mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-26 19:26:43 +00:00
test/gen3_mixed_blits: Alternately use fence regs for the render copies
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
853d729598
commit
6f6cd81913
@ -129,8 +129,9 @@ static uint32_t fill_reloc(struct drm_i915_gem_relocation_entry *reloc,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
render_copy(int fd,
|
render_copy(int fd,
|
||||||
uint32_t dst, int dst_tiling,
|
uint32_t dst, int dst_tiling,
|
||||||
uint32_t src, int src_tiling)
|
uint32_t src, int src_tiling,
|
||||||
|
int use_fence)
|
||||||
{
|
{
|
||||||
uint32_t batch[1024], *b = batch;
|
uint32_t batch[1024], *b = batch;
|
||||||
struct drm_i915_gem_relocation_entry reloc[2], *r = reloc;
|
struct drm_i915_gem_relocation_entry reloc[2], *r = reloc;
|
||||||
@ -199,11 +200,15 @@ render_copy(int fd,
|
|||||||
*b++ = (_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_TWO_SIDE | 0);
|
*b++ = (_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_TWO_SIDE | 0);
|
||||||
|
|
||||||
/* samler state */
|
/* samler state */
|
||||||
tiling_bits = 0;
|
if (use_fence) {
|
||||||
if (src_tiling != I915_TILING_NONE)
|
tiling_bits = MS3_USE_FENCE_REGS;
|
||||||
tiling_bits = MS3_TILED_SURFACE;
|
} else {
|
||||||
if (src_tiling == I915_TILING_Y)
|
tiling_bits = 0;
|
||||||
tiling_bits |= MS3_TILE_WALK;
|
if (src_tiling != I915_TILING_NONE)
|
||||||
|
tiling_bits = MS3_TILED_SURFACE;
|
||||||
|
if (src_tiling == I915_TILING_Y)
|
||||||
|
tiling_bits |= MS3_TILE_WALK;
|
||||||
|
}
|
||||||
|
|
||||||
#define TEX_COUNT 1
|
#define TEX_COUNT 1
|
||||||
*b++ = (_3DSTATE_MAP_STATE | (3 * TEX_COUNT));
|
*b++ = (_3DSTATE_MAP_STATE | (3 * TEX_COUNT));
|
||||||
@ -225,11 +230,15 @@ render_copy(int fd,
|
|||||||
*b++ = (0x00000000);
|
*b++ = (0x00000000);
|
||||||
|
|
||||||
/* render target state */
|
/* render target state */
|
||||||
tiling_bits = 0;
|
if (use_fence) {
|
||||||
if (dst_tiling != I915_TILING_NONE)
|
tiling_bits = BUF_3D_USE_FENCE;
|
||||||
tiling_bits = BUF_3D_TILED_SURFACE;
|
} else {
|
||||||
if (dst_tiling == I915_TILING_Y)
|
tiling_bits = 0;
|
||||||
tiling_bits |= BUF_3D_TILE_WALK_Y;
|
if (dst_tiling != I915_TILING_NONE)
|
||||||
|
tiling_bits = BUF_3D_TILED_SURFACE;
|
||||||
|
if (dst_tiling == I915_TILING_Y)
|
||||||
|
tiling_bits |= BUF_3D_TILE_WALK_Y;
|
||||||
|
}
|
||||||
*b++ = (_3DSTATE_BUF_INFO_CMD);
|
*b++ = (_3DSTATE_BUF_INFO_CMD);
|
||||||
*b++ = (BUF_3D_ID_COLOR_BACK | tiling_bits | WIDTH*4);
|
*b++ = (BUF_3D_ID_COLOR_BACK | tiling_bits | WIDTH*4);
|
||||||
*b = fill_reloc(r++, b-batch, dst,
|
*b = fill_reloc(r++, b-batch, dst,
|
||||||
@ -311,12 +320,16 @@ render_copy(int fd,
|
|||||||
|
|
||||||
assert(r-reloc == 2);
|
assert(r-reloc == 2);
|
||||||
|
|
||||||
|
tiling_bits = 0;
|
||||||
|
if (use_fence)
|
||||||
|
tiling_bits = EXEC_OBJECT_NEEDS_FENCE;
|
||||||
|
|
||||||
obj[0].handle = dst;
|
obj[0].handle = dst;
|
||||||
obj[0].relocation_count = 0;
|
obj[0].relocation_count = 0;
|
||||||
obj[0].relocs_ptr = 0;
|
obj[0].relocs_ptr = 0;
|
||||||
obj[0].alignment = 0;
|
obj[0].alignment = 0;
|
||||||
obj[0].offset = 0;
|
obj[0].offset = 0;
|
||||||
obj[0].flags = 0;
|
obj[0].flags = tiling_bits;
|
||||||
obj[0].rsvd1 = 0;
|
obj[0].rsvd1 = 0;
|
||||||
obj[0].rsvd2 = 0;
|
obj[0].rsvd2 = 0;
|
||||||
|
|
||||||
@ -325,7 +338,7 @@ render_copy(int fd,
|
|||||||
obj[1].relocs_ptr = 0;
|
obj[1].relocs_ptr = 0;
|
||||||
obj[1].alignment = 0;
|
obj[1].alignment = 0;
|
||||||
obj[1].offset = 0;
|
obj[1].offset = 0;
|
||||||
obj[1].flags = 0;
|
obj[1].flags = tiling_bits;
|
||||||
obj[1].rsvd1 = 0;
|
obj[1].rsvd1 = 0;
|
||||||
obj[1].rsvd2 = 0;
|
obj[1].rsvd2 = 0;
|
||||||
|
|
||||||
@ -434,6 +447,19 @@ static void blt_copy(int fd, uint32_t dst, uint32_t src)
|
|||||||
gem_close(fd, handle);
|
gem_close(fd, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
copy(int fd,
|
||||||
|
uint32_t dst, int dst_tiling,
|
||||||
|
uint32_t src, int src_tiling)
|
||||||
|
{
|
||||||
|
switch (random() % 3) {
|
||||||
|
case 0: render_copy(fd, dst, dst_tiling, src, src_tiling, 0); break;
|
||||||
|
case 1: render_copy(fd, dst, dst_tiling, src, src_tiling, 1); break;
|
||||||
|
case 2: blt_copy(fd, dst, src); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
|
static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_mmap_gtt mmap_arg;
|
struct drm_i915_gem_mmap_gtt mmap_arg;
|
||||||
@ -543,10 +569,7 @@ int main(int argc, char **argv)
|
|||||||
int src = i % count;
|
int src = i % count;
|
||||||
int dst = (i + 1) % count;
|
int dst = (i + 1) % count;
|
||||||
|
|
||||||
if (random() & 1)
|
copy(fd, handle[dst], tiling[dst], handle[src], tiling[src]);
|
||||||
render_copy(fd, handle[dst], tiling[dst], handle[src], tiling[src]);
|
|
||||||
else
|
|
||||||
blt_copy(fd, handle[dst], handle[src]);
|
|
||||||
start_val[dst] = start_val[src];
|
start_val[dst] = start_val[src];
|
||||||
}
|
}
|
||||||
printf("verifying..."); fflush(stdout);
|
printf("verifying..."); fflush(stdout);
|
||||||
@ -559,10 +582,7 @@ int main(int argc, char **argv)
|
|||||||
int src = (i + 1) % count;
|
int src = (i + 1) % count;
|
||||||
int dst = i % count;
|
int dst = i % count;
|
||||||
|
|
||||||
if (random() & 1)
|
copy(fd, handle[dst], tiling[dst], handle[src], tiling[src]);
|
||||||
render_copy(fd, handle[dst], tiling[dst], handle[src], tiling[src]);
|
|
||||||
else
|
|
||||||
blt_copy(fd, handle[dst], handle[src]);
|
|
||||||
start_val[dst] = start_val[src];
|
start_val[dst] = start_val[src];
|
||||||
}
|
}
|
||||||
printf("verifying..."); fflush(stdout);
|
printf("verifying..."); fflush(stdout);
|
||||||
@ -578,10 +598,7 @@ int main(int argc, char **argv)
|
|||||||
while (src == dst)
|
while (src == dst)
|
||||||
dst = random() % count;
|
dst = random() % count;
|
||||||
|
|
||||||
if (random() & 1)
|
copy(fd, handle[dst], tiling[dst], handle[src], tiling[src]);
|
||||||
render_copy(fd, handle[dst], tiling[dst], handle[src], tiling[src]);
|
|
||||||
else
|
|
||||||
blt_copy(fd, handle[dst], handle[src]);
|
|
||||||
start_val[dst] = start_val[src];
|
start_val[dst] = start_val[src];
|
||||||
}
|
}
|
||||||
printf("verifying..."); fflush(stdout);
|
printf("verifying..."); fflush(stdout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user