From c4b27bc8682c5d919a7e95c7cb3e2021d8b37c92 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sat, 18 Jul 2020 17:39:15 +1000 Subject: [PATCH] drm/nouveau/kms/nv50-: convert core crc_set_src() to new push macros Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/crc.h | 4 ++-- drivers/gpu/drm/nouveau/dispnv50/crc907d.c | 30 ++++++++++++++---------------- drivers/gpu/drm/nouveau/dispnv50/crcc37d.c | 29 +++++++++++++---------------- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc.h b/drivers/gpu/drm/nouveau/dispnv50/crc.h index 4bc59e779315..0c10f84b1d62 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/crc.h +++ b/drivers/gpu/drm/nouveau/dispnv50/crc.h @@ -50,8 +50,8 @@ struct nv50_crc_atom { }; struct nv50_crc_func { - void (*set_src)(struct nv50_head *, int or, enum nv50_crc_source_type, - struct nv50_crc_notifier_ctx *, u32 wndw); + int (*set_src)(struct nv50_head *, int or, enum nv50_crc_source_type, + struct nv50_crc_notifier_ctx *, u32 wndw); void (*set_ctx)(struct nv50_head *, struct nv50_crc_notifier_ctx *); u32 (*get_entry)(struct nv50_head *, struct nv50_crc_notifier_ctx *, enum nv50_crc_source, int idx); diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc907d.c b/drivers/gpu/drm/nouveau/dispnv50/crc907d.c index 92e907de7645..1401cf245a4e 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/crc907d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/crc907d.c @@ -6,6 +6,8 @@ #include "disp.h" #include "head.h" +#include + #define CRC907D_MAX_ENTRIES 255 struct crc907d_notifier { @@ -18,16 +20,16 @@ struct crc907d_notifier { } entries[CRC907D_MAX_ENTRIES]; } __packed; -static void +static int crc907d_set_src(struct nv50_head *head, int or, enum nv50_crc_source_type source, struct nv50_crc_notifier_ctx *ctx, u32 wndw) { struct drm_crtc *crtc = &head->base.base; - struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; - const u32 hoff = head->base.index * 0x300; - u32 *push; + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; + const int i = head->base.index; u32 crc_args = 0xfff00000; + int ret; switch (source) { case NV50_CRC_SOURCE_TYPE_SOR: @@ -50,22 +52,18 @@ crc907d_set_src(struct nv50_head *head, int or, break; } - push = evo_wait(core, 4); - if (!push) - return; + if ((ret = PUSH_WAIT(push, 4))) + return ret; if (source) { - evo_mthd(push, 0x0438 + hoff, 1); - evo_data(push, ctx->ntfy.handle); - evo_mthd(push, 0x0430 + hoff, 1); - evo_data(push, crc_args); + PUSH_NVSQ(push, NV907D, 0x0438 + (i * 0x300), ctx->ntfy.handle); + PUSH_NVSQ(push, NV907D, 0x0430 + (i * 0x300), crc_args); } else { - evo_mthd(push, 0x0430 + hoff, 1); - evo_data(push, crc_args); - evo_mthd(push, 0x0438 + hoff, 1); - evo_data(push, 0); + PUSH_NVSQ(push, NV907D, 0x0430 + (i * 0x300), crc_args); + PUSH_NVSQ(push, NV907D, 0x0438 + (i * 0x300), 0); } - evo_kick(push, core); + + return 0; } static void crc907d_set_ctx(struct nv50_head *head, diff --git a/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c b/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c index 940cefd5517d..ab78f7ca85a3 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c @@ -6,6 +6,8 @@ #include "disp.h" #include "head.h" +#include + #define CRCC37D_MAX_ENTRIES 2047 struct crcc37d_notifier { @@ -30,15 +32,15 @@ struct crcc37d_notifier { } entries[CRCC37D_MAX_ENTRIES]; } __packed; -static void +static int crcc37d_set_src(struct nv50_head *head, int or, enum nv50_crc_source_type source, struct nv50_crc_notifier_ctx *ctx, u32 wndw) { - struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; - const u32 hoff = head->base.index * 0x400; - u32 *push; + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; + const int i = head->base.index; u32 crc_args; + int ret; switch (source) { case NV50_CRC_SOURCE_TYPE_SOR: @@ -55,23 +57,18 @@ crcc37d_set_src(struct nv50_head *head, int or, break; } - push = evo_wait(core, 4); - if (!push) - return; + if ((ret = PUSH_WAIT(push, 4))) + return ret; if (source) { - evo_mthd(push, 0x2180 + hoff, 1); - evo_data(push, ctx->ntfy.handle); - evo_mthd(push, 0x2184 + hoff, 1); - evo_data(push, crc_args | wndw); + PUSH_NVSQ(push, NVC37D, 0x2180 + (i * 0x400), ctx->ntfy.handle); + PUSH_NVSQ(push, NVC37D, 0x2184 + (i * 0x400), crc_args | wndw); } else { - evo_mthd(push, 0x2184 + hoff, 1); - evo_data(push, 0); - evo_mthd(push, 0x2180 + hoff, 1); - evo_data(push, 0); + PUSH_NVSQ(push, NVC37D, 0x2184 + (i * 0x400), 0); + PUSH_NVSQ(push, NVC37D, 0x2180 + (i * 0x400), 0); } - evo_kick(push, core); + return 0; } static void crcc37d_set_ctx(struct nv50_head *head, -- 2.11.0