[gnome-ostree] manifest: Update meas to 9.0, enable llvmpipe



commit fb4275836775374ffd89bffec50fd742a90acac8
Author: Colin Walters <walters verbum org>
Date:   Fri Nov 16 18:57:50 2012 -0500

    manifest: Update meas to 9.0, enable llvmpipe
    
    This doesn't quite work in qemu for me, but should hopefully get us
    closer.

 manifest.json                          |   37 ++++---
 patches/mesa-8.0-llvmpipe-shmget.patch |  173 ++++++++++++++++++++++++++++++++
 patches/mesa-8.0.1-fix-16bpp.patch     |   30 ++++++
 patches/mesa-llvmpipe-dlopen.patch     |   61 +++++++++++
 4 files changed, 287 insertions(+), 14 deletions(-)
---
diff --git a/manifest.json b/manifest.json
index 0c6127e..168237d 100644
--- a/manifest.json
+++ b/manifest.json
@@ -361,20 +361,29 @@
 		 "config-opts": ["--enable-nouveau-experimental-api"]},
 
 		{"src": "fd-mesa:mesa",
-                 "tag": "16e0ebccb61b65a58db4b3bb1a25a953515eab90",
-		 "config-opts": ["--disable-asm",
-		 		 "--disable-glw",
-		                 "--disable-glut",
-				 "--enable-gl-osmesa",
-				 "--with-driver=dri",
-				 "--with-osmesa-bits=8",
-				 "--with-dri-driverdir=/usr/lib/dri",
-				 "--enable-egl",
-				 "--enable-gles1",
-				 "--enable-gles2",
-				 "--disable-gallium-egl",
-				 "--disable-gallium-llvm",
-                                 "--with-gallium-drivers=swrast"]},
+            	 "tag": "mesa-9.0", 
+		 "patches": ["mesa-llvmpipe-dlopen.patch",
+		 	    "mesa-8.0-llvmpipe-shmget.patch",
+			    "mesa-8.0.1-fix-16bpp.patch"],
+		 "config-opts": [
+            	     "--enable-pic", 
+            	     "--disable-asm", 
+		     "--disable-glw", 
+		     "--disable-glut", 
+		     "--enable-osmesa", 
+		     "--with-dri-driverdir=/usr/lib/dri", 
+		     "--enable-egl", 
+		     "--enable-gles1", 
+		     "--enable-gles2", 
+		     "--disable-gallium-egl", 
+		     "--with-egl-platforms=x11,drm",
+		     "--enable-shared-glapi",
+		     "--enable-gbm",
+		     "--enable-xa",
+		     "--with-gallium-drivers=r300,r600,nouveau,swrast",
+		     "--enable-gallium-llvm",
+		     "--with-dri-drivers=nouveau,radeon,r200,i915,i965"
+		     ]},
 
 		{"src": "fd:xorg/app/xkbcomp",
 		 "patches": ["xkbcomp-autogen.patch"]},
diff --git a/patches/mesa-8.0-llvmpipe-shmget.patch b/patches/mesa-8.0-llvmpipe-shmget.patch
new file mode 100644
index 0000000..cf19b72
--- /dev/null
+++ b/patches/mesa-8.0-llvmpipe-shmget.patch
@@ -0,0 +1,173 @@
+From 815879b955654f517fd80ac41ce738c3bd3efa08 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters verbum org>
+Date: Wed, 14 Nov 2012 19:49:04 -0500
+Subject: [PATCH] llvmpipe: Use ShmGetImage if possible
+
+* Wed Mar 21 2012 Adam Jackson <ajax redhat com> 8.0.1-6
+- mesa-8.0.1-llvmpipe-shmget.patch: Use ShmGetImage if possible
+---
+ src/gallium/state_trackers/dri/sw/drisw.c |   10 ---
+ src/glx/drisw_glx.c                       |  101 ++++++++++++++++++++++++++++-
+ 2 files changed, 100 insertions(+), 11 deletions(-)
+
+diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
+index 5247126..3cdb6eb 100644
+--- a/src/gallium/state_trackers/dri/sw/drisw.c
++++ b/src/gallium/state_trackers/dri/sw/drisw.c
+@@ -252,8 +252,6 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
+    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);
+ 
+@@ -265,14 +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. */
+-   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);
+ }
+ 
+diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
+index 014296b..03522a9 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 <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 op,
+    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.7.7.6
+
diff --git a/patches/mesa-8.0.1-fix-16bpp.patch b/patches/mesa-8.0.1-fix-16bpp.patch
new file mode 100644
index 0000000..c35de26
--- /dev/null
+++ b/patches/mesa-8.0.1-fix-16bpp.patch
@@ -0,0 +1,30 @@
+From 7cad0ff082977b9a4b5d7c90f0ed21ad79bb5676 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters verbum org>
+Date: Wed, 14 Nov 2012 19:48:01 -0500
+Subject: [PATCH] Fix 16bpp in llvmpipe
+
+Taken from Fedora mesa.spec:
+
+* Mon Apr 02 2012 Adam Jackson <ajax redhat com> 8.0.2-2
+- mesa-8.0.1-fix-16bpp.patch: Taken from Fedora mesa.spec
+---
+ src/mesa/state_tracker/st_manager.c |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
+index 88b886d..72f3139 100644
+--- a/src/mesa/state_tracker/st_manager.c
++++ b/src/mesa/state_tracker/st_manager.c
+@@ -530,6 +530,9 @@ st_context_teximage(struct st_context_iface *stctxi,
+       if (util_format_get_component_bits(internal_format,
+                UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
+          internalFormat = GL_RGBA;
++      else if (util_format_get_component_bits(internal_format,
++                 UTIL_FORMAT_COLORSPACE_RGB, 0) == 5)
++         internalFormat = GL_RGB5;
+       else
+          internalFormat = GL_RGB;
+ 
+-- 
+1.7.7.6
+
diff --git a/patches/mesa-llvmpipe-dlopen.patch b/patches/mesa-llvmpipe-dlopen.patch
new file mode 100644
index 0000000..5d4c470
--- /dev/null
+++ b/patches/mesa-llvmpipe-dlopen.patch
@@ -0,0 +1,61 @@
+From 7e2e29c67f8fc8ec72c2dc8544428fdd86b21353 Mon Sep 17 00:00:00 2001
+From: Olivier Blin <dev blino org>
+Date: Sat, 4 Aug 2012 00:29:45 +0200
+Subject: [PATCH] gallium: only link static archives between ld start/end
+ group options
+
+llvmpipe test programs failed to link with --as-needed ld option,
+since dynamic libraries were mixed with static libraries between the
+ld --start-group and --end-group options.
+
+gd3d1x likely had the same issue.
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52167
+---
+ src/gallium/Makefile.template                    | 2 +-
+ src/gallium/drivers/llvmpipe/Makefile            | 3 ++-
+ src/gallium/state_trackers/d3d1x/gd3d1x/Makefile | 3 ++-
+ 3 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template
+index 036c119..c30477a 100644
+--- a/src/gallium/Makefile.template
++++ b/src/gallium/Makefile.template
+@@ -41,7 +41,7 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURC
+ 	$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null
+ 
+ $(PROGS): % : %.o $(PROGS_DEPS)
+-	$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  $(LIBS) -Wl,--end-group
++	$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group  $(LIBS) -Wl,--end-group $(LDADD)
+ 
+ # Emacs tags
+ tags:
+diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
+index ef16fc7..35f8fe8 100644
+--- a/src/gallium/drivers/llvmpipe/Makefile
++++ b/src/gallium/drivers/llvmpipe/Makefile
+@@ -68,7 +68,8 @@ lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxil
+ 	$(PYTHON2) $(PYTHON_FLAGS) lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@
+ 
+ LDFLAGS += $(LLVM_LDFLAGS)
+-LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a $(LLVM_LIBS) $(GL_LIB_DEPS)
++LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a
++LDADD += $(LLVM_LIBS) $(GL_LIB_DEPS)
+ LD=$(CXX)
+ 
+ $(PROGS): lp_test_main.o libllvmpipe.a
+diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
+index 32d2956..f9cad05 100644
+--- a/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
++++ b/src/gallium/state_trackers/d3d1x/gd3d1x/Makefile
+@@ -3,5 +3,6 @@ CPP_SOURCES=$(wildcard *.cpp)
+ LIBRARY_INCLUDES=-Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../d3d1xstutil/include -I../d3d1xshader/include -I../../../include -I../../../auxiliary -I../../../state_trackers/egl/common
+ PROGS=tools/dxbc2tgsi
+ PROGS_DEPS=libgd3d1x.a ../d3d1xshader/libd3d1xshader.a ../d3d1xstutil/libd3d1xstutil.a ../../../auxiliary/libgallium.a
+-LIBS=$(PROGS_DEPS) -ldl
++LIBS=$(PROGS_DEPS)
++LDADD=-ldl
+ include ../Makefile.inc
+-- 
+1.7.11.4
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]