162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2018 Red Hat Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1262306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2162306a36Sopenharmony_ci */
2262306a36Sopenharmony_ci#include "head.h"
2362306a36Sopenharmony_ci#include "atom.h"
2462306a36Sopenharmony_ci#include "core.h"
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#include <nvif/pushc37b.h>
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#include <nvhw/class/clc37d.h>
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistatic int
3162306a36Sopenharmony_ciheadc37d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
3262306a36Sopenharmony_ci{
3362306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
3462306a36Sopenharmony_ci	const int i = head->base.index;
3562306a36Sopenharmony_ci	u8 depth;
3662306a36Sopenharmony_ci	int ret;
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci	/*XXX: This is a dirty hack until OR depth handling is
3962306a36Sopenharmony_ci	 *     improved later for deep colour etc.
4062306a36Sopenharmony_ci	 */
4162306a36Sopenharmony_ci	switch (asyh->or.depth) {
4262306a36Sopenharmony_ci	case 6: depth = 5; break;
4362306a36Sopenharmony_ci	case 5: depth = 4; break;
4462306a36Sopenharmony_ci	case 2: depth = 1; break;
4562306a36Sopenharmony_ci	case 0:	depth = 4; break;
4662306a36Sopenharmony_ci	default:
4762306a36Sopenharmony_ci		depth = asyh->or.depth;
4862306a36Sopenharmony_ci		WARN_ON(1);
4962306a36Sopenharmony_ci		break;
5062306a36Sopenharmony_ci	}
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
5362306a36Sopenharmony_ci		return ret;
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE(i),
5662306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, CRC_MODE, asyh->or.crc_raster) |
5762306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, HSYNC_POLARITY, asyh->or.nhsync) |
5862306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, VSYNC_POLARITY, asyh->or.nvsync) |
5962306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, PIXEL_DEPTH, depth) |
6062306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_OUTPUT_RESOURCE, COLOR_SPACE_OVERRIDE, DISABLE));
6162306a36Sopenharmony_ci	return 0;
6262306a36Sopenharmony_ci}
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_cistatic int
6562306a36Sopenharmony_ciheadc37d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
6662306a36Sopenharmony_ci{
6762306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
6862306a36Sopenharmony_ci	const int i = head->base.index;
6962306a36Sopenharmony_ci	int ret;
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
7262306a36Sopenharmony_ci		return ret;
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_PROCAMP(i),
7562306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_PROCAMP, COLOR_SPACE, RGB) |
7662306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_PROCAMP, CHROMA_LPF, DISABLE) |
7762306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_PROCAMP, SAT_COS, asyh->procamp.sat.cos) |
7862306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_PROCAMP, SAT_SINE, asyh->procamp.sat.sin) |
7962306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_PROCAMP, DYNAMIC_RANGE, VESA) |
8062306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_PROCAMP, RANGE_COMPRESSION, DISABLE) |
8162306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_PROCAMP, BLACK_LEVEL, GRAPHICS));
8262306a36Sopenharmony_ci	return 0;
8362306a36Sopenharmony_ci}
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciint
8662306a36Sopenharmony_ciheadc37d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
8762306a36Sopenharmony_ci{
8862306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
8962306a36Sopenharmony_ci	const int i = head->base.index;
9062306a36Sopenharmony_ci	int ret;
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
9362306a36Sopenharmony_ci		return ret;
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_DITHER_CONTROL(i),
9662306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, ENABLE, asyh->dither.enable) |
9762306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, BITS, asyh->dither.bits) |
9862306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_DITHER_CONTROL, OFFSET_ENABLE, DISABLE) |
9962306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, MODE, asyh->dither.mode) |
10062306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_DITHER_CONTROL, PHASE, 0));
10162306a36Sopenharmony_ci	return 0;
10262306a36Sopenharmony_ci}
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciint
10562306a36Sopenharmony_ciheadc37d_curs_clr(struct nv50_head *head)
10662306a36Sopenharmony_ci{
10762306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
10862306a36Sopenharmony_ci	const int i = head->base.index;
10962306a36Sopenharmony_ci	int ret;
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 4)))
11262306a36Sopenharmony_ci		return ret;
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_CURSOR(i),
11562306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, ENABLE, DISABLE) |
11662306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, FORMAT, A8R8G8B8));
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_CURSOR(i, 0), 0x00000000);
11962306a36Sopenharmony_ci	return 0;
12062306a36Sopenharmony_ci}
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciint
12362306a36Sopenharmony_ciheadc37d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
12462306a36Sopenharmony_ci{
12562306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
12662306a36Sopenharmony_ci	const int i = head->base.index;
12762306a36Sopenharmony_ci	int ret;
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 7)))
13062306a36Sopenharmony_ci		return ret;
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_CURSOR(i),
13362306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, ENABLE, ENABLE) |
13462306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, FORMAT, asyh->curs.format) |
13562306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, SIZE, asyh->curs.layout) |
13662306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_X, 0) |
13762306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_Y, 0) |
13862306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR, DE_GAMMA, NONE),
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci				HEAD_SET_CONTROL_CURSOR_COMPOSITION(i),
14162306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, K1, 0xff) |
14262306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, CURSOR_COLOR_FACTOR_SELECT,
14362306a36Sopenharmony_ci								     K1) |
14462306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, VIEWPORT_COLOR_FACTOR_SELECT,
14562306a36Sopenharmony_ci								     NEG_K1_TIMES_SRC) |
14662306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_CONTROL_CURSOR_COMPOSITION, MODE, BLEND));
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_CURSOR(i, 0), asyh->curs.handle);
14962306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_OFFSET_CURSOR(i, 0), asyh->curs.offset >> 8);
15062306a36Sopenharmony_ci	return 0;
15162306a36Sopenharmony_ci}
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ciint
15462306a36Sopenharmony_ciheadc37d_curs_format(struct nv50_head *head, struct nv50_wndw_atom *asyw,
15562306a36Sopenharmony_ci		     struct nv50_head_atom *asyh)
15662306a36Sopenharmony_ci{
15762306a36Sopenharmony_ci	asyh->curs.format = asyw->image.format;
15862306a36Sopenharmony_ci	return 0;
15962306a36Sopenharmony_ci}
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_cistatic int
16262306a36Sopenharmony_ciheadc37d_olut_clr(struct nv50_head *head)
16362306a36Sopenharmony_ci{
16462306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
16562306a36Sopenharmony_ci	const int i = head->base.index;
16662306a36Sopenharmony_ci	int ret;
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
16962306a36Sopenharmony_ci		return ret;
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTEXT_DMA_OUTPUT_LUT(i), 0x00000000);
17262306a36Sopenharmony_ci	return 0;
17362306a36Sopenharmony_ci}
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_cistatic int
17662306a36Sopenharmony_ciheadc37d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
17762306a36Sopenharmony_ci{
17862306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
17962306a36Sopenharmony_ci	const int i = head->base.index;
18062306a36Sopenharmony_ci	int ret;
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 4)))
18362306a36Sopenharmony_ci		return ret;
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT(i),
18662306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT, SIZE, asyh->olut.size) |
18762306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT, RANGE, asyh->olut.range) |
18862306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_CONTROL_OUTPUT_LUT, OUTPUT_MODE, asyh->olut.output_mode),
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci				HEAD_SET_OFFSET_OUTPUT_LUT(i), asyh->olut.offset >> 8,
19162306a36Sopenharmony_ci				HEAD_SET_CONTEXT_DMA_OUTPUT_LUT(i), asyh->olut.handle);
19262306a36Sopenharmony_ci	return 0;
19362306a36Sopenharmony_ci}
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_cistatic bool
19662306a36Sopenharmony_ciheadc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
19762306a36Sopenharmony_ci{
19862306a36Sopenharmony_ci	if (size != 256 && size != 1024)
19962306a36Sopenharmony_ci		return false;
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	asyh->olut.size = size == 1024 ? NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_SIZE_SIZE_1025 :
20262306a36Sopenharmony_ci					 NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_SIZE_SIZE_257;
20362306a36Sopenharmony_ci	asyh->olut.range = NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_RANGE_UNITY;
20462306a36Sopenharmony_ci	asyh->olut.output_mode = NVC37D_HEAD_SET_CONTROL_OUTPUT_LUT_OUTPUT_MODE_INTERPOLATE;
20562306a36Sopenharmony_ci	asyh->olut.load = head907d_olut_load;
20662306a36Sopenharmony_ci	return true;
20762306a36Sopenharmony_ci}
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_cistatic int
21062306a36Sopenharmony_ciheadc37d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
21162306a36Sopenharmony_ci{
21262306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
21362306a36Sopenharmony_ci	struct nv50_head_mode *m = &asyh->mode;
21462306a36Sopenharmony_ci	const int i = head->base.index;
21562306a36Sopenharmony_ci	int ret;
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 15)))
21862306a36Sopenharmony_ci		return ret;
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_RASTER_SIZE(i),
22162306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_SIZE, WIDTH, m->h.active) |
22262306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_SIZE, HEIGHT, m->v.active),
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci				HEAD_SET_RASTER_SYNC_END(i),
22562306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_SYNC_END, X, m->h.synce) |
22662306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_SYNC_END, Y, m->v.synce),
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci				HEAD_SET_RASTER_BLANK_END(i),
22962306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_END, X, m->h.blanke) |
23062306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_END, Y, m->v.blanke),
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci				HEAD_SET_RASTER_BLANK_START(i),
23362306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_START, X, m->h.blanks) |
23462306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_RASTER_BLANK_START, Y, m->v.blanks));
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci	//XXX:
23762306a36Sopenharmony_ci	PUSH_NVSQ(push, NVC37D, 0x2074 + (i * 0x400), m->v.blank2e << 16 | m->v.blank2s);
23862306a36Sopenharmony_ci	PUSH_NVSQ(push, NVC37D, 0x2008 + (i * 0x400), m->interlace);
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY(i),
24162306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY, HERTZ, m->clock * 1000));
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX(i),
24462306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX, HERTZ, m->clock * 1000));
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci	/*XXX: HEAD_USAGE_BOUNDS, doesn't belong here. */
24762306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS(i),
24862306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS, CURSOR, USAGE_W256_H256) |
24962306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS, OUTPUT_LUT, USAGE_1025) |
25062306a36Sopenharmony_ci		  NVDEF(NVC37D, HEAD_SET_HEAD_USAGE_BOUNDS, UPSCALING_ALLOWED, TRUE));
25162306a36Sopenharmony_ci	return 0;
25262306a36Sopenharmony_ci}
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ciint
25562306a36Sopenharmony_ciheadc37d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
25662306a36Sopenharmony_ci{
25762306a36Sopenharmony_ci	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
25862306a36Sopenharmony_ci	const int i = head->base.index;
25962306a36Sopenharmony_ci	int ret;
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 4)))
26262306a36Sopenharmony_ci		return ret;
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_VIEWPORT_SIZE_IN(i),
26562306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_IN, WIDTH, asyh->view.iW) |
26662306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_IN, HEIGHT, asyh->view.iH));
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	PUSH_MTHD(push, NVC37D, HEAD_SET_VIEWPORT_SIZE_OUT(i),
26962306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_OUT, WIDTH, asyh->view.oW) |
27062306a36Sopenharmony_ci		  NVVAL(NVC37D, HEAD_SET_VIEWPORT_SIZE_OUT, HEIGHT, asyh->view.oH));
27162306a36Sopenharmony_ci	return 0;
27262306a36Sopenharmony_ci}
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_civoid
27562306a36Sopenharmony_ciheadc37d_static_wndw_map(struct nv50_head *head, struct nv50_head_atom *asyh)
27662306a36Sopenharmony_ci{
27762306a36Sopenharmony_ci	int i, end;
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci	for (i = head->base.index * 2, end = i + 2; i < end; i++)
28062306a36Sopenharmony_ci		asyh->wndw.owned |= BIT(i);
28162306a36Sopenharmony_ci}
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ciconst struct nv50_head_func
28462306a36Sopenharmony_ciheadc37d = {
28562306a36Sopenharmony_ci	.view = headc37d_view,
28662306a36Sopenharmony_ci	.mode = headc37d_mode,
28762306a36Sopenharmony_ci	.olut = headc37d_olut,
28862306a36Sopenharmony_ci	.ilut_check = head907d_ilut_check,
28962306a36Sopenharmony_ci	.olut_size = 1024,
29062306a36Sopenharmony_ci	.olut_set = headc37d_olut_set,
29162306a36Sopenharmony_ci	.olut_clr = headc37d_olut_clr,
29262306a36Sopenharmony_ci	.curs_layout = head917d_curs_layout,
29362306a36Sopenharmony_ci	.curs_format = headc37d_curs_format,
29462306a36Sopenharmony_ci	.curs_set = headc37d_curs_set,
29562306a36Sopenharmony_ci	.curs_clr = headc37d_curs_clr,
29662306a36Sopenharmony_ci	.dither = headc37d_dither,
29762306a36Sopenharmony_ci	.procamp = headc37d_procamp,
29862306a36Sopenharmony_ci	.or = headc37d_or,
29962306a36Sopenharmony_ci	.static_wndw_map = headc37d_static_wndw_map,
30062306a36Sopenharmony_ci};
301