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
......@@ -228,6 +228,10 @@ struct igt_buf {
uint32_t tiling;
uint32_t *data;
uint32_t size;
struct {
uint32_t offset;
uint32_t stride;
} aux;
/*< private >*/
unsigned num_tiles;
};
......
......@@ -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,
sizeof(data->linear));
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
......
......@@ -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,
sizeof(data->linear));
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
......
......@@ -66,6 +66,8 @@ static void scratch_buf_init(struct igt_buf *buf,
drm_intel_bufmgr *bufmgr,
uint32_t pixel)
{
memset(buf, 0, sizeof(*buf));
buf->bo = create_bo(bufmgr, pixel);
buf->stride = STRIDE;
buf->tiling = I915_TILING_NONE;
......@@ -109,7 +111,7 @@ static void fork_rcs_copy(int target, drm_intel_bo **dst, int count, unsigned fl
igt_fork(child, count) {
struct intel_batchbuffer *batch;
struct igt_buf buf;
struct igt_buf buf = {};
batch = intel_batchbuffer_alloc(dst[child]->bufmgr,
devid);
......
......@@ -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);
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
......
......@@ -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,
sizeof(data->linear));
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
......
......@@ -105,7 +105,7 @@ static void run_test (int fd, int count)
igt_info("Cyclic blits, forward...\n");
for (i = 0; i < count * 4; i++) {
struct igt_buf src, dst;
struct igt_buf src = {}, dst = {};
src.bo = bo[i % count];
src.stride = STRIDE;
......@@ -128,7 +128,7 @@ static void run_test (int fd, int count)
igt_info("Cyclic blits, backward...\n");
for (i = 0; i < count * 4; i++) {
struct igt_buf src, dst;
struct igt_buf src = {}, dst = {};
src.bo = bo[(i + 1) % count];
src.stride = STRIDE;
......@@ -148,7 +148,7 @@ static void run_test (int fd, int count)
igt_info("Random blits...\n");
for (i = 0; i < count * 4; i++) {
struct igt_buf src, dst;
struct igt_buf src = {}, dst = {};
int s = random() % count;
int d = random() % count;
......
......@@ -61,7 +61,7 @@ static int snoop;
static void
check_bo(struct intel_batchbuffer *batch, struct igt_buf *buf, uint32_t val)
{
struct igt_buf tmp;
struct igt_buf tmp = {};
uint32_t *ptr;
int i;
......
......@@ -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)
{
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = 4 * WIDTH;
buf->tiling = I915_TILING_NONE;
......
......@@ -478,6 +478,8 @@ static void sanitize_stride(struct igt_buf *buf)
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->size = size;
igt_assert(buf->bo);
......
......@@ -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,
int size, int stride)
{
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = stride;
buf->tiling = I915_TILING_X;
......
......@@ -495,6 +495,8 @@ scratch_buf_init(drm_intel_bufmgr *bufmgr,
scratch_buf_memset(bo, width, height, color);
memset(buf, 0, sizeof(*buf));
buf->bo = bo;
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
......
......@@ -35,7 +35,7 @@
IGT_TEST_DESCRIPTION("Tests slice/subslice/EU power gating functionality.\n");
struct {
static struct {
int init;
int drm_fd;
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