From 8fd62e80ae1985b1dc466ecddbbed1e48edb08f9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 10 Jan 2013 15:22:12 -0800 Subject: [PATCH] intel: Make intel_blit.c take pitches in bytes. As we gain support for NPOT cpp, a pitch may not divide by cpp cleanly. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/intel/intel_blit.c | 5 ----- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 8 ++++---- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel_read.c | 4 ++-- src/mesa/drivers/dri/intel/intel_regions.c | 4 ++-- src/mesa/drivers/dri/intel/intel_tex_copy.c | 4 ++-- src/mesa/drivers/dri/intel/intel_tex_image.c | 3 ++- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 4 ++-- 8 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 867d7b3b6a7..9351df72505 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -144,9 +144,6 @@ intelEmitCopyBlit(struct intel_context *intel, src_buffer, src_pitch, src_offset, src_x, src_y, dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h); - src_pitch *= cpp; - dst_pitch *= cpp; - /* Blit pitch must be dword-aligned. Otherwise, the hardware appears to drop * the low bits. */ @@ -421,8 +418,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, if (w < 0 || h < 0) return true; - dst_pitch *= cpp; - DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d, %d bytes %d dwords\n", __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h, src_size, dwords); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 75422199d27..ad4378141d6 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -727,9 +727,9 @@ intel_miptree_copy_slice(struct intel_context *intel, if (!intelEmitCopyBlit(intel, dst_mt->region->cpp, - src_mt->region->pitch, src_mt->region->bo, + src_mt->region->pitch * src_mt->region->cpp, src_mt->region->bo, 0, src_mt->region->tiling, - dst_mt->region->pitch, dst_mt->region->bo, + dst_mt->region->pitch * dst_mt->region->cpp, dst_mt->region->bo, 0, dst_mt->region->tiling, src_x, src_y, dst_x, dst_y, @@ -1165,9 +1165,9 @@ intel_miptree_map_blit(struct intel_context *intel, if (!intelEmitCopyBlit(intel, mt->region->cpp, - mt->region->pitch, mt->region->bo, + mt->region->pitch * mt->region->cpp, mt->region->bo, 0, mt->region->tiling, - map->stride / mt->region->cpp, map->bo, + map->stride, map->bo, 0, I915_TILING_NONE, x, y, 0, 0, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 954dfc50b14..6105b429451 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -274,7 +274,7 @@ do_blit_bitmap( struct gl_context *ctx, (GLubyte *)stipple, sz, color, - dst->pitch, + dst->pitch * dst->cpp, dst->bo, 0, dst->tiling, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index ab4e581c400..1e524cd9230 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -151,8 +151,8 @@ do_blit_readpixels(struct gl_context * ctx, if (!intelEmitCopyBlit(intel, src->cpp, - src->pitch, src->bo, 0, src->tiling, - rowLength, dst_buffer, dst_offset, false, + src->pitch * src->cpp, src->bo, 0, src->tiling, + rowLength * src->cpp, dst_buffer, dst_offset, false, x, y, dst_x, dst_y, width, height, diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 7cb008c2f71..d9e026b27ea 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -391,8 +391,8 @@ intel_region_copy(struct intel_context *intel, return intelEmitCopyBlit(intel, dst->cpp, - src_pitch, src->bo, src_offset, src->tiling, - dst->pitch, dst->bo, dst_offset, dst->tiling, + src_pitch * src->cpp, src->bo, src_offset, src->tiling, + dst->pitch * dst->cpp, dst->bo, dst_offset, dst->tiling, srcx, srcy, dstx, dsty, width, height, logicop); } diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 1af7b1c5671..47b8dc3b3ae 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -125,11 +125,11 @@ intel_copy_texsubimage(struct intel_context *intel, /* blit from src buffer to texture */ if (!intelEmitCopyBlit(intel, intelImage->mt->cpp, - src_pitch, + src_pitch * region->cpp, region->bo, 0, region->tiling, - intelImage->mt->region->pitch, + intelImage->mt->region->pitch * intelImage->mt->cpp, intelImage->mt->region->bo, 0, intelImage->mt->region->tiling, diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index d1b5826db42..387f5a591b5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -182,12 +182,13 @@ try_pbo_upload(struct gl_context *ctx, src_stride = unpack->RowLength; else src_stride = image->Width; + src_stride *= intelImage->mt->region->cpp; intel_miptree_get_image_offset(intelImage->mt, intelImage->base.Base.Level, intelImage->base.Base.Face, &dst_x, &dst_y); - dst_stride = intelImage->mt->region->pitch; + dst_stride = intelImage->mt->region->pitch * intelImage->mt->region->cpp; if (!intelEmitCopyBlit(intel, intelImage->mt->cpp, diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index f07a312ffdf..bf9d2dc8fbd 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -136,9 +136,9 @@ intel_blit_texsubimage(struct gl_context * ctx, ret = intelEmitCopyBlit(intel, intelImage->mt->cpp, - dstRowStride / intelImage->mt->cpp, + dstRowStride, temp_bo, 0, false, - dst_pitch / intelImage->mt->cpp, + dst_pitch, intelImage->mt->region->bo, 0, intelImage->mt->region->tiling, 0, 0, blit_x, blit_y, width, height, -- 2.30.2