drm/nouveau/kms/nv50-: convert core head_core_set() to new push macros
authorBen Skeggs <bskeggs@redhat.com>
Sat, 20 Jun 2020 23:06:18 +0000 (09:06 +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/head.h
drivers/gpu/drm/nouveau/dispnv50/head507d.c
drivers/gpu/drm/nouveau/dispnv50/head827d.c
drivers/gpu/drm/nouveau/dispnv50/head907d.c

index 779f81b..17c5fc7 100644 (file)
@@ -33,7 +33,7 @@ struct nv50_head_func {
        int (*olut_set)(struct nv50_head *, struct nv50_head_atom *);
        int (*olut_clr)(struct nv50_head *);
        void (*core_calc)(struct nv50_head *, struct nv50_head_atom *);
-       void (*core_set)(struct nv50_head *, struct nv50_head_atom *);
+       int (*core_set)(struct nv50_head *, struct nv50_head_atom *);
        void (*core_clr)(struct nv50_head *);
        int (*curs_layout)(struct nv50_head *, struct nv50_wndw_atom *,
                           struct nv50_head_atom *);
@@ -72,7 +72,7 @@ int head907d_mode(struct nv50_head *, struct nv50_head_atom *);
 bool head907d_olut(struct nv50_head *, struct nv50_head_atom *, int);
 int head907d_olut_set(struct nv50_head *, struct nv50_head_atom *);
 int head907d_olut_clr(struct nv50_head *);
-void head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
+int head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
 void head907d_core_clr(struct nv50_head *);
 void head907d_curs_set(struct nv50_head *, struct nv50_head_atom *);
 void head907d_curs_clr(struct nv50_head *);
@@ -86,7 +86,6 @@ int head917d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
 
 extern const struct nv50_head_func headc37d;
 int headc37d_view(struct nv50_head *, struct nv50_head_atom *);
-void headc37d_core_set(struct nv50_head *, struct nv50_head_atom *);
 void headc37d_core_clr(struct nv50_head *);
 int headc37d_curs_format(struct nv50_head *, struct nv50_wndw_atom *,
                         struct nv50_head_atom *);
index f653c5c..3b28060 100644 (file)
@@ -169,34 +169,34 @@ head507d_core_clr(struct nv50_head *head)
        }
 }
 
-static void
+static int
 head507d_core_set(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, 9))) {
-               evo_mthd(push, 0x0860 + head->base.index * 0x400, 1);
-               evo_data(push, asyh->core.offset >> 8);
-               evo_mthd(push, 0x0868 + head->base.index * 0x400, 4);
-               evo_data(push, asyh->core.h << 16 | asyh->core.w);
-               evo_data(push, asyh->core.layout << 20 |
-                              (asyh->core.pitch >> 8) << 8 |
-                              asyh->core.blocks << 8 |
-                              asyh->core.blockh);
-               evo_data(push, asyh->core.kind << 16 |
-                              asyh->core.format << 8);
-               evo_data(push, asyh->core.handle);
-               evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1);
-               evo_data(push, asyh->core.y << 16 | asyh->core.x);
-               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;
 
-               /* EVO will complain with INVALID_STATE if we have an
-                * active cursor and (re)specify HeadSetContextDmaIso
-                * without also updating HeadSetOffsetCursor.
-                */
-               asyh->set.curs = asyh->curs.visible;
-               asyh->set.olut = asyh->olut.handle != 0;
-       }
+       if ((ret = PUSH_WAIT(push, 9)))
+               return ret;
+
+       PUSH_NVSQ(push, NV507D, 0x0860 + (i * 0x400), asyh->core.offset >> 8);
+       PUSH_NVSQ(push, NV507D, 0x0868 + (i * 0x400), asyh->core.h << 16 | asyh->core.w,
+                               0x086c + (i * 0x400), asyh->core.layout << 20 |
+                                                    (asyh->core.pitch >> 8) << 8 |
+                                                     asyh->core.blocks << 8 |
+                                                     asyh->core.blockh,
+                               0x0870 + (i * 0x400), asyh->core.kind << 16 |
+                                                     asyh->core.format << 8,
+                               0x0874 + (i * 0x400), asyh->core.handle);
+       PUSH_NVSQ(push, NV507D, 0x08c0 + (i * 0x400), asyh->core.y << 16 | asyh->core.x);
+
+       /* EVO will complain with INVALID_STATE if we have an
+        * active cursor and (re)specify HeadSetContextDmaIso
+        * without also updating HeadSetOffsetCursor.
+        */
+       asyh->set.curs = asyh->curs.visible;
+       asyh->set.olut = asyh->olut.handle != 0;
+       return 0;
 }
 
 void
index 7cb81d9..3361eea 100644 (file)
@@ -54,26 +54,26 @@ head827d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
        }
 }
 
-static void
+static int
 head827d_core_set(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, 9))) {
-               evo_mthd(push, 0x0860 + head->base.index * 0x400, 1);
-               evo_data(push, asyh->core.offset >> 8);
-               evo_mthd(push, 0x0868 + head->base.index * 0x400, 4);
-               evo_data(push, asyh->core.h << 16 | asyh->core.w);
-               evo_data(push, asyh->core.layout << 20 |
-                              (asyh->core.pitch >> 8) << 8 |
-                              asyh->core.blocks << 8 |
-                              asyh->core.blockh);
-               evo_data(push, asyh->core.format << 8);
-               evo_data(push, asyh->core.handle);
-               evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1);
-               evo_data(push, asyh->core.y << 16 | asyh->core.x);
-               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, 9)))
+               return ret;
+
+       PUSH_NVSQ(push, NV827D, 0x0860 + (i * 0x400), asyh->core.offset >> 8);
+       PUSH_NVSQ(push, NV827D, 0x0868 + (i * 0x400), asyh->core.h << 16 | asyh->core.w,
+                               0x086c + (i * 0x400), asyh->core.layout << 20 |
+                                                    (asyh->core.pitch >> 8) << 8 |
+                                                     asyh->core.blocks << 8 |
+                                                     asyh->core.blockh,
+                               0x0870 + (i * 0x400), asyh->core.format << 8,
+                               0x0874 + (i * 0x400), asyh->core.handle);
+       PUSH_NVSQ(push, NV827D, 0x08c0 + (i * 0x400), asyh->core.y << 16 | asyh->core.x);
+       return 0;
 }
 
 static int
index 01be2b9..0957e25 100644 (file)
@@ -172,26 +172,26 @@ head907d_core_clr(struct nv50_head *head)
        }
 }
 
-void
+int
 head907d_core_set(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, 9))) {
-               evo_mthd(push, 0x0460 + head->base.index * 0x300, 1);
-               evo_data(push, asyh->core.offset >> 8);
-               evo_mthd(push, 0x0468 + head->base.index * 0x300, 4);
-               evo_data(push, asyh->core.h << 16 | asyh->core.w);
-               evo_data(push, asyh->core.layout << 24 |
-                              (asyh->core.pitch >> 8) << 8 |
-                              asyh->core.blocks << 8 |
-                              asyh->core.blockh);
-               evo_data(push, asyh->core.format << 8);
-               evo_data(push, asyh->core.handle);
-               evo_mthd(push, 0x04b0 + head->base.index * 0x300, 1);
-               evo_data(push, asyh->core.y << 16 | asyh->core.x);
-               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, 9)))
+               return ret;
+
+       PUSH_NVSQ(push, NV907D, 0x0460 + (i * 0x300), asyh->core.offset >> 8);
+       PUSH_NVSQ(push, NV907D, 0x0468 + (i * 0x300), asyh->core.h << 16 | asyh->core.w,
+                               0x046c + (i * 0x300), asyh->core.layout << 24 |
+                                                    (asyh->core.pitch >> 8) << 8 |
+                                                     asyh->core.blocks << 8 |
+                                                     asyh->core.blockh,
+                               0x0470 + (i * 0x300), asyh->core.format << 8,
+                               0x0474 + (i * 0x300), asyh->core.handle);
+       PUSH_NVSQ(push, NV907D, 0x04b0 + (i * 0x300), asyh->core.y << 16 | asyh->core.x);
+       return 0;
 }
 
 int