Mesa (7.8): progs/demos: Add arbocclude2 to Makefile and .gitignore.

2010-03-05 Thread Vinson Lee
Module: Mesa
Branch: 7.8
Commit: ba8f4c5d36e6c9cd806a4c3360a8202b1f81ee05
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba8f4c5d36e6c9cd806a4c3360a8202b1f81ee05

Author: Vinson Lee 
Date:   Fri Mar  5 23:18:01 2010 -0800

progs/demos: Add arbocclude2 to Makefile and .gitignore.

---

 progs/demos/.gitignore |1 +
 progs/demos/Makefile   |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/progs/demos/.gitignore b/progs/demos/.gitignore
index 1b31866..aecdd9a 100644
--- a/progs/demos/.gitignore
+++ b/progs/demos/.gitignore
@@ -1,6 +1,7 @@
 arbfplight
 arbfslight
 arbocclude
+arbocclude2
 bounce
 clearspd
 copypix
diff --git a/progs/demos/Makefile b/progs/demos/Makefile
index 5b1d2a0..a13a272 100644
--- a/progs/demos/Makefile
+++ b/progs/demos/Makefile
@@ -15,6 +15,7 @@ PROGS = \
arbfplight \
arbfslight \
arbocclude \
+   arbocclude2 \
bounce \
clearspd \
copypix \

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


Mesa (master): dri: drop MINIGLX_SOURCES (2)

2010-03-05 Thread George Sapountzis
Module: Mesa
Branch: master
Commit: 419f0f9d0426bc1eb40ceb60e7764af4013947a0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=419f0f9d0426bc1eb40ceb60e7764af4013947a0

Author: George Sapountzis 
Date:   Sat Mar  6 06:33:21 2010 +0200

dri: drop MINIGLX_SOURCES (2)

---

 src/mesa/drivers/dri/i810/server/i810_dri.c |  975 -
 src/mesa/drivers/dri/i915/server/intel_dri.c|1 -
 src/mesa/drivers/dri/i965/server/intel_dri.c|1 -
 src/mesa/drivers/dri/intel/server/intel_dri.c   | 1306 --
 src/mesa/drivers/dri/mga/server/mga_dri.c   | 1088 --
 src/mesa/drivers/dri/r128/server/r128_dri.c | 1112 ---
 src/mesa/drivers/dri/r200/server/radeon_dri.c   |1 -
 src/mesa/drivers/dri/r300/server/radeon_dri.c   |1 -
 src/mesa/drivers/dri/r600/server/radeon_dri.c   |1 -
 src/mesa/drivers/dri/radeon/server/radeon_dri.c | 1337 ---
 src/mesa/drivers/dri/tdfx/server/tdfx_dri.c |  471 
 src/mesa/drivers/dri/unichrome/server/via_dri.c | 1251 -
 12 files changed, 0 insertions(+), 7545 deletions(-)

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


Mesa (master): dri: drop MINIGLX_SOURCES

2010-03-05 Thread George Sapountzis
Module: Mesa
Branch: master
Commit: 8953bfce0eb7e56f13d4527ef86cdf4cf2db037f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8953bfce0eb7e56f13d4527ef86cdf4cf2db037f

Author: George Sapountzis 
Date:   Sat Mar  6 06:33:20 2010 +0200

dri: drop MINIGLX_SOURCES

---

 src/mesa/drivers/dri/i810/Makefile  |3 ---
 src/mesa/drivers/dri/i915/Makefile  |2 --
 src/mesa/drivers/dri/i965/Makefile  |1 -
 src/mesa/drivers/dri/mach64/Makefile|3 ---
 src/mesa/drivers/dri/mga/Makefile   |2 --
 src/mesa/drivers/dri/nouveau/Makefile   |2 --
 src/mesa/drivers/dri/r128/Makefile  |2 --
 src/mesa/drivers/dri/r200/Makefile  |2 --
 src/mesa/drivers/dri/r300/Makefile  |2 --
 src/mesa/drivers/dri/r600/Makefile  |2 --
 src/mesa/drivers/dri/radeon/Makefile|2 --
 src/mesa/drivers/dri/savage/Makefile|3 ---
 src/mesa/drivers/dri/sis/Makefile   |4 
 src/mesa/drivers/dri/tdfx/Makefile  |3 ---
 src/mesa/drivers/dri/unichrome/Makefile |2 --
 15 files changed, 0 insertions(+), 35 deletions(-)

diff --git a/src/mesa/drivers/dri/i810/Makefile 
b/src/mesa/drivers/dri/i810/Makefile
index 3874fae..54a837d 100644
--- a/src/mesa/drivers/dri/i810/Makefile
+++ b/src/mesa/drivers/dri/i810/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
 
 LIBNAME = i810_dri.so
 
-# Not yet
-# MINIGLX_SOURCES = server/i810_dri.c 
-
 DRIVER_SOURCES = \
i810context.c \
i810ioctl.c \
diff --git a/src/mesa/drivers/dri/i915/Makefile 
b/src/mesa/drivers/dri/i915/Makefile
index dc15ae4..5b49d0c 100644
--- a/src/mesa/drivers/dri/i915/Makefile
+++ b/src/mesa/drivers/dri/i915/Makefile
@@ -4,8 +4,6 @@ include $(TOP)/configs/current
 
 LIBNAME = i915_dri.so
 
-MINIGLX_SOURCES = server/intel_dri.c
-
 DRIVER_SOURCES = \
i830_context.c \
i830_state.c \
diff --git a/src/mesa/drivers/dri/i965/Makefile 
b/src/mesa/drivers/dri/i965/Makefile
index f98a1a2..a242580 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -99,7 +99,6 @@ DRIVER_SOURCES = \
 
 C_SOURCES = \
$(COMMON_SOURCES) \
-   $(MINIGLX_SOURCES) \
$(DRIVER_SOURCES)
 
 ASM_SOURCES = 
diff --git a/src/mesa/drivers/dri/mach64/Makefile 
b/src/mesa/drivers/dri/mach64/Makefile
index a8f463e..c20fdec 100644
--- a/src/mesa/drivers/dri/mach64/Makefile
+++ b/src/mesa/drivers/dri/mach64/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
 
 LIBNAME = mach64_dri.so
 
-# Not yet
-# MINIGLX_SOURCES = server/mach64_dri.c 
-
 DRIVER_SOURCES = \
mach64_context.c \
mach64_ioctl.c \
diff --git a/src/mesa/drivers/dri/mga/Makefile 
b/src/mesa/drivers/dri/mga/Makefile
index 0cc329f..92533bc 100644
--- a/src/mesa/drivers/dri/mga/Makefile
+++ b/src/mesa/drivers/dri/mga/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
 
 LIBNAME = mga_dri.so
 
-MINIGLX_SOURCES = server/mga_dri.c 
-
 DRIVER_SOURCES = \
mgadd.c \
mgaioctl.c \
diff --git a/src/mesa/drivers/dri/nouveau/Makefile 
b/src/mesa/drivers/dri/nouveau/Makefile
index 49e8933..7be19b2 100644
--- a/src/mesa/drivers/dri/nouveau/Makefile
+++ b/src/mesa/drivers/dri/nouveau/Makefile
@@ -8,8 +8,6 @@ DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
 
 LIBNAME = nouveau_vieux_dri.so
 
-MINIGLX_SOURCES =
-
 DRIVER_SOURCES = \
nouveau_screen.c \
nouveau_context.c \
diff --git a/src/mesa/drivers/dri/r128/Makefile 
b/src/mesa/drivers/dri/r128/Makefile
index 52c5a38..8144c9b 100644
--- a/src/mesa/drivers/dri/r128/Makefile
+++ b/src/mesa/drivers/dri/r128/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
 
 LIBNAME = r128_dri.so
 
-MINIGLX_SOURCES = server/r128_dri.c 
-
 DRIVER_SOURCES = \
r128_context.c \
r128_lock.c \
diff --git a/src/mesa/drivers/dri/r200/Makefile 
b/src/mesa/drivers/dri/r200/Makefile
index 14eb96c..2e86e8b 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
 
 LIBNAME = r200_dri.so
 
-MINIGLX_SOURCES = server/radeon_dri.c 
-
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
diff --git a/src/mesa/drivers/dri/r300/Makefile 
b/src/mesa/drivers/dri/r300/Makefile
index 04459c2..08934fc 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
 
 LIBNAME = r300_dri.so
 
-MINIGLX_SOURCES = server/radeon_dri.c
-
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
diff --git a/src/mesa/drivers/dri/r600/Makefile 
b/src/mesa/drivers/dri/r600/Makefile
index 5d50941..2478b12 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
 
 LIBNAME = r600_dri.so
 
-MINIGLX_SOURCES = server/radeon_dri.c
-
 ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 end

Mesa (master): config: drop WINDOW_SYSTEM var

2010-03-05 Thread George Sapountzis
Module: Mesa
Branch: master
Commit: 9009a854d1e0a8682af50b34650e0de62f5fe3a3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9009a854d1e0a8682af50b34650e0de62f5fe3a3

Author: George Sapountzis 
Date:   Sat Mar  6 06:33:20 2010 +0200

config: drop WINDOW_SYSTEM var

---

 configs/autoconf.in|1 -
 configs/freebsd-dri|1 -
 configs/linux-dri  |1 -
 configs/linux-dri-xcb  |2 --
 configs/linux-egl  |1 -
 configs/linux-indirect |1 -
 configure.ac   |3 ---
 7 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 3063787..510d658 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -83,7 +83,6 @@ PROGRAM_DIRS = @PROGRAM_DIRS@
 
 # Driver specific build vars
 DRI_DIRS = @DRI_DIRS@ 
-WINDOW_SYSTEM = @WINDOW_SYSTEM@
 EGL_DISPLAYS = @EGL_DISPLAYS@
 
 # Dependencies
diff --git a/configs/freebsd-dri b/configs/freebsd-dri
index 0b91cfc..2c697e1 100644
--- a/configs/freebsd-dri
+++ b/configs/freebsd-dri
@@ -44,7 +44,6 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt 
-lX11
 SRC_DIRS = glx gallium mesa glu glut/glx glew glw
 DRIVER_DIRS = dri
 PROGRAM_DIRS = 
-WINDOW_SYSTEM=dri
 
 DRM_SOURCE_PATH=$(TOP)/../drm
 
diff --git a/configs/linux-dri b/configs/linux-dri
index e8e8ccf..b752739 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -58,7 +58,6 @@ PROGRAM_DIRS := egl $(PROGRAM_DIRS)
 EGL_DRIVERS_DIRS = glx
 
 DRIVER_DIRS = dri
-WINDOW_SYSTEM = dri
 GALLIUM_WINSYS_DIRS = drm
 GALLIUM_WINSYS_DRM_DIRS = vmware intel i965
 GALLIUM_STATE_TRACKERS_DIRS = egl
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index c5ed89c..1ed980a 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -51,7 +51,5 @@ SRC_DIRS = glx gallium mesa glu glut/glx glew glw
 PROGRAM_DIRS = xdemos
 
 DRIVER_DIRS = dri
-WINDOW_SYSTEM=dri
-
 DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
savage sis tdfx unichrome
diff --git a/configs/linux-egl b/configs/linux-egl
index 2c2834b..a891001 100644
--- a/configs/linux-egl
+++ b/configs/linux-egl
@@ -51,7 +51,6 @@ SRC_DIRS = gallium mesa gallium/winsys glu egl
 PROGRAM_DIRS = egl
 
 DRIVER_DIRS = dri
-WINDOW_SYSTEM = dri
 GALLIUM_WINSYS_DIRS = egl_drm
 
 DRI_DIRS = intel 
diff --git a/configs/linux-indirect b/configs/linux-indirect
index 0914fba..1c7dd85 100644
--- a/configs/linux-indirect
+++ b/configs/linux-indirect
@@ -50,4 +50,3 @@ GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm 
-lpthread -ldl
 SRC_DIRS = glx glu glut/glx glew glw
 DRIVER_DIRS =
 PROGRAM_DIRS = 
-WINDOW_SYSTEM=dri
diff --git a/configure.ac b/configure.ac
index 8ca2749..70e158f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -457,7 +457,6 @@ CORE_DIRS="glsl mesa"
 
 SRC_DIRS="glew"
 GLU_DIRS="sgi"
-WINDOW_SYSTEM=""
 GALLIUM_DIRS="auxiliary drivers state_trackers"
 GALLIUM_WINSYS_DIRS=""
 GALLIUM_WINSYS_DRM_DIRS=""
@@ -472,7 +471,6 @@ xlib)
 dri)
 SRC_DIRS="$SRC_DIRS glx"
 DRIVER_DIRS="dri"
-WINDOW_SYSTEM="dri"
 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
 ;;
 osmesa)
@@ -482,7 +480,6 @@ esac
 AC_SUBST([SRC_DIRS])
 AC_SUBST([GLU_DIRS])
 AC_SUBST([DRIVER_DIRS])
-AC_SUBST([WINDOW_SYSTEM])
 AC_SUBST([GALLIUM_DIRS])
 AC_SUBST([GALLIUM_WINSYS_DIRS])
 AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])

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


Mesa (master): docs: skeleton for 7.9 release notes

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 67277a6d118e0e9f3dadf108990d8fa5fe8cb63b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=67277a6d118e0e9f3dadf108990d8fa5fe8cb63b

Author: Brian Paul 
Date:   Fri Mar  5 17:36:34 2010 -0700

docs: skeleton for 7.9 release notes

---

 docs/relnotes-7.9.html |   50 
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/docs/relnotes-7.9.html b/docs/relnotes-7.9.html
new file mode 100644
index 000..f7d5016
--- /dev/null
+++ b/docs/relnotes-7.9.html
@@ -0,0 +1,50 @@
+
+
+Mesa Release Notes
+
+
+
+
+
+
+
+Mesa 7.9 Release Notes / date TBD
+
+
+Mesa 7.9 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.9.1.
+
+
+Mesa 7.9 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+
+
+See the Compiling/Installing page for prerequisites
+for DRI hardware acceleration.
+
+
+
+MD5 checksums
+
+tbd
+
+
+
+New features
+
+
+
+
+Bug fixes
+
+
+
+
+Changes
+
+
+
+
+

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


Mesa (master): mesa: bump version to 7.9

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6ce4a85e0b1d6581d73c1b1cbc37525d7a9ed1ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ce4a85e0b1d6581d73c1b1cbc37525d7a9ed1ba

Author: Brian Paul 
Date:   Fri Mar  5 17:35:01 2010 -0700

mesa: bump version to 7.9

Now that the 7.8 branch has been created Mesa/master will be version 7.9

---

 Makefile|2 +-
 configs/default |2 +-
 src/mesa/main/version.h |6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index c4ee9e5..92b227c 100644
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ ultrix-gcc:
 
 # Rules for making release tarballs
 
-VERSION=7.8-devel
+VERSION=7.9-devel
 DIRECTORY = Mesa-$(VERSION)
 LIB_NAME = MesaLib-$(VERSION)
 DEMO_NAME = MesaDemos-$(VERSION)
diff --git a/configs/default b/configs/default
index ad6d93c..4fe64cc 100644
--- a/configs/default
+++ b/configs/default
@@ -9,7 +9,7 @@ CONFIG_NAME = default
 
 # Version info
 MESA_MAJOR=7
-MESA_MINOR=8
+MESA_MINOR=9
 MESA_TINY=0
 MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
 
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index d521569..59f62eb 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.8
+ * Version:  7.9
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
@@ -33,9 +33,9 @@
 
 /* Mesa version */
 #define MESA_MAJOR 7
-#define MESA_MINOR 8
+#define MESA_MINOR 9
 #define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.8-devel"
+#define MESA_VERSION_STRING "7.9-devel"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

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


Mesa (7.8): glx: Move initialization of ext_list_first_time to where it' s storage is allocated

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: 7.8
Commit: ae7b3a632dd3f3b005459d77b66a77948260f716
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae7b3a632dd3f3b005459d77b66a77948260f716

Author: Brian Paul 
Date:   Fri Mar  5 17:32:36 2010 -0700

glx: Move initialization of ext_list_first_time to where it's storage is 
allocated

Move the initialization of ext_list_first_time from all of the DRI loader's
CreateScreen routines, to where the storage for the screen config is
allocated.

It needs to get set in the screen-config even if DRI is forced off
using LIBGL_ALWAYS_INDIRECT, so that psc->direct_support is initialized
correctly, otherwise __glXExtensionBitIsEnabled() always returns FALSE

Specifically, this causes a problem with an X server which advertises
GLX<=1.2, and the GLX_SGIX_fbconfig extension.
glXGetFBConfigFromVisualSGIX() uses __glXExtensionBitIsEnabled() to
check if the GLX_SGIX_fbconfig extension is available, but that function
won't return correct information because that data has never been
initialized, because ext_list_first_time was never set...

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

(cherry picked from commit 96ab4d2b84178209ee59017458d9964b32b7e183)

---

 src/glx/dri2_glx.c  |3 ---
 src/glx/dri_glx.c   |3 ---
 src/glx/drisw_glx.c |3 ---
 src/glx/glxext.c|3 +++
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index d573e46..5b0f335 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -519,9 +519,6 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
if (psp == NULL)
   return NULL;
 
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
&driverName, &deviceName)) {
   XFree(psp);
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index f9fe9a2..e47db82 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -648,9 +648,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
if (psp == NULL)
   return NULL;
 
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
if (!driGetDriverName(priv->dpy, screen, &driverName)) {
   Xfree(psp);
   return NULL;
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index eed9a8c..1b94a56 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -364,9 +364,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
if (psp == NULL)
   return NULL;
 
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL)
   goto handle_error;
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index c2de1a3..b5657ba 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -717,6 +717,9 @@ AllocAndFetchScreenConfigs(Display * dpy, 
__GLXdisplayPrivate * priv)
   if (psc->drawHash == NULL)
  continue;
 
+  /* Initialize per screen dynamic client GLX extensions */
+  psc->ext_list_first_time = GL_TRUE;
+
   if (priv->dri2Display)
  psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv);
 

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


Mesa (7.8): docs: remove merge conflict garbage

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: 7.8
Commit: c781e2841a25aeecac2f9af1a31ce129a530d796
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c781e2841a25aeecac2f9af1a31ce129a530d796

Author: Brian Paul 
Date:   Fri Mar  5 17:32:07 2010 -0700

docs: remove merge conflict garbage

---

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

diff --git a/docs/relnotes.html b/docs/relnotes.html
index f1f95c5..3e17a1e 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -13,7 +13,6 @@ The release notes summarize what's new or changed in each 
Mesa release.
 
 
 
-<<< HEAD:docs/relnotes.html
 7.8 release notes
 7.7.1 release notes
 7.7 release notes

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


Mesa (master): glx: Move initialization of ext_list_first_time to where it' s storage is allocated

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 96ab4d2b84178209ee59017458d9964b32b7e183
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96ab4d2b84178209ee59017458d9964b32b7e183

Author: Jon TURNEY 
Date:   Wed Jul  1 21:18:13 2009 +0100

glx: Move initialization of ext_list_first_time to where it's storage is 
allocated

Move the initialization of ext_list_first_time from all of the DRI loader's
CreateScreen routines, to where the storage for the screen config is
allocated.

It needs to get set in the screen-config even if DRI is forced off
using LIBGL_ALWAYS_INDIRECT, so that psc->direct_support is initialized
correctly, otherwise __glXExtensionBitIsEnabled() always returns FALSE

Specifically, this causes a problem with an X server which advertises
GLX<=1.2, and the GLX_SGIX_fbconfig extension.
glXGetFBConfigFromVisualSGIX() uses __glXExtensionBitIsEnabled() to
check if the GLX_SGIX_fbconfig extension is available, but that function
won't return correct information because that data has never been
initialized, because ext_list_first_time was never set...

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

---

 src/glx/dri2_glx.c  |3 ---
 src/glx/dri_glx.c   |3 ---
 src/glx/drisw_glx.c |3 ---
 src/glx/glxext.c|3 +++
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index d573e46..5b0f335 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -519,9 +519,6 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
if (psp == NULL)
   return NULL;
 
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
&driverName, &deviceName)) {
   XFree(psp);
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index f9fe9a2..e47db82 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -648,9 +648,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
if (psp == NULL)
   return NULL;
 
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
if (!driGetDriverName(priv->dpy, screen, &driverName)) {
   Xfree(psp);
   return NULL;
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index eed9a8c..1b94a56 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -364,9 +364,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
if (psp == NULL)
   return NULL;
 
-   /* Initialize per screen dynamic client GLX extensions */
-   psc->ext_list_first_time = GL_TRUE;
-
psc->driver = driOpenDriver(driverName);
if (psc->driver == NULL)
   goto handle_error;
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index c2de1a3..b5657ba 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -717,6 +717,9 @@ AllocAndFetchScreenConfigs(Display * dpy, 
__GLXdisplayPrivate * priv)
   if (psc->drawHash == NULL)
  continue;
 
+  /* Initialize per screen dynamic client GLX extensions */
+  psc->ext_list_first_time = GL_TRUE;
+
   if (priv->dri2Display)
  psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv);
 

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


Mesa (7.8): meta: Use the DrawBuffer's stencil size

2010-03-05 Thread Ian Romanick
Module: Mesa
Branch: 7.8
Commit: 77fc3ef9116fae6b8b53cda78d97c4ff1ec5c171
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77fc3ef9116fae6b8b53cda78d97c4ff1ec5c171

Author: Ian Romanick 
Date:   Wed Mar  3 17:20:27 2010 -0800

meta: Use the DrawBuffer's stencil size

Previously the code was erroneously using the stencil size of the
context instead of the stencil size of the DrawBuffer.  With FBOs
these may be different.  As a result, clearing the stencil buffer of
an FBO bound to a context that doesn't have stencil would fail.

Signed-off-by: Ian Romanick 

---

 src/mesa/drivers/common/meta.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 8e229bb..b97b760 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1895,7 +1895,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
   _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
   _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE);
 
-  for (bit = 0; bit < ctx->Visual.stencilBits; bit++) {
+  for (bit = 0; bit < ctx->DrawBuffer->Visual.stencilBits; bit++) {
  const GLuint mask = 1 << bit;
  if (mask & origStencilMask) {
 _mesa_StencilFunc(GL_ALWAYS, mask, mask);

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


Mesa (master): meta: Use the DrawBuffer's stencil size

2010-03-05 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 77fc3ef9116fae6b8b53cda78d97c4ff1ec5c171
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77fc3ef9116fae6b8b53cda78d97c4ff1ec5c171

Author: Ian Romanick 
Date:   Wed Mar  3 17:20:27 2010 -0800

meta: Use the DrawBuffer's stencil size

Previously the code was erroneously using the stencil size of the
context instead of the stencil size of the DrawBuffer.  With FBOs
these may be different.  As a result, clearing the stencil buffer of
an FBO bound to a context that doesn't have stencil would fail.

Signed-off-by: Ian Romanick 

---

 src/mesa/drivers/common/meta.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 8e229bb..b97b760 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1895,7 +1895,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
   _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
   _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE);
 
-  for (bit = 0; bit < ctx->Visual.stencilBits; bit++) {
+  for (bit = 0; bit < ctx->DrawBuffer->Visual.stencilBits; bit++) {
  const GLuint mask = 1 << bit;
  if (mask & origStencilMask) {
 _mesa_StencilFunc(GL_ALWAYS, mask, mask);

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


Mesa (master): swrast: Remove redundant test of the visual' s accumulation buffer size

2010-03-05 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 66c0abba6ba89d326555389d9539894402303286
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=66c0abba6ba89d326555389d9539894402303286

Author: Ian Romanick 
Date:   Wed Mar  3 17:17:56 2010 -0800

swrast: Remove redundant test of the visual's accumulation buffer size

If the visual doesn't have an accumulation buffer, the renderbuffer
passed into _swrast_clear_accum_buffer will be NULL anyway.  There is
no reason the check the visual.  Moreover, the test erroneously checks
the context's visual instead of the visual of the current DrawBuffer.
With FBOs these may be different.

Signed-off-by: Ian Romanick 

---

 src/mesa/swrast/s_accum.c |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index 2dd9ca6..854e106 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -130,11 +130,7 @@ _swrast_clear_accum_buffer( GLcontext *ctx, struct 
gl_renderbuffer *rb )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint x, y, width, height;
 
-   if (ctx->Visual.accumRedBits == 0) {
-  /* No accumulation buffer! Not an error. */
-  return;
-   }
-
+   /* No accumulation buffer! Not an error. */
if (!rb || !rb->Data)
   return;
 

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


Mesa (master): swrast: Adjust colors based on ReadBuffer visual, not context visual

2010-03-05 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: ebbec7e4e44fccf496a9a663bdcc643efead6e95
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebbec7e4e44fccf496a9a663bdcc643efead6e95

Author: Ian Romanick 
Date:   Wed Mar  3 17:16:11 2010 -0800

swrast: Adjust colors based on ReadBuffer visual, not context visual

In the presence of FBOs, the visual of the context may not match the,
possibly fake, visual of the current ReadBuffer.  Note that the caller
of adjust_colors correctly uses the visual of the ReadBuffer.

Signed-off-by: Ian Romanick 

---

 src/mesa/swrast/s_readpix.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index ecabac6..368311e 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -253,21 +253,21 @@ fast_read_rgba_pixels( GLcontext *ctx,
 /**
  * When we're using a low-precision color buffer (like 16-bit 5/6/5)
  * we have to adjust our color values a bit to pass conformance.
- * The problem is when a 5 or 6-bit color value is convert to an 8-bit
+ * The problem is when a 5 or 6-bit color value is converted to an 8-bit
  * value and then a floating point value, the floating point values don't
  * increment uniformly as the 5 or 6-bit value is incremented.
  *
  * This function adjusts floating point values to compensate.
  */
 static void
-adjust_colors(GLcontext *ctx, GLuint n, GLfloat rgba[][4])
+adjust_colors(const struct gl_framebuffer *fb, GLuint n, GLfloat rgba[][4])
 {
-   const GLuint rShift = 8 - ctx->Visual.redBits;
-   const GLuint gShift = 8 - ctx->Visual.greenBits;
-   const GLuint bShift = 8 - ctx->Visual.blueBits;
-   const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits  ) - 1);
-   const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1);
-   const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1);
+   const GLuint rShift = 8 - fb->Visual.redBits;
+   const GLuint gShift = 8 - fb->Visual.greenBits;
+   const GLuint bShift = 8 - fb->Visual.blueBits;
+   const GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits  ) - 1);
+   const GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1);
+   const GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1);
GLuint i;
for (i = 0; i < n; i++) {
   GLint r, g, b;
@@ -390,7 +390,7 @@ read_rgba_pixels( GLcontext *ctx,
  if (fb->Visual.redBits < 8 ||
  fb->Visual.greenBits < 8 ||
  fb->Visual.blueBits < 8) {
-adjust_colors(ctx, width, rgba);
+adjust_colors(fb, width, rgba);
  }
 
  /* pack the row of RGBA pixels into user's buffer */

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


Mesa (master): swrast: Remove stray comment that mentions ctx->Visual

2010-03-05 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: c67af0628b1b020b36df7dc81e9ab125da06b3a9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c67af0628b1b020b36df7dc81e9ab125da06b3a9

Author: Ian Romanick 
Date:   Wed Mar  3 17:14:55 2010 -0800

swrast: Remove stray comment that mentions ctx->Visual

Signed-off-by: Ian Romanick 

---

 src/mesa/swrast/s_linetemp.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index 182f962..033431d 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -84,7 +84,6 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex 
*vert1 )
DEPTH_TYPE *zPtr;
 #elif defined(INTERP_Z)
const GLint depthBits = ctx->DrawBuffer->Visual.depthBits;
-/*ctx->Visual.depthBits;*/
 #endif
 #ifdef PIXEL_ADDRESS
PIXEL_TYPE *pixelPtr;

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


Mesa (master): llvmpipe: added code to set texture depth, max mipmap levels info

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b5038fdd65535012086535c6a87bc56c91a65c87
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5038fdd65535012086535c6a87bc56c91a65c87

Author: Brian Paul 
Date:   Fri Mar  5 16:51:35 2010 -0700

llvmpipe: added code to set texture depth, max mipmap levels info

---

 src/gallium/drivers/llvmpipe/lp_jit.c |   10 +-
 src/gallium/drivers/llvmpipe/lp_jit.h |4 
 src/gallium/drivers/llvmpipe/lp_setup.c   |2 ++
 src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c |   12 
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c 
b/src/gallium/drivers/llvmpipe/lp_jit.c
index b666ffc..bacff50 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -51,10 +51,12 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
 
/* struct lp_jit_texture */
{
-  LLVMTypeRef elem_types[4];
+  LLVMTypeRef elem_types[6];
 
   elem_types[LP_JIT_TEXTURE_WIDTH]  = LLVMInt32Type();
   elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type();
+  elem_types[LP_JIT_TEXTURE_DEPTH] = LLVMInt32Type();
+  elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
   elem_types[LP_JIT_TEXTURE_STRIDE] = LLVMInt32Type();
   elem_types[LP_JIT_TEXTURE_DATA]   = LLVMPointerType(LLVMInt8Type(), 0);
 
@@ -66,6 +68,12 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, height,
  screen->target, texture_type,
  LP_JIT_TEXTURE_HEIGHT);
+  LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
+ screen->target, texture_type,
+ LP_JIT_TEXTURE_DEPTH);
+  LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
+ screen->target, texture_type,
+ LP_JIT_TEXTURE_LAST_LEVEL);
   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, stride,
  screen->target, texture_type,
  LP_JIT_TEXTURE_STRIDE);
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h 
b/src/gallium/drivers/llvmpipe/lp_jit.h
index 8df3015..0ebb282 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -48,6 +48,8 @@ struct lp_jit_texture
 {
uint32_t width;
uint32_t height;
+   uint32_t depth;
+   uint32_t last_level;
uint32_t stride;
const void *data;
 };
@@ -56,6 +58,8 @@ struct lp_jit_texture
 enum {
LP_JIT_TEXTURE_WIDTH = 0,
LP_JIT_TEXTURE_HEIGHT,
+   LP_JIT_TEXTURE_DEPTH,
+   LP_JIT_TEXTURE_LAST_LEVEL,
LP_JIT_TEXTURE_STRIDE,
LP_JIT_TEXTURE_DATA
 };
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c 
b/src/gallium/drivers/llvmpipe/lp_setup.c
index aebed85..b0713c3 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -469,6 +469,8 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
  jit_tex = &setup->fs.current.jit_context.textures[i];
  jit_tex->width = tex->width0;
  jit_tex->height = tex->height0;
+ jit_tex->depth = tex->depth0;
+ jit_tex->last_level = tex->last_level;
  jit_tex->stride = lp_tex->stride[0];
  if(!lp_tex->dt) {
 jit_tex->data = lp_tex->data;
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c 
b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
index 515c908..6324624 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
@@ -132,10 +132,12 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state 
*base,
}
 
 
-LP_LLVM_TEXTURE_MEMBER(width,LP_JIT_TEXTURE_WIDTH)
-LP_LLVM_TEXTURE_MEMBER(height,   LP_JIT_TEXTURE_HEIGHT)
-LP_LLVM_TEXTURE_MEMBER(stride,   LP_JIT_TEXTURE_STRIDE)
-LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA)
+LP_LLVM_TEXTURE_MEMBER(width,  LP_JIT_TEXTURE_WIDTH)
+LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT)
+LP_LLVM_TEXTURE_MEMBER(depth,  LP_JIT_TEXTURE_DEPTH)
+LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL)
+LP_LLVM_TEXTURE_MEMBER(stride, LP_JIT_TEXTURE_STRIDE)
+LP_LLVM_TEXTURE_MEMBER(data_ptr,   LP_JIT_TEXTURE_DATA)
 
 
 static void
@@ -189,6 +191,8 @@ lp_llvm_sampler_soa_create(const struct 
lp_sampler_static_state *static_state,
sampler->base.emit_fetch_texel = lp_llvm_sampler_soa_emit_fetch_texel;
sampler->dynamic_state.base.width = lp_llvm_texture_width;
sampler->dynamic_state.base.height = lp_llvm_texture_height;
+   sampler->dynamic_state.base.depth = lp_llvm_texture_depth;
+   sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
sampler->dynamic_state.base.stride = lp_llvm_texture_stride;
sampler->dynamic_state.base.data_ptr = lp_llvm_texture_data_ptr;
sampler->dynamic_state.static_state = sta

Mesa (master): gallivm: checkpoint: code gen for mipmap selection

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1a0a2b64ca150a97c96da2d4d97189c233dce407
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a0a2b64ca150a97c96da2d4d97189c233dce407

Author: Brian Paul 
Date:   Fri Mar  5 16:52:11 2010 -0700

gallivm: checkpoint: code gen for mipmap selection

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |   65 +
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 6b643fa..bc2f307 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1159,6 +1159,69 @@ lp_build_lod_selector(struct lp_build_sample_context 
*bld,
 }
 
 
+/**
+ * For PIPE_TEX_MIPFILTER_NEAREST, convert float LOD to integer
+ * mipmap level index.
+ * \param lod  scalar float texture level of detail
+ * \param level_out  returns integer 
+ */
+static void
+lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
+   unsigned unit,
+   LLVMValueRef lod,
+   LLVMValueRef *level_out)
+{
+   struct lp_build_context *coord_bld = &bld->coord_bld;
+   struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
+   LLVMValueRef last_level, level;
+
+   last_level = bld->dynamic_state->last_level(bld->dynamic_state,
+   bld->builder, unit);
+
+   /* convert float lod to integer */
+   level = lp_build_iround(coord_bld, lod);
+
+   /* clamp level to legal range of levels */
+   *level_out = lp_build_clamp(int_coord_bld, level,
+   int_coord_bld->zero,
+   last_level);
+}
+
+
+/**
+ * For PIPE_TEX_MIPFILTER_LINEAR, convert float LOD to integer to
+ * two (adjacent) mipmap level indexes.  Later, we'll sample from those
+ * two mipmap levels and interpolate between them.
+ */
+static void
+lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
+   unsigned unit,
+   LLVMValueRef lod,
+   LLVMValueRef *level0_out,
+   LLVMValueRef *level1_out,
+   LLVMValueRef *weight_out)
+{
+   struct lp_build_context *coord_bld = &bld->coord_bld;
+   struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
+   LLVMValueRef last_level, level;
+
+   last_level = bld->dynamic_state->last_level(bld->dynamic_state,
+   bld->builder, unit);
+
+   /* convert float lod to integer */
+   level = lp_build_ifloor(coord_bld, lod);
+
+   /* compute level 0 and clamp to legal range of levels */
+   *level0_out = lp_build_clamp(int_coord_bld, level,
+int_coord_bld->zero,
+last_level);
+   /* compute level 1 and clamp to legal range of levels */
+   *level1_out = lp_build_add(int_coord_bld, *level0_out, int_coord_bld->one);
+   *level1_out = lp_build_min(int_coord_bld, *level1_out, int_coord_bld->zero);
+
+   *weight_out = lp_build_fract(coord_bld, lod);
+}
+
 
 
 /**
@@ -1187,6 +1250,8 @@ lp_build_sample_soa(LLVMBuilderRef builder,
LLVMValueRef r;
 
(void) lp_build_lod_selector;   /* temporary to silence warning */
+   (void) lp_build_nearest_mip_level;
+   (void) lp_build_linear_mip_levels;
 
/* Setup our build context */
memset(&bld, 0, sizeof bld);

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


Mesa (master): gallivm: added methods for getting texture depth, num mipmap levels

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7f4b5c5387a3a8e3c5f31f0badc943c43857683a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f4b5c5387a3a8e3c5f31f0badc943c43857683a

Author: Brian Paul 
Date:   Fri Mar  5 16:50:48 2010 -0700

gallivm: added methods for getting texture depth, num mipmap levels

---

 src/gallium/auxiliary/gallivm/lp_bld_sample.h |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 2120775..5ba0925 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -100,6 +100,18 @@ struct lp_sampler_dynamic_state
   LLVMBuilderRef builder,
   unsigned unit);
 
+   /** Obtain the base texture depth. */
+   LLVMValueRef
+   (*depth)( struct lp_sampler_dynamic_state *state,
+ LLVMBuilderRef builder,
+ unsigned unit);
+
+   /** Obtain the number of mipmap levels (minus one). */
+   LLVMValueRef
+   (*last_level)( struct lp_sampler_dynamic_state *state,
+  LLVMBuilderRef builder,
+  unsigned unit);
+
LLVMValueRef
(*stride)( struct lp_sampler_dynamic_state *state,
   LLVMBuilderRef builder,

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


Mesa (master): gallivm: checkpoint: texture LOD computation code gen

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6bc644fe62adad6656be3f29c118045fc5630510
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6bc644fe62adad6656be3f29c118045fc5630510

Author: Brian Paul 
Date:   Fri Mar  5 16:07:54 2010 -0700

gallivm: checkpoint: texture LOD computation code gen

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |  129 -
 1 files changed, 126 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 2b04bec..6b643fa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1040,6 +1040,127 @@ lp_build_sample_compare(struct lp_build_sample_context 
*bld,
 }
 
 
+static int
+texture_dims(enum pipe_texture_target tex)
+{
+   switch (tex) {
+   case PIPE_TEXTURE_1D:
+  return 1;
+   case PIPE_TEXTURE_2D:
+   case PIPE_TEXTURE_CUBE:
+  return 2;
+   case PIPE_TEXTURE_3D:
+  return 3;
+   default:
+  assert(0 && "bad texture target in texture_dims()");
+  return 2;
+   }
+}
+
+
+/**
+ * Generate code to compute texture level of detail (lambda).
+ * \param s  vector of texcoord s values
+ * \param t  vector of texcoord t values
+ * \param r  vector of texcoord r values
+ * \param width  scalar int texture width
+ * \param height  scalar int texture height
+ * \param depth  scalar int texture depth
+ */
+static LLVMValueRef
+lp_build_lod_selector(struct lp_build_sample_context *bld,
+  LLVMValueRef s,
+  LLVMValueRef t,
+  LLVMValueRef r,
+  LLVMValueRef width,
+  LLVMValueRef height,
+  LLVMValueRef depth)
+
+{
+   const int dims = texture_dims(bld->static_state->target);
+   struct lp_build_context *coord_bld = &bld->coord_bld;
+
+   LLVMValueRef lod_bias = lp_build_const_scalar(bld->coord_bld.type,
+ bld->static_state->lod_bias);
+   LLVMValueRef min_lod = lp_build_const_scalar(bld->coord_bld.type,
+bld->static_state->min_lod);
+   LLVMValueRef max_lod = lp_build_const_scalar(bld->coord_bld.type,
+bld->static_state->max_lod);
+
+   LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+   LLVMValueRef index1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
+   LLVMValueRef index2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
+
+   LLVMValueRef s0, s1, s2;
+   LLVMValueRef t0, t1, t2;
+   LLVMValueRef r0, r1, r2;
+   LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
+   LLVMValueRef rho, lod;
+
+   /*
+* dsdx = abs(s[1] - s[0]);
+* dsdy = abs(s[2] - s[0]);
+* dtdx = abs(t[1] - t[0]);
+* dtdy = abs(t[2] - t[0]);
+* drdx = abs(r[1] - r[0]);
+* drdy = abs(r[2] - r[0]);
+* XXX we're assuming a four-element quad in 2x2 layout here.
+*/
+   s0 = LLVMBuildExtractElement(bld->builder, s, index0, "s0");
+   s1 = LLVMBuildExtractElement(bld->builder, s, index1, "s1");
+   s2 = LLVMBuildExtractElement(bld->builder, s, index2, "s2");
+   dsdx = lp_build_abs(coord_bld, lp_build_sub(coord_bld, s1, s0));
+   dsdy = lp_build_abs(coord_bld, lp_build_sub(coord_bld, s2, s0));
+   if (dims > 1) {
+  t0 = LLVMBuildExtractElement(bld->builder, t, index0, "t0");
+  t1 = LLVMBuildExtractElement(bld->builder, t, index1, "t1");
+  t2 = LLVMBuildExtractElement(bld->builder, t, index2, "t2");
+  dtdx = lp_build_abs(coord_bld, lp_build_sub(coord_bld, t1, t0));
+  dtdy = lp_build_abs(coord_bld, lp_build_sub(coord_bld, t2, t0));
+  if (dims > 2) {
+ r0 = LLVMBuildExtractElement(bld->builder, r, index0, "r0");
+ r1 = LLVMBuildExtractElement(bld->builder, r, index1, "r1");
+ r2 = LLVMBuildExtractElement(bld->builder, r, index2, "r2");
+ drdx = lp_build_abs(coord_bld, lp_build_sub(coord_bld, r1, r0));
+ drdy = lp_build_abs(coord_bld, lp_build_sub(coord_bld, r2, r0));
+  }
+   }
+
+   /* Compute rho = max of all partial derivatives scaled by texture size.
+* XXX this can be vectorized somewhat
+*/
+   rho = lp_build_mul(coord_bld,
+   lp_build_max(coord_bld, dsdx, dsdy),
+   lp_build_int_to_float(coord_bld, width));
+   if (dims > 1) {
+  LLVMValueRef max;
+  max = lp_build_mul(coord_bld,
+ lp_build_max(coord_bld, dtdx, dtdy),
+ lp_build_int_to_float(coord_bld, height));
+  rho = lp_build_max(coord_bld, rho, max);
+  if (dims > 2) {
+ max = lp_build_mul(coord_bld,
+lp_build_max(coord_bld, drdx, drdy),
+lp_build_int_to_float(coord_bld, depth));
+ rho = lp_build_max(coord_bld, rho, max);
+  }
+   }
+
+   /* compute lod = log2(rho) */
+   lod = lp_build_log2(coord_bld, rho);
+
+   /* add lod

Mesa (master): gallivm: added field for sampler lod

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 36a0c4219deaa1509ae9746abb845f9502ca9f1b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=36a0c4219deaa1509ae9746abb845f9502ca9f1b

Author: Brian Paul 
Date:   Fri Mar  5 16:07:26 2010 -0700

gallivm: added field for sampler lod

---

 src/gallium/auxiliary/gallivm/lp_bld_sample.c |9 +
 src/gallium/auxiliary/gallivm/lp_bld_sample.h |1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 55ac2e9..6a026e4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -75,14 +75,15 @@ lp_sampler_static_state(struct lp_sampler_static_state 
*state,
state->min_mip_filter= sampler->min_mip_filter;
state->mag_img_filter= sampler->mag_img_filter;
state->compare_mode  = sampler->compare_mode;
+   state->compare_func  = sampler->compare_func;
+   state->normalized_coords = sampler->normalized_coords;
+   state->lod_bias  = sampler->lod_bias;
+   state->min_lod   = sampler->min_lod;
+   state->max_lod   = sampler->max_lod;
state->border_color[0]   = sampler->border_color[0];
state->border_color[1]   = sampler->border_color[1];
state->border_color[2]   = sampler->border_color[2];
state->border_color[3]   = sampler->border_color[3];
-   if(sampler->compare_mode != PIPE_TEX_COMPARE_NONE) {
-  state->compare_func  = sampler->compare_func;
-   }
-   state->normalized_coords = sampler->normalized_coords;
 }
 
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index a791d88..2120775 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -70,6 +70,7 @@ struct lp_sampler_static_state
unsigned compare_mode:1;
unsigned compare_func:3;
unsigned normalized_coords:1;
+   float lod_bias, min_lod, max_lod;
float border_color[4];
 };
 

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


Mesa (master): i965: Only use the effective subset of the WM sampler key.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 8c8e664f1086e702e1102ee7f5043c8c12c037bd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c8e664f1086e702e1102ee7f5043c8c12c037bd

Author: Eric Anholt 
Date:   Fri Mar  5 14:13:24 2010 -0800

i965: Only use the effective subset of the WM sampler key.

The whole structure is 836 bytes, but if only the first one or two
samplers are used (as is common), the part that matters is only 56 or
108 bytes.  By using just that subset as the key (since the key size
is also part of the key), we improve firefox-talos-gfx performance by
1%.

---

 src/mesa/drivers/dri/i965/brw_wm_sampler_state.c |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 3a33996..d7650af 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -229,7 +229,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
GLcontext *ctx = &brw->intel.ctx;
int unit;
 
-   memset(key, 0, sizeof(*key));
+   key->sampler_count = 0;
 
for (unit = 0; unit < BRW_MAX_TEX_UNIT; unit++) {
   if (ctx->Texture.Unit[unit]._ReallyEnabled) {
@@ -240,6 +240,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
 struct gl_texture_image *firstImage =
texObj->Image[0][intelObj->firstLevel];
 
+memset(entry, 0, sizeof(*entry));
+
  entry->tex_target = texObj->Target;
 
 entry->seamless_cube_map = (texObj->Target == GL_TEXTURE_CUBE_MAP)
@@ -288,7 +290,7 @@ static void upload_wm_samplers( struct brw_context *brw )
 {
GLcontext *ctx = &brw->intel.ctx;
struct wm_sampler_key key;
-   int i;
+   int i, sampler_key_size;
 
brw_wm_sampler_populate_key(brw, &key);
 
@@ -302,8 +304,11 @@ static void upload_wm_samplers( struct brw_context *brw )
if (brw->wm.sampler_count == 0)
   return;
 
+   /* Only include the populated portion of the key in the search. */
+   sampler_key_size = offsetof(struct wm_sampler_key,
+  sampler[key.sampler_count]);
brw->wm.sampler_bo = brw_search_cache(&brw->cache, BRW_SAMPLER,
-&key, sizeof(key),
+&key, sampler_key_size,
 brw->wm.sdc_bo, key.sampler_count,
 NULL);
 
@@ -323,7 +328,7 @@ static void upload_wm_samplers( struct brw_context *brw )
   }
 
   brw->wm.sampler_bo = brw_upload_cache(&brw->cache, BRW_SAMPLER,
-   &key, sizeof(key),
+   &key, sampler_key_size,
brw->wm.sdc_bo, key.sampler_count,
&sampler, sizeof(sampler));
 

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


Mesa (master): intel: Remove support for the DRI1 TFP extension.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: a232cc59e3f8ac8462c23b1a83e0ba60b451e681
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a232cc59e3f8ac8462c23b1a83e0ba60b451e681

Author: Eric Anholt 
Date:   Fri Mar  5 13:48:41 2010 -0800

intel: Remove support for the DRI1 TFP extension.

---

 src/mesa/drivers/dri/i915/i830_texstate.c|   53 ++-
 src/mesa/drivers/dri/i915/i915_texstate.c|   38 +++--
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   63 ++
 src/mesa/drivers/dri/intel/intel_screen.c|6 --
 src/mesa/drivers/dri/intel/intel_tex.h   |2 -
 src/mesa/drivers/dri/intel/intel_tex_image.c |   23 
 src/mesa/drivers/dri/intel/intel_tex_obj.h   |4 --
 7 files changed, 42 insertions(+), 147 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c 
b/src/mesa/drivers/dri/i915/i830_texstate.c
index 7525f9f..e8f7e37 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -122,6 +122,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
GLuint *state = i830->state.Tex[unit], format, pitch;
GLint lodbias;
GLubyte border[4];
+   GLuint dst_x, dst_y;
 
memset(state, 0, sizeof(state));
 
@@ -132,7 +133,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
i830->state.tex_buffer[unit] = NULL;
}
 
-   if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
+   if (!intel_finalize_mipmap_tree(intel, unit))
   return GL_FALSE;
 
/* Get first image here, since intelObj->firstLevel will get set in
@@ -140,42 +141,20 @@ i830_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
 */
firstImage = tObj->Image[0][intelObj->firstLevel];
 
-   if (intelObj->imageOverride) {
-  i830->state.tex_buffer[unit] = NULL;
-  i830->state.tex_offset[unit] = intelObj->textureOffset;
+   intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0,
+ &dst_x, &dst_y);
 
-  switch (intelObj->depthOverride) {
-  case 32:
-format = MAPSURF_32BIT | MT_32BIT_ARGB;
-break;
-  case 24:
-  default:
-format = MAPSURF_32BIT | MT_32BIT_XRGB;
-break;
-  case 16:
-format = MAPSURF_16BIT | MT_16BIT_RGB565;
-break;
-  }
-
-  pitch = intelObj->pitchOverride;
-   } else {
-  GLuint dst_x, dst_y;
-
-  intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0,
-&dst_x, &dst_y);
-
-  dri_bo_reference(intelObj->mt->region->buffer);
-  i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
-  /* XXX: This calculation is probably broken for tiled images with
-   * a non-page-aligned offset.
-   */
-  i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) *
-intelObj->mt->cpp;
+   dri_bo_reference(intelObj->mt->region->buffer);
+   i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
+   /* XXX: This calculation is probably broken for tiled images with
+* a non-page-aligned offset.
+*/
+   i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) *
+  intelObj->mt->cpp;
 
-  format = translate_texture_format(firstImage->TexFormat,
-   firstImage->InternalFormat);
-  pitch = intelObj->mt->pitch * intelObj->mt->cpp;
-   }
+   format = translate_texture_format(firstImage->TexFormat,
+firstImage->InternalFormat);
+   pitch = intelObj->mt->pitch * intelObj->mt->cpp;
 
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
(LOAD_TEXTURE_MAP0 << unit) | 4);
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 3ee4c86..a1ab8f8 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -150,7 +150,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
i915->state.tex_buffer[unit] = NULL;
}
 
-   if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
+   if (!intel_finalize_mipmap_tree(intel, unit))
   return GL_FALSE;
 
/* Get first image here, since intelObj->firstLevel will get set in
@@ -158,34 +158,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
 */
firstImage = tObj->Image[0][intelObj->firstLevel];
 
-   if (intelObj->imageOverride) {
-  i915->state.tex_buffer[unit] = NULL;
-  i915->state.tex_offset[unit] = intelObj->textureOffset;
+   dri_bo_reference(intelObj->mt->region->buffer);
+   i915->state.tex_buffer[unit] = intelObj->mt->region->buffer;
+   i915->state.tex_offset[unit] = 0; /* Always the origin of the miptree */
 
-  switch (intelObj->depthOverride) {
-   

Mesa (master): i965: Remove the paths for making a const surface object for a NULL BO.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 20952f0378247f69849b6e37a7374bc9c94437a0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=20952f0378247f69849b6e37a7374bc9c94437a0

Author: Eric Anholt 
Date:   Fri Mar  5 13:38:02 2010 -0800

i965: Remove the paths for making a const surface object for a NULL BO.

---

 src/mesa/drivers/dri/i965/brw_vs_surface_state.c |4 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   29 -
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 950d075..4007b5a 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -104,7 +104,7 @@ brw_update_vs_constant_surface( GLcontext *ctx,
/* If there's no constant buffer, then no surface BO is needed to point at
 * it.
 */
-   if (vp->const_buffer == 0) {
+   if (vp->const_buffer == NULL) {
   drm_intel_bo_unreference(brw->vs.surf_bo[surf]);
   brw->vs.surf_bo[surf] = NULL;
   return;
@@ -132,7 +132,7 @@ brw_update_vs_constant_surface( GLcontext *ctx,
brw->vs.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
 BRW_SS_SURFACE,
 &key, sizeof(key),
-&key.bo, key.bo ? 1 : 0,
+&key.bo, 1,
 NULL);
if (brw->vs.surf_bo[surf] == NULL) {
   brw->vs.surf_bo[surf] = brw_create_constant_surface(brw, &key);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index a420676..b1ab79b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -336,10 +336,7 @@ brw_create_constant_surface( struct brw_context *brw,
surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
 
assert(key->bo);
-   if (key->bo)
-  surf.ss1.base_addr = key->bo->offset; /* reloc */
-   else
-  surf.ss1.base_addr = key->offset;
+   surf.ss1.base_addr = key->bo->offset; /* reloc */
 
surf.ss2.width = w & 0x7f;/* bits 6:0 of size or width */
surf.ss2.height = (w >> 7) & 0x1fff;  /* bits 19:7 of size or width */
@@ -349,20 +346,16 @@ brw_create_constant_surface( struct brw_context *brw,
  
bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE,
 key, sizeof(*key),
-&key->bo, key->bo ? 1 : 0,
+&key->bo, 1,
 &surf, sizeof(surf));
 
-   if (key->bo) {
-  /* Emit relocation to surface contents.  Section 5.1.1 of the gen4
-   * bspec ("Data Cache") says that the data cache does not exist as
-   * a separate cache and is just the sampler cache.
-   */
-  dri_bo_emit_reloc(bo,
-   I915_GEM_DOMAIN_SAMPLER, 0,
-   0,
-   offsetof(struct brw_surface_state, ss1),
-   key->bo);
-   }
+   /* Emit relocation to surface contents.  Section 5.1.1 of the gen4
+* bspec ("Data Cache") says that the data cache does not exist as
+* a separate cache and is just the sampler cache.
+*/
+   drm_intel_bo_emit_reloc(bo, offsetof(struct brw_surface_state, ss1),
+  key->bo, 0,
+  I915_GEM_DOMAIN_SAMPLER, 0);
 
return bo;
 }
@@ -420,7 +413,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
/* If there's no constant buffer, then no surface BO is needed to point at
 * it.
 */
-   if (fp->const_buffer == 0) {
+   if (fp->const_buffer == NULL) {
   drm_intel_bo_unreference(brw->wm.surf_bo[surf]);
   brw->wm.surf_bo[surf] = NULL;
   return;
@@ -448,7 +441,7 @@ brw_update_wm_constant_surface( GLcontext *ctx,
brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache,
 BRW_SS_SURFACE,
 &key, sizeof(key),
-&key.bo, key.bo ? 1 : 0,
+&key.bo, 1,
 NULL);
if (brw->wm.surf_bo[surf] == NULL) {
   brw->wm.surf_bo[surf] = brw_create_constant_surface(brw, &key);

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


Mesa (master): i965: Remove the unused SDC BO pointer from the sampler state key.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 9a38f76044761f9555bf84ebbc520c015ec88d78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a38f76044761f9555bf84ebbc520c015ec88d78

Author: Eric Anholt 
Date:   Fri Mar  5 13:24:24 2010 -0800

i965: Remove the unused SDC BO pointer from the sampler state key.

Since it's a BO pointer, it already lives outside the key in
brw->wm.sdc_bo[] which is used for sampler state lookup and setup.

---

 src/mesa/drivers/dri/i965/brw_wm_sampler_state.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index c232cd2..3a33996 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -89,7 +89,6 @@ struct wm_sampler_key {
   float max_aniso;
   GLenum minfilter, magfilter;
   GLenum comparemode, comparefunc;
-  dri_bo *sdc_bo;
 
   /** If target is cubemap, take context setting.
*/

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


Mesa (master): i965: Rename SNB brw_*_key structs to gen6_*_key structs.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 879ea6f27972766c792fe78971a36c5c7b9f1884
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=879ea6f27972766c792fe78971a36c5c7b9f1884

Author: Eric Anholt 
Date:   Fri Mar  5 13:19:09 2010 -0800

i965: Rename SNB brw_*_key structs to gen6_*_key structs.

---

 src/mesa/drivers/dri/i965/gen6_cc.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c 
b/src/mesa/drivers/dri/i965/gen6_cc.c
index 6418fc6..f7acad6 100644
--- a/src/mesa/drivers/dri/i965/gen6_cc.c
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -32,7 +32,7 @@
 #include "intel_batchbuffer.h"
 #include "main/macros.h"
 
-struct brw_blend_state_key {
+struct gen6_blend_state_key {
GLboolean color_blend, alpha_enabled;
GLboolean dither;
 
@@ -47,7 +47,7 @@ struct brw_blend_state_key {
 
 static void
 blend_state_populate_key(struct brw_context *brw,
-struct brw_blend_state_key *key)
+struct gen6_blend_state_key *key)
 {
GLcontext *ctx = &brw->intel.ctx;
 
@@ -85,7 +85,7 @@ blend_state_populate_key(struct brw_context *brw,
  */
 static drm_intel_bo *
 blend_state_create_from_key(struct brw_context *brw,
-   struct brw_blend_state_key *key)
+   struct gen6_blend_state_key *key)
 {
struct gen6_blend_state blend;
drm_intel_bo *bo;
@@ -148,7 +148,7 @@ blend_state_create_from_key(struct brw_context *brw,
 static void
 prepare_blend_state(struct brw_context *brw)
 {
-   struct brw_blend_state_key key;
+   struct gen6_blend_state_key key;
 
blend_state_populate_key(brw, &key);
 
@@ -171,7 +171,7 @@ const struct brw_tracked_state gen6_blend_state = {
.prepare = prepare_blend_state,
 };
 
-struct brw_color_calc_state_key {
+struct gen6_color_calc_state_key {
GLubyte blend_constant_color[4];
GLclampf alpha_ref;
GLubyte stencil_ref[2];
@@ -179,7 +179,7 @@ struct brw_color_calc_state_key {
 
 static void
 color_calc_state_populate_key(struct brw_context *brw,
- struct brw_color_calc_state_key *key)
+ struct gen6_color_calc_state_key *key)
 {
GLcontext *ctx = &brw->intel.ctx;
 
@@ -209,7 +209,7 @@ color_calc_state_populate_key(struct brw_context *brw,
  */
 static drm_intel_bo *
 color_calc_state_create_from_key(struct brw_context *brw,
-struct brw_color_calc_state_key *key)
+struct gen6_color_calc_state_key *key)
 {
struct gen6_color_calc_state cc;
drm_intel_bo *bo;
@@ -238,7 +238,7 @@ color_calc_state_create_from_key(struct brw_context *brw,
 static void
 prepare_color_calc_state(struct brw_context *brw)
 {
-   struct brw_color_calc_state_key key;
+   struct gen6_color_calc_state_key key;
 
color_calc_state_populate_key(brw, &key);
 

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


Mesa (master): i965: Pack gen6 blend_state_key structure.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 5d18e86971bdcf0a4dff3cb62581d7ae54c5e67a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d18e86971bdcf0a4dff3cb62581d7ae54c5e67a

Author: Eric Anholt 
Date:   Fri Mar  5 13:18:13 2010 -0800

i965: Pack gen6 blend_state_key structure.

---

 src/mesa/drivers/dri/i965/gen6_cc.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c 
b/src/mesa/drivers/dri/i965/gen6_cc.c
index 42b41f3..6418fc6 100644
--- a/src/mesa/drivers/dri/i965/gen6_cc.c
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -34,6 +34,7 @@
 
 struct brw_blend_state_key {
GLboolean color_blend, alpha_enabled;
+   GLboolean dither;
 
GLenum logic_op;
 
@@ -42,8 +43,6 @@ struct brw_blend_state_key {
GLenum blend_dst_rgb, blend_dst_a;
 
GLenum alpha_func;
-
-   GLboolean dither;
 };
 
 static void

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


Mesa (master): intel: Only do batchbuffer debug if --enable-debug is used.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 855515859ec1d94737ea91167220ba7b568c144d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=855515859ec1d94737ea91167220ba7b568c144d

Author: Eric Anholt 
Date:   Fri Mar  5 12:56:40 2010 -0800

intel: Only do batchbuffer debug if --enable-debug is used.

This saves 6.6KB on the 965 driver, and appears to speed
firefox-talos-gfx up by 1-2%.  Unlike many other asserts in the
driver, when we make a mistake that would trigger one of these it
generally shows up all the time for developers, so turning it off for
release seems fine.

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 5e0ea91..e5ad261 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -24,11 +24,13 @@ struct intel_batchbuffer
 
GLuint size;
 
+#ifdef DEBUG
/** Tracking of BEGIN_BATCH()/OUT_BATCH()/ADVANCE_BATCH() debugging */
struct {
   GLuint total;
   GLubyte *start_ptr;
} emit;
+#endif
 
GLuint dirty_state;
GLuint reserved_space;
@@ -97,7 +99,9 @@ intel_batchbuffer_space(struct intel_batchbuffer *batch)
 static INLINE void
 intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, GLuint dword)
 {
+#ifdef DEBUG
assert(intel_batchbuffer_space(batch) >= 4);
+#endif
*(GLuint *) (batch->ptr) = dword;
batch->ptr += 4;
 }
@@ -112,7 +116,9 @@ static INLINE void
 intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
 GLuint sz)
 {
+#ifdef DEBUG
assert(sz < batch->size - 8);
+#endif
if (intel_batchbuffer_space(batch) < sz)
   intel_batchbuffer_flush(batch);
 }
@@ -121,15 +127,18 @@ static INLINE void
 intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n)
 {
intel_batchbuffer_require_space(batch, n * 4);
+#ifdef DEBUG
assert(batch->map);
assert(batch->emit.start_ptr == NULL);
batch->emit.total = n * 4;
batch->emit.start_ptr = batch->ptr;
+#endif
 }
 
 static INLINE void
 intel_batchbuffer_advance(struct intel_batchbuffer *batch)
 {
+#ifdef DEBUG
unsigned int _n = batch->ptr - batch->emit.start_ptr;
assert(batch->emit.start_ptr != NULL);
if (_n != batch->emit.total) {
@@ -138,6 +147,7 @@ intel_batchbuffer_advance(struct intel_batchbuffer *batch)
   abort();
}
batch->emit.start_ptr = NULL;
+#endif
 }
 
 /* Here are the crusty old macros, to be removed:

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


Mesa (master): intel: Replace batch macro contents with function calls.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 7392002041f6c7ac6eb788d7b154f2b44eb6f403
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7392002041f6c7ac6eb788d7b154f2b44eb6f403

Author: Eric Anholt 
Date:   Fri Mar  5 12:47:21 2010 -0800

intel: Replace batch macro contents with function calls.

This manages to cut down another 3800 bytes.

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.h |   67 ++--
 1 files changed, 39 insertions(+), 28 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index b7625b5..5e0ea91 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -71,6 +71,17 @@ GLboolean intel_batchbuffer_emit_reloc_fenced(struct 
intel_batchbuffer *batch,
  uint32_t offset);
 void intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch);
 
+static INLINE uint32_t float_as_int(float f)
+{
+   union {
+  float f;
+  uint32_t d;
+   } fi;
+
+   fi.f = f;
+   return fi.d;
+}
+
 /* Inline functions - might actually be better off with these
  * non-inlined.  Certainly better off switching all command packets to
  * be passed as structs rather than dwords, but that's a little bit of
@@ -92,6 +103,12 @@ intel_batchbuffer_emit_dword(struct intel_batchbuffer 
*batch, GLuint dword)
 }
 
 static INLINE void
+intel_batchbuffer_emit_float(struct intel_batchbuffer *batch, float f)
+{
+   intel_batchbuffer_emit_dword(batch, float_as_int(f));
+}
+
+static INLINE void
 intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
 GLuint sz)
 {
@@ -100,33 +117,36 @@ intel_batchbuffer_require_space(struct intel_batchbuffer 
*batch,
   intel_batchbuffer_flush(batch);
 }
 
-static INLINE uint32_t float_as_int(float f)
+static INLINE void
+intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n)
 {
-   union {
-  float f;
-  uint32_t d;
-   } fi;
+   intel_batchbuffer_require_space(batch, n * 4);
+   assert(batch->map);
+   assert(batch->emit.start_ptr == NULL);
+   batch->emit.total = n * 4;
+   batch->emit.start_ptr = batch->ptr;
+}
 
-   fi.f = f;
-   return fi.d;
+static INLINE void
+intel_batchbuffer_advance(struct intel_batchbuffer *batch)
+{
+   unsigned int _n = batch->ptr - batch->emit.start_ptr;
+   assert(batch->emit.start_ptr != NULL);
+   if (_n != batch->emit.total) {
+  fprintf(stderr, "ADVANCE_BATCH: %d of %d dwords emitted\n",
+ _n, batch->emit.total);
+  abort();
+   }
+   batch->emit.start_ptr = NULL;
 }
 
 /* Here are the crusty old macros, to be removed:
  */
 #define BATCH_LOCALS
 
-#define BEGIN_BATCH(n) do {\
-   intel_batchbuffer_require_space(intel->batch, (n)*4); \
-   assert(intel->batch->map);  \
-   assert(intel->batch->emit.start_ptr == NULL);   \
-   intel->batch->emit.total = (n) * 4; \
-   intel->batch->emit.start_ptr = intel->batch->ptr;   \
-} while (0)
-
+#define BEGIN_BATCH(n) intel_batchbuffer_begin(intel->batch, n)
 #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
-#define OUT_BATCH_F(f) intel_batchbuffer_emit_dword(intel->batch,  \
-   float_as_int(f))
-
+#define OUT_BATCH_F(f) intel_batchbuffer_emit_float(intel->batch,f)
 #define OUT_RELOC(buf, read_domains, write_domain, delta) do { \
intel_batchbuffer_emit_reloc(intel->batch, buf, \
read_domains, write_domain, delta); \
@@ -136,15 +156,6 @@ static INLINE uint32_t float_as_int(float f)
   read_domains, write_domain, delta); \
 } while (0)
 
-#define ADVANCE_BATCH() do {   \
-   unsigned int _n = intel->batch->ptr - intel->batch->emit.start_ptr; \
-   assert(intel->batch->emit.start_ptr != NULL);   \
-   if (_n != intel->batch->emit.total) {   \
-  fprintf(stderr, "ADVANCE_BATCH: %d of %d dwords emitted\n",  \
- _n, intel->batch->emit.total);\
-  abort(); \
-   }   \
-   intel->batch->emit.start_ptr = NULL;
\
-} while(0)
+#define ADVANCE_BATCH() intel_batchbuffer_advance(intel->batch);
 
 #endif

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


Mesa (master): intel: Move the assertions about reloc delta from the macros to the function.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 342a7f23bf76e21b049cba9ab97bf4aa640a5bfd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=342a7f23bf76e21b049cba9ab97bf4aa640a5bfd

Author: Eric Anholt 
Date:   Fri Mar  5 12:40:45 2010 -0800

intel: Move the assertions about reloc delta from the macros to the function.

Cuts another 1800 bytes from the driver.

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.c |4 
 src/mesa/drivers/dri/intel/intel_batchbuffer.h |2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index a7bfd62..9768b0d 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -210,6 +210,8 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer 
*batch,
 {
int ret;
 
+   assert(delta < buffer->size);
+
if (batch->ptr - batch->map > batch->buf->size)
 printf ("bad relocation ptr %p map %p offset %d size %lu\n",
batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
@@ -234,6 +236,8 @@ intel_batchbuffer_emit_reloc_fenced(struct 
intel_batchbuffer *batch,
 {
int ret;
 
+   assert(delta < buffer->size);
+
if (batch->ptr - batch->map > batch->buf->size)
 printf ("bad relocation ptr %p map %p offset %d size %lu\n",
batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 860aa13..b7625b5 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -128,12 +128,10 @@ static INLINE uint32_t float_as_int(float f)
float_as_int(f))
 
 #define OUT_RELOC(buf, read_domains, write_domain, delta) do { \
-   assert((unsigned) (delta) < buf->size); \
intel_batchbuffer_emit_reloc(intel->batch, buf, \
read_domains, write_domain, delta); \
 } while (0)
 #define OUT_RELOC_FENCED(buf, read_domains, write_domain, delta) do {  \
-   assert((unsigned) (delta) < buf->size); \
intel_batchbuffer_emit_reloc_fenced(intel->batch, buf,  \
   read_domains, write_domain, delta); \
 } while (0)

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


Mesa (master): intel: Check that the batch is mapped per BEGIN, not each OUT.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 8a9d8bd52af4414e59320c68238b8929edf3ff80
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a9d8bd52af4414e59320c68238b8929edf3ff80

Author: Eric Anholt 
Date:   Fri Mar  5 12:27:46 2010 -0800

intel: Check that the batch is mapped per BEGIN, not each OUT.

Shaves 800 bytes off the driver.

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 79bdbc1..860aa13 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -86,7 +86,6 @@ intel_batchbuffer_space(struct intel_batchbuffer *batch)
 static INLINE void
 intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, GLuint dword)
 {
-   assert(batch->map);
assert(intel_batchbuffer_space(batch) >= 4);
*(GLuint *) (batch->ptr) = dword;
batch->ptr += 4;
@@ -118,6 +117,7 @@ static INLINE uint32_t float_as_int(float f)
 
 #define BEGIN_BATCH(n) do {\
intel_batchbuffer_require_space(intel->batch, (n)*4); \
+   assert(intel->batch->map);  \
assert(intel->batch->emit.start_ptr == NULL);   \
intel->batch->emit.total = (n) * 4; \
intel->batch->emit.start_ptr = intel->batch->ptr;   \

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


Mesa (master): i965: Try to assign SNB SF inputs to outputs.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: f6f5e8767926932dc276015ce84b74a0d01ade65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6f5e8767926932dc276015ce84b74a0d01ade65

Author: Eric Anholt 
Date:   Fri Mar  5 12:27:25 2010 -0800

i965: Try to assign SNB SF inputs to outputs.

---

 src/mesa/drivers/dri/i965/gen6_sf_state.c |   43 +++-
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 18fab61..8d96b44 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -32,6 +32,25 @@
 #include "main/macros.h"
 #include "intel_batchbuffer.h"
 
+static uint32_t
+get_attr_override(struct brw_context *brw, int attr)
+{
+   uint32_t attr_override;
+   int attr_index = 0, i;
+
+   /* Find the source index (0 = first attribute after the 4D position)
+* for this output attribute.  attr is currently a VERT_RESULT_* but should
+* be FRAG_ATTRIB_*.
+*/
+   for (i = 0; i < attr; i++) {
+  if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(i))
+attr_index++;
+   }
+   attr_override = attr_index;
+
+   return attr_index;
+}
+
 static void
 upload_sf_state(struct brw_context *brw)
 {
@@ -45,6 +64,7 @@ upload_sf_state(struct brw_context *brw)
int i;
/* _NEW_BUFFER */
GLboolean render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
+   int attr = 0;
 
dw1 =
   num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT |
@@ -122,8 +142,27 @@ upload_sf_state(struct brw_context *brw)
OUT_BATCH_F(ctx->Polygon.OffsetFactor); /* scale */
OUT_BATCH_F(0.0); /* XXX: global depth offset clamp */
for (i = 0; i < 8; i++) {
-  /* attribute overrides */
-  OUT_BATCH(0);
+  uint32_t attr_overrides = 0;
+
+  /* These should be generating FS inputs read instead of VS
+   * outputs written
+   */
+  for (; attr < 64; attr++) {
+if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) {
+   attr_overrides |= get_attr_override(brw, attr);
+   attr++;
+   break;
+}
+  }
+
+  for (; attr < 64; attr++) {
+if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) {
+   attr_overrides |= get_attr_override(brw, attr) << 16;
+   attr++;
+   break;
+}
+  }
+  OUT_BATCH(attr_overrides);
}
OUT_BATCH(0); /* point sprite texcoord bitmask */
OUT_BATCH(0); /* constant interp bitmask */

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


Mesa (master): i965: Fix the SNB SF input size.

2010-03-05 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 3b9612645e537c3d293b09f27ef199a3eb52d840
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b9612645e537c3d293b09f27ef199a3eb52d840

Author: Eric Anholt 
Date:   Thu Mar  4 18:26:33 2010 -0800

i965: Fix the SNB SF input size.

---

 src/mesa/drivers/dri/i965/gen6_sf_state.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 08e6753..18fab61 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -48,7 +48,7 @@ upload_sf_state(struct brw_context *brw)
 
dw1 =
   num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT |
-  num_inputs << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
+  (num_inputs + 1) / 2 << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
   3 << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT;
dw2 = GEN6_SF_VIEWPORT_TRANSFORM_ENABLE |
   GEN6_SF_STATISTICS_ENABLE;

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


Mesa (master): Always return VOLATILE for ObjectPurgeable(VOLATILE)

2010-03-05 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 24f90112761d108a4a131fad11bd7b426d8edfa0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=24f90112761d108a4a131fad11bd7b426d8edfa0

Author: Chris Wilson 
Date:   Fri Mar  5 23:10:45 2010 +

Always return VOLATILE for ObjectPurgeable(VOLATILE)

Fixes fdo bug 26128.

The spec mandates that VOLATILE is returned from
ObjectPurgeable(VOLATILE) irrespective of the actual status of the
object upon completion of marking it purgeable.

Conform to the spec, even though it seems wrong.

Signed-off-by: Chris Wilson 

---

 src/mesa/main/bufferobj.c |   20 
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index c532cbe..71d1514 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1809,6 +1809,8 @@ _mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, 
GLenum option)
 GLenum GLAPIENTRY
 _mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
 {
+   GLenum retval;
+
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
 
@@ -1832,17 +1834,27 @@ _mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint 
name, GLenum option)
 
switch (objectType) {
case GL_TEXTURE:
-  return _mesa_TextureObjectPurgeable (ctx, name, option);
+  retval = _mesa_TextureObjectPurgeable (ctx, name, option);
+  break;
case GL_RENDERBUFFER_EXT:
-  return _mesa_RenderObjectPurgeable (ctx, name, option);
+  retval = _mesa_RenderObjectPurgeable (ctx, name, option);
+  break;
case GL_BUFFER_OBJECT_APPLE:
-  return _mesa_BufferObjectPurgeable (ctx, name, option);
+  retval = _mesa_BufferObjectPurgeable (ctx, name, option);
+  break;
default:
   _mesa_error(ctx, GL_INVALID_ENUM,
   "glObjectPurgeable(name = 0x%x) invalid type: %d",
   name, objectType);
   return 0;
}
+
+   /* In strict conformance to the spec, we must only return VOLATILE when
+* when passed the VOLATILE option. Madness.
+*
+* XXX First fix the spec, then fix me.
+*/
+   return option == GL_VOLATILE_APPLE ? GL_VOLATILE_APPLE : retval;
 }
 
 
@@ -1902,7 +1914,7 @@ _mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint 
name, GLenum option)
if (ctx->Driver.RenderObjectUnpurgeable)
   retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option);
 
-   return retval;
+   return option;
 }
 
 

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


Mesa (master): llvmpipe: add pipe_thread_wait() calls

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b704a4e8f332e7f9a38c21ce074cd244cf2fe89e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b704a4e8f332e7f9a38c21ce074cd244cf2fe89e

Author: Brian Paul 
Date:   Fri Mar  5 14:24:02 2010 -0700

llvmpipe: add pipe_thread_wait() calls

Wait for threads to exit before cleaning up per-thread data.
Fixes hang on context destruction with glean makeCurrent test.
See fd.o bug 26536.

---

 src/gallium/drivers/llvmpipe/lp_rast.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c 
b/src/gallium/drivers/llvmpipe/lp_rast.c
index 0f83eea..dd9a8e8 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -846,6 +846,12 @@ void lp_rast_destroy( struct lp_rasterizer *rast )
   pipe_semaphore_signal(&rast->tasks[i].work_ready);
}
 
+   /* Wait for threads to terminate before cleaning up per-thread data */
+   for (i = 0; i < rast->num_threads; i++) {
+  pipe_thread_wait(rast->threads[i]);
+   }
+
+   /* Clean up per-thread data */
for (i = 0; i < rast->num_threads; i++) {
   pipe_semaphore_destroy(&rast->tasks[i].work_ready);
   pipe_semaphore_destroy(&rast->tasks[i].work_done);

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


Mesa (master): gallium/docs: document additional wrap mode restrictions

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 76e87786ab946b54adf756b0c671aa78d6bd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76e87786ab946b54adf756b0c671aa78d6bd

Author: Brian Paul 
Date:   Fri Mar  5 13:30:24 2010 -0700

gallium/docs: document additional wrap mode restrictions

---

 src/gallium/docs/source/cso/sampler.rst |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/docs/source/cso/sampler.rst 
b/src/gallium/docs/source/cso/sampler.rst
index 44698d1..9bbb784 100644
--- a/src/gallium/docs/source/cso/sampler.rst
+++ b/src/gallium/docs/source/cso/sampler.rst
@@ -85,6 +85,9 @@ normalized_coords
 will be scaled by the texture width, height, depth to compute texel
 addresses.  Otherwise, the texture coords are used as-is (they are not
 scaled by the texture dimensions).
+When normalized_coords=0, only a subset of the texture wrap modes are
+allowed: PIPE_TEX_WRAP_CLAMP, PIPE_TEX_WRAP_CLAMP_TO_EDGE and
+PIPE_TEX_WRAP_CLAMP_TO_BORDER.
 lod_bias
 Bias factor which is added to the computed level of detail.
 The normal level of detail is computed from the partial derivatives of

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


Mesa (master): gallivm: minor arithmetic improvements

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 88e2eae271fc76f82f3c732e32d3faa3184353ff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=88e2eae271fc76f82f3c732e32d3faa3184353ff

Author: Brian Paul 
Date:   Fri Mar  5 13:27:51 2010 -0700

gallivm: minor arithmetic improvements

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |   21 -
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 50dd1a5..2b04bec 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -432,9 +432,10 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context 
*bld,
   {
  LLVMValueRef min, max;
  if (bld->static_state->normalized_coords) {
-/* min = -1.0 / (2 * length) */
-min = lp_build_rcp(coord_bld, lp_build_mul(coord_bld, two, 
length_f));
-min = lp_build_negate(coord_bld, min);
+/* min = -1.0 / (2 * length) = -0.5 / length */
+min = lp_build_mul(coord_bld,
+   lp_build_const_scalar(coord_bld->type, -0.5F),
+   lp_build_rcp(coord_bld, length_f));
 /* max = 1.0 - min */
 max = lp_build_sub(coord_bld, coord_bld->one, min);
 /* coord = clamp(coord, min, max) */
@@ -518,9 +519,10 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context 
*bld,
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
   {
  LLVMValueRef min, max;
- /* min = -1.0 / (2 * length) */
- min = lp_build_rcp(coord_bld, lp_build_mul(coord_bld, two, length_f));
- min = lp_build_negate(coord_bld, min);
+ /* min = -1.0 / (2 * length) = -0.5 / length */
+ min = lp_build_mul(coord_bld,
+lp_build_const_scalar(coord_bld->type, -0.5F),
+lp_build_rcp(coord_bld, length_f));
  /* max = 1.0 - min */
  max = lp_build_sub(coord_bld, coord_bld->one, min);
 
@@ -618,9 +620,10 @@ lp_build_sample_wrap_nearest(struct 
lp_build_sample_context *bld,
   {
  LLVMValueRef min, max;
  if (bld->static_state->normalized_coords) {
-/* min = -1.0 / (2 * length) */
-min = lp_build_rcp(coord_bld, lp_build_mul(coord_bld, two, 
length_f));
-min = lp_build_negate(coord_bld, min);
+/* min = -1.0 / (2 * length) = -0.5 / length */
+min = lp_build_mul(coord_bld,
+   lp_build_const_scalar(coord_bld->type, -0.5F),
+   lp_build_rcp(coord_bld, length_f));
 /* max = length - min */
 max = lp_build_sub(coord_bld, length_f, min);
 /* scale coord to length */

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


Mesa (master): gallivm: implement non-normalized texture wrap modes

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d660e28c9cc52e55963532939ef383eac983a44b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d660e28c9cc52e55963532939ef383eac983a44b

Author: Brian Paul 
Date:   Fri Mar  5 13:21:56 2010 -0700

gallivm: implement non-normalized texture wrap modes

Note that only the PIPE_TEX_WRAP_CLAMP,CLAMP_TO_EDGE,CLAMP_TO_BORDER
modes work with non-normalized texcoords.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |  107 +
 1 files changed, 68 insertions(+), 39 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index fe41d5e..50dd1a5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -361,15 +361,10 @@ lp_build_sample_wrap_linear(struct 
lp_build_sample_context *bld,
LLVMValueRef two = lp_build_const_scalar(coord_bld->type, 2.0);
LLVMValueRef half = lp_build_const_scalar(coord_bld->type, 0.5);
LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length);
-   LLVMValueRef length_minus_one;
-   LLVMValueRef length_f_minus_one;
+   LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, 
uint_coord_bld->one);
+   LLVMValueRef length_f_minus_one = lp_build_sub(coord_bld, length_f, 
coord_bld->one);
LLVMValueRef coord0, coord1, weight;
 
-   /* XXX check for normalized vs. unnormalized coords */
-
-   length_minus_one = lp_build_sub(uint_coord_bld, length, 
uint_coord_bld->one);
-   length_f_minus_one = lp_build_sub(coord_bld, length_f, coord_bld->one);
-
switch(wrap_mode) {
case PIPE_TEX_WRAP_REPEAT:
   /* mul by size and subtract 0.5 */
@@ -394,7 +389,9 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context 
*bld,
   break;
 
case PIPE_TEX_WRAP_CLAMP:
-  coord = lp_build_mul(coord_bld, coord, length_f);
+  if (bld->static_state->normalized_coords) {
+ coord = lp_build_mul(coord_bld, coord, length_f);
+  }
   weight = lp_build_fract(coord_bld, coord);
   coord0 = lp_build_clamp(coord_bld, coord, coord_bld->zero,
   length_f_minus_one);
@@ -406,11 +403,20 @@ lp_build_sample_wrap_linear(struct 
lp_build_sample_context *bld,
   break;
 
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
-  /* clamp to [0,1] */
-  coord = lp_build_clamp(coord_bld, coord, coord_bld->zero, 
coord_bld->one);
-  /* mul by tex size and subtract 0.5 */
-  coord = lp_build_mul(coord_bld, coord, length_f);
-  coord = lp_build_sub(coord_bld, coord, half);
+  if (bld->static_state->normalized_coords) {
+ /* clamp to [0,1] */
+ coord = lp_build_clamp(coord_bld, coord, coord_bld->zero, 
coord_bld->one);
+ /* mul by tex size and subtract 0.5 */
+ coord = lp_build_mul(coord_bld, coord, length_f);
+ coord = lp_build_sub(coord_bld, coord, half);
+  }
+  else {
+ LLVMValueRef min, max;
+ /* clamp to [0.5, length - 0.5] */
+ min = lp_build_const_scalar(coord_bld->type, 0.5F);
+ max = lp_build_sub(coord_bld, length_f, min);
+ coord = lp_build_clamp(coord_bld, coord, min, max);
+  }
   /* compute lerp weight */
   weight = lp_build_fract(coord_bld, coord);
   /* coord0 = floor(coord); */
@@ -425,16 +431,25 @@ lp_build_sample_wrap_linear(struct 
lp_build_sample_context *bld,
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
   {
  LLVMValueRef min, max;
- /* min = -1.0 / (2 * length) */
- min = lp_build_rcp(coord_bld, lp_build_mul(coord_bld, two, length_f));
- min = lp_build_negate(coord_bld, min);
- /* max = 1.0 - min */
- max = lp_build_sub(coord_bld, coord_bld->one, min);
- /* coord = clamp(coord, min, max) */
- coord = lp_build_clamp(coord_bld, coord, min, max);
- /* scale coord to length (and sub 0.5?) */
- coord = lp_build_mul(coord_bld, coord, length_f);
- coord = lp_build_sub(coord_bld, coord, half);
+ if (bld->static_state->normalized_coords) {
+/* min = -1.0 / (2 * length) */
+min = lp_build_rcp(coord_bld, lp_build_mul(coord_bld, two, 
length_f));
+min = lp_build_negate(coord_bld, min);
+/* max = 1.0 - min */
+max = lp_build_sub(coord_bld, coord_bld->one, min);
+/* coord = clamp(coord, min, max) */
+coord = lp_build_clamp(coord_bld, coord, min, max);
+/* scale coord to length (and sub 0.5?) */
+coord = lp_build_mul(coord_bld, coord, length_f);
+coord = lp_build_sub(coord_bld, coord, half);
+ }
+ else {
+/* clamp to [-0.5, length + 0.5] */
+min = lp_build_const_scalar(coord_bld->type, -0.5F);
+max = lp_build_sub(coord_bld, length_f, min);
+coord = lp_build_clamp(coord_bld, coord, min, max);
+coord = lp_build_sub(coord_bld, c

Mesa (master): softpipe: implement PIPE_TEX_WRAP_CLAMP_TO_EDGE for unorm texture sampling

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b5b128b26841e7f947edd8f0cbcc91a530d6bb8f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5b128b26841e7f947edd8f0cbcc91a530d6bb8f

Author: Brian Paul 
Date:   Fri Mar  5 12:38:05 2010 -0700

softpipe: implement PIPE_TEX_WRAP_CLAMP_TO_EDGE for unorm texture sampling

CLAMP_TO_BORDER and CLAMP_TO_EDGE were doing the same thing.

---

 src/gallium/drivers/softpipe/sp_tex_sample.c |   49 ++---
 1 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c 
b/src/gallium/drivers/softpipe/sp_tex_sample.c
index b3a7973..ef7ccf4 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -437,8 +437,7 @@ wrap_linear_mirror_clamp_to_border(const float s[4], 
unsigned size,
 
 
 /**
- * For RECT textures / unnormalized texcoords
- * Only a subset of wrap modes supported.
+ * PIPE_TEX_WRAP_CLAMP for nearest sampling, unnormalized coords.
  */
 static void
 wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4])
@@ -452,7 +451,7 @@ wrap_nearest_unorm_clamp(const float s[4], unsigned size, 
int icoord[4])
 
 
 /**
- * Handles clamp_to_edge and clamp_to_border:
+ * PIPE_TEX_WRAP_CLAMP_TO_BORDER for nearest sampling, unnormalized coords.
  */
 static void
 wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size,
@@ -460,14 +459,27 @@ wrap_nearest_unorm_clamp_to_border(const float s[4], 
unsigned size,
 {
uint ch;
for (ch = 0; ch < 4; ch++) {
+  icoord[ch]= util_ifloor( CLAMP(s[ch], -0.5F, (float) size + 0.5F) );
+   }
+}
+
+
+/**
+ * PIPE_TEX_WRAP_CLAMP_TO_EDGE for nearest sampling, unnormalized coords.
+ */
+static void
+wrap_nearest_unorm_clamp_to_edge(const float s[4], unsigned size,
+ int icoord[4])
+{
+   uint ch;
+   for (ch = 0; ch < 4; ch++) {
   icoord[ch]= util_ifloor( CLAMP(s[ch], 0.5F, (float) size - 0.5F) );
}
 }
 
 
 /**
- * For RECT textures / unnormalized texcoords.
- * Only a subset of wrap modes supported.
+ * PIPE_TEX_WRAP_CLAMP for linear sampling, unnormalized coords.
  */
 static void
 wrap_linear_unorm_clamp(const float s[4], unsigned size,
@@ -484,13 +496,36 @@ wrap_linear_unorm_clamp(const float s[4], unsigned size,
 }
 
 
+/**
+ * PIPE_TEX_WRAP_CLAMP_TO_BORDER for linear sampling, unnormalized coords.
+ */
 static void
 wrap_linear_unorm_clamp_to_border(const float s[4], unsigned size,
   int icoord0[4], int icoord1[4], float w[4])
 {
uint ch;
for (ch = 0; ch < 4; ch++) {
-  float u = CLAMP(s[ch], 0.5F, (float) size - 0.5F);
+  float u = CLAMP(s[ch], -0.5F, (float) size + 0.5F);
+  u -= 0.5F;
+  icoord0[ch] = util_ifloor(u);
+  icoord1[ch] = icoord0[ch] + 1;
+  if (icoord1[ch] > (int) size - 1)
+ icoord1[ch] = size - 1;
+  w[ch] = frac(u);
+   }
+}
+
+
+/**
+ * PIPE_TEX_WRAP_CLAMP_TO_EDGE for linear sampling, unnormalized coords.
+ */
+static void
+wrap_linear_unorm_clamp_to_edge(const float s[4], unsigned size,
+int icoord0[4], int icoord1[4], float w[4])
+{
+   uint ch;
+   for (ch = 0; ch < 4; ch++) {
+  float u = CLAMP(s[ch], +0.5F, (float) size - 0.5F);
   u -= 0.5F;
   icoord0[ch] = util_ifloor(u);
   icoord1[ch] = icoord0[ch] + 1;
@@ -1707,6 +1742,7 @@ get_nearest_unorm_wrap(unsigned mode)
case PIPE_TEX_WRAP_CLAMP:
   return wrap_nearest_unorm_clamp;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+  return wrap_nearest_unorm_clamp_to_edge;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
   return wrap_nearest_unorm_clamp_to_border;
default:
@@ -1750,6 +1786,7 @@ get_linear_unorm_wrap(unsigned mode)
case PIPE_TEX_WRAP_CLAMP:
   return wrap_linear_unorm_clamp;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+  return wrap_linear_unorm_clamp_to_edge;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
   return wrap_linear_unorm_clamp_to_border;
default:

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


Mesa (master): mesa: minor reformatting, new comments

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e9968ebfa40b4740601c1596950ebd3f168664b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9968ebfa40b4740601c1596950ebd3f168664b0

Author: Brian Paul 
Date:   Fri Mar  5 12:32:32 2010 -0700

mesa: minor reformatting, new comments

---

 src/mesa/main/api_validate.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index e9359db..4fb7b5a 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -123,6 +123,12 @@ check_valid_to_render(GLcontext *ctx, const char *function)
return GL_TRUE;
 }
 
+
+/**
+ * Do bounds checking on array element indexes.  Check that the vertices
+ * pointed to by the indices don't lie outside buffer object bounds.
+ * \return GL_TRUE if OK, GL_FALSE if any indexed vertex goes is out of bounds
+ */
 static GLboolean
 check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type,
   const GLvoid *indices, GLint basevertex)
@@ -150,14 +156,15 @@ check_index_bounds(GLcontext *ctx, GLsizei count, GLenum 
type,
if ((int)(min + basevertex) < 0 ||
max + basevertex > ctx->Array.ArrayObj->_MaxElement) {
   /* the max element is out of bounds of one or more enabled arrays */
-  _mesa_warning(ctx, "glDrawElements() index=%u is "
-   "out of bounds (max=%u)", max, 
ctx->Array.ArrayObj->_MaxElement);
+  _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
+max, ctx->Array.ArrayObj->_MaxElement);
   return GL_FALSE;
}
 
return GL_TRUE;
 }
 
+
 /**
  * Error checking for glDrawElements().  Includes parameter checking
  * and VBO bounds checking.

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


Mesa (master): progs/xdemos: fix up GLX extension checking

2010-03-05 Thread Jesse Barnes
Module: Mesa
Branch: master
Commit: f846a008e9e63f01bc673e31efd0d6b22e4eb0b9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f846a008e9e63f01bc673e31efd0d6b22e4eb0b9

Author: Jesse Barnes 
Date:   Fri Mar  5 11:21:12 2010 -0800

progs/xdemos: fix up GLX extension checking

A few of my programs were using the client string in addition to the
main extensions string to see if a feature was present.  Correct this to
only check for the currently available and working extensions.

---

 progs/xdemos/glsync.c  |   11 ++-
 progs/xdemos/msctest.c |   13 +++--
 progs/xdemos/omlsync.c |9 +
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c
index c00ba9e..3751373 100644
--- a/progs/xdemos/glsync.c
+++ b/progs/xdemos/glsync.c
@@ -63,10 +63,9 @@ void (*swap_interval)();
 
 static int GLXExtensionSupported(Display *dpy, const char *extension)
 {
-   const char *extensionsString, *client_extensions, *pos;
+   const char *extensionsString, *pos;
 
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
-   client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
 
pos = strstr(extensionsString, extension);
 
@@ -74,12 +73,6 @@ static int GLXExtensionSupported(Display *dpy, const char 
*extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
 
-   pos = strstr(client_extensions, extension);
-
-   if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
-   (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
-   return 1;
-
return 0;
 }
 
@@ -235,7 +228,7 @@ int main(int argc, char *argv[])
 
XMapWindow(disp, winGL);
ret = glXMakeCurrent(disp, winGL, context);
-   if (ret) {
+   if (!ret) {
fprintf(stderr, "failed to make context current: %d\n", ret);
}
 
diff --git a/progs/xdemos/msctest.c b/progs/xdemos/msctest.c
index 001ecf0..11b0434 100644
--- a/progs/xdemos/msctest.c
+++ b/progs/xdemos/msctest.c
@@ -45,10 +45,9 @@ void (*wait_sync)(Display *dpy, Window winGL, int64_t 
target_msc, int64_t diviso
 
 static int GLXExtensionSupported(Display *dpy, const char *extension)
 {
-   const char *extensionsString, *client_extensions, *pos;
+   const char *extensionsString, *pos;
 
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
-   client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
 
pos = strstr(extensionsString, extension);
 
@@ -56,12 +55,6 @@ static int GLXExtensionSupported(Display *dpy, const char 
*extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
 
-   pos = strstr(client_extensions, extension);
-
-   if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
-   (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
-   return 1;
-
return 0;
 }
 
@@ -167,8 +160,8 @@ int main(int argc, char *argv[])
 
glXMakeCurrent(disp, winGL, context);
 
-   get_sync_values = glXGetProcAddress((unsigned char 
*)"glXGetSyncValuesOML");
-   wait_sync = glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
+   get_sync_values = (void *)glXGetProcAddress((unsigned char 
*)"glXGetSyncValuesOML");
+   wait_sync = (void *)glXGetProcAddress((unsigned char 
*)"glXWaitForMscOML");
 
if (!get_sync_values || !wait_sync) {
fprintf(stderr, "failed to get sync values function\n");
diff --git a/progs/xdemos/omlsync.c b/progs/xdemos/omlsync.c
index f2c1d13..a2baf4a 100644
--- a/progs/xdemos/omlsync.c
+++ b/progs/xdemos/omlsync.c
@@ -73,10 +73,9 @@ int (*glXSwapInterval)(int interval);
 
 static int GLXExtensionSupported(Display *dpy, const char *extension)
 {
-   const char *extensionsString, *client_extensions, *pos;
+   const char *extensionsString, *pos;
 
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
-   client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
 
pos = strstr(extensionsString, extension);
 
@@ -84,12 +83,6 @@ static int GLXExtensionSupported(Display *dpy, const char 
*extension)
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
 
-   pos = strstr(client_extensions, extension);
-
-   if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
-   (pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
-   return 1;
-
return 0;
 }
 

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


Mesa (master): xdemos/omlsync: add waitformsc and swap interval code

2010-03-05 Thread Jesse Barnes
Module: Mesa
Branch: master
Commit: 77bc721a529e1643ad3c56ed58817e4d74599909
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77bc721a529e1643ad3c56ed58817e4d74599909

Author: Jesse Barnes 
Date:   Fri Mar  5 10:28:41 2010 -0800

xdemos/omlsync: add waitformsc and swap interval code

---

 progs/xdemos/omlsync.c |   32 +++-
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/progs/xdemos/omlsync.c b/progs/xdemos/omlsync.c
index 4eee849..f2c1d13 100644
--- a/progs/xdemos/omlsync.c
+++ b/progs/xdemos/omlsync.c
@@ -69,6 +69,7 @@ Bool (*glXWaitForMscOML)(Display *dpy, GLXDrawable drawable, 
int64_t target_msc,
 int64_t *msc, int64_t *sbc);
 Bool (*glXWaitForSbcOML)(Display *dpy, GLXDrawable drawable, int64_t 
target_sbc,
 int64_t *ust, int64_t *msc, int64_t *sbc);
+int (*glXSwapInterval)(int interval);
 
 static int GLXExtensionSupported(Display *dpy, const char *extension)
 {
@@ -94,14 +95,15 @@ static int GLXExtensionSupported(Display *dpy, const char 
*extension)
 
 extern char *optarg;
 extern int optind, opterr, optopt;
-static char optstr[] = "w:h:vd:r:n:";
+static char optstr[] = "w:h:vd:r:n:i:";
 
 static void usage(char *name)
 {
-   printf("usage: %s [-w ] [-h ] [-i] "
-  "[-n] [-v]\n", name);
+   printf("usage: %s [-w ] [-h ] ...\n", name);
+   printf("\t-d - divisor for OML swap\n");
+   printf("\t-r - remainder for OML swap\n");
+   printf("\t-n - wait interval for OML WaitMSC\n");
printf("\t-i - swap at most once every n frames\n");
-   printf("\t-n - wait n frames between swaps\n");
printf("\t-v: verbose (print count)\n");
exit(-1);
 }
@@ -115,8 +117,9 @@ int main(int argc, char *argv[])
GLXContext context;
int dummy;
Atom wmDelete;
+   int64_t ust, msc, sbc;
int width = 500, height = 500, verbose = 0, divisor = 0, remainder = 0,
-  wait_interval = 0;
+   wait_interval = 0, swap_interval = 1;
int c, i = 1;
int ret;
int db_attribs[] = { GLX_RGBA,
@@ -149,6 +152,9 @@ int main(int argc, char *argv[])
case 'n':
wait_interval = atoi(optarg);
break;
+   case 'i':
+   swap_interval = atoi(optarg);
+   break;
default:
usage(argv[0]);
break;
@@ -171,6 +177,11 @@ int main(int argc, char *argv[])
return -1;
}
 
+   if (!GLXExtensionSupported(disp, "GLX_MESA_swap_control")) {
+   fprintf(stderr, "GLX_MESA_swap_control not supported\n");
+   return -1;
+   }
+
pvi = glXChooseVisual(disp, DefaultScreen(disp), db_attribs);
 
if (!pvi) {
@@ -224,8 +235,14 @@ int main(int argc, char *argv[])
glXSwapBuffersMscOML = (void *)glXGetProcAddress((unsigned char 
*)"glXSwapBuffersMscOML");
glXWaitForMscOML = (void *)glXGetProcAddress((unsigned char 
*)"glXWaitForMscOML");
glXWaitForSbcOML = (void *)glXGetProcAddress((unsigned char 
*)"glXWaitForSbcOML");
+   glXSwapInterval = (void *)glXGetProcAddress((unsigned char 
*)"glXSwapIntervalMESA");
 
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glXSwapInterval(swap_interval);
+   fprintf(stderr, "set swap interval to %d\n", swap_interval);
+
+   glXGetSyncValuesOML(disp, winGL, &ust, &msc, &sbc);
while (i++) {
/* Alternate colors to make tearing obvious */
if (i & 1) {
@@ -240,6 +257,11 @@ int main(int argc, char *argv[])
glRectf(0, 0, width, height);
 
glXSwapBuffersMscOML(disp, winGL, 0, divisor, remainder);
+
+   if (wait_interval) {
+   glXWaitForMscOML(disp, winGL, msc + wait_interval,
+0, 0, &ust, &msc, &sbc);
+   }
}
 
XDestroyWindow(disp, winGL);

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


Mesa (master): DRI2: expose OML_sync_control if possible

2010-03-05 Thread Jesse Barnes
Module: Mesa
Branch: master
Commit: 1ca968363dd55e919bd91c8fc31c34d207af3958
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ca968363dd55e919bd91c8fc31c34d207af3958

Author: Jesse Barnes 
Date:   Fri Mar  5 11:17:19 2010 -0800

DRI2: expose OML_sync_control if possible

If the server supports the OML related protocol, enable support for the
extension.

---

 src/glx/dri2_glx.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 29d589c..d573e46 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -614,6 +614,9 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
   psp->setSwapInterval = dri2SetSwapInterval;
   psp->getSwapInterval = dri2GetSwapInterval;
 #endif
+#if defined(X_DRI2GetMSC) && defined(X_DRI2WaitMSC) && 
defined(X_DRI2SwapInterval)
+  __glXEnableDirectExtension(psc, "GLX_OML_sync_control");
+#endif
}
 
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always

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


Mesa (master): GLX: remove debug prints from glXWaitForMscOML dispatch

2010-03-05 Thread Jesse Barnes
Module: Mesa
Branch: master
Commit: 6b3145d6ee07a0fa9bb867e96ebe6cf716961bb9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b3145d6ee07a0fa9bb867e96ebe6cf716961bb9

Author: Jesse Barnes 
Date:   Fri Mar  5 10:31:39 2010 -0800

GLX: remove debug prints from glXWaitForMscOML dispatch

Leftover from earlier commit.

---

 src/glx/glxcmds.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4fbc6b6..49cbce7 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -2534,8 +2534,6 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
int ret;
 
-   fprintf(stderr, "waitmsc: %lld, %lld, %lld\n", target_msc, divisor,
-  remainder);
 
/* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
 * error", but the return type in the spec is Bool.
@@ -2547,7 +2545,6 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
 
 #ifdef __DRI_MEDIA_STREAM_COUNTER
if (pdraw != NULL && psc->msc != NULL) {
-  fprintf(stderr, "dri1 msc\n");
   ret = (*psc->msc->waitForMSC) (pdraw->driDrawable, target_msc,
  divisor, remainder, msc, sbc);
 
@@ -2563,7 +2560,6 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
   return ret;
}
 
-   fprintf(stderr, "no drawable??\n");
return False;
 }
 

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


Mesa (master): progs: Add arbocclude2 demo.

2010-03-05 Thread Michał Król
Module: Mesa
Branch: master
Commit: 2b15f4fc6840b4bb5ca81d3ed0137c31f63725e8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b15f4fc6840b4bb5ca81d3ed0137c31f63725e8

Author: Michal Krol 
Date:   Fri Mar  5 18:42:42 2010 +0100

progs: Add arbocclude2 demo.

---

 progs/demos/SConscript|1 +
 progs/demos/arbocclude2.c |  314 +
 2 files changed, 315 insertions(+), 0 deletions(-)

diff --git a/progs/demos/SConscript b/progs/demos/SConscript
index 067c162..20ec6a0 100644
--- a/progs/demos/SConscript
+++ b/progs/demos/SConscript
@@ -4,6 +4,7 @@ progs = [
 'arbfplight',
 'arbfslight',
 'arbocclude',
+'arbocclude2',
 'bounce',
 'clearspd',
 'copypix',
diff --git a/progs/demos/arbocclude2.c b/progs/demos/arbocclude2.c
new file mode 100644
index 000..195a238
--- /dev/null
+++ b/progs/demos/arbocclude2.c
@@ -0,0 +1,314 @@
+/*
+ * GL_ARB_occlusion_query demo
+ *
+ * Brian Paul
+ * 12 June 2003
+ *
+ * Copyright (C) 2003  Brian Paul   All Rights Reserved.
+ * 
+ * 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
+ * BRIAN PAUL 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static GLboolean Anim = GL_TRUE;
+static GLfloat Xpos = 0;
+static GLuint OccQuery1;
+static GLuint OccQuery2;
+static GLint Win = 0;
+
+
+static void
+PrintString(const char *s)
+{
+   while (*s) {
+  glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
+  s++;
+   }
+}
+
+
+
+static void Idle(void)
+{
+   static int lastTime = 0;
+   static int sign = +1;
+   int time = glutGet(GLUT_ELAPSED_TIME);
+   float step;
+
+   if (lastTime == 0)
+  lastTime = time;
+   else if (time - lastTime < 20)  /* 50Hz update */
+  return;
+
+   step = (time - lastTime) / 1000.0 * sign;
+   lastTime = time;
+
+   Xpos += step;
+
+   if (Xpos > 2.5) {
+  Xpos = 2.5;
+  sign = -1;
+   }
+   else if (Xpos < -2.5) {
+  Xpos = -2.5;
+  sign = +1;
+   }
+   glutPostRedisplay();
+}
+
+
+static void Display( void )
+{
+   GLuint passed1, passed2;
+   GLint ready;
+   char s[100];
+
+   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+   glMatrixMode( GL_PROJECTION );
+   glLoadIdentity();
+   glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
+   glMatrixMode( GL_MODELVIEW );
+   glLoadIdentity();
+   glTranslatef( 0.0, 0.0, -15.0 );
+
+   /* draw the occluding polygons */
+   glColor3f(0, 0.6, 0.8);
+   glBegin(GL_QUADS);
+   glVertex2f(-1.6, -1.5);
+   glVertex2f(-0.4, -1.5);
+   glVertex2f(-0.4,  1.5);
+   glVertex2f(-1.6,  1.5);
+
+   glVertex2f( 0.4, -1.5);
+   glVertex2f( 1.6, -1.5);
+   glVertex2f( 1.6,  1.5);
+   glVertex2f( 0.4,  1.5);
+   glEnd();
+
+#if defined(GL_ARB_occlusion_query)
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the first polygon with occlusion testing */
+   glPushMatrix();
+   glTranslatef(Xpos, 0.4, -0.5);
+   glScalef(0.3, 0.3, 1.0);
+   glRotatef(-90.0 * Xpos, 0, 0, 1);
+
+   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
+
+   glBegin(GL_POLYGON);
+   glVertex3f(-1, -1, 0);
+   glVertex3f( 1, -1, 0);
+   glVertex3f( 1,  1, 0);
+   glVertex3f(-1,  1, 0);
+   glEnd();
+
+   glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+
+   /* draw the second polygon with occlusion testing */
+   glPopMatrix();
+   glPushMatrix();
+   glTranslatef(Xpos, -0.4, -0.5);
+   glScalef(0.3, 0.3, 1.0);
+
+   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery2);
+
+   glBegin(GL_POLYGON);
+   glVertex3f(-1, -1, 0);
+   glVertex3f( 1, -1, 0);
+   glVertex3f( 1,  1, 0);
+   glVertex3f(-1,  1, 0);
+   glEnd();
+
+   glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+
+   /* turn off occlusion testing */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+
+   do {
+  /* do useful work here, if any */
+  glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
+   } while (!ready);
+   glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
+
+   do {
+  /* do useful work here, if 

Mesa (gallium-winsys-handle-rebased): nouveau: s/TEXTURE_USAGE_PRIMARY/ TEXTURE_USAGE_SCANOUT

2010-03-05 Thread Christoph Bumiller
Module: Mesa
Branch: gallium-winsys-handle-rebased
Commit: 5024a39d111e2cef176a18e17f18917c2242ec72
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5024a39d111e2cef176a18e17f18917c2242ec72

Author: Christoph Bumiller 
Date:   Tue Mar  2 11:08:05 2010 +0100

nouveau: s/TEXTURE_USAGE_PRIMARY/TEXTURE_USAGE_SCANOUT

---

 src/gallium/drivers/nv30/nv30_miptree.c |4 ++--
 src/gallium/drivers/nv40/nv40_miptree.c |4 ++--
 src/gallium/drivers/nv50/nv50_miptree.c |2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_miptree.c 
b/src/gallium/drivers/nv30/nv30_miptree.c
index c29c36e..d8a9d3f 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -18,7 +18,7 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
   PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
   PIPE_TEXTURE_USAGE_RENDER_TARGET |
   PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
-  PIPE_TEXTURE_USAGE_PRIMARY);
+  PIPE_TEXTURE_USAGE_SCANOUT);
 
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
@@ -78,7 +78,7 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct 
pipe_texture *pt)
pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
-   if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
+   if (pt->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
 PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
 PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c 
b/src/gallium/drivers/nv40/nv40_miptree.c
index ad1a9a5..9acbef4 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -20,7 +20,7 @@ nv40_miptree_layout(struct nv40_miptree *mt)
   PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
   PIPE_TEXTURE_USAGE_RENDER_TARGET |
   PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
-  PIPE_TEXTURE_USAGE_PRIMARY);
+  PIPE_TEXTURE_USAGE_SCANOUT);
 
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
@@ -80,7 +80,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct 
pipe_texture *pt)
pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
-   if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
+   if (pt->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
 PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
 PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c 
b/src/gallium/drivers/nv50/nv50_miptree.c
index 7297c74..133f220 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -104,7 +104,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const 
struct pipe_texture *tmp)
tile_flags = 0x7400;
break;
default:
-   if ((pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) &&
+   if ((pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT) &&
util_format_get_blocksizebits(pt->format) == 32)
tile_flags = 0x7a00;
else

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


Mesa (master): gallium/docs: updated/improve sampler state documentation

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c3b6adccc91b295772a934ba4115c7f3cced4dfe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3b6adccc91b295772a934ba4115c7f3cced4dfe

Author: Brian Paul 
Date:   Fri Mar  5 09:53:37 2010 -0700

gallium/docs: updated/improve sampler state documentation

---

 src/gallium/docs/source/cso/sampler.rst |   98 ---
 1 files changed, 77 insertions(+), 21 deletions(-)

diff --git a/src/gallium/docs/source/cso/sampler.rst 
b/src/gallium/docs/source/cso/sampler.rst
index 77979fc..44698d1 100644
--- a/src/gallium/docs/source/cso/sampler.rst
+++ b/src/gallium/docs/source/cso/sampler.rst
@@ -13,38 +13,94 @@ Members
 ---
 
 wrap_s
-How to wrap the S coordinate. One of PIPE_TEX_WRAP.
+How to wrap the S coordinate. One of PIPE_TEX_WRAP_*.
 wrap_t
-How to wrap the T coordinate. One of PIPE_TEX_WRAP.
+How to wrap the T coordinate. One of PIPE_TEX_WRAP_*.
 wrap_r
-How to wrap the R coordinate. One of PIPE_TEX_WRAP.
+How to wrap the R coordinate. One of PIPE_TEX_WRAP_*.
+
+The wrap modes are:
+
+* ``PIPE_TEX_WRAP_REPEAT``: Standard coord repeat/wrap-around mode.
+* ``PIPE_TEX_WRAP_CLAMP_TO_EDGE``: Clamp coord to edge of texture, the border
+  color is never sampled.
+* ``PIPE_TEX_WRAP_CLAMP_TO_BORDER``: Clamp coord to border of texture, the
+  border color is sampled when coords go outside the range [0,1].
+* ``PIPE_TEX_WRAP_CLAMP``: The coord is clamped to the range [0,1] before
+  scaling to the texture size.  This corresponds to the legacy OpenGL GL_CLAMP
+  texture wrap mode.  Historically, this mode hasn't acted consistantly across
+  all graphics hardware.  It sometimes acts like CLAMP_TO_EDGE or
+  CLAMP_TO_BORDER.  The behaviour may also vary depending on linear vs.
+  nearest sampling mode.
+* ``PIPE_TEX_WRAP_MIRROR_REPEAT``: If the integer part of the coordinate
+  is odd, the coord becomes (1 - coord).  Then, normal texture REPEAT is
+  applied to the coord.
+* ``PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE``: First, the absolute value of the
+  coordinate is computed.  Then, regular CLAMP_TO_EDGE is applied to the coord.
+* ``PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER``: First, the absolute value of the
+  coordinate is computed.  Then, regular CLAMP_TO_BORDER is applied to the
+  coord.
+* ``PIPE_TEX_WRAP_MIRROR_CLAMP``: First, the absolute value of the coord is
+  computed.  Then, regular CLAMP is applied to the coord.
+
+
 min_img_filter
-The filter to use when minifying texels. One of PIPE_TEX_FILTER.
+The image filter to use when minifying texels. One of PIPE_TEX_FILTER_*.
+mag_img_filter
+The image filter to use when magnifying texels. One of PIPE_TEX_FILTER_*.
+
+The texture image filter modes are:
+
+* ``PIPE_TEX_FILTER_NEAREST``: One texel is fetched from the texture image
+  at the texture coordinate.
+* ``PIPE_TEX_FILTER_LINEAR``: Two, four or eight texels (depending on the
+  texture dimensions; 1D/2D/3D) are fetched from the texture image and
+  linearly weighted and blended together.
+
 min_mip_filter
 The filter to use when minifying mipmapped textures. One of
-PIPE_TEX_FILTER.
-mag_img_filter
-The filter to use when magnifying texels. One of PIPE_TEX_FILTER.
+PIPE_TEX_MIPFILTER_*.
+
+The texture mip filter modes are:
+
+* ``PIPE_TEX_MIPFILTER_NEAREST``: A single mipmap level/image is selected
+  according to the texture LOD (lambda) value.
+* ``PIPE_TEX_MIPFILTER_LINEAR``: The two mipmap levels/images above/below
+  the texture LOD value are sampled from.  The results of sampling from
+  those two images are blended together with linear interpolation.
+* ``PIPE_TEX_MIPFILTER_NONE``: Mipmap filtering is disabled.  All texels
+  are taken from the level 0 image.
+
+
 compare_mode
-If set to PIPE_TEX_COMPARE_R_TO_TEXTURE, texture output is computed
-according to compare_func, using r coord and the texture value as operands.
+If set to PIPE_TEX_COMPARE_R_TO_TEXTURE, the result of texture sampling
+is not a color but a true/false value which is the result of comparing the
+sampled texture value (typically a Z value from a depth texture) to the
+texture coordinate's R component.
 If set to PIPE_TEX_COMPARE_NONE, no comparison calculation is performed.
 compare_func
-How the comparison is computed. One of PIPE_FUNC.
+The inequality operator used when compare_mode=1.  One of PIPE_FUNC_x.
 normalized_coords
-Whether the texture coordinates are normalized. If normalized, they will
-always be in [0, 1]. If not, they will be in the range of each dimension
-of the loaded texture.
+If set, the incoming texture coordinates (nominally in the range [0,1])
+will be scaled by the texture width, height, depth to compute texel
+addresses.  Otherwise, the texture coords are used as-is (they are not
+scaled by the texture dimensions).
 lod_bias
-The bias to apply to the level of detail.
+Bias factor which is added to the computed level of det

Mesa (master): mesa: whitespace fixes, 80-column wrapping, etc.

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e176ae5f2a90632c778c3ae7dcab587f119035b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e176ae5f2a90632c778c3ae7dcab587f119035b1

Author: Brian Paul 
Date:   Fri Mar  5 09:23:43 2010 -0700

mesa: whitespace fixes, 80-column wrapping, etc.

---

 src/mesa/main/bufferobj.c |  186 +
 1 files changed, 102 insertions(+), 84 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 3c48f6c..c532cbe 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1119,20 +1119,20 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
}
 
switch (usage) {
-  case GL_STREAM_DRAW_ARB:
-  case GL_STREAM_READ_ARB:
-  case GL_STREAM_COPY_ARB:
-  case GL_STATIC_DRAW_ARB:
-  case GL_STATIC_READ_ARB:
-  case GL_STATIC_COPY_ARB:
-  case GL_DYNAMIC_DRAW_ARB:
-  case GL_DYNAMIC_READ_ARB:
-  case GL_DYNAMIC_COPY_ARB:
- /* OK */
- break;
-  default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
- return;
+   case GL_STREAM_DRAW_ARB:
+   case GL_STREAM_READ_ARB:
+   case GL_STREAM_COPY_ARB:
+   case GL_STATIC_DRAW_ARB:
+   case GL_STATIC_READ_ARB:
+   case GL_STATIC_COPY_ARB:
+   case GL_DYNAMIC_DRAW_ARB:
+   case GL_DYNAMIC_READ_ARB:
+   case GL_DYNAMIC_COPY_ARB:
+  /* OK */
+  break;
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
+  return;
}
 
bufObj = get_buffer(ctx, target);
@@ -1225,18 +1225,18 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
 
switch (access) {
-  case GL_READ_ONLY_ARB:
- accessFlags = GL_MAP_READ_BIT;
- break;
-  case GL_WRITE_ONLY_ARB:
- accessFlags = GL_MAP_WRITE_BIT;
- break;
-  case GL_READ_WRITE_ARB:
- accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
- break;
-  default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
- return NULL;
+   case GL_READ_ONLY_ARB:
+  accessFlags = GL_MAP_READ_BIT;
+  break;
+   case GL_WRITE_ONLY_ARB:
+  accessFlags = GL_MAP_WRITE_BIT;
+  break;
+   case GL_READ_WRITE_ARB:
+  accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
+  break;
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
+  return NULL;
}
 
bufObj = get_buffer(ctx, target);
@@ -1385,21 +1385,21 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum 
pname, GLint *params)
}
 
switch (pname) {
-  case GL_BUFFER_SIZE_ARB:
- *params = (GLint) bufObj->Size;
- break;
-  case GL_BUFFER_USAGE_ARB:
- *params = bufObj->Usage;
- break;
-  case GL_BUFFER_ACCESS_ARB:
- *params = simplified_access_mode(bufObj->AccessFlags);
- break;
-  case GL_BUFFER_MAPPED_ARB:
- *params = _mesa_bufferobj_mapped(bufObj);
- break;
-  default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)");
- return;
+   case GL_BUFFER_SIZE_ARB:
+  *params = (GLint) bufObj->Size;
+  break;
+   case GL_BUFFER_USAGE_ARB:
+  *params = bufObj->Usage;
+  break;
+   case GL_BUFFER_ACCESS_ARB:
+  *params = simplified_access_mode(bufObj->AccessFlags);
+  break;
+   case GL_BUFFER_MAPPED_ARB:
+  *params = _mesa_bufferobj_mapped(bufObj);
+  break;
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)");
+  return;
}
 }
 
@@ -1427,21 +1427,21 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum 
pname, GLint64 *params)
}
 
switch (pname) {
-  case GL_BUFFER_SIZE_ARB:
- *params = bufObj->Size;
- break;
-  case GL_BUFFER_USAGE_ARB:
- *params = bufObj->Usage;
- break;
-  case GL_BUFFER_ACCESS_ARB:
- *params = simplified_access_mode(bufObj->AccessFlags);
- break;
-  case GL_BUFFER_MAPPED_ARB:
- *params = _mesa_bufferobj_mapped(bufObj);
- break;
-  default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname)");
- return;
+   case GL_BUFFER_SIZE_ARB:
+  *params = bufObj->Size;
+  break;
+   case GL_BUFFER_USAGE_ARB:
+  *params = bufObj->Usage;
+  break;
+   case GL_BUFFER_ACCESS_ARB:
+  *params = simplified_access_mode(bufObj->AccessFlags);
+  break;
+   case GL_BUFFER_MAPPED_ARB:
+  *params = _mesa_bufferobj_mapped(bufObj);
+  break;
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname)");
+  return;
}
 }
 
@@ -1713,6 +1713,7 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr 
offset, GLsizeiptr length)
   ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj);
 }
 
+
 #if FEATURE_APPLE_object_purgeable
 static GLenum
 _mesa_BufferObjectPurgeable(GLc

Mesa (master): docs: document GL_APPLE_object_purgeable

2010-03-05 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 60fae3b0249b42dd8c2f5777ad5f933a9bbc50d2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=60fae3b0249b42dd8c2f5777ad5f933a9bbc50d2

Author: Brian Paul 
Date:   Fri Mar  5 09:24:15 2010 -0700

docs: document GL_APPLE_object_purgeable

---

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

diff --git a/docs/relnotes-7.8.html b/docs/relnotes-7.8.html
index 552b25a..ebe3d49 100644
--- a/docs/relnotes-7.8.html
+++ b/docs/relnotes-7.8.html
@@ -38,6 +38,7 @@ tbd
 GL_EXT_draw_buffers2 extension (swrast and i965 driver only)
 GL_ARB_fragment_coord_conventions extension (for swrast, i965, and Gallium 
drivers)
 GL_EXT_texture_array extension (swrast driver only)
+GL_APPLE_object_purgeable extension (swrast and i945/i965 DRI drivers)
 Much improved support for EGL in Mesa
 New state trackers for OpenGL ES 1.1 and 2.0
 Dedicated documentation for Gallium

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


Mesa (master): APPLE_object_purgeable: intel

2010-03-05 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 755915fa5d9ea782d142b3f8755b62d6de28fe29
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=755915fa5d9ea782d142b3f8755b62d6de28fe29

Author: Chris Wilson 
Date:   Wed Jan 13 18:35:25 2010 +

APPLE_object_purgeable: intel

Implement support for purgeable objects by using the GEM madvise ioctl.

Signed-off-by: Chris Wilson 

---

 src/mesa/drivers/dri/intel/intel_buffer_objects.c |  134 -
 src/mesa/drivers/dri/intel/intel_extensions.c |3 +
 2 files changed, 136 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c 
b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 312866d..7599bea 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -31,10 +31,12 @@
 #include "main/macros.h"
 #include "main/bufferobj.h"
 
-#include "intel_context.h"
 #include "intel_blit.h"
 #include "intel_buffer_objects.h"
 #include "intel_batchbuffer.h"
+#include "intel_context.h"
+#include "intel_fbo.h"
+#include "intel_mipmap_tree.h"
 #include "intel_regions.h"
 
 static GLboolean
@@ -588,6 +590,126 @@ intel_bufferobj_copy_subdata(GLcontext *ctx,
intel_batchbuffer_emit_mi_flush(intel->batch);
 }
 
+#if FEATURE_APPLE_object_purgeable
+static GLenum
+intel_buffer_purgeable(GLcontext * ctx,
+   drm_intel_bo *buffer,
+   GLenum option)
+{
+   int retained = 0;
+
+   if (buffer != NULL)
+  retained = drm_intel_bo_madvise (buffer, I915_MADV_DONTNEED);
+
+   return retained ? GL_VOLATILE_APPLE : GL_RELEASED_APPLE;
+}
+
+static GLenum
+intel_buffer_object_purgeable(GLcontext * ctx,
+  struct gl_buffer_object *obj,
+  GLenum option)
+{
+   struct intel_buffer_object *intel;
+
+   intel = intel_buffer_object (obj);
+   if (intel->buffer != NULL)
+  return intel_buffer_purgeable (ctx, intel->buffer, option);
+
+   if (option == GL_RELEASED_APPLE) {
+  if (intel->sys_buffer != NULL) {
+ free(intel->sys_buffer);
+ intel->sys_buffer = NULL;
+  }
+
+  return GL_RELEASED_APPLE;
+   } else {
+  /* XXX Create the buffer and madvise(MADV_DONTNEED)? */
+  return intel_buffer_purgeable (ctx,
+ intel_bufferobj_buffer(intel_context(ctx),
+intel, INTEL_READ),
+ option);
+   }
+}
+
+static GLenum
+intel_texture_object_purgeable(GLcontext * ctx,
+   struct gl_texture_object *obj,
+   GLenum option)
+{
+   struct intel_texture_object *intel;
+
+   intel = intel_texture_object(obj);
+   if (intel->mt == NULL || intel->mt->region == NULL)
+  return GL_RELEASED_APPLE;
+
+   return intel_buffer_purgeable (ctx, intel->mt->region->buffer, option);
+}
+
+static GLenum
+intel_render_object_purgeable(GLcontext * ctx,
+  struct gl_renderbuffer *obj,
+  GLenum option)
+{
+   struct intel_renderbuffer *intel;
+
+   intel = intel_renderbuffer(obj);
+   if (intel->region == NULL)
+  return GL_RELEASED_APPLE;
+
+   return intel_buffer_purgeable (ctx, intel->region->buffer, option);
+}
+
+static GLenum
+intel_buffer_unpurgeable(GLcontext * ctx,
+ drm_intel_bo *buffer,
+ GLenum option)
+{
+   int retained;
+
+   retained = 0;
+   if (buffer != NULL)
+  retained = drm_intel_bo_madvise (buffer, I915_MADV_WILLNEED);
+
+   return retained ? GL_RETAINED_APPLE : GL_UNDEFINED_APPLE;
+}
+
+static GLenum
+intel_buffer_object_unpurgeable(GLcontext * ctx,
+struct gl_buffer_object *obj,
+GLenum option)
+{
+   return intel_buffer_unpurgeable (ctx, intel_buffer_object (obj)->buffer, 
option);
+}
+
+static GLenum
+intel_texture_object_unpurgeable(GLcontext * ctx,
+ struct gl_texture_object *obj,
+ GLenum option)
+{
+   struct intel_texture_object *intel;
+
+   intel = intel_texture_object(obj);
+   if (intel->mt == NULL || intel->mt->region == NULL)
+  return GL_UNDEFINED_APPLE;
+
+   return intel_buffer_unpurgeable (ctx, intel->mt->region->buffer, option);
+}
+
+static GLenum
+intel_render_object_unpurgeable(GLcontext * ctx,
+struct gl_renderbuffer *obj,
+GLenum option)
+{
+   struct intel_renderbuffer *intel;
+
+   intel = intel_renderbuffer(obj);
+   if (intel->region == NULL)
+  return GL_UNDEFINED_APPLE;
+
+   return intel_buffer_unpurgeable (ctx, intel->region->buffer, option);
+}
+#endif
+
 void
 intelInitBufferObjectFuncs(struct dd_function_table *functions)
 {
@@ -601,4 +723,14 @@ intelInitBufferObjectFuncs(struct dd_function_table 
*functions)
functions->F

Mesa (master): Merge branch 'object-purgeable'

2010-03-05 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 6ba31fb2dbe6a90e6d60a49b3e5bd2edce05241d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ba31fb2dbe6a90e6d60a49b3e5bd2edce05241d

Author: Chris Wilson 
Date:   Fri Mar  5 15:03:51 2010 +

Merge branch 'object-purgeable'

Acked-by: Brian Paul 

---



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


Mesa (master): APPLE_object_purgeable: core

2010-03-05 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 99864d595f7d4c13e9548f83d5972db9af64e67b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=99864d595f7d4c13e9548f83d5972db9af64e67b

Author: Chris Wilson 
Date:   Fri Nov 13 12:19:35 2009 +

APPLE_object_purgeable: core

Signed-off-by: Chris Wilson 

---

 src/mesa/main/api_exec.c   |6 +
 src/mesa/main/bufferobj.c  |  356 
 src/mesa/main/bufferobj.h  |   11 ++
 src/mesa/main/dd.h |   17 ++
 src/mesa/main/dlist.c  |6 +
 src/mesa/main/extensions.c |4 +
 src/mesa/main/mfeatures.h  |1 +
 src/mesa/main/mtypes.h |4 +
 8 files changed, 405 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 70c154b..fa8d409 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -758,4 +758,10 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_EGLImageTargetTexture2DOES(exec, _mesa_EGLImageTargetTexture2DOES);
SET_EGLImageTargetRenderbufferStorageOES(exec, 
_mesa_EGLImageTargetRenderbufferStorageOES);
 #endif
+
+#if FEATURE_APPLE_object_purgeable
+   SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
+   SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
+   SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
+#endif
 }
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 971b280..3c48f6c 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -37,6 +37,8 @@
 #include "image.h"
 #include "context.h"
 #include "bufferobj.h"
+#include "fbobject.h"
+#include "texobj.h"
 
 
 /* Debug flags */
@@ -1710,3 +1712,357 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr 
offset, GLsizeiptr length)
if (ctx->Driver.FlushMappedBufferRange)
   ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj);
 }
+
+#if FEATURE_APPLE_object_purgeable
+static GLenum
+_mesa_BufferObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
+{
+   struct gl_buffer_object *bufObj;
+   GLenum retval;
+
+   bufObj = _mesa_lookup_bufferobj(ctx, name);
+   if (!bufObj) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glObjectPurgeable(name = 0x%x)", name);
+  return 0;
+   }
+   if (!_mesa_is_bufferobj(bufObj)) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" );
+  return 0;
+   }
+
+   if (bufObj->Purgeable) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glObjectPurgeable(name = 0x%x) is already purgeable", name);
+  return GL_VOLATILE_APPLE;
+   }
+
+   bufObj->Purgeable = GL_TRUE;
+
+   retval = GL_VOLATILE_APPLE;
+   if (ctx->Driver.BufferObjectPurgeable)
+  retval = ctx->Driver.BufferObjectPurgeable(ctx, bufObj, option);
+
+   return retval;
+}
+
+static GLenum
+_mesa_RenderObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
+{
+   struct gl_renderbuffer *bufObj;
+   GLenum retval;
+
+   bufObj = _mesa_lookup_renderbuffer(ctx, name);
+   if (!bufObj) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glObjectUnpurgeable(name = 0x%x)", name);
+  return 0;
+   }
+
+   if (bufObj->Purgeable) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glObjectPurgeable(name = 0x%x) is already purgeable", name);
+  return GL_VOLATILE_APPLE;
+   }
+
+   bufObj->Purgeable = GL_TRUE;
+
+   retval = GL_VOLATILE_APPLE;
+   if (ctx->Driver.RenderObjectPurgeable)
+  retval = ctx->Driver.RenderObjectPurgeable(ctx, bufObj, option);
+
+   return retval;
+}
+
+static GLenum
+_mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
+{
+   struct gl_texture_object *bufObj;
+   GLenum retval;
+
+   bufObj = _mesa_lookup_texture(ctx, name);
+   if (!bufObj) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glObjectPurgeable(name = 0x%x)", name);
+  return 0;
+   }
+
+   if (bufObj->Purgeable) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glObjectPurgeable(name = 0x%x) is already purgeable", name);
+  return GL_VOLATILE_APPLE;
+   }
+
+   bufObj->Purgeable = GL_TRUE;
+
+   retval = GL_VOLATILE_APPLE;
+   if (ctx->Driver.TextureObjectPurgeable)
+  retval = ctx->Driver.TextureObjectPurgeable(ctx, bufObj, option);
+
+   return retval;
+}
+
+GLenum GLAPIENTRY
+_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+   if (name == 0) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glObjectPurgeable(name = 0x%x)", name);
+  return 0;
+   }
+
+   switch (option) {
+   case GL_VOLATILE_APPLE:
+   case GL_RELEASED_APPLE:
+  break;
+
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  "glObjectPurgeable(name = 0x%x) invalid option: %d", name, 
option);
+  return 0;
+   }
+
+   switch (objectType) {
+   case GL_TEXTURE:
+  return _mesa_TextureObj

Mesa (master): APPLE_object_purgeable: autogenerated files

2010-03-05 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 894d0ab9388543642b6940f09358844736a8bd3a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=894d0ab9388543642b6940f09358844736a8bd3a

Author: Chris Wilson 
Date:   Thu Nov 12 10:15:49 2009 +

APPLE_object_purgeable: autogenerated files

---

 src/mesa/glapi/glapidispatch.h |   37 +-
 src/mesa/glapi/glapioffsets.h  |   22 +-
 src/mesa/glapi/glapitable.h|   17 +-
 src/mesa/glapi/glapitemp.h |   44 +-
 src/mesa/glapi/glprocs.h   |  640 +++---
 src/mesa/main/enums.c  | 6108 
 src/mesa/main/remap_helper.h   | 3040 ++--
 src/mesa/sparc/glapi_sparc.S   |   19 +-
 src/mesa/x86-64/glapi_x86-64.S |  195 +-
 src/mesa/x86/glapi_x86.S   |   23 +-
 10 files changed, 5182 insertions(+), 4963 deletions(-)

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


Mesa (master): APPLE_object_purgeable: xml

2010-03-05 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: e5c49e49cce6c14bc9e973dea4d69e0b7d36086d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5c49e49cce6c14bc9e973dea4d69e0b7d36086d

Author: Chris Wilson 
Date:   Thu Nov 12 10:12:56 2009 +

APPLE_object_purgeable: xml

Signed-off-by: Chris Wilson 

---

 src/mesa/glapi/gen/APPLE_object_purgeable.xml |   37 +
 src/mesa/glapi/gen/Makefile   |1 +
 src/mesa/glapi/gen/gl_API.xml |1 +
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/mesa/glapi/gen/APPLE_object_purgeable.xml 
b/src/mesa/glapi/gen/APPLE_object_purgeable.xml
new file mode 100644
index 000..62fa64a
--- /dev/null
+++ b/src/mesa/glapi/gen/APPLE_object_purgeable.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+   
+
+
+
+
+
+
+
+
+   
+
+
+
+
+
+
+   
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mesa/glapi/gen/Makefile b/src/mesa/glapi/gen/Makefile
index 8e9c909..8aa74ce 100644
--- a/src/mesa/glapi/gen/Makefile
+++ b/src/mesa/glapi/gen/Makefile
@@ -79,6 +79,7 @@ API_XML = \
ARB_seamless_cube_map.xml \
ARB_sync.xml \
ARB_vertex_array_object.xml \
+   APPLE_object_purgeable.xml \
APPLE_vertex_array_object.xml \
EXT_draw_buffers2.xml \
EXT_framebuffer_object.xml \
diff --git a/src/mesa/glapi/gen/gl_API.xml b/src/mesa/glapi/gen/gl_API.xml
index 0b3d57b..4a4d0d5 100644
--- a/src/mesa/glapi/gen/gl_API.xml
+++ b/src/mesa/glapi/gen/gl_API.xml
@@ -11978,6 +11978,7 @@
 
 
 
+http://www.w3.org/2001/XInclude"/>
 http://www.w3.org/2001/XInclude"/>
 
 

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