OSDN Git Service

drm/nouveau/kms/nv50-: convert core crc_set_src() to new push macros
authorBen Skeggs <bskeggs@redhat.com>
Sat, 18 Jul 2020 07:39:15 +0000 (17:39 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Jul 2020 08:50:56 +0000 (18:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/dispnv50/crc.h
drivers/gpu/drm/nouveau/dispnv50/crc907d.c
drivers/gpu/drm/nouveau/dispnv50/crcc37d.c

index 4bc59e7..0c10f84 100644 (file)
@@ -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);
index 92e907d..1401cf2 100644 (file)
@@ -6,6 +6,8 @@
 #include "disp.h"
 #include "head.h"
 
+#include <nvif/push507c.h>
+
 #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,
index 940cefd..ab78f7c 100644 (file)
@@ -6,6 +6,8 @@
 #include "disp.h"
 #include "head.h"
 
+#include <nvif/push507c.h>
+
 #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,