base507c.c (261fcfa96991d6652b061262c1879cc0bdd1aa3a) base507c.c (53e0a3e70de69dc9f498d26c6b5495b2771ee374)
1/*
2 * Copyright 2018 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 14 unchanged lines hidden (view full) ---

23
24#include <nvif/cl507c.h>
25#include <nvif/event.h>
26
27#include <drm/drm_atomic_helper.h>
28#include <drm/drm_plane_helper.h>
29#include "nouveau_bo.h"
30
1/*
2 * Copyright 2018 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 14 unchanged lines hidden (view full) ---

23
24#include <nvif/cl507c.h>
25#include <nvif/event.h>
26
27#include <drm/drm_atomic_helper.h>
28#include <drm/drm_plane_helper.h>
29#include "nouveau_bo.h"
30
31u32
32base507c_update(struct nv50_wndw *wndw, u32 interlock)
31void
32base507c_update(struct nv50_wndw *wndw, u32 *interlock)
33{
34 u32 *push;
35 if ((push = evo_wait(&wndw->wndw, 2))) {
36 evo_mthd(push, 0x0080, 1);
33{
34 u32 *push;
35 if ((push = evo_wait(&wndw->wndw, 2))) {
36 evo_mthd(push, 0x0080, 1);
37 evo_data(push, interlock);
37 evo_data(push, interlock[NV50_DISP_INTERLOCK_CORE]);
38 evo_kick(push, &wndw->wndw);
38 evo_kick(push, &wndw->wndw);
39 return interlock ? 2 << (wndw->id * 8) : 0;
40 }
39 }
41 return 0;
42}
43
44void
45base507c_lut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
46{
47 u32 *push;
48 if ((push = evo_wait(&wndw->wndw, 2))) {
49 evo_mthd(push, 0x00e0, 1);

--- 169 unchanged lines hidden (view full) ---

219 .image_set = base507c_image_set,
220 .image_clr = base507c_image_clr,
221 .lut = base507c_lut,
222 .update = base507c_update,
223};
224
225int
226base507c_new_(const struct nv50_wndw_func *func, const u32 *format,
40}
41
42void
43base507c_lut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
44{
45 u32 *push;
46 if ((push = evo_wait(&wndw->wndw, 2))) {
47 evo_mthd(push, 0x00e0, 1);

--- 169 unchanged lines hidden (view full) ---

217 .image_set = base507c_image_set,
218 .image_clr = base507c_image_clr,
219 .lut = base507c_lut,
220 .update = base507c_update,
221};
222
223int
224base507c_new_(const struct nv50_wndw_func *func, const u32 *format,
227 struct nouveau_drm *drm, int head, s32 oclass,
225 struct nouveau_drm *drm, int head, s32 oclass, u32 interlock_data,
228 struct nv50_wndw **pwndw)
229{
230 struct nv50_disp_base_channel_dma_v0 args = {
231 .head = head,
232 };
233 struct nv50_disp *disp = nv50_disp(drm->dev);
234 struct nv50_wndw *wndw;
235 int ret;
236
237 ret = nv50_wndw_new_(func, drm->dev, DRM_PLANE_TYPE_PRIMARY,
226 struct nv50_wndw **pwndw)
227{
228 struct nv50_disp_base_channel_dma_v0 args = {
229 .head = head,
230 };
231 struct nv50_disp *disp = nv50_disp(drm->dev);
232 struct nv50_wndw *wndw;
233 int ret;
234
235 ret = nv50_wndw_new_(func, drm->dev, DRM_PLANE_TYPE_PRIMARY,
238 "base", head, format, BIT(head), &wndw);
236 "base", head, format, BIT(head),
237 NV50_DISP_INTERLOCK_BASE, interlock_data, &wndw);
239 if (*pwndw = wndw, ret)
240 return ret;
241
242 ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
243 &oclass, head, &args, sizeof(args),
244 disp->sync->bo.offset, &wndw->wndw);
245 if (ret) {
246 NV_ERROR(drm, "base%04x allocation failed: %d\n", oclass, ret);

--- 14 unchanged lines hidden (view full) ---

261 wndw->data = 0x00000000;
262 return 0;
263}
264
265int
266base507c_new(struct nouveau_drm *drm, int head, s32 oclass,
267 struct nv50_wndw **pwndw)
268{
238 if (*pwndw = wndw, ret)
239 return ret;
240
241 ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
242 &oclass, head, &args, sizeof(args),
243 disp->sync->bo.offset, &wndw->wndw);
244 if (ret) {
245 NV_ERROR(drm, "base%04x allocation failed: %d\n", oclass, ret);

--- 14 unchanged lines hidden (view full) ---

260 wndw->data = 0x00000000;
261 return 0;
262}
263
264int
265base507c_new(struct nouveau_drm *drm, int head, s32 oclass,
266 struct nv50_wndw **pwndw)
267{
269 return base507c_new_(&base507c, base507c_format, drm, head, oclass, pwndw);
268 return base507c_new_(&base507c, base507c_format, drm, head, oclass,
269 0x00000002 << (head * 8), pwndw);
270}
270}