drm/nouveau/kms/nv50-: convert core update() to new push macros
authorBen Skeggs <bskeggs@redhat.com>
Sat, 20 Jun 2020 07:10:46 +0000 (17:10 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Jul 2020 08:50:54 +0000 (18:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/dispnv50/core.h
drivers/gpu/drm/nouveau/dispnv50/core507d.c
drivers/gpu/drm/nouveau/dispnv50/corec37d.c

index 15a4ce9..113368d 100644 (file)
@@ -20,7 +20,7 @@ struct nv50_core_func {
        int (*caps_init)(struct nouveau_drm *, struct nv50_disp *);
        int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
                              struct nvif_device *);
-       void (*update)(struct nv50_core *, u32 *interlock, bool ntfy);
+       int (*update)(struct nv50_core *, u32 *interlock, bool ntfy);
 
        struct {
                void (*owner)(struct nv50_core *);
@@ -46,7 +46,7 @@ int core507d_init(struct nv50_core *);
 void core507d_ntfy_init(struct nouveau_bo *, u32);
 int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *);
 int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
-void core507d_update(struct nv50_core *, u32 *, bool);
+int core507d_update(struct nv50_core *, u32 *, bool);
 
 extern const struct nv50_outp_func dac507d;
 extern const struct nv50_outp_func sor507d;
@@ -63,7 +63,7 @@ int core917d_new(struct nouveau_drm *, s32, struct nv50_core **);
 int corec37d_new(struct nouveau_drm *, s32, struct nv50_core **);
 int corec37d_caps_init(struct nouveau_drm *, struct nv50_disp *);
 int corec37d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
-void corec37d_update(struct nv50_core *, u32 *, bool);
+int corec37d_update(struct nv50_core *, u32 *, bool);
 void corec37d_wndw_owner(struct nv50_core *);
 extern const struct nv50_outp_func sorc37d;
 
index 455509c..4938e4b 100644 (file)
 
 #include "nouveau_bo.h"
 
-void
+int
 core507d_update(struct nv50_core *core, u32 *interlock, bool ntfy)
 {
-       u32 *push;
-       if ((push = evo_wait(&core->chan, 5))) {
-               if (ntfy) {
-                       evo_mthd(push, 0x0084, 1);
-                       evo_data(push, 0x80000000 | NV50_DISP_CORE_NTFY);
-               }
-               evo_mthd(push, 0x0080, 2);
-               evo_data(push, interlock[NV50_DISP_INTERLOCK_BASE] |
-                              interlock[NV50_DISP_INTERLOCK_OVLY]);
-               evo_data(push, 0x00000000);
-               evo_kick(push, &core->chan);
-       }
+       struct nvif_push *push = core->chan.push;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 5)))
+               return ret;
+
+       if (ntfy)
+               PUSH_NVSQ(push, NV507D, 0x0084, 0x80000000 | NV50_DISP_CORE_NTFY);
+
+       PUSH_NVSQ(push, NV507D, 0x0080, interlock[NV50_DISP_INTERLOCK_BASE] |
+                                       interlock[NV50_DISP_INTERLOCK_OVLY],
+                               0x0084, 0x00000000);
+       return PUSH_KICK(push);
 }
 
 int
index 59eef8d..38604f5 100644 (file)
@@ -42,28 +42,26 @@ corec37d_wndw_owner(struct nv50_core *core)
        }
 }
 
-void
+int
 corec37d_update(struct nv50_core *core, u32 *interlock, bool ntfy)
 {
-       u32 *push;
-       if ((push = evo_wait(&core->chan, 9))) {
-               if (ntfy) {
-                       evo_mthd(push, 0x020c, 1);
-                       evo_data(push, 0x00001000 | NV50_DISP_CORE_NTFY);
-               }
+       struct nvif_push *push = core->chan.push;
+       int ret;
 
-               evo_mthd(push, 0x0218, 2);
-               evo_data(push, interlock[NV50_DISP_INTERLOCK_CURS]);
-               evo_data(push, interlock[NV50_DISP_INTERLOCK_WNDW]);
-               evo_mthd(push, 0x0200, 1);
-               evo_data(push, 0x00000001);
+       if ((ret = PUSH_WAIT(push, 9)))
+               return ret;
 
-               if (ntfy) {
-                       evo_mthd(push, 0x020c, 1);
-                       evo_data(push, 0x00000000);
-               }
-               evo_kick(push, &core->chan);
-       }
+       if (ntfy)
+               PUSH_NVSQ(push, NVC37D, 0x020c, 0x00001000 | NV50_DISP_CORE_NTFY);
+
+       PUSH_NVSQ(push, NVC37D, 0x0218, interlock[NV50_DISP_INTERLOCK_CURS],
+                               0x021c, interlock[NV50_DISP_INTERLOCK_WNDW]);
+       PUSH_NVSQ(push, NVC37D, 0x0200, 0x00000001);
+
+       if (ntfy)
+               PUSH_NVSQ(push, NVC37D, 0x020c, 0x00000000);
+
+       return PUSH_KICK(push);
 }
 
 int