Commit a4393c39 authored by Ville Syrjälä's avatar Ville Syrjälä

lib: Add aux surface state to igt_buf

Store a bit of aux surface state in igt_buf. This will be needed
for rendercopy AUX_CCS_E color compression.

We also have to sprinkle memset()s and whatnot all over to make
sure the current igt_buf users don't leave the aux stuff full
of stack garbage.
Signed-off-by: Ville Syrjälä's avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent ae539ba6
...@@ -223,13 +223,17 @@ void intel_copy_bo(struct intel_batchbuffer *batch, ...@@ -223,13 +223,17 @@ void intel_copy_bo(struct intel_batchbuffer *batch,
* fill functions. * fill functions.
*/ */
struct igt_buf { struct igt_buf {
drm_intel_bo *bo; drm_intel_bo *bo;
uint32_t stride; uint32_t stride;
uint32_t tiling; uint32_t tiling;
uint32_t *data; uint32_t *data;
uint32_t size; uint32_t size;
/*< private >*/ struct {
unsigned num_tiles; uint32_t offset;
uint32_t stride;
} aux;
/*< private >*/
unsigned num_tiles;
}; };
unsigned igt_buf_width(const struct igt_buf *buf); unsigned igt_buf_width(const struct igt_buf *buf);
......
...@@ -72,6 +72,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf, ...@@ -72,6 +72,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
gem_write(data->drm_fd, bo->handle, 0, data->linear, gem_write(data->drm_fd, bo->handle, 0, data->linear,
sizeof(data->linear)); sizeof(data->linear));
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = stride; buf->stride = stride;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
......
...@@ -75,6 +75,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf, ...@@ -75,6 +75,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
gem_write(data->drm_fd, bo->handle, 0, data->linear, gem_write(data->drm_fd, bo->handle, 0, data->linear,
sizeof(data->linear)); sizeof(data->linear));
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = stride; buf->stride = stride;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
......
...@@ -66,6 +66,8 @@ static void scratch_buf_init(struct igt_buf *buf, ...@@ -66,6 +66,8 @@ static void scratch_buf_init(struct igt_buf *buf,
drm_intel_bufmgr *bufmgr, drm_intel_bufmgr *bufmgr,
uint32_t pixel) uint32_t pixel)
{ {
memset(buf, 0, sizeof(*buf));
buf->bo = create_bo(bufmgr, pixel); buf->bo = create_bo(bufmgr, pixel);
buf->stride = STRIDE; buf->stride = STRIDE;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
...@@ -109,7 +111,7 @@ static void fork_rcs_copy(int target, drm_intel_bo **dst, int count, unsigned fl ...@@ -109,7 +111,7 @@ static void fork_rcs_copy(int target, drm_intel_bo **dst, int count, unsigned fl
igt_fork(child, count) { igt_fork(child, count) {
struct intel_batchbuffer *batch; struct intel_batchbuffer *batch;
struct igt_buf buf; struct igt_buf buf = {};
batch = intel_batchbuffer_alloc(dst[child]->bufmgr, batch = intel_batchbuffer_alloc(dst[child]->bufmgr,
devid); devid);
......
...@@ -206,6 +206,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf, ...@@ -206,6 +206,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096); bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = stride; buf->stride = stride;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
......
...@@ -103,6 +103,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf, ...@@ -103,6 +103,8 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
gem_write(data->fd, bo->handle, 0, data->linear, gem_write(data->fd, bo->handle, 0, data->linear,
sizeof(data->linear)); sizeof(data->linear));
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = stride; buf->stride = stride;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
......
...@@ -105,7 +105,7 @@ static void run_test (int fd, int count) ...@@ -105,7 +105,7 @@ static void run_test (int fd, int count)
igt_info("Cyclic blits, forward...\n"); igt_info("Cyclic blits, forward...\n");
for (i = 0; i < count * 4; i++) { for (i = 0; i < count * 4; i++) {
struct igt_buf src, dst; struct igt_buf src = {}, dst = {};
src.bo = bo[i % count]; src.bo = bo[i % count];
src.stride = STRIDE; src.stride = STRIDE;
...@@ -128,7 +128,7 @@ static void run_test (int fd, int count) ...@@ -128,7 +128,7 @@ static void run_test (int fd, int count)
igt_info("Cyclic blits, backward...\n"); igt_info("Cyclic blits, backward...\n");
for (i = 0; i < count * 4; i++) { for (i = 0; i < count * 4; i++) {
struct igt_buf src, dst; struct igt_buf src = {}, dst = {};
src.bo = bo[(i + 1) % count]; src.bo = bo[(i + 1) % count];
src.stride = STRIDE; src.stride = STRIDE;
...@@ -148,7 +148,7 @@ static void run_test (int fd, int count) ...@@ -148,7 +148,7 @@ static void run_test (int fd, int count)
igt_info("Random blits...\n"); igt_info("Random blits...\n");
for (i = 0; i < count * 4; i++) { for (i = 0; i < count * 4; i++) {
struct igt_buf src, dst; struct igt_buf src = {}, dst = {};
int s = random() % count; int s = random() % count;
int d = random() % count; int d = random() % count;
......
...@@ -61,7 +61,7 @@ static int snoop; ...@@ -61,7 +61,7 @@ static int snoop;
static void static void
check_bo(struct intel_batchbuffer *batch, struct igt_buf *buf, uint32_t val) check_bo(struct intel_batchbuffer *batch, struct igt_buf *buf, uint32_t val)
{ {
struct igt_buf tmp; struct igt_buf tmp = {};
uint32_t *ptr; uint32_t *ptr;
int i; int i;
......
...@@ -131,6 +131,8 @@ static void bo_check(data_t *data, drm_intel_bo *bo, uint32_t val) ...@@ -131,6 +131,8 @@ static void bo_check(data_t *data, drm_intel_bo *bo, uint32_t val)
static void scratch_buf_init_from_bo(struct igt_buf *buf, drm_intel_bo *bo) static void scratch_buf_init_from_bo(struct igt_buf *buf, drm_intel_bo *bo)
{ {
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = 4 * WIDTH; buf->stride = 4 * WIDTH;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
......
...@@ -478,6 +478,8 @@ static void sanitize_stride(struct igt_buf *buf) ...@@ -478,6 +478,8 @@ static void sanitize_stride(struct igt_buf *buf)
static void init_buffer(struct igt_buf *buf, unsigned size) static void init_buffer(struct igt_buf *buf, unsigned size)
{ {
memset(buf, 0, sizeof(*buf));
buf->bo = drm_intel_bo_alloc(bufmgr, "tiled bo", size, 4096); buf->bo = drm_intel_bo_alloc(bufmgr, "tiled bo", size, 4096);
buf->size = size; buf->size = size;
igt_assert(buf->bo); igt_assert(buf->bo);
......
...@@ -150,6 +150,8 @@ static void fill_blt(data_t *data, uint32_t handle, unsigned char color) ...@@ -150,6 +150,8 @@ static void fill_blt(data_t *data, uint32_t handle, unsigned char color)
static void scratch_buf_init(struct igt_buf *buf, drm_intel_bo *bo, static void scratch_buf_init(struct igt_buf *buf, drm_intel_bo *bo,
int size, int stride) int size, int stride)
{ {
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = stride; buf->stride = stride;
buf->tiling = I915_TILING_X; buf->tiling = I915_TILING_X;
......
...@@ -495,6 +495,8 @@ scratch_buf_init(drm_intel_bufmgr *bufmgr, ...@@ -495,6 +495,8 @@ scratch_buf_init(drm_intel_bufmgr *bufmgr,
scratch_buf_memset(bo, width, height, color); scratch_buf_memset(bo, width, height, color);
memset(buf, 0, sizeof(*buf));
buf->bo = bo; buf->bo = bo;
buf->stride = stride; buf->stride = stride;
buf->tiling = I915_TILING_NONE; buf->tiling = I915_TILING_NONE;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
IGT_TEST_DESCRIPTION("Tests slice/subslice/EU power gating functionality.\n"); IGT_TEST_DESCRIPTION("Tests slice/subslice/EU power gating functionality.\n");
struct { static struct {
int init; int init;
int drm_fd; int drm_fd;
int devid; int devid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment