aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel/intel_tex_subimage.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-01-10 15:11:28 -0800
committerEric Anholt <[email protected]>2013-01-18 12:48:13 -0800
commit60894edeef973e86a73067276f658b72f84271b6 (patch)
tree8ad06635586742380f5f429eecae0502057597d5 /src/mesa/drivers/dri/intel/intel_tex_subimage.c
parent8fd62e80ae1985b1dc466ecddbbed1e48edb08f9 (diff)
intel: Make intel_region's pitch be bytes instead of pixels.
We almost never want a stride in pixels -- if you're doing anything with a stride, you're specifying an offset or incrementing a pointer, and in both cases you had to multiply by cpp to get the bytes value you wanted. But worse, on the way to creating a region from a new tiled BO, we divided by cpp to get pitch in pixels, and for an RGB32 buffer (an upcoming change) the pitch wouldn't divide exactly, and we'd end up with a wrong stride in our region. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_tex_subimage.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index bf9d2dc8fbd..7a2f713c88f 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -129,8 +129,6 @@ intel_blit_texsubimage(struct gl_context * ctx,
}
bool ret;
- unsigned int dst_pitch = intelImage->mt->region->pitch *
- intelImage->mt->cpp;
drm_intel_gem_bo_unmap_gtt(temp_bo);
@@ -138,7 +136,7 @@ intel_blit_texsubimage(struct gl_context * ctx,
intelImage->mt->cpp,
dstRowStride,
temp_bo, 0, false,
- dst_pitch,
+ intelImage->mt->region->pitch,
intelImage->mt->region->bo, 0,
intelImage->mt->region->tiling,
0, 0, blit_x, blit_y, width, height,
@@ -268,7 +266,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
const uint32_t cpp = 4; /* chars per pixel of GL_BGRA */
const uint32_t swizzle_width_pixels = 16;
- const uint32_t stride_bytes = image->mt->region->pitch * cpp;
+ const uint32_t stride_bytes = image->mt->region->pitch;
const uint32_t width_tiles = stride_bytes / tile_width_bytes;
for (uint32_t y_pixels = yoffset; y_pixels < y_max_pixels; ++y_pixels) {