diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-10-08 17:36:21 -0700 |
---|---|---|
committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-10-09 12:51:21 -0700 |
commit | 4de3b1765e6f76f4e0f40434f5278f0edac0c61e (patch) | |
tree | 78047ce7c779a35ed7d6c5cac010f00d45a30ff0 | |
parent | 6f8c30d8edf8ee0c57689704e32b949b003bfb02 (diff) |
gem_exec_faulting_reloc: use iterator for batchbuffer
This will help keep the code clean for new platforms which might have
differently sized relocations.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r-- | tests/gem_exec_faulting_reloc.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c index d25bd5ef..ef801ed4 100644 --- a/tests/gem_exec_faulting_reloc.c +++ b/tests/gem_exec_faulting_reloc.c @@ -67,11 +67,12 @@ static int gem_linear_blt(uint32_t *batch, igt_assert(height <= 1<<16); if (height) { - b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB; - b[1] = 0xcc << 16 | 1 << 25 | 1 << 24 | (16*1024); - b[2] = 0; - b[3] = height << 16 | (4*1024); - b[4] = 0; + int i = 0; + b[i++] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB; + b[i++] = 0xcc << 16 | 1 << 25 | 1 << 24 | (16*1024); + b[i++] = 0; + b[i++] = height << 16 | (4*1024); + b[i++] = 0; reloc->offset = (b-batch+4) * sizeof(uint32_t); reloc->delta = 0; reloc->target_handle = dst; @@ -80,9 +81,9 @@ static int gem_linear_blt(uint32_t *batch, reloc->presumed_offset = 0; reloc++; - b[5] = 0; - b[6] = 16*1024; - b[7] = 0; + b[i++] = 0; + b[i++] = 16*1024; + b[i++] = 0; reloc->offset = (b-batch+7) * sizeof(uint32_t); reloc->delta = 0; reloc->target_handle = src; @@ -96,11 +97,12 @@ static int gem_linear_blt(uint32_t *batch, } if (length) { - b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB; - b[1] = 0xcc << 16 | 1 << 25 | 1 << 24 | (16*1024); - b[2] = height << 16; - b[3] = (1+height) << 16 | (length / 4); - b[4] = 0; + int i = 0; + b[i++] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB; + b[i++] = 0xcc << 16 | 1 << 25 | 1 << 24 | (16*1024); + b[i++] = height << 16; + b[i++] = (1+height) << 16 | (length / 4); + b[i++] = 0; reloc->offset = (b-batch+4) * sizeof(uint32_t); reloc->delta = 0; reloc->target_handle = dst; @@ -109,9 +111,9 @@ static int gem_linear_blt(uint32_t *batch, reloc->presumed_offset = 0; reloc++; - b[5] = height << 16; - b[6] = 16*1024; - b[7] = 0; + b[i++] = height << 16; + b[i++] = 16*1024; + b[i++] = 0; reloc->offset = (b-batch+7) * sizeof(uint32_t); reloc->delta = 0; reloc->target_handle = src; |