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>
This commit is contained in:
Ben Widawsky 2013-10-08 17:36:21 -07:00
parent 6f8c30d8ed
commit 4de3b1765e

View File

@ -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;