summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-11-16 15:18:24 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-11-20 17:37:05 +0100
commit10c983077a782ff9d02b6e5c47281039830fe6fb (patch)
treec91ced2d113943a4e11dde0dcafd581163027152 /lib
parentfdcdfa1e220c5070072d5dac9523cd105e7406c2 (diff)
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: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: Fix double ;; (Ville] Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_draw.c2
-rw-r--r--lib/intel_batchbuffer.c7
-rw-r--r--lib/intel_batchbuffer.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index 84dd212c..94f16632 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -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);
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index c13b1dc4..ad2e718f 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -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) &&
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 2dcb09ce..ecc23f08 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -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 {