diff options
Diffstat (limited to 'meta/recipes-graphics/mesa')
22 files changed, 677 insertions, 0 deletions
diff --git a/meta/recipes-graphics/mesa/mesa-7.11.inc b/meta/recipes-graphics/mesa/mesa-7.11.inc new file mode 100644 index 000000000..7c4a6904d --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-7.11.inc @@ -0,0 +1,20 @@ +DEPENDS += "mesa-dri-glsl-native" + + +SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaLib-${PV}.tar.bz2 \ + file://uclibc.patch \ + file://crossfix.patch \ + file://crossfix-mklib.patch \ + file://mesa_fix_for_x32.patch \ + " +S = "${WORKDIR}/Mesa-${PV}" + +SRC_URI[md5sum] = "ff03aca82d0560009a076a87c888cf13" +SRC_URI[sha256sum] = "f8bf37a00882840a3e3d327576bc26a79ae7f4e18fe1f7d5f17a5b1c80dd7acf" + +do_configure_prepend() { + #check for python not python2, because python-native does not stage python2 binary/link + sed -i 's/AC_CHECK_PROGS(\[PYTHON2\], \[python2 python\])/AC_CHECK_PROGS(\[PYTHON2\], \[python python\])/g' ${S}/configure.ac + # We need builtin_compiler built for buildhost arch instead of target (is provided by mesa-dri-glsl-native)" + sed -i "s#\./builtin_compiler#${STAGING_BINDIR_NATIVE}/glsl/builtin_compiler#g" ${S}/src/glsl/Makefile +} diff --git a/meta/recipes-graphics/mesa/mesa-common.inc b/meta/recipes-graphics/mesa/mesa-common.inc new file mode 100644 index 000000000..f697e673e --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-common.inc @@ -0,0 +1,54 @@ +SUMMARY = "A free implementation of the OpenGL API" +DESCRIPTION = "Mesa is an open-source implementation of the OpenGL specification - \ +a system for rendering interactive 3D graphics. \ +A variety of device drivers allows Mesa to be used in many different environments \ +ranging from software emulation to complete hardware acceleration for modern GPUs. \ +Mesa is used as part of the overall Direct Rendering Infrastructure and X.org \ +environment." + +HOMEPAGE = "http://mesa3d.org" +BUGTRACKER = "https://bugs.freedesktop.org" +SECTION = "x11" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://docs/license.html;md5=7a3373c039b6b925c427755a4f779c1d" + +INC_PR = "r14" +PE = "2" + + +PROTO_DEPS = "xf86driproto glproto" +LIB_DEPS = "virtual/libx11 libxext libxxf86vm libxdamage libxfixes libxml2-native" + +DEPENDS = "makedepend-native python-native flex-native bison-native ${PROTO_DEPS} ${LIB_DEPS}" + +PROVIDES = "virtual/libgl" + +# for mesa-dri and mesa-xlib +FILESEXTRAPATHS_append := "${THISDIR}/mesa:" + +inherit autotools pkgconfig + +EXTRA_OECONF = "--enable-glu \ + --disable-glw \ + --disable-glut \ + --enable-glx-tls" + +# Multiple virtual/gl providers being built breaks staging +EXCLUDE_FROM_WORLD = "1" + +# ie mesa-dri could be empty and mesa-dri-dev RDEPENDS on it +ALLOW_EMPTY_${PN} = "1" + +PACKAGES =+ "libegl libegl-dev libegl-dbg libglu libglu-dev libosmesa libosmesa-dev libgl libgl-dev" +FILES_libegl = "${libdir}/libEGL.so.* ${libdir}/egl/*.so" +FILES_libgl = "${libdir}/libGL.so.*" +FILES_libglu = "${libdir}/libGLU.so.*" +FILES_libosmesa = "${libdir}/libOSMesa.so.*" + +FILES_libegl-dev = "${libdir}/libEGL.* ${includedir}/EGL" +FILES_libgl-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc" +FILES_libglu-dev = "${libdir}/libGLU.* ${includedir}/GL/glu*.h" +FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/osmesa.h" + +FILES_${PN}-dbg += "${libdir}/dri/.debug/*" +FILES_libegl-dbg += "${libdir}/egl/.debug/*" diff --git a/meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch b/meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch new file mode 100644 index 000000000..9b5e95218 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch @@ -0,0 +1,24 @@ +after gcc linking has changed, all the libraries must be explicitely specified +This patch avoids these linking errors: + +| CCLD xeglgears +| /build_disk/poky_build/build0/tmp/sysroots/x86_64-linux/usr/libexec/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.5.1/ld: xeglthreads.o: undefined reference to symbol 'pthread_join@@GLIBC_2.4' +| /build_disk/poky_build/build0/tmp/sysroots/x86_64-linux/usr/libexec/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.5.1/ld: note: 'pthread_join@@GLIBC_2.4' is defined in DSO /build_disk/poky_build/build0/tmp/sysroots/qemuarm/lib/libpthread.so.0 so try adding it to the linker command line +| /build_disk/poky_build/build0/tmp/sysroots/qemuarm/lib/libpthread.so.0: could not read symbols: Invalid operation +| collect2: ld returned 1 exit status + + +Nitin A Kamble <nitin.a.kamble@intel.com> +Date: 2011/02/03 + +Upstream-Status: Pending + +Index: mesa-demos-8.0.1/src/egl/opengl/Makefile.am +=================================================================== +--- mesa-demos-8.0.1.orig/src/egl/opengl/Makefile.am 2010-07-07 10:57:15.000000000 -0700 ++++ mesa-demos-8.0.1/src/egl/opengl/Makefile.am 2011-02-03 14:30:13.928486381 -0800 +@@ -67,3 +67,4 @@ + + eglgears_x11_LDADD = ../eglut/libeglut_x11.la + egltri_x11_LDADD = ../eglut/libeglut_x11.la ++xeglthreads_LDADD = -lpthread diff --git a/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb b/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb new file mode 100644 index 000000000..bfc62c585 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb @@ -0,0 +1,22 @@ +SUMMARY = "Mesa demo applications" +DESCRIPTION = "This package includes the demonstration application, such as glxgears. \ +These applications can be used for Mesa validation and benchmarking." +HOMEPAGE = "http://mesa3d.org" +BUGTRACKER = "https://bugs.freedesktop.org" +SECTION = "x11" + +LICENSE = "MIT & PD" +LIC_FILES_CHKSUM = "file://src/xdemos/glxgears.c;beginline=1;endline=20;md5=914225785450eff644a86c871d3ae00e \ + file://src/xdemos/glxdemo.c;beginline=1;endline=8;md5=b01d5ab1aee94d35b7efaa2ef48e1a06" + +DEPENDS = "virtual/libx11 virtual/libgl glew" + +PR = "r2" + +SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/demos/${PV}/${BPN}-${PV}.tar.bz2 \ + file://dso_linking_change_build_fix.patch" + +inherit autotools pkgconfig + +SRC_URI[md5sum] = "320c2a4b6edc6faba35d9cb1e2a30bf4" +SRC_URI[sha256sum] = "4bc7f2b20d17e3eebfec288f2367a435cd2db71fc5ac9ece2c14827e290d77d1" diff --git a/meta/recipes-graphics/mesa/mesa-dri-glsl-native_7.11.bb b/meta/recipes-graphics/mesa/mesa-dri-glsl-native_7.11.bb new file mode 100644 index 000000000..91945956b --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-dri-glsl-native_7.11.bb @@ -0,0 +1,27 @@ +DESCRIPTION = "gl shader language specific build from mesa-dri" +HOMEPAGE = "http://mesa3d.org" +BUGTRACKER = "https://bugs.freedesktop.org" +SECTION = "x11" +LICENSE = "GPLv3+" +LIC_FILES_CHKSUM = "file://glsl_parser.cpp;beginline=3;endline=33;md5=d078f1cddc2fc355719c090482254bd9" + +DEPENDS = "makedepend-native" + +SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaLib-${PV}.tar.bz2" +SRC_URI[md5sum] = "ff03aca82d0560009a076a87c888cf13" +SRC_URI[sha256sum] = "f8bf37a00882840a3e3d327576bc26a79ae7f4e18fe1f7d5f17a5b1c80dd7acf" + +S = "${WORKDIR}/Mesa-${PV}/src/glsl/" + +inherit native + +# use default config for native build +do_configure_prepend() { + ln -sf ${S}/../../configs/default ${S}/../../configs/current +} + +do_install() { + install -d ${D}/${bindir}/glsl + install -m 755 ${S}/builtin_compiler ${D}/${bindir}/glsl/builtin_compiler + install -m 755 ${S}/glsl_compiler ${D}/${bindir}/glsl/glsl_compiler +} diff --git a/meta/recipes-graphics/mesa/mesa-dri.inc b/meta/recipes-graphics/mesa/mesa-dri.inc new file mode 100644 index 000000000..480672fd0 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-dri.inc @@ -0,0 +1,24 @@ +PROTO_DEPS += "dri2proto" +LIB_DEPS += "libdrm expat" + +# most of our targets do not have DRI so will use mesa-xlib +DEFAULT_PREFERENCE = "-1" + +DRIDRIVERS = "swrast" +DRIDRIVERS_append_x86 = ",i915,i965" +DRIDRIVERS_append_x86-64 = ",i915,i965" + +EXTRA_OECONF += "--with-driver=dri --disable-egl --disable-gallium --without-gallium-drivers --with-dri-drivers=${DRIDRIVERS}" + +python populate_packages_prepend() { + import os.path + + dri_drivers_root = os.path.join(d.getVar('libdir', True), "dri") + + do_split_packages(d, dri_drivers_root, '^(.*)_dri\.so$', 'mesa-dri-driver-%s', 'Mesa %s DRI driver', extra_depends='') +} + +PACKAGES_DYNAMIC = "mesa-dri-driver-*" + +FILES_${PN}-dbg += "${libdir}/dri/.debug/*" + diff --git a/meta/recipes-graphics/mesa/mesa-dri_7.11.bb b/meta/recipes-graphics/mesa/mesa-dri_7.11.bb new file mode 100644 index 000000000..219e55517 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-dri_7.11.bb @@ -0,0 +1,4 @@ +include mesa-common.inc +include mesa-${PV}.inc +include mesa-dri.inc +PR = "${INC_PR}.1" diff --git a/meta/recipes-graphics/mesa/mesa-dri_git.bb b/meta/recipes-graphics/mesa/mesa-dri_git.bb new file mode 100644 index 000000000..a0e19459f --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-dri_git.bb @@ -0,0 +1,9 @@ +include mesa-common.inc +include mesa-git.inc +include mesa-dri.inc + +# this needs to be lower than -1 because all mesa-dri have -1 and git version has highest PV, but shouldn't be default +DEFAULT_PREFERENCE = "-2" + +PR = "${INC_PR}.0" + diff --git a/meta/recipes-graphics/mesa/mesa-git.inc b/meta/recipes-graphics/mesa/mesa-git.inc new file mode 100644 index 000000000..1b4c0a69b --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-git.inc @@ -0,0 +1,20 @@ +DEPENDS += "mesa-dri-glsl-native" + +SRCREV = "983fa4ad523535debf2e94cf6ac1fd4c5630c0d2" +PV = "7.11+gitr${SRCPV}" + +LIC_FILES_CHKSUM = "file://docs/license.html;md5=03ccdc4c379c4289aecfb8892c546f67" +FILESEXTRAPATHS_prepend := "${THISDIR}/mesa-git:" + +SRC_URI = "git://anongit.freedesktop.org/git/mesa/mesa;protocol=git \ + file://uclibc.patch \ + file://crossfix.patch \ + " +S = "${WORKDIR}/git" + +do_configure_prepend() { + #check for python not python2, because python-native does not stage python2 binary/link + sed -i 's/AC_CHECK_PROGS(\[PYTHON2\], \[python2 python\])/AC_CHECK_PROGS(\[PYTHON2\], \[python python\])/g' ${S}/configure.ac + # We need builtin_compiler built for buildhost arch instead of target (is provided by mesa-dri-glsl-native)" + sed -i "s#\./builtin_compiler#${STAGING_BINDIR_NATIVE}/glsl/builtin_compiler#g" ${S}/src/glsl/Makefile +} diff --git a/meta/recipes-graphics/mesa/mesa-git/uclibc.patch b/meta/recipes-graphics/mesa/mesa-git/uclibc.patch new file mode 100644 index 000000000..0b031f9c3 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-git/uclibc.patch @@ -0,0 +1,57 @@ +Upstream-Status: Pending + +From 904bd5127bd88f45abf4a376676e0a487cfb018a Mon Sep 17 00:00:00 2001 +From: Martin Jansa <Martin.Jansa@gmail.com> +Date: Thu, 13 Oct 2011 12:46:53 +0200 +Subject: [PATCH] configure: add check HAVE_NEWLOCALE to fix build with uclibc + +Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> +--- + configure.ac | 3 +++ + src/glsl/strtod.c | 2 +- + src/mesa/main/imports.c | 2 +- + 3 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 49e81ad..468cfd7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -507,6 +507,9 @@ AC_SUBST([DLOPEN_LIBS]) + dnl See if posix_memalign is available + AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) + ++dnl See if newlocale is available ++AC_CHECK_FUNCS_ONCE(newlocale) ++ + dnl SELinux awareness. + AC_ARG_ENABLE([selinux], + [AS_HELP_STRING([--enable-selinux], +diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c +index ff34591..88aa5ef 100644 +--- a/src/glsl/strtod.c ++++ b/src/glsl/strtod.c +@@ -44,7 +44,7 @@ + double + glsl_strtod(const char *s, char **end) + { +-#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) ++#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && defined (HAVE_NEWLOCALE) + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); +diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c +index 345a1c5..493e0fb 100644 +--- a/src/mesa/main/imports.c ++++ b/src/mesa/main/imports.c +@@ -767,7 +767,7 @@ float + _mesa_strtof( const char *s, char **end ) + { + #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ +- !defined(ANDROID) ++ !defined(ANDROID) && defined (HAVE_NEWLOCALE) + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); +-- +1.7.7 + diff --git a/meta/recipes-graphics/mesa/mesa-xlib.inc b/meta/recipes-graphics/mesa/mesa-xlib.inc new file mode 100644 index 000000000..b720e140f --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-xlib.inc @@ -0,0 +1 @@ +EXTRA_OECONF += " --with-driver=xlib --without-gallium-drivers" diff --git a/meta/recipes-graphics/mesa/mesa-xlib_7.11.bb b/meta/recipes-graphics/mesa/mesa-xlib_7.11.bb new file mode 100644 index 000000000..7547b22cc --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-xlib_7.11.bb @@ -0,0 +1,5 @@ +include mesa-common.inc +include mesa-${PV}.inc +include mesa-xlib.inc +PR = "${INC_PR}.2" + diff --git a/meta/recipes-graphics/mesa/mesa-xlib_git.bb b/meta/recipes-graphics/mesa/mesa-xlib_git.bb new file mode 100644 index 000000000..be2f5d3cf --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-xlib_git.bb @@ -0,0 +1,8 @@ +include mesa-common.inc +include mesa-git.inc +include mesa-xlib.inc + +# this needs to be lower than -1 because all mesa-dri have -1 and git version has highest PV, but shouldn't be default +DEFAULT_PREFERENCE = "-2" + +PR = "${INC_PR}.1" diff --git a/meta/recipes-graphics/mesa/mesa/crossfix-mklib.patch b/meta/recipes-graphics/mesa/mesa/crossfix-mklib.patch new file mode 100644 index 000000000..dc0822891 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa/crossfix-mklib.patch @@ -0,0 +1,71 @@ +This patch is ported from WindRiver linux and to fix cross compile failure. + +And original commits are: +commit 8d5ccc8113e1b51b0529a00c18a4aba956247e1b +commit 5c4212084b871a0c0fb7d174280ec9a634637deb + +Upstream-Status: Pending + +Signed-off-by: Kang Kai <kai.kang@windriver.com> + +--- Mesa-7.10.2/bin/mklib.orig 2011-09-28 16:15:34.170000074 +0800 ++++ Mesa-7.10.2/bin/mklib 2011-09-28 16:15:42.370000073 +0800 +@@ -49,8 +49,8 @@ + /*) ;; + *) FILE="$ORIG_DIR/$FILE" ;; + esac +- MEMBERS=`ar t $FILE` +- ar x $FILE ++ MEMBERS=`${AR} t $FILE` ++ ${AR} x $FILE + for MEMBER in $MEMBERS ; do + NEWFILES="$NEWFILES $DIR/$MEMBER" + done +@@ -77,7 +77,7 @@ + make_ar_static_lib() { + OPTS=$1 + shift; +- RANLIB=$1 ++ USE_RANLIB=$1 + shift; + LIBNAME=$1 + shift; +@@ -87,11 +87,11 @@ + rm -f ${LIBNAME} + + # make static lib +- ar ${OPTS} ${LIBNAME} ${OBJECTS} ++ ${AR} ${OPTS} ${LIBNAME} ${OBJECTS} + + # run ranlib +- if [ ${RANLIB} = 1 ] ; then +- ranlib ${LIBNAME} ++ if [ ${USE_RANLIB} = 1 ] ; then ++ ${RANLIB} ${LIBNAME} + fi + + echo ${LIBNAME} +@@ -313,9 +313,9 @@ + if [ "x$LINK" = "x" ] ; then + # -linker was not specified so set default link command now + if [ $CPLUSPLUS = 1 ] ; then +- LINK=g++ ++ LINK=$CXX + else +- LINK=gcc ++ LINK=$CC + fi + fi + +@@ -531,9 +531,9 @@ + if [ "x$LINK" = "x" ] ; then + # -linker was not specified so set default link command now + if [ $CPLUSPLUS = 1 ] ; then +- LINK=g++ ++ LINK=${CXX} + else +- LINK=gcc ++ LINK=${CC} + fi + fi + diff --git a/meta/recipes-graphics/mesa/mesa/crossfix.patch b/meta/recipes-graphics/mesa/mesa/crossfix.patch new file mode 100644 index 000000000..d300e2f1b --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa/crossfix.patch @@ -0,0 +1,18 @@ +Upstream-Status: Pending + +Index: Mesa-7.5/bin/mklib +=================================================================== +--- Mesa-7.5.orig/bin/mklib 2009-08-12 13:01:34.000000000 +0100 ++++ Mesa-7.5/bin/mklib 2009-08-12 13:04:19.000000000 +0100 +@@ -234,9 +234,9 @@ + if [ "x$LINK" = "x" ] ; then + # -linker was not specified so set default link command now + if [ $CPLUSPLUS = 1 ] ; then +- LINK=g++ ++ LINK=$CXX + else +- LINK=gcc ++ LINK=$CC + fi + fi + diff --git a/meta/recipes-graphics/mesa/mesa/mesa_fix_for_x32.patch b/meta/recipes-graphics/mesa/mesa/mesa_fix_for_x32.patch new file mode 100644 index 000000000..f072c34f7 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa/mesa_fix_for_x32.patch @@ -0,0 +1,40 @@ +Upstream-Status: Pending + +Using uname like this when cross compiling is a really bad idea. We +provide the correct linker flags, lets just assume we can get this +right ourselves. + +RP 2012/04/26 + +Index: Mesa-7.11/bin/mklib +=================================================================== +--- Mesa-7.11.orig/bin/mklib 2012-04-26 19:43:20.729150109 +0000 ++++ Mesa-7.11/bin/mklib 2012-04-26 20:30:22.421086163 +0000 +@@ -330,13 +330,7 @@ + ;; + esac + +- # Check if objects are 32-bit and we're running in 64-bit +- # environment. If so, pass -m32 flag to linker. + set ${OBJECTS} +- ABI32=`file $1 | grep 32-bit` +- if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then +- OPTS="-m32 ${OPTS}" +- fi + + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} +@@ -387,13 +381,7 @@ + # exptmp is removed below + fi + +- # Check if objects are 32-bit and we're running in 64-bit +- # environment. If so, pass -m32 flag to linker. + set ${OBJECTS} +- ABI32=`file $1 | grep 32-bit` +- if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then +- OPTS="-m32 ${OPTS}" +- fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi diff --git a/meta/recipes-graphics/mesa/mesa/uclibc.patch b/meta/recipes-graphics/mesa/mesa/uclibc.patch new file mode 100644 index 000000000..49d0234ec --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa/uclibc.patch @@ -0,0 +1,42 @@ +Upstream-Status: Pending + +Index: Mesa-7.10.2/src/mesa/main/imports.c +=================================================================== +--- Mesa-7.10.2.orig/src/mesa/main/imports.c 2011-03-01 12:57:29.000000000 -0800 ++++ Mesa-7.10.2/src/mesa/main/imports.c 2011-07-20 19:08:49.441785510 -0700 +@@ -757,7 +757,7 @@ + float + _mesa_strtof( const char *s, char **end ) + { +-#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) ++#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && defined (HAVE_NEWLOCALE) + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); +Index: Mesa-7.10.2/src/glsl/strtod.c +=================================================================== +--- Mesa-7.10.2.orig/src/glsl/strtod.c 2011-01-03 16:45:51.000000000 -0800 ++++ Mesa-7.10.2/src/glsl/strtod.c 2011-07-20 19:10:21.441785488 -0700 +@@ -44,7 +44,7 @@ + double + glsl_strtod(const char *s, char **end) + { +-#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) ++#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && defined (HAVE_NEWLOCALE) + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); +Index: Mesa-7.10.2/configure.ac +=================================================================== +--- Mesa-7.10.2.orig/configure.ac 2011-07-20 19:09:02.000000000 -0700 ++++ Mesa-7.10.2/configure.ac 2011-07-20 19:09:57.121785492 -0700 +@@ -450,6 +450,9 @@ + dnl See if posix_memalign is available + AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) + ++dnl See if newlocale is available ++AC_CHECK_FUNCS_ONCE(newlocale) ++ + dnl SELinux awareness. + AC_ARG_ENABLE([selinux], + [AS_HELP_STRING([--enable-selinux], diff --git a/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch new file mode 100644 index 000000000..342f49b71 --- /dev/null +++ b/meta/recipes-graphics/mesa/qemugl/call_opengl_fix.patch @@ -0,0 +1,94 @@ +Save registers via local variables instead of simple "push", so that gcc become +aware of this operation and avoid stack disorder. + +opengl calling (in call_opengl_qemu) includes 4 steps: +1. prepare opengl parameters on stack +2. save some "input" register by push +3. load "input" register with parameters on stack via same index as step 1 +4. issue "int 0x99" to trap into qemu, who will get parameter in the registers + +New gcc uses "%esp" rather than "%ebp" to index local variable in stack, which +leads wrong index in step 3, as push decrease "%esp" automatically. Saving +registers via local variables to fix it. + +Upstream-Status: Pending + +Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> +Index: git/opengl_client.c +=================================================================== +--- git.orig/opengl_client.c 2012-02-28 15:26:28.000000000 +0800 ++++ git/opengl_client.c 2012-02-28 15:29:18.000000000 +0800 +@@ -1076,23 +1076,29 @@ + { + #if defined(__i386__) + int ret; ++ int bx, cx, dx, si; + #ifdef WIN32 + __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (win32_sigsegv_handler)); + #endif +- __asm__ ("push %ebx"); +- __asm__ ("push %ecx"); +- __asm__ ("push %edx"); +- __asm__ ("push %esi"); ++ /* save registers before opengl call */ ++ __asm__ ("mov %%ebx, %0"::"m"(bx)); ++ __asm__ ("mov %%ecx, %0"::"m"(cx)); ++ __asm__ ("mov %%edx, %0"::"m"(dx)); ++ __asm__ ("mov %%esi, %0"::"m"(si)); ++ + __asm__ ("mov %0, %%eax"::"m"(func_number)); + __asm__ ("mov %0, %%ebx"::"m"(pid)); + __asm__ ("mov %0, %%ecx"::"m"(ret_string)); + __asm__ ("mov %0, %%edx"::"m"(args)); + __asm__ ("mov %0, %%esi"::"m"(args_size)); + __asm__ ("int $0x99"); +- __asm__ ("pop %esi"); +- __asm__ ("pop %edx"); +- __asm__ ("pop %ecx"); +- __asm__ ("pop %ebx"); ++ ++ /* restore registers */ ++ __asm__ ("mov %0, %%ebx"::"m"(bx)); ++ __asm__ ("mov %0, %%ecx"::"m"(cx)); ++ __asm__ ("mov %0, %%edx"::"m"(dx)); ++ __asm__ ("mov %0, %%esi"::"m"(si)); ++ + __asm__ ("mov %%eax, %0"::"m"(ret)); + #ifdef WIN32 + __asm__ ("movl (%%esp),%%ecx;movl %%ecx,%%fs:0;addl $8,%%esp;" : : : "%ecx"); +@@ -1100,20 +1106,27 @@ + return ret; + #elif defined(__x86_64__) + int ret; +- __asm__ ("push %rbx"); +- __asm__ ("push %rcx"); +- __asm__ ("push %rdx"); +- __asm__ ("push %rsi"); ++ long bx, cx, dx, si; ++ ++ /* save registers before opengl call */ ++ __asm__ ("mov %%rbx, %0"::"m"(bx)); ++ __asm__ ("mov %%rcx, %0"::"m"(cx)); ++ __asm__ ("mov %%rdx, %0"::"m"(dx)); ++ __asm__ ("mov %%rsi, %0"::"m"(si)); ++ + __asm__ ("mov %0, %%eax"::"m"(func_number)); + __asm__ ("mov %0, %%ebx"::"m"(pid)); + __asm__ ("mov %0, %%rcx"::"m"(ret_string)); + __asm__ ("mov %0, %%rdx"::"m"(args)); + __asm__ ("mov %0, %%rsi"::"m"(args_size)); + __asm__ ("int $0x99"); +- __asm__ ("pop %rsi"); +- __asm__ ("pop %rdx"); +- __asm__ ("pop %rcx"); +- __asm__ ("pop %rbx"); ++ ++ /* restore registers */ ++ __asm__ ("mov %0, %%rbx"::"m"(bx)); ++ __asm__ ("mov %0, %%rcx"::"m"(cx)); ++ __asm__ ("mov %0, %%rdx"::"m"(dx)); ++ __asm__ ("mov %0, %%rsi"::"m"(si)); ++ + __asm__ ("mov %%eax, %0"::"m"(ret)); + return ret; + #else diff --git a/meta/recipes-graphics/mesa/qemugl/extensions_emulation.patch b/meta/recipes-graphics/mesa/qemugl/extensions_emulation.patch new file mode 100644 index 000000000..08418c2f4 --- /dev/null +++ b/meta/recipes-graphics/mesa/qemugl/extensions_emulation.patch @@ -0,0 +1,34 @@ +Hide some GLX extensions by default to avoid guest call missing GLX API. It's +hacky to implement these APIs, so hide these extensions as fix. + +Upstream-Status: Pending + +Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> + +Index: git/opengl_client.c +=================================================================== +--- git.orig/opengl_client.c 2012-03-16 18:22:27.000000000 +0800 ++++ git/opengl_client.c 2012-03-16 18:52:06.000000000 +0800 +@@ -105,6 +105,12 @@ + "NO_MOVE", /* default : set if TCP/IP communication */ + }; + ++/* Hiding some GLX extensions from guest */ ++static const char* hiding_extensions = ++ "GLX_MESA_copy_sub_buffer,\ ++ GLX_MESA_multithread_makecurrent,\ ++ GLX_MESA_swap_control,\ ++ "; + + #ifdef WIN32 + +@@ -3516,7 +3522,8 @@ + static void removeUnwantedExtensions(char* ret) + { + char* toBeRemoved = getenv("GL_REMOVE_EXTENSIONS"); +- if (toBeRemoved == NULL) return; ++ if (toBeRemoved == NULL) ++ toBeRemoved = hiding_extensions; + toBeRemoved = strdup(toBeRemoved); + char* iterToBeRemoved = toBeRemoved; + while(*iterToBeRemoved) diff --git a/meta/recipes-graphics/mesa/qemugl/remove-x11r6-lib-dir.patch b/meta/recipes-graphics/mesa/qemugl/remove-x11r6-lib-dir.patch new file mode 100644 index 000000000..d24d0455d --- /dev/null +++ b/meta/recipes-graphics/mesa/qemugl/remove-x11r6-lib-dir.patch @@ -0,0 +1,21 @@ +Remove X11R6 lib directory + +"-L/usr/X11R6/lib" is obsolate in poky. Poky currently use Xserver from X.org (X11R7.x), which puts lib in standard /usr/lib, so no need to specify the extra -L/usr/X11R6/lib. Meanwhile, the -L/usr/X11R6/lib will cause warning: library search path "/usr/X11R6/lib" is unsafe for cross-compilation. so better to remove it. + +Upstream-Status: Pending + +Signed-off-by: Yu Ke <ke.yu@intel.com> + +diff --git a/Makefile b/Makefile +index 9e5a8ea..f3a082a 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,7 +3,7 @@ GL_CFLAGS := -Wall -g -O2 -fno-strict-aliasing + all: libGL.so.1.2 + + libGL.so.1.2: client_stub.c opengl_client.c glgetv_cst.h opengl_func.h opengl_utils.h opengl_client_xfonts.c mesa_gl.h mesa_glext.h mesa_glx.h mesa_glxext.h +- $(CC) -fPIC $(GL_CFLAGS) opengl_client.c -shared -o libGL.so.1.2 -lX11 -lXfixes -lm -L$(D)/usr/X11R6/lib -lpthread -I. ++ $(CC) -fPIC $(GL_CFLAGS) opengl_client.c -shared -o libGL.so.1.2 -lX11 -lXfixes -lm -lpthread -I. + + opengl_func.h: gl_func.h + diff --git a/meta/recipes-graphics/mesa/qemugl/versionfix.patch b/meta/recipes-graphics/mesa/qemugl/versionfix.patch new file mode 100644 index 000000000..614b816d1 --- /dev/null +++ b/meta/recipes-graphics/mesa/qemugl/versionfix.patch @@ -0,0 +1,32 @@ +Upstream-Status: Pending + +Index: git/Makefile +=================================================================== +--- git.orig/Makefile 2009-01-19 23:37:36.000000000 +0000 ++++ git/Makefile 2009-06-09 20:30:37.000000000 +0100 +@@ -1,9 +1,9 @@ + GL_CFLAGS := -Wall -g -O2 -fno-strict-aliasing + +-all: libGL.so ++all: libGL.so.1.2 + +-libGL.so: client_stub.c opengl_client.c glgetv_cst.h opengl_func.h opengl_utils.h opengl_client_xfonts.c mesa_gl.h mesa_glext.h mesa_glx.h mesa_glxext.h +- $(CC) -fPIC $(GL_CFLAGS) opengl_client.c -shared -o libGL.so -lX11 -lXfixes -lm -L$(D)/usr/X11R6/lib -lpthread -I. ++libGL.so.1.2: client_stub.c opengl_client.c glgetv_cst.h opengl_func.h opengl_utils.h opengl_client_xfonts.c mesa_gl.h mesa_glext.h mesa_glx.h mesa_glxext.h ++ $(CC) -fPIC $(GL_CFLAGS) opengl_client.c -shared -o libGL.so.1.2 -lX11 -lXfixes -lm -L$(D)/usr/X11R6/lib -lpthread -I. + + opengl_func.h: gl_func.h + +Index: git/opengl_client.c +=================================================================== +--- git.orig/opengl_client.c 2009-06-09 21:07:15.000000000 +0100 ++++ git/opengl_client.c 2009-06-09 21:07:33.000000000 +0100 +@@ -11578,7 +11578,7 @@ + tab_assoc = calloc(tabSize, sizeof(AssocProcAdress)); + + #ifndef WIN32 +- handle = dlopen(getenv("REAL_LIBGL") ? getenv("REAL_LIBGL") : "libGL.so" ,RTLD_LAZY); ++ handle = dlopen(getenv("REAL_LIBGL") ? getenv("REAL_LIBGL") : "libGL.so.1.2" ,RTLD_LAZY); + if (!handle) { + log_gl("%s\n", dlerror()); + exit(1); diff --git a/meta/recipes-graphics/mesa/qemugl_git.bb b/meta/recipes-graphics/mesa/qemugl_git.bb new file mode 100644 index 000000000..32980d319 --- /dev/null +++ b/meta/recipes-graphics/mesa/qemugl_git.bb @@ -0,0 +1,50 @@ +DESCRIPTION = "QEMU i386 OpenGL passtrough" +HOMEPAGE = "http://savannah.nongnu.org/projects/qemugl" +SECTION = "x11/drivers" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://opengl_client.c;beginline=4;endline=23;md5=a7dbe915be5fb5df8fd496f348ed9a05 \ + file://parse_mesa_get_c.c;befinline=4;endline=23;md5=a55f258f32720c9565a425a3956bcb5e" + +DEPENDS = "virtual/libx11 xproto glproto libxfixes" + +COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)' + +SRC_URI = "git://git.yoctoproject.org/qemugl;protocol=git \ + file://versionfix.patch \ + file://remove-x11r6-lib-dir.patch \ + file://call_opengl_fix.patch \ + file://extensions_emulation.patch" +S = "${WORKDIR}/git" + +SRCREV = "d888bbc723c00d197d34a39b5b7448660ec1b1c0" + +PV = "0.0+git${SRCPV}" +PR = "r11" + +DEFAULT_PREFERENCE = "-1" + +do_install () { + install -d ${D}${libdir}/ + if [ "${PN}" != "qemugl-nativesdk" ]; then + install -m 0755 ${S}/libGL.so.1.2 ${D}${libdir}/libGL-qemu.so.1.2 + else + install -m 0755 ${S}/libGL.so.1.2 ${D}${libdir}/libGL.so.1.2 + ln -s libGL.so.1.2 ${D}${libdir}/libGL.so.1 + ln -s libGL.so.1 ${D}${libdir}/libGL.so + fi +} + +# This cannot be converted to run at pacakge install time, because +# it depends on being run after the libgl1 package is installed, +# and RPM cannot guarantee the order of pacakge insallation. +pkg_postinst_${PN} () { +#!/bin/sh -e +if [ x"$D" = "x" ]; then + rm -f ${libdir}/libGL.so.1.2 + ln -s libGL-qemu.so.1.2 ${libdir}/libGL.so.1.2 +else + exit 1 +fi +} + +BBCLASSEXTEND = "nativesdk" |
