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

index e30c9bb..e49ef06 100644 (file)
@@ -39,7 +39,7 @@ struct nv50_head_func {
                           struct nv50_head_atom *);
        int (*curs_format)(struct nv50_head *, struct nv50_wndw_atom *,
                           struct nv50_head_atom *);
-       void (*curs_set)(struct nv50_head *, struct nv50_head_atom *);
+       int (*curs_set)(struct nv50_head *, struct nv50_head_atom *);
        void (*curs_clr)(struct nv50_head *);
        void (*base)(struct nv50_head *, struct nv50_head_atom *);
        void (*ovly)(struct nv50_head *, struct nv50_head_atom *);
@@ -74,7 +74,7 @@ int head907d_olut_set(struct nv50_head *, struct nv50_head_atom *);
 int head907d_olut_clr(struct nv50_head *);
 int head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
 int head907d_core_clr(struct nv50_head *);
-void head907d_curs_set(struct nv50_head *, struct nv50_head_atom *);
+int head907d_curs_set(struct nv50_head *, struct nv50_head_atom *);
 void head907d_curs_clr(struct nv50_head *);
 void head907d_ovly(struct nv50_head *, struct nv50_head_atom *);
 void head907d_procamp(struct nv50_head *, struct nv50_head_atom *);
@@ -88,7 +88,7 @@ extern const struct nv50_head_func headc37d;
 int headc37d_view(struct nv50_head *, struct nv50_head_atom *);
 int headc37d_curs_format(struct nv50_head *, struct nv50_wndw_atom *,
                         struct nv50_head_atom *);
-void headc37d_curs_set(struct nv50_head *, struct nv50_head_atom *);
+int headc37d_curs_set(struct nv50_head *, struct nv50_head_atom *);
 void headc37d_curs_clr(struct nv50_head *);
 void headc37d_dither(struct nv50_head *, struct nv50_head_atom *);
 void headc37d_static_wndw_map(struct nv50_head *, struct nv50_head_atom *);
index f062cd1..2cdbf49 100644 (file)
@@ -117,18 +117,21 @@ head507d_curs_clr(struct nv50_head *head)
        }
 }
 
-static void
+static int
 head507d_curs_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, 3))) {
-               evo_mthd(push, 0x0880 + head->base.index * 0x400, 2);
-               evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
-                                           asyh->curs.format << 24);
-               evo_data(push, asyh->curs.offset >> 8);
-               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, NV507D, 0x0880 + (i * 0x400), 0x80000000 |
+                                                     asyh->curs.layout << 26 |
+                                                     asyh->curs.format << 24,
+                               0x0884 + (i * 0x400), asyh->curs.offset >> 8);
+       return 0;
 }
 
 int
index 3361eea..6b1b683 100644 (file)
@@ -38,20 +38,22 @@ head827d_curs_clr(struct nv50_head *head)
        }
 }
 
-static void
+static int
 head827d_curs_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, 5))) {
-               evo_mthd(push, 0x0880 + head->base.index * 0x400, 2);
-               evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
-                                           asyh->curs.format << 24);
-               evo_data(push, asyh->curs.offset >> 8);
-               evo_mthd(push, 0x089c + head->base.index * 0x400, 1);
-               evo_data(push, asyh->curs.handle);
-               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, 5)))
+               return ret;
+
+       PUSH_NVSQ(push, NV827D, 0x0880 + (i * 0x400), 0x80000000 |
+                                                     asyh->curs.layout << 26 |
+                                                     asyh->curs.format << 24,
+                               0x0884 + (i * 0x400), asyh->curs.offset >> 8);
+       PUSH_NVSQ(push, NV827D, 0x089c + (i * 0x400), asyh->curs.handle);
+       return 0;
 }
 
 static int
index 2e2b33b..32dd0de 100644 (file)
@@ -144,20 +144,22 @@ head907d_curs_clr(struct nv50_head *head)
        }
 }
 
-void
+int
 head907d_curs_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, 5))) {
-               evo_mthd(push, 0x0480 + head->base.index * 0x300, 2);
-               evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
-                                           asyh->curs.format << 24);
-               evo_data(push, asyh->curs.offset >> 8);
-               evo_mthd(push, 0x048c + head->base.index * 0x300, 1);
-               evo_data(push, asyh->curs.handle);
-               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, 5)))
+               return ret;
+
+       PUSH_NVSQ(push, NV907D, 0x0480 + (i * 0x300), 0x80000000 |
+                                                     asyh->curs.layout << 26 |
+                                                     asyh->curs.format << 24,
+                               0x0484 + (i * 0x300), asyh->curs.offset >> 8);
+       PUSH_NVSQ(push, NV907D, 0x048c + (i * 0x300), asyh->curs.handle);
+       return 0;
 }
 
 int
index d3e7234..89ac5d7 100644 (file)
@@ -98,23 +98,23 @@ headc37d_curs_clr(struct nv50_head *head)
        }
 }
 
-void
+int
 headc37d_curs_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, 7))) {
-               evo_mthd(push, 0x209c + head->base.index * 0x400, 2);
-               evo_data(push, 0x80000000 |
-                              asyh->curs.layout << 8 |
-                              asyh->curs.format << 0);
-               evo_data(push, 0x000072ff);
-               evo_mthd(push, 0x2088 + head->base.index * 0x400, 1);
-               evo_data(push, asyh->curs.handle);
-               evo_mthd(push, 0x2090 + head->base.index * 0x400, 1);
-               evo_data(push, asyh->curs.offset >> 8);
-               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, 7)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC37D, 0x209c + (i * 0x400), 0x80000000 |
+                                                     asyh->curs.layout << 8 |
+                                                     asyh->curs.format << 0,
+                               0x20a0 + (i * 0x400), 0x000072ff);
+       PUSH_NVSQ(push, NVC37D, 0x2088 + (i * 0x400), asyh->curs.handle);
+       PUSH_NVSQ(push, NVC37D, 0x2090 + (i * 0x400), asyh->curs.offset >> 8);
+       return 0;
 }
 
 int