xref: /openbmc/linux/drivers/gpu/drm/nouveau/dispnv50/base827c.c (revision ccd27db8c731817ef36e75de2b5fdc2e79550213)
1*ccd27db8SBen Skeggs /*
2*ccd27db8SBen Skeggs  * Copyright 2018 Red Hat Inc.
3*ccd27db8SBen Skeggs  *
4*ccd27db8SBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5*ccd27db8SBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6*ccd27db8SBen Skeggs  * to deal in the Software without restriction, including without limitation
7*ccd27db8SBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*ccd27db8SBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9*ccd27db8SBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10*ccd27db8SBen Skeggs  *
11*ccd27db8SBen Skeggs  * The above copyright notice and this permission notice shall be included in
12*ccd27db8SBen Skeggs  * all copies or substantial portions of the Software.
13*ccd27db8SBen Skeggs  *
14*ccd27db8SBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*ccd27db8SBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*ccd27db8SBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*ccd27db8SBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*ccd27db8SBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*ccd27db8SBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*ccd27db8SBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21*ccd27db8SBen Skeggs  */
22*ccd27db8SBen Skeggs #include "base.h"
23*ccd27db8SBen Skeggs 
24*ccd27db8SBen Skeggs static void
25*ccd27db8SBen Skeggs base827c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
26*ccd27db8SBen Skeggs {
27*ccd27db8SBen Skeggs 	u32 *push;
28*ccd27db8SBen Skeggs 	if ((push = evo_wait(&wndw->wndw, 10))) {
29*ccd27db8SBen Skeggs 		evo_mthd(push, 0x0084, 1);
30*ccd27db8SBen Skeggs 		evo_data(push, asyw->image.mode << 8 |
31*ccd27db8SBen Skeggs 			       asyw->image.interval << 4);
32*ccd27db8SBen Skeggs 		evo_mthd(push, 0x00c0, 1);
33*ccd27db8SBen Skeggs 		evo_data(push, asyw->image.handle);
34*ccd27db8SBen Skeggs 		evo_mthd(push, 0x0800, 5);
35*ccd27db8SBen Skeggs 		evo_data(push, asyw->image.offset >> 8);
36*ccd27db8SBen Skeggs 		evo_data(push, 0x00000000);
37*ccd27db8SBen Skeggs 		evo_data(push, asyw->image.h << 16 | asyw->image.w);
38*ccd27db8SBen Skeggs 		evo_data(push, asyw->image.layout << 20 |
39*ccd27db8SBen Skeggs 			       asyw->image.pitch |
40*ccd27db8SBen Skeggs 			       asyw->image.block);
41*ccd27db8SBen Skeggs 		evo_data(push, asyw->image.format << 8);
42*ccd27db8SBen Skeggs 		evo_kick(push, &wndw->wndw);
43*ccd27db8SBen Skeggs 	}
44*ccd27db8SBen Skeggs }
45*ccd27db8SBen Skeggs 
46*ccd27db8SBen Skeggs static const struct nv50_wndw_func
47*ccd27db8SBen Skeggs base827c = {
48*ccd27db8SBen Skeggs 	.acquire = base507c_acquire,
49*ccd27db8SBen Skeggs 	.release = base507c_release,
50*ccd27db8SBen Skeggs 	.sema_set = base507c_sema_set,
51*ccd27db8SBen Skeggs 	.sema_clr = base507c_sema_clr,
52*ccd27db8SBen Skeggs 	.ntfy_reset = base507c_ntfy_reset,
53*ccd27db8SBen Skeggs 	.ntfy_set = base507c_ntfy_set,
54*ccd27db8SBen Skeggs 	.ntfy_clr = base507c_ntfy_clr,
55*ccd27db8SBen Skeggs 	.ntfy_wait_begun = base507c_ntfy_wait_begun,
56*ccd27db8SBen Skeggs 	.image_set = base827c_image_set,
57*ccd27db8SBen Skeggs 	.image_clr = base507c_image_clr,
58*ccd27db8SBen Skeggs 	.lut = base507c_lut,
59*ccd27db8SBen Skeggs 	.update = base507c_update,
60*ccd27db8SBen Skeggs };
61*ccd27db8SBen Skeggs 
62*ccd27db8SBen Skeggs int
63*ccd27db8SBen Skeggs base827c_new(struct nouveau_drm *drm, int head, s32 oclass,
64*ccd27db8SBen Skeggs 	     struct nv50_wndw **pwndw)
65*ccd27db8SBen Skeggs {
66*ccd27db8SBen Skeggs 	return base507c_new_(&base827c, base507c_format, drm, head, oclass, pwndw);
67*ccd27db8SBen Skeggs }
68