drm/nouveau/kms/nv50-: convert wndw xlut_clr() to new push macros
[linux-2.6-microblaze.git] / drivers / gpu / drm / nouveau / dispnv50 / wndwc57e.c
index 1d64741..f393399 100644 (file)
@@ -27,6 +27,7 @@
 #include <nouveau_bo.h>
 
 #include <nvif/clc37e.h>
+#include <nvif/pushc37b.h>
 
 static void
 wndwc57e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
@@ -60,64 +61,65 @@ wndwc57e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
        evo_kick(push, &wndw->wndw);
 }
 
-static void
+static int
 wndwc57e_csc_clr(struct nv50_wndw *wndw)
 {
-       u32 *push;
-       if ((push = evo_wait(&wndw->wndw, 13))) {
-                evo_mthd(push, 0x0400, 12);
-                evo_data(push, 0x00010000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00010000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00000000);
-                evo_data(push, 0x00010000);
-                evo_data(push, 0x00000000);
-                evo_kick(push, &wndw->wndw);
-       }
+       struct nvif_push *push = wndw->wndw.push;
+       const u32 identity[12] = {
+               0x00010000, 0x00000000, 0x00000000, 0x00000000,
+               0x00000000, 0x00010000, 0x00000000, 0x00000000,
+               0x00000000, 0x00000000, 0x00010000, 0x00000000,
+       };
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 1 + ARRAY_SIZE(identity))))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57E, 0x0400, identity, ARRAY_SIZE(identity));
+       return 0;
 }
 
-static void
+static int
 wndwc57e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
 {
-       u32 *push, i;
-       if ((push = evo_wait(&wndw->wndw, 13))) {
-                evo_mthd(push, 0x0400, 12);
-                for (i = 0; i < 12; i++)
-                         evo_data(push, asyw->csc.matrix[i]);
-                evo_kick(push, &wndw->wndw);
-       }
+       struct nvif_push *push = wndw->wndw.push;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 13)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57E, 0x0400, asyw->csc.matrix, 12);
+       return 0;
 }
 
-static void
+static int
 wndwc57e_ilut_clr(struct nv50_wndw *wndw)
 {
-       u32 *push;
-       if ((push = evo_wait(&wndw->wndw, 2))) {
-               evo_mthd(push, 0x0444, 1);
-               evo_data(push, 0x00000000);
-               evo_kick(push, &wndw->wndw);
-       }
+       struct nvif_push *push = wndw->wndw.push;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 2)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57E, 0x0444, 0x00000000);
+       return 0;
 }
 
-static void
+static int
 wndwc57e_ilut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
 {
-       u32 *push;
-       if ((push = evo_wait(&wndw->wndw, 4))) {
-               evo_mthd(push, 0x0440, 3);
-               evo_data(push, asyw->xlut.i.size << 8 |
-                              asyw->xlut.i.mode << 2 |
-                              asyw->xlut.i.output_mode);
-               evo_data(push, asyw->xlut.handle);
-               evo_data(push, asyw->xlut.i.offset >> 8);
-               evo_kick(push, &wndw->wndw);
-       }
+       struct nvif_push *push = wndw->wndw.push;
+       int ret;
+
+       if ((ret = PUSH_WAIT(push, 4)))
+               return ret;
+
+       PUSH_NVSQ(push, NVC57E, 0x0440, asyw->xlut.i.size << 8 |
+                                       asyw->xlut.i.mode << 2 |
+                                       asyw->xlut.i.output_mode,
+                               0x0444, asyw->xlut.handle,
+                               0x0448, asyw->xlut.i.offset >> 8);
+       return 0;
 }
 
 static u16