Accepting request 131514 from X11:XOrg
llvmpipe, if available (bnc#766498). (forwarded request 131513 from fcrozat) OBS-URL: https://build.opensuse.org/request/show/131514 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/Mesa?expand=0&rev=155
This commit is contained in:
commit
7f87f54463
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Aug 23 15:29:34 UTC 2012 - fcrozat@suse.com
|
||||||
|
|
||||||
|
- Add u_mesa-8.0-llvmpipe-shmget.patch (Fedora): use shmget under
|
||||||
|
llvmpipe, if available (bnc#766498).
|
||||||
|
- Update u_mesa-8.0.1-fix-16bpp.patch to work with shmget patch.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Aug 8 15:43:20 CEST 2012 - tiwai@suse.de
|
Wed Aug 8 15:43:20 CEST 2012 - tiwai@suse.de
|
||||||
|
|
||||||
|
@ -96,6 +96,8 @@ Patch13: u_mesa-8.0.1-fix-16bpp.patch
|
|||||||
# Patch to remove OS ABI tag from libGL, so it is no longer preferred over libGLs without OS ABI tag
|
# Patch to remove OS ABI tag from libGL, so it is no longer preferred over libGLs without OS ABI tag
|
||||||
Patch14: u_remove-os-abi-tag.patch
|
Patch14: u_remove-os-abi-tag.patch
|
||||||
Patch15: U_i965-gen7-Reduce-GT1-WM-thread-count-according-to-up.patch
|
Patch15: U_i965-gen7-Reduce-GT1-WM-thread-count-according-to-up.patch
|
||||||
|
# Patch from Fedora, use shmget when available, under llvmpipe
|
||||||
|
Patch16: u_mesa-8.0-llvmpipe-shmget.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -476,6 +478,7 @@ packages.
|
|||||||
rm -rf docs/README.{VMS,WIN32,OS2}
|
rm -rf docs/README.{VMS,WIN32,OS2}
|
||||||
#%patch11 -p1
|
#%patch11 -p1
|
||||||
%patch12 -p1
|
%patch12 -p1
|
||||||
|
%patch16 -p1
|
||||||
%patch13 -p1
|
%patch13 -p1
|
||||||
%patch14 -p1
|
%patch14 -p1
|
||||||
%patch15 -p1
|
%patch15 -p1
|
||||||
|
156
u_mesa-8.0-llvmpipe-shmget.patch
Normal file
156
u_mesa-8.0-llvmpipe-shmget.patch
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
diff -up mesa-20120424/src/gallium/state_trackers/dri/sw/drisw.c.jx mesa-20120424/src/gallium/state_trackers/dri/sw/drisw.c
|
||||||
|
--- mesa-20120424/src/gallium/state_trackers/dri/sw/drisw.c.jx 2012-04-24 07:37:03.000000000 -0400
|
||||||
|
+++ mesa-20120424/src/gallium/state_trackers/dri/sw/drisw.c 2012-05-16 13:30:36.596312047 -0400
|
||||||
|
@@ -252,8 +252,6 @@ drisw_update_tex_buffer(struct dri_drawa
|
||||||
|
struct pipe_transfer *transfer;
|
||||||
|
char *map;
|
||||||
|
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);
|
||||||
|
|
||||||
|
@@ -266,14 +264,6 @@ drisw_update_tex_buffer(struct dri_drawa
|
||||||
|
/* 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. */
|
||||||
|
- ximage_stride = w * cpp;
|
||||||
|
- for (line = h-1; line; --line) {
|
||||||
|
- memmove(&map[line * transfer->stride],
|
||||||
|
- &map[line * ximage_stride],
|
||||||
|
- ximage_stride);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
pipe_transfer_unmap(pipe, transfer);
|
||||||
|
pipe_transfer_destroy(pipe, transfer);
|
||||||
|
}
|
||||||
|
diff -up mesa-20120424/src/glx/drisw_glx.c.jx mesa-20120424/src/glx/drisw_glx.c
|
||||||
|
--- mesa-20120424/src/glx/drisw_glx.c.jx 2012-04-24 07:37:03.000000000 -0400
|
||||||
|
+++ mesa-20120424/src/glx/drisw_glx.c 2012-05-16 13:29:25.087965268 -0400
|
||||||
|
@@ -24,6 +24,9 @@
|
||||||
|
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
+#include <sys/ipc.h>
|
||||||
|
+#include <sys/shm.h>
|
||||||
|
+#include <X11/extensions/XShm.h>
|
||||||
|
#include "glxclient.h"
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include "dri_common.h"
|
||||||
|
@@ -206,6 +209,96 @@ swrastPutImage(__DRIdrawable * draw, int
|
||||||
|
ximage->data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int shm_error;
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+shm_handler(Display *d, XErrorEvent *e)
|
||||||
|
+{
|
||||||
|
+ shm_error = 1;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+align(int value, int alignment)
|
||||||
|
+{
|
||||||
|
+ return (value + alignment - 1) & ~(alignment - 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Slight fast path. Short of changing how texture memory is allocated, we
|
||||||
|
+ * have two options for getting the pixels out. GetImage is clamped by the
|
||||||
|
+ * server's write buffer size, so you end up doing lots of relatively small
|
||||||
|
+ * requests (128k each or so), with two memcpys: down into the kernel, and
|
||||||
|
+ * then back up. ShmGetImage is one big blit into the shm segment (which
|
||||||
|
+ * could be GPU DMA, in principle) and then another one here.
|
||||||
|
+ */
|
||||||
|
+static Bool
|
||||||
|
+swrastShmGetImage(__DRIdrawable *read, char *data, struct drisw_drawable *prp)
|
||||||
|
+{
|
||||||
|
+ __GLXDRIdrawable *pread = &(prp->base);
|
||||||
|
+ Display *dpy = pread->psc->dpy;
|
||||||
|
+ XImage *ximage = prp->ximage;
|
||||||
|
+ unsigned long image_size = ximage->height * ximage->bytes_per_line;
|
||||||
|
+ Bool ret = 0;
|
||||||
|
+ XShmSegmentInfo seg = { 0, -1, (void *)-1, 0 };
|
||||||
|
+ int (*old_handler)(Display *, XErrorEvent *);
|
||||||
|
+
|
||||||
|
+ if (!XShmQueryExtension(dpy))
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ /* image setup */
|
||||||
|
+ seg.shmid = shmget(IPC_PRIVATE, image_size, IPC_CREAT | 0777);
|
||||||
|
+ if (seg.shmid < 0)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ seg.shmaddr = shmat(seg.shmid, NULL, 0);
|
||||||
|
+ if (seg.shmaddr == (void *)-1)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ XSync(dpy, 0);
|
||||||
|
+ old_handler = XSetErrorHandler(shm_handler);
|
||||||
|
+ XShmAttach(dpy, &seg);
|
||||||
|
+ XSync(dpy, 0);
|
||||||
|
+ XSetErrorHandler(old_handler);
|
||||||
|
+ if (shm_error)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ ximage->data = seg.shmaddr;
|
||||||
|
+ ximage->obdata = &seg;
|
||||||
|
+ if (!XShmGetImage(dpy, pread->xDrawable, ximage, 0, 0, -1))
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * ShmGetImage doesn't actually pay attention to ->bytes_per_line.
|
||||||
|
+ * We have to compensate for this somewhere since llvmpipe's natural
|
||||||
|
+ * tile width is 64. Do it here so we don't have to undo it with a
|
||||||
|
+ * bunch of memmove in the driver.
|
||||||
|
+ */
|
||||||
|
+ do {
|
||||||
|
+ int i;
|
||||||
|
+ char *src = ximage->data;
|
||||||
|
+ int dst_width = align(ximage->width * ximage->bits_per_pixel / 8, 256);
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < ximage->height; i++) {
|
||||||
|
+ memcpy(data, src, ximage->bytes_per_line);
|
||||||
|
+ data += dst_width;
|
||||||
|
+ src += ximage->bytes_per_line;
|
||||||
|
+ }
|
||||||
|
+ } while (0);
|
||||||
|
+ ret = 1;
|
||||||
|
+
|
||||||
|
+out:
|
||||||
|
+ ximage->obdata = NULL;
|
||||||
|
+ ximage->data = NULL;
|
||||||
|
+ shm_error = 0;
|
||||||
|
+ XShmDetach(dpy, &seg);
|
||||||
|
+ if (seg.shmaddr != (void *)-1)
|
||||||
|
+ shmdt(seg.shmaddr);
|
||||||
|
+ if (seg.shmid > -1)
|
||||||
|
+ shmctl(seg.shmid, IPC_RMID, NULL);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
swrastGetImage(__DRIdrawable * read,
|
||||||
|
int x, int y, int w, int h,
|
||||||
|
@@ -220,11 +313,17 @@ 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;
|
||||||
|
+
|
||||||
|
+ /* shm failed, fall back to protocol */
|
||||||
|
+ ximage->data = data;
|
||||||
|
+
|
||||||
|
XGetSubImage(dpy, readable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
|
||||||
|
|
||||||
|
ximage->data = NULL;
|
@ -1,3 +1,17 @@
|
|||||||
|
diff -up Mesa-8.0.1/src/glx/drisw_glx.c.jx Mesa-8.0.1/src/glx/drisw_glx.c
|
||||||
|
--- Mesa-8.0.1/src/glx/drisw_glx.c.jx 2012-04-02 10:34:23.000000000 -0400
|
||||||
|
+++ Mesa-8.0.1/src/glx/drisw_glx.c 2012-04-02 11:44:19.296407735 -0400
|
||||||
|
@@ -274,7 +274,9 @@ swrastShmGetImage(__DRIdrawable *read, c
|
||||||
|
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 -up Mesa-8.0.1/src/mesa/state_tracker/st_manager.c.jx Mesa-8.0.1/src/mesa/state_tracker/st_manager.c
|
diff -up Mesa-8.0.1/src/mesa/state_tracker/st_manager.c.jx Mesa-8.0.1/src/mesa/state_tracker/st_manager.c
|
||||||
--- Mesa-8.0.1/src/mesa/state_tracker/st_manager.c.jx 2012-02-14 18:44:00.000000000 -0500
|
--- Mesa-8.0.1/src/mesa/state_tracker/st_manager.c.jx 2012-02-14 18:44:00.000000000 -0500
|
||||||
+++ Mesa-8.0.1/src/mesa/state_tracker/st_manager.c 2012-04-02 12:02:14.613964417 -0400
|
+++ Mesa-8.0.1/src/mesa/state_tracker/st_manager.c 2012-04-02 12:02:14.613964417 -0400
|
||||||
|
Loading…
Reference in New Issue
Block a user