From 10c983077a782ff9d02b6e5c47281039830fe6fb Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 16 Nov 2018 15:18:24 +0100 Subject: lib/batchbuffer: Set bpp in igt_buf. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 [mlankhorst: Fix double ;; (Ville] Reviewed-by: Ville Syrjälä --- lib/intel_batchbuffer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/intel_batchbuffer.c') 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) && -- cgit v1.2.3