aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_tex_image.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-10-03 20:03:41 -0700
committerEric Anholt <[email protected]>2013-10-23 15:33:19 -0700
commitc298f5ff5681dd7c3cf0bf7c37a6f22430deeb91 (patch)
tree76d47ef95657b9ff447d67baf8c2a75266b5652b /src/mesa/drivers/dri/i965/intel_tex_image.c
parent3b58e0ed642b1833b86dbefb36b6055a6709a720 (diff)
i965: Try to avoid stalls on the GPU when doing glBufferSubData().
On DOTA2, framerate on dota2-de1.dem in windowed mode on my laptop improves by 7.69854% +/- 0.909163% (n=3). In a microbenchmark hitting this code path (wall time of piglit vbo-subdata-many), runtime decreases from 0.8 to 0.05 seconds. v2: Use out of range start/end instead of separate bool for the active flag (suggestion by Jordan), fix double-upload in the stalling path. Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_tex_image.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index c5d99e19df5..cc50f84ea32 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -126,13 +126,14 @@ try_pbo_upload(struct gl_context *ctx,
return false;
}
- src_buffer = intel_bufferobj_buffer(brw, pbo, INTEL_READ);
- /* note: potential 64-bit ptr to 32-bit int cast */
- src_offset = (GLuint) (unsigned long) pixels;
-
int src_stride =
_mesa_image_row_stride(unpack, image->Width, format, type);
+ /* note: potential 64-bit ptr to 32-bit int cast */
+ src_offset = (GLuint) (unsigned long) pixels;
+ src_buffer = intel_bufferobj_buffer(brw, pbo,
+ src_offset, src_stride * image->Height);
+
struct intel_mipmap_tree *pbo_mt =
intel_miptree_create_for_bo(brw,
src_buffer,