drm/nouveau/kms/nv50-: use NVIDIA's headers for wndw image_set()
[linux-2.6-microblaze.git] / drivers / gpu / drm / nouveau / dispnv50 / ovly507e.c
index b46c95e..5369080 100644 (file)
@@ -30,6 +30,8 @@
 #include <nvif/event.h>
 #include <nvif/push507c.h>
 
+#include <nvhw/class/cl507e.h>
+
 int
 ovly507e_scale_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
 {
@@ -54,18 +56,32 @@ ovly507e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
        if ((ret = PUSH_WAIT(push, 12)))
                return ret;
 
-       PUSH_NVSQ(push, NV507E, 0x0084, asyw->image.interval << 4);
-       PUSH_NVSQ(push, NV507E, 0x00c0, asyw->image.handle[0]);
-       PUSH_NVSQ(push, NV507E, 0x0100, 0x00000002);
-       PUSH_NVSQ(push, NV507E, 0x0800, asyw->image.offset[0] >> 8);
-       PUSH_NVSQ(push, NV507E, 0x0808, asyw->image.h << 16 | asyw->image.w,
-                               0x080c, asyw->image.layout << 20 |
-                                      (asyw->image.pitch[0] >> 8) << 8 |
-                                       asyw->image.blocks[0] << 8 |
-                                       asyw->image.blockh,
-                               0x0810, asyw->image.kind << 16 |
-                                       asyw->image.format << 8 |
-                                       asyw->image.colorspace);
+       PUSH_MTHD(push, NV507E, SET_PRESENT_CONTROL,
+                 NVDEF(NV507E, SET_PRESENT_CONTROL, BEGIN_MODE, ASAP) |
+                 NVVAL(NV507E, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval));
+
+       PUSH_MTHD(push, NV507E, SET_CONTEXT_DMA_ISO, asyw->image.handle[0]);
+
+       PUSH_MTHD(push, NV507E, SET_COMPOSITION_CONTROL,
+                 NVDEF(NV507E, SET_COMPOSITION_CONTROL, MODE, OPAQUE_SUSPEND_BASE));
+
+       PUSH_MTHD(push, NV507E, SURFACE_SET_OFFSET, asyw->image.offset[0] >> 8);
+
+       PUSH_MTHD(push, NV507E, SURFACE_SET_SIZE,
+                 NVVAL(NV507E, SURFACE_SET_SIZE, WIDTH, asyw->image.w) |
+                 NVVAL(NV507E, SURFACE_SET_SIZE, HEIGHT, asyw->image.h),
+
+                               SURFACE_SET_STORAGE,
+                 NVVAL(NV507E, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh) |
+                 NVVAL(NV507E, SURFACE_SET_STORAGE, PITCH, (asyw->image.pitch[0] >> 8)) |
+                 NVVAL(NV507E, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) |
+                 NVVAL(NV507E, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout),
+
+                               SURFACE_SET_PARAMS,
+                 NVVAL(NV507E, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) |
+                 NVVAL(NV507E, SURFACE_SET_PARAMS, COLOR_SPACE, asyw->image.colorspace) |
+                 NVVAL(NV507E, SURFACE_SET_PARAMS, KIND, asyw->image.kind) |
+                 NVDEF(NV507E, SURFACE_SET_PARAMS, PART_STRIDE, PARTSTRIDE_256));
        return 0;
 }