drm/nouveau/kms/nv50-: convert core head_or() to new push macros
authorBen Skeggs <bskeggs@redhat.com>
Sat, 20 Jun 2020 23:28:36 +0000 (09:28 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Jul 2020 08:50:55 +0000 (18:50 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/dispnv50/head.h
drivers/gpu/drm/nouveau/dispnv50/head907d.c
drivers/gpu/drm/nouveau/dispnv50/headc37d.c
drivers/gpu/drm/nouveau/dispnv50/headc57d.c

index 5fca0b7..dae841d 100644 (file)
@@ -45,7 +45,7 @@ struct nv50_head_func {
        int (*ovly)(struct nv50_head *, struct nv50_head_atom *);
        int (*dither)(struct nv50_head *, struct nv50_head_atom *);
        int (*procamp)(struct nv50_head *, struct nv50_head_atom *);
-       void (*or)(struct nv50_head *, struct nv50_head_atom *);
+       int (*or)(struct nv50_head *, struct nv50_head_atom *);
        void (*static_wndw_map)(struct nv50_head *, struct nv50_head_atom *);
 };
 
@@ -78,7 +78,7 @@ int head907d_curs_set(struct nv50_head *, struct nv50_head_atom *);
 int head907d_curs_clr(struct nv50_head *);
 int head907d_ovly(struct nv50_head *, struct nv50_head_atom *);
 int head907d_procamp(struct nv50_head *, struct nv50_head_atom *);
-void head907d_or(struct nv50_head *, struct nv50_head_atom *);
+int head907d_or(struct nv50_head *, struct nv50_head_atom *);
 
 extern const struct nv50_head_func head917d;
 int head917d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
index b6b406d..3be63f0 100644 (file)
 
 #include <nvif/push507c.h>
 
-void
+int
 head907d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 3))) {
-               evo_mthd(push, 0x0404 + (head->base.index * 0x300), 2);
-               evo_data(push, asyh->or.depth  << 6 |
-                              asyh->or.nvsync << 4 |
-                              asyh->or.nhsync << 3 |
-                              asyh->or.crc_raster);
-               evo_data(push, 0x31ec6000 | head->base.index << 25 |
-                                           asyh->mode.interlace);
-               evo_kick(push, core);
-       }
+       struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
+       const int i = head->base.index;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 3)))
+               return ret;
+
+       PUSH_NVSQ(push, NV907D, 0x0404 + (i * 0x300), asyh->or.depth  << 6 |
+                                                     asyh->or.nvsync << 4 |
+                                                     asyh->or.nhsync << 3 |
+                                                     asyh->or.crc_raster,
+                               0x0408 + (i * 0x300), 0x31ec6000 |
+                                                     head->base.index << 25 |
+                                                     asyh->mode.interlace);
+       return 0;
 }
 
 int
index 20d3ce4..bd63245 100644 (file)
 
 #include <nvif/pushc37b.h>
 
-static void
+static int
 headc37d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
+       struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
+       const int i = head->base.index;
        u8 depth;
-       u32 *push;
-
-       if ((push = evo_wait(core, 2))) {
-               /*XXX: This is a dirty hack until OR depth handling is
-                *     improved later for deep colour etc.
-                */
-               switch (asyh->or.depth) {
-               case 6: depth = 5; break;
-               case 5: depth = 4; break;
-               case 2: depth = 1; break;
-               case 0: depth = 4; break;
-               default:
-                       depth = asyh->or.depth;
-                       WARN_ON(1);
-                       break;
-               }
-
-               evo_mthd(push, 0x2004 + (head->base.index * 0x400), 1);
-               evo_data(push, depth << 4 |
-                              asyh->or.nvsync << 3 |
-                              asyh->or.nhsync << 2 |
-                              asyh->or.crc_raster);
-               evo_kick(push, core);
+       int ret;
+
+       /*XXX: This is a dirty hack until OR depth handling is
+        *     improved later for deep colour etc.
+        */
+       switch (asyh->or.depth) {
+       case 6: depth = 5; break;
+       case 5: depth = 4; break;
+       case 2: depth = 1; break;
+       case 0: depth = 4; break;
+       default:
+               depth = asyh->or.depth;
+               WARN_ON(1);
+               break;
        }
+
+       if ((ret = PUSH_WAIT(push, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC37D, 0x2004 + (i * 0x400), depth << 4 |
+                                                     asyh->or.nvsync << 3 |
+                                                     asyh->or.nhsync << 2 |
+                                                     asyh->or.crc_raster);
+       return 0;
 }
 
 static int
index 751ffef..e38087b 100644 (file)
 
 #include <nvif/pushc37b.h>
 
-static void
+static int
 headc57d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
+       struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
+       const int i = head->base.index;
        u8 depth;
-       u32 *push;
-
-       if ((push = evo_wait(core, 2))) {
-               /*XXX: This is a dirty hack until OR depth handling is
-                *     improved later for deep colour etc.
-                */
-               switch (asyh->or.depth) {
-               case 6: depth = 5; break;
-               case 5: depth = 4; break;
-               case 2: depth = 1; break;
-               case 0: depth = 4; break;
-               default:
-                       depth = asyh->or.depth;
-                       WARN_ON(1);
-                       break;
-               }
+       int ret;
 
-               evo_mthd(push, 0x2004 + (head->base.index * 0x400), 1);
-               evo_data(push, 0xfc000000 |
-                              depth << 4 |
-                              asyh->or.nvsync << 3 |
-                              asyh->or.nhsync << 2 |
-                              asyh->or.crc_raster);
-               evo_kick(push, core);
+       /*XXX: This is a dirty hack until OR depth handling is
+        *     improved later for deep colour etc.
+        */
+       switch (asyh->or.depth) {
+       case 6: depth = 5; break;
+       case 5: depth = 4; break;
+       case 2: depth = 1; break;
+       case 0: depth = 4; break;
+       default:
+               depth = asyh->or.depth;
+               WARN_ON(1);
+               break;
        }
+
+       if ((ret = PUSH_WAIT(push, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57D, 0x2004 + (i * 0x400), 0xfc000000 |
+                                                     depth << 4 |
+                                                     asyh->or.nvsync << 3 |
+                                                     asyh->or.nhsync << 2 |
+                                                     asyh->or.crc_raster);
+       return 0;
 }
 
 static int