xref: /OK3568_Linux_fs/kernel/drivers/gpu/drm/nouveau/dispnv50/headc37d.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 2018 Red Hat Inc.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
5*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
6*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
7*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
9*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included in
12*4882a593Smuzhiyun  * all copies or substantial portions of the Software.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*4882a593Smuzhiyun  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*4882a593Smuzhiyun  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*4882a593Smuzhiyun  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*4882a593Smuzhiyun  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*4882a593Smuzhiyun  * OTHER DEALINGS IN THE SOFTWARE.
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun #include "head.h"
23*4882a593Smuzhiyun #include "atom.h"
24*4882a593Smuzhiyun #include "core.h"
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include <nvif/pushc37b.h>
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #include <nvhw/class/clc37d.h>
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun static int
headc37d_or(struct nv50_head * head,struct nv50_head_atom * asyh)31*4882a593Smuzhiyun headc37d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
32*4882a593Smuzhiyun {
33*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
34*4882a593Smuzhiyun 	const int i = head->base.index;
35*4882a593Smuzhiyun 	u8 depth;
36*4882a593Smuzhiyun 	int ret;
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun 	/*XXX: This is a dirty hack until OR depth handling is
39*4882a593Smuzhiyun 	 *     improved later for deep colour etc.
40*4882a593Smuzhiyun 	 */
41*4882a593Smuzhiyun 	switch (asyh->or.depth) {
42*4882a593Smuzhiyun 	case 6: depth = 5; break;
43*4882a593Smuzhiyun 	case 5: depth = 4; break;
44*4882a593Smuzhiyun 	case 2: depth = 1; break;
45*4882a593Smuzhiyun 	case 0:	depth = 4; break;
46*4882a593Smuzhiyun 	default:
47*4882a593Smuzhiyun 		depth = asyh->or.depth;
48*4882a593Smuzhiyun 		WARN_ON(1);
49*4882a593Smuzhiyun 		break;
50*4882a593Smuzhiyun 	}
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 2)))
53*4882a593Smuzhiyun 		return ret;
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE(i),
56*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, CRC_MODE, asyh->or.crc_raster) |
57*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, HSYNC_POLARITY, asyh->or.nhsync) |
58*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, VSYNC_POLARITY, asyh->or.nvsync) |
59*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, PIXEL_DEPTH, depth) |
60*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, COLOR_SPACE_OVERRIDE, DISABLE));
61*4882a593Smuzhiyun 	return 0;
62*4882a593Smuzhiyun }
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun static int
headc37d_procamp(struct nv50_head * head,struct nv50_head_atom * asyh)65*4882a593Smuzhiyun headc37d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
66*4882a593Smuzhiyun {
67*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
68*4882a593Smuzhiyun 	const int i = head->base.index;
69*4882a593Smuzhiyun 	int ret;
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 2)))
72*4882a593Smuzhiyun 		return ret;
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_PROCAMP(i),
75*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_PROCAMP, COLOR_SPACE, RGB) |
76*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_PROCAMP, CHROMA_LPF, DISABLE) |
77*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_PROCAMP, SAT_COS, asyh->procamp.sat.cos) |
78*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_PROCAMP, SAT_SINE, asyh->procamp.sat.sin) |
79*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_PROCAMP, DYNAMIC_RANGE, VESA) |
80*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_PROCAMP, RANGE_COMPRESSION, DISABLE) |
81*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_PROCAMP, BLACK_LEVEL, GRAPHICS));
82*4882a593Smuzhiyun 	return 0;
83*4882a593Smuzhiyun }
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun int
headc37d_dither(struct nv50_head * head,struct nv50_head_atom * asyh)86*4882a593Smuzhiyun headc37d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
87*4882a593Smuzhiyun {
88*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
89*4882a593Smuzhiyun 	const int i = head->base.index;
90*4882a593Smuzhiyun 	int ret;
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 2)))
93*4882a593Smuzhiyun 		return ret;
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_DITHER_CONTROL(i),
96*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, ENABLE, asyh->dither.enable) |
97*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, BITS, asyh->dither.bits) |
98*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_DITHER_CONTROL, OFFSET_ENABLE, DISABLE) |
99*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, MODE, asyh->dither.mode) |
100*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, PHASE, 0));
101*4882a593Smuzhiyun 	return 0;
102*4882a593Smuzhiyun }
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun int
headc37d_curs_clr(struct nv50_head * head)105*4882a593Smuzhiyun headc37d_curs_clr(struct nv50_head *head)
106*4882a593Smuzhiyun {
107*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
108*4882a593Smuzhiyun 	const int i = head->base.index;
109*4882a593Smuzhiyun 	int ret;
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 4)))
112*4882a593Smuzhiyun 		return ret;
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_CURSOR(i),
115*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, ENABLE, DISABLE) |
116*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, FORMAT, A8R8G8B8));
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_CURSOR(i, 0), 0x00000000);
119*4882a593Smuzhiyun 	return 0;
120*4882a593Smuzhiyun }
121*4882a593Smuzhiyun 
122*4882a593Smuzhiyun int
headc37d_curs_set(struct nv50_head * head,struct nv50_head_atom * asyh)123*4882a593Smuzhiyun headc37d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
124*4882a593Smuzhiyun {
125*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
126*4882a593Smuzhiyun 	const int i = head->base.index;
127*4882a593Smuzhiyun 	int ret;
128*4882a593Smuzhiyun 
129*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 7)))
130*4882a593Smuzhiyun 		return ret;
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_CURSOR(i),
133*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, ENABLE, ENABLE) |
134*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, FORMAT, asyh->curs.format) |
135*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, SIZE, asyh->curs.layout) |
136*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_X, 0) |
137*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_Y, 0) |
138*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, DE_GAMMA, NONE),
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun 				HEAD_SET_CONTROL_CURSOR_COMPOSITION(i),
141*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, K1, 0xff) |
142*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, CURSOR_COLOR_FACTOR_SELECT,
143*4882a593Smuzhiyun 								     K1) |
144*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, VIEWPORT_COLOR_FACTOR_SELECT,
145*4882a593Smuzhiyun 								     NEG_K1_TIMES_SRC) |
146*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, MODE, BLEND));
147*4882a593Smuzhiyun 
148*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_CURSOR(i, 0), asyh->curs.handle);
149*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_OFFSET_CURSOR(i, 0), asyh->curs.offset >> 8);
150*4882a593Smuzhiyun 	return 0;
151*4882a593Smuzhiyun }
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun int
headc37d_curs_format(struct nv50_head * head,struct nv50_wndw_atom * asyw,struct nv50_head_atom * asyh)154*4882a593Smuzhiyun headc37d_curs_format(struct nv50_head *head, struct nv50_wndw_atom *asyw,
155*4882a593Smuzhiyun 		     struct nv50_head_atom *asyh)
156*4882a593Smuzhiyun {
157*4882a593Smuzhiyun 	asyh->curs.format = asyw->image.format;
158*4882a593Smuzhiyun 	return 0;
159*4882a593Smuzhiyun }
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun static int
headc37d_olut_clr(struct nv50_head * head)162*4882a593Smuzhiyun headc37d_olut_clr(struct nv50_head *head)
163*4882a593Smuzhiyun {
164*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
165*4882a593Smuzhiyun 	const int i = head->base.index;
166*4882a593Smuzhiyun 	int ret;
167*4882a593Smuzhiyun 
168*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 2)))
169*4882a593Smuzhiyun 		return ret;
170*4882a593Smuzhiyun 
171*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_OUTPUT_LUT(i), 0x00000000);
172*4882a593Smuzhiyun 	return 0;
173*4882a593Smuzhiyun }
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun static int
headc37d_olut_set(struct nv50_head * head,struct nv50_head_atom * asyh)176*4882a593Smuzhiyun headc37d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
177*4882a593Smuzhiyun {
178*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
179*4882a593Smuzhiyun 	const int i = head->base.index;
180*4882a593Smuzhiyun 	int ret;
181*4882a593Smuzhiyun 
182*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 4)))
183*4882a593Smuzhiyun 		return ret;
184*4882a593Smuzhiyun 
185*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT(i),
186*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT, SIZE, asyh->olut.size) |
187*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT, RANGE, asyh->olut.range) |
188*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT, OUTPUT_MODE, asyh->olut.output_mode),
189*4882a593Smuzhiyun 
190*4882a593Smuzhiyun 				HEAD_SET_OFFSET_OUTPUT_LUT(i), asyh->olut.offset >> 8,
191*4882a593Smuzhiyun 				HEAD_SET_CONTEXT_DMA_OUTPUT_LUT(i), asyh->olut.handle);
192*4882a593Smuzhiyun 	return 0;
193*4882a593Smuzhiyun }
194*4882a593Smuzhiyun 
195*4882a593Smuzhiyun static bool
headc37d_olut(struct nv50_head * head,struct nv50_head_atom * asyh,int size)196*4882a593Smuzhiyun headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
197*4882a593Smuzhiyun {
198*4882a593Smuzhiyun 	if (size != 256 && size != 1024)
199*4882a593Smuzhiyun 		return false;
200*4882a593Smuzhiyun 
201*4882a593Smuzhiyun 	asyh->olut.size = size == 1024 ? NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_SIZE_SIZE_1025 :
202*4882a593Smuzhiyun 					 NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_SIZE_SIZE_257;
203*4882a593Smuzhiyun 	asyh->olut.range = NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_RANGE_UNITY;
204*4882a593Smuzhiyun 	asyh->olut.output_mode = NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_OUTPUT_MODE_INTERPOLATE;
205*4882a593Smuzhiyun 	asyh->olut.load = head907d_olut_load;
206*4882a593Smuzhiyun 	return true;
207*4882a593Smuzhiyun }
208*4882a593Smuzhiyun 
209*4882a593Smuzhiyun static int
headc37d_mode(struct nv50_head * head,struct nv50_head_atom * asyh)210*4882a593Smuzhiyun headc37d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
211*4882a593Smuzhiyun {
212*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
213*4882a593Smuzhiyun 	struct nv50_head_mode *m = &asyh->mode;
214*4882a593Smuzhiyun 	const int i = head->base.index;
215*4882a593Smuzhiyun 	int ret;
216*4882a593Smuzhiyun 
217*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 15)))
218*4882a593Smuzhiyun 		return ret;
219*4882a593Smuzhiyun 
220*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_RASTER_SIZE(i),
221*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_SIZE, WIDTH, m->h.active) |
222*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_SIZE, HEIGHT, m->v.active),
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun 				HEAD_SET_RASTER_SYNC_END(i),
225*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_SYNC_END, X, m->h.synce) |
226*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_SYNC_END, Y, m->v.synce),
227*4882a593Smuzhiyun 
228*4882a593Smuzhiyun 				HEAD_SET_RASTER_BLANK_END(i),
229*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_END, X, m->h.blanke) |
230*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_END, Y, m->v.blanke),
231*4882a593Smuzhiyun 
232*4882a593Smuzhiyun 				HEAD_SET_RASTER_BLANK_START(i),
233*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_START, X, m->h.blanks) |
234*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_START, Y, m->v.blanks));
235*4882a593Smuzhiyun 
236*4882a593Smuzhiyun 	//XXX:
237*4882a593Smuzhiyun 	PUSH_NVSQ(push, NVC37D, 0x2074 + (i * 0x400), m->v.blank2e << 16 | m->v.blank2s);
238*4882a593Smuzhiyun 	PUSH_NVSQ(push, NVC37D, 0x2008 + (i * 0x400), m->interlace);
239*4882a593Smuzhiyun 
240*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY(i),
241*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY, HERTZ, m->clock * 1000));
242*4882a593Smuzhiyun 
243*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX(i),
244*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX, HERTZ, m->clock * 1000));
245*4882a593Smuzhiyun 
246*4882a593Smuzhiyun 	/*XXX: HEAD_USAGE_BOUNDS, doesn't belong here. */
247*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS(i),
248*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS, CURSOR, USAGE_W256_H256) |
249*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS, OUTPUT_LUT, USAGE_1025) |
250*4882a593Smuzhiyun 		  NVDEF(NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS, UPSCALING_ALLOWED, TRUE));
251*4882a593Smuzhiyun 	return 0;
252*4882a593Smuzhiyun }
253*4882a593Smuzhiyun 
254*4882a593Smuzhiyun int
headc37d_view(struct nv50_head * head,struct nv50_head_atom * asyh)255*4882a593Smuzhiyun headc37d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
256*4882a593Smuzhiyun {
257*4882a593Smuzhiyun 	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
258*4882a593Smuzhiyun 	const int i = head->base.index;
259*4882a593Smuzhiyun 	int ret;
260*4882a593Smuzhiyun 
261*4882a593Smuzhiyun 	if ((ret = PUSH_WAIT(push, 4)))
262*4882a593Smuzhiyun 		return ret;
263*4882a593Smuzhiyun 
264*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_VIEWPORT_SIZE_IN(i),
265*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_IN, WIDTH, asyh->view.iW) |
266*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_IN, HEIGHT, asyh->view.iH));
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun 	PUSH_MTHD(push, NVC37D, HEAD_SET_VIEWPORT_SIZE_OUT(i),
269*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_OUT, WIDTH, asyh->view.oW) |
270*4882a593Smuzhiyun 		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_OUT, HEIGHT, asyh->view.oH));
271*4882a593Smuzhiyun 	return 0;
272*4882a593Smuzhiyun }
273*4882a593Smuzhiyun 
274*4882a593Smuzhiyun void
headc37d_static_wndw_map(struct nv50_head * head,struct nv50_head_atom * asyh)275*4882a593Smuzhiyun headc37d_static_wndw_map(struct nv50_head *head, struct nv50_head_atom *asyh)
276*4882a593Smuzhiyun {
277*4882a593Smuzhiyun 	int i, end;
278*4882a593Smuzhiyun 
279*4882a593Smuzhiyun 	for (i = head->base.index * 2, end = i + 2; i < end; i++)
280*4882a593Smuzhiyun 		asyh->wndw.owned |= BIT(i);
281*4882a593Smuzhiyun }
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun const struct nv50_head_func
284*4882a593Smuzhiyun headc37d = {
285*4882a593Smuzhiyun 	.view = headc37d_view,
286*4882a593Smuzhiyun 	.mode = headc37d_mode,
287*4882a593Smuzhiyun 	.olut = headc37d_olut,
288*4882a593Smuzhiyun 	.olut_size = 1024,
289*4882a593Smuzhiyun 	.olut_set = headc37d_olut_set,
290*4882a593Smuzhiyun 	.olut_clr = headc37d_olut_clr,
291*4882a593Smuzhiyun 	.curs_layout = head917d_curs_layout,
292*4882a593Smuzhiyun 	.curs_format = headc37d_curs_format,
293*4882a593Smuzhiyun 	.curs_set = headc37d_curs_set,
294*4882a593Smuzhiyun 	.curs_clr = headc37d_curs_clr,
295*4882a593Smuzhiyun 	.dither = headc37d_dither,
296*4882a593Smuzhiyun 	.procamp = headc37d_procamp,
297*4882a593Smuzhiyun 	.or = headc37d_or,
298*4882a593Smuzhiyun 	.static_wndw_map = headc37d_static_wndw_map,
299*4882a593Smuzhiyun };
300