diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-10-09 09:07:55 -0700 |
---|---|---|
committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-10-09 12:52:09 -0700 |
commit | f014878722f7d9371e54e936de668d8a3b8115f1 (patch) | |
tree | 202c89175dc5c8319d395b13322eb8ffdc2ff0d1 | |
parent | a7934e26ae206c6558ff3b34af8728ca7ef04fb5 (diff) |
gem_pin: Use iterator for blit batch setup
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r-- | tests/gem_pin.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/gem_pin.c b/tests/gem_pin.c index f886f4f3..273315fc 100644 --- a/tests/gem_pin.c +++ b/tests/gem_pin.c @@ -91,12 +91,12 @@ static int gem_linear_blt(uint32_t *batch, { uint32_t *b = batch; - b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB; - b[1] = 0x66 << 16 | 1 << 25 | 1 << 24 | (4*1024); - b[2] = 0; - b[3] = (length / (4*1024)) << 16 | 1024; - b[4] = 0; - reloc->offset = (b-batch+4) * sizeof(uint32_t); + *b++ = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB; + *b++ = 0x66 << 16 | 1 << 25 | 1 << 24 | (4*1024); + *b++ = 0; + *b++ = (length / (4*1024)) << 16 | 1024; + *b++ = 0; + reloc->offset = (b-batch-1) * sizeof(uint32_t); reloc->delta = 0; reloc->target_handle = dst; reloc->read_domains = I915_GEM_DOMAIN_RENDER; @@ -104,10 +104,10 @@ static int gem_linear_blt(uint32_t *batch, reloc->presumed_offset = 0; reloc++; - b[5] = 0; - b[6] = 4*1024; - b[7] = 0; - reloc->offset = (b-batch+7) * sizeof(uint32_t); + *b++ = 0; + *b++ = 4*1024; + *b++ = 0; + reloc->offset = (b-batch-1) * sizeof(uint32_t); reloc->delta = 0; reloc->target_handle = src; reloc->read_domains = I915_GEM_DOMAIN_RENDER; @@ -115,12 +115,10 @@ static int gem_linear_blt(uint32_t *batch, reloc->presumed_offset = 0; reloc++; - b += 8; + *b++ = MI_BATCH_BUFFER_END; + *b++ = 0; - b[0] = MI_BATCH_BUFFER_END; - b[1] = 0; - - return (b+2 - batch) * sizeof(uint32_t); + return (b - batch) * sizeof(uint32_t); } static void make_busy(int fd, uint32_t handle) |