From 394bdb02b12c5cfa3ccf6d8f4266d06bbda80f22ec9898c7addfcaef206d31b8 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Mon, 16 Sep 2013 13:16:25 +0000 Subject: [PATCH] - updated to latest available version of * u_mesa-8.0-llvmpipe-shmget.patch * u_mesa-8.0.1-fix-16bpp.patch and applying it now in the opposite order. OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=325 --- Mesa.changes | 8 +++ Mesa.spec | 2 +- u_mesa-8.0-llvmpipe-shmget.patch | 88 ++++++++++++++++++++++++++------ u_mesa-8.0.1-fix-16bpp.patch | 60 +++++++++++++++++++++- 4 files changed, 140 insertions(+), 18 deletions(-) diff --git a/Mesa.changes b/Mesa.changes index 1b330c2..ed4965d 100644 --- a/Mesa.changes +++ b/Mesa.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Sep 16 12:44:53 UTC 2013 - sndirsch@suse.com + +- updated to latest available version of + * u_mesa-8.0-llvmpipe-shmget.patch + * u_mesa-8.0.1-fix-16bpp.patch + and applying it now in the opposite order. + ------------------------------------------------------------------- Fri Sep 13 12:53:33 UTC 2013 - duwe@suse.com diff --git a/Mesa.spec b/Mesa.spec index 54e31f2..8e88131 100644 --- a/Mesa.spec +++ b/Mesa.spec @@ -528,8 +528,8 @@ poor video quality, choppy videos and artefacts all over. # remove some docs rm -rf docs/README.{VMS,WIN32,OS2} #%patch11 -p1 -%patch13 -p1 %patch15 -p1 +%patch13 -p1 %if %egl_gallium %patch16 -p1 %endif diff --git a/u_mesa-8.0-llvmpipe-shmget.patch b/u_mesa-8.0-llvmpipe-shmget.patch index 72910a2..270a46e 100644 --- a/u_mesa-8.0-llvmpipe-shmget.patch +++ b/u_mesa-8.0-llvmpipe-shmget.patch @@ -1,3 +1,43 @@ +From c617fb498b2315efdccd799b8efb7a18a758fb36 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 22 Mar 2012 09:29:19 +0000 +Subject: [PATCHv4] glx: Use ShmGetImage if possible. + +v2: Adam Jackson +Fix image pitch bug. + +v3: Adam Jackson +Rediff for 8.1 + +v4: Stefan BrĂ¼ns +The patch handles failing XShmAttach with a special error handler, but in case +of an error it called XShmDetach unconditionally and unprotected. As there is +no XSync it failed later on the first call to a function causing a XSync. +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=917687 +Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=807205 +--- + +NOTE: +v3 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 + +v4 solves an issue on openSUSE:12.2. + +--- + src/gallium/state_trackers/dri/sw/drisw.c | 11 --- + src/glx/drisw_glx.c | 114 +++++++++++++++++++++++++++++- + 2 files changed, 113 insertions(+), 12 deletions(-) + diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 41f66d5..28beb80 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c @@ -8,13 +48,13 @@ index 41f66d5..28beb80 100644 int x, y, w, h; - int ximage_stride, line; - int cpp = util_format_get_blocksize(res->format); - + get_drawable_info(dPriv, &x, &y, &w, &h); - + @@ -265,15 +263,6 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, /* Copy the Drawable content to the mapped texture buffer */ get_image(dPriv, x, y, w, h, map); - + - /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. - get_image() has a pitch rounded up to 4 bytes. */ - ximage_stride = ((w * cpp) + 3) & -4; @@ -26,14 +66,14 @@ index 41f66d5..28beb80 100644 - pipe_transfer_unmap(pipe, transfer); } - + diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c -index 832e964..feac747 100644 +index 0583cd1..5643f15 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -24,6 +24,9 @@ #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - + #include +#include +#include @@ -44,8 +84,8 @@ index 832e964..feac747 100644 @@ -206,6 +209,96 @@ swrastPutImage(__DRIdrawable * draw, int op, ximage->data = NULL; } - -+static int shm_error; + ++static int shm_error = 0; + +static int +shm_handler(Display *d, XErrorEvent *e) @@ -79,7 +119,7 @@ index 832e964..feac747 100644 + XShmSegmentInfo seg = { 0, -1, (void *)-1, 0 }; + int (*old_handler)(Display *, XErrorEvent *); + -+ if (!XShmQueryExtension(dpy)) ++ if (shm_error || !XShmQueryExtension(dpy)) + goto out; + + /* image setup */ @@ -126,8 +166,8 @@ index 832e964..feac747 100644 +out: + ximage->obdata = NULL; + ximage->data = NULL; -+ shm_error = 0; -+ XShmDetach(dpy, &seg); ++ if (shm_error == 0) ++ XShmDetach(dpy, &seg); + if (seg.shmaddr != (void *)-1) + shmdt(seg.shmaddr); + if (seg.shmid > -1) @@ -138,15 +178,15 @@ index 832e964..feac747 100644 static void swrastGetImage(__DRIdrawable * read, int x, int y, int w, int h, -@@ -220,11 +313,17 @@ swrastGetImage(__DRIdrawable * read, +@@ -220,13 +313,32 @@ swrastGetImage(__DRIdrawable * read, readable = pread->xDrawable; - + ximage = prp->ximage; - ximage->data = data; ximage->width = w; ximage->height = h; ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32); - + + /* XXX check dimensions, if any caller ever sub-images */ + if (swrastShmGetImage(read, data, prp)) + return; @@ -155,5 +195,23 @@ index 832e964..feac747 100644 + ximage->data = data; + XGetSubImage(dpy, readable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0); - + ++ do { ++ int dst_width = align(ximage->width * ximage->bits_per_pixel / 8, 256); ++ int line; ++ ++ if (dst_width != ximage->bytes_per_line) { ++ for (line = ximage->height-1; line; line--) { ++ memmove(&data[dst_width * line], ++ &data[ximage->bytes_per_line * line], ++ dst_width); ++ } ++ } ++ } while (0); ++ ximage->data = NULL; + } + +-- +1.8.1.4 + diff --git a/u_mesa-8.0.1-fix-16bpp.patch b/u_mesa-8.0.1-fix-16bpp.patch index e033d6c..ee20999 100644 --- a/u_mesa-8.0.1-fix-16bpp.patch +++ b/u_mesa-8.0.1-fix-16bpp.patch @@ -1,9 +1,61 @@ +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..660ab16 100644 +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, @@ -11,3 +63,7 @@ index 9c2b4d2..660ab16 100644 + internalFormat = GL_RGB5; else internalFormat = GL_RGB; + +-- +1.8.1.4 +