[igt-dev] [PATCH i-g-t 6/7] tests/gem_render_copy: Add subtests for different tiling modes
Chris Wilson
chris at chris-wilson.co.uk
Wed Jul 4 16:45:42 UTC 2018
Quoting Ville Syrjala (2018-07-04 17:16:45)
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Make sure our rendercopy implementations do the right thing with
> tiled buffers.
>
> For now we'll just do linear->linear, x-tiled->x-tiled, and
> y-tiled->y-tiled. Not sure there's much point in adding tests
> for different src vs. dst tiling modes?
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> static void scratch_buf_init(data_t *data, struct igt_buf *buf,
> - int width, int height, int stride)
> + int width, int height, int stride,
> + uint32_t tiling)
> {
> drm_intel_bo *bo;
> int size = height * stride;
> @@ -210,9 +226,12 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
>
> buf->bo = bo;
> buf->stride = stride;
> - buf->tiling = I915_TILING_NONE;
> + buf->tiling = tiling;
> buf->size = size;
>
> + drm_intel_bo_set_tiling(buf->bo, &tiling, buf->stride);
> + igt_assert_eq(tiling, buf->tiling);
I'd feel more confident with
drm_intel_bo *bo;
- int size = height * stride;
+ uint32_t tiling = req_tiling;
+ unsigned long pitch;
- bo = drm_intel_bo_alloc(data->bufmgr, "", size, 4096);
+ bo = drm_intel_bo_alloc_tiled(data->bufmgr, "",
+ width, height, 4,
+ &tiling, &pitch, 0);
+ igt_assert(tiling === req_tiling);
buf->bo = bo;
- buf->stride = stride;
- buf->tiling = I915_TILING_NONE;
- buf->size = size;
+ buf->stride = pitch;
+ buf->tiling = tiling;
+ buf->size = pitch * height;
It just so happens that STRIDE is a tile width, but testing odd
drawables might be useful (considering recent bugs ;)
-Chris
More information about the igt-dev
mailing list