Commit 10c98307 authored by Maarten Lankhorst's avatar Maarten Lankhorst

lib/batchbuffer: Set bpp in igt_buf.

We want to allow bpp = 8 or 16, so make sure we set the bpp
in igt_buf. This way we can extend rendercopy to support
other values for bpp.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
[mlankhorst: Fix double ;; (Ville]
Reviewed-by: Ville Syrjälä's avatarVille Syrjälä <ville.syrjala@linux.intel.com>
parent fdcdfa1e
......@@ -602,10 +602,12 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
src_buf.stride = tmp.stride;
src_buf.tiling = I915_TILING_NONE;
src_buf.size = tmp.size;
src_buf.bpp = 32;
dst_buf.bo = dst;
dst_buf.stride = buf->stride;
dst_buf.tiling = tiling;
dst_buf.size = buf->size;
dst_buf.bpp = 32;
batch = intel_batchbuffer_alloc(cmd_data->bufmgr, devid);
igt_assert(batch);
......
......@@ -511,7 +511,7 @@ intel_copy_bo(struct intel_batchbuffer *batch,
*/
unsigned igt_buf_width(const struct igt_buf *buf)
{
return buf->stride/sizeof(uint32_t);
return buf->stride/(buf->bpp / 8);
}
/**
......@@ -764,7 +764,6 @@ void igt_blitter_fast_copy__raw(int fd,
* @src_y: source pixel y-coordination
* @width: width of the copied rectangle
* @height: height of the copied rectangle
* @bpp: source and destination bits per pixel
* @dst: destination i-g-t buffer object
* @dst_delta: offset into the destination i-g-t bo
* @dst_x: destination pixel x-coordination
......@@ -785,10 +784,12 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
uint32_t src_pitch, dst_pitch;
uint32_t dword0, dword1;
igt_assert(src->bpp == dst->bpp);
src_pitch = fast_copy_pitch(src->stride, src->tiling);
dst_pitch = fast_copy_pitch(dst->stride, src->tiling);
dword0 = fast_copy_dword0(src->tiling, dst->tiling);
dword1 = fast_copy_dword1(src->tiling, dst->tiling, bpp);
dword1 = fast_copy_dword1(src->tiling, dst->tiling, dst->bpp);
#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15))
assert(CHECK_RANGE(src_x) && CHECK_RANGE(src_y) &&
......
......@@ -215,6 +215,7 @@ void intel_copy_bo(struct intel_batchbuffer *batch,
* @bo: underlying libdrm buffer object
* @stride: stride of the buffer
* @tiling: tiling mode bits
* @bpp: bits per pixel, 8, 16 or 32.
* @data: pointer to the memory mapping of the buffer
* @size: size of the buffer object
*
......@@ -226,6 +227,7 @@ struct igt_buf {
drm_intel_bo *bo;
uint32_t stride;
uint32_t tiling;
uint32_t bpp;
uint32_t *data;
uint32_t size;
struct {
......
......@@ -854,11 +854,13 @@ static void render_copy_bo(struct buffers *b, drm_intel_bo *dst, drm_intel_bo *s
.size = b->npixels * 4,
.num_tiles = b->npixels * 4,
.stride = b->width * 4,
.bpp = 32,
}, s = {
.bo = src,
.size = b->npixels * 4,
.num_tiles = b->npixels * 4,
.stride = b->width * 4,
.bpp = 32,
};
uint32_t swizzle;
......
......@@ -78,6 +78,7 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
buf->size = SIZE;
buf->bpp = 32;
}
static void
......
......@@ -81,6 +81,7 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
buf->size = SIZE;
buf->bpp = 32;
}
static void
......
......@@ -76,6 +76,7 @@ static void scratch_buf_init(struct igt_buf *buf,
buf->stride = STRIDE;
buf->tiling = I915_TILING_NONE;
buf->size = SIZE;
buf->bpp = 32;
}
static void scratch_buf_fini(struct igt_buf *buf)
......@@ -132,6 +133,7 @@ static void fork_rcs_copy(int target, drm_intel_bo **dst, int count, unsigned fl
buf.stride = STRIDE;
buf.tiling = I915_TILING_NONE;
buf.size = SIZE;
buf.bpp = 32;
for (int i = 0; i <= target; i++) {
struct igt_buf src;
......
......@@ -56,11 +56,13 @@ static drm_intel_bo *rcs_copy_bo(drm_intel_bo *dst, drm_intel_bo *src)
.size = width * height * 4,
.num_tiles = width * height * 4,
.stride = width * 4,
.bpp = 32,
}, s = {
.bo = src,
.size = width * height * 4,
.num_tiles = width * height * 4,
.stride = width * 4,
.bpp = 32,
};
uint32_t swizzle;
drm_intel_bo *bo = batch->bo;
......
......@@ -287,6 +287,7 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
buf->stride = ALIGN(width * 4, 128);
buf->size = buf->stride * height;
buf->tiling = tiling;
buf->bpp = 32;
aux_width = scratch_buf_aux_width(buf);
aux_height = scratch_buf_aux_height(buf);
......@@ -309,6 +310,7 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
buf->stride = pitch;
buf->tiling = tiling;
buf->size = pitch * height;
buf->bpp = 32;
}
igt_assert(igt_buf_width(buf) == width);
......
......@@ -109,6 +109,7 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf,
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
buf->size = SIZE;
buf->bpp = 32;
}
static void scratch_buf_fini(data_t *data, struct igt_buf *buf)
......
......@@ -111,11 +111,13 @@ static void run_test (int fd, int count)
src.stride = STRIDE;
src.tiling = I915_TILING_NONE;
src.size = SIZE;
src.bpp = 32;
dst.bo = bo[(i + 1) % count];
dst.stride = STRIDE;
dst.tiling = I915_TILING_NONE;
dst.size = SIZE;
dst.bpp = 32;
render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
start_val[(i + 1) % count] = start_val[i % count];
......@@ -134,11 +136,13 @@ static void run_test (int fd, int count)
src.stride = STRIDE;
src.tiling = I915_TILING_NONE;
src.size = SIZE;
src.bpp = 32;
dst.bo = bo[i % count];
dst.stride = STRIDE;
dst.tiling = I915_TILING_NONE;
dst.size = SIZE;
dst.bpp = 32;
render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
start_val[i % count] = start_val[(i + 1) % count];
......@@ -159,11 +163,13 @@ static void run_test (int fd, int count)
src.stride = STRIDE;
src.tiling = I915_TILING_NONE;
src.size = SIZE;
src.bpp = 32;
dst.bo = bo[d];
dst.stride = STRIDE;
dst.tiling = I915_TILING_NONE;
dst.size = SIZE;
dst.bpp = 32;
render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, 0, 0);
start_val[d] = start_val[s];
......
......@@ -69,6 +69,7 @@ check_bo(struct intel_batchbuffer *batch, struct igt_buf *buf, uint32_t val)
tmp.stride = STRIDE;
tmp.tiling = I915_TILING_NONE;
tmp.size = SIZE;
tmp.bpp = 32;
render_copy(batch, NULL, buf, 0, 0, WIDTH, HEIGHT, &tmp, 0, 0);
if (snoop) {
......@@ -134,6 +135,7 @@ static void run_test (int fd, int count)
buf[i].stride = pitch;
buf[i].tiling = tiling;
buf[i].size = SIZE;
buf[i].bpp = 32;
start_val[i] = start;
......
......@@ -137,6 +137,7 @@ static void scratch_buf_init_from_bo(struct igt_buf *buf, drm_intel_bo *bo)
buf->stride = 4 * WIDTH;
buf->tiling = I915_TILING_NONE;
buf->size = 4 * WIDTH * HEIGHT;
buf->bpp = 32;
}
static void scratch_buf_init(data_t *data, struct igt_buf *buf,
......
......@@ -485,6 +485,7 @@ static void init_buffer(struct igt_buf *buf, unsigned size)
igt_assert(buf->bo);
buf->tiling = I915_TILING_NONE;
buf->stride = 4096;
buf->bpp = 32;
sanitize_stride(buf);
......
......@@ -153,6 +153,7 @@ static void scratch_buf_init(struct igt_buf *buf, drm_intel_bo *bo,
buf->stride = stride;
buf->tiling = I915_TILING_X;
buf->size = size;
buf->bpp = 32;
}
static void fill_render(data_t *data, uint32_t handle, unsigned char color)
......
......@@ -501,6 +501,7 @@ scratch_buf_init(drm_intel_bufmgr *bufmgr,
buf->stride = stride;
buf->tiling = I915_TILING_NONE;
buf->size = size;
buf->bpp = 32;
}
static void
......
......@@ -303,6 +303,7 @@ gem_init(void)
gem.buf.tiling = I915_TILING_NONE;
gem.buf.size = gem.buf.stride;
gem.buf.bo = drm_intel_bo_alloc(gem.bufmgr, "", gem.buf.size, 4096);
gem.buf.bpp = 32;
igt_assert(gem.buf.bo);
gem.init = 4;
......
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