Skip to content
Snippets Groups Projects
Commit 3f51e2f5 authored by Emma Anholt's avatar Emma Anholt Committed by Ian Romanick
Browse files

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: default avatarIan Romanick <ian.d.romanick@intel.com>
Acked-by: default avatarPaul Berry <stereotype441@gmail.com>
(cherry picked from commit 0a39cb88)
parent 54691913
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment