OSDN Git Service

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

index be1dafb..779f81b 100644 (file)
@@ -31,7 +31,7 @@ struct nv50_head_func {
        bool olut_identity;
        int  olut_size;
        int (*olut_set)(struct nv50_head *, struct nv50_head_atom *);
-       void (*olut_clr)(struct nv50_head *);
+       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 *);
        void (*core_clr)(struct nv50_head *);
@@ -71,7 +71,7 @@ int head907d_view(struct nv50_head *, struct nv50_head_atom *);
 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 *);
-void head907d_olut_clr(struct nv50_head *);
+int head907d_olut_clr(struct nv50_head *);
 void 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 *);
index 50ff8bc..f653c5c 100644 (file)
@@ -231,16 +231,18 @@ head507d_core_calc(struct nv50_head *head, struct nv50_head_atom *asyh)
        asyh->core.pitch = ALIGN(asyh->core.w, 64) * 4;
 }
 
-static void
+static int
 head507d_olut_clr(struct nv50_head *head)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 2))) {
-               evo_mthd(push, 0x0840 + (head->base.index * 0x400), 1);
-               evo_data(push, 0x00000000);
-               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, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NV507D, 0x0840 + (i * 0x400), 0x00000000);
+       return 0;
 }
 
 static int
index 30939bc..7cb81d9 100644 (file)
@@ -76,18 +76,19 @@ head827d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
        }
 }
 
-static void
+static int
 head827d_olut_clr(struct nv50_head *head)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 4))) {
-               evo_mthd(push, 0x0840 + (head->base.index * 0x400), 1);
-               evo_data(push, 0x00000000);
-               evo_mthd(push, 0x085c + (head->base.index * 0x400), 1);
-               evo_data(push, 0x00000000);
-               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, 4)))
+               return ret;
+
+       PUSH_NVSQ(push, NV827D, 0x0840 + (i * 0x400), 0x00000000);
+       PUSH_NVSQ(push, NV827D, 0x085c + (i * 0x400), 0x00000000);
+       return 0;
 }
 
 static int
index 24e0d7c..01be2b9 100644 (file)
@@ -194,18 +194,19 @@ head907d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
        }
 }
 
-void
+int
 head907d_olut_clr(struct nv50_head *head)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 4))) {
-               evo_mthd(push, 0x0448 + (head->base.index * 0x300), 1);
-               evo_data(push, 0x00000000);
-               evo_mthd(push, 0x045c + (head->base.index * 0x300), 1);
-               evo_data(push, 0x00000000);
-               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, 4)))
+               return ret;
+
+       PUSH_NVSQ(push, NV907D, 0x0448 + (i * 0x300), 0x00000000);
+       PUSH_NVSQ(push, NV907D, 0x045c + (i * 0x300), 0x00000000);
+       return 0;
 }
 
 int
index 4363fcc..d3e7234 100644 (file)
@@ -125,16 +125,18 @@ headc37d_curs_format(struct nv50_head *head, struct nv50_wndw_atom *asyw,
        return 0;
 }
 
-static void
+static int
 headc37d_olut_clr(struct nv50_head *head)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 2))) {
-               evo_mthd(push, 0x20ac + (head->base.index * 0x400), 1);
-               evo_data(push, 0x00000000);
-               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, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC37D, 0x20ac + (i * 0x400), 0x00000000);
+       return 0;
 }
 
 static int
index 2f90a24..a39f744 100644 (file)
@@ -75,16 +75,18 @@ headc57d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
        }
 }
 
-void
+static int
 headc57d_olut_clr(struct nv50_head *head)
 {
-       struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
-       u32 *push;
-       if ((push = evo_wait(core, 2))) {
-               evo_mthd(push, 0x2288 + (head->base.index * 0x400), 1);
-               evo_data(push, 0x00000000);
-               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, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57D, 0x2288 + (i * 0x400), 0x00000000);
+       return 0;
 }
 
 static int