gem_evict_*: Use iterator for blit batch
authorBen Widawsky <benjamin.widawsky@intel.com>
Wed, 9 Oct 2013 15:37:48 +0000 (08:37 -0700)
committerBen Widawsky <benjamin.widawsky@intel.com>
Wed, 9 Oct 2013 19:52:09 +0000 (12:52 -0700)
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
tests/gem_evict_alignment.c
tests/gem_evict_everything.c

index af0cbbf..57eb586 100644 (file)
@@ -56,22 +56,22 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo, int alignme
        struct drm_i915_gem_exec_object2 *obj;
        struct drm_i915_gem_execbuffer2 exec;
        uint32_t handle;
-       int n, ret;
+       int n, ret, i=0;
 
-       batch[0] = (XY_SRC_COPY_BLT_CMD |
+       batch[i++] = (XY_SRC_COPY_BLT_CMD |
                    XY_SRC_COPY_BLT_WRITE_ALPHA |
                    XY_SRC_COPY_BLT_WRITE_RGB);
-       batch[1] = (3 << 24) | /* 32 bits */
+       batch[i++] = (3 << 24) | /* 32 bits */
                  (0xcc << 16) | /* copy ROP */
                  WIDTH*4;
-       batch[2] = 0; /* dst x1,y1 */
-       batch[3] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
-       batch[4] = 0; /* dst reloc */
-       batch[5] = 0; /* src x1,y1 */
-       batch[6] = WIDTH*4;
-       batch[7] = 0; /* src reloc */
-       batch[8] = MI_BATCH_BUFFER_END;
-       batch[9] = MI_NOOP;
+       batch[i++] = 0; /* dst x1,y1 */
+       batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
+       batch[i++] = 0; /* dst reloc */
+       batch[i++] = 0; /* src x1,y1 */
+       batch[i++] = WIDTH*4;
+       batch[i++] = 0; /* src reloc */
+       batch[i++] = MI_BATCH_BUFFER_END;
+       batch[i++] = MI_NOOP;
 
        handle = gem_create(fd, 4096);
        gem_write(fd, handle, 0, batch, sizeof(batch));
index 4eb7cb4..ae856b0 100644 (file)
@@ -56,22 +56,22 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo, int error)
        struct drm_i915_gem_exec_object2 *obj;
        struct drm_i915_gem_execbuffer2 exec;
        uint32_t handle;
-       int n, ret;
+       int n, ret, i=0;
 
-       batch[0] = (XY_SRC_COPY_BLT_CMD |
+       batch[i++] = (XY_SRC_COPY_BLT_CMD |
                    XY_SRC_COPY_BLT_WRITE_ALPHA |
                    XY_SRC_COPY_BLT_WRITE_RGB);
-       batch[1] = (3 << 24) | /* 32 bits */
+       batch[i++] = (3 << 24) | /* 32 bits */
                  (0xcc << 16) | /* copy ROP */
                  WIDTH*4;
-       batch[2] = 0; /* dst x1,y1 */
-       batch[3] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
-       batch[4] = 0; /* dst reloc */
-       batch[5] = 0; /* src x1,y1 */
-       batch[6] = WIDTH*4;
-       batch[7] = 0; /* src reloc */
-       batch[8] = MI_BATCH_BUFFER_END;
-       batch[9] = MI_NOOP;
+       batch[i++] = 0; /* dst x1,y1 */
+       batch[i++] = (HEIGHT << 16) | WIDTH; /* dst x2,y2 */
+       batch[i++] = 0; /* dst reloc */
+       batch[i++] = 0; /* src x1,y1 */
+       batch[i++] = WIDTH*4;
+       batch[i++] = 0; /* src reloc */
+       batch[i++] = MI_BATCH_BUFFER_END;
+       batch[i++] = MI_NOOP;
 
        handle = gem_create(fd, 4096);
        gem_write(fd, handle, 0, batch, sizeof(batch));