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 "base.h"
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#include <nvif/if0014.h>
2562306a36Sopenharmony_ci#include <nvif/push507c.h>
2662306a36Sopenharmony_ci#include <nvif/timer.h>
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#include <nvhw/class/cl507c.h>
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#include <drm/drm_atomic_helper.h>
3162306a36Sopenharmony_ci#include <drm/drm_fourcc.h>
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#include "nouveau_bo.h"
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciint
3662306a36Sopenharmony_cibase507c_update(struct nv50_wndw *wndw, u32 *interlock)
3762306a36Sopenharmony_ci{
3862306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
3962306a36Sopenharmony_ci	int ret;
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
4262306a36Sopenharmony_ci		return ret;
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, UPDATE, interlock[NV50_DISP_INTERLOCK_CORE]);
4562306a36Sopenharmony_ci	return PUSH_KICK(push);
4662306a36Sopenharmony_ci}
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciint
4962306a36Sopenharmony_cibase507c_image_clr(struct nv50_wndw *wndw)
5062306a36Sopenharmony_ci{
5162306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
5262306a36Sopenharmony_ci	int ret;
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 4)))
5562306a36Sopenharmony_ci		return ret;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_PRESENT_CONTROL,
5862306a36Sopenharmony_ci		  NVDEF(NV507C, SET_PRESENT_CONTROL, BEGIN_MODE, NON_TEARING) |
5962306a36Sopenharmony_ci		  NVVAL(NV507C, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, 0));
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_CONTEXT_DMA_ISO, 0x00000000);
6262306a36Sopenharmony_ci	return 0;
6362306a36Sopenharmony_ci}
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_cistatic int
6662306a36Sopenharmony_cibase507c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
6762306a36Sopenharmony_ci{
6862306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
6962306a36Sopenharmony_ci	int ret;
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 13)))
7262306a36Sopenharmony_ci		return ret;
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_PRESENT_CONTROL,
7562306a36Sopenharmony_ci		  NVVAL(NV507C, SET_PRESENT_CONTROL, BEGIN_MODE, asyw->image.mode) |
7662306a36Sopenharmony_ci		  NVVAL(NV507C, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval));
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_CONTEXT_DMA_ISO, asyw->image.handle[0]);
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci	if (asyw->image.format == NV507C_SURFACE_SET_PARAMS_FORMAT_RF16_GF16_BF16_AF16) {
8162306a36Sopenharmony_ci		PUSH_MTHD(push, NV507C, SET_PROCESSING,
8262306a36Sopenharmony_ci			  NVDEF(NV507C, SET_PROCESSING, USE_GAIN_OFS, ENABLE),
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci					SET_CONVERSION,
8562306a36Sopenharmony_ci			  NVVAL(NV507C, SET_CONVERSION, GAIN, 0) |
8662306a36Sopenharmony_ci			  NVVAL(NV507C, SET_CONVERSION, OFS, 0x64));
8762306a36Sopenharmony_ci	} else {
8862306a36Sopenharmony_ci		PUSH_MTHD(push, NV507C, SET_PROCESSING,
8962306a36Sopenharmony_ci			  NVDEF(NV507C, SET_PROCESSING, USE_GAIN_OFS, DISABLE),
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci					SET_CONVERSION,
9262306a36Sopenharmony_ci			  NVVAL(NV507C, SET_CONVERSION, GAIN, 0) |
9362306a36Sopenharmony_ci			  NVVAL(NV507C, SET_CONVERSION, OFS, 0));
9462306a36Sopenharmony_ci	}
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SURFACE_SET_OFFSET(0, 0), asyw->image.offset[0] >> 8);
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SURFACE_SET_SIZE(0),
9962306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_SIZE, WIDTH, asyw->image.w) |
10062306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_SIZE, HEIGHT, asyw->image.h),
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci				SURFACE_SET_STORAGE(0),
10362306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout) |
10462306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_STORAGE, PITCH, asyw->image.pitch[0] >> 8) |
10562306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) |
10662306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh),
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci				SURFACE_SET_PARAMS(0),
10962306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) |
11062306a36Sopenharmony_ci		  NVDEF(NV507C, SURFACE_SET_PARAMS, SUPER_SAMPLE, X1_AA) |
11162306a36Sopenharmony_ci		  NVDEF(NV507C, SURFACE_SET_PARAMS, GAMMA, LINEAR) |
11262306a36Sopenharmony_ci		  NVDEF(NV507C, SURFACE_SET_PARAMS, LAYOUT, FRM) |
11362306a36Sopenharmony_ci		  NVVAL(NV507C, SURFACE_SET_PARAMS, KIND, asyw->image.kind) |
11462306a36Sopenharmony_ci		  NVDEF(NV507C, SURFACE_SET_PARAMS, PART_STRIDE, PARTSTRIDE_256));
11562306a36Sopenharmony_ci	return 0;
11662306a36Sopenharmony_ci}
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ciint
11962306a36Sopenharmony_cibase507c_xlut_clr(struct nv50_wndw *wndw)
12062306a36Sopenharmony_ci{
12162306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
12262306a36Sopenharmony_ci	int ret;
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
12562306a36Sopenharmony_ci		return ret;
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_BASE_LUT_LO,
12862306a36Sopenharmony_ci		  NVDEF(NV507C, SET_BASE_LUT_LO, ENABLE, DISABLE));
12962306a36Sopenharmony_ci	return 0;
13062306a36Sopenharmony_ci}
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ciint
13362306a36Sopenharmony_cibase507c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
13462306a36Sopenharmony_ci{
13562306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
13662306a36Sopenharmony_ci	int ret;
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
13962306a36Sopenharmony_ci		return ret;
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_BASE_LUT_LO,
14262306a36Sopenharmony_ci		  NVDEF(NV507C, SET_BASE_LUT_LO, ENABLE, USE_CORE_LUT));
14362306a36Sopenharmony_ci	return 0;
14462306a36Sopenharmony_ci}
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ciint
14762306a36Sopenharmony_cibase507c_ntfy_wait_begun(struct nouveau_bo *bo, u32 offset,
14862306a36Sopenharmony_ci			 struct nvif_device *device)
14962306a36Sopenharmony_ci{
15062306a36Sopenharmony_ci	s64 time = nvif_msec(device, 2000ULL,
15162306a36Sopenharmony_ci		if (NVBO_TD32(bo, offset, NV_DISP_BASE_NOTIFIER_1, _0, STATUS, ==, BEGUN))
15262306a36Sopenharmony_ci			break;
15362306a36Sopenharmony_ci		usleep_range(1, 2);
15462306a36Sopenharmony_ci	);
15562306a36Sopenharmony_ci	return time < 0 ? time : 0;
15662306a36Sopenharmony_ci}
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ciint
15962306a36Sopenharmony_cibase507c_ntfy_clr(struct nv50_wndw *wndw)
16062306a36Sopenharmony_ci{
16162306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
16262306a36Sopenharmony_ci	int ret;
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
16562306a36Sopenharmony_ci		return ret;
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_CONTEXT_DMA_NOTIFIER, 0x00000000);
16862306a36Sopenharmony_ci	return 0;
16962306a36Sopenharmony_ci}
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ciint
17262306a36Sopenharmony_cibase507c_ntfy_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
17362306a36Sopenharmony_ci{
17462306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
17562306a36Sopenharmony_ci	int ret;
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 3)))
17862306a36Sopenharmony_ci		return ret;
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_NOTIFIER_CONTROL,
18162306a36Sopenharmony_ci		  NVVAL(NV507C, SET_NOTIFIER_CONTROL, MODE, asyw->ntfy.awaken) |
18262306a36Sopenharmony_ci		  NVVAL(NV507C, SET_NOTIFIER_CONTROL, OFFSET, asyw->ntfy.offset >> 2),
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci				SET_CONTEXT_DMA_NOTIFIER, asyw->ntfy.handle);
18562306a36Sopenharmony_ci	return 0;
18662306a36Sopenharmony_ci}
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_civoid
18962306a36Sopenharmony_cibase507c_ntfy_reset(struct nouveau_bo *bo, u32 offset)
19062306a36Sopenharmony_ci{
19162306a36Sopenharmony_ci	NVBO_WR32(bo, offset, NV_DISP_BASE_NOTIFIER_1, _0,
19262306a36Sopenharmony_ci			NVDEF(NV_DISP_BASE_NOTIFIER_1, _0, STATUS, NOT_BEGUN));
19362306a36Sopenharmony_ci}
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ciint
19662306a36Sopenharmony_cibase507c_sema_clr(struct nv50_wndw *wndw)
19762306a36Sopenharmony_ci{
19862306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
19962306a36Sopenharmony_ci	int ret;
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 2)))
20262306a36Sopenharmony_ci		return ret;
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_CONTEXT_DMA_SEMAPHORE, 0x00000000);
20562306a36Sopenharmony_ci	return 0;
20662306a36Sopenharmony_ci}
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ciint
20962306a36Sopenharmony_cibase507c_sema_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
21062306a36Sopenharmony_ci{
21162306a36Sopenharmony_ci	struct nvif_push *push = wndw->wndw.push;
21262306a36Sopenharmony_ci	int ret;
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	if ((ret = PUSH_WAIT(push, 5)))
21562306a36Sopenharmony_ci		return ret;
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci	PUSH_MTHD(push, NV507C, SET_SEMAPHORE_CONTROL, asyw->sema.offset,
21862306a36Sopenharmony_ci				SET_SEMAPHORE_ACQUIRE, asyw->sema.acquire,
21962306a36Sopenharmony_ci				SET_SEMAPHORE_RELEASE, asyw->sema.release,
22062306a36Sopenharmony_ci				SET_CONTEXT_DMA_SEMAPHORE, asyw->sema.handle);
22162306a36Sopenharmony_ci	return 0;
22262306a36Sopenharmony_ci}
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_civoid
22562306a36Sopenharmony_cibase507c_release(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
22662306a36Sopenharmony_ci		 struct nv50_head_atom *asyh)
22762306a36Sopenharmony_ci{
22862306a36Sopenharmony_ci	asyh->base.cpp = 0;
22962306a36Sopenharmony_ci}
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ciint
23262306a36Sopenharmony_cibase507c_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
23362306a36Sopenharmony_ci		 struct nv50_head_atom *asyh)
23462306a36Sopenharmony_ci{
23562306a36Sopenharmony_ci	const struct drm_framebuffer *fb = asyw->state.fb;
23662306a36Sopenharmony_ci	int ret;
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci	ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state,
23962306a36Sopenharmony_ci						  DRM_PLANE_NO_SCALING,
24062306a36Sopenharmony_ci						  DRM_PLANE_NO_SCALING,
24162306a36Sopenharmony_ci						  false, true);
24262306a36Sopenharmony_ci	if (ret)
24362306a36Sopenharmony_ci		return ret;
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci	if (!wndw->func->ilut) {
24662306a36Sopenharmony_ci		if ((asyh->base.cpp != 1) ^ (fb->format->cpp[0] != 1))
24762306a36Sopenharmony_ci			asyh->state.color_mgmt_changed = true;
24862306a36Sopenharmony_ci	}
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci	asyh->base.depth = fb->format->depth;
25162306a36Sopenharmony_ci	asyh->base.cpp = fb->format->cpp[0];
25262306a36Sopenharmony_ci	asyh->base.x = asyw->state.src.x1 >> 16;
25362306a36Sopenharmony_ci	asyh->base.y = asyw->state.src.y1 >> 16;
25462306a36Sopenharmony_ci	asyh->base.w = asyw->state.fb->width;
25562306a36Sopenharmony_ci	asyh->base.h = asyw->state.fb->height;
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	/* Some newer formats, esp FP16 ones, don't have a
25862306a36Sopenharmony_ci	 * "depth". There's nothing that really makes sense there
25962306a36Sopenharmony_ci	 * either, so just set it to the implicit bit count.
26062306a36Sopenharmony_ci	 */
26162306a36Sopenharmony_ci	if (!asyh->base.depth)
26262306a36Sopenharmony_ci		asyh->base.depth = asyh->base.cpp * 8;
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	return 0;
26562306a36Sopenharmony_ci}
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ciconst u32
26862306a36Sopenharmony_cibase507c_format[] = {
26962306a36Sopenharmony_ci	DRM_FORMAT_C8,
27062306a36Sopenharmony_ci	DRM_FORMAT_RGB565,
27162306a36Sopenharmony_ci	DRM_FORMAT_XRGB1555,
27262306a36Sopenharmony_ci	DRM_FORMAT_ARGB1555,
27362306a36Sopenharmony_ci	DRM_FORMAT_XRGB8888,
27462306a36Sopenharmony_ci	DRM_FORMAT_ARGB8888,
27562306a36Sopenharmony_ci	DRM_FORMAT_XBGR2101010,
27662306a36Sopenharmony_ci	DRM_FORMAT_ABGR2101010,
27762306a36Sopenharmony_ci	DRM_FORMAT_XBGR8888,
27862306a36Sopenharmony_ci	DRM_FORMAT_ABGR8888,
27962306a36Sopenharmony_ci	DRM_FORMAT_XBGR16161616F,
28062306a36Sopenharmony_ci	DRM_FORMAT_ABGR16161616F,
28162306a36Sopenharmony_ci	0
28262306a36Sopenharmony_ci};
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_cistatic const struct nv50_wndw_func
28562306a36Sopenharmony_cibase507c = {
28662306a36Sopenharmony_ci	.acquire = base507c_acquire,
28762306a36Sopenharmony_ci	.release = base507c_release,
28862306a36Sopenharmony_ci	.sema_set = base507c_sema_set,
28962306a36Sopenharmony_ci	.sema_clr = base507c_sema_clr,
29062306a36Sopenharmony_ci	.ntfy_reset = base507c_ntfy_reset,
29162306a36Sopenharmony_ci	.ntfy_set = base507c_ntfy_set,
29262306a36Sopenharmony_ci	.ntfy_clr = base507c_ntfy_clr,
29362306a36Sopenharmony_ci	.ntfy_wait_begun = base507c_ntfy_wait_begun,
29462306a36Sopenharmony_ci	.olut_core = 1,
29562306a36Sopenharmony_ci	.xlut_set = base507c_xlut_set,
29662306a36Sopenharmony_ci	.xlut_clr = base507c_xlut_clr,
29762306a36Sopenharmony_ci	.image_set = base507c_image_set,
29862306a36Sopenharmony_ci	.image_clr = base507c_image_clr,
29962306a36Sopenharmony_ci	.update = base507c_update,
30062306a36Sopenharmony_ci};
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ciint
30362306a36Sopenharmony_cibase507c_new_(const struct nv50_wndw_func *func, const u32 *format,
30462306a36Sopenharmony_ci	      struct nouveau_drm *drm, int head, s32 oclass, u32 interlock_data,
30562306a36Sopenharmony_ci	      struct nv50_wndw **pwndw)
30662306a36Sopenharmony_ci{
30762306a36Sopenharmony_ci	struct nvif_disp_chan_v0 args = {
30862306a36Sopenharmony_ci		.id = head,
30962306a36Sopenharmony_ci	};
31062306a36Sopenharmony_ci	struct nouveau_display *disp = nouveau_display(drm->dev);
31162306a36Sopenharmony_ci	struct nv50_disp *disp50 = nv50_disp(drm->dev);
31262306a36Sopenharmony_ci	struct nv50_wndw *wndw;
31362306a36Sopenharmony_ci	int ret;
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci	ret = nv50_wndw_new_(func, drm->dev, DRM_PLANE_TYPE_PRIMARY,
31662306a36Sopenharmony_ci			     "base", head, format, BIT(head),
31762306a36Sopenharmony_ci			     NV50_DISP_INTERLOCK_BASE, interlock_data, &wndw);
31862306a36Sopenharmony_ci	if (*pwndw = wndw, ret)
31962306a36Sopenharmony_ci		return ret;
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci	ret = nv50_dmac_create(&drm->client.device, &disp->disp.object,
32262306a36Sopenharmony_ci			       &oclass, head, &args, sizeof(args),
32362306a36Sopenharmony_ci			       disp50->sync->offset, &wndw->wndw);
32462306a36Sopenharmony_ci	if (ret) {
32562306a36Sopenharmony_ci		NV_ERROR(drm, "base%04x allocation failed: %d\n", oclass, ret);
32662306a36Sopenharmony_ci		return ret;
32762306a36Sopenharmony_ci	}
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci	wndw->ntfy = NV50_DISP_BASE_NTFY(wndw->id);
33062306a36Sopenharmony_ci	wndw->sema = NV50_DISP_BASE_SEM0(wndw->id);
33162306a36Sopenharmony_ci	wndw->data = 0x00000000;
33262306a36Sopenharmony_ci	return 0;
33362306a36Sopenharmony_ci}
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ciint
33662306a36Sopenharmony_cibase507c_new(struct nouveau_drm *drm, int head, s32 oclass,
33762306a36Sopenharmony_ci	     struct nv50_wndw **pwndw)
33862306a36Sopenharmony_ci{
33962306a36Sopenharmony_ci	return base507c_new_(&base507c, base507c_format, drm, head, oclass,
34062306a36Sopenharmony_ci			     0x00000002 << (head * 8), pwndw);
34162306a36Sopenharmony_ci}
342