Mesa (7.11): targets/egl-static: fix a linking error

2011-07-13 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: 443ff6024dbe5909a6c2b35c8c5873e37e490d65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=443ff6024dbe5909a6c2b35c8c5873e37e490d65

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jul 13 15:25:46 2011 +0800

targets/egl-static: fix a linking error

rbug is always linked in and it needs libpthread.
(cherry picked from commit 5fe5d236c26b3b2428bc7395304e40cf21d3d3e1)

---

 src/gallium/targets/egl-static/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/targets/egl-static/Makefile 
b/src/gallium/targets/egl-static/Makefile
index 832d7ba..69e7eec 100644
--- a/src/gallium/targets/egl-static/Makefile
+++ b/src/gallium/targets/egl-static/Makefile
@@ -42,7 +42,7 @@ egl_CPPFLAGS += \
-I$(TOP)/src/egl/main \
-D_EGL_MAIN=_eglMain
 egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
-egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm
+egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm -lpthread
 
 # EGL platforms
 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: fix linking errors

2011-07-10 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 95f9e118fe7b02ab5d28550dabd8751e5fb15e3c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=95f9e118fe7b02ab5d28550dabd8751e5fb15e3c

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jul 10 01:27:20 2011 +0800

st/egl: fix linking errors

Add symbols referenced by src/glx/dri2.c.

---

 src/gallium/state_trackers/egl/x11/x11_screen.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c 
b/src/gallium/state_trackers/egl/x11/x11_screen.c
index f1cc440..6155b4d 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -452,6 +452,12 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
 extern unsigned
 dri2GetSwapEventType(Display *dpy, XID drawable);
 
+extern void *
+dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
+
+extern void *
+GetGLXDrawable(Display *dpy, XID drawable);
+
 /**
  * This is also called from src/glx/dri2.c.
  */
@@ -460,4 +466,16 @@ unsigned dri2GetSwapEventType(Display *dpy, XID drawable)
return 0;
 }
 
+void *
+dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id)
+{
+   return NULL;
+}
+
+void *
+GetGLXDrawable(Display *dpy, XID drawable)
+{
+   return NULL;
+}
+
 #endif /* GLX_DIRECT_RENDERING */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: add copyright notices

2011-07-02 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: f2001df508fda599a18b3586d2775e970a3db13a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2001df508fda599a18b3586d2775e970a3db13a

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jul  2 17:57:30 2011 +0900

egl: add copyright notices

The list of copyright holders could be incomplete.  Please update
directly or notify me if your name is missing.

---

 src/egl/drivers/glx/egl_glx.c |   26 ++
 src/egl/main/eglapi.c |   30 ++
 src/egl/main/eglapi.h |   30 ++
 src/egl/main/eglarray.c   |   28 
 src/egl/main/eglarray.h   |   28 
 src/egl/main/eglcompiler.h|   29 +
 src/egl/main/eglconfig.c  |   30 ++
 src/egl/main/eglconfig.h  |   30 ++
 src/egl/main/eglcontext.c |   30 ++
 src/egl/main/eglcontext.h |   30 ++
 src/egl/main/eglcurrent.c |   28 
 src/egl/main/eglcurrent.h |   28 
 src/egl/main/egldefines.h |   25 -
 src/egl/main/egldisplay.c |   30 ++
 src/egl/main/egldisplay.h |   30 ++
 src/egl/main/egldriver.c  |   30 ++
 src/egl/main/egldriver.h  |   30 ++
 src/egl/main/eglfallbacks.c   |   28 
 src/egl/main/eglglobals.c |   30 ++
 src/egl/main/eglglobals.h |   30 ++
 src/egl/main/eglimage.c   |   29 +
 src/egl/main/eglimage.h   |   29 +
 src/egl/main/egllog.c |   30 ++
 src/egl/main/egllog.h |   29 +
 src/egl/main/eglmisc.c|   26 ++
 src/egl/main/eglmisc.h|   26 ++
 src/egl/main/eglmode.c|   30 ++
 src/egl/main/eglmode.h|   30 ++
 src/egl/main/eglmutex.h   |   28 
 src/egl/main/eglscreen.c  |   30 ++
 src/egl/main/eglscreen.h  |   30 ++
 src/egl/main/eglstring.c  |   30 ++
 src/egl/main/eglstring.h  |   30 ++
 src/egl/main/eglsurface.c |   30 ++
 src/egl/main/eglsurface.h |   30 ++
 src/egl/main/eglsync.c|   28 
 src/egl/main/eglsync.h|   28 
 src/egl/main/egltypedefs.h|   30 ++
 38 files changed, 1054 insertions(+), 49 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=f2001df508fda599a18b3586d2775e970a3db13a
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.11): egl: add copyright notices

2011-07-02 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: e4cef07b87e42a2fbd944bec3374e88e2b5b32d5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4cef07b87e42a2fbd944bec3374e88e2b5b32d5

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jul  2 17:57:30 2011 +0900

egl: add copyright notices

The list of copyright holders could be incomplete.  Please update
directly or notify me if your name is missing.
(cherry picked from commit f2001df508fda599a18b3586d2775e970a3db13a)

---

 src/egl/drivers/glx/egl_glx.c |   26 ++
 src/egl/main/eglapi.c |   30 ++
 src/egl/main/eglapi.h |   30 ++
 src/egl/main/eglarray.c   |   28 
 src/egl/main/eglarray.h   |   28 
 src/egl/main/eglcompiler.h|   29 +
 src/egl/main/eglconfig.c  |   30 ++
 src/egl/main/eglconfig.h  |   30 ++
 src/egl/main/eglcontext.c |   30 ++
 src/egl/main/eglcontext.h |   30 ++
 src/egl/main/eglcurrent.c |   28 
 src/egl/main/eglcurrent.h |   28 
 src/egl/main/egldefines.h |   25 -
 src/egl/main/egldisplay.c |   30 ++
 src/egl/main/egldisplay.h |   30 ++
 src/egl/main/egldriver.c  |   30 ++
 src/egl/main/egldriver.h  |   30 ++
 src/egl/main/eglfallbacks.c   |   28 
 src/egl/main/eglglobals.c |   30 ++
 src/egl/main/eglglobals.h |   30 ++
 src/egl/main/eglimage.c   |   29 +
 src/egl/main/eglimage.h   |   29 +
 src/egl/main/egllog.c |   30 ++
 src/egl/main/egllog.h |   29 +
 src/egl/main/eglmisc.c|   26 ++
 src/egl/main/eglmisc.h|   26 ++
 src/egl/main/eglmode.c|   30 ++
 src/egl/main/eglmode.h|   30 ++
 src/egl/main/eglmutex.h   |   28 
 src/egl/main/eglscreen.c  |   30 ++
 src/egl/main/eglscreen.h  |   30 ++
 src/egl/main/eglstring.c  |   30 ++
 src/egl/main/eglstring.h  |   30 ++
 src/egl/main/eglsurface.c |   30 ++
 src/egl/main/eglsurface.h |   30 ++
 src/egl/main/eglsync.c|   28 
 src/egl/main/eglsync.h|   28 
 src/egl/main/egltypedefs.h|   30 ++
 38 files changed, 1054 insertions(+), 49 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=e4cef07b87e42a2fbd944bec3374e88e2b5b32d5
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): autoconf: fix --disable-dri

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 5029ea4d9c0594ef6c08dd59d49a2646ab78b583
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5029ea4d9c0594ef6c08dd59d49a2646ab78b583

Author: Chia-I Wu olva...@gmail.com
Date:   Mon Jun 27 13:06:39 2011 +0900

autoconf: fix --disable-dri

Define GLX_INDIRECT_RENDERING and GLX_DIRECT_RENDERING when $enable_glx,
not $enable_dri.

---

 configure.ac |   33 +
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 73f5786..174518c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1039,11 +1039,19 @@ PKG_CHECK_MODULES([LIBDRM_RADEON],
  HAVE_LIBDRM_RADEON=no)
 
 dnl
-dnl More X11 setup
+dnl More GLX setup
 dnl
-if test x$enable_xlib_glx = xyes; then
+case x$enable_glx$enable_xlib_glx in
+xyesyes)
 DEFINES=$DEFINES -DUSE_XSHM
-fi
+;;
+xyesno)
+DEFINES=$DEFINES -DGLX_INDIRECT_RENDERING
+if test x$driglx_direct = xyes; then
+DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
+fi
+;;
+esac
 
 dnl
 dnl TLS detection
@@ -1118,10 +1126,7 @@ if test x$enable_dri = xyes; then
 case $host_os in
 linux*)
 DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-if test x$driglx_direct = xyes; then
-DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
-fi
-DEFINES=$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS
+DEFINES=$DEFINES -DHAVE_ALIAS
 
 case $host_cpu in
 x86_64)
@@ -1151,10 +1156,6 @@ if test x$enable_dri = xyes; then
 freebsd* | dragonfly* | *netbsd*)
 DEFINES=$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1
 DEFINES=$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS
-DEFINES=$DEFINES -DGLX_INDIRECT_RENDERING
-if test x$driglx_direct = xyes; then
-DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
-fi
 
 if test x$DRI_DIRS = xyes; then
 DRI_DIRS=i810 i915 i965 mach64 mga nouveau r128 r200 r300 r600 \
@@ -1163,21 +1164,13 @@ if test x$enable_dri = xyes; then
 ;;
 gnu*)
 DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-DEFINES=$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS
+DEFINES=$DEFINES -DHAVE_ALIAS
;;
 solaris*)
 DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-DEFINES=$DEFINES -DGLX_INDIRECT_RENDERING
-if test x$driglx_direct = xyes; then
-DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
-fi
 ;;
 cygwin*)
 DEFINES=$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER
-DEFINES=$DEFINES -DGLX_INDIRECT_RENDERING
-if test x$driglx_direct = xyes; then
-DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
-fi
 if test x$DRI_DIRS = xyes; then
 DRI_DIRS=swrast
 fi

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): autoconf: add --enable-{dri,glx,osmesa}

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 9e7a4147c730adda047aae66c17f07d9de5b4a28
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e7a4147c730adda047aae66c17f07d9de5b4a28

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jun 26 13:24:32 2011 +0900

autoconf: add --enable-{dri,glx,osmesa}

The idea is that DRI driver, libGL and libOSMesa are libraries that can
be independently enabled, yet --with-driver does not allow us to easily
do that, if not impossible.  This also matches what
--enable-{egl,xorg,d3d1x} do for the respective libraries.

There are two libGL providers: Xlib-based and DRI-based.  They cannot
coexist.  To be able to choose between them, --enable-xlib-glx is also
added.

With this commit, --with-driver=dri can be replaced by

  $ ./configure --enable-dri --enable-glx --disable-osmesa

--with-driver=xlib can be replaced by

  $ ./configure --disable-dri --enable-glx --enable-osmesa \
--enable-xlib-glx

and --with-driver=osmesa can be replaced by

  $ ./configure --disable-dri --disable-glx --enable-osmesa

Some combinations that cannot be supported with --with-driver will
produce errors at the moment.  But in the future, we would like to
support, for example,

  $ ./configure --enable-dri --disable-glx --enable-egl
  (build libEGL and DRI drivers, but not libGL)

Note that this commit still keeps --with-driver for transitional
purpose.

---

 configure.ac |  301 ++
 1 files changed, 177 insertions(+), 124 deletions(-)

diff --git a/configure.ac b/configure.ac
index acf9f06..73f5786 100644
--- a/configure.ac
+++ b/configure.ac
@@ -543,6 +543,28 @@ AC_ARG_ENABLE([openvg],
 [enable support for OpenVG API @:@default=no@:@])],
 [enable_openvg=$enableval],
 [enable_openvg=no])
+
+AC_ARG_ENABLE([dri],
+[AS_HELP_STRING([--enable-dri],
+[enable DRI modules @:@default=auto@:@])],
+[enable_dri=$enableval],
+[enable_dri=auto])
+AC_ARG_ENABLE([glx],
+[AS_HELP_STRING([--enable-glx],
+[enable GLX library @:@default=auto@:@])],
+[enable_glx=$enableval],
+[enable_glx=auto])
+AC_ARG_ENABLE([osmesa],
+[AS_HELP_STRING([--enable-osmesa],
+[enable OSMesa library @:@default=auto@:@])],
+[enable_osmesa=$enableval],
+[enable_osmesa=auto])
+AC_ARG_ENABLE([egl],
+[AS_HELP_STRING([--disable-egl],
+[disable EGL library @:@default=enabled@:@])],
+[enable_egl=$enableval],
+[enable_egl=yes])
+
 AC_ARG_ENABLE([xorg],
 [AS_HELP_STRING([--enable-xorg],
 [enable support for X.Org DDX API @:@default=no@:@])],
@@ -553,16 +575,17 @@ AC_ARG_ENABLE([d3d1x],
 [enable support for Direct3D 10  11 low-level API 
@:@default=no@:@])],
 [enable_d3d1x=$enableval],
 [enable_d3d1x=no])
-AC_ARG_ENABLE([egl],
-[AS_HELP_STRING([--disable-egl],
-[disable EGL library @:@default=enabled@:@])],
-[enable_egl=$enableval],
-[enable_egl=yes])
 AC_ARG_ENABLE([gbm],
[AS_HELP_STRING([--enable-gbm],
  [enable gbm library @:@default=auto@:@])],
[enable_gbm=$enableval],
[enable_gbm=auto])
+
+AC_ARG_ENABLE([xlib_glx],
+[AS_HELP_STRING([--enable-xlib-glx],
+[make GLX library Xlib-based instead of DRI-based 
@:@default=disable@:@])],
+[enable_xlib_glx=$enableval],
+[enable_xlib_glx=auto])
 AC_ARG_ENABLE([gallium_egl],
 [AS_HELP_STRING([--enable-gallium-egl],
 [enable optional EGL state tracker (not required
@@ -648,24 +671,66 @@ if test x$enable_opengl = xno; then
 fi
 
 AC_ARG_WITH([driver],
-[AS_HELP_STRING([--with-driver=DRIVER],
-[driver for Mesa: xlib,dri,osmesa @:@default=dri when available, or 
xlib@:@])],
+[AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
 [mesa_driver=$withval],
-[mesa_driver=$default_driver])
+[mesa_driver=auto])
 dnl Check for valid option
 case x$mesa_driver in
-xxlib|xdri|xosmesa)
-if test x$enable_opengl = xno; then
-AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled])
+xxlib|xdri|xosmesa|xno)
+if test x$enable_dri != xauto -o \
+x$enable_glx != xauto -o \
+x$enable_osmesa != xauto -o \
+x$enable_xlib_glx != xauto; then
+AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
 fi
 ;;
-xno)
+xauto)
+mesa_driver=$default_driver
 ;;
 *)
 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
 ;;
 esac
 
+# map $mesa_driver to APIs
+if test x$enable_dri = xauto; then
+case x$mesa_driver in
+xdri) enable_dri=yes ;;
+*)enable_dri=no ;;
+esac
+fi
+
+if test x$enable_glx = xauto; then
+case x$mesa_driver in
+xdri|xxlib) enable_glx=yes ;;
+*)  enable_glx=no ;;
+esac
+fi
+
+if test x$enable_osmesa = xauto; then
+case x$mesa_driver in
+xxlib|xosmesa) enable_osmesa=yes ;;
+*) enable_osmesa=no ;;
+esac
+fi
+
+if test x$enable_xlib_glx = xauto; then
+case x$mesa_driver

Mesa (master): autoconf: fix --disable-glx

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 94ec5fd1b37077c3be8ef5d275b641654f87504c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94ec5fd1b37077c3be8ef5d275b641654f87504c

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 27 09:19:02 2011 +0900

autoconf: fix --disable-glx

libdrm is used in multiple places.  Always check for it and set
have_libdrm.  Each user can then check the variable.

This is useful when only EGL and DRI drivers are needed.

---

 configure.ac |   39 +++
 1 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index 174518c..6568472 100644
--- a/configure.ac
+++ b/configure.ac
@@ -725,12 +725,6 @@ if test x$enable_glx = xno; then
 enable_xlib_glx=no
 fi
 
-if test x$enable_dri = xyes; then
-if test x$enable_glx = xno -o x$enable_xlib_glx = xyes; then
-AC_MSG_ERROR([cannot build DRI drivers without DRI-based GLX yet])
-fi
-fi
-
 dnl
 dnl Driver specific build directories
 dnl
@@ -815,6 +809,23 @@ AC_SUBST([GALLIUM_DRIVERS_DIRS])
 AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
 AC_SUBST([MESA_LLVM])
 
+# Check for libdrm
+PKG_CHECK_MODULES([LIBDRM], [libdrm = $LIBDRM_REQUIRED],
+  [have_libdrm=yes], [have_libdrm=no])
+
+if test x$enable_dri = xyes; then
+# DRI must be shared, I think
+if test $enable_static = yes; then
+AC_MSG_ERROR([Can't use static libraries for DRI drivers])
+fi
+
+if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([DRI drivers require libdrm = $LIBDRM_REQUIRED])
+fi
+
+DRI_PC_REQ_PRIV=libdrm = $LIBDRM_REQUIRED
+fi
+
 dnl
 dnl Find out if X is available. The variable have_x is set if libX11 is
 dnl found to mimic AC_PATH_XTRA.
@@ -919,8 +930,9 @@ xyesno)
 PKG_CHECK_MODULES([GLPROTO], [glproto = $GLPROTO_REQUIRED])
 GL_PC_REQ_PRIV=glproto = $GLPROTO_REQUIRED
 if test x$driglx_direct = xyes; then
-# Check for libdrm
-PKG_CHECK_MODULES([LIBDRM], [libdrm = $LIBDRM_REQUIRED])
+if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([Direct rendering requires libdrm = 
$LIBDRM_REQUIRED])
+fi
 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto = $DRI2PROTO_REQUIRED])
 GL_PC_REQ_PRIV=$GL_PC_REQ_PRIV libdrm = $LIBDRM_REQUIRED dri2proto 
= $DRI2PROTO_REQUIRED
 fi
@@ -970,14 +982,6 @@ xyesno)
 ;;
 esac
 
-if test x$enable_dri = xyes; then
-# DRI must be shared, I think
-if test $enable_static = yes; then
-AC_MSG_ERROR([Can't use static libraries for DRI drivers])
-fi
-fi
-
-DRI_PC_REQ_PRIV=libdrm = $LIBDRM_REQUIRED
 GLESv1_CM_LIB_DEPS=$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS
 GLESv1_CM_PC_LIB_PRIV=-lm -lpthread $DLOPEN_LIBS
 GLESv2_LIB_DEPS=$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS
@@ -1364,6 +1368,9 @@ if test x$enable_gallium_egl = xyes; then
 if test x$enable_egl = xno; then
 AC_MSG_ERROR([cannot enable egl_gallium without EGL])
 fi
+if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([egl_gallium requires libdrm = $LIBDRM_REQUIRED])
+fi
 
 GALLIUM_STATE_TRACKERS_DIRS=egl $GALLIUM_STATE_TRACKERS_DIRS
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS egl-static

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: remove unused header

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: c0b0e71148726d5b7f276b10bef981034660427f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0b0e71148726d5b7f276b10bef981034660427f

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jul  1 18:19:31 2011 +0900

st/egl: remove unused header

---

 .../state_trackers/egl/common/egl_g3d_image.c  |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index 4f5bdba..7e9a29b 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -37,9 +37,6 @@
 #include egl_g3d.h
 #include egl_g3d_image.h
 
-/* for struct winsys_handle */
-#include state_tracker/drm_driver.h
-
 /**
  * Reference and return the front left buffer of the native pixmap.
  */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: fix a typo

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: bf04d9eebfd117ad3b9c095b990183614d4f5f09
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf04d9eebfd117ad3b9c095b990183614d4f5f09

Author: Chia-I Wu olva...@gmail.com
Date:   Fri Jul  1 18:13:38 2011 +0900

st/egl: fix a typo

Wrong goto labels.

---

 .../state_trackers/egl/common/native_helper.c  |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/native_helper.c 
b/src/gallium/state_trackers/egl/common/native_helper.c
index 6f2097c..cca1e1c 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -282,9 +282,9 @@ resource_surface_copy_swap(struct resource_surface *rsurf,
  btex, 0, src_box);
ret = TRUE;
 
- out_no_ftex:
-   pipe_resource_reference(btex, NULL);
  out_no_btex:
+   pipe_resource_reference(btex, NULL);
+ out_no_ftex:
pipe_resource_reference(ftex, NULL);
 
return ret;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: fix a compiler warning

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: c250363022ea2d4d8de1a1660431f35d8b92aca4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c250363022ea2d4d8de1a1660431f35d8b92aca4

Author: Chia-I Wu olva...@gmail.com
Date:   Fri Jul  1 18:12:16 2011 +0900

egl: fix a compiler warning

---

 src/egl/main/eglconfig.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 55ce6fd..556cc8e 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -305,6 +305,7 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean 
for_matching)
 break;
  default:
 assert(0);
+mask = 0;
 break;
  }
  if (val  ~mask)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): autoconf: swrast does not require libdrm

2011-07-01 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 8123934d5a6a4a25a30dcd77e9f0f0d7b7b74a74
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8123934d5a6a4a25a30dcd77e9f0f0d7b7b74a74

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jul  2 09:49:17 2011 +0900

autoconf: swrast does not require libdrm

This fixes

  $ ./configure --disable-driglx-direct \
--with-dri-drivers=swrast \
--with-gallium-drivers=

---

 configure.ac |   17 +
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6568472..5a54370 100644
--- a/configure.ac
+++ b/configure.ac
@@ -819,11 +819,10 @@ if test x$enable_dri = xyes; then
 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
 fi
 
-if test x$have_libdrm != xyes; then
-AC_MSG_ERROR([DRI drivers require libdrm = $LIBDRM_REQUIRED])
+# not a hard requirement as swrast does not depend on it
+if test x$have_libdrm = xyes; then
+DRI_PC_REQ_PRIV=libdrm = $LIBDRM_REQUIRED
 fi
-
-DRI_PC_REQ_PRIV=libdrm = $LIBDRM_REQUIRED
 fi
 
 dnl
@@ -1206,6 +1205,13 @@ if test x$enable_dri = xyes; then
 [AC_MSG_ERROR([Expat required for DRI.])])
 fi
 
+# libdrm is required for all except swrast
+if test -n $DRI_DIRS -a x$DRI_DIRS != xswrast; then
+if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([DRI drivers requires libdrm = $LIBDRM_REQUIRED])
+fi
+fi
+
 # put all the necessary libs together, including possibly libdricore
 DRI_LIB_DEPS=$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm 
-lpthread $DLOPEN_LIBS
 fi
@@ -1793,6 +1799,9 @@ dnl Gallium helper functions
 dnl
 gallium_check_st() {
 if test x$HAVE_ST_DRI = xyes || test x$HAVE_ST_XORG = xyes; then
+ if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([DRI or Xorg DDX requires libdrm = $LIBDRM_REQUIRED])
+ fi
  GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS $1
 fi
 if test x$HAVE_ST_DRI = xyes  test x$2 != x; then

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.11): egl: fix EGL_MATCH_NATIVE_PIXMAP

2011-06-30 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: 29574af377c5b935824b0896d9c4dbf937f11e1c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=29574af377c5b935824b0896d9c4dbf937f11e1c

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 18:28:20 2011 +0900

egl: fix EGL_MATCH_NATIVE_PIXMAP

EGL_MATCH_NATIVE_PIXMAP is valid for eglChooseConfig, but invalid for
eglGetConfigAttrib.
(cherry picked from commit 8ea5330200e314f9f7de763b1951656c92caa857)

---

 src/egl/main/eglconfig.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 5b377b7..d63634b 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -456,8 +456,6 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
   return EGL_FALSE;
 
switch (attr) {
-   case EGL_MATCH_NATIVE_PIXMAP:
-  return EGL_FALSE;
case EGL_Y_INVERTED_NOK:
   return conf-Display-Extensions.NOK_texture_from_pixmap;
default:
@@ -739,6 +737,16 @@ _eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLConfig *conf,
 {
if (!_eglIsConfigAttribValid(conf, attribute))
   return _eglError(EGL_BAD_ATTRIBUTE, eglGetConfigAttrib);
+
+   /* nonqueryable attributes */
+   switch (attribute) {
+   case EGL_MATCH_NATIVE_PIXMAP:
+  return _eglError(EGL_BAD_ATTRIBUTE, eglGetConfigAttrib);
+  break;
+   default:
+  break;
+   }
+
if (!value)
   return _eglError(EGL_BAD_PARAMETER, eglGetConfigAttrib);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.11): targets/egl-static: do not use DRI_LIB_DEPS

2011-06-30 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: 0fafcc69192a598e2bbbe82bb9741327eefccdbe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fafcc69192a598e2bbbe82bb9741327eefccdbe

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 18:09:18 2011 +0900

targets/egl-static: do not use DRI_LIB_DEPS

It brings in libraries that are not necessarily needed.
(cherry picked from commit 1e9f0b17365072ef672afddde9d973530581)

---

 src/gallium/targets/egl-static/Makefile |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/egl-static/Makefile 
b/src/gallium/targets/egl-static/Makefile
index d69fe42..6b5ed60 100644
--- a/src/gallium/targets/egl-static/Makefile
+++ b/src/gallium/targets/egl-static/Makefile
@@ -42,7 +42,7 @@ egl_CPPFLAGS += \
-I$(TOP)/src/egl/main \
-D_EGL_MAIN=_eglMain
 egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
-egl_SYS += $(LIBUDEV_LIBS) -lEGL -lm
+egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm
 
 # EGL platforms
 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
@@ -70,7 +70,7 @@ egl_CPPFLAGS += -I$(TOP)/src/mesa $(API_DEFINES)
 # make st/mesa built-in when there is a single glapi provider
 ifeq ($(SHARED_GLAPI),1)
 egl_LIBS += $(TOP)/src/mesa/libmesagallium.a
-egl_SYS += $(DRI_LIB_DEPS) -l$(GLAPI_LIB)
+egl_SYS += -lm -lpthread $(DLOPEN_LIBS) -l$(GLAPI_LIB)
 else
 egl_CPPFLAGS += -D_EGL_EXTERNAL_GL=1
 OUTPUTS += st_GL
@@ -154,7 +154,7 @@ egl_SYS := $(sort $(egl_SYS))
 # st_GL, built only when shared glapi is not enabled
 st_GL_CPPFLAGS := -I $(TOP)/src/mesa -I$(TOP)/src/gallium/include
 st_GL_LIBS := $(TOP)/src/mesa/libmesagallium.a $(GALLIUM_AUXILIARIES)
-st_GL_SYS := $(DRI_LIB_DEPS)
+st_GL_SYS := -lm -lpthread $(DLOPEN_LIBS)
 
 # LLVM
 ifeq ($(MESA_LLVM),1)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.11): targets/gbm: attemp to fix unresolved symbols

2011-06-30 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: 567778e49a0bcc089901ed6ea352034ae988115f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=567778e49a0bcc089901ed6ea352034ae988115f

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jun 26 07:36:26 2011 +0900

targets/gbm: attemp to fix unresolved symbols

Move system libraries (usually .so) out of --start-group / --end-group
pair.  Add possiblly missing archives, defines, and shared libraries.
(cherry picked from commit 56ec8e17d3a132cd43a3d75a653a034b05cbd918)

---

 src/gallium/targets/gbm/Makefile |   31 ++-
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/gallium/targets/gbm/Makefile b/src/gallium/targets/gbm/Makefile
index 2c096bc..5310425 100644
--- a/src/gallium/targets/gbm/Makefile
+++ b/src/gallium/targets/gbm/Makefile
@@ -18,6 +18,7 @@ GBM_INCLUDES = \
 GBM_LIBS = $(LIBUDEV_LIBS) $(LIBDRM_LIB) \
   $(TOP)/src/gallium/state_trackers/gbm/libgbm.a \
   $(TOP)/src/gallium/drivers/identity/libidentity.a \
+  $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
   $(TOP)/src/gallium/drivers/trace/libtrace.a \
   $(TOP)/src/gallium/drivers/rbug/librbug.a \
   $(GALLIUM_AUXILIARIES)
@@ -37,44 +38,54 @@ pipe_INCLUDES = \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/winsys
 
-pipe_LIBS = $(LIBDRM_LIB) \
+pipe_LIBS = \
$(TOP)/src/gallium/drivers/identity/libidentity.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/rbug/librbug.a \
$(GALLIUM_AUXILIARIES)
 
-pipe_CLFLAGS = $(LIBDRM_CFLAGS)
+# as if we are DRI modules
+pipe_SYS = $(DRI_LIB_DEPS)
+
+pipe_CLFLAGS = \
+   -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD \
+   $(LIBDRM_CFLAGS)
 
 pipe_LDFLAGS = -Wl,--no-undefined
 
 # i915 pipe driver
-i915_LIBS = -ldrm_intel \
+i915_LIBS = \
$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
$(TOP)/src/gallium/drivers/i915/libi915.a
+i915_SYS = -ldrm_intel
 
 # i965 pipe driver
-i965_LIBS = -ldrm_intel \
+i965_LIBS = \
$(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
$(TOP)/src/gallium/drivers/i965/libi965.a \
$(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
+i965_SYS = -ldrm_intel
 
 # nouveau pipe driver
-nouveau_LIBS = -ldrm_nouveau \
+nouveau_LIBS = \
$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
$(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+nouveau_SYS = -ldrm_nouveau
 
 # r300 pipe driver
-r300_LIBS = -ldrm \
+r300_LIBS = \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
+r300_SYS = -ldrm_radeon
 
 # r600 pipe driver
-r600_LIBS = -ldrm -ldrm_radeon \
+r600_LIBS = \
$(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
$(TOP)/src/gallium/drivers/r600/libr600.a
+r600_SYS = -ldrm_radeon
 
 # vmwgfx pipe driver
 vmwgfx_LIBS = \
@@ -83,7 +94,8 @@ vmwgfx_LIBS = \
 
 # LLVM
 ifeq ($(MESA_LLVM),1)
-pipe_LIBS += $(LLVM_LIBS)
+pipe_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
+pipe_SYS += $(LLVM_LIBS)
 pipe_LDFLAGS += $(LLVM_LDFLAGS)
 endif
 
@@ -140,7 +152,8 @@ $(pipe_TARGETS): $(PIPE_PREFIX)%.so: pipe_%.o
$(MKLIB) -o $@ -noprefix -linker '$(CC)' \
-ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
$(MKLIB_OPTIONS) $ \
-   -Wl,--start-group $($*_LIBS) $(pipe_LIBS) -Wl,--end-group
+   -Wl,--start-group $(pipe_LIBS) $($*_LIBS) -Wl,--end-group \
+   $(pipe_SYS) $($*_SYS)
 
 $(pipe_OBJECTS): %.o: %.c
$(CC) -c -o $@ $ $(pipe_INCLUDES) $(pipe_CFLAGS) $(CFLAGS)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.11): targets/egl-static: fix library search order

2011-06-30 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: bd1ceb5c5ba47b9b1930b9e6e10181a8ee792d98
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd1ceb5c5ba47b9b1930b9e6e10181a8ee792d98

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jun 28 15:23:20 2011 +0900

targets/egl-static: fix library search order

Use

  $(MKLIB) -ldflags '-L$(TOP)/$(LIB_DIR)'

instead of

  $(MKLIB) -L$(TOP)/$(LIB_DIR)

to make sure the local library path appears before system's.
(cherry picked from commit 24137afb315007c4e686b494d4565c5bd3d2d97f)

---

 src/gallium/targets/egl-static/Makefile |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/targets/egl-static/Makefile 
b/src/gallium/targets/egl-static/Makefile
index 6b5ed60..832d7ba 100644
--- a/src/gallium/targets/egl-static/Makefile
+++ b/src/gallium/targets/egl-static/Makefile
@@ -173,14 +173,14 @@ default: $(OUTPUTS)
 
 $(OUTPUT_PATH)/egl_gallium.so: $(egl_OBJECTS) $(egl_LIBS)
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
-   -L$(TOP)/$(LIB_DIR) -ldflags '-Wl,--no-undefined $(LDFLAGS)' \
+   -ldflags '-L$(TOP)/$(LIB_DIR) -Wl,--no-undefined $(LDFLAGS)' \
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
$(egl_OBJECTS) -Wl,--start-group $(egl_LIBS) -Wl,--end-group \
$(egl_SYS)
 
 $(OUTPUT_PATH)/st_GL.so: st_GL.o $(st_GL_LIBS)
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
-   -L$(TOP)/$(LIB_DIR) -ldflags '$(LDFLAGS)' \
+   -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
$ -Wl,--start-group $(st_GL_LIBS) -Wl,--end-group \
$(st_GL_SYS)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.11): target/egl-static: fix a compiler warning

2011-06-30 Thread Chia-I Wu
Module: Mesa
Branch: 7.11
Commit: b90c710c6cd8017f59b09d935fbbbe94ada81a12
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b90c710c6cd8017f59b09d935fbbbe94ada81a12

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jun 30 10:23:50 2011 +0900

target/egl-static: fix a compiler warning

(cherry picked from commit 3e3df5fcd19671260fdd983e1ebfaca7826242a6)

---

 src/gallium/targets/egl-static/st_GL.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/egl-static/st_GL.c 
b/src/gallium/targets/egl-static/st_GL.c
index d9ca834..3f4b7a0 100644
--- a/src/gallium/targets/egl-static/st_GL.c
+++ b/src/gallium/targets/egl-static/st_GL.c
@@ -29,6 +29,9 @@
 #include pipe/p_compiler.h
 
 PUBLIC struct st_api *
+st_api_create_OpenGL(void);
+
+struct st_api *
 st_api_create_OpenGL(void)
 {
return st_gl_api_create();

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: update fbdev backend

2011-06-28 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: aa281dd3924cf76e24c0e8cbd971f58d082cd4cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa281dd3924cf76e24c0e8cbd971f58d082cd4cd

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jun 28 10:22:01 2011 +0900

st/egl: update fbdev backend

Considering fbdev as an in-kernel window system,

 - opening a device opens a connection
 - there is only one window: the framebuffer
 - fb_var_screeninfo decides window position, size, and even color format
 - there is no pixmap

Now EGL is built on top of this window system.  So we should have

 - the fd as the handle of the native display
 - reject all but one native window: NULL
 - no pixmap support

modeset support is still around, but it should be removed soon.

---

 .../state_trackers/egl/fbdev/native_fbdev.c|  334 +++-
 src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.c  |   71 +++--
 src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.h  |9 +-
 3 files changed, 241 insertions(+), 173 deletions(-)

diff --git a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c 
b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
index 49e3728..6772d37 100644
--- a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
+++ b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
@@ -26,6 +26,21 @@
  *Chia-I Wu o...@lunarg.com
  */
 
+/**
+ * Considering fbdev as an in-kernel window system,
+ *
+ *  - opening a device opens a connection
+ *  - there is only one window: the framebuffer
+ *  - fb_var_screeninfo decides window position, size, and even color format
+ *  - there is no pixmap
+ *
+ * Now EGL is built on top of this window system.  So we should have
+ *
+ *  - the fd as the handle of the native display
+ *  - reject all but one native window: NULL
+ *  - no pixmap support
+ */
+
 #include sys/ioctl.h
 #include sys/types.h
 #include sys/stat.h
@@ -48,13 +63,10 @@ struct fbdev_display {
const struct native_event_handler *event_handler;
 
struct fb_fix_screeninfo finfo;
-   struct fb_var_screeninfo vinfo;
-
+   struct fb_var_screeninfo config_vinfo;
struct native_config config;
-   struct native_connector connector;
-   struct native_mode mode;
 
-   struct fbdev_surface *current_surface;
+   boolean assume_fixed_vinfo;
 };
 
 struct fbdev_surface {
@@ -66,7 +78,7 @@ struct fbdev_surface {
 
unsigned int sequence_number;
 
-   boolean is_current;
+   struct fbdev_sw_drawable drawable;
 };
 
 static INLINE struct fbdev_display *
@@ -103,38 +115,70 @@ fbdev_surface_validate(struct native_surface *nsurf, uint 
attachment_mask,
return TRUE;
 }
 
-static boolean
-fbdev_surface_flush_frontbuffer(struct native_surface *nsurf)
+static enum pipe_format
+vinfo_to_format(const struct fb_var_screeninfo *vinfo)
 {
-   struct fbdev_surface *fbsurf = fbdev_surface(nsurf);
+   enum pipe_format format = PIPE_FORMAT_NONE;
 
-   if (!fbsurf-is_current)
-  return TRUE;
+   /* should also check channel offsets... */
+   switch (vinfo-bits_per_pixel) {
+   case 32:
+  if (vinfo-red.length == 8 
+  vinfo-green.length == 8 
+  vinfo-blue.length == 8) {
+ format = (vinfo-transp.length == 8) ?
+PIPE_FORMAT_B8G8R8A8_UNORM : PIPE_FORMAT_B8G8R8X8_UNORM;
+  }
+  break;
+   case 16:
+  if (vinfo-red.length == 5 
+  vinfo-green.length == 6 
+  vinfo-blue.length == 5 
+  vinfo-transp.length == 0)
+ format = PIPE_FORMAT_B5G6R5_UNORM;
+  break;
+   default:
+  break;
+   }
 
-   return resource_surface_present(fbsurf-rsurf,
- NATIVE_ATTACHMENT_FRONT_LEFT, NULL);
+   return format;
 }
 
 static boolean
-fbdev_surface_swap_buffers(struct native_surface *nsurf)
+fbdev_surface_update_drawable(struct native_surface *nsurf,
+  const struct fb_var_screeninfo *vinfo)
 {
struct fbdev_surface *fbsurf = fbdev_surface(nsurf);
-   struct fbdev_display *fbdpy = fbsurf-fbdpy;
-   boolean ret = TRUE;
-
-   if (fbsurf-is_current) {
-  ret = resource_surface_present(fbsurf-rsurf,
-NATIVE_ATTACHMENT_BACK_LEFT, NULL);
+   unsigned x, y, width, height;
+
+   x = vinfo-xoffset;
+   y = vinfo-yoffset;
+   width = MIN2(vinfo-xres, fbsurf-width);
+   height = MIN2(vinfo-yres, fbsurf-height);
+
+   /* sanitize the values */
+   if (x + width  vinfo-xres_virtual) {
+  if (x  vinfo-xres_virtual)
+ width = 0;
+  else
+ width = vinfo-xres_virtual - x;
+   }
+   if (y + height  vinfo-yres_virtual) {
+  if (y  vinfo-yres_virtual)
+ height = 0;
+  else
+ height = vinfo-yres_virtual - y;
}
 
-   resource_surface_swap_buffers(fbsurf-rsurf,
- NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, TRUE);
-   /* the front/back textures are swapped */
-   fbsurf-sequence_number++;
-   fbdpy-event_handler-invalid_surface(fbdpy-base,
- fbsurf-base, fbsurf-sequence_number);
+   fbsurf-drawable.format = vinfo_to_format(vinfo);
+   fbsurf

Demos (master): eglfbdev: add a demo for EGL on fbdev

2011-06-28 Thread Chia-I Wu
Module: Demos
Branch: master
Commit: a05e5db67134086e4f2fc8480890a2b315c8c704
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=a05e5db67134086e4f2fc8480890a2b315c8c704

Author: Chia-I Wu olva...@gmail.com
Date:   Mon Jun 27 15:20:40 2011 +0900

eglfbdev: add a demo for EGL on fbdev

---

 src/egl/opengles1/Makefile.am |1 +
 src/egl/opengles1/eglfbdev.c  |  338 +
 2 files changed, 339 insertions(+), 0 deletions(-)

diff --git a/src/egl/opengles1/Makefile.am b/src/egl/opengles1/Makefile.am
index 752c3d1..7a9828d 100644
--- a/src/egl/opengles1/Makefile.am
+++ b/src/egl/opengles1/Makefile.am
@@ -43,6 +43,7 @@ noinst_PROGRAMS = \
clear \
drawtex_screen \
drawtex_x11 \
+   eglfbdev \
es1_info \
gears_screen \
gears_x11 \
diff --git a/src/egl/opengles1/eglfbdev.c b/src/egl/opengles1/eglfbdev.c
new file mode 100644
index 000..bbc268e
--- /dev/null
+++ b/src/egl/opengles1/eglfbdev.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *Chia-I Wu o...@lunarg.com
+ */
+
+/*
+ * This is a demonstration of EGL on fbdev:
+ *
+ *   The native display is the fd of the device;
+ *   There is only one native window, NULL;
+ *   There is no native pixmaps.
+ *
+ * It is the app's responsibility to set up the tty, open the fb device, and
+ * initialize EGL.
+ */
+
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include stdarg.h
+
+/* for tty */
+#include linux/kd.h
+#include linux/vt.h
+#include sys/ioctl.h
+#include termios.h
+#include unistd.h
+#include signal.h
+
+/* for fbdev */
+#include linux/fb.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+
+/* for EGL */
+#include EGL/egl.h
+#include GLES/gl.h
+
+static int tty_fd = -1;
+static int tty_saved_vtno;
+
+static int tty_open_vt(int vtno)
+{
+   const char tty[] = /dev/tty%d;
+   char name[64];
+   int size, flags;
+
+   size = snprintf(name, sizeof(name), tty, vtno);
+   if (size = sizeof(name))
+  return -1;
+
+   flags = (vtno) ? O_RDWR | O_NDELAY : O_WRONLY;
+
+   return open(name, flags);
+}
+
+static int tty_switch_vt(int fd, int vtno)
+{
+   int ret;
+
+   ret = ioctl(fd, VT_ACTIVATE, vtno);
+   if (ret = 0)
+  ret = ioctl(fd, VT_WAITACTIVE, vtno);
+
+   return ret;
+}
+
+
+static int tty_init_vt(void)
+{
+   struct vt_stat vts;
+   int fd, vtno;
+
+   /* get the next available tty number */
+   fd = tty_open_vt(0);
+   if (fd  0)
+  return -1;
+   if (ioctl(fd, VT_OPENQRY, vtno)  0)
+  goto fail;
+   close(fd);
+
+   fd = tty_open_vt(vtno);
+   if (fd  0)
+  return -1;
+
+   /* save the current VT */
+   if (ioctl(fd, VT_GETSTATE, vts)  0)
+  goto fail;
+   tty_saved_vtno = vts.v_active;
+
+   if (tty_switch_vt(fd, vtno))
+  goto fail;
+
+   return fd;
+
+fail:
+   close(fd);
+   return -1;
+}
+
+static void
+tty_close(void)
+{
+   /* restore */
+   ioctl(tty_fd, KDSETMODE, KD_TEXT);
+   tty_switch_vt(tty_fd, tty_saved_vtno);
+
+   close(tty_fd);
+}
+
+static void
+signal_handler(int sig)
+{
+   if (tty_fd = 0)
+  tty_close();
+}
+
+static int tty_open(void)
+{
+   struct sigaction sa;
+
+   tty_fd = tty_init_vt();
+   if (tty_fd  0)
+  return -1;
+
+   /* install the signal handler */
+   memset(sa, 0, sizeof(sa));
+   sigemptyset(sa.sa_mask);
+   sa.sa_handler = signal_handler;
+   if (sigaction(SIGINT, sa, NULL))
+  goto fail;
+   if (sigaction(SIGTERM, sa, NULL))
+  goto fail;
+   if (sigaction(SIGABRT, sa, NULL))
+  goto fail;
+
+   if (ioctl(tty_fd, KDSETMODE, KD_GRAPHICS)  0)
+  goto fail;
+
+   tcflush(tty_fd, TCIOFLUSH);
+
+   return 0;
+
+fail:
+   tty_close();
+   tty_fd = -1;
+   return -1;
+}
+
+static EGLDisplay egl_dpy;
+static EGLContext egl_ctx;
+static EGLSurface egl_surf;
+static EGLBoolean egl_verbose;
+
+static void
+egl_fatal(char *format, ...)
+{
+   va_list

Mesa (master): targets/egl-static: fix library search order

2011-06-28 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 24137afb315007c4e686b494d4565c5bd3d2d97f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=24137afb315007c4e686b494d4565c5bd3d2d97f

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jun 28 15:23:20 2011 +0900

targets/egl-static: fix library search order

Use

  $(MKLIB) -ldflags '-L$(TOP)/$(LIB_DIR)'

instead of

  $(MKLIB) -L$(TOP)/$(LIB_DIR)

to make sure the local library path appears before system's.

---

 src/gallium/targets/egl-static/Makefile |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/targets/egl-static/Makefile 
b/src/gallium/targets/egl-static/Makefile
index 6b5ed60..832d7ba 100644
--- a/src/gallium/targets/egl-static/Makefile
+++ b/src/gallium/targets/egl-static/Makefile
@@ -173,14 +173,14 @@ default: $(OUTPUTS)
 
 $(OUTPUT_PATH)/egl_gallium.so: $(egl_OBJECTS) $(egl_LIBS)
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
-   -L$(TOP)/$(LIB_DIR) -ldflags '-Wl,--no-undefined $(LDFLAGS)' \
+   -ldflags '-L$(TOP)/$(LIB_DIR) -Wl,--no-undefined $(LDFLAGS)' \
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
$(egl_OBJECTS) -Wl,--start-group $(egl_LIBS) -Wl,--end-group \
$(egl_SYS)
 
 $(OUTPUT_PATH)/st_GL.so: st_GL.o $(st_GL_LIBS)
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
-   -L$(TOP)/$(LIB_DIR) -ldflags '$(LDFLAGS)' \
+   -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
$ -Wl,--start-group $(st_GL_LIBS) -Wl,--end-group \
$(st_GL_SYS)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl-static: fix building without libudev

2011-06-26 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: a1cadf2b5c3b8f2e33207e81ee4d1476b5f87805
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1cadf2b5c3b8f2e33207e81ee4d1476b5f87805

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jun 26 18:03:15 2011 +0900

targets/egl-static: fix building without libudev

Thanks to José for pointing out.

---

 src/gallium/targets/egl-static/egl.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/targets/egl-static/egl.c 
b/src/gallium/targets/egl-static/egl.c
index 9b59ebd..568f549 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -33,9 +33,10 @@
 #ifdef HAVE_LIBUDEV
 #include stdio.h /* for sscanf */
 #include libudev.h
+#endif
+
 #define DRIVER_MAP_GALLIUM_ONLY
 #include pci_ids/pci_id_driver_map.h
-#endif
 
 #include egl_pipe.h
 #include egl_st.h

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: reorganize backend initialization

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 73df31eedd0f33c8a9907855cb247c8f87964c48
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=73df31eedd0f33c8a9907855cb247c8f87964c48

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 14:52:57 2011 +0900

st/egl: reorganize backend initialization

Remove set_event_handler() and pass the event handler with
native_get_XXX_platform().  Add init_screen() so that the pipe screen is
created later.  This way we don't need to pass user_data to
create_display().

---

 src/gallium/state_trackers/egl/common/egl_g3d.c|   29 ---
 src/gallium/state_trackers/egl/common/native.h |   26 --
 src/gallium/state_trackers/egl/drm/native_drm.c|   26 +++---
 src/gallium/state_trackers/egl/drm/native_drm.h|2 +-
 .../state_trackers/egl/fbdev/native_fbdev.c|   84 +--
 src/gallium/state_trackers/egl/gdi/native_gdi.c|   58 +++---
 .../state_trackers/egl/wayland/native_drm.c|   11 +--
 .../state_trackers/egl/wayland/native_shm.c|   12 +--
 .../state_trackers/egl/wayland/native_wayland.c|   20 ++---
 .../state_trackers/egl/wayland/native_wayland.h|7 +-
 src/gallium/state_trackers/egl/x11/native_dri2.c   |   12 +--
 src/gallium/state_trackers/egl/x11/native_x11.c|   20 ++---
 src/gallium/state_trackers/egl/x11/native_x11.h|6 +-
 src/gallium/state_trackers/egl/x11/native_ximage.c |   56 +++--
 14 files changed, 172 insertions(+), 197 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 6a40f4d..7d1eafe 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -87,7 +87,7 @@ egl_g3d_lookup_egl_image(struct native_display *ndpy, void 
*egl_image)
return resource;
 }
 
-static struct native_event_handler egl_g3d_native_event_handler = {
+static const struct native_event_handler egl_g3d_native_event_handler = {
egl_g3d_invalid_surface,
egl_g3d_new_drm_screen,
egl_g3d_new_sw_screen,
@@ -110,40 +110,38 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType 
plat)
   case _EGL_PLATFORM_WINDOWS:
  plat_name = Windows;
 #ifdef HAVE_GDI_BACKEND
- nplat = native_get_gdi_platform();
+ nplat = native_get_gdi_platform(egl_g3d_native_event_handler);
 #endif
  break;
   case _EGL_PLATFORM_X11:
  plat_name = X11;
 #ifdef HAVE_X11_BACKEND
- nplat = native_get_x11_platform();
+ nplat = native_get_x11_platform(egl_g3d_native_event_handler);
 #endif
 break;
   case _EGL_PLATFORM_WAYLAND:
  plat_name = wayland;
 #ifdef HAVE_WAYLAND_BACKEND
- nplat = native_get_wayland_platform();
+ nplat = native_get_wayland_platform(egl_g3d_native_event_handler);
 #endif
  break;
   case _EGL_PLATFORM_DRM:
  plat_name = DRM;
 #ifdef HAVE_DRM_BACKEND
- nplat = native_get_drm_platform();
+ nplat = native_get_drm_platform(egl_g3d_native_event_handler);
 #endif
  break;
   case _EGL_PLATFORM_FBDEV:
  plat_name = FBDEV;
 #ifdef HAVE_FBDEV_BACKEND
- nplat = native_get_fbdev_platform();
+ nplat = native_get_fbdev_platform(egl_g3d_native_event_handler);
 #endif
  break;
   default:
  break;
   }
 
-  if (nplat)
- nplat-set_event_handler(egl_g3d_native_event_handler);
-  else
+  if (!nplat)
  _eglLog(_EGL_WARNING, unsupported platform %s, plat_name);
 
   gdrv-platforms[plat] = nplat;
@@ -520,13 +518,20 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
gdpy-loader = gdrv-loader;
dpy-DriverData = gdpy;
 
-   _eglLog(_EGL_INFO, use %s for display %p, nplat-name, 
dpy-PlatformDisplay);
-   gdpy-native = nplat-create_display(dpy-PlatformDisplay,
- dpy-Options.UseFallback, (void *) dpy);
+   _eglLog(_EGL_INFO, use %s for display %p,
+ nplat-name, dpy-PlatformDisplay);
+   gdpy-native =
+  nplat-create_display(dpy-PlatformDisplay, dpy-Options.UseFallback);
if (!gdpy-native) {
   _eglError(EGL_NOT_INITIALIZED, eglInitialize(no usable display));
   goto fail;
}
+   gdpy-native-user_data = (void *) dpy;
+   if (!gdpy-native-init_screen(gdpy-native)) {
+  _eglError(EGL_NOT_INITIALIZED,
+eglInitialize(failed to initialize screen));
+  goto fail;
+   }
 
if (gdpy-loader-profile_masks[ST_API_OPENGL]  ST_PROFILE_DEFAULT_MASK)
   dpy-ClientAPIs |= EGL_OPENGL_BIT;
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index cb26196..c0b8385 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -152,6 +152,11 @@ struct native_display {
 */
void *user_data;
 
+   /**
+* Initialize and create the pipe screen.
+*/
+   boolean (*init_screen)(struct

Mesa (master): st/egl: clean up eglCopyBuffers

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 7c4e9dcdceec1112c91206619fe8b0885be99a79
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c4e9dcdceec1112c91206619fe8b0885be99a79

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 15:48:24 2011 +0900

st/egl: clean up eglCopyBuffers

Add copy_to_pixmap method to native_display and use it for
eglCopyBuffers.

---

 .../state_trackers/egl/common/egl_g3d_api.c|   44 +---
 src/gallium/state_trackers/egl/common/native.h |   11 +
 .../state_trackers/egl/common/native_helper.c  |   41 ++
 .../state_trackers/egl/common/native_helper.h  |5 ++
 .../state_trackers/egl/wayland/native_wayland.c|1 +
 src/gallium/state_trackers/egl/x11/native_dri2.c   |2 +
 src/gallium/state_trackers/egl/x11/native_ximage.c |1 +
 7 files changed, 63 insertions(+), 42 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 1d49c30..cd1c355 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -602,21 +602,6 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surf)
  gsurf-base.SwapInterval);
 }
 
-/**
- * Get the pipe surface of the given attachment of the native surface.
- */
-static struct pipe_resource *
-get_pipe_resource(struct native_display *ndpy, struct native_surface *nsurf,
-  enum native_attachment natt)
-{
-   struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
-
-   textures[natt] = NULL;
-   nsurf-validate(nsurf, 1  natt, NULL, textures, NULL, NULL);
-
-   return textures[natt];
-}
-
 static EGLBoolean
 egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
  EGLNativePixmapType target)
@@ -624,43 +609,18 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surf,
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
_EGLContext *ctx = _eglGetCurrentContext();
-   struct native_surface *nsurf;
-   struct pipe_resource *ptex;
-   struct pipe_context *pipe;
 
if (!gsurf-render_texture)
   return EGL_TRUE;
 
-   nsurf = gdpy-native-create_pixmap_surface(gdpy-native, target, NULL);
-   if (!nsurf)
-  return _eglError(EGL_BAD_NATIVE_PIXMAP, eglCopyBuffers);
-
/* flush if the surface is current */
if (ctx  ctx-DrawSurface == gsurf-base) {
   struct egl_g3d_context *gctx = egl_g3d_context(ctx);
   gctx-stctxi-flush(gctx-stctxi, ST_FLUSH_FRONT, NULL);
}
 
-   pipe = ndpy_get_copy_context(gdpy-native);
-   if (!pipe)
-  return EGL_FALSE;
-
-   ptex = get_pipe_resource(gdpy-native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
-   if (ptex) {
-  struct pipe_box src_box;
-
-  u_box_origin_2d(ptex-width0, ptex-height0, src_box);
-  pipe-resource_copy_region(pipe, ptex, 0, 0, 0, 0,
-gsurf-render_texture, 0, src_box);
-  pipe-flush(pipe, NULL);
-  nsurf-present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
-
-  pipe_resource_reference(ptex, NULL);
-   }
-
-   nsurf-destroy(nsurf);
-
-   return EGL_TRUE;
+   return gdpy-native-copy_to_pixmap(gdpy-native,
+ target, gsurf-render_texture);
 }
 
 static EGLBoolean
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index c0b8385..8d01257 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -180,11 +180,22 @@ struct native_display {
 *
 * This function is usually called to find a config that supports a given
 * pixmap.  Thus, it is usually called with the same pixmap in a row.
+*
+* TODO should be get_pixmap_format() and return the pipe format of the
+* pixmap.
 */
boolean (*is_pixmap_supported)(struct native_display *ndpy,
   EGLNativePixmapType pix,
   const struct native_config *nconf);
 
+   /**
+* Copy the contents of the resource to the pixmap's front-left attachment.
+* This is used to implement eglCopyBuffers.  Required unless no config has
+* pixmap_bit set.
+*/
+   boolean (*copy_to_pixmap)(struct native_display *ndpy,
+ EGLNativePixmapType pix,
+ struct pipe_resource *src);
 
/**
 * Create a window surface.  Required unless no config has window_bit set.
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c 
b/src/gallium/state_trackers/egl/common/native_helper.c
index 2585730..6f2097c 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -368,6 +368,47 @@ resource_surface_wait(struct resource_surface *rsurf)
while (resource_surface_throttle(rsurf));
 }
 
+boolean

Mesa (master): st/egl: add a fast path for ximage eglCopyBuffers

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 53d354b2247fd2d4ec230a7b4adb5bd91d3cb83a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=53d354b2247fd2d4ec230a7b4adb5bd91d3cb83a

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 16:18:11 2011 +0900

st/egl: add a fast path for ximage eglCopyBuffers

---

 src/gallium/state_trackers/egl/x11/native_ximage.c |   41 +++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c 
b/src/gallium/state_trackers/egl/x11/native_ximage.c
index bb5f0aa..5742b0f 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -447,6 +447,45 @@ ximage_display_is_pixmap_supported(struct native_display 
*ndpy,
return (fmt == nconf-color_format);
 }
 
+static boolean
+ximage_display_copy_to_pixmap(struct native_display *ndpy,
+  EGLNativePixmapType pix,
+  struct pipe_resource *src)
+{
+   /* fast path to avoid unnecessary allocation and resource_copy_region */
+   if (src-bind  PIPE_BIND_DISPLAY_TARGET) {
+  struct ximage_display *xdpy = ximage_display(ndpy);
+  enum pipe_format fmt = get_pixmap_format(xdpy-base, pix);
+  const struct ximage_config *xconf;
+  struct xlib_drawable xdraw;
+  int i;
+
+  if (fmt == PIPE_FORMAT_NONE || src-format != fmt)
+ return FALSE;
+
+  for (i = 0; i  xdpy-num_configs; i++) {
+ if (xdpy-configs[i].base.color_format == fmt) {
+xconf = xdpy-configs[i];
+break;
+ }
+  }
+  if (!xconf)
+ return FALSE;
+
+  memset(xdraw, 0, sizeof(xdraw));
+  xdraw.visual = xconf-visual-visual;
+  xdraw.depth = xconf-visual-depth;
+  xdraw.drawable = (Drawable) pix;
+
+  xdpy-base.screen-flush_frontbuffer(xdpy-base.screen,
+src, 0, 0, xdraw);
+
+  return TRUE;
+   }
+
+   return native_display_copy_to_pixmap(ndpy, pix, src);
+}
+
 static int
 ximage_display_get_param(struct native_display *ndpy,
  enum native_param_type param)
@@ -542,7 +581,7 @@ x11_create_ximage_display(Display *dpy,
 
xdpy-base.get_configs = ximage_display_get_configs;
xdpy-base.is_pixmap_supported = ximage_display_is_pixmap_supported;
-   xdpy-base.copy_to_pixmap = native_display_copy_to_pixmap;
+   xdpy-base.copy_to_pixmap = ximage_display_copy_to_pixmap;
xdpy-base.create_window_surface = ximage_display_create_window_surface;
xdpy-base.create_pixmap_surface = ximage_display_create_pixmap_surface;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl-static: do not use DRI_LIB_DEPS

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 1e9f0b17365072ef672afddde9d973530581
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e9f0b17365072ef672afddde9d973530581

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 18:09:18 2011 +0900

targets/egl-static: do not use DRI_LIB_DEPS

It brings in libraries that are not necessarily needed.

---

 src/gallium/targets/egl-static/Makefile |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/egl-static/Makefile 
b/src/gallium/targets/egl-static/Makefile
index d69fe42..6b5ed60 100644
--- a/src/gallium/targets/egl-static/Makefile
+++ b/src/gallium/targets/egl-static/Makefile
@@ -42,7 +42,7 @@ egl_CPPFLAGS += \
-I$(TOP)/src/egl/main \
-D_EGL_MAIN=_eglMain
 egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
-egl_SYS += $(LIBUDEV_LIBS) -lEGL -lm
+egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm
 
 # EGL platforms
 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
@@ -70,7 +70,7 @@ egl_CPPFLAGS += -I$(TOP)/src/mesa $(API_DEFINES)
 # make st/mesa built-in when there is a single glapi provider
 ifeq ($(SHARED_GLAPI),1)
 egl_LIBS += $(TOP)/src/mesa/libmesagallium.a
-egl_SYS += $(DRI_LIB_DEPS) -l$(GLAPI_LIB)
+egl_SYS += -lm -lpthread $(DLOPEN_LIBS) -l$(GLAPI_LIB)
 else
 egl_CPPFLAGS += -D_EGL_EXTERNAL_GL=1
 OUTPUTS += st_GL
@@ -154,7 +154,7 @@ egl_SYS := $(sort $(egl_SYS))
 # st_GL, built only when shared glapi is not enabled
 st_GL_CPPFLAGS := -I $(TOP)/src/mesa -I$(TOP)/src/gallium/include
 st_GL_LIBS := $(TOP)/src/mesa/libmesagallium.a $(GALLIUM_AUXILIARIES)
-st_GL_SYS := $(DRI_LIB_DEPS)
+st_GL_SYS := -lm -lpthread $(DLOPEN_LIBS)
 
 # LLVM
 ifeq ($(MESA_LLVM),1)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: make implementing eglChooseConfig easier

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 31520548b763947da6b70b6debe38820835c5bcc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=31520548b763947da6b70b6debe38820835c5bcc

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 17:32:15 2011 +0900

egl: make implementing eglChooseConfig easier

Add a new helper function, _eglFilterConfigArray, for drivers and hide
_eglSortConfigs.

---

 src/egl/main/eglconfig.c   |   72 ++--
 src/egl/main/eglconfig.h   |   12 ++--
 .../state_trackers/egl/common/egl_g3d_api.c|   42 ++--
 3 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 5b377b7..1fd473d 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -634,7 +634,7 @@ void _eglSwapConfigs(const _EGLConfig **conf1, const 
_EGLConfig **conf2)
  * qsort() in that the compare function accepts an additional
  * argument.
  */
-void
+static void
 _eglSortConfigs(const _EGLConfig **configs, EGLint count,
 EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
   void *),
@@ -672,34 +672,27 @@ _eglSortConfigs(const _EGLConfig **configs, EGLint count,
 }
 
 
-static int
-_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2,
-   void *priv_data)
-{
-   const _EGLConfig *criteria = (const _EGLConfig *) priv_data;
-   return _eglCompareConfigs(conf1, conf2, criteria, EGL_TRUE);
-}
-
-
 /**
- * Typical fallback routine for eglChooseConfig
+ * A helper function for implementing eglChooseConfig.  See _eglFilterArray and
+ * _eglSortConfigs for the meanings of match and compare.
  */
 EGLBoolean
-_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size, EGLint *num_configs)
+_eglFilterConfigArray(_EGLArray *array, EGLConfig *configs,
+  EGLint config_size, EGLint *num_configs,
+  EGLBoolean (*match)(const _EGLConfig *, void *),
+  EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
+void *),
+  void *priv_data)
 {
-   _EGLConfig **configList, criteria;
+   _EGLConfig **configList;
EGLint i, count;
 
if (!num_configs)
   return _eglError(EGL_BAD_PARAMETER, eglChooseConfigs);
 
-   if (!_eglParseConfigAttribList(criteria, disp, attrib_list))
-  return _eglError(EGL_BAD_ATTRIBUTE, eglChooseConfig);
-
/* get the number of matched configs */
-   count = _eglFilterArray(disp-Configs, NULL, 0,
- (_EGLArrayForEach) _eglMatchConfig, (void *) criteria);
+   count = _eglFilterArray(array, NULL, 0,
+ (_EGLArrayForEach) match, priv_data);
if (!count) {
   *num_configs = count;
   return EGL_TRUE;
@@ -710,13 +703,13 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, 
const EGLint *attrib_list,
   return _eglError(EGL_BAD_ALLOC, eglChooseConfig(out of memory));
 
/* get the matched configs */
-   _eglFilterArray(disp-Configs, (void **) configList, count,
- (_EGLArrayForEach) _eglMatchConfig, (void *) criteria);
+   _eglFilterArray(array, (void **) configList, count,
+ (_EGLArrayForEach) match, priv_data);
 
/* perform sorting of configs */
if (configs  count) {
   _eglSortConfigs((const _EGLConfig **) configList, count,
-  _eglFallbackCompare, (void *) criteria);
+  compare, priv_data);
   count = MIN2(count, config_size);
   for (i = 0; i  count; i++)
  configs[i] = _eglGetConfigHandle(configList[i]);
@@ -730,6 +723,41 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const 
EGLint *attrib_list,
 }
 
 
+static EGLBoolean
+_eglFallbackMatch(const _EGLConfig *conf, void *priv_data)
+{
+   return _eglMatchConfig(conf, (const _EGLConfig *) priv_data);
+}
+
+
+static EGLint
+_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2,
+void *priv_data)
+{
+   return _eglCompareConfigs(conf1, conf2,
+ (const _EGLConfig *) priv_data, EGL_TRUE);
+}
+
+
+/**
+ * Typical fallback routine for eglChooseConfig
+ */
+EGLBoolean
+_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size, EGLint *num_configs)
+{
+   _EGLConfig criteria;
+
+   if (!_eglParseConfigAttribList(criteria, disp, attrib_list))
+  return _eglError(EGL_BAD_ATTRIBUTE, eglChooseConfig);
+
+   return _eglFilterConfigArray(disp-Configs,
+ configs, config_size, num_configs,
+ _eglFallbackMatch, _eglFallbackCompare,
+ (void *) criteria);
+}
+
+
 /**
  * Fallback for eglGetConfigAttrib.
  */
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index 2169960..91038f4 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h

Mesa (master): st/egl: add get_pixmap_format callback to native_display

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: a0ad339915d8b5fdbebe82678fc81cbf1ec6682b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0ad339915d8b5fdbebe82678fc81cbf1ec6682b

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 16:44:11 2011 +0900

st/egl: add get_pixmap_format callback to native_display

And use it for EGL_MATCH_NATIVE_PIXMAP.  Remove is_pixmap_supported
meanwhile.

---

 .../state_trackers/egl/common/egl_g3d_api.c|   46 
 src/gallium/state_trackers/egl/common/native.h |   16 ++-
 .../state_trackers/egl/wayland/native_wayland.c|9 ++--
 src/gallium/state_trackers/egl/x11/native_dri2.c   |   28 +---
 src/gallium/state_trackers/egl/x11/native_ximage.c |   13 +++---
 5 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 7a0d6a4..cd68e97 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -86,11 +86,18 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
return stapi;
 }
 
+struct egl_g3d_choose_config_data {
+   _EGLConfig criteria;
+   enum pipe_format format;
+};
+
 static int
 egl_g3d_compare_config(const _EGLConfig *conf1, const _EGLConfig *conf2,
void *priv_data)
 {
-   const _EGLConfig *criteria = (const _EGLConfig *) priv_data;
+   struct egl_g3d_choose_config_data *data =
+  (struct egl_g3d_choose_config_data *) priv_data;
+   const _EGLConfig *criteria = data-criteria;;
 
/* EGL_NATIVE_VISUAL_TYPE ignored? */
return _eglCompareConfigs(conf1, conf2, criteria, EGL_TRUE);
@@ -99,36 +106,39 @@ egl_g3d_compare_config(const _EGLConfig *conf1, const 
_EGLConfig *conf2,
 static EGLBoolean
 egl_g3d_match_config(const _EGLConfig *conf, void *priv_data)
 {
-   const _EGLConfig *criteria = (const _EGLConfig *) priv_data;
+   struct egl_g3d_choose_config_data *data =
+  (struct egl_g3d_choose_config_data *) priv_data;
+   struct egl_g3d_config *gconf = egl_g3d_config(conf);
 
-   if (!_eglMatchConfig(conf, criteria))
+   if (data-format != PIPE_FORMAT_NONE 
+   data-format != gconf-native-color_format)
   return EGL_FALSE;
 
-   if (criteria-MatchNativePixmap != EGL_NONE 
-   criteria-MatchNativePixmap != EGL_DONT_CARE) {
-  struct egl_g3d_display *gdpy = egl_g3d_display(conf-Display);
-  struct egl_g3d_config *gconf = egl_g3d_config(conf);
-  EGLNativePixmapType pix =
- (EGLNativePixmapType) criteria-MatchNativePixmap;
-
-  if (!gdpy-native-is_pixmap_supported(gdpy-native, pix, gconf-native))
- return EGL_FALSE;
-   }
-
-   return EGL_TRUE;
+   return _eglMatchConfig(conf, data-criteria);
 }
 
 static EGLBoolean
 egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attribs,
   EGLConfig *configs, EGLint size, EGLint *num_configs)
 {
-   _EGLConfig criteria;
+   struct egl_g3d_choose_config_data data;
 
-   if (!_eglParseConfigAttribList(criteria, dpy, attribs))
+   if (!_eglParseConfigAttribList(data.criteria, dpy, attribs))
   return _eglError(EGL_BAD_ATTRIBUTE, eglChooseConfig);
 
+   data.format = PIPE_FORMAT_NONE;
+   if (data.criteria.MatchNativePixmap != EGL_NONE 
+   data.criteria.MatchNativePixmap != EGL_DONT_CARE) {
+  struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+
+  if (!gdpy-native-get_pixmap_format(gdpy-native,
+   (EGLNativePixmapType) data.criteria.MatchNativePixmap,
+   data.format))
+ return _eglError(EGL_BAD_NATIVE_PIXMAP, eglChooseConfig);
+   }
+
return _eglFilterConfigArray(dpy-Configs, configs, size, num_configs,
- egl_g3d_match_config, egl_g3d_compare_config, criteria);
+ egl_g3d_match_config, egl_g3d_compare_config, data);
 }
 
 static _EGLContext *
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 8d01257..fc50ee4 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -175,18 +175,12 @@ struct native_display {
int *num_configs);
 
/**
-* Test if a pixmap is supported by the given config.  Required unless no
-* config has pixmap_bit set.
-*
-* This function is usually called to find a config that supports a given
-* pixmap.  Thus, it is usually called with the same pixmap in a row.
-*
-* TODO should be get_pixmap_format() and return the pipe format of the
-* pixmap.
+* Get the color format of the pixmap.  Required unless no config has
+* pixmap_bit set.
 */
-   boolean (*is_pixmap_supported)(struct native_display *ndpy,
-  EGLNativePixmapType pix,
-  const struct native_config *nconf);
+   boolean (*get_pixmap_format)(struct native_display

Mesa (master): egl: fix EGL_MATCH_NATIVE_PIXMAP

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 8ea5330200e314f9f7de763b1951656c92caa857
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ea5330200e314f9f7de763b1951656c92caa857

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jun 25 18:28:20 2011 +0900

egl: fix EGL_MATCH_NATIVE_PIXMAP

EGL_MATCH_NATIVE_PIXMAP is valid for eglChooseConfig, but invalid for
eglGetConfigAttrib.

---

 src/egl/main/eglconfig.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 1fd473d..55ce6fd 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -456,8 +456,6 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
   return EGL_FALSE;
 
switch (attr) {
-   case EGL_MATCH_NATIVE_PIXMAP:
-  return EGL_FALSE;
case EGL_Y_INVERTED_NOK:
   return conf-Display-Extensions.NOK_texture_from_pixmap;
default:
@@ -767,6 +765,16 @@ _eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLConfig *conf,
 {
if (!_eglIsConfigAttribValid(conf, attribute))
   return _eglError(EGL_BAD_ATTRIBUTE, eglGetConfigAttrib);
+
+   /* nonqueryable attributes */
+   switch (attribute) {
+   case EGL_MATCH_NATIVE_PIXMAP:
+  return _eglError(EGL_BAD_ATTRIBUTE, eglGetConfigAttrib);
+  break;
+   default:
+  break;
+   }
+
if (!value)
   return _eglError(EGL_BAD_PARAMETER, eglGetConfigAttrib);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/gbm: attemp to fix unresolved symbols

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 56ec8e17d3a132cd43a3d75a653a034b05cbd918
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=56ec8e17d3a132cd43a3d75a653a034b05cbd918

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jun 26 07:36:26 2011 +0900

targets/gbm: attemp to fix unresolved symbols

Move system libraries (usually .so) out of --start-group / --end-group
pair.  Add possiblly missing archives, defines, and shared libraries.

---

 src/gallium/targets/gbm/Makefile |   31 ++-
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/gallium/targets/gbm/Makefile b/src/gallium/targets/gbm/Makefile
index 2c096bc..5310425 100644
--- a/src/gallium/targets/gbm/Makefile
+++ b/src/gallium/targets/gbm/Makefile
@@ -18,6 +18,7 @@ GBM_INCLUDES = \
 GBM_LIBS = $(LIBUDEV_LIBS) $(LIBDRM_LIB) \
   $(TOP)/src/gallium/state_trackers/gbm/libgbm.a \
   $(TOP)/src/gallium/drivers/identity/libidentity.a \
+  $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
   $(TOP)/src/gallium/drivers/trace/libtrace.a \
   $(TOP)/src/gallium/drivers/rbug/librbug.a \
   $(GALLIUM_AUXILIARIES)
@@ -37,44 +38,54 @@ pipe_INCLUDES = \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/winsys
 
-pipe_LIBS = $(LIBDRM_LIB) \
+pipe_LIBS = \
$(TOP)/src/gallium/drivers/identity/libidentity.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/rbug/librbug.a \
$(GALLIUM_AUXILIARIES)
 
-pipe_CLFLAGS = $(LIBDRM_CFLAGS)
+# as if we are DRI modules
+pipe_SYS = $(DRI_LIB_DEPS)
+
+pipe_CLFLAGS = \
+   -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD \
+   $(LIBDRM_CFLAGS)
 
 pipe_LDFLAGS = -Wl,--no-undefined
 
 # i915 pipe driver
-i915_LIBS = -ldrm_intel \
+i915_LIBS = \
$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
$(TOP)/src/gallium/drivers/i915/libi915.a
+i915_SYS = -ldrm_intel
 
 # i965 pipe driver
-i965_LIBS = -ldrm_intel \
+i965_LIBS = \
$(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
$(TOP)/src/gallium/drivers/i965/libi965.a \
$(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
+i965_SYS = -ldrm_intel
 
 # nouveau pipe driver
-nouveau_LIBS = -ldrm_nouveau \
+nouveau_LIBS = \
$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
$(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+nouveau_SYS = -ldrm_nouveau
 
 # r300 pipe driver
-r300_LIBS = -ldrm \
+r300_LIBS = \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
+r300_SYS = -ldrm_radeon
 
 # r600 pipe driver
-r600_LIBS = -ldrm -ldrm_radeon \
+r600_LIBS = \
$(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
$(TOP)/src/gallium/drivers/r600/libr600.a
+r600_SYS = -ldrm_radeon
 
 # vmwgfx pipe driver
 vmwgfx_LIBS = \
@@ -83,7 +94,8 @@ vmwgfx_LIBS = \
 
 # LLVM
 ifeq ($(MESA_LLVM),1)
-pipe_LIBS += $(LLVM_LIBS)
+pipe_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
+pipe_SYS += $(LLVM_LIBS)
 pipe_LDFLAGS += $(LLVM_LDFLAGS)
 endif
 
@@ -140,7 +152,8 @@ $(pipe_TARGETS): $(PIPE_PREFIX)%.so: pipe_%.o
$(MKLIB) -o $@ -noprefix -linker '$(CC)' \
-ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
$(MKLIB_OPTIONS) $ \
-   -Wl,--start-group $($*_LIBS) $(pipe_LIBS) -Wl,--end-group
+   -Wl,--start-group $(pipe_LIBS) $($*_LIBS) -Wl,--end-group \
+   $(pipe_SYS) $($*_SYS)
 
 $(pipe_OBJECTS): %.o: %.c
$(CC) -c -o $@ $ $(pipe_INCLUDES) $(pipe_CFLAGS) $(CFLAGS)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: fix a compile error

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: ed47d65c7c05d7dd5a5b4cafaa32afbd4fff0bef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed47d65c7c05d7dd5a5b4cafaa32afbd4fff0bef

Author: Chia-I Wu olva...@gmail.com
Date:   Sun Jun 26 08:02:13 2011 +0900

st/egl: fix a compile error

It is triggered when --with-driver=xlib is specified.

---

 src/gallium/state_trackers/egl/x11/native_dri2.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 9a9e6c8..4b8be7b 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -936,8 +936,7 @@ x11_create_dri2_display(Display *dpy,
 
 struct native_display *
 x11_create_dri2_display(Display *dpy,
-struct native_event_handler *event_handler,
-void *user_data)
+const struct native_event_handler *event_handler)
 {
return NULL;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl-static: refactor drm_fd_get_screen_name

2011-06-25 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 450f48627684c6ea1472b4fdd51c6fc121f2bc9c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=450f48627684c6ea1472b4fdd51c6fc121f2bc9c

Author: Chia-I Wu olva...@gmail.com
Date:   Sun Jun 26 07:58:16 2011 +0900

targets/egl-static: refactor drm_fd_get_screen_name

Add drm_fd_get_pci_id to get the PCI ID.  Fix a leak with udev on error.

---

 src/gallium/targets/egl-static/egl.c |   81 ++
 1 files changed, 53 insertions(+), 28 deletions(-)

diff --git a/src/gallium/targets/egl-static/egl.c 
b/src/gallium/targets/egl-static/egl.c
index 2caad0e..9b59ebd 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -31,7 +31,7 @@
 #include egllog.h
 
 #ifdef HAVE_LIBUDEV
-#include stdio.h
+#include stdio.h /* for sscanf */
 #include libudev.h
 #define DRIVER_MAP_GALLIUM_ONLY
 #include pci_ids/pci_id_driver_map.h
@@ -60,27 +60,29 @@ get_st_api(enum st_api_type api)
return stmod-stapi;
 }
 
-static const char *
-drm_fd_get_screen_name(int fd)
-{
 #ifdef HAVE_LIBUDEV
-   struct udev *udev;
-   struct udev_device *device, *parent;
+
+static boolean
+drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
+{
+   struct udev *udev = NULL;
+   struct udev_device *device = NULL, *parent;
struct stat buf;
const char *pci_id;
-   int vendor_id, chip_id, idx = -1, i;
+
+   *chip_id = -1;
 
udev = udev_new();
if (fstat(fd, buf)  0) {
   _eglLog(_EGL_WARNING, failed to stat fd %d, fd);
-  return NULL;
+  goto out;
}
 
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
if (device == NULL) {
   _eglLog(_EGL_WARNING,
   could not create udev device for fd %d, fd);
-  return NULL;
+  goto out;
}
 
parent = udev_device_get_parent(device);
@@ -91,41 +93,64 @@ drm_fd_get_screen_name(int fd)
 
pci_id = udev_device_get_property_value(parent, PCI_ID);
if (pci_id == NULL ||
-   sscanf(pci_id, %x:%x, vendor_id, chip_id) != 2) {
+   sscanf(pci_id, %x:%x, vendor_id, chip_id) != 2) {
   _eglLog(_EGL_WARNING, malformed or no PCI ID);
+  *chip_id = -1;
   goto out;
}
 
-   /* find the driver index */
+out:
+   if (device)
+  udev_device_unref(device);
+   if (udev)
+  udev_unref(udev);
+
+   return (*chip_id = 0);
+}
+
+#else
+
+static boolean
+drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
+{
+   return FALSE;
+}
+
+#endif /* HAVE_LIBUDEV */
+
+static const char *
+drm_fd_get_screen_name(int fd)
+{
+   int vendor_id, chip_id;
+   int idx, i;
+
+   if (!drm_fd_get_pci_id(fd, vendor_id, chip_id)) {
+  _eglLog(_EGL_WARNING, failed to get driver name for fd %d, fd);
+  return NULL;
+   }
+
for (idx = 0; driver_map[idx].driver; idx++) {
   if (vendor_id != driver_map[idx].vendor_id)
  continue;
 
+  /* done if no chip id */
   if (driver_map[idx].num_chips_ids == -1)
- goto out;
+ break;
 
   for (i = 0; i  driver_map[idx].num_chips_ids; i++) {
  if (driver_map[idx].chip_ids[i] == chip_id)
-goto out;
+break;
   }
+  /* matched! */
+  if (i  driver_map[idx].num_chips_ids)
+ break;
}
 
-out:
-   udev_device_unref(device);
-   udev_unref(udev);
-
-   if (idx = 0) {
-  _eglLog((driver_map[idx].driver) ? _EGL_INFO : _EGL_WARNING,
-pci id for fd %d: %04x:%04x, driver %s,
-fd, vendor_id, chip_id, driver_map[idx].driver);
-
-  return driver_map[idx].driver;
-   }
-#endif
-
-   _eglLog(_EGL_WARNING, failed to get driver name for fd %d, fd);
+   _eglLog((driver_map[idx].driver) ? _EGL_INFO : _EGL_WARNING,
+ pci id for fd %d: %04x:%04x, driver %s,
+ fd, vendor_id, chip_id, driver_map[idx].driver);
 
-   return NULL;
+   return driver_map[idx].driver;
 }
 
 static struct pipe_screen *

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/gbm: build pipe drivers

2011-06-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: f36d210c93b1fde0cdc5c6625ca2df25ad937aba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f36d210c93b1fde0cdc5c6625ca2df25ad937aba

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jun 24 10:39:06 2011 +0900

targets/gbm: build pipe drivers

Build pipe drivers here instead of using those built by the
soon-to-be-removed targets/egl.

[with an update by Benjamin Franzke to use --{start|end}-group]

---

 src/gallium/targets/gbm/Makefile   |  126 +++-
 src/gallium/targets/gbm/pipe_i915.c|   27 +++
 src/gallium/targets/gbm/pipe_i965.c|   30 
 src/gallium/targets/gbm/pipe_loader.c  |6 +-
 src/gallium/targets/gbm/pipe_nouveau.c |   21 +
 src/gallium/targets/gbm/pipe_r300.c|   27 +++
 src/gallium/targets/gbm/pipe_r600.c|   27 +++
 src/gallium/targets/gbm/pipe_swrast.c  |   22 ++
 src/gallium/targets/gbm/pipe_vmwgfx.c  |   27 +++
 src/gbm/backends/Makefile.template |   10 +-
 10 files changed, 314 insertions(+), 9 deletions(-)

diff --git a/src/gallium/targets/gbm/Makefile b/src/gallium/targets/gbm/Makefile
index 74a0232..2c096bc 100644
--- a/src/gallium/targets/gbm/Makefile
+++ b/src/gallium/targets/gbm/Makefile
@@ -24,9 +24,133 @@ GBM_LIBS = $(LIBUDEV_LIBS) $(LIBDRM_LIB) \
 
 
 GBM_CFLAGS = \
--D_EGL_GALLIUM_DRIVER_SEARCH_DIR=\$(EGL_DRIVER_INSTALL_DIR)\ \
+-DGBM_BACKEND_SEARCH_DIR=\$(GBM_BACKEND_INSTALL_DIR)\ \
 -DPIPE_PREFIX=\$(PIPE_PREFIX)\ \
 $(LIBUDEV_CFLAGS) \
 $(LIBDRM_CFLAGS)  
 
+
+pipe_INCLUDES = \
+   -I$(TOP)/include \
+   -I$(TOP)/src/gallium/auxiliary \
+   -I$(TOP)/src/gallium/drivers \
+   -I$(TOP)/src/gallium/include \
+   -I$(TOP)/src/gallium/winsys
+
+pipe_LIBS = $(LIBDRM_LIB) \
+   $(TOP)/src/gallium/drivers/identity/libidentity.a \
+   $(TOP)/src/gallium/drivers/trace/libtrace.a \
+   $(TOP)/src/gallium/drivers/rbug/librbug.a \
+   $(GALLIUM_AUXILIARIES)
+
+pipe_CLFLAGS = $(LIBDRM_CFLAGS)
+
+pipe_LDFLAGS = -Wl,--no-undefined
+
+# i915 pipe driver
+i915_LIBS = -ldrm_intel \
+   $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
+   $(TOP)/src/gallium/drivers/i915/libi915.a
+
+# i965 pipe driver
+i965_LIBS = -ldrm_intel \
+   $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
+   $(TOP)/src/gallium/drivers/i965/libi965.a \
+   $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
+
+# nouveau pipe driver
+nouveau_LIBS = -ldrm_nouveau \
+   $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+   $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
+   $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+   $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
+   $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+
+# r300 pipe driver
+r300_LIBS = -ldrm \
+   $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
+   $(TOP)/src/gallium/drivers/r300/libr300.a
+
+# r600 pipe driver
+r600_LIBS = -ldrm -ldrm_radeon \
+   $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
+   $(TOP)/src/gallium/drivers/r600/libr600.a
+
+# vmwgfx pipe driver
+vmwgfx_LIBS = \
+   $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
+   $(TOP)/src/gallium/drivers/svga/libsvga.a
+
+# LLVM
+ifeq ($(MESA_LLVM),1)
+pipe_LIBS += $(LLVM_LIBS)
+pipe_LDFLAGS += $(LLVM_LDFLAGS)
+endif
+
+# determine the targets/sources
+pipe_TARGETS =
+pipe_SOURCES =
+
+ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
+pipe_TARGETS += $(PIPE_PREFIX)i915.so
+pipe_SOURCES += pipe_i915.c
+endif
+
+ifneq ($(findstring i965/drm,$(GALLIUM_WINSYS_DIRS)),)
+pipe_TARGETS += $(PIPE_PREFIX)i965.so
+pipe_SOURCES += pipe_i965.c
+endif
+
+ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
+pipe_TARGETS += $(PIPE_PREFIX)nouveau.so
+pipe_SOURCES += pipe_nouveau.c
+endif
+
+ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
+pipe_TARGETS += $(PIPE_PREFIX)r300.so
+pipe_SOURCES += pipe_r300.c
+endif
+
+ifneq ($(findstring r600/drm,$(GALLIUM_WINSYS_DIRS)),)
+pipe_TARGETS += $(PIPE_PREFIX)r600.so
+pipe_SOURCES += pipe_r600.c
+endif
+
+ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
+pipe_TARGETS += $(PIPE_PREFIX)vmwgfx.so
+pipe_SOURCES += pipe_vmwgfx.c
+endif
+
+pipe_OBJECTS = $(pipe_SOURCES:.c=.o)
+
+
+GBM_EXTRA_TARGETS = $(addprefix $(TOP)/$(LIB_DIR)/gbm/, $(pipe_TARGETS))
+GBM_EXTRA_INSTALL = install-pipes
+GBM_EXTRA_CLEAN = clean-pipes
+GBM_EXTRA_SOURCES = $(pipe_SOURCES)
+
 include $(TOP)/src/gbm/backends/Makefile.template
+
+
+$(GBM_EXTRA_TARGETS): $(TOP)/$(LIB_DIR)/gbm/%: %
+   @$(INSTALL) -d $(dir $@)
+   $(INSTALL) $ $(dir $@)
+
+$(pipe_TARGETS): $(PIPE_PREFIX)%.so: pipe_%.o
+   $(MKLIB) -o $@ -noprefix -linker '$(CC)' \
+   -ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
+   $(MKLIB_OPTIONS) $ \
+   -Wl,--start-group $($*_LIBS) $(pipe_LIBS) -Wl,--end-group
+
+$(pipe_OBJECTS): %.o: %.c
+   $(CC) -c -o

Mesa (master): targets/egl-static: add support for driver lookup

2011-06-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: a000745f80f695cfa0cd1dc206869eeb5f87f36f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a000745f80f695cfa0cd1dc206869eeb5f87f36f

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 20 12:36:02 2011 +0900

targets/egl-static: add support for driver lookup

Use pci id to driver map to look up the driver name.  This is based on
a433755ec5c48088a0d8a340851a1a8be9e58897.

---

 src/gallium/targets/egl-static/egl.c |   82 ++
 1 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/egl-static/egl.c 
b/src/gallium/targets/egl-static/egl.c
index 7e926cf..eee97a5 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -28,6 +28,14 @@
 
 #include common/egl_g3d_loader.h
 #include egldriver.h
+#include egllog.h
+
+#ifdef HAVE_LIBUDEV
+#include stdio.h
+#include libudev.h
+#define DRIVER_MAP_GALLIUM_ONLY
+#include pci_ids/pci_id_driver_map.h
+#endif
 
 #include egl_pipe.h
 #include egl_st.h
@@ -52,9 +60,83 @@ get_st_api(enum st_api_type api)
return stmod-stapi;
 }
 
+static const char *
+drm_fd_get_screen_name(int fd)
+{
+#ifdef HAVE_LIBUDEV
+   struct udev *udev;
+   struct udev_device *device, *parent;
+   struct stat buf;
+   const char *pci_id;
+   int vendor_id, chip_id, idx = -1, i;
+
+   udev = udev_new();
+   if (fstat(fd, buf)  0) {
+  _eglLog(_EGL_WARNING, failed to stat fd %d, fd);
+  return NULL;
+   }
+
+   device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
+   if (device == NULL) {
+  _eglLog(_EGL_WARNING,
+  could not create udev device for fd %d, fd);
+  return NULL;
+   }
+
+   parent = udev_device_get_parent(device);
+   if (parent == NULL) {
+  _eglLog(_EGL_WARNING, could not get parent device);
+  goto out;
+   }
+
+   pci_id = udev_device_get_property_value(parent, PCI_ID);
+   if (pci_id == NULL ||
+   sscanf(pci_id, %x:%x, vendor_id, chip_id) != 2) {
+  _eglLog(_EGL_WARNING, malformed or no PCI ID);
+  goto out;
+   }
+
+   /* find the driver index */
+   for (idx = 0; driver_map[idx].driver; idx++) {
+  if (vendor_id != driver_map[idx].vendor_id)
+ continue;
+
+  if (driver_map[idx].num_chips_ids == -1)
+ goto out;
+
+  for (i = 0; i  driver_map[idx].num_chips_ids; i++) {
+ if (driver_map[idx].chip_ids[i] == chip_id)
+goto out;
+  }
+   }
+
+out:
+   udev_device_unref(device);
+   udev_unref(udev);
+
+   if (idx = 0) {
+  _eglLog((driver_map[idx].driver) ? _EGL_INFO : _EGL_WARNING,
+pci id for fd %d: %04x:%04x, driver %s,
+fd, vendor_id, chip_id, driver_map[idx].driver);
+
+  return driver_map[idx].driver;
+   }
+#endif
+
+   _eglLog(_EGL_WARNING, failed to get driver name for fd %d, fd);
+
+   return NULL;
+}
+
 static struct pipe_screen *
 create_drm_screen(const char *name, int fd)
 {
+   if (!name) {
+  name = drm_fd_get_screen_name(fd);
+  if (!name)
+ return NULL;
+   }
+
return egl_pipe_create_drm_screen(name, fd);
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl-static: allow st/mesa to be dynamically loaded

2011-06-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 7451bffad41a8ab7c61c9799b351c031852eb780
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7451bffad41a8ab7c61c9799b351c031852eb780

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jun 23 20:08:53 2011 +0900

targets/egl-static: allow st/mesa to be dynamically loaded

When shared glapi is not enabled, there are two glapi providers and we
cannot decide which one to link to at build time.  It results in
unresolved symbols in st/mesa.  This commit makes st/mesa a loadable
module when shared glapi is not enabled, and hopes that the apps will
link to one of the glapi providers (GL or GLES).

---

 src/gallium/targets/egl-static/egl.c|2 +-
 src/gallium/targets/egl-static/egl_st.c |  127 ++-
 src/gallium/targets/egl-static/egl_st.h |3 +
 src/gallium/targets/egl-static/st_GL.c  |   35 +
 4 files changed, 148 insertions(+), 19 deletions(-)

diff --git a/src/gallium/targets/egl-static/egl.c 
b/src/gallium/targets/egl-static/egl.c
index eee97a5..2caad0e 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -170,7 +170,7 @@ loader_fini(void)
   struct st_module *stmod = st_modules[i];
 
   if (stmod-stapi) {
- stmod-stapi-destroy(stmod-stapi);
+ egl_st_destroy_api(stmod-stapi);
  stmod-stapi = NULL;
   }
   stmod-initialized = FALSE;
diff --git a/src/gallium/targets/egl-static/egl_st.c 
b/src/gallium/targets/egl-static/egl_st.c
index 3db5262..81d7bb4 100644
--- a/src/gallium/targets/egl-static/egl_st.c
+++ b/src/gallium/targets/egl-static/egl_st.c
@@ -29,52 +29,143 @@
 #include state_tracker/st_api.h
 #include egl_st.h
 
-/* for st/mesa */
+#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
 #include state_tracker/st_gl_api.h
-/* for st/vega */
+#endif
+
+#if FEATURE_VG
 #include vg_api.h
+#endif
+
+#if _EGL_EXTERNAL_GL
+
+#include util/u_string.h
+#include util/u_dl.h
+#include egldriver.h
+#include egllog.h
+
+static struct util_dl_library *egl_st_gl_lib;
+
+static EGLBoolean
+dlopen_gl_lib_cb(const char *dir, size_t len, void *callback_data)
+{
+   const char *name = (const char *) callback_data;
+   char path[1024];
+   int ret;
+
+   if (len) {
+  ret = util_snprintf(path, sizeof(path), %.*s/%s UTIL_DL_EXT,
+len, dir, name);
+   }
+   else {
+  ret = util_snprintf(path, sizeof(path), %s UTIL_DL_EXT, name);
+   }
+
+   if (ret  0  ret  sizeof(path)) {
+  egl_st_gl_lib = util_dl_open(path);
+  if (egl_st_gl_lib)
+ _eglLog(_EGL_DEBUG, loaded %s, path);
+   }
+
+   return !egl_st_gl_lib;
+}
 
 static struct st_api *
-st_GL_create_api(void)
+load_gl(const char *name, const char *procname)
 {
-#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
-   return st_gl_api_create();
-#else
-   return NULL;
-#endif
+   struct st_api *(*create_api)(void);
+   struct st_api *stapi = NULL;
+
+   _eglSearchPathForEach(dlopen_gl_lib_cb, (void *) name);
+   if (!egl_st_gl_lib)
+  return NULL;
+
+   create_api = (struct st_api *(*)(void))
+  util_dl_get_proc_address(egl_st_gl_lib, procname);
+   if (create_api)
+  stapi = create_api();
+
+   if (!stapi) {
+  util_dl_close(egl_st_gl_lib);
+  egl_st_gl_lib = NULL;
+   }
+
+   return stapi;
 }
 
 static struct st_api *
-st_OpenVG_create_api(void)
+egl_st_load_gl(void)
 {
-#if FEATURE_VG
-   return (struct st_api *) vg_api_get();
-#else
-   return NULL;
-#endif
+   const char module[] = st_GL;
+   const char symbol[] = st_api_create_OpenGL;
+   struct st_api *stapi;
+
+   stapi = load_gl(module, symbol);
+
+   /* try again with libglapi.so loaded */
+   if (!stapi) {
+  struct util_dl_library *glapi = util_dl_open(libglapi UTIL_DL_EXT);
+
+  if (glapi) {
+ _eglLog(_EGL_DEBUG, retry with libglapi UTIL_DL_EXT  loaded);
+
+ stapi = load_gl(module, symbol);
+ util_dl_close(glapi);
+  }
+   }
+   if (!stapi)
+  _eglLog(_EGL_WARNING, unable to load %s UTIL_DL_EXT, module);
+
+   return stapi;
 }
 
+#endif /* _EGL_EXTERNAL_GL */
+
 struct st_api *
 egl_st_create_api(enum st_api_type api)
 {
-   struct st_api *stapi;
+   struct st_api *stapi = NULL;
 
switch (api) {
case ST_API_OPENGL:
-  stapi = st_GL_create_api();
+#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
+#if _EGL_EXTERNAL_GL
+  stapi = egl_st_load_gl();
+#else
+  stapi = st_gl_api_create();
+#endif
+#endif
   break;
case ST_API_OPENVG:
-  stapi = st_OpenVG_create_api();
+#if FEATURE_VG
+  stapi = (struct st_api *) vg_api_get();
+#endif
   break;
default:
   assert(!Unknown API Type\n);
-  stapi = NULL;
   break;
}
 
return stapi;
 }
 
+void
+egl_st_destroy_api(struct st_api *stapi)
+{
+#if _EGL_EXTERNAL_GL
+   boolean is_gl = (stapi-api == ST_API_OPENGL);
+
+   stapi-destroy(stapi);
+
+   if (is_gl) {
+  util_dl_close(egl_st_gl_lib);
+  egl_st_gl_lib = NULL;
+   }
+#else
+   stapi-destroy(stapi);
+#endif
+}
+
 uint

Mesa (master): targets/egl-static: replace targets/egl

2011-06-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: b8f097f7a0da976ea23f8ee124f6faf0472ce42c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8f097f7a0da976ea23f8ee124f6faf0472ce42c

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 20 12:01:39 2011 +0900

targets/egl-static: replace targets/egl

Build egl_gallium from targets/egl-static intead of targets/egl.  The
latter exposes (unversioned) gallium interfaces and is frowned upon.

---

 configure.ac|2 +-
 src/gallium/targets/egl-static/Makefile |  201 +++
 2 files changed, 202 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 82ff9da..c36b2f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1307,7 +1307,7 @@ if test x$enable_gallium_egl = xyes; then
 fi
 
 GALLIUM_STATE_TRACKERS_DIRS=egl $GALLIUM_STATE_TRACKERS_DIRS
-GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS egl
+GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS egl-static
 HAVE_ST_EGL=yes
 fi
 
diff --git a/src/gallium/targets/egl-static/Makefile 
b/src/gallium/targets/egl-static/Makefile
new file mode 100644
index 000..d69fe42
--- /dev/null
+++ b/src/gallium/targets/egl-static/Makefile
@@ -0,0 +1,201 @@
+# src/gallium/targets/egl-static/Makefile
+#
+# This is Makefile for egl_gallium.so.  It is static in that all state trackers
+# and pipe drivers are linked statically when possible.
+#
+# The following variables are examined
+#
+#   EGL_PLATFORMS   - platforms to support
+#   EGL_CLIENT_APIS - state trackers to support
+#   GALLIUM_WINSYS_DIRS - pipe drivers to support
+#   SHARED_GLAPI- st/mesa can be statically linked or not
+#
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+OUTPUTS := egl_gallium
+
+egl_CPPFLAGS := \
+   -I$(TOP)/include \
+   -I$(TOP)/src/gallium/auxiliary \
+   -I$(TOP)/src/gallium/drivers \
+   -I$(TOP)/src/gallium/include \
+   -I$(TOP)/src/gallium/winsys
+egl_LIBS := \
+   $(TOP)/src/gallium/drivers/identity/libidentity.a \
+   $(TOP)/src/gallium/drivers/trace/libtrace.a \
+   $(TOP)/src/gallium/drivers/rbug/librbug.a \
+   $(GALLIUM_AUXILIARIES)
+egl_SYS :=
+
+egl_SOURCES := \
+   egl.c \
+   egl_pipe.c \
+   egl_st.c
+
+egl_OBJECTS := $(egl_SOURCES:%.c=%.o)
+
+# st/egl
+egl_CPPFLAGS += \
+   -I$(TOP)/src/gallium/state_trackers/egl \
+   -I$(TOP)/src/egl/main \
+   -D_EGL_MAIN=_eglMain
+egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
+egl_SYS += $(LIBUDEV_LIBS) -lEGL -lm
+
+# EGL platforms
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+egl_CPPFLAGS += $(LIBDRM_CFLAGS)
+egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
+egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
+endif
+ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
+egl_CPPFLAGS += $(LIBDRM_CFLAGS)
+egl_LIBS += $(TOP)/src/gallium/winsys/sw/wayland/libws_wayland.a
+egl_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
+egl_SYS += $(LIBDRM_LIB) $(WAYLAND_LIBS)
+endif
+ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
+egl_CPPFLAGS += $(LIBDRM_CFLAGS)
+egl_SYS += $(LIBDRM_LIB) -lgbm
+endif
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
+endif
+
+# st/mesa
+ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
+egl_CPPFLAGS += -I$(TOP)/src/mesa $(API_DEFINES)
+# make st/mesa built-in when there is a single glapi provider
+ifeq ($(SHARED_GLAPI),1)
+egl_LIBS += $(TOP)/src/mesa/libmesagallium.a
+egl_SYS += $(DRI_LIB_DEPS) -l$(GLAPI_LIB)
+else
+egl_CPPFLAGS += -D_EGL_EXTERNAL_GL=1
+OUTPUTS += st_GL
+endif # SHARED_GLAPI
+endif
+
+# st/vega
+ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
+egl_CPPFLAGS += -I$(TOP)/src/gallium/state_trackers/vega -DFEATURE_VG=1
+egl_LIBS += $(TOP)/src/gallium/state_trackers/vega/libvega.a
+egl_SYS += -lm -l$(VG_LIB)
+endif
+
+# i915
+ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
+egl_CPPFLAGS += -D_EGL_PIPE_I915=1
+egl_LIBS += \
+   $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
+   $(TOP)/src/gallium/drivers/i915/libi915.a
+egl_SYS += -ldrm_intel
+endif
+
+# i965
+ifneq ($(findstring i965/drm,$(GALLIUM_WINSYS_DIRS)),)
+egl_CPPFLAGS += -D_EGL_PIPE_I995=1
+egl_LIBS += \
+   $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
+   $(TOP)/src/gallium/drivers/i965/libi965.a \
+   $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
+egl_SYS += -ldrm_intel
+endif
+
+# nouveau
+ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
+egl_CPPFLAGS += -D_EGL_PIPE_NOUVEAU=1
+egl_LIBS += \
+   $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+   $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
+   $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+   $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
+   $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+egl_SYS += -ldrm_nouveau
+endif
+
+# r300
+ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
+egl_CPPFLAGS += -D_EGL_PIPE_R300=1
+egl_LIBS += \
+   $(TOP

Mesa (master): st/egl: make native_buffer interface typed

2011-06-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: febf5e4147612641fc23f202d5813958bee3af13
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=febf5e4147612641fc23f202d5813958bee3af13

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jun 24 13:30:35 2011 +0900

st/egl: make native_buffer interface typed

Use a typed struct to describe the native buffer and let the backends
map the native buffer to winsys_handle for
resource_from_handle/resource_to_handle.

---

 .../state_trackers/egl/common/egl_g3d_image.c  |   70 ---
 .../state_trackers/egl/common/native_buffer.h  |   31 ++---
 .../state_trackers/egl/common/native_helper.c  |   72 
 .../state_trackers/egl/common/native_helper.h  |9 +++
 src/gallium/state_trackers/egl/drm/native_drm.c|   23 +--
 .../state_trackers/egl/wayland/native_drm.c|   23 +--
 6 files changed, 139 insertions(+), 89 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index ce72e27..4f5bdba 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -137,10 +137,9 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name,
  _EGLImage *img, const EGLint *attribs)
 {
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
-   struct pipe_resource templ;
-   struct winsys_handle wsh;
_EGLImageAttribs attrs;
EGLint format;
+   struct native_buffer nbuf;
 
if (!dpy-Extensions.MESA_drm_image)
   return NULL;
@@ -166,21 +165,21 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint 
name,
   break;
}
 
-   memset(templ, 0, sizeof(templ));
-   templ.target = PIPE_TEXTURE_2D;
-   templ.format = format;
-   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
-   templ.width0 = attrs.Width;
-   templ.height0 = attrs.Height;
-   templ.depth0 = 1;
-   templ.array_size = 1;
-
-   memset(wsh, 0, sizeof(wsh));
-   wsh.handle = (unsigned) name;
-   wsh.stride =
-  attrs.DRMBufferStrideMESA * util_format_get_blocksize(templ.format);
-
-   return gdpy-native-buffer-import_buffer(gdpy-native, templ, wsh);
+   memset(nbuf, 0, sizeof(nbuf));
+   nbuf.type = NATIVE_BUFFER_DRM;
+   nbuf.u.drm.templ.target = PIPE_TEXTURE_2D;
+   nbuf.u.drm.templ.format = format;
+   nbuf.u.drm.templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+   nbuf.u.drm.templ.width0 = attrs.Width;
+   nbuf.u.drm.templ.height0 = attrs.Height;
+   nbuf.u.drm.templ.depth0 = 1;
+   nbuf.u.drm.templ.array_size = 1;
+
+   nbuf.u.drm.name = name;
+   nbuf.u.drm.stride =
+  attrs.DRMBufferStrideMESA * util_format_get_blocksize(format);
+
+   return gdpy-native-buffer-import_buffer(gdpy-native, nbuf);
 }
 
 #endif /* EGL_MESA_drm_image */
@@ -327,35 +326,26 @@ egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay 
*dpy, _EGLImage *img,
 {
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_image *gimg = egl_g3d_image(img);
-   struct winsys_handle wsh;
+   struct native_buffer nbuf;
 
if (!dpy-Extensions.MESA_drm_image)
   return EGL_FALSE;
 
-   /* get shared handle */
-   if (name) {
-  memset(handle, 0, sizeof(handle));
-  wsh.type = DRM_API_HANDLE_TYPE_SHARED;
-  if (!gdpy-native-buffer-export_buffer(gdpy-native,
-   gimg-texture, wsh))
- return EGL_FALSE;
+   memset(nbuf, 0, sizeof(nbuf));
+   nbuf.type = NATIVE_BUFFER_DRM;
+   if (name)
+  nbuf.u.drm.templ.bind |= PIPE_BIND_SHARED;
 
-  *name = wsh.handle;
-   }
+   if (!gdpy-native-buffer-export_buffer(gdpy-native,
+gimg-texture, nbuf))
+  return EGL_FALSE;
 
-   /* get KMS handle */
-   if (handle || stride) {
-  memset(wsh, 0, sizeof(wsh));
-  wsh.type = DRM_API_HANDLE_TYPE_KMS;
-  if (!gdpy-native-buffer-export_buffer(gdpy-native,
-   gimg-texture, wsh))
- return EGL_FALSE;
-
-  if (handle)
- *handle = wsh.handle;
-  if (stride)
- *stride = wsh.stride;
-   }
+   if (name)
+  *name = nbuf.u.drm.name;
+   if (handle)
+  *handle = nbuf.u.drm.handle;
+   if (stride)
+  *stride = nbuf.u.drm.stride;
 
return EGL_TRUE;
 }
diff --git a/src/gallium/state_trackers/egl/common/native_buffer.h 
b/src/gallium/state_trackers/egl/common/native_buffer.h
index 5c29ab9..b8a66d1 100644
--- a/src/gallium/state_trackers/egl/common/native_buffer.h
+++ b/src/gallium/state_trackers/egl/common/native_buffer.h
@@ -30,30 +30,43 @@
 #define _NATIVE_BUFFER_H_
 
 #include pipe/p_compiler.h
+#include pipe/p_state.h
 
 struct native_display;
-struct pipe_resource;
+
+enum native_buffer_type {
+   NATIVE_BUFFER_DRM,
+
+   NUM_NATIVE_BUFFERS
+};
+
+struct native_buffer {
+   enum native_buffer_type type;
+
+   union {
+  struct {
+ struct

Mesa (master): targets/egl: removed

2011-06-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 875a1f896056fda291f19b1f119fc23b17fe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=875a1f896056fda291f19b1f119fc23b17fe

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jun 24 11:15:55 2011 +0900

targets/egl: removed

Not used.

---

 src/gallium/targets/egl/Makefile   |  242 -
 src/gallium/targets/egl/egl.c  |  466 
 src/gallium/targets/egl/egl.h  |   44 ---
 src/gallium/targets/egl/pipe_i915.c|   27 --
 src/gallium/targets/egl/pipe_i965.c|   30 --
 src/gallium/targets/egl/pipe_nouveau.c |   21 --
 src/gallium/targets/egl/pipe_r300.c|   27 --
 src/gallium/targets/egl/pipe_r600.c|   27 --
 src/gallium/targets/egl/pipe_swrast.c  |   22 --
 src/gallium/targets/egl/pipe_vmwgfx.c  |   27 --
 src/gallium/targets/egl/st_GL.c|8 -
 src/gallium/targets/egl/st_OpenVG.c|8 -
 12 files changed, 0 insertions(+), 949 deletions(-)

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
deleted file mode 100644
index 0cbcc8f..000
--- a/src/gallium/targets/egl/Makefile
+++ /dev/null
@@ -1,242 +0,0 @@
-# src/gallium/targets/egl/Makefile
-#
-# This is the Makefile for EGL Gallium driver package.  The package consists of
-#
-#   egl_gallium.so - EGL driver
-#   pipe_HW.so   - pipe drivers
-#   st_API.so- client API state trackers
-#
-# The following variables are examined
-#
-#   EGL_PLATFORMS   - platforms to support
-#   GALLIUM_WINSYS_DIRS - pipe drivers to support
-#   EGL_CLIENT_APIS - state trackers to support
-#
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-ST_PREFIX := st_
-PIPE_PREFIX := pipe_
-
-common_CPPFLAGS := \
-   -I$(TOP)/include \
-   -I$(TOP)/src/gallium/auxiliary \
-   -I$(TOP)/src/gallium/drivers \
-   -I$(TOP)/src/gallium/include \
-   -I$(TOP)/src/gallium/winsys \
-   $(LIBDRM_CFLAGS)
-
-common_SYS :=
-common_LIBS := \
-   $(TOP)/src/gallium/drivers/identity/libidentity.a \
-   $(TOP)/src/gallium/drivers/trace/libtrace.a \
-   $(TOP)/src/gallium/drivers/rbug/librbug.a \
-   $(GALLIUM_AUXILIARIES)
-
-# EGL driver
-egl_CPPFLAGS := \
-   -I$(TOP)/src/gallium/state_trackers/egl \
-   -I$(TOP)/src/egl/main \
-   -DPIPE_PREFIX=\$(PIPE_PREFIX)\ -DST_PREFIX=\$(ST_PREFIX)\
-egl_SYS := -lm $(DLOPEN_LIBS) -lEGL
-egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
-
-ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
-egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
-egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
-endif
-ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
-egl_SYS += $(WAYLAND_LIBS) $(LIBDRM_LIB)
-egl_LIBS += $(TOP)/src/gallium/winsys/sw/wayland/libws_wayland.a
-egl_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
-endif
-ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
-egl_SYS += $(LIBUDEV_LIBS) $(LIBDRM_LIB) -lgbm
-endif
-ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
-egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
-endif
-
-# EGL_RENDERABLE_TYPE is a compile time attribute
-ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
-egl_CPPFLAGS += $(API_DEFINES)
-endif
-ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
-egl_CPPFLAGS += -DFEATURE_VG=1
-endif
-egl_CPPFLAGS := $(sort $(egl_CPPFLAGS))
-
-# i915 pipe driver
-i915_CPPFLAGS :=
-i915_SYS := -ldrm_intel
-i915_LIBS := \
-   $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
-   $(TOP)/src/gallium/drivers/i915/libi915.a
-
-# i965 pipe driver
-i965_CPPFLAGS :=
-i965_SYS := -ldrm_intel
-i965_LIBS := \
-   $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
-   $(TOP)/src/gallium/drivers/i965/libi965.a \
-   $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
-
-# nouveau pipe driver
-nouveau_CPPFLAGS :=
-nouveau_SYS := -ldrm_nouveau
-nouveau_LIBS := \
-   $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
-   $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
-   $(TOP)/src/gallium/drivers/nv50/libnv50.a \
-   $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
-   $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
-
-# r300 pipe driver
-r300_CPPFLAGS :=
-r300_SYS := -ldrm
-r300_LIBS := \
-   $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
-   $(TOP)/src/gallium/drivers/r300/libr300.a
-
-# r600 pipe driver
-r600_CPPFLAGS :=
-r600_SYS := -ldrm -ldrm_radeon
-r600_LIBS := \
-   $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
-   $(TOP)/src/gallium/drivers/r600/libr600.a
-
-# vmwgfx pipe driver
-vmwgfx_CPPFLAGS :=
-vmwgfx_SYS :=
-vmwgfx_LIBS := \
-   $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
-   $(TOP)/src/gallium/drivers/svga/libsvga.a
-
-# swrast (pseudo) pipe driver
-swrast_CPPFLAGS := -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
-swrast_SYS := -lm
-swrast_LIBS := $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
-
-# LLVM
-ifeq ($(MESA_LLVM),1)
-common_SYS += $(LLVM_LIBS)
-swrast_CPPFLAGS

Mesa (master): st/mesa: use a helper for st_framebuffer creation

2011-06-22 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 7587c140cd0c28f6c500846a7311b435443f46fd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7587c140cd0c28f6c500846a7311b435443f46fd

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jun 22 11:02:27 2011 +0900

st/mesa: use a helper for st_framebuffer creation

In st_api_make_current, we would like to reuse the exising
st_framebuffer if possible.  Use a helper function to make the code
clearer.

---

 src/mesa/state_tracker/st_manager.c |   47 +-
 1 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 46be553..c95514c 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -716,38 +716,49 @@ st_api_get_current(struct st_api *stapi)
return (st) ? st-iface : NULL;
 }
 
+static struct st_framebuffer *
+st_framebuffer_reuse_or_create(struct gl_framebuffer *fb,
+   struct st_framebuffer_iface *stfbi)
+{
+   struct st_framebuffer *cur = st_ws_framebuffer(fb), *stfb = NULL;
+
+   if (cur  cur-iface == stfbi) {
+  /* reuse the current stfb */
+  st_framebuffer_reference(stfb, cur);
+   }
+   else {
+  /* create a new one */
+  stfb = st_framebuffer_create(stfbi);
+   }
+
+   return stfb;
+}
+
 static boolean
 st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
 struct st_framebuffer_iface *stdrawi,
 struct st_framebuffer_iface *streadi)
 {
struct st_context *st = (struct st_context *) stctxi;
-   struct st_framebuffer *stdraw, *stread, *stfb;
+   struct st_framebuffer *stdraw, *stread;
boolean ret;
 
_glapi_check_multithread();
 
if (st) {
-  /* reuse/create the draw fb */
-  stfb = st_ws_framebuffer(st-ctx-WinSysDrawBuffer);
-  if (stfb  stfb-iface == stdrawi) {
- stdraw = NULL;
- st_framebuffer_reference(stdraw, stfb);
+  /* reuse or create the draw fb */
+  stdraw = st_framebuffer_reuse_or_create(st-ctx-WinSysDrawBuffer,
+  stdrawi);
+  if (streadi != stdrawi) {
+ /* do the same for the read fb */
+ stread = st_framebuffer_reuse_or_create(st-ctx-WinSysReadBuffer,
+ streadi);
   }
   else {
- stdraw = st_framebuffer_create(stdrawi);
-  }
-
-  /* reuse/create the read fb */
-  stfb = st_ws_framebuffer(st-ctx-WinSysReadBuffer);
-  if (!stfb || stfb-iface != streadi)
- stfb = stdraw;
-  if (stfb  stfb-iface == streadi) {
  stread = NULL;
- st_framebuffer_reference(stread, stfb);
-  }
-  else {
- stread = st_framebuffer_create(streadi);
+ /* reuse the draw fb for the read fb */
+ if (stdraw)
+st_framebuffer_reference(stread, stdraw);
   }
 
   if (stdraw  stread) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): configure.ac: remove deprecated EGL options

2011-06-19 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 66c71d150aed5fbecd49cb028332fdcc2c1feb70
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=66c71d150aed5fbecd49cb028332fdcc2c1feb70

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 20 08:05:04 2011 +0900

configure.ac: remove deprecated EGL options

---

 configure.ac |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 70da9ee..c9dd8a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -523,11 +523,6 @@ AC_ARG_ENABLE([gles2],
 [enable support for OpenGL ES 2.x API @:@default=no@:@])],
 [enable_gles2=$enableval],
 [enable_gles2=no])
-AC_ARG_ENABLE([gles-overlay],
-[AS_HELP_STRING([--enable-gles-overlay],
-[DEPRECATED.  Same as --enable-gles1 and --enable-gles2])],
-[enable_gles1=$enableval; enable_gles2=$enableval],
-[])
 AC_ARG_ENABLE([openvg],
 [AS_HELP_STRING([--enable-openvg],
 [enable support for OpenVG API @:@default=no@:@])],
@@ -1560,10 +1555,6 @@ AC_ARG_WITH([egl-platforms],
 x11,drm @:@default=auto@:@])],
 [with_egl_platforms=$withval],
 [with_egl_platforms=yes])
-AC_ARG_WITH([egl-displays],
-[AS_HELP_STRING([--with-egl-displays@:@=DIRS...@:@],
-[DEPRECATED.  Use --with-egl-platforms instead])],
-[with_egl_platforms=$withval])
 
 EGL_PLATFORMS=
 WAYLAND_EGL_LIB_DEPS=

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): docs: update EGL for changed configure options

2011-06-19 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 8eea050f5aed6ad8aeb64105c0e2581f0fd0b10a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8eea050f5aed6ad8aeb64105c0e2581f0fd0b10a

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 20 11:14:56 2011 +0900

docs: update EGL for changed configure options

---

 docs/egl.html  |   45 +
 docs/opengles.html |   19 +--
 docs/openvg.html   |   10 +-
 3 files changed, 27 insertions(+), 47 deletions(-)

diff --git a/docs/egl.html b/docs/egl.html
index fb15086..5b75007 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -29,12 +29,14 @@ directly dispatched to the drivers./p
 the driver for your hardware.  For example/p
 
 pre
-  $ ./configure --enable-gles2 --enable-openvg --enable-gallium-nouveau
+  $ ./configure --enable-gles1 --enable-gles2 \
+--with-dri-drivers=... \
+--with-gallium-drivers=...
 /pre
 
-pThe main library and OpenGL is enabled by default.  The first option above
-enables a href=opengles.htmlOpenGL ES 2.x/a.  The second option enables
-a href=openvg.htmlOpenVG/a./p
+pThe main library and OpenGL is enabled by default.  The first two options
+above enables a href=opengles.htmlOpenGL ES 1.x and 2.x/a.  The last two
+options enables the listed classic and and Gallium drivers respectively./p
 
 /li
 
@@ -42,8 +44,8 @@ enables a href=opengles.htmlOpenGL ES 2.x/a.  The 
second option enables
 /ol
 
 pIn the given example, it will build and install codelibEGL/code,
-codelibGL/code, codelibGLESv1_CM/code, codelibGLESv2/code,
-codelibOpenVG/code, and one or more EGL drivers./p
+codelibGL/code, codelibGLESv1_CM/code, codelibGLESv2/code, and one
+or more EGL drivers./p
 
 h3Configure Options/h3
 
@@ -65,6 +67,12 @@ drivers will be installed to code${libdir}/egl/code./p
 
 /li
 
+licode--enable-gallium-egl/code
+
+pEnable the optional codeegl_gallium/code driver./p
+
+/li
+
 licode--with-egl-platforms/code
 
 pList the platforms (window systems) to support.  Its argument is a comma
@@ -88,15 +96,17 @@ internal library that supports multiple APIs./p
 
 /li
 
-licode--enable-openvg/code
+licode--enable-shared-glapi/code
 
-pOpenVG must be explicitly enabled by this option./p
+pBy default, codelibGL/code has its own copy of codelibglapi/code.
+This options makes codelibGL/code use the shared codelibglapi/code.  
This
+is required if applications mix OpenGL and OpenGL ES./p
 
 /li
 
-licode--enable-gallium-egl/code
+licode--enable-openvg/code
 
-pExplicitly enable or disable codeegl_gallium/code./p
+pOpenVG must be explicitly enabled by this option./p
 
 /li
 
@@ -220,8 +230,7 @@ distribution./p
 pGenerally, codeegl_dri2/code is preferred over codeegl_gallium/code
 when the system already has DRI drivers.  As codeegl_gallium/code is loaded
 before codeegl_dri2/code when both are available, codeegl_gallium/code
-may either be disabled with code--disable-gallium-egl/code or packaged
-separately./p
+is disabled by default./p
 
 h2Developers/h2
 
@@ -307,17 +316,5 @@ not be called with the sample display at the same time.  
If a driver has access
 to an codeEGLDisplay/code without going through the EGL APIs, the driver
 should as well lock the display before using it.
 
-h3TODOs/h3
-
-ul
-liPass the conformance tests/li
-liMixed use of OpenGL, OpenGL ES 1.1, and OpenGL ES 2.0 is supported.  But
-which one of codelibGL.so/code, codelibGLESv1_CM.so/code, and
-codelibGLESv2.so/code should an application link to?  Bad things may happen
-when, say, an application is linked to codelibGLESv2.so/code and
-codelibcairo/code, which is linked to codelibGL.so/code instead./li
-
-/ul
-
 /body
 /html
diff --git a/docs/opengles.html b/docs/opengles.html
index 742182e..0fee488 100644
--- a/docs/opengles.html
+++ b/docs/opengles.html
@@ -34,27 +34,10 @@ EGL drivers for your hardware./p
 
 h2Run the Demos/h2
 
-pThere are some demos in codeprogs/egl//code.  You can use them to test
-your build.  For example,/p
-
-pre
-  $ cd progs/egl/eglut
-  $ make
-  $ cd ../opengles1
-  $ make
-  $ ./torus_x11
-/pre
+pThere are some demos in codemesa/demos/code repository./p
 
 h2Developers/h2
 
-h3Internal Libraries/h3
-
-table border=1 style=text-align: center;
-   trtdLibrary Name/tdtdUsed 
By/tdtdEnabled/tdtdOpenGL/tdtdOpenGL ES 1.x/tdtdOpenGL ES 
2.x/td/tr
-   trtdcodelibmesa.a/tdtdClassic DRI 
drivers/tdtdy/tdtdy/tdtd--enable-gles1/tdtd--enable-gles2/td/tr
-   trtdcodelibmesagallium.a/tdtdGallium EGL and DRI 
drivers/tdtdy/tdtdy/tdtd--enable-gles1/tdtd--enable-gles2/td/tr
-/table
-
 h3Dispatch Table/h3
 
 pOpenGL ES has an additional indirection when dispatching fucntions/p
diff --git a/docs/openvg.html b/docs/openvg.html
index eff8c58..81e50b6 100644
--- a/docs/openvg.html
+++ b/docs/openvg.html
@@ -11,7 +11,7 @@
 H1OpenVG State Tracker/H1
 
 p
-The current version of the OpenVG state tracker implements OpenVG 1.0.
+The current version of the OpenVG state tracker implements OpenVG 1.1

Mesa (master): egl_dri2: add dri2_load_driver_swrast

2011-06-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: cf69eeacc6931e833e7894a379af4fae085881e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf69eeacc6931e833e7894a379af4fae085881e9

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jun  8 16:33:55 2011 +0800

egl_dri2: add dri2_load_driver_swrast

Refactor dri2_load_driver and add dri2_load_driver_swrast for loading
swrast DRI driver.

---

 src/egl/drivers/dri2/egl_dri2.c |   56 +--
 src/egl/drivers/dri2/egl_dri2.h |3 ++
 src/egl/drivers/dri2/platform_x11.c |4 +--
 3 files changed, 44 insertions(+), 19 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 3d5827e..a38bff5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -334,8 +334,8 @@ dri2_bind_extensions(struct dri2_egl_display *dri2_dpy,
return ret;
 }
 
-EGLBoolean
-dri2_load_driver(_EGLDisplay *disp)
+static const __DRIextension **
+dri2_open_driver(_EGLDisplay *disp)
 {
struct dri2_egl_display *dri2_dpy = disp-DriverData;
const __DRIextension **extensions;
@@ -374,9 +374,9 @@ dri2_load_driver(_EGLDisplay *disp)
 
if (dri2_dpy-driver == NULL) {
   _eglLog(_EGL_WARNING,
- DRI2: failed to open any driver (search paths %s),
- search_paths);
-  return EGL_FALSE;
+ DRI2: failed to open %s (search paths %s),
+ dri2_dpy-driver_name, search_paths);
+  return NULL;
}
 
_eglLog(_EGL_DEBUG, DRI2: dlopen(%s), path);
@@ -385,20 +385,44 @@ dri2_load_driver(_EGLDisplay *disp)
   _eglLog(_EGL_WARNING,
  DRI2: driver exports no extensions (%s), dlerror());
   dlclose(dri2_dpy-driver);
+   }
+
+   return extensions;
+}
+
+EGLBoolean
+dri2_load_driver(_EGLDisplay *disp)
+{
+   struct dri2_egl_display *dri2_dpy = disp-DriverData;
+   const __DRIextension **extensions;
+
+   extensions = dri2_open_driver(disp);
+   if (!extensions)
+  return EGL_FALSE;
+
+   if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) {
+  dlclose(dri2_dpy-driver);
   return EGL_FALSE;
}
 
-   if (strcmp(dri2_dpy-driver_name, swrast) == 0) {
-  if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, 
extensions)) {
- dlclose(dri2_dpy-driver);
- return EGL_FALSE;
-  }
-   } else {
-  if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) 
{
- dlclose(dri2_dpy-driver);
- return EGL_FALSE;
-  }
-   } 
+   return EGL_TRUE;
+}
+
+EGLBoolean
+dri2_load_driver_swrast(_EGLDisplay *disp)
+{
+   struct dri2_egl_display *dri2_dpy = disp-DriverData;
+   const __DRIextension **extensions;
+
+   dri2_dpy-driver_name = swrast;
+   extensions = dri2_open_driver(disp);
+   if (!extensions)
+  return EGL_FALSE;
+
+   if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions)) {
+  dlclose(dri2_dpy-driver);
+  return EGL_FALSE;
+   }
 
return EGL_TRUE;
 }
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 97f541b..dd9eb94 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -183,6 +183,9 @@ EGLBoolean
 dri2_load_driver(_EGLDisplay *disp);
 
 EGLBoolean
+dri2_load_driver_swrast(_EGLDisplay *disp);
+
+EGLBoolean
 dri2_create_screen(_EGLDisplay *disp);
 
 struct dri2_egl_config *
diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 2e26ff0..8bff294 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -906,9 +906,7 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay 
*disp)
   goto cleanup_dpy;
}
 
-   dri2_dpy-driver_name = dri2_strndup(swrast, strlen(swrast));
-
-   if (!dri2_load_driver(disp))
+   if (!dri2_load_driver_swrast(disp))
   goto cleanup_conn;
 
dri2_dpy-swrast_loader_extension.base.name = __DRI_SWRAST_LOADER;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl_dri2: try swrastg_dri if swrast_dri fails

2011-06-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 77e031a1c423affde99934f0fd059d49852e2729
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77e031a1c423affde99934f0fd059d49852e2729

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jun  8 16:33:56 2011 +0800

egl_dri2: try swrastg_dri if swrast_dri fails

Per libGL.

---

 src/egl/drivers/dri2/egl_dri2.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a38bff5..d430145 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -416,6 +416,12 @@ dri2_load_driver_swrast(_EGLDisplay *disp)
 
dri2_dpy-driver_name = swrast;
extensions = dri2_open_driver(disp);
+   if (!extensions) {
+  /* try again with swrastg */
+  dri2_dpy-driver_name = swrastg;
+  extensions = dri2_open_driver(disp);
+   }
+
if (!extensions)
   return EGL_FALSE;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): wayland-drm: remove depend on make clean

2011-06-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 982cb365848ebb7e64dc0915e37793e5823e4bbf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=982cb365848ebb7e64dc0915e37793e5823e4bbf

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 13 11:35:21 2011 +0800

wayland-drm: remove depend on make clean

---

 src/egl/wayland/wayland-drm/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/Makefile 
b/src/egl/wayland/wayland-drm/Makefile
index 789b020..bc010b6 100644
--- a/src/egl/wayland/wayland-drm/Makefile
+++ b/src/egl/wayland/wayland-drm/Makefile
@@ -34,6 +34,7 @@ depend:
 clean:
rm -rf libwayland-drm.a $(wayland_drm_OBJECTS) \
$(GEN_SOURCES) $(GEN_HEADERS)
+   rm -f depend depend.bak
 
 install:
@echo -n 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: Fix tls with shared/es-glapi on x86-64

2011-06-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 3e1caf5d2666ed220f4a740db4fe5a7ad54e455a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e1caf5d2666ed220f4a740db4fe5a7ad54e455a

Author: Benjamin Franzke benjaminfran...@googlemail.com
Date:   Wed Jun  8 15:50:25 2011 +0200

mapi: Fix tls with shared/es-glapi on x86-64

x86_64_entry_start needs to be declared static in the C code,
in order to have the correct address in entry_get_public
(seems not to be needed on x86).

The compiler needs to lookup a local not a global object.

Otherwise addresses needed for _glapi_proc_address will be computed
from some random offset (0x6400229a61058b48 in my case).

---

 src/mapi/mapi/entry_x86-64_tls.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h
index d3b606c..72d4125 100644
--- a/src/mapi/mapi/entry_x86-64_tls.h
+++ b/src/mapi/mapi/entry_x86-64_tls.h
@@ -76,10 +76,12 @@ entry_patch_public(void)
 {
 }
 
+static char
+x86_64_entry_start[];
+
 mapi_func
 entry_get_public(int slot)
 {
-   extern char x86_64_entry_start[];
return (mapi_func) (x86_64_entry_start + slot * 32);
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: declare x86_entry_start/end static

2011-06-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 77b7e1b58fcc4823b6b1f4fa4296c810db218f8a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77b7e1b58fcc4823b6b1f4fa4296c810db218f8a

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jun 13 11:41:41 2011 +0800

mapi: declare x86_entry_start/end static

x86_entry_start and x86_entry_end are defined by the inline assembly.
Declaring them static saves one instruction in entry_get_public.

---

 src/mapi/mapi/entry_x86_tls.h |6 +++---
 src/mapi/mapi/entry_x86_tsd.h |5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h
index 5169069..de91812 100644
--- a/src/mapi/mapi/entry_x86_tls.h
+++ b/src/mapi/mapi/entry_x86_tls.h
@@ -86,12 +86,13 @@ __asm__(.text);
 extern unsigned long
 x86_current_tls();
 
+static char x86_entry_start[];
+static char x86_entry_end[];
+
 void
 entry_patch_public(void)
 {
 #ifndef GLX_X86_READONLY_TEXT
-   extern char x86_entry_start[];
-   extern char x86_entry_end[];
char patch[8] = {
   0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */
   0x90, 0x90  /* nop's */
@@ -108,7 +109,6 @@ entry_patch_public(void)
 mapi_func
 entry_get_public(int slot)
 {
-   extern char x86_entry_start[];
return (mapi_func) (x86_entry_start + slot * 16);
 }
 
diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h
index 1491478..c479c19 100644
--- a/src/mapi/mapi/entry_x86_tsd.h
+++ b/src/mapi/mapi/entry_x86_tsd.h
@@ -60,6 +60,9 @@ __asm__(.balign 32\n
 #include string.h
 #include u_execmem.h
 
+static const char x86_entry_start[];
+static const char x86_entry_end[];
+
 void
 entry_patch_public(void)
 {
@@ -68,7 +71,6 @@ entry_patch_public(void)
 mapi_func
 entry_get_public(int slot)
 {
-   extern const char x86_entry_start[];
return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE);
 }
 
@@ -84,7 +86,6 @@ entry_patch(mapi_func entry, int slot)
 mapi_func
 entry_generate(int slot)
 {
-   extern const char x86_entry_end[];
const char *code_templ = x86_entry_end - X86_ENTRY_SIZE;
void *code;
mapi_func entry;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: fix GLES remap table setup again

2011-06-08 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: fed482f5e30ea6b230ed20982551b340570dc3e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fed482f5e30ea6b230ed20982551b340570dc3e9

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jun  8 22:04:16 2011 +0800

mesa: fix GLES remap table setup again

Generate different glapidispatch.h's for GL and GLES.  For GLES, we want
a local remap table.

This reverts commit 5af46e836073d2112b147b524e441bdb808cc128.  The
commit will break GL remap table setup when main/glapidispatch.h is
regenerated.

---

 src/mapi/glapi/gen/gl_table.py |   22 +-
 src/mesa/main/es_generator.py  |5 +++--
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index c3cc616..bd3f3eb 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -149,14 +149,18 @@ class PrintRemapTable(gl_XML.gl_print_base):
print '#else /* !_GLAPI_USE_REMAP_TABLE */'
print ''
 
-   print '#define driDispatchRemapTable_size %u' % (count)
-   print 'extern int driDispatchRemapTable[ 
driDispatchRemapTable_size ];'
-   print ''
-   print '#if FEATURE_remap_table'
-   print '#define driDispatchRemapTable remap_table'
-   print 'static int remap_table[driDispatchRemapTable_size];'
-   print '#endif'
-   print ''
+   if self.es:
+   remap_table = esLocalRemapTable
+
+   print '#define %s_size %u' % (remap_table, count)
+   print 'static int %s[ %s_size ];' % (remap_table, 
remap_table)
+   print ''
+   else:
+   remap_table = driDispatchRemapTable
+
+   print '#define %s_size %u' % (remap_table, count)
+   print 'extern int %s[ %s_size ];' % (remap_table, 
remap_table)
+   print ''
 
for f, index in functions:
print '#define %s_remap_index %u' % (f.name, index)
@@ -164,7 +168,7 @@ class PrintRemapTable(gl_XML.gl_print_base):
print ''
 
for f, index in functions:
-   print '#define _gloffset_%s 
driDispatchRemapTable[%s_remap_index]' % (f.name, f.name)
+   print '#define _gloffset_%s %s[%s_remap_index]' % 
(f.name, remap_table, f.name)
 
print ''
print '#endif /* _GLAPI_USE_REMAP_TABLE */'
diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py
index 87d8bd3..5b49416 100644
--- a/src/mesa/main/es_generator.py
+++ b/src/mesa/main/es_generator.py
@@ -680,6 +680,7 @@ print 
 
 #if FEATURE_remap_table
 
+/* define esLocalRemapTable */
 /* cannot include main/dispatch.h here */
 #define _GLAPI_USE_REMAP_TABLE
 #include %sapi/main/glapidispatch.h
@@ -701,7 +702,7 @@ init_remap_table(void)
   return;
}
 
-   for (i = 0; i  driDispatchRemapTable_size; i++) {
+   for (i = 0; i  esLocalRemapTable_size; i++) {
   GLint offset;
   const char *spec;
 
@@ -710,7 +711,7 @@ init_remap_table(void)
   spec = _mesa_function_pool + remap[i].pool_index;
 
   offset = _mesa_map_function_spec(spec);
-  remap_table[i] = offset;
+  esLocalRemapTable[i] = offset;
}
initialized = GL_TRUE;
_glthread_UNLOCK_MUTEX(mutex);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: fix function remapping for dlist

2011-06-08 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 0dc45374f2c62e33680f3a5729a18ba9ee40cd4d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0dc45374f2c62e33680f3a5729a18ba9ee40cd4d

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jun  8 21:51:41 2011 +0800

mesa: fix function remapping for dlist

glapidispatch.h should not be included directly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36282

---

 src/mesa/main/dlist.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index c23593b..958f5a6 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -49,7 +49,6 @@
 #include eval.h
 #include framebuffer.h
 #include glapi/glapi.h
-#include glapidispatch.h
 #include hash.h
 #include image.h
 #include light.h

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: merge glapidispatch.h into dispatch.h

2011-06-08 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 4bb748b609288205ddea750550185d7642025bff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bb748b609288205ddea750550185d7642025bff

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jun  8 22:24:32 2011 +0800

mesa: merge glapidispatch.h into dispatch.h

glapidispatch.h was located in glapi and shared with mesa core.  Because
the way it was shared, mesa core must include it indirectly via
main/dispatch.h.

Now that it is no longer needed by glapi and is located in core mesa,
merging it with main/dispatch.h to avoid wrong uses.

---

 src/glx/apple/apple_glapi.c|4 +-
 src/mapi/glapi/gen-es/Makefile |4 +-
 src/mapi/glapi/gen/Makefile|4 +-
 src/mapi/glapi/gen/gl_table.py |   19 +-
 src/mesa/SConscript|4 +-
 src/mesa/main/dispatch.h   |12245 +++-
 src/mesa/main/es_generator.py  |7 +-
 src/mesa/main/glapidispatch.h  |12268 
 8 files changed, 12257 insertions(+), 12298 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=4bb748b609288205ddea750550185d7642025bff
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: set EGL_ALPHA_MASK_SIZE

2011-06-08 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 6b492d09767531915aa631bec470af1cf4653a6c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b492d09767531915aa631bec470af1cf4653a6c

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jun  9 00:23:16 2011 +0800

st/egl: set EGL_ALPHA_MASK_SIZE

---

 src/gallium/state_trackers/egl/common/egl_g3d.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 4bd8656..29dbbef 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -259,6 +259,10 @@ init_config_attributes(_EGLConfig *conf, const struct 
native_config *nconf,
conf-DepthSize = depth_stencil[0];
conf-StencilSize = depth_stencil[1];
 
+   /* st/vega will allocate the mask on demand */
+   if (api_mask  EGL_OPENVG_BIT)
+  conf-AlphaMaskSize = 8;
+
conf-SurfaceType = surface_type;
 
conf-NativeRenderable = EGL_TRUE;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Demos (master): Properly defining default precision in es2gears fragment shader.

2011-02-20 Thread Chia-I Wu
Module: Demos
Branch: master
Commit: 0b5dc98b31382d09ed4c1be6dee6657fa64208b4
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=0b5dc98b31382d09ed4c1be6dee6657fa64208b4

Author: Ricardo Salveti de Araujo ricardo.salv...@canonical.com
Date:   Thu Feb  3 18:35:24 2011 -0200

Properly defining default precision in es2gears fragment shader.

Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@canonical.com

---

 src/egl/opengles2/es2gears.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/egl/opengles2/es2gears.c b/src/egl/opengles2/es2gears.c
index 0018ea9..37fb6a4 100644
--- a/src/egl/opengles2/es2gears.c
+++ b/src/egl/opengles2/es2gears.c
@@ -607,9 +607,6 @@ gears_idle(void)
 }
 
 static const char vertex_shader[] =
-#ifdef GL_ES\n
-precision mediump float;\n
-#endif\n
 attribute vec3 position;\n
 attribute vec3 normal;\n
 \n
@@ -638,6 +635,7 @@ static const char vertex_shader[] =
 };
 
 static const char fragment_shader[] =
+precision mediump float;\n
 varying vec4 Color;\n
 \n
 void main(void)\n

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl_dri2: Return NULL when xcb_get_geometry_reply fails.

2011-02-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: bf0c56522e21bd45ad3385e3115ef7eb71a7b8bf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf0c56522e21bd45ad3385e3115ef7eb71a7b8bf

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Feb 20 12:23:54 2011 -0700

egl_dri2: Return NULL when xcb_get_geometry_reply fails.

This should fix bug #33946.

---

 src/egl/drivers/dri2/platform_x11.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 1c7c841..50310ee 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -782,6 +782,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext 
*ctx,
   _eglError(EGL_BAD_ALLOC, xcb_get_geometry);
   free(error);
   free(buffers_reply);
+  return NULL;
}
 
switch (geometry_reply-depth) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): Fix --enable-shared-glapi configure option

2011-02-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: aa6a5cf1d5625ecb5efff3a43233ed972ab29cad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa6a5cf1d5625ecb5efff3a43233ed972ab29cad

Author: Jon TURNEY jon.tur...@dronecode.org.uk
Date:   Wed Feb 16 13:37:57 2011 +

Fix --enable-shared-glapi configure option

Fix a typo which meant that --enable-shared-glapi didn't actually cause a 
shared glapi to be built

Signed-off-by: Jon TURNEY jon.tur...@dronecode.org.uk

---

 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 46d3516..e1702ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -614,7 +614,7 @@ GALLIUM_DRIVERS_DIRS=softpipe failover galahad trace rbug 
noop identity
 GALLIUM_STATE_TRACKERS_DIRS=
 
 # build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
-case x$enabled_shared_glapi$enable_gles1$enable_gles2 in
+case x$enable_shared_glapi$enable_gles1$enable_gles2 in
 x*yes*)
 CORE_DIRS=$CORE_DIRS mapi/shared-glapi
 ;;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/vega: s/vg[A-Z]/vega[A-Z]/.

2011-01-30 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 05e5b53128fc4dc25769fecace671cdaa7004630
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05e5b53128fc4dc25769fecace671cdaa7004630

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan 30 16:38:12 2011 +0800

st/vega: s/vg[A-Z]/vega[A-Z]/.

---

 src/gallium/state_trackers/vega/api_filters.c |8 ++--
 src/gallium/state_trackers/vega/api_images.c  |8 ++--
 src/gallium/state_trackers/vega/api_masks.c   |4 +-
 src/gallium/state_trackers/vega/api_params.c  |   64 
 4 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/gallium/state_trackers/vega/api_filters.c 
b/src/gallium/state_trackers/vega/api_filters.c
index 0beeeaf..6be460c 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -294,7 +294,7 @@ void vegaConvolve(VGImage dst, VGImage src,
struct vg_image *d, *s;
VGint kernel_size = kernelWidth * kernelHeight;
struct filter_info info;
-   const VGint max_kernel_size = vgGeti(VG_MAX_KERNEL_SIZE);
+   const VGint max_kernel_size = vegaGeti(VG_MAX_KERNEL_SIZE);
 
if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) {
   vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
@@ -396,7 +396,7 @@ void vegaSeparableConvolve(VGImage dst, VGImage src,
struct vg_context *ctx = vg_current_context();
VGshort *kernel;
VGint i, j, idx = 0;
-   const VGint max_kernel_size = vgGeti(VG_MAX_SEPARABLE_KERNEL_SIZE);
+   const VGint max_kernel_size = vegaGeti(VG_MAX_SEPARABLE_KERNEL_SIZE);
 
if (dst == VG_INVALID_HANDLE || src == VG_INVALID_HANDLE) {
   vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
@@ -426,8 +426,8 @@ void vegaSeparableConvolve(VGImage dst, VGImage src,
  ++idx;
   }
}
-   vgConvolve(dst, src, kernelWidth, kernelHeight, shiftX, shiftY,
-  kernel, scale, bias, tilingMode);
+   vegaConvolve(dst, src, kernelWidth, kernelHeight, shiftX, shiftY,
+kernel, scale, bias, tilingMode);
free(kernel);
 }
 
diff --git a/src/gallium/state_trackers/vega/api_images.c 
b/src/gallium/state_trackers/vega/api_images.c
index d8ad57a..b993ba6 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -106,12 +106,12 @@ VGImage vegaCreateImage(VGImageFormat format,
   vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
   return VG_INVALID_HANDLE;
}
-   if (width  vgGeti(VG_MAX_IMAGE_WIDTH) ||
-   height  vgGeti(VG_MAX_IMAGE_HEIGHT)) {
+   if (width  vegaGeti(VG_MAX_IMAGE_WIDTH) ||
+   height  vegaGeti(VG_MAX_IMAGE_HEIGHT)) {
   vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
   return VG_INVALID_HANDLE;
}
-   if (width * height  vgGeti(VG_MAX_IMAGE_PIXELS)) {
+   if (width * height  vegaGeti(VG_MAX_IMAGE_PIXELS)) {
   vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
   return VG_INVALID_HANDLE;
}
@@ -488,7 +488,7 @@ void vegaCopyPixels(VGint dx, VGint dy,
 
vg_validate_state(ctx);
/* make sure rendering has completed */
-   vgFinish();
+   vegaFinish();
 
vg_copy_surface(ctx, strb-surface, dx, dy,
strb-surface, sx, sy, width, height);
diff --git a/src/gallium/state_trackers/vega/api_masks.c 
b/src/gallium/state_trackers/vega/api_masks.c
index 6c52369..cdbf002 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -139,8 +139,8 @@ VGMaskLayer vegaCreateMaskLayer(VGint width, VGint height)
struct vg_context *ctx = vg_current_context();
 
if (width = 0 || height = 0 ||
-   width  vgGeti(VG_MAX_IMAGE_WIDTH) ||
-   height  vgGeti(VG_MAX_IMAGE_HEIGHT)) {
+   width  vegaGeti(VG_MAX_IMAGE_WIDTH) ||
+   height  vegaGeti(VG_MAX_IMAGE_HEIGHT)) {
   vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
   return VG_INVALID_HANDLE;
}
diff --git a/src/gallium/state_trackers/vega/api_params.c 
b/src/gallium/state_trackers/vega/api_params.c
index 04c2f8c..e5e5521 100644
--- a/src/gallium/state_trackers/vega/api_params.c
+++ b/src/gallium/state_trackers/vega/api_params.c
@@ -61,7 +61,7 @@ static INLINE VGboolean count_in_bounds(VGParamType type, 
VGint count)
else if (type == VG_STROKE_DASH_PATTERN) {
   return count = VEGA_MAX_DASH_COUNT;
} else {
-  VGint real_count = vgGetVectorSize(type);
+  VGint real_count = vegaGetVectorSize(type);
   return count == real_count;
}
 }
@@ -104,7 +104,7 @@ void vegaSetf (VGParamType type, VGfloat value)
case VG_MAX_IMAGE_BYTES:
case VG_MAX_GAUSSIAN_STD_DEVIATION:
case VG_MAX_FLOAT:
-  vgSeti(type, floor(value));
+  vegaSeti(type, floor(value));
   return;
   break;
case VG_STROKE_LINE_WIDTH:
@@ -290,7 +290,7 @@ void vegaSetfv(VGParamType type, VGint count,
case VG_FILTER_FORMAT_LINEAR:
case VG_FILTER_FORMAT_PREMULTIPLIED:
case VG_FILTER_CHANNEL_MASK:
-  vgSeti(type, floor(values[0]));
+  vegaSeti(type, floor(values[0

Mesa (master): st/vega: Remove an invalid sanity check.

2011-01-30 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: e919dee1edd469c174c5c07c95efd4932a674b67
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e919dee1edd469c174c5c07c95efd4932a674b67

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan 30 23:09:42 2011 +0800

st/vega: Remove an invalid sanity check.

Before create_handle returns, obj-handle is 0.  Calling
handle_to_object will fail.

---

 src/gallium/state_trackers/vega/handle.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/vega/handle.c 
b/src/gallium/state_trackers/vega/handle.c
index 5ec4d71..11eedd9 100644
--- a/src/gallium/state_trackers/vega/handle.c
+++ b/src/gallium/state_trackers/vega/handle.c
@@ -81,12 +81,6 @@ create_handle(void *object)
 {
VGHandle h = next_handle++;
util_hash_table_set(handle_hash, intptr_to_pointer(h), object);
-#if DEBUG
-   {
-  void *v = handle_to_object(h);
-  assert(v == object);
-   }
-#endif
return h;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/vega: Disable blending when the paint is opaque.

2011-01-30 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 3f0a966807f03a364edea0272ddf45f08ab7ce4f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f0a966807f03a364edea0272ddf45f08ab7ce4f

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan 30 22:54:40 2011 +0800

st/vega: Disable blending when the paint is opaque.

When the paint is opaque (currently, solid color with alpha 1.0f), no
blending is needed for VG_BLEND_SRC_OVER.  This eliminates the serious
performance hit introduced by 859106f196ade77f59f8787b071739901cd1a843
for a common scenario.

---

 src/gallium/state_trackers/vega/api_paint.c  |   10 +-
 src/gallium/state_trackers/vega/api_params.c |6 ++
 src/gallium/state_trackers/vega/paint.c  |7 +++
 src/gallium/state_trackers/vega/paint.h  |1 +
 src/gallium/state_trackers/vega/renderer.c   |7 ++-
 src/gallium/state_trackers/vega/shader.c |2 ++
 src/gallium/state_trackers/vega/vg_context.c |5 +++--
 src/gallium/state_trackers/vega/vg_context.h |4 +++-
 8 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/vega/api_paint.c 
b/src/gallium/state_trackers/vega/api_paint.c
index 6a8ae9c..2610ebe 100644
--- a/src/gallium/state_trackers/vega/api_paint.c
+++ b/src/gallium/state_trackers/vega/api_paint.c
@@ -72,6 +72,8 @@ void vegaSetPaint(VGPaint paint, VGbitfield paintModes)
if (paintModes  VG_STROKE_PATH) {
   ctx-state.vg.stroke_paint = handle_to_paint(paint);
}
+
+   ctx-state.dirty |= PAINT_DIRTY;
 }
 
 VGPaint vegaGetPaint(VGPaintMode paintMode)
@@ -98,6 +100,7 @@ VGPaint vegaGetPaint(VGPaintMode paintMode)
 void vegaSetColor(VGPaint paint, VGuint rgba)
 {
struct vg_context *ctx = vg_current_context();
+   struct vg_paint *p;
 
if (paint == VG_INVALID_HANDLE) {
   vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
@@ -109,7 +112,12 @@ void vegaSetColor(VGPaint paint, VGuint rgba)
   return;
}
 
-   paint_set_colori(handle_to_paint(paint), rgba);
+   p = handle_to_paint(paint);
+   paint_set_colori(p, rgba);
+
+   if (ctx-state.vg.fill_paint == p ||
+   ctx-state.vg.stroke_paint == p)
+  ctx-state.dirty |= PAINT_DIRTY;
 }
 
 VGuint vegaGetColor(VGPaint paint)
diff --git a/src/gallium/state_trackers/vega/api_params.c 
b/src/gallium/state_trackers/vega/api_params.c
index e5e5521..aa1e5dd 100644
--- a/src/gallium/state_trackers/vega/api_params.c
+++ b/src/gallium/state_trackers/vega/api_params.c
@@ -1135,6 +1135,9 @@ void vegaSetParameterfv(VGHandle object,
   else {
  struct vg_paint *paint = handle_to_paint(object);
  paint_set_color(paint, values);
+ if (ctx-state.vg.fill_paint == paint ||
+ ctx-state.vg.stroke_paint == paint)
+ctx-state.dirty |= PAINT_DIRTY;
   }
}
   break;
@@ -1248,6 +1251,9 @@ void vegaSetParameteriv(VGHandle object,
   else {
  struct vg_paint *paint = handle_to_paint(object);
  paint_set_coloriv(paint, values);
+ if (ctx-state.vg.fill_paint == paint ||
+ ctx-state.vg.stroke_paint == paint)
+ctx-state.dirty |= PAINT_DIRTY;
   }
}
   break;
diff --git a/src/gallium/state_trackers/vega/paint.c 
b/src/gallium/state_trackers/vega/paint.c
index 2db8cbc..6e5348a 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -748,3 +748,10 @@ void paint_fill_constant_buffer(struct vg_paint *paint,
   abort();
}
 }
+
+VGboolean paint_is_opaque(struct vg_paint *paint)
+{
+   /* TODO add other paint types and make sure PAINT_DIRTY gets set */
+   return (paint-type == VG_PAINT_TYPE_COLOR 
+   floatsEqual(paint-solid.color[3], 1.0f));
+}
diff --git a/src/gallium/state_trackers/vega/paint.h 
b/src/gallium/state_trackers/vega/paint.h
index 3de3bbe..e535776 100644
--- a/src/gallium/state_trackers/vega/paint.h
+++ b/src/gallium/state_trackers/vega/paint.h
@@ -118,5 +118,6 @@ void paint_fill_constant_buffer(struct vg_paint *paint,
 const struct matrix *mat,
 void *buffer);
 
+VGboolean paint_is_opaque(struct vg_paint *paint);
 
 #endif
diff --git a/src/gallium/state_trackers/vega/renderer.c 
b/src/gallium/state_trackers/vega/renderer.c
index e42bad7..936bf2e 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -28,6 +28,7 @@
 #include renderer.h
 
 #include vg_context.h
+#include paint.h /* for paint_is_opaque */
 
 #include pipe/p_context.h
 #include pipe/p_state.h
@@ -1289,7 +1290,11 @@ static void renderer_validate_blend(struct renderer 
*renderer,
   blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
   break;
case VG_BLEND_SRC_OVER:
-  if (!util_format_has_alpha(fb_format)) {
+  if (paint_is_opaque(state-fill_paint) 
+  paint_is_opaque(state-stroke_paint)) {
+ /* no blending */
+  }
+  else if (!util_format_has_alpha(fb_format

Mesa (master): mapi: Workaround a bug in makedepend.

2011-01-29 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: b825e4955243b8ecb57e58afafd8b2286fdd4369
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b825e4955243b8ecb57e58afafd8b2286fdd4369

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jan 29 19:06:27 2011 +0800

mapi: Workaround a bug in makedepend.

makedepend would crash when a source includes a header indirectly, such
as

  #define HEADER some-header.h
  #include HEADER

Do not define HEADER (makedepend would detects this as an incomplete
include) and add the dependency manually in the Makefile.

This should hopefully fix bug #33374.

---

 src/mapi/es1api/Makefile   |7 ++-
 src/mapi/glapi/Makefile|   18 ++
 src/mapi/shared-glapi/Makefile |7 ++-
 src/mapi/vgapi/Makefile|5 -
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
index 4fa68e5..aef6948 100644
--- a/src/mapi/es1api/Makefile
+++ b/src/mapi/es1api/Makefile
@@ -124,10 +124,15 @@ install: default install-headers install-pc
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(esapi_LIB_GLOB) \
$(DESTDIR)$(INSTALL_LIB_DIR)
 
+# workaround a bug in makedepend
+makedepend_CPPFLAGS := \
+   $(filter-out -DMAPI_ABI_HEADER=%, $(esapi_CPPFLAGS))
+$(esapi_OBJECTS): glapi_mapi_tmp.h
+
 depend: $(esapi_SOURCES)
@echo running $(MKDEP)
@touch depend
-   @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(esapi_CPPFLAGS) \
+   @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(makedepend_CPPFLAGS) \
$(esapi_SOURCES) 2/dev/null | \
sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,'  depend
 
diff --git a/src/mapi/glapi/Makefile b/src/mapi/glapi/Makefile
index 203a8ab..bb4ed65 100644
--- a/src/mapi/glapi/Makefile
+++ b/src/mapi/glapi/Makefile
@@ -13,11 +13,12 @@ include $(MAPI)/sources.mak
 glapi_CPPFLAGS := \
-I$(TOP)/include \
-I$(TOP)/src/mapi \
-   -I$(TOP)/src/mesa \
-   -DMAPI_ABI_HEADER=\glapi/glapi_mapi_tmp.h\
+   -I$(TOP)/src/mesa
 
 ifeq ($(SHARED_GLAPI),1)
-glapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
+glapi_CPPFLAGS += \
+   -DMAPI_MODE_BRIDGE \
+   -DMAPI_ABI_HEADER=\glapi/glapi_mapi_tmp.h\
 glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
 
 glapi_GLAPI_OBJECTS :=
@@ -58,10 +59,19 @@ clean:
-rm -f lib$(TARGET).a
-rm -f depend depend.bak
 
+ifeq ($(SHARED_GLAPI),1)
+# workaround a bug in makedepend
+makedepend_CPPFLAGS := \
+   $(filter-out -DMAPI_ABI_HEADER=%, $(glapi_CPPFLAGS))
+$(glapi_OBJECTS): glapi_mapi_tmp.h
+else
+makedepend_CPPFLAGS := $(glapi_CPPFLAGS)
+endif
+
 depend: $(glapi_SOURCES)
@ echo running $(MKDEP)
@ touch depend
-   @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \
+   @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(makedepend_CPPFLAGS) \
$(glapi_SOURCES) 2/dev/null | sed -e 's,^$(MAPI)/,,'  depend
 
 -include depend
diff --git a/src/mapi/shared-glapi/Makefile b/src/mapi/shared-glapi/Makefile
index ee937bd..c928f82 100644
--- a/src/mapi/shared-glapi/Makefile
+++ b/src/mapi/shared-glapi/Makefile
@@ -51,10 +51,15 @@ install:
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_GLOB) \
$(DESTDIR)$(INSTALL_LIB_DIR)
 
+# workaround a bug in makedepend
+makedepend_CPPFLAGS := \
+   $(filter-out -DMAPI_ABI_HEADER=%, $(glapi_CPPFLAGS))
+$(glapi_OBJECTS): glapi_mapi_tmp.h
+
 depend: $(glapi_SOURCES)
@echo running $(MKDEP)
@touch depend
-   @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \
+   @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(makedepend_CPPFLAGS) \
$(glapi_SOURCES) 2/dev/null | sed -e 's,^$(MAPI)/,,' \
 depend
 
diff --git a/src/mapi/vgapi/Makefile b/src/mapi/vgapi/Makefile
index e239e20..68cf26e 100644
--- a/src/mapi/vgapi/Makefile
+++ b/src/mapi/vgapi/Makefile
@@ -81,11 +81,14 @@ install: default install-headers install-pc
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(VG_LIB_GLOB) \
$(DESTDIR)$(INSTALL_LIB_DIR)
 
+# due to a bug in makedepend, cannot pass VGAPI_CPPFLAGS to it
+$(VGAPI_OBJECTS): vgapi_tmp.h
+
 depend: $(VGAPI_SOURCES)
@echo running $(MKDEP)
@touch depend
@$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \
-   $(VGAPI_CPPFLAGS) $(VGAPI_SOURCES) 2/dev/null | \
+   $(VGAPI_SOURCES) 2/dev/null | \
sed -e 's,^$(MAPI)/,,'  depend
 
 -include depend

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Demos (master): egl/opengl: fixed linking of eglgears_* with libm

2011-01-29 Thread Chia-I Wu
Module: Demos
Branch: master
Commit: d8f7d6bac9415581c02b18ebb462d3d9951fe5b4
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=d8f7d6bac9415581c02b18ebb462d3d9951fe5b4

Author: Jure Repinc j...@holodeck1.com
Date:   Wed Jan 26 02:31:52 2011 +0100

egl/opengl: fixed linking of eglgears_* with libm

---

 src/egl/opengl/CMakeLists.txt |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/opengl/CMakeLists.txt b/src/egl/opengl/CMakeLists.txt
index ede9ec3..3a012e1 100644
--- a/src/egl/opengl/CMakeLists.txt
+++ b/src/egl/opengl/CMakeLists.txt
@@ -6,10 +6,10 @@ add_executable(eglinfo eglinfo.c)
 target_link_libraries(eglinfo ${EGL_egl_LIBRARY})
 
 add_executable(eglgears_screen eglgears.c)
-target_link_libraries(eglgears_screen ${EGL_egl_LIBRARY} eglut_screen)
+target_link_libraries(eglgears_screen ${EGL_egl_LIBRARY} eglut_screen m)
 
 if(X11_FOUND)
   add_executable(eglgears_x11 eglgears.c)
-  target_link_libraries(eglgears_x11 ${EGL_egl_LIBRARY} eglut_x11)
+  target_link_libraries(eglgears_x11 ${EGL_egl_LIBRARY} eglut_x11 m)
 endif(X11_FOUND)
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: Make the transition to built-in drivers more smooth.

2011-01-29 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: f36cba6cf3d51a3937d3bb429609d258399751a0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f36cba6cf3d51a3937d3bb429609d258399751a0

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan 30 04:52:31 2011 +0800

egl: Make the transition to built-in drivers more smooth.

When the user sets EGL_DRIVER to egl_dri2 (or egl_glx), make sure the
built-in driver is used.  The user might leave the outdated egl_dri2.so
(or egl_glx.so) on the filesystem and we do not want to load it.

---

 src/egl/main/egldriver.c |   29 -
 1 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index e133c22..b75e8b6 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -437,6 +437,7 @@ _eglAddUserDriver(void)
 {
const char *search_path = _eglGetSearchPath();
char *env;
+   size_t name_len = 0;
 
env = getenv(EGL_DRIVER);
 #if defined(_EGL_OS_UNIX)
@@ -448,21 +449,39 @@ _eglAddUserDriver(void)
  env = NULL;
   }
}
+   else if (env) {
+  char *suffix = strchr(env, '.');
+  name_len = (suffix) ? suffix - env : strlen(env);
+   }
+#else
+   if (env)
+  name_len = strlen(env);
 #endif /* _EGL_OS_UNIX */
-   if (env) {
+
+   /*
+* Try built-in drivers first if we know the driver name.  This makes sure
+* we do not load the outdated external driver that is still on the
+* filesystem.
+*/
+   if (name_len) {
   _EGLModule *mod;
   EGLint i;
 
-  /* env can be a path */
-  _eglPreloadForEach(search_path, _eglLoaderFile, (void *) env);
-  /* or the name of a built-in driver */
   for (i = 0; _eglBuiltInDrivers[i].name; i++) {
- if (!strcmp(_eglBuiltInDrivers[i].name, env)) {
+ if (strlen(_eglBuiltInDrivers[i].name) == name_len 
+ !strncmp(_eglBuiltInDrivers[i].name, env, name_len)) {
 mod = _eglAddModule(env);
 if (mod)
mod-BuiltIn = _eglBuiltInDrivers[i].main;
+
+return EGL_TRUE;
  }
   }
+   }
+
+   /* otherwise, treat env as a path */
+   if (env) {
+  _eglPreloadForEach(search_path, _eglLoaderFile, (void *) env);
 
   return EGL_TRUE;
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl_dri2: Export glapi symbols for DRI drivers.

2011-01-29 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 218381d92755fa080bbb5635c0c4ed6d5296b79c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=218381d92755fa080bbb5635c0c4ed6d5296b79c

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan 30 05:09:06 2011 +0800

egl_dri2: Export glapi symbols for DRI drivers.

When an app loads libEGL.so dynamically with RTLD_LOCAL, loading DRI
drivers would fail because of missing glapi symbols.  This commit makes
egl_dri2 load libglapi.so with RTLD_GLOBAL to export glapi symbols for
future symbol resolutions.

The same trick can be found in GLX.  However, egl_dri2 can only do so
when --enable-shared-glapi is given.  Because, otherwise, both libGL.so
and libglapi.so define glapi symbols and egl_dri2 cannot tell which
library to load.

---

 src/egl/drivers/dri2/Makefile   |4 
 src/egl/drivers/dri2/egl_dri2.c |   33 +++--
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index 553ee87..bd3d702 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -20,4 +20,8 @@ EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) 
$(LIBDRM_LIB)
 EGL_CFLAGS = -D_EGL_MAIN=_eglBuiltInDriverDRI2
 EGL_BUILTIN = true
 
+ifeq ($(SHARED_GLAPI),1)
+EGL_CFLAGS += -DHAVE_SHARED_GLAPI
+endif
+
 include ../Makefile.template
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 6fc1e49..92fc9df 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -62,6 +62,7 @@ struct dri2_egl_driver
 {
_EGLDriver base;
 
+   void *handle;
_EGLProc (*get_proc_address)(const char *procname);
void (*glFlush)(void);
 };
@@ -2337,6 +2338,9 @@ static void
 dri2_unload(_EGLDriver *drv)
 {
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
+
+   if (dri2_drv-handle)
+  dlclose(dri2_drv-handle);
free(dri2_drv);
 }
 
@@ -2344,23 +2348,30 @@ static EGLBoolean
 dri2_load(_EGLDriver *drv)
 {
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
+#ifdef HAVE_SHARED_GLAPI
+   const char *libname = libglapi.so.0;
+#else
+   /*
+* Both libGL.so and libglapi.so are glapi providers.  There is no way to
+* tell which one to load.
+*/
+   const char *libname = NULL;
+#endif
void *handle;
 
-   handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
+   /* RTLD_GLOBAL to make sure glapi symbols are visible to DRI drivers */
+   handle = dlopen(libname, RTLD_LAZY | RTLD_GLOBAL);
if (handle) {
   dri2_drv-get_proc_address = (_EGLProc (*)(const char *))
  dlsym(handle, _glapi_get_proc_address);
-  /* no need to keep a reference */
-  dlclose(handle);
+  if (!dri2_drv-get_proc_address || !libname) {
+ /* no need to keep a reference */
+ dlclose(handle);
+ handle = NULL;
+  }
}
 
-   /*
-* If glapi is not available, loading DRI drivers will fail.  Ideally, we
-* should load one of libGL, libGLESv1_CM, or libGLESv2 and go on.  But if
-* the app has loaded another one of them with RTLD_LOCAL, there may be
-* unexpected behaviors later because there will be two copies of glapi
-* (with global variables of the same names!) in the memory.
-*/
+   /* if glapi is not available, loading DRI drivers will fail */
if (!dri2_drv-get_proc_address) {
   _eglLog(_EGL_WARNING, DRI2: failed to find _glapi_get_proc_address);
   return EGL_FALSE;
@@ -2369,6 +2380,8 @@ dri2_load(_EGLDriver *drv)
dri2_drv-glFlush = (void (*)(void))
   dri2_drv-get_proc_address(glFlush);
 
+   dri2_drv-handle = handle;
+
return EGL_TRUE;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: ENTRY_CURRENT_TABLE_GET should be stringified.

2011-01-21 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 3f04314ae2659748c8cf73ec649a035bc9e01597
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f04314ae2659748c8cf73ec649a035bc9e01597

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan 21 16:56:55 2011 +0800

mapi: ENTRY_CURRENT_TABLE_GET should be stringified.

So that it can be renamed to _glapi_get_dispatch.

---

 src/mapi/mapi/entry.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mapi/mapi/entry.c b/src/mapi/mapi/entry.c
index f378ccf..3d9168a 100644
--- a/src/mapi/mapi/entry.c
+++ b/src/mapi/mapi/entry.c
@@ -37,7 +37,7 @@
 #ifdef MAPI_MODE_BRIDGE
 #define ENTRY_CURRENT_TABLE_GET _glapi_get_dispatch
 #else
-#define ENTRY_CURRENT_TABLE_GET u_current_get_internal
+#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_internal)
 #endif
 
 #if defined(USE_X86_ASM)  defined(__GNUC__)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glapi: Add gl_and_es_API.xml.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 323b5e323adad55a0f941c0765b9d1224927cacb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=323b5e323adad55a0f941c0765b9d1224927cacb

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Dec 12 02:21:09 2010 +0800

glapi: Add gl_and_es_API.xml.

gl_and_es_API.xml defines OpenGL ES 1.1 and 2.0 API as well as OpenGL
API.  It consists of gl_API.xml and the newly added es_EXT.xml,
ARB_get_program_binary.xml, OES_single_precision.xml, and
OES_fixed_point.xml.

---

 src/mapi/glapi/gen/ARB_get_program_binary.xml |   36 ++
 src/mapi/glapi/gen/Makefile   |9 +
 src/mapi/glapi/gen/OES_fixed_point.xml|  259 +++
 src/mapi/glapi/gen/OES_single_precision.xml   |   47 ++
 src/mapi/glapi/gen/es_EXT.xml |  618 +
 src/mapi/glapi/gen/gl_and_es_API.xml  |  286 
 6 files changed, 1255 insertions(+), 0 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=323b5e323adad55a0f941c0765b9d1224927cacb
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: Add the ability to parse GLAPI XML.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: f71a9acf59a2cd6396fb57afe57d7808df0bb82b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f71a9acf59a2cd6396fb57afe57d7808df0bb82b

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Dec  7 10:15:50 2010 +0800

mapi: Add the ability to parse GLAPI XML.

A prerequisite if we want to convert vgapi.csv to vgapi.xml, or to use
mapi for glapi.

---

 src/mapi/mapi/mapi_abi.py |   81 ++---
 1 files changed, 76 insertions(+), 5 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 5c21242..1db6cf3 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -126,6 +126,61 @@ class ABIEntry(object):
 
 return res
 
+def abi_parse_xml(xml):
+Parse a GLAPI XML file for ABI entries.
+import os
+GLAPI = ./%s/../glapi/gen % (os.path.dirname(sys.argv[0]))
+sys.path.append(GLAPI)
+import gl_XML, glX_XML
+
+api = gl_XML.parse_GL_API(xml, glX_XML.glx_item_factory())
+
+entry_dict = {}
+for func in api.functionIterateByOffset():
+# make sure func.name appear first
+entry_points = func.entry_points[:]
+entry_points.remove(func.name)
+entry_points.insert(0, func.name)
+
+for name in entry_points:
+attrs = {
+'slot': func.offset,
+'hidden': not func.is_static_entry_point(name),
+'alias': None if name == func.name else func.name,
+'handcode': bool(func.has_different_protocol(name)),
+}
+
+# post-process attrs
+if attrs['alias']:
+try:
+alias = entry_dict[attrs['alias']]
+except KeyError:
+raise Exception('failed to alias %s' % attrs['alias'])
+if alias.alias:
+raise Exception('recursive alias %s' % ent.name)
+attrs['alias'] = alias
+if attrs['handcode']:
+attrs['handcode'] = func.static_glx_name(name)
+else:
+attrs['handcode'] = None
+
+if entry_dict.has_key(name):
+raise Exception('%s is duplicated' % (name))
+
+cols = []
+cols.append(func.return_type)
+cols.append(name)
+params = func.get_parameter_string(name)
+cols.extend([p.strip() for p in params.split(',')])
+
+ent = ABIEntry(cols, attrs)
+entry_dict[ent.name] = ent
+
+entries = entry_dict.values()
+entries.sort()
+
+return entries
+
 def abi_parse_line(line):
 cols = [col.strip() for col in line.split(',')]
 
@@ -194,9 +249,16 @@ def abi_parse(filename):
 entries = entry_dict.values()
 entries.sort()
 
-# sanity check
+return entries
+
+def abi_sanity_check(entries):
+if not entries:
+return
+
+all_names = []
+last_slot = entries[-1].slot
 i = 0
-for slot in xrange(next_slot):
+for slot in xrange(last_slot + 1):
 if entries[i].slot != slot:
 raise Exception('entries are not ordered by slots')
 if entries[i].alias:
@@ -210,12 +272,16 @@ def abi_parse(filename):
 elif ent.handcode != handcode:
 raise Exception('two aliases with handcode %s != %s',
 ent.handcode, handcode)
+
+if ent.name in all_names:
+raise Exception('%s is duplicated' % (ent.name))
+if ent.alias and ent.alias.name not in all_names:
+raise Exception('failed to alias %s' % (ent.alias.name))
+all_names.append(ent.name)
 i += 1
 if i  len(entries):
 raise Exception('there are %d invalid entries' % (len(entries) - 1))
 
-return entries
-
 class ABIPrinter(object):
 MAPI Printer
 
@@ -651,7 +717,12 @@ def main():
 
 filename, options = parse_args()
 
-entries = abi_parse(filename)
+if filename.endswith('.xml'):
+entries = abi_parse_xml(filename)
+else:
+entries = abi_parse(filename)
+abi_sanity_check(entries)
+
 printer = printers[options.printer](entries)
 if options.mode == 'lib':
 printer.output_for_lib()

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: Allow prefix to be macro.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 7828f554abf59e05a4b4152dabd599fae79d0be8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7828f554abf59e05a4b4152dabd599fae79d0be8

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Dec  6 22:21:51 2010 +0800

mapi: Allow prefix to be macro.

Treat prefix as macro when it is all uppercase.  Generate PREFIX(name)
instead of PREFIXname when it is a macro.

---

 src/mapi/mapi/mapi_abi.py |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 1db6cf3..397e7de 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -368,8 +368,11 @@ class ABIPrinter(object):
 
 def _c_function(self, ent, prefix, mangle=False, stringify=False):
 Return the function name of an entry.
-formats = { True: '%s%s', False: '%s%s' }
-fmt = formats[stringify]
+formats = {
+True: { True: '%s_STR(%s)', False: '%s(%s)' },
+False: { True: '%s%s', False: '%s%s' },
+}
+fmt = formats[prefix.isupper()][stringify]
 name = ent.name
 if mangle and ent.hidden:
 name = '_dispatch_stub_' + str(ent.slot)
@@ -379,7 +382,8 @@ class ABIPrinter(object):
 Return the function name used for calling.
 if ent.handcode:
 # _c_function does not handle this case
-fmt = '%s%s'
+formats = { True: '%s(%s)', False: '%s%s' }
+fmt = formats[prefix.isupper()]
 name = fmt % (prefix, ent.handcode)
 elif self.need_entry_point(ent):
 name = self._c_function(ent, prefix, True)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: Fix glapi printers for gl_and_es_API.xml.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 23a89f187272215cc0a517ad75e2cc469a43ba0b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=23a89f187272215cc0a517ad75e2cc469a43ba0b

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Dec 15 01:21:33 2010 +0800

mapi: Fix glapi printers for gl_and_es_API.xml.

Fix GLAPIPrinter, ES1APIPrinter, and ES2APIPrinter to output files that
are ready for compilation.  Since gl_and_es_API.xml is based on
gl_API.xml, the hidden and handcode attributes of entries have to be
overridden for ES1APIPrinter and ES2APIPrinter.

---

 src/mapi/mapi/mapi_abi.py |  521 +++--
 1 files changed, 503 insertions(+), 18 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 397e7de..47be8c5 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -302,6 +302,8 @@ class ABIPrinter(object):
 self.api_entry = 'KHRONOS_APIENTRY'
 self.api_attrs = 'KHRONOS_APIATTRIBUTES'
 
+self.c_header = ''
+
 self.lib_need_table_size = True
 self.lib_need_noop_array = True
 self.lib_need_stubs = True
@@ -432,12 +434,12 @@ class ABIPrinter(object):
 if ent.ret:
 ret = 'return '
 stmt1 = self.indent
-stmt1 += 'const struct mapi_table *tbl = u_current_get();'
+stmt1 += 'const struct mapi_table *_tbl = u_current_get();'
 stmt2 = self.indent
-stmt2 += 'mapi_func func = ((const mapi_func *) tbl)[%d];' % (
+stmt2 += 'mapi_func _func = ((const mapi_func *) _tbl)[%d];' % (
 ent.slot)
 stmt3 = self.indent
-stmt3 += '%s((%s) func)(%s);' % (ret, cast, ent.c_args())
+stmt3 += '%s((%s) _func)(%s);' % (ret, cast, ent.c_args())
 
 disp = '%s\n{\n%s\n%s\n%s\n}' % (proto, stmt1, stmt2, stmt3)
 
@@ -555,6 +557,11 @@ class ABIPrinter(object):
 
 def output_for_lib(self):
 print self.c_notice()
+
+if self.c_header:
+print
+print self.c_header
+
 print
 print '#ifdef MAPI_TMP_DEFINES'
 print self.c_public_includes()
@@ -575,7 +582,7 @@ class ABIPrinter(object):
 print '#ifdef MAPI_TMP_NOOP_ARRAY'
 print '#ifdef DEBUG'
 print
-print self.c_noop_functions(self.prefix_noop, self.prefix_lib)
+print self.c_noop_functions(self.prefix_noop, self.prefix_warn)
 print
 print 'const mapi_func table_%s_array[] = {' % (self.prefix_noop)
 print self.c_noop_initializer(self.prefix_noop, False)
@@ -640,8 +647,9 @@ class ABIPrinter(object):
 class GLAPIPrinter(ABIPrinter):
 OpenGL API Printer
 
-def __init__(self, entries):
-super(GLAPIPrinter, self).__init__(entries)
+def __init__(self, entries, api=None):
+api_entries = self._get_api_entries(entries, api)
+super(GLAPIPrinter, self).__init__(api_entries)
 
 self.api_defines = ['GL_GLEXT_PROTOTYPES']
 self.api_headers = ['GL/gl.h', 'GL/glext.h']
@@ -649,33 +657,509 @@ class GLAPIPrinter(ABIPrinter):
 self.api_entry = 'APIENTRY'
 self.api_attrs = ''
 
-self.prefix_lib = 'gl'
+self.prefix_lib = 'GLAPI_PREFIX'
 self.prefix_app = '_mesa_'
 self.prefix_noop = 'noop'
+self.prefix_warn = self.prefix_lib
 
-def output_for_app(self):
-# not used
-pass
+self.c_header = self._get_c_header()
+
+def _get_api_entries(self, entries, api):
+Override the entry attributes according to API.
+import copy
+
+# no override
+if api is None:
+return entries
+
+api_entries = {}
+for ent in entries:
+ent = copy.copy(ent)
+
+# override 'hidden' and 'handcode'
+ent.hidden = ent.name not in api
+ent.handcode = False
+if ent.alias:
+ent.alias = api_entries[ent.alias.name]
+
+api_entries[ent.name] = ent
+
+# sanity check
+missed = [name for name in api if name not in api_entries]
+if missed:
+raise Exception('%s is missing' % str(missed))
+
+entries = api_entries.values()
+entries.sort()
+
+return entries
+
+def _get_c_header(self):
+header = #ifndef _GLAPI_TMP_H_
+#define _GLAPI_TMP_H_
+#ifdef USE_MGL_NAMESPACE
+#define GLAPI_PREFIX(func)  mgl##func
+#define GLAPI_PREFIX_STR(func)  mgl#func
+#else
+#define GLAPI_PREFIX(func)  gl##func
+#define GLAPI_PREFIX_STR(func)  gl#func
+#endif /* USE_MGL_NAMESPACE */
+
+typedef int GLfixed;
+typedef int GLclampx;
+#endif /* _GLAPI_TMP_H_ */
+
+return header
 
 class ES1APIPrinter(GLAPIPrinter):
 OpenGL ES 1.x API Printer
 
 def __init__(self, entries):
-super(ES1APIPrinter, self).__init__(entries)
+es1_api = [
+# OpenGL ES 1.1

Mesa (master): mapi: Add a new glapi.h implementation.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 6fc152f660ed995fb6c785b9e8e925bb1640532a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fc152f660ed995fb6c785b9e8e925bb1640532a

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Dec 11 03:33:42 2010 +0800

mapi: Add a new glapi.h implementation.

The new implementation is based on mapi.  No new script is needed.  As
noted in sources.mk, the way to use it is to compile MAPI_GLAPI_SOURCES
with MAPI_MODE_GLAPI defined.

---

 src/mapi/mapi/mapi_glapi.c |  240 
 src/mapi/mapi/sources.mak  |   10 ++
 src/mapi/mapi/u_current.h  |6 +-
 3 files changed, 253 insertions(+), 3 deletions(-)

diff --git a/src/mapi/mapi/mapi_glapi.c b/src/mapi/mapi/mapi_glapi.c
new file mode 100644
index 000..adfc0cb
--- /dev/null
+++ b/src/mapi/mapi/mapi_glapi.c
@@ -0,0 +1,240 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.9
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *Chia-I Wu o...@lunarg.com
+ */
+
+#include string.h
+#include glapi/glapi.h
+#include mapi/u_current.h
+#include mapi/table.h /* for MAPI_TABLE_NUM_SLOTS */
+#include mapi/stub.h
+
+/*
+ * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in
+ * u_current.c.
+ */
+
+#ifdef GLX_USE_TLS
+/* not used, but defined for compatibility */
+const struct _glapi_table *_glapi_Dispatch;
+const void *_glapi_Context;
+#endif /* GLX_USE_TLS */
+
+void
+_glapi_destroy_multithread(void)
+{
+   u_current_destroy();
+}
+
+void
+_glapi_check_multithread(void)
+{
+   u_current_init();
+}
+
+void
+_glapi_set_context(void *context)
+{
+   u_current_set_user((const void *) context);
+}
+
+void
+_glapi_set_dispatch(struct _glapi_table *dispatch)
+{
+   u_current_set((const struct mapi_table *) dispatch);
+}
+
+/**
+ * Return size of dispatch table struct as number of functions (or
+ * slots).
+ */
+unsigned int
+_glapi_get_dispatch_table_size(void)
+{
+   return MAPI_TABLE_NUM_SLOTS;
+}
+
+/**
+ * Fill-in the dispatch stub for the named function.
+ *
+ * This function is intended to be called by a hardware driver.  When called,
+ * a dispatch stub may be created created for the function.  A pointer to this
+ * dispatch function will be returned by glXGetProcAddress.
+ *
+ * \param function_names   Array of pointers to function names that should
+ * share a common dispatch offset.
+ * \param parameter_signature  String representing the types of the parameters
+ * passed to the named function.  Parameter types
+ * are converted to characters using the following
+ * rules:
+ *   - 'i' for \c GLint, \c GLuint, and \c GLenum
+ *   - 'p' for any pointer type
+ *   - 'f' for \c GLfloat and \c GLclampf
+ *   - 'd' for \c GLdouble and \c GLclampd
+ *
+ * \returns
+ * The offset in the dispatch table of the named function.  A pointer to the
+ * driver's implementation of the named function should be stored at
+ * \c dispatch_table[\c offset].  Return -1 if error/problem.
+ *
+ * \sa glXGetProcAddress
+ *
+ * \warning
+ * This function can only handle up to 8 names at a time.  As far as I know,
+ * the maximum number of names ever associated with an existing GL function is
+ * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT,
+ * \c glPointParameterfARB, and \c glPointParameterf), so this should not be
+ * too painful of a limitation.
+ *
+ * \todo
+ * Check parameter_signature.
+ */
+int
+_glapi_add_dispatch( const char * const * function_names,
+const char * parameter_signature )
+{
+   const struct mapi_stub *function_stubs[8];
+   const struct mapi_stub *alias = NULL;
+   unsigned

Mesa (master): mapi: u_current_table may be renamed.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 96c52d16c1716b8974b5421342f53f36cb80c10f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96c52d16c1716b8974b5421342f53f36cb80c10f

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Aug 24 15:51:57 2010 +0800

mapi: u_current_table may be renamed.

When MAPI_MODE_GLAPI is defined, u_current_table is renamed to
_glapi_Dispatch or _glapi_tls_Dispatch.  The ASM dispatchers should not
use hardcoded name.

---

 src/mapi/mapi/entry.c|6 +-
 src/mapi/mapi/entry_x86-64_tls.h |4 ++--
 src/mapi/mapi/entry_x86_tls.h|2 +-
 src/mapi/mapi/entry_x86_tsd.h|2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/mapi/mapi/entry.c b/src/mapi/mapi/entry.c
index 69b6134..faeda83 100644
--- a/src/mapi/mapi/entry.c
+++ b/src/mapi/mapi/entry.c
@@ -27,6 +27,11 @@
  */
 
 #include entry.h
+#include u_current.h
+#include u_macros.h
+
+/* define macros for use by assembly dispatchers */
+#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table)
 
 #if defined(USE_X86_ASM)  defined(__GNUC__)
 #   ifdef GLX_USE_TLS
@@ -39,7 +44,6 @@
 #else
 
 #include stdlib.h
-#include u_current.h
 
 /* C version of the public entries */
 #define MAPI_TMP_DEFINES
diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h
index d14bf1c..21ba434 100644
--- a/src/mapi/mapi/entry_x86-64_tls.h
+++ b/src/mapi/mapi/entry_x86-64_tls.h
@@ -46,7 +46,7 @@ __asm__(.section .note.ABI-tag, \a\\n\t
 __asm__(.text);
 
 __asm__(x86_64_current_tls:\n\t
-   movq u_current_table@GOTTPOFF(%rip), %rax\n\t
+   movq  ENTRY_CURRENT_TABLE @GOTTPOFF(%rip), %rax\n\t
ret);
 
 __asm__(.balign 32\n
@@ -59,7 +59,7 @@ __asm__(.balign 32\n
func :
 
 #define STUB_ASM_CODE(slot)  \
-   movq u_current_table@GOTTPOFF(%rip), %rax\n\t   \
+   movq  ENTRY_CURRENT_TABLE @GOTTPOFF(%rip), %rax\n\t  \
movq %fs:(%rax), %r11\n\t   \
jmp *(8 *  slot )(%r11)
 
diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h
index ea63490..43f3489 100644
--- a/src/mapi/mapi/entry_x86_tls.h
+++ b/src/mapi/mapi/entry_x86_tls.h
@@ -50,7 +50,7 @@ __asm__(x86_current_tls:\n\t
 1:\n\t
 popl %eax\n\t
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t
-   movl u_current_table@GOTNTPOFF(%eax), %eax\n\t
+   movl  ENTRY_CURRENT_TABLE @GOTNTPOFF(%eax), %eax\n\t
ret);
 
 #ifndef GLX_X86_READONLY_TEXT
diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h
index 0a07ad7..38742e7 100644
--- a/src/mapi/mapi/entry_x86_tsd.h
+++ b/src/mapi/mapi/entry_x86_tsd.h
@@ -43,7 +43,7 @@ __asm__(.text\n
func :
 
 #define STUB_ASM_CODE(slot) \
-   movl u_current_table, %eax\n\t \
+   movl  ENTRY_CURRENT_TABLE , %eax\n\t \
testl %eax, %eax\n\t   \
je 1f\n\t  \
jmp *(4 *  slot )(%eax)\n\

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glapi: Fix OpenGL ES 1.1 and 2.0 interop.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 9767d3b5ad08640737e9d8dd4feb046478ae1f4b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9767d3b5ad08640737e9d8dd4feb046478ae1f4b

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Dec 26 18:02:59 2010 +0800

glapi: Fix OpenGL ES 1.1 and 2.0 interop.

Move _glapi_* symbols from libGLESv1_CM.so and libGLESv2.so to
libglapi.so.  This makes sure an app will get only one copy of glapi in
its address space.

Note that with this change, libGLES* and libglapi must be built from the
same source tree and distributed together.  This requirement comes from
the fact that the dispatch offsets used by these libraries are
re-assigned whenever GLAPI XMLs are changed.

---

 configs/autoconf.in|4 +
 configs/default|4 +
 configure.ac   |   13 
 src/mapi/es1api/Makefile   |  128 ++-
 src/mapi/glapi/gen-es/Makefile |   61 +--
 src/mapi/shared-glapi/Makefile |   61 +++
 6 files changed, 171 insertions(+), 100 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index ff5ea6f..93923c8 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -65,6 +65,7 @@ OSMESA_LIB = @OSMESA_LIB@
 GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
+GLAPI_LIB = glapi
 
 # Library names (actual file names)
 GL_LIB_NAME = @GL_LIB_NAME@
@@ -76,6 +77,7 @@ EGL_LIB_NAME = @EGL_LIB_NAME@
 GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
 GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
 VG_LIB_NAME = @VG_LIB_NAME@
+GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
 
 # Globs used to install the lib and all symlinks
 GL_LIB_GLOB = @GL_LIB_GLOB@
@@ -87,6 +89,7 @@ EGL_LIB_GLOB = @EGL_LIB_GLOB@
 GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
 GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
 VG_LIB_GLOB = @VG_LIB_GLOB@
+GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
 
 # Directories to build
 LIB_DIR = @LIB_DIR@
@@ -129,6 +132,7 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
 GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
 VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
+GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@
 
 # DRI dependencies
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
diff --git a/configs/default b/configs/default
index b969415..9030cf5 100644
--- a/configs/default
+++ b/configs/default
@@ -59,6 +59,7 @@ EGL_LIB = EGL
 GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
+GLAPI_LIB = glapi
 
 
 # Library names (actual file names)
@@ -71,6 +72,7 @@ EGL_LIB_NAME = lib$(EGL_LIB).so
 GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so
 GLESv2_LIB_NAME = lib$(GLESv2_LIB).so
 VG_LIB_NAME = lib$(VG_LIB).so
+GLAPI_LIB_NAME = lib$(GLAPI_LIB).so
 
 # globs used to install the lib and all symlinks
 GL_LIB_GLOB = $(GL_LIB_NAME)*
@@ -82,6 +84,7 @@ EGL_LIB_GLOB = $(EGL_LIB_NAME)*
 GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)*
 GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)*
 VG_LIB_GLOB = $(VG_LIB_NAME)*
+GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)*
 
 TALLOC_LIBS = `pkg-config --libs talloc`
 TALLOC_CFLAGS = `pkg-config --cflags talloc`
@@ -130,6 +133,7 @@ APP_LIB_DEPS= $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) 
-l$(GLUT_LIB) -l$(GLU_LI
 GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 VG_LIB_DEPS= $(EXTRA_LIB_PATH) -lpthread
+GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 
 # Program dependencies - specific GL/glut libraries added in Makefiles
 APP_LIB_DEPS = -lm
diff --git a/configure.ac b/configure.ac
index f51ad9e..ba5e12e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -316,6 +316,7 @@ EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
 GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
+GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
 
 
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
@@ -327,6 +328,7 @@ 
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTE
 
GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
+GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
 AC_SUBST([GL_LIB_NAME])
 AC_SUBST([GLU_LIB_NAME])
@@ -337,6 +339,7 @@ AC_SUBST([EGL_LIB_NAME])
 AC_SUBST([GLESv1_CM_LIB_NAME])
 AC_SUBST([GLESv2_LIB_NAME])
 AC_SUBST([VG_LIB_NAME])
+AC_SUBST([GLAPI_LIB_NAME])
 
 AC_SUBST([GL_LIB_GLOB])
 AC_SUBST([GLU_LIB_GLOB])
@@ -347,6 +350,7 @@ AC_SUBST([EGL_LIB_GLOB])
 AC_SUBST([GLESv1_CM_LIB_GLOB])
 AC_SUBST([GLESv2_LIB_GLOB])
 AC_SUBST([VG_LIB_GLOB])
+AC_SUBST

Mesa (master): mapi: Add support for bridge mode.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 97185bf2654f7e72d8bfcc216f905492655d4c77
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=97185bf2654f7e72d8bfcc216f905492655d4c77

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Dec 17 00:24:27 2010 +0800

mapi: Add support for bridge mode.

In bridge mode, mapi no longer implements glapi.h.  It becomes a user of
glapi.h.  Imagine an app that uses both libGL.so and libGLESv2.so.
There will be two copies of glapi in the app's memory.  It is possible
that _glapi_get_dispatch does not return what _glapi_set_dispatch set,
if they access different copies of the global variables.  The solution
to this situation to build either one of the libraries as a bridge to
the other.  Or build both libraries as bridges to another shared
glapi library.

---

 src/mapi/mapi/entry.c|   21 +
 src/mapi/mapi/entry_x86-64_tls.h |   22 +
 src/mapi/mapi/entry_x86_tls.h|7 +++-
 src/mapi/mapi/entry_x86_tsd.h|   11 +++-
 src/mapi/mapi/mapi_abi.py|   93 +++---
 src/mapi/mapi/mapi_tmp.h |   15 ++
 src/mapi/mapi/sources.mak|6 +++
 src/mapi/mapi/u_current.h|7 ++-
 8 files changed, 149 insertions(+), 33 deletions(-)

diff --git a/src/mapi/mapi/entry.c b/src/mapi/mapi/entry.c
index faeda83..f378ccf 100644
--- a/src/mapi/mapi/entry.c
+++ b/src/mapi/mapi/entry.c
@@ -33,6 +33,13 @@
 /* define macros for use by assembly dispatchers */
 #define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table)
 
+/* in bridge mode, mapi is a user of glapi */
+#ifdef MAPI_MODE_BRIDGE
+#define ENTRY_CURRENT_TABLE_GET _glapi_get_dispatch
+#else
+#define ENTRY_CURRENT_TABLE_GET u_current_get_internal
+#endif
+
 #if defined(USE_X86_ASM)  defined(__GNUC__)
 #   ifdef GLX_USE_TLS
 #  include entry_x86_tls.h
@@ -45,12 +52,24 @@
 
 #include stdlib.h
 
+static INLINE const struct mapi_table *
+entry_current_get(void)
+{
+#ifdef MAPI_MODE_BRIDGE
+   return GET_DISPATCH();
+#else
+   return u_current_get();
+#endif
+}
+
 /* C version of the public entries */
 #define MAPI_TMP_DEFINES
 #define MAPI_TMP_PUBLIC_DECLARES
 #define MAPI_TMP_PUBLIC_ENTRIES
 #include mapi_tmp.h
 
+#ifndef MAPI_MODE_BRIDGE
+
 void
 entry_patch_public(void)
 {
@@ -74,4 +93,6 @@ entry_patch(mapi_func entry, int slot)
 {
 }
 
+#endif /* MAPI_MODE_BRIDGE */
+
 #endif /* asm */
diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h
index 21ba434..d3b606c 100644
--- a/src/mapi/mapi/entry_x86-64_tls.h
+++ b/src/mapi/mapi/entry_x86-64_tls.h
@@ -26,8 +26,6 @@
  *Chia-I Wu o...@lunarg.com
  */
 
-#include string.h
-#include u_execmem.h
 #include u_macros.h
 
 #ifdef __linux__
@@ -43,13 +41,8 @@ __asm__(.section .note.ABI-tag, \a\\n\t
 3: .p2align 2\n\t);/* pad out section */
 #endif /* __linux__ */
 
-__asm__(.text);
-
-__asm__(x86_64_current_tls:\n\t
-   movq  ENTRY_CURRENT_TABLE @GOTTPOFF(%rip), %rax\n\t
-   ret);
-
-__asm__(.balign 32\n
+__asm__(.text\n
+.balign 32\n
 x86_64_entry_start:);
 
 #define STUB_ASM_ENTRY(func) \
@@ -66,9 +59,18 @@ __asm__(.balign 32\n
 #define MAPI_TMP_STUB_ASM_GCC
 #include mapi_tmp.h
 
+#ifndef MAPI_MODE_BRIDGE
+
+__asm__(x86_64_current_tls:\n\t
+   movq  ENTRY_CURRENT_TABLE @GOTTPOFF(%rip), %rax\n\t
+   ret);
+
 extern unsigned long
 x86_64_current_tls();
 
+#include string.h
+#include u_execmem.h
+
 void
 entry_patch_public(void)
 {
@@ -118,3 +120,5 @@ entry_generate(int slot)
 
return entry;
 }
+
+#endif /* MAPI_MODE_BRIDGE */
diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h
index 43f3489..5169069 100644
--- a/src/mapi/mapi/entry_x86_tls.h
+++ b/src/mapi/mapi/entry_x86_tls.h
@@ -27,7 +27,6 @@
  */
 
 #include string.h
-#include u_execmem.h
 #include u_macros.h
 
 #ifdef __linux__
@@ -80,6 +79,10 @@ __asm__(.balign 16\n
 __asm__(.text);
 #endif /* GLX_X86_READONLY_TEXT */
 
+#ifndef MAPI_MODE_BRIDGE
+
+#include u_execmem.h
+
 extern unsigned long
 x86_current_tls();
 
@@ -139,3 +142,5 @@ entry_generate(int slot)
 
return entry;
 }
+
+#endif /* MAPI_MODE_BRIDGE */
diff --git a/src/mapi/mapi/entry_x86_tsd.h b/src/mapi/mapi/entry_x86_tsd.h
index 38742e7..1491478 100644
--- a/src/mapi/mapi/entry_x86_tsd.h
+++ b/src/mapi/mapi/entry_x86_tsd.h
@@ -26,8 +26,6 @@
  *Chia-I Wu o...@lunarg.com
  */
 
-#include string.h
-#include u_execmem.h
 #include u_macros.h
 
 #define X86_ENTRY_SIZE 32
@@ -48,15 +46,20 @@ __asm__(.text\n
je 1f\n\t  \
jmp *(4 *  slot )(%eax)\n\
1:\n\t \
-   call u_current_get_internal\n\t\
+   call  ENTRY_CURRENT_TABLE_GET \n\t \
jmp *(4 *  slot )(%eax)
 
 #define MAPI_TMP_STUB_ASM_GCC
 #include mapi_tmp.h
 
+#ifndef MAPI_MODE_BRIDGE
+
 __asm__(.balign 32\n
 x86_entry_end:);
 
+#include string.h
+#include u_execmem.h
+
 void
 entry_patch_public(void)
 {
@@ -96,3 +99,5 @@ entry_generate(int slot

Mesa (master): glapi: Fix OpenGL and OpenGL ES interop.

2011-01-20 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: e8c7d7598fb48237508f566204c71ba8f74d544f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8c7d7598fb48237508f566204c71ba8f74d544f

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Dec 26 18:24:13 2010 +0800

glapi: Fix OpenGL and OpenGL ES interop.

When --enable-shared-glapi is specified, libGL will share libglapi with
OpenGL ES instead of defining its own copy of glapi.  This makes sure an
app will get only one copy of glapi in its address space.

The new option is disabled by default.  When enabled, libGL and libglapi
must be built from the same source tree and distributed together.  This
requirement comes from the fact that the dispatch offsets used by these
libraries are re-assigned whenever GLAPI XMLs are changed.

For GLX, indirect rendering for has_different_protocol() functions is
tricky.  A has_different_protocol() function is assigned only one
dispatch offset, yet each entry point needs a different protocol opcode.
It cannot be supported by the shared glapi.  The fix to this is to make
glXGetProcAddress handle such functions specially before calling
_glapi_get_proc_address.

Note that these files are automatically generated/re-generated

 src/glx/indirect.c
 src/glx/indirect.h
 src/mapi/glapi/glapi_mapi_tmp.h

---

 configs/autoconf.in |1 +
 configure.ac|   16 +-
 src/gallium/targets/egl/Makefile|6 +-
 src/gallium/targets/libgl-xlib/Makefile |4 +
 src/glx/Makefile|6 +
 src/glx/glxcmds.c   |7 +-
 src/glx/indirect.c  |   64 +-
 src/glx/indirect.h  |4 +
 src/mapi/glapi/Makefile |   58 +-
 src/mapi/glapi/gen/Makefile |6 +
 src/mapi/glapi/gen/glX_proto_send.py|   53 +
 src/mapi/glapi/glapi_mapi_tmp.h |13105 +++
 src/mapi/shared-glapi/Makefile  |2 +-
 src/mesa/drivers/x11/Makefile   |3 +
 14 files changed, 13306 insertions(+), 29 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=e8c7d7598fb48237508f566204c71ba8f74d544f
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): autoconf: Fail when --with-state-trackers is incomplete.

2011-01-19 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: c116a0e2dcce7635707fab724cfe4f6bc23906e3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c116a0e2dcce7635707fab724cfe4f6bc23906e3

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jan 20 14:19:13 2011 +0800

autoconf: Fail when --with-state-trackers is incomplete.

When --enable-openvg or --enable-gallium-egl is enabled,
--with-state-trackers must have vega or egl.

---

 configure.ac |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index d9220c8..f51ad9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1428,6 +1428,7 @@ yes)
 if test x$enable_openvg != xyes; then
 AC_MSG_ERROR([cannot build vega state tracker without 
--enable-openvg])
 fi
+have_st_vega=yes
 ;;
 esac
 
@@ -1442,6 +1443,14 @@ yes)
 fi
 done
 GALLIUM_STATE_TRACKERS_DIRS=$state_trackers
+
+# append --enable-openvg/--enable-gallium-egl to --with-state-trackers
+if test x$have_st_vega != xyes -a x$enable_openvg = xyes; then
+AC_MSG_ERROR([--with-state-trackers specified but vega is missing])
+fi
+if test x$HAVE_ST_EGL != xyes -a x$enable_gallium_egl = xyes; then
+AC_MSG_ERROR([--with-state-trackers specified but egl is missing])
+fi
 ;;
 esac
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): d3d1x: Fix broken build.

2011-01-16 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 326332a130baa732805489565ed806ce344cc1f6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=326332a130baa732805489565ed806ce344cc1f6

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan 16 17:34:40 2011 +0800

d3d1x: Fix broken build.

st/egl native.h changed its interface in
a22a332fc7cc54d4d0973dcd21a90159cc51de1a.

---

 .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp  |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp 
b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
index a54324a..2ff24e1 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -256,11 +256,16 @@ struct GalliumDXGIAdapter
{
this-parent = factory;
 
+/* FIXME handler should be static */
handler.invalid_surface = handle_invalid_surface;
handler.new_drm_screen = dxgi_loader_create_drm_screen;
handler.new_sw_screen = dxgi_loader_create_sw_screen;
-   display = platform-create_display(dpy, handler, this);
+   platform-set_event_handler(handler);
+
+   display = platform-create_display(dpy, FALSE, this);
if(!display)
+   display = platform-create_display(dpy, TRUE, this);
+if(!display)
throw E_FAIL;
memset(desc, 0, sizeof(desc));
std::string s = std::string(GalliumD3D on ) + 
display-screen-get_name(display-screen) +  by  + 
display-screen-get_vendor(display-screen);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl: i965 needs libwsw.

2011-01-14 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 6f769a690b005c054f71429423ad6ef8d1bc058c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f769a690b005c054f71429423ad6ef8d1bc058c

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jan 15 03:24:15 2011 +0800

targets/egl: i965 needs libwsw.

Fix undefined symbol wrapper_sw_winsys_dewrap_pipe_screen.

---

 src/gallium/targets/egl/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 3e36000..017c195 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -74,7 +74,8 @@ i965_CPPFLAGS :=
 i965_SYS := -ldrm_intel
 i965_LIBS := \
$(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
-   $(TOP)/src/gallium/drivers/i965/libi965.a
+   $(TOP)/src/gallium/drivers/i965/libi965.a \
+   $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
 
 # nouveau pipe driver
 nouveau_CPPFLAGS :=

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl-static: Assorted cleanups and fixes.

2011-01-14 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: b70d0a6a51da42fc390e82161a96c80fd8c653ff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b70d0a6a51da42fc390e82161a96c80fd8c653ff

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jan 15 03:15:41 2011 +0800

targets/egl-static: Assorted cleanups and fixes.

Share more code between windows and non-windows platforms.  Check
env['x11'] for X11 and add env['X11_LIBS'] to LIBS.  Add ws_wrapper for
i965g.

---

 src/gallium/targets/egl-static/SConscript |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/targets/egl-static/SConscript 
b/src/gallium/targets/egl-static/SConscript
index 25c49ea..381ef4e 100644
--- a/src/gallium/targets/egl-static/SConscript
+++ b/src/gallium/targets/egl-static/SConscript
@@ -32,6 +32,7 @@ env.Prepend(LIBS = [
 galahad,
 gallium,
 egl,
+st_egl,
 ])
 
 if env['llvm']:
@@ -55,28 +56,26 @@ if env['platform'] == 'windows':
 ])
 
 env.Prepend(LIBS = [
-st_egl,
 ws_gdi,
 ])
-
-# OpenVG
-env.Append(CPPDEFINES = ['FEATURE_VG=1'])
-env.Prepend(LIBS = [openvg, st_vega])
 else:
-env.Prepend(LIBS = [
-st_egl,
-ws_xlib,
-])
-
 # OpenGL
 env.Append(CPPDEFINES = ['FEATURE_GL=1'])
 env.Prepend(LIBS = ['GL', 'talloc', glsl, mesa])
 
-# OpenVG
+# OpenVG
+if True:
 env.Append(CPPDEFINES = ['FEATURE_VG=1'])
 env.Prepend(LIBPATH = [openvg.dir])
-env.Prepend(LIBS = ['OpenVG', st_vega])
+# manually add LIBPREFIX on windows
+openvg_name = 'OpenVG' if env['platform'] != 'windows' else 'libOpenVG'
+env.Prepend(LIBS = [openvg_name, st_vega])
 
+if env['x11']:
+env.Prepend(LIBS = [
+ws_xlib,
+env['X11_LIBS'],
+])
 
 if env['dri']:
 env.ParseConfig('pkg-config --cflags --libs xfixes')
@@ -93,6 +92,7 @@ if env['drm']:
 i915,
 i965drm,
 i965,
+ws_wrapper,
 ])
 
 if env['drm_radeon']:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: Add glDepthRangef and glClearDepthf to APIspec.xml.

2011-01-14 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: a4a5a9a5ce255e34ba92396dacd997f7c6f96462
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4a5a9a5ce255e34ba92396dacd997f7c6f96462

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Jan 15 12:39:24 2011 +0800

mesa: Add glDepthRangef and glClearDepthf to APIspec.xml.

Core mesa has gained support for GL_ARB_ES2_compatibility.  Make GLES
generated dispatch table use them.

---

 src/mesa/main/APIspec.xml |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 2a98c95..50446a9 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -3590,6 +3590,7 @@
function name=ClearColor template=ClearColor gltype=GLclampf/
function name=ClearStencil template=ClearStencil/
function name=ClearDepth template=ClearDepth gltype=GLclampd/
+   function name=ClearDepthf template=ClearDepth gltype=GLclampf/
 
function name=StencilMask template=StencilMask/
function name=StencilMaskSeparate template=StencilMaskSeparate/
@@ -3634,6 +3635,7 @@
function name=IsEnabled template=IsEnabled/
 
function name=DepthRange template=DepthRange gltype=GLclampd/
+   function name=DepthRangef template=DepthRange gltype=GLclampf/
function name=Frustum template=Frustum gltype=GLdouble/
 
function name=LoadIdentity template=LoadIdentity/

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: Cleanup _EGLDisplay initialization.

2011-01-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: a4a38dcf61f141297a083ccac217200947d57b0d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4a38dcf61f141297a083ccac217200947d57b0d

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jan 13 16:53:13 2011 +0800

egl: Cleanup _EGLDisplay initialization.

Reorder/rename and document the fields that should be set by the driver during
initialization.  Drop the major/minor arguments from drv-API.Initialize.

---

 src/egl/drivers/dri2/egl_dri2.c |   33 ++
 src/egl/drivers/glx/egl_glx.c   |9 +++---
 src/egl/main/eglapi.c   |9 ++
 src/egl/main/eglapi.h   |2 +-
 src/egl/main/egldisplay.h   |   28 +-
 src/egl/main/egldriver.c|8 ++---
 src/egl/main/eglmisc.c  |   31 -
 src/egl/main/eglstring.h|1 +
 src/gallium/state_trackers/egl/common/egl_g3d.c |   17 +--
 9 files changed, 66 insertions(+), 72 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 458d18f..f6bca4a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -260,8 +260,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
  base.BindToTextureRGBA = bind_to_texture_rgba;
}
 
-   base.RenderableType = disp-ClientAPIsMask;
-   base.Conformant = disp-ClientAPIsMask;
+   base.RenderableType = disp-ClientAPIs;
+   base.Conformant = disp-ClientAPIs;
 
if (!_eglValidateConfig(base, EGL_FALSE)) {
   _eglLog(_EGL_DEBUG, DRI2: failed to validate config %d, id);
@@ -752,13 +752,13 @@ dri2_create_screen(_EGLDisplay *disp)
else
   api_mask = 1  __DRI_API_OPENGL;
 
-   disp-ClientAPIsMask = 0;
+   disp-ClientAPIs = 0;
if (api_mask  (1 __DRI_API_OPENGL))
-  disp-ClientAPIsMask |= EGL_OPENGL_BIT;
+  disp-ClientAPIs |= EGL_OPENGL_BIT;
if (api_mask  (1 __DRI_API_GLES))
-  disp-ClientAPIsMask |= EGL_OPENGL_ES_BIT;
+  disp-ClientAPIs |= EGL_OPENGL_ES_BIT;
if (api_mask  (1  __DRI_API_GLES2))
-  disp-ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
+  disp-ClientAPIs |= EGL_OPENGL_ES2_BIT;
 
if (dri2_dpy-dri2-base.version = 2) {
   disp-Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
@@ -775,8 +775,7 @@ dri2_create_screen(_EGLDisplay *disp)
 }
 
 static EGLBoolean
-dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
-   EGLint *major, EGLint *minor)
+dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
 {
struct dri2_egl_display *dri2_dpy;
 
@@ -855,8 +854,8 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
disp-Extensions.NOK_texture_from_pixmap = EGL_TRUE;
 
/* we're supporting EGL 1.4 */
-   *major = 1;
-   *minor = 4;
+   disp-VersionMajor = 1;
+   disp-VersionMinor = 4;
 
return EGL_TRUE;
 
@@ -1415,8 +1414,7 @@ dri2_get_driver_for_fd(int fd)
 }
 
 static EGLBoolean
-dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
-   EGLint *major, EGLint *minor)
+dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
 {
struct dri2_egl_display *dri2_dpy;
int i;
@@ -1451,8 +1449,8 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
disp-Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
 
/* we're supporting EGL 1.4 */
-   *major = 1;
-   *minor = 4;
+   disp-VersionMajor = 1;
+   disp-VersionMinor = 4;
 
return EGL_TRUE;
 
@@ -1470,16 +1468,15 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp,
  * Called via eglInitialize(), GLX_drv-API.Initialize().
  */
 static EGLBoolean
-dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
-   EGLint *major, EGLint *minor)
+dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
 {
switch (disp-Platform) {
case _EGL_PLATFORM_X11:
-  return dri2_initialize_x11(drv, disp, major, minor);
+  return dri2_initialize_x11(drv, disp);
 
 #ifdef HAVE_LIBUDEV
case _EGL_PLATFORM_DRM:
-  return dri2_initialize_drm(drv, disp, major, minor);
+  return dri2_initialize_drm(drv, disp);
 #endif
 
default:
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 5fce06d..84b04f7 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -581,8 +581,7 @@ check_quirks(struct GLX_egl_driver *GLX_drv,
  * Called via eglInitialize(), GLX_drv-API.Initialize().
  */
 static EGLBoolean
-GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
-   EGLint *major, EGLint *minor)
+GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp)
 {
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy;
@@ -614,7 +613,7 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
}
 
disp-DriverData = (void *) GLX_dpy;
-   disp-ClientAPIsMask = EGL_OPENGL_BIT;
+   disp-ClientAPIs = EGL_OPENGL_BIT

Mesa (master): egl: Simplify driver matching.

2011-01-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 655e4598927728a663f4cfcd6babdf7e5ad83f77
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=655e4598927728a663f4cfcd6babdf7e5ad83f77

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jan 13 00:27:45 2011 +0800

egl: Simplify driver matching.

Add initialization options that drv-API.Initialize should support.
Replace drv-Probe by TestOnly initialization option and simplify
_eglMatchDriver.

---

 src/egl/drivers/dri2/egl_dri2.c |4 +
 src/egl/drivers/glx/egl_glx.c   |3 +
 src/egl/main/egldisplay.h   |5 +
 src/egl/main/egldriver.c|  121 +--
 src/egl/main/egldriver.h|   12 +--
 src/gallium/state_trackers/egl/common/egl_g3d.c |   11 +--
 6 files changed, 64 insertions(+), 92 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f6bca4a..2e827f4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1472,10 +1472,14 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
 {
switch (disp-Platform) {
case _EGL_PLATFORM_X11:
+  if (disp-Options.TestOnly)
+ return EGL_TRUE;
   return dri2_initialize_x11(drv, disp);
 
 #ifdef HAVE_LIBUDEV
case _EGL_PLATFORM_DRM:
+  if (disp-Options.TestOnly)
+ return EGL_TRUE;
   return dri2_initialize_drm(drv, disp);
 #endif
 
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 84b04f7..aecebae 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -589,6 +589,9 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp)
if (disp-Platform != _EGL_PLATFORM_X11)
   return EGL_FALSE;
 
+   if (disp-Options.TestOnly)
+  return EGL_TRUE;
+
GLX_dpy = CALLOC_STRUCT(GLX_egl_display);
if (!GLX_dpy)
   return _eglError(EGL_BAD_ALLOC, eglInitialize);
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index faeb290..b42760b 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -90,6 +90,11 @@ struct _egl_display
_EGLDriver *Driver;/** Matched driver of the display */
EGLBoolean Initialized;/** True if the display is initialized */
 
+   /* options that affect how the driver initializes the display */
+   struct {
+  EGLBoolean TestOnly;/** Driver should not set fields when true */
+   } Options;
+
/* these fields are set by the driver during init */
void *DriverData;  /** Driver private data */
EGLint VersionMajor;   /** EGL major version */
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 1ae030d..7baa24f 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -525,100 +525,75 @@ _eglAddDrivers(void)
 
 
 /**
- * Match a display to a driver.  The display is initialized unless use_probe is
- * true.
- *
- * The matching is done by finding the first driver that can initialize the
- * display, or when use_probe is true, the driver with highest score.
+ * A helper function for _eglMatchDriver.  It finds the first driver that can
+ * initialize the display and return.
  */
-_EGLDriver *
-_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean use_probe)
+static _EGLDriver *
+_eglMatchAndInitialize(_EGLDisplay *dpy)
 {
-   _EGLModule *mod;
-   _EGLDriver *best_drv = NULL;
-   EGLint best_score = 0;
-   EGLint i;
-
-   _eglLockMutex(_eglModuleMutex);
+   _EGLDriver *drv = NULL;
+   EGLint i = 0;
 
if (!_eglAddDrivers()) {
-  _eglUnlockMutex(_eglModuleMutex);
   _eglLog(_EGL_WARNING, failed to find any driver);
-  return EGL_FALSE;
+  return NULL;
}
 
-   /* match the loaded modules */
-   for (i = 0; i  _eglModules-Size; i++) {
-  mod = (_EGLModule *) _eglModules-Elements[i];
-  if (!mod-Driver)
- break;
+   if (dpy-Driver) {
+  drv = dpy-Driver;
+  /* no re-matching? */
+  if (!drv-API.Initialize(drv, dpy))
+ drv = NULL;
+  return drv;
+   }
 
-  if (use_probe) {
- EGLint score = (mod-Driver-Probe) ?
-mod-Driver-Probe(mod-Driver, dpy) : 1;
- if (score  best_score) {
-best_drv = mod-Driver;
-best_score = score;
- }
+   while (i  _eglModules-Size) {
+  _EGLModule *mod = (_EGLModule *) _eglModules-Elements[i];
+
+  if (!_eglLoadModule(mod)) {
+ /* remove invalid modules */
+ _eglEraseArray(_eglModules, i, _eglFreeModule);
+ continue;
+  }
+
+  if (mod-Driver-API.Initialize(mod-Driver, dpy)) {
+ drv = mod-Driver;
+ break;
   }
   else {
- if (mod-Driver-API.Initialize(mod-Driver, dpy)) {
-best_drv = mod-Driver;
-best_score = 100;
- }
+ i++;
   }
-  /* perfect match */
-  if (best_score = 100)
- break;
}
 
-   /* load more modules */
-   if (!best_drv) {
-  EGLint

Mesa (master): egl: Improve driver selection.

2011-01-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: a22a332fc7cc54d4d0973dcd21a90159cc51de1a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a22a332fc7cc54d4d0973dcd21a90159cc51de1a

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Jan 13 04:40:38 2011 +0800

egl: Improve driver selection.

The idea is to be able to match a driver using the following order

  try egl_gallium with hw renderer
  try egl_dri2
  try egl_gallium with sw renderer
  try egl_glx

given the module list

  egl_gallium
  egl_dri2
  egl_glx

For that, UseFallback initialization option is added.  The module list
is matched twice: with the option unset and with the option set.  In the
first pass, egl_gallium skips its sw renderer and egl_glx rejects to
initialize since UseFallback is not set.  In the second pass,
egl_gallium skips its hw renderer and egl_dri2 rejects to initialize
since UseFallback is set.  The process stops at the first driver that
initializes the display.

---

 src/egl/drivers/dri2/egl_dri2.c|4 +
 src/egl/drivers/glx/egl_glx.c  |4 +
 src/egl/main/egldisplay.h  |1 +
 src/egl/main/egldriver.c   |5 +
 src/gallium/state_trackers/egl/common/egl_g3d.c|   86 ++--
 src/gallium/state_trackers/egl/common/native.h |3 +-
 src/gallium/state_trackers/egl/drm/native_drm.c|   14 +++-
 .../state_trackers/egl/fbdev/native_fbdev.c|   14 +++-
 src/gallium/state_trackers/egl/gdi/native_gdi.c|   14 +++-
 src/gallium/state_trackers/egl/x11/native_x11.c|   28 ---
 10 files changed, 110 insertions(+), 63 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2e827f4..6fc1e49 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1470,6 +1470,10 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
 static EGLBoolean
 dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
 {
+   /* not until swrast_dri is supported */
+   if (disp-Options.UseFallback)
+  return EGL_FALSE;
+
switch (disp-Platform) {
case _EGL_PLATFORM_X11:
   if (disp-Options.TestOnly)
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index aecebae..c3c11c7 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -589,6 +589,10 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp)
if (disp-Platform != _EGL_PLATFORM_X11)
   return EGL_FALSE;
 
+   /* this is a fallback driver */
+   if (!disp-Options.UseFallback)
+  return EGL_FALSE;
+
if (disp-Options.TestOnly)
   return EGL_TRUE;
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index b42760b..dbc5d32 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -93,6 +93,7 @@ struct _egl_display
/* options that affect how the driver initializes the display */
struct {
   EGLBoolean TestOnly;/** Driver should not set fields when true */
+  EGLBoolean UseFallback; /** Use fallback driver (sw or less features) */
} Options;
 
/* these fields are set by the driver during init */
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 7baa24f..e133c22 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -585,8 +585,13 @@ _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only)
 
/* set options */
dpy-Options.TestOnly = test_only;
+   dpy-Options.UseFallback = EGL_FALSE;
 
best_drv = _eglMatchAndInitialize(dpy);
+   if (!best_drv) {
+  dpy-Options.UseFallback = EGL_TRUE;
+  best_drv = _eglMatchAndInitialize(dpy);
+   }
 
_eglUnlockMutex(_eglModuleMutex);
 
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
b/src/gallium/state_trackers/egl/common/egl_g3d.c
index bad32ac..9024f94 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -38,6 +38,46 @@
 #include egl_g3d_loader.h
 #include native.h
 
+static void
+egl_g3d_invalid_surface(struct native_display *ndpy,
+struct native_surface *nsurf,
+unsigned int seq_num)
+{
+   /* XXX not thread safe? */
+   struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf-user_data);
+   struct egl_g3d_context *gctx;
+   
+   /*
+* Some functions such as egl_g3d_copy_buffers create a temporary native
+* surface.  There is no gsurf associated with it.
+*/
+   gctx = (gsurf) ? egl_g3d_context(gsurf-base.CurrentContext) : NULL;
+   if (gctx)
+  gctx-stctxi-notify_invalid_framebuffer(gctx-stctxi, gsurf-stfbi);
+}
+
+static struct pipe_screen *
+egl_g3d_new_drm_screen(struct native_display *ndpy, const char *name, int fd)
+{
+   _EGLDisplay *dpy = (_EGLDisplay *) ndpy-user_data;
+   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+   return gdpy-loader-create_drm_screen(name, fd);
+}
+
+static struct pipe_screen *
+egl_g3d_new_sw_screen

Mesa (master): draw: Fix an off-by-one bug in a vsplit assertion.

2011-01-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: abbb1c8f084c6739bc9d6f559caf26f3f71b2fab
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=abbb1c8f084c6739bc9d6f559caf26f3f71b2fab

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan 14 01:50:51 2011 +0800

draw: Fix an off-by-one bug in a vsplit assertion.

When use_spoken is true, istart (the first vertex of this segment) is
replaced by i0 (the spoken vertex of the fan).  There are still icount
vertices.

Thanks to Brian Paul for spotting this.

---

 src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h 
b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
index 3f66f96..75dba8c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
@@ -258,9 +258,10 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, 
unsigned flags,
boolean use_spoken = ((flags  DRAW_SPLIT_BEFORE) != 0);
unsigned nr = 0, i;
 
-   assert(icount + !!use_spoken = vsplit-segment_size);
+   assert(icount = vsplit-segment_size);
 
if (use_spoken) {
+  /* replace istart by i0 */
   vsplit-fetch_elts[nr++] = i0;
   for (i = 1 ; i  icount; i++)
  vsplit-fetch_elts[nr++] = istart + i;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: Fix an assertion in _eglUpdateAPIsString.

2011-01-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 36a59b29ef07b78378dcb3934131d262d42612cb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=36a59b29ef07b78378dcb3934131d262d42612cb

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan 14 14:11:35 2011 +0800

egl: Fix an assertion in _eglUpdateAPIsString.

dpy-ClientAPIs was renamed in a4a38dcf61f141297a083ccac217200947d57b0d.

---

 src/egl/main/eglmisc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index 5a607dc..a595e3f 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -133,7 +133,7 @@ _eglUpdateAPIsString(_EGLDisplay *dpy)
if (dpy-ClientAPIs  EGL_OPENVG_BIT)
   strcat(apis, OpenVG );
 
-   assert(strlen(apis)  sizeof(dpy-ClientAPIs));
+   assert(strlen(apis)  sizeof(dpy-ClientAPIsString));
 }
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Demos (master): egl/opengl: Use eglChooseConfig in peglgears.

2011-01-13 Thread Chia-I Wu
Module: Demos
Branch: master
Commit: f61baefe2e9858b68fccd838dce644ab6ecc1e1e
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=f61baefe2e9858b68fccd838dce644ab6ecc1e1e

Author: Chia-I Wu olva...@gmail.com
Date:   Fri Jan 14 14:17:59 2011 +0800

egl/opengl: Use eglChooseConfig in peglgears.

eglGetConfig might not return a config that supports pbuffer.

---

 src/egl/opengl/peglgears.c |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/egl/opengl/peglgears.c b/src/egl/opengl/peglgears.c
index 212d1ac..30b6578 100644
--- a/src/egl/opengl/peglgears.c
+++ b/src/egl/opengl/peglgears.c
@@ -371,6 +371,7 @@ main(int argc, char *argv[])
EGLint numConfigs, i;
EGLBoolean b;
EGLDisplay d;
+   EGLint configAttribs[10];
EGLint screenAttribs[10];
GLboolean printInfo = GL_FALSE;
EGLint width = 300, height = 300;
@@ -398,7 +399,19 @@ main(int argc, char *argv[])
printf(peglgears: EGL version = %d.%d\n, major, minor);
printf(peglgears: EGL_VENDOR = %s\n, eglQueryString(d, EGL_VENDOR));
 
-   eglGetConfigs(d, configs, MAX_CONFIGS, numConfigs);
+   i = 0;
+   configAttribs[i++] = EGL_RENDERABLE_TYPE;
+   configAttribs[i++] = EGL_OPENGL_BIT;
+   configAttribs[i++] = EGL_SURFACE_TYPE;
+   configAttribs[i++] = EGL_PBUFFER_BIT;
+   configAttribs[i++] = EGL_NONE;
+
+   numConfigs = 0;
+   if (!eglChooseConfig(d, configAttribs, configs, MAX_CONFIGS, 
numConfigs) ||
+   !numConfigs) {
+   printf(peglgears: failed to choose a config\n);
+   return 0;
+   }
 
eglBindAPI(EGL_OPENGL_API);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: Fix EGL_VERSION string.

2011-01-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: e7d8f925704ddd635748fe72a42eaeec95eb89ee
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7d8f925704ddd635748fe72a42eaeec95eb89ee

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan 14 14:29:04 2011 +0800

egl: Fix EGL_VERSION string.

Fix a copy-and-paste error in a4a38dcf61f141297a083ccac217200947d57b0d.

---

 src/egl/main/eglmisc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index a595e3f..f8ba5f3 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -147,7 +147,7 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint 
name)
   return _EGL_VENDOR_STRING;
case EGL_VERSION:
   _eglsnprintf(dpy-VersionString, sizeof(dpy-VersionString),
-  %d.%d (%s), dpy-VersionMajor, dpy-VersionMajor,
+  %d.%d (%s), dpy-VersionMajor, dpy-VersionMinor,
   dpy-Driver-Name);
   return dpy-VersionString;
case EGL_EXTENSIONS:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): targets/egl-static: New EGL target for scons.

2011-01-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 49ed5bb28d501cd6751bd59dc25a60a4293bcd75
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=49ed5bb28d501cd6751bd59dc25a60a4293bcd75

Author: Chia-I Wu o...@lunarg.com
Date:   Mon Jan 10 12:39:46 2011 +0800

targets/egl-static: New EGL target for scons.

This target is based on and replaces egl-gdi.  It is suitable for both
windows and x11.

---

 src/egl/main/egldriver.c   |   20 ++-
 src/gallium/targets/egl-gdi/SConscript |   55 -
 .../{egl-gdi/egl-static.c = egl-static/egl.c} |  122 +--
 src/gallium/targets/egl-static/egl_pipe.c  |  216 
 src/gallium/targets/egl-static/egl_pipe.h  |   40 
 src/gallium/targets/egl-static/egl_st.c|  105 ++
 src/gallium/targets/egl-static/egl_st.h|   40 
 7 files changed, 469 insertions(+), 129 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 62c5695..46876d0 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -141,9 +141,6 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
if (!lib) {
   _eglLog(_EGL_WARNING, Could not open driver %s (%s),
   driverPath, error);
-  if (!getenv(EGL_DRIVER))
- _eglLog(_EGL_WARNING,
- The driver can be overridden by setting EGL_DRIVER);
   return NULL;
}
 
@@ -468,6 +465,19 @@ _eglAddUserDriver(void)
 
 
 /**
+ * Add egl_gallium to the module array.
+ */
+static void
+_eglAddGalliumDriver(void)
+{
+#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM
+   void *external = (void *) egl_gallium;
+   _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external);
+#endif
+}
+
+
+/**
  * Add built-in drivers to the module array.
  */
 static void
@@ -491,14 +501,12 @@ _eglAddBuiltInDrivers(void)
 static EGLBoolean
 _eglAddDrivers(void)
 {
-   void *external = (void *) egl_gallium;
-
if (_eglModules)
   return EGL_TRUE;
 
/* the order here decides the priorities of the drivers */
_eglAddUserDriver();
-   _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external);
+   _eglAddGalliumDriver();
_eglAddBuiltInDrivers();
 
return (_eglModules != NULL);
diff --git a/src/gallium/targets/egl-gdi/SConscript 
b/src/gallium/targets/egl-gdi/SConscript
deleted file mode 100644
index d52eeb7..000
--- a/src/gallium/targets/egl-gdi/SConscript
+++ /dev/null
@@ -1,55 +0,0 @@
-###
-# SConscript for egl-gdi target
-
-Import('*')
-
-env = env.Clone()
-
-env.Append(CPPPATH = [
-'#/src/gallium/state_trackers/egl',
-'#/src/gallium/state_trackers/vega',
-'#/src/egl/main',
-'#/src/mesa',
-])
-
-env.Append(CPPDEFINES = [
-'FEATURE_VG=1',
-'GALLIUM_SOFTPIPE',
-'GALLIUM_RBUG',
-'GALLIUM_TRACE',
-])
-
-env.Append(LIBS = [
-'gdi32',
-'user32',
-'kernel32',
-'ws2_32',
-])
-
-env.Prepend(LIBS = [
-st_egl_gdi,
-ws_gdi,
-identity,
-trace,
-rbug,
-softpipe,
-vgapi,
-st_vega,
-gallium,
-egl,
-])
-
-if env['llvm']:
-env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-env.Prepend(LIBS = [llvmpipe])
-
-egl_gallium = env.SharedLibrary(
-target ='egl_gallium',
-source = 'egl-static.c',
-)
-
-env['no_import_lib'] = 1
-
-egl_gdi = env.InstallSharedLibrary(egl_gallium)
-
-env.Alias('egl-gdi', egl_gdi)
diff --git a/src/gallium/targets/egl-gdi/egl-static.c 
b/src/gallium/targets/egl-static/egl.c
similarity index 52%
rename from src/gallium/targets/egl-gdi/egl-static.c
rename to src/gallium/targets/egl-static/egl.c
index da6e5ce..e617ff5 100644
--- a/src/gallium/targets/egl-gdi/egl-static.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.9
+ * Version:  7.10
  *
- * Copyright (C) 2010 LunarG Inc.
+ * Copyright (C) 2010-2011 LunarG Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the Software),
@@ -27,41 +27,29 @@
  */
 
 #include common/egl_g3d_loader.h
-#include state_tracker/st_gl_api.h
-#include vg_api.h
-#include target-helpers/inline_sw_helper.h
-#include target-helpers/inline_debug_helper.h
 #include egldriver.h
 
-static struct st_api *stapis[ST_API_COUNT];
+#include egl_pipe.h
+#include egl_st.h
+
+static struct egl_g3d_loader egl_g3d_loader;
+
+static struct st_module {
+   boolean initialized;
+   struct st_api *stapi;
+} st_modules[ST_API_COUNT];
 
 static struct st_api *
 get_st_api(enum st_api_type api)
 {
-   struct st_api *stapi;
+   struct st_module *stmod = st_modules[api];
 
-   stapi = stapis[api];
-   if (stapi)
-  return stapi;
-
-   switch (api) {
-#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
-   case ST_API_OPENGL:
-  stapi = st_gl_api_create();
-  break;
-#endif
-#if FEATURE_VG
-   case

Mesa (master): egl_dri2: Fix eglGetProcAddress.

2011-01-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 39812c48dfb18e6c3b896db8a8395eeebef8cc1b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=39812c48dfb18e6c3b896db8a8395eeebef8cc1b

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jan 12 18:06:47 2011 +0800

egl_dri2: Fix eglGetProcAddress.

The driver struct is zeroed after dri2_load.  Oops.

---

 src/egl/drivers/dri2/egl_dri2.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 8967969..458d18f 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2382,10 +2382,11 @@ _EGL_MAIN(const char *args)
if (!dri2_drv)
   return NULL;
 
+   memset(dri2_drv, 0, sizeof *dri2_drv);
+
if (!dri2_load(dri2_drv-base))
   return NULL;
 
-   memset(dri2_drv, 0, sizeof *dri2_drv);
_eglInitDriverFallbacks(dri2_drv-base);
dri2_drv-base.API.Initialize = dri2_initialize;
dri2_drv-base.API.Terminate = dri2_terminate;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: libEGL depends on LOCAL_LIBS.

2011-01-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 4924cb9036cfe0f435a4a09db6f86d59a3a132d8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4924cb9036cfe0f435a4a09db6f86d59a3a132d8

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jan 12 18:09:12 2011 +0800

egl: libEGL depends on LOCAL_LIBS.

So that libEGL is rebuilt whenever LOCAL_LIBS changes.

---

 src/egl/main/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 0eb309c..c710631 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -93,7 +93,7 @@ default: depend library
 # EGL Library
 library: $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME)
 
-$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS)
+$(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS)
$(MKLIB) -o $(EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(EGL_MAJOR) -minor $(EGL_MINOR) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: When EGL_DRIVER is set, do not add other drivers.

2011-01-12 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 1e4f412242391000eea3fd28452865c3d27f987d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e4f412242391000eea3fd28452865c3d27f987d

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jan 12 17:49:43 2011 +0800

egl: When EGL_DRIVER is set, do not add other drivers.

Setting EGL_DRIVER forces the driver to be loaded, as documented.  There
should be no fallbacks.

---

 src/egl/main/egldriver.c |   19 ++-
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index b7c3de3..0f2e40a 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -432,7 +432,7 @@ _eglGetSearchPath(void)
  *
  * The user driver is specified by EGL_DRIVER.
  */
-static void
+static EGLBoolean
 _eglAddUserDriver(void)
 {
const char *search_path = _eglGetSearchPath();
@@ -463,7 +463,11 @@ _eglAddUserDriver(void)
mod-BuiltIn = _eglBuiltInDrivers[i].main;
  }
   }
+
+  return EGL_TRUE;
}
+
+   return EGL_FALSE;
 }
 
 
@@ -507,10 +511,14 @@ _eglAddDrivers(void)
if (_eglModules)
   return EGL_TRUE;
 
-   /* the order here decides the priorities of the drivers */
-   _eglAddUserDriver();
-   _eglAddGalliumDriver();
-   _eglAddBuiltInDrivers();
+   if (!_eglAddUserDriver()) {
+  /*
+   * Add other drivers only when EGL_DRIVER is not set.  The order here
+   * decides the priorities.
+   */
+  _eglAddGalliumDriver();
+  _eglAddBuiltInDrivers();
+   }
 
return (_eglModules != NULL);
 }
@@ -535,6 +543,7 @@ _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean use_probe)
 
if (!_eglAddDrivers()) {
   _eglUnlockMutex(_eglModuleMutex);
+  _eglLog(_EGL_WARNING, failed to find any driver);
   return EGL_FALSE;
}
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl_dri2: Look up _glapi_get_proc_address dynamically.

2011-01-09 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: fef5d14494ff19ea302e247ba593e189a8ab62bd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fef5d14494ff19ea302e247ba593e189a8ab62bd

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan  7 15:02:41 2011 +0800

egl_dri2: Look up _glapi_get_proc_address dynamically.

In preparation for making egl_dri2 built-in.  It also handles

  symbol lookup error: /usr/local/lib/egl/egl_dri2.so: undefined symbol:
  _glapi_get_proc_address

more gracefully.

---

 src/egl/drivers/dri2/Makefile   |2 +-
 src/egl/drivers/dri2/egl_dri2.c |   60 +--
 2 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index 8a3c9b6..ec4d1bc 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -15,6 +15,6 @@ EGL_INCLUDES = \
$(LIBUDEV_CFLAGS) \
$(LIBDRM_CFLAGS)
 
-EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(LIBDRM_LIBS)
+EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
 
 include ../Makefile.template
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 7592984..5223298 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -47,7 +47,6 @@
 #include libudev.h
 #endif
 
-#include glapi/glapi.h
 #include eglconfig.h
 #include eglcontext.h
 #include egldisplay.h
@@ -63,6 +62,7 @@ struct dri2_egl_driver
 {
_EGLDriver base;
 
+   _EGLProc (*get_proc_address)(const char *procname);
void (*glFlush)(void);
 };
 
@@ -1867,11 +1867,9 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *draw,
 static _EGLProc
 dri2_get_proc_address(_EGLDriver *drv, const char *procname)
 {
-   (void) drv;
-
-   /* FIXME: Do we need to support lookup of EGL symbols too? */
+   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
 
-   return (_EGLProc) _glapi_get_proc_address(procname);
+   return dri2_drv-get_proc_address(procname);
 }
 
 static EGLBoolean
@@ -1903,13 +1901,6 @@ dri2_wait_native(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint engine)
return EGL_TRUE;
 }
 
-static void
-dri2_unload(_EGLDriver *drv)
-{
-   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
-   free(dri2_drv);
-}
-
 static EGLBoolean
 dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
  EGLNativePixmapType target)
@@ -2337,6 +2328,45 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLImage *img,
return EGL_TRUE;
 }
 
+static void
+dri2_unload(_EGLDriver *drv)
+{
+   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
+   free(dri2_drv);
+}
+
+static EGLBoolean
+dri2_load(_EGLDriver *drv)
+{
+   struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
+   void *handle;
+
+   handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
+   if (handle) {
+  dri2_drv-get_proc_address = (_EGLProc (*)(const char *))
+ dlsym(handle, _glapi_get_proc_address);
+  /* no need to keep a reference */
+  dlclose(handle);
+   }
+
+   /*
+* If glapi is not available, loading DRI drivers will fail.  Ideally, we
+* should load one of libGL, libGLESv1_CM, or libGLESv2 and go on.  But if
+* the app has loaded another one of them with RTLD_LOCAL, there may be
+* unexpected behaviors later because there will be two copies of glapi
+* (with global variables of the same names!) in the memory.
+*/
+   if (!dri2_drv-get_proc_address) {
+  _eglLog(_EGL_WARNING, DRI2: failed to find _glapi_get_proc_address);
+  return EGL_FALSE;
+   }
+
+   dri2_drv-glFlush = (void (*)(void))
+  dri2_drv-get_proc_address(glFlush);
+
+   return EGL_TRUE;
+}
+
 /**
  * This is the main entrypoint into the driver, called by libEGL.
  * Create a new _EGLDriver object and init its dispatch table.
@@ -2352,6 +2382,9 @@ _eglMain(const char *args)
if (!dri2_drv)
   return NULL;
 
+   if (!dri2_load(dri2_drv-base))
+  return NULL;
+
memset(dri2_drv, 0, sizeof *dri2_drv);
_eglInitDriverFallbacks(dri2_drv-base);
dri2_drv-base.API.Initialize = dri2_initialize;
@@ -2378,8 +2411,5 @@ _eglMain(const char *args)
dri2_drv-base.Name = DRI2;
dri2_drv-base.Unload = dri2_unload;
 
-   dri2_drv-glFlush =
-  (void (*)(void)) dri2_get_proc_address(dri2_drv-base, glFlush);
-
return dri2_drv-base;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl_glx: Load libGL dynamically.

2011-01-09 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 15f0223931e32ef5ff82b39a2b6c433400edbd9d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15f0223931e32ef5ff82b39a2b6c433400edbd9d

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan  7 13:42:15 2011 +0800

egl_glx: Load libGL dynamically.

This is a step forward for compatibility with really old GLX.  But the
real reason for making this change now is so that we can make egl_glx a
built-in driver without having to link to libGL.

---

 src/egl/drivers/glx/Makefile  |2 +-
 src/egl/drivers/glx/egl_glx.c |  343 -
 2 files changed, 238 insertions(+), 107 deletions(-)

diff --git a/src/egl/drivers/glx/Makefile b/src/egl/drivers/glx/Makefile
index d976b91..89981e6 100644
--- a/src/egl/drivers/glx/Makefile
+++ b/src/egl/drivers/glx/Makefile
@@ -11,6 +11,6 @@ EGL_INCLUDES = \
-I$(TOP)/src/egl/main
 
 EGL_CFLAGS = $(X11_CFLAGS)
-EGL_LIBS = $(X11_LIBS) -lGL
+EGL_LIBS = $(X11_LIBS) $(DLOPEN_LIBS)
 
 include ../Makefile.template
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 8ec7c48..db9109d 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -36,8 +36,8 @@
 #include stdlib.h
 #include string.h
 #include X11/Xlib.h
-#include GL/glx.h
-#include EGL/egl.h
+#include dlfcn.h
+#include GL/glx.h
 
 #include eglconfig.h
 #include eglcontext.h
@@ -54,10 +54,66 @@
 #error GL/glx.h must be equal to or greater than GLX 1.4
 #endif
 
+/* GLX 1.0 */
+typedef GLXContext (*GLXCREATECONTEXTPROC)( Display *dpy, XVisualInfo *vis, 
GLXContext shareList, Bool direct );
+typedef void (*GLXDESTROYCONTEXTPROC)( Display *dpy, GLXContext ctx );
+typedef Bool (*GLXMAKECURRENTPROC)( Display *dpy, GLXDrawable drawable, 
GLXContext ctx);
+typedef void (*GLXSWAPBUFFERSPROC)( Display *dpy, GLXDrawable drawable );
+typedef GLXPixmap (*GLXCREATEGLXPIXMAPPROC)( Display *dpy, XVisualInfo 
*visual, Pixmap pixmap );
+typedef void (*GLXDESTROYGLXPIXMAPPROC)( Display *dpy, GLXPixmap pixmap );
+typedef Bool (*GLXQUERYVERSIONPROC)( Display *dpy, int *maj, int *min );
+typedef int (*GLXGETCONFIGPROC)( Display *dpy, XVisualInfo *visual, int 
attrib, int *value );
+typedef void (*GLXWAITGLPROC)( void );
+typedef void (*GLXWAITXPROC)( void );
+
+/* GLX 1.1 */
+typedef const char *(*GLXQUERYEXTENSIONSSTRINGPROC)( Display *dpy, int screen 
);
+typedef const char *(*GLXQUERYSERVERSTRINGPROC)( Display *dpy, int screen, int 
name );
+typedef const char *(*GLXGETCLIENTSTRINGPROC)( Display *dpy, int name );
+
 /** subclass of _EGLDriver */
 struct GLX_egl_driver
 {
_EGLDriver Base;   /** base class */
+
+   void *handle;
+
+   /* GLX 1.0 */
+   GLXCREATECONTEXTPROC glXCreateContext;
+   GLXDESTROYCONTEXTPROC glXDestroyContext;
+   GLXMAKECURRENTPROC glXMakeCurrent;
+   GLXSWAPBUFFERSPROC glXSwapBuffers;
+   GLXCREATEGLXPIXMAPPROC glXCreateGLXPixmap;
+   GLXDESTROYGLXPIXMAPPROC glXDestroyGLXPixmap;
+   GLXQUERYVERSIONPROC glXQueryVersion;
+   GLXGETCONFIGPROC glXGetConfig;
+   GLXWAITGLPROC glXWaitGL;
+   GLXWAITXPROC glXWaitX;
+
+   /* GLX 1.1 */
+   GLXQUERYEXTENSIONSSTRINGPROC glXQueryExtensionsString;
+   GLXQUERYSERVERSTRINGPROC glXQueryServerString;
+   GLXGETCLIENTSTRINGPROC glXGetClientString;
+
+   /* GLX 1.3 or (GLX_SGI_make_current_read and GLX_SGIX_fbconfig) */
+   PFNGLXGETFBCONFIGSPROC glXGetFBConfigs;
+   PFNGLXGETFBCONFIGATTRIBPROC glXGetFBConfigAttrib;
+   PFNGLXGETVISUALFROMFBCONFIGPROC glXGetVisualFromFBConfig;
+   PFNGLXCREATEWINDOWPROC glXCreateWindow;
+   PFNGLXDESTROYWINDOWPROC glXDestroyWindow;
+   PFNGLXCREATEPIXMAPPROC glXCreatePixmap;
+   PFNGLXDESTROYPIXMAPPROC glXDestroyPixmap;
+   PFNGLXCREATEPBUFFERPROC glXCreatePbuffer;
+   PFNGLXDESTROYPBUFFERPROC glXDestroyPbuffer;
+   PFNGLXCREATENEWCONTEXTPROC glXCreateNewContext;
+   PFNGLXMAKECONTEXTCURRENTPROC glXMakeContextCurrent;
+
+   /* GLX 1.4 or GLX_ARB_get_proc_address */
+   PFNGLXGETPROCADDRESSPROC glXGetProcAddress;
+
+   /* GLX_SGIX_pbuffer */
+   PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX;
+   PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX;
 };
 
 
@@ -76,14 +132,9 @@ struct GLX_egl_display
EGLBoolean have_fbconfig;
EGLBoolean have_pbuffer;
 
-   /* GLX_SGIX_pbuffer */
-   PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX;
-   PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX;
-
/* workaround quirks of different GLX implementations */
EGLBoolean single_buffered_quirk;
EGLBoolean glx_window_quirk;
-
 };
 
 
@@ -168,19 +219,21 @@ static const struct {
 
 
 static EGLBoolean
-convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
+convert_fbconfig(struct GLX_egl_driver *GLX_drv,
+ struct GLX_egl_display *GLX_dpy, GLXFBConfig fbconfig,
  struct GLX_egl_config *GLX_conf)
 {
+   Display *dpy = GLX_dpy-dpy;
int err, attr, val;
unsigned i;
 
/* must have rgba bit */
-   err = glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, val

Mesa (master): mesa: Remove GLES overlay.

2011-01-09 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 12583174c53b23be6db1fb1cfa3dd1e8dbbd3c15
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12583174c53b23be6db1fb1cfa3dd1e8dbbd3c15

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan  7 17:24:16 2011 +0800

mesa: Remove GLES overlay.

With core mesa doing runtime API checks, GLES overlay is no longer
needed.  Make --enable-gles-overlay equivalent to --enable-gles[12].
There may still be places where compile-time checks are done.  They
could be fixed case by case.

---

 configs/autoconf.in|1 -
 configure.ac   |   33 +
 docs/egl.html  |   11 -
 docs/opengles.html |4 +-
 src/gallium/targets/egl/Makefile   |   24 +-
 src/gallium/targets/egl/egl.c  |   14 +-
 src/gallium/targets/egl/st_GLESv1_CM.c |8 ---
 src/gallium/targets/egl/st_GLESv2.c|8 ---
 src/mesa/Makefile  |   77 +---
 9 files changed, 18 insertions(+), 162 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index e2d70c6..3dceb1a 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -15,7 +15,6 @@ ASM_FLAGS = @ASM_FLAGS@
 PIC_FLAGS = @PIC_FLAGS@
 DEFINES = @DEFINES@
 API_DEFINES = @API_DEFINES@
-GLES_OVERLAY = @GLES_OVERLAY@
 CFLAGS = @CPPFLAGS@ @CFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
 CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
diff --git a/configure.ac b/configure.ac
index 08a8b61..c00ecd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -483,9 +483,9 @@ AC_ARG_ENABLE([gles2],
 [enable_gles2=no])
 AC_ARG_ENABLE([gles-overlay],
 [AS_HELP_STRING([--enable-gles-overlay],
-[build separate OpenGL ES only libraries @:@default=no@:@])],
-[enable_gles_overlay=$enableval],
-[enable_gles_overlay=no])
+[DEPRECATED.  Same as --enable-gles1 and --enable-gles2])],
+[enable_gles1=$enableval; enable_gles2=$enableval],
+[])
 
 AC_ARG_ENABLE([openvg],
 [AS_HELP_STRING([--enable-openvg],
@@ -506,13 +506,11 @@ fi
 if test x$enable_opengl = xno -a \
 x$enable_gles1 = xno -a \
 x$enable_gles2 = xno -a \
-x$enable_gles_overlay = xno -a \
 x$enable_openvg = xno; then
 AC_MSG_ERROR([at least one API should be enabled])
 fi
 
 API_DEFINES=
-GLES_OVERLAY=0
 if test x$enable_opengl = xno; then
 API_DEFINES=$API_DEFINES -DFEATURE_GL=0
 else
@@ -524,11 +522,7 @@ fi
 if test x$enable_gles2 = xyes; then
 API_DEFINES=$API_DEFINES -DFEATURE_ES2=1
 fi
-if test x$enable_gles_overlay = xyes; then
-GLES_OVERLAY=1
-fi
 AC_SUBST([API_DEFINES])
-AC_SUBST([GLES_OVERLAY])
 
 dnl
 dnl Driver configuration. Options are xlib, dri and osmesa right now.
@@ -596,12 +590,15 @@ if test x$enable_opengl = xyes; then
 CORE_DIRS=$CORE_DIRS mapi/glapi
 fi
 
-# build es1api and es2api if OpenGL ES is enabled
-case x$enable_gles1$enable_gles2$enable_gles_overlay in
-x*yes*)
-CORE_DIRS=$CORE_DIRS mapi/es1api mapi/es2api
-;;
-esac
+# build es1api if OpenGL ES 1.x is enabled
+if test x$enable_gles1 = xyes; then
+CORE_DIRS=$CORE_DIRS mapi/es1api
+fi
+
+# build es2api if OpenGL ES 2.x is enabled
+if test x$enable_gles2 = xyes; then
+CORE_DIRS=$CORE_DIRS mapi/es2api
+fi
 
 # build vgapi if OpenVG is enabled
 if test x$enable_openvg = xyes; then
@@ -609,7 +606,7 @@ if test x$enable_openvg = xyes; then
 fi
 
 # build glsl and mesa if OpenGL or OpenGL ES is enabled
-case x$enable_opengl$enable_gles1$enable_gles2$enable_gles_overlay in
+case x$enable_opengl$enable_gles1$enable_gles2 in
 x*yes*)
 CORE_DIRS=$CORE_DIRS glsl mesa
 ;;
@@ -1451,9 +1448,6 @@ x*yes*)
 EGL_CLIENT_APIS=$EGL_CLIENT_APIS '$(GL_LIB)'
 ;;
 esac
-if test x$enable_gles_overlay = xyes; then
-EGL_CLIENT_APIS=$EGL_CLIENT_APIS '$(GLESv1_CM_LIB) $(GLESv2_LIB)'
-fi
 if test x$enable_openvg = xyes; then
 EGL_CLIENT_APIS=$EGL_CLIENT_APIS '$(VG_LIB)'
 VG_LIB_DEPS=$VG_LIB_DEPS -lpthread
@@ -1746,7 +1740,6 @@ echo includedir:  $includedir
 dnl API info
 echo 
 echo OpenGL:  $enable_opengl (ES1: $enable_gles1 ES2: 
$enable_gles2)
-echo GLES overlay:$enable_gles_overlay
 echo OpenVG:  $enable_openvg
 
 dnl Driver info
diff --git a/docs/egl.html b/docs/egl.html
index a92f9d1..fb15086 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -88,17 +88,6 @@ internal library that supports multiple APIs./p
 
 /li
 
-licode--enable-gles-overlay/code
-
-pThis option enables OpenGL ES as separate internal libraries.  This is an
-alternative approach to enable OpenGL ES./p
-
-pThis is only supported by codeegl_gallium/code.  For systems using DRI
-drivers, code--enable-gles1/code and code--enable-gles2/code are
-suggested instead as all drivers will benefit./p
-
-/li
-
 licode--enable-openvg/code
 
 pOpenVG must be explicitly enabled by this option./p
diff --git a/docs/opengles.html b/docs

Mesa (master): egl: Make egl_dri2 and egl_glx built-in drivers.

2011-01-09 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: c98ea26e16b6458b4385d6558936696e4d099455
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c98ea26e16b6458b4385d6558936696e4d099455

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Jan  7 16:30:08 2011 +0800

egl: Make egl_dri2 and egl_glx built-in drivers.

These two drivers are small in size.  Making them built-in should
simplify packaging.

---

 configure.ac  |2 +-
 docs/egl.html |7 +-
 src/egl/Makefile  |2 +-
 src/egl/drivers/Makefile.template |   30 ++--
 src/egl/drivers/dri2/Makefile |5 +-
 src/egl/drivers/dri2/egl_dri2.c   |2 +-
 src/egl/drivers/glx/Makefile  |5 +-
 src/egl/drivers/glx/egl_glx.c |2 +-
 src/egl/main/Makefile |   16 -
 src/egl/main/egldriver.c  |  135 ++---
 src/egl/main/egldriver.h  |8 ++
 11 files changed, 111 insertions(+), 103 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2a05c..08a8b61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1783,7 +1783,7 @@ if test $enable_egl = yes; then
 
 egl_drivers=
 for d in $EGL_DRIVERS_DIRS; do
-egl_drivers=$egl_drivers egl_$d
+egl_drivers=$egl_drivers builtin:egl_$d
 done
 
 if test $enable_gallium = yes -a $HAVE_ST_EGL = yes; then
diff --git a/docs/egl.html b/docs/egl.html
index 33e9187..a92f9d1 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -148,9 +148,10 @@ may set/p
 
 licodeEGL_DRIVER/code
 
-pThis variable specifies a full path to an EGL driver and it forces the
-specified EGL driver to be loaded.  It comes in handy when one wants to test a
-specific driver.  This variable is ignored for setuid/setgid binaries./p
+pThis variable specifies a full path to or the name of an EGL driver.  It
+forces the specified EGL driver to be loaded.  It comes in handy when one wants
+to test a specific driver.  This variable is ignored for setuid/setgid
+binaries./p
 
 /li
 
diff --git a/src/egl/Makefile b/src/egl/Makefile
index 5b09e17..50f227f 100644
--- a/src/egl/Makefile
+++ b/src/egl/Makefile
@@ -3,7 +3,7 @@
 TOP = ../..
 include $(TOP)/configs/current
 
-SUBDIRS = main drivers
+SUBDIRS = drivers main
 
 
 default: subdirs
diff --git a/src/egl/drivers/Makefile.template 
b/src/egl/drivers/Makefile.template
index 47709e3..76dbe26 100644
--- a/src/egl/drivers/Makefile.template
+++ b/src/egl/drivers/Makefile.template
@@ -2,6 +2,7 @@
 #
 # Drivers should define
 #
+# EGL_BUILTIN, the driver is built-in or external
 # EGL_DRIVER, the driver name
 # EGL_SOURCES, the driver sources
 # EGL_INCLUDES, the include pathes
@@ -12,32 +13,45 @@
 #
 
 
-EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER)
+EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER).so
 EGL_OBJECTS = $(EGL_SOURCES:.c=.o)
 
+# built-in or external
+ifeq ($(EGL_BUILTIN),true)
+EGL_TARGET = lib$(EGL_DRIVER).a
+EGL_INSTALL =
+else
+EGL_TARGET = $(EGL_DRIVER_PATH)
+EGL_INSTALL = install-so
+endif
 
-default: depend $(EGL_DRIVER_PATH)
+default: depend $(EGL_TARGET)
 
-$(EGL_DRIVER_PATH): $(EGL_DRIVER)
+$(EGL_DRIVER_PATH): $(EGL_DRIVER).so
@$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
$(INSTALL) $ $(TOP)/$(LIB_DIR)/egl
 
-$(EGL_DRIVER): $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
-   @$(MKLIB) -o $(EGL_DRIVER) -noprefix \
+$(EGL_DRIVER).so: $(EGL_OBJECTS) Makefile 
$(TOP)/src/egl/drivers/Makefile.template
+   @$(MKLIB) -o $(EGL_DRIVER).so -noprefix \
-linker '$(CC)' -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
$(MKLIB_OPTIONS) \
$(EGL_OBJECTS) $(EGL_LIBS) -l$(EGL_LIB)
 
+lib$(EGL_DRIVER).a: $(EGL_OBJECTS) Makefile 
$(TOP)/src/egl/drivers/Makefile.template
+   @$(MKLIB) -o $(EGL_DRIVER) -static $(EGL_OBJECTS)
+
 .c.o:
$(CC) -c $(EGL_INCLUDES) $(CFLAGS) $(EGL_CFLAGS) $ -o $@
 
-
-install: $(EGL_DRIVER_PATH)
+install-so: $(EGL_DRIVER_PATH)
$(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
$(MINSTALL) $(EGL_DRIVER_PATH) $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
 
+install: $(EGL_INSTALL)
+
 clean:
-   rm -f $(EGL_DRIVER)
+   rm -f $(EGL_DRIVER).so
+   rm -f lib$(EGL_DRIVER).a
rm -f $(EGL_OBJECTS)
rm -f depend depend.bak
 
diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index ec4d1bc..553ee87 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -3,7 +3,7 @@
 TOP = ../../../..
 include $(TOP)/configs/current
 
-EGL_DRIVER = egl_dri2.so
+EGL_DRIVER = egl_dri2
 EGL_SOURCES = egl_dri2.c
 
 EGL_INCLUDES = \
@@ -17,4 +17,7 @@ EGL_INCLUDES = \
 
 EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
 
+EGL_CFLAGS = -D_EGL_MAIN=_eglBuiltInDriverDRI2
+EGL_BUILTIN = true
+
 include ../Makefile.template
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 5223298..8967969 100644
--- a/src/egl/drivers/dri2/egl_dri2.c

Mesa (master): st/egl: Fix a void pointer arithmetic warning.

2011-01-09 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 97e9a0e23f0e06d020883c37b9d065e8978a47f4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=97e9a0e23f0e06d020883c37b9d065e8978a47f4

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Jan  9 18:18:03 2011 +0800

st/egl: Fix a void pointer arithmetic warning.

---

 src/gallium/state_trackers/egl/x11/native_dri2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index adcc3b3..c82e2da 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -799,7 +799,7 @@ dri2_display_hash_table_hash(void *key)
 static int
 dri2_display_hash_table_compare(void *key1, void *key2)
 {
-   return (key1 - key2);
+   return ((char *) key1 - (char *) key2);
 }
 
 struct native_display *

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.9): egl: Check extensions.

2011-01-07 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: 110c49fddd7a111288946255477ea3a354db49e8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=110c49fddd7a111288946255477ea3a354db49e8

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Sep 24 02:42:15 2010 +0800

egl: Check extensions.

Do not call into the driver if the extension for the called function is
not enabled.
(cherry picked from commit 6b2f1561ad66c358a5d6b7a5ed5eb8f550a3b098)

---

 src/egl/main/eglapi.c |   52 ++--
 1 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 829d700..e8f856f 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -402,10 +402,15 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, 
EGLContext share_list,
_EGLContext *context;
EGLContext ret;
 
-   if (config)
-  _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
-   else
-  _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
+   _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
+
+   if (!config) {
+  /* config may be NULL if surfaceless */
+  if (!disp-Extensions.KHR_surfaceless_gles1 
+  !disp-Extensions.KHR_surfaceless_gles2 
+  !disp-Extensions.KHR_surfaceless_opengl)
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+   }
 
if (!share  share_list != EGL_NO_CONTEXT)
   RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
@@ -459,9 +464,19 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface 
read,
 
if (!context  ctx != EGL_NO_CONTEXT)
   RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
-   if ((!draw_surf  draw != EGL_NO_SURFACE) ||
-   (!read_surf  read != EGL_NO_SURFACE))
-  RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+   if (!draw_surf || !read_surf) {
+  /* surfaces may be NULL if surfaceless */
+  if (!disp-Extensions.KHR_surfaceless_gles1 
+  !disp-Extensions.KHR_surfaceless_gles2 
+  !disp-Extensions.KHR_surfaceless_opengl)
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+
+  if ((!draw_surf  draw != EGL_NO_SURFACE) ||
+  (!read_surf  read != EGL_NO_SURFACE))
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+  if (draw_surf || read_surf)
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
+   }
 
ret = drv-API.MakeCurrent(drv, disp, draw_surf, read_surf, context);
 
@@ -1276,6 +1291,8 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum 
target,
EGLImageKHR ret;
 
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
+   if (!disp-Extensions.KHR_image_base)
+  RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
if (!context  ctx != EGL_NO_CONTEXT)
   RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
 
@@ -1296,6 +1313,8 @@ eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
EGLBoolean ret;
 
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+   if (!disp-Extensions.KHR_image_base)
+  RETURN_EGL_EVAL(disp, EGL_FALSE);
if (!img)
   RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
 
@@ -1321,6 +1340,8 @@ eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const 
EGLint *attrib_list)
EGLSyncKHR ret;
 
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv);
+   if (!disp-Extensions.KHR_reusable_sync)
+  RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
 
sync = drv-API.CreateSyncKHR(drv, disp, type, attrib_list);
ret = (sync) ? _eglLinkSync(sync, disp) : EGL_NO_SYNC_KHR;
@@ -1338,6 +1359,8 @@ eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
EGLBoolean ret;
 
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+   assert(disp-Extensions.KHR_reusable_sync);
+
_eglUnlinkSync(s);
ret = drv-API.DestroySyncKHR(drv, disp, s);
 
@@ -1354,6 +1377,7 @@ eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, 
EGLint flags, EGLTimeKHR t
EGLint ret;
 
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+   assert(disp-Extensions.KHR_reusable_sync);
ret = drv-API.ClientWaitSyncKHR(drv, disp, s, flags, timeout);
 
RETURN_EGL_EVAL(disp, ret);
@@ -1369,6 +1393,7 @@ eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum 
mode)
EGLBoolean ret;
 
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+   assert(disp-Extensions.KHR_reusable_sync);
ret = drv-API.SignalSyncKHR(drv, disp, s, mode);
 
RETURN_EGL_EVAL(disp, ret);
@@ -1384,6 +1409,7 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, 
EGLint attribute, EGLint *v
EGLBoolean ret;
 
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+   assert(disp-Extensions.KHR_reusable_sync);
ret = drv-API.GetSyncAttribKHR(drv, disp, s, attribute, value);
 
RETURN_EGL_EVAL(disp, ret);
@@ -1407,14 +1433,14 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface 
surface,
 
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
 
+   if (!disp-Extensions.NOK_swap_region)
+  RETURN_EGL_EVAL(disp, EGL_FALSE);
+
/* surface must be bound to current context in EGL 1.4 */
if (!ctx

Mesa (7.9): egl_glx: Fix borken driver.

2011-01-05 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: c438a09b4c1f9c886b83c81aabc0838503a426ee
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c438a09b4c1f9c886b83c81aabc0838503a426ee

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Jan  5 18:51:39 2011 +0800

egl_glx: Fix borken driver.

The driver was broken since 6eda3f311bc24999835003e404d5eda5599bc5de.
All configs fail to pass _eglValidateConfig.  This fix might not be
complete, but at least EGL demos run.

This fixes bug #32825.

---

 src/egl/drivers/glx/egl_glx.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index b2076e2..9805598 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -142,7 +142,6 @@ static const struct {
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_SAMPLE_BUFFERS,   EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES,  EGL_SAMPLES },
-   { GLX_RENDER_TYPE,  EGL_RENDERABLE_TYPE },
{ GLX_X_RENDERABLE, EGL_NATIVE_RENDERABLE },
{ GLX_X_VISUAL_TYPE,EGL_NATIVE_VISUAL_TYPE },
{ GLX_CONFIG_CAVEAT,EGL_CONFIG_CAVEAT },
@@ -218,6 +217,16 @@ convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
 
_eglSetConfigKey(GLX_conf-Base, EGL_SURFACE_TYPE, surface_type);
 
+   _eglSetConfigKey(GLX_conf-Base, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
+
+   glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_TYPE, val);
+   if (val == GLX_NONE) {
+  _eglSetConfigKey(GLX_conf-Base, EGL_TRANSPARENT_TYPE, EGL_NONE);
+  _eglSetConfigKey(GLX_conf-Base, EGL_TRANSPARENT_RED_VALUE, 0);
+  _eglSetConfigKey(GLX_conf-Base, EGL_TRANSPARENT_GREEN_VALUE, 0);
+  _eglSetConfigKey(GLX_conf-Base, EGL_TRANSPARENT_BLUE_VALUE, 0);
+   }
+
return EGL_TRUE;
 }
 
@@ -294,6 +303,7 @@ convert_visual(Display *dpy, XVisualInfo *vinfo,
   surface_type |= EGL_PIXMAP_BIT;
 
_eglSetConfigKey(GLX_conf-Base, EGL_SURFACE_TYPE, surface_type);
+   _eglSetConfigKey(GLX_conf-Base, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
 
_eglSetConfigKey(GLX_conf-Base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.10): docs: Add an example for EGL_DRIVERS_PATH.

2011-01-04 Thread Chia-I Wu
Module: Mesa
Branch: 7.10
Commit: ebcb7f27e5950041478d92c82f0f2419b35cdbd2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebcb7f27e5950041478d92c82f0f2419b35cdbd2

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jan  4 00:53:19 2011 +0800

docs: Add an example for EGL_DRIVERS_PATH.

EGL_DRIVERS_PATH can be set to test EGL without installation.
(cherry picked from commit cba77869547f8edb1c1fdafcf457bccc4097042b)

---

 docs/egl.html |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/docs/egl.html b/docs/egl.html
index ff610c3..33e9187 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -134,6 +134,16 @@ colon-separated directories where the main library will 
look for drivers, in
 addition to the default directory.  This variable is ignored for setuid/setgid
 binaries./p
 
+pThis variable is usually set to test an uninstalled build.  For example, one
+may set/p
+
+pre
+  $ export LD_LIBRARY_PATH=$mesa/lib
+  $ export EGL_DRIVERS_PATH=$mesa/lib/egl
+/pre
+
+pto test a build without installation/p
+
 /li
 
 licodeEGL_DRIVER/code

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.10): autoconf: Fix --with-driver=xlib --enable-openvg.

2011-01-04 Thread Chia-I Wu
Module: Mesa
Branch: 7.10
Commit: f5c13469320032fe894a95ce493fa64441aa341f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5c13469320032fe894a95ce493fa64441aa341f

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jan  4 01:05:22 2011 +0800

autoconf: Fix --with-driver=xlib --enable-openvg.

st/egl should be enabled with --enable-openvg even the driver is xlib or
osmesa.  Also, GLX_DIRECT_RENDERING should not be defined because libdrm
is not checked.
(cherry picked from commit ada9c78c29ef11720d464211c098b740f8aa11a4)

---

 configure.ac |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index bd81775..b451f7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1352,7 +1352,7 @@ if test x$enable_gallium_egl = xauto; then
 enable_gallium_egl=$enable_egl
 ;;
 *)
-enable_gallium_egl=no
+enable_gallium_egl=$enable_openvg
 ;;
 esac
 fi
@@ -1467,10 +1467,6 @@ AC_SUBST([EGL_CLIENT_APIS])
 
 if test x$HAVE_ST_EGL = xyes; then
GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS egl
-   # define GLX_DIRECT_RENDERING even when the driver is not dri
-   if test x$mesa_driver != xdri -a x$driglx_direct = xyes; then
-DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
-   fi
 fi
 
 if test x$HAVE_ST_XORG = xyes; then

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): docs: Add an example for EGL_DRIVERS_PATH.

2011-01-03 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: cba77869547f8edb1c1fdafcf457bccc4097042b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cba77869547f8edb1c1fdafcf457bccc4097042b

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jan  4 00:53:19 2011 +0800

docs: Add an example for EGL_DRIVERS_PATH.

EGL_DRIVERS_PATH can be set to test EGL without installation.

---

 docs/egl.html |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/docs/egl.html b/docs/egl.html
index ff610c3..33e9187 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -134,6 +134,16 @@ colon-separated directories where the main library will 
look for drivers, in
 addition to the default directory.  This variable is ignored for setuid/setgid
 binaries./p
 
+pThis variable is usually set to test an uninstalled build.  For example, one
+may set/p
+
+pre
+  $ export LD_LIBRARY_PATH=$mesa/lib
+  $ export EGL_DRIVERS_PATH=$mesa/lib/egl
+/pre
+
+pto test a build without installation/p
+
 /li
 
 licodeEGL_DRIVER/code

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): autoconf: Fix --with-driver=xlib --enable-openvg.

2011-01-03 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: ada9c78c29ef11720d464211c098b740f8aa11a4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ada9c78c29ef11720d464211c098b740f8aa11a4

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Jan  4 01:05:22 2011 +0800

autoconf: Fix --with-driver=xlib --enable-openvg.

st/egl should be enabled with --enable-openvg even the driver is xlib or
osmesa.  Also, GLX_DIRECT_RENDERING should not be defined because libdrm
is not checked.

---

 configure.ac |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index bd81775..b451f7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1352,7 +1352,7 @@ if test x$enable_gallium_egl = xauto; then
 enable_gallium_egl=$enable_egl
 ;;
 *)
-enable_gallium_egl=no
+enable_gallium_egl=$enable_openvg
 ;;
 esac
 fi
@@ -1467,10 +1467,6 @@ AC_SUBST([EGL_CLIENT_APIS])
 
 if test x$HAVE_ST_EGL = xyes; then
GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS egl
-   # define GLX_DIRECT_RENDERING even when the driver is not dri
-   if test x$mesa_driver != xdri -a x$driglx_direct = xyes; then
-DEFINES=$DEFINES -DGLX_DIRECT_RENDERING
-   fi
 fi
 
 if test x$HAVE_ST_XORG = xyes; then

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/egl: Fix eglChooseConfig when configs is NULL.

2010-12-26 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 9f2062fb12aa4e0d69583e88e70080efe70e1967
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f2062fb12aa4e0d69583e88e70080efe70e1967

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Dec 26 23:34:57 2010 +0800

st/egl: Fix eglChooseConfig when configs is NULL.

When configs is NULL, the app wants to know the number of matching
configs.

---

 .../state_trackers/egl/common/egl_g3d_api.c|8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index bce901a..c9f94a3 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -158,17 +158,17 @@ egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, 
const EGLint *attribs,
  (_EGLArrayForEach) egl_g3d_match_config, (void *) criteria);
 
/* perform sorting of configs */
-   if (tmp_configs  tmp_size) {
+   if (configs  tmp_size) {
   _eglSortConfigs((const _EGLConfig **) tmp_configs, tmp_size,
 egl_g3d_compare_config, (void *) criteria);
-  size = MIN2(tmp_size, size);
-  for (i = 0; i  size; i++)
+  tmp_size = MIN2(tmp_size, size);
+  for (i = 0; i  tmp_size; i++)
  configs[i] = _eglGetConfigHandle(tmp_configs[i]);
}
 
FREE(tmp_configs);
 
-   *num_configs = size;
+   *num_configs = tmp_size;
 
return EGL_TRUE;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (7.10): st/egl: Fix eglChooseConfig when configs is NULL.

2010-12-26 Thread Chia-I Wu
Module: Mesa
Branch: 7.10
Commit: fd2b11e433a36202e2890c8dd5a821d10bd4e8f6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd2b11e433a36202e2890c8dd5a821d10bd4e8f6

Author: Chia-I Wu o...@lunarg.com
Date:   Sun Dec 26 23:34:57 2010 +0800

st/egl: Fix eglChooseConfig when configs is NULL.

When configs is NULL, the app wants to know the number of matching
configs.
(cherry picked from commit 9f2062fb12aa4e0d69583e88e70080efe70e1967)

---

 .../state_trackers/egl/common/egl_g3d_api.c|8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index ef1c116..169a441 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -158,17 +158,17 @@ egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, 
const EGLint *attribs,
  (_EGLArrayForEach) egl_g3d_match_config, (void *) criteria);
 
/* perform sorting of configs */
-   if (tmp_configs  tmp_size) {
+   if (configs  tmp_size) {
   _eglSortConfigs((const _EGLConfig **) tmp_configs, tmp_size,
 egl_g3d_compare_config, (void *) criteria);
-  size = MIN2(tmp_size, size);
-  for (i = 0; i  size; i++)
+  tmp_size = MIN2(tmp_size, size);
+  for (i = 0; i  tmp_size; i++)
  configs[i] = _eglGetConfigHandle(tmp_configs[i]);
}
 
FREE(tmp_configs);
 
-   *num_configs = size;
+   *num_configs = tmp_size;
 
return EGL_TRUE;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: Store alias entry instead of alias name.

2010-12-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 86d29eab48b4ec8a972eec8a2a8179b5386a069e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86d29eab48b4ec8a972eec8a2a8179b5386a069e

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Dec 15 03:33:30 2010 +0800

mapi: Store alias entry instead of alias name.

An entry can hold more info than plain name.

---

 src/mapi/mapi/mapi_abi.py |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 3a87266..c295574 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -166,10 +166,13 @@ def abi_parse(filename):
 # post-process attributes
 if attrs['alias']:
 try:
-ent = entry_dict[attrs['alias']]
-slot = ent.slot
+alias = entry_dict[attrs['alias']]
 except KeyError:
 raise Exception('failed to alias %s' % attrs['alias'])
+if alias.alias:
+raise Exception('recursive alias %s' % ent.name)
+slot = alias.slot
+attrs['alias'] = alias
 else:
 slot = next_slot
 next_slot += 1
@@ -194,7 +197,7 @@ def abi_parse(filename):
 raise Exception('entries are not ordered by slots')
 if entries[i].alias:
 raise Exception('first entry of slot %d aliases %s'
-% (slot, entries[i].alias))
+% (slot, entries[i].alias.name))
 while i  len(entries) and entries[i].slot == slot:
 i += 1
 if i  len(entries):
@@ -374,7 +377,6 @@ class ABIPrinter(object):
 
 def c_asm_gcc(self, prefix):
 asm = []
-to_name = None
 
 asm.append('__asm__(')
 for ent in self.entries:
@@ -385,11 +387,11 @@ class ABIPrinter(object):
 
 if ent.alias:
 asm.append('.globl %s\\n' % (name))
-asm.append('.set %s, %s\\n' % (name, to_name))
+asm.append('.set %s, %s\\n' % (name,
+prefix + ent.alias.name))
 else:
 asm.append('STUB_ASM_ENTRY(%s)\\n' % (name))
 asm.append('\\tSTUB_ASM_CODE(%d)\\n' % (ent.slot))
-to_name = name
 asm.append(');')
 
 return \n.join(asm)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: Minor ABIPrinter refactoring.

2010-12-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 8eee1d522e006e1988b16e0cf40a086a7b7290ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8eee1d522e006e1988b16e0cf40a086a7b7290ba

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Dec 10 23:57:36 2010 +0800

mapi: Minor ABIPrinter refactoring.

Split out function name generation from _c_decl to _c_function, and use
it everywhere.  Add an optional 'export' argument to _cdecl.  It is
prepended to the returned string.

---

 src/mapi/mapi/mapi_abi.py |   53 +++-
 1 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index c295574..74d8a39 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -247,8 +247,9 @@ class ABIPrinter(object):
 
 def c_mapi_table_initializer(self, prefix):
 Return the array initializer for mapi_table_fill.
-entries = [ent.name for ent in self.entries if not ent.alias]
-pre = self.indent + '(mapi_proc) ' + prefix
+entries = [self._c_function(ent, prefix)
+for ent in self.entries if not ent.alias]
+pre = self.indent + '(mapi_proc) '
 return pre + (',\n' + pre).join(entries)
 
 def c_mapi_table_spec(self):
@@ -266,11 +267,19 @@ class ABIPrinter(object):
 
 return self.indent + self.indent.join(specv1)
 
-def _c_decl(self, ent, prefix, need_attr=True):
+def _c_function(self, ent, prefix, stringify=False):
+Return the function name of an entry.
+formats = { True: '%s%s', False: '%s%s' }
+fmt = formats[stringify]
+return fmt % (prefix, ent.name)
+
+def _c_decl(self, ent, prefix, export=''):
 Return the C declaration for the entry.
-decl = '%s %s %s%s(%s)' % (ent.c_return(), self.api_entry,
-prefix, ent.name, ent.c_params())
-if need_attr and self.api_attrs:
+decl = '%s %s %s(%s)' % (ent.c_return(), self.api_entry,
+self._c_function(ent, prefix), ent.c_params())
+if export:
+decl = export + ' ' + decl
+if self.api_attrs:
 decl += ' ' + self.api_attrs
 
 return decl
@@ -284,10 +293,10 @@ class ABIPrinter(object):
 
 def c_private_declarations(self, prefix):
 Return the declarations of private functions.
-decls = [self._c_decl(ent, prefix)
+decls = [self._c_decl(ent, prefix) + ';'
 for ent in self.entries if not ent.alias]
 
-return ;\n.join(decls) + ;
+return \n.join(decls)
 
 def c_public_dispatches(self, prefix):
 Return the public dispatch functions.
@@ -296,7 +305,7 @@ class ABIPrinter(object):
 if ent.hidden:
 continue
 
-proto = self.api_call + ' ' + self._c_decl(ent, prefix)
+proto = self._c_decl(ent, prefix, self.api_call)
 cast = self._c_cast(ent)
 
 ret = ''
@@ -337,8 +346,9 @@ class ABIPrinter(object):
 Return the initializer for struct mapi_stub array.
 stubs = []
 for ent in self.entries_sorted_by_names:
-stubs.append('%s{ (mapi_func) %s%s, %d, (void *) %d }' % (
-self.indent, prefix, ent.name, ent.slot, pool_offsets[ent]))
+stubs.append('%s{ (mapi_func) %s, %d, (void *) %d }' % (
+self.indent, self._c_function(ent, prefix),
+ent.slot, pool_offsets[ent]))
 
 return ',\n'.join(stubs)
 
@@ -349,10 +359,10 @@ class ABIPrinter(object):
 if ent.alias:
 continue
 
-proto = 'static ' + self._c_decl(ent, prefix)
+proto = self._c_decl(ent, prefix, 'static')
 
-stmt1 = self.indent + '%s(%s%s);' % (
-self.noop_warn, warn_prefix, ent.name)
+stmt1 = self.indent + '%s(%s);' % (self.noop_warn,
+self._c_function(ent, warn_prefix, True))
 
 if ent.ret:
 stmt2 = self.indent + 'return (%s) 0;' % (ent.ret)
@@ -366,7 +376,8 @@ class ABIPrinter(object):
 
 def c_noop_initializer(self, prefix, use_generic):
 Return an initializer for the noop dispatch table.
-entries = [prefix + ent.name for ent in self.entries if not ent.alias]
+entries = [self._c_function(ent, prefix)
+for ent in self.entries if not ent.alias]
 if use_generic:
 entries = [self.noop_generic] * len(entries)
 
@@ -380,17 +391,17 @@ class ABIPrinter(object):
 
 asm.append('__asm__(')
 for ent in self.entries:
-name = prefix + ent.name
+name = self._c_function(ent, prefix, True)
 
 if ent.hidden:
-asm.append('.hidden %s\\n' % (name))
+asm.append('.hidden %s\\n' % (name))
 
 if ent.alias:
-asm.append('.globl %s\\n' % (name))
-asm.append('.set %s, %s\\n' % (name

Mesa (master): mapi: Add handcode attribute to the script.

2010-12-24 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 52ca15334992cf7d37beaa17f120401ba4b4bcf4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=52ca15334992cf7d37beaa17f120401ba4b4bcf4

Author: Chia-I Wu o...@lunarg.com
Date:   Tue Dec  7 13:33:11 2010 +0800

mapi: Add handcode attribute to the script.

Entries with handcode attribute will be handled normally, except no
entry point will be generated for them.

---

 src/mapi/mapi/mapi_abi.py |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 74d8a39..0059171 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -45,6 +45,7 @@ class ABIEntry(object):
 self.slot = attrs['slot']
 self.hidden = attrs['hidden']
 self.alias = attrs['alias']
+self.handcode = attrs['handcode']
 
 def c_prototype(self):
 return '%s %s(%s)' % (self.c_return(), self.name, self.c_params())
@@ -132,6 +133,7 @@ def abi_parse_line(line):
 'slot': -1,
 'hidden': False,
 'alias': None,
+'handcode': None,
 }
 
 # extract attributes from the first column
@@ -144,6 +146,8 @@ def abi_parse_line(line):
 attrs['hidden'] = True
 elif val.startswith('alias='):
 attrs['alias'] = val[6:]
+elif val.startswith('handcode='):
+attrs['handcode'] = val[9:]
 elif not val:
 pass
 else:
@@ -198,7 +202,14 @@ def abi_parse(filename):
 if entries[i].alias:
 raise Exception('first entry of slot %d aliases %s'
 % (slot, entries[i].alias.name))
+handcode = None
 while i  len(entries) and entries[i].slot == slot:
+ent = entries[i]
+if not handcode and ent.handcode:
+handcode = ent.handcode
+elif ent.handcode != handcode:
+raise Exception('two aliases with handcode %s != %s',
+ent.handcode, handcode)
 i += 1
 if i  len(entries):
 raise Exception('there are %d invalid entries' % (len(entries) - 1))
@@ -320,6 +331,10 @@ class ABIPrinter(object):
 stmt3 += '%s((%s) func)(%s);' % (ret, cast, ent.c_args())
 
 disp = '%s\n{\n%s\n%s\n%s\n}' % (proto, stmt1, stmt2, stmt3)
+
+if ent.handcode:
+disp = '#if 0\n' + disp + '\n#endif'
+
 dispatches.append(disp)
 
 return '\n\n'.join(dispatches)
@@ -393,6 +408,9 @@ class ABIPrinter(object):
 for ent in self.entries:
 name = self._c_function(ent, prefix, True)
 
+if ent.handcode:
+asm.append('#if 0')
+
 if ent.hidden:
 asm.append('.hidden %s\\n' % (name))
 
@@ -403,6 +421,10 @@ class ABIPrinter(object):
 else:
 asm.append('STUB_ASM_ENTRY(%s)\\n' % (name))
 asm.append('\\tSTUB_ASM_CODE(%d)\\n' % (ent.slot))
+
+if ent.handcode:
+asm.append('#endif')
+asm.append('')
 asm.append(');')
 
 return \n.join(asm)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


<    2   3   4   5   6   7   8   9   10   11   >