From 60fe1551667dba2cb9afa085fdff0cbc351a3e73 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 2 Apr 2012 16:27:19 +0000 Subject: [PATCH 2/2] glx: Fix 16bpp in llvmpipe. v2: Richard Hughes Rebuild with new git snapshot - Remove upstreamed patches v3: Johannes Obermayr Revert changes made in v2. --- v2 has not been applied on Fedora for a while (since 9.0): http://pkgs.fedoraproject.org/cgit/mesa.git/commit/?h=f18&id=9058f5a # this fastpath is: # - broken with swrast classic # - broken on 24bpp # - not a huge win anyway # - ABI-broken wrt upstream # - eventually obsoleted by vgem # # dear ajax: fix this one way or the other #patch9 -p1 -b .shmget #patch12 -p1 -b .16bpp This "broken on 24bpp" could be because v2 removed changes which depend on XShmGetImage patch. I assume Richard didn't notice this dependency and thought changes were upstreamed: http://pkgs.fedoraproject.org/cgit/mesa.git/commit/?id=43e76b8 So revert v2 and apply XShmGetImage patch before. --- src/glx/drisw_glx.c | 4 +++- src/mesa/state_tracker/st_manager.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 08fa1d9..f94fa4b 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -277,7 +277,9 @@ swrastShmGetImage(__DRIdrawable *read, char *data, struct drisw_drawable *prp) do { int i; char *src = ximage->data; - int dst_width = align(ximage->width * ximage->bits_per_pixel / 8, 256); + int bytes_per_pixel = ((ximage->bits_per_pixel + 7) / 8); + int dst_width = align(ximage->width * bytes_per_pixel, + 64 * bytes_per_pixel); for (i = 0; i < ximage->height; i++) { memcpy(data, src, ximage->bytes_per_line); diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 9c2b4d2..c6a3189 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -512,6 +512,9 @@ st_context_teximage(struct st_context_iface *stctxi, if (util_format_has_alpha(tex->format)) internalFormat = GL_RGBA; + else if (util_format_get_component_bits(pipe_format, + UTIL_FORMAT_COLORSPACE_RGB, 0) == 5) + internalFormat = GL_RGB5; else internalFormat = GL_RGB; -- 1.8.1.4