drm/nouveau/kms/nv50-: convert core init() to new push macros
authorBen Skeggs <bskeggs@redhat.com>
Sat, 20 Jun 2020 07:04:57 +0000 (17:04 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Jul 2020 08:50:53 +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
drivers/gpu/drm/nouveau/dispnv50/corec57d.c

index e021cb3..15a4ce9 100644 (file)
@@ -15,7 +15,7 @@ int nv50_core_new(struct nouveau_drm *, struct nv50_core **);
 void nv50_core_del(struct nv50_core **);
 
 struct nv50_core_func {
-       void (*init)(struct nv50_core *);
+       int (*init)(struct nv50_core *);
        void (*ntfy_init)(struct nouveau_bo *, u32 offset);
        int (*caps_init)(struct nouveau_drm *, struct nv50_disp *);
        int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
@@ -42,7 +42,7 @@ struct nv50_core_func {
 int core507d_new(struct nouveau_drm *, s32, struct nv50_core **);
 int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
                  struct nv50_core **);
-void core507d_init(struct nv50_core *);
+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 *);
index 1d66f69..ce6f649 100644 (file)
@@ -23,6 +23,7 @@
 #include "head.h"
 
 #include <nvif/cl507d.h>
+#include <nvif/push507c.h>
 #include <nvif/timer.h>
 
 #include "nouveau_bo.h"
@@ -76,15 +77,17 @@ core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
        return 0;
 }
 
-void
+int
 core507d_init(struct nv50_core *core)
 {
-       u32 *push;
-       if ((push = evo_wait(&core->chan, 2))) {
-               evo_mthd(push, 0x0088, 1);
-               evo_data(push, core->chan.sync.handle);
-               evo_kick(push, &core->chan);
-       }
+       struct nvif_push *push = core->chan.push;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NV507D, 0x0088, core->chan.sync.handle);
+       return PUSH_KICK(push);
 }
 
 static const struct nv50_core_func
index a4a307e..59eef8d 100644 (file)
 #include "head.h"
 
 #include <nvif/class.h>
-#include <nouveau_bo.h>
-
+#include <nvif/pushc37b.h>
 #include <nvif/timer.h>
 
+#include <nouveau_bo.h>
+
 void
 corec37d_wndw_owner(struct nv50_core *core)
 {
@@ -112,24 +113,26 @@ int corec37d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp)
        return 0;
 }
 
-static void
+static int
 corec37d_init(struct nv50_core *core)
 {
+       struct nvif_push *push = core->chan.push;
        const u32 windows = 8; /*XXX*/
-       u32 *push, i;
-       if ((push = evo_wait(&core->chan, 2 + 5 * windows))) {
-               evo_mthd(push, 0x0208, 1);
-               evo_data(push, core->chan.sync.handle);
-               for (i = 0; i < windows; i++) {
-                       evo_mthd(push, 0x1004 + (i * 0x080), 2);
-                       evo_data(push, 0x0000001f);
-                       evo_data(push, 0x00000000);
-                       evo_mthd(push, 0x1010 + (i * 0x080), 1);
-                       evo_data(push, 0x00127fff);
-               }
-               evo_kick(push, &core->chan);
-               core->assign_windows = true;
+       int ret, i;
+
+       if ((ret = PUSH_WAIT(push, 2 + windows * 5)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC37D, 0x0208, core->chan.sync.handle);
+
+       for (i = 0; i < windows; i++) {
+               PUSH_NVSQ(push, NVC37D, 0x1004 + (i * 0x080), 0x0000001f,
+                                       0x1008 + (i * 0x080), 0x00000000);
+               PUSH_NVSQ(push, NVC37D, 0x1010 + (i * 0x080), 0x00127fff);
        }
+
+       core->assign_windows = true;
+       return PUSH_KICK(push);
 }
 
 static const struct nv50_core_func
index e1c11eb..afc703a 100644 (file)
 #include "core.h"
 #include "head.h"
 
-static void
+#include <nvif/pushc37b.h>
+
+static int
 corec57d_init(struct nv50_core *core)
 {
+       struct nvif_push *push = core->chan.push;
        const u32 windows = 8; /*XXX*/
-       u32 *push, i;
-       if ((push = evo_wait(&core->chan, 2 + 5 * windows))) {
-               evo_mthd(push, 0x0208, 1);
-               evo_data(push, core->chan.sync.handle);
-               for (i = 0; i < windows; i++) {
-                       evo_mthd(push, 0x1004 + (i * 0x080), 2);
-                       evo_data(push, 0x0000000f);
-                       evo_data(push, 0x00000000);
-                       evo_mthd(push, 0x1010 + (i * 0x080), 1);
-                       evo_data(push, 0x00117fff);
-               }
-               evo_kick(push, &core->chan);
-               core->assign_windows = true;
+       int ret, i;
+
+       if ((ret = PUSH_WAIT(push, 2 + windows * 5)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57D, 0x0208, core->chan.sync.handle);
+
+       for (i = 0; i < windows; i++) {
+               PUSH_NVSQ(push, NVC57D, 0x1004 + (i * 0x080), 0x0000000f,
+                                       0x1008 + (i * 0x080), 0x00000000);
+               PUSH_NVSQ(push, NVC57D, 0x1010 + (i * 0x080), 0x00117fff);
        }
+
+       core->assign_windows = true;
+       return PUSH_KICK(push);
 }
 
 static const struct nv50_core_func