diff options
author | Eric Anholt <[email protected]> | 2013-05-24 12:48:47 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-06-26 10:58:22 -0700 |
commit | 3f51e2f5ec178c91c8b2b290f752b31751c5ba73 (patch) | |
tree | 1dfce1b89a0871711b2e68f4b49dde711e3eafb1 /src/mesa | |
parent | 54691913f996c0c8695753f3b7f9441654c1f519 (diff) |
intel: Fix format handling of blit glBitmap()
Any 32-bit format got ARGB8888 handling (including, say, GL_RG1616), and
anything else got 16-bit (including, say, GL_R8), which could potentially
hang the GPU by writing out of bounds.
NOTE: This is a candidate for the stable branches.
Reviewed-and-tested-by: Ian Romanick <[email protected]>
Acked-by: Paul Berry <[email protected]>
(cherry picked from commit 0a39cb88deee338de3c82db2e70594f11ee1cc8d)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index c22d32c9da3..b03160cda4c 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -227,10 +227,19 @@ do_blit_bitmap( struct gl_context *ctx, UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[2], tmpColor[2]); UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]); - if (irb->mt->cpp == 2) - color = PACK_COLOR_565(ubcolor[0], ubcolor[1], ubcolor[2]); - else + switch (irb->mt->format) { + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_XRGB8888: color = PACK_COLOR_8888(ubcolor[3], ubcolor[0], ubcolor[1], ubcolor[2]); + break; + case MESA_FORMAT_RGB565: + color = PACK_COLOR_565(ubcolor[0], ubcolor[1], ubcolor[2]); + break; + default: + perf_debug("Unsupported format %s in accelerated glBitmap()\n", + _mesa_get_format_name(irb->mt->format)); + return false; + } if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F)) return false; |