Mesa (master): Add an autoconf option for mangling Mesa.

2011-10-17 Thread Thomas Fogal
Module: Mesa
Branch: master
Commit: c0573fb29df6defe58f4898f0b8a42e8b9214d36
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0573fb29df6defe58f4898f0b8a42e8b9214d36

Author: Tom Fogal tfo...@alumni.unh.edu
Date:   Mon Oct 10 10:33:18 2011 -0600

Add an autoconf option for mangling Mesa.

In addition to setting up the flags correctly, this renames the
generated libraries to ensure they get 'Mangled' in the name.
This is very useful for distros and the like, where mangled Mesa
and non-mangled GL libraries typically need to be installed
side-by-side.

Reviewed-by: Dan Nicholson dbn.li...@gmail.com

---

 configs/autoconf.in |4 ++--
 configure.ac|   27 ---
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 9bbafc9..96fe5da 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -64,8 +64,8 @@ FLEX = @FLEX@
 BISON = @BISON@
 
 # Library names (base name)
-GL_LIB = GL
-GLU_LIB = GLU
+GL_LIB = @GL_LIB@
+GLU_LIB = @GLU_LIB@
 GLW_LIB = GLw
 OSMESA_LIB = @OSMESA_LIB@
 GLESv1_CM_LIB = GLESv1_CM
diff --git a/configure.ac b/configure.ac
index ae7b36b..3f951ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -350,6 +350,28 @@ else
 fi
 
 dnl
+dnl Mangled Mesa support
+dnl
+AC_ARG_ENABLE([mangling],
+  [AS_HELP_STRING([--enable-mangling],
+[enable mangled symbols and library name @:@default=disabled@:@])],
+  [enable_mangling=${enableval}],
+  [enable_mangling=no]
+)
+GL_LIB=GL
+GLU_LIB=GLU
+OSMESA_LIB=OSMesa
+if test x${enable_mangling} = xyes ; then
+  DEFINES=${DEFINES} -DUSE_MGL_NAMESPACE
+  GL_LIB=MangledGL
+  GLU_LIB=MangledGLU
+  OSMESA_LIB=MangledOSMesa
+fi
+AC_SUBST([GL_LIB])
+AC_SUBST([GLU_LIB])
+AC_SUBST([OSMESA_LIB])
+
+dnl
 dnl potentially-infringing-but-nobody-knows-for-sure stuff
 dnl
 AC_ARG_ENABLE([texture-float],
@@ -1288,17 +1310,16 @@ if test x$osmesa_bits != x8; then
 fi
 case x$osmesa_bits in
 x8)
-OSMESA_LIB=OSMesa
+OSMESA_LIB=${OSMESA_LIB}
 ;;
 x16|x32)
-OSMESA_LIB=OSMesa$osmesa_bits
+OSMESA_LIB=${OSMESA_LIB}$osmesa_bits
 DEFINES=$DEFINES -DCHAN_BITS=$osmesa_bits 
-DDEFAULT_SOFTWARE_DEPTH_BITS=31
 ;;
 *)
 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
 ;;
 esac
-AC_SUBST([OSMESA_LIB])
 
 if test x$enable_osmesa = xyes; then
 # only link libraries with osmesa if shared

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


Mesa (master): st/xorg: remove target library on make clean

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: adbab41e6722a428d12b19db48d7a4644eab920b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=adbab41e6722a428d12b19db48d7a4644eab920b

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct 16 14:37:36 2011 +0200

st/xorg: remove target library on make clean

---

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

diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index d1231ca..be0cb4c 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -60,7 +60,7 @@ $(TOP)/$(LIB_DIR)/gallium:
mkdir -p $@
 
 clean:
-   rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME).a depend depend.bak
+   rm -f $(OBJECTS) $(GENERATED_SOURCES) $(LIBNAME) depend depend.bak
 
 install:
$(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR)

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


Mesa (master): gallium/targets: use c++ compiler for linking

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 757390491cfa3b861fab76940a8c6e508d1f1a25
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=757390491cfa3b861fab76940a8c6e508d1f1a25

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Thu Oct 13 21:45:45 2011 +0200

gallium/targets: use c++ compiler for linking

As pointed out by Michel Dänzer, gcc -lstdc++ doesn't work on all systems,
because it may require other libraries which are only pulled in implicitly
by g++. And libstdc++ is available only with GNU compiler.

Use c++ compiler for linking and remove redundant LDFLAGS += -lstdc++
all over the tree.

---

 configure.ac  |2 +-
 src/gallium/targets/Makefile.dri  |2 -
 src/gallium/targets/Makefile.va   |9 ++-
 src/gallium/targets/Makefile.vdpau|9 ++-
 src/gallium/targets/Makefile.xorg |   11 ++---
 src/gallium/targets/Makefile.xvmc |   10 ++--
 src/gallium/targets/gbm/Makefile  |   34 
 src/gallium/targets/xa-vmwgfx/Makefile|9 ++-
 src/gallium/targets/xorg-nouveau/Makefile |2 +
 src/gallium/targets/xvmc-nouveau/Makefile |2 +
 10 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3f951ec..0864b55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1748,7 +1748,7 @@ if test x$enable_gallium_llvm = xyes; then
 if test x$LLVM_CONFIG != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version`
LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed 's/-DNDEBUG\//g'`
-   LLVM_LIBS=`$LLVM_CONFIG --libs` -lstdc++
+   LLVM_LIBS=`$LLVM_CONFIG --libs`
 
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
DEFINES=$DEFINES -D__STDC_CONSTANT_MACROS
diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
index 857ebfe..a26b3ee 100644
--- a/src/gallium/targets/Makefile.dri
+++ b/src/gallium/targets/Makefile.dri
@@ -4,8 +4,6 @@
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)
 DRIVER_EXTRAS = $(LLVM_LIBS)
-else
-LDFLAGS += -lstdc++
 endif
 
 MESA_MODULES = \
diff --git a/src/gallium/targets/Makefile.va b/src/gallium/targets/Makefile.va
index 7ced430..920f130 100644
--- a/src/gallium/targets/Makefile.va
+++ b/src/gallium/targets/Makefile.va
@@ -17,8 +17,13 @@ STATE_TRACKER_LIB = 
$(TOP)/src/gallium/state_trackers/va/libvatracker.a
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)
 DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
 else
-LDFLAGS += -lstdc++
+  ifeq ($(LINK_WITH_CXX),1)
+LD=$(CXX)
+  else
+LD=$(CC)
+  endif
 endif
 
 # XXX: Hack, VA public funcs aren't exported
@@ -39,7 +44,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
-   $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+   $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VA_MAJOR) -minor $(VA_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) 
$(DRIVER_EXTRAS)
diff --git a/src/gallium/targets/Makefile.vdpau 
b/src/gallium/targets/Makefile.vdpau
index c634915..39984e2 100644
--- a/src/gallium/targets/Makefile.vdpau
+++ b/src/gallium/targets/Makefile.vdpau
@@ -17,8 +17,13 @@ STATE_TRACKER_LIB = 
$(TOP)/src/gallium/state_trackers/vdpau/libvdpautracker.a
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)
 DRIVER_EXTRAS = $(LLVM_LIBS)
+LD=$(CXX)
 else
-LDFLAGS += -lstdc++
+  ifeq ($(LINK_WITH_CXX),1)
+LD=$(CXX)
+  else
+LD=$(CC)
+  endif
 endif
 
 # XXX: Hack, VDPAU public funcs aren't exported if we link to 
libvdpautracker.a :(
@@ -39,7 +44,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
-   $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+   $(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VDPAU_MAJOR) -minor $(VDPAU_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
$(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS) 
$(DRIVER_EXTRAS)
diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index c96eded..d1231ca 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -29,12 +29,15 @@ INCLUDES = \
 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
 
 ifeq ($(MESA_LLVM),1)
-LD = $(CXX)
 LDFLAGS += $(LLVM_LDFLAGS)
-USE_CXX=1
 DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
+LD=$(CXX)
 else
-LDFLAGS += -lstdc++
+  ifeq ($(LINK_WITH_CXX),1)
+LD=$(CXX)
+  else
+LD=$(CC)
+  endif
 endif
 
 
@@ -43,7 +46,7 @@ endif
 default: depend 

Mesa (master): targets/va/vdpau/xvmc: don't rebuild target lib every time

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 106c99fee52fe712ee5792e876b83aa318740b7d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=106c99fee52fe712ee5792e876b83aa318740b7d

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct 16 18:51:11 2011 +0200

targets/va/vdpau/xvmc: don't rebuild target lib every time

Dependency on target directory caused unnecessary relink. Remove them.

---

 src/gallium/targets/Makefile.va|2 +-
 src/gallium/targets/Makefile.vdpau |2 +-
 src/gallium/targets/Makefile.xvmc  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/Makefile.va b/src/gallium/targets/Makefile.va
index 920f130..7215fc3 100644
--- a/src/gallium/targets/Makefile.va
+++ b/src/gallium/targets/Makefile.va
@@ -43,7 +43,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VA_MAJOR) -minor $(VA_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
diff --git a/src/gallium/targets/Makefile.vdpau 
b/src/gallium/targets/Makefile.vdpau
index 39984e2..c59cd02 100644
--- a/src/gallium/targets/Makefile.vdpau
+++ b/src/gallium/targets/Makefile.vdpau
@@ -43,7 +43,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(VDPAU_MAJOR) -minor $(VDPAU_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
diff --git a/src/gallium/targets/Makefile.xvmc 
b/src/gallium/targets/Makefile.xvmc
index cb35d3c..8c7b7f4 100644
--- a/src/gallium/targets/Makefile.xvmc
+++ b/src/gallium/targets/Makefile.xvmc
@@ -43,7 +43,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 
 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) 
$(STATE_TRACKER_LIB) Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(LD)' -ldflags '$(LDFLAGS)' \
-major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \

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


Mesa (master): st/xorg: fix build when /lib/ gallium directory does not exist yet

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 638d5a10f31aebe8642e862de7d0a1eaf977ebae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=638d5a10f31aebe8642e862de7d0a1eaf977ebae

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct 16 20:13:49 2011 +0200

st/xorg: fix build when /lib/gallium directory does not exist yet

TARGET was not defined, so make checked directory instead of file

---

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

diff --git a/src/gallium/targets/Makefile.xorg 
b/src/gallium/targets/Makefile.xorg
index be0cb4c..481e3d6 100644
--- a/src/gallium/targets/Makefile.xorg
+++ b/src/gallium/targets/Makefile.xorg
@@ -26,7 +26,7 @@ INCLUDES = \
-I$(TOP)/src/gallium/winsys \
$(DRIVER_INCLUDES)
 
-LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
+LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 
 ifeq ($(MESA_LLVM),1)
 LDFLAGS += $(LLVM_LDFLAGS)

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


Mesa (7.11): nouveau: fix crash during fence emission

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: 8d1f1eae93a873fae3639134581de6ac1f6d413e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d1f1eae93a873fae3639134581de6ac1f6d413e

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Sep 25 16:01:19 2011 +0200

nouveau: fix crash during fence emission

Fence emission can flush the push buffer, which through flush_notify
unreferences recently emitted fence. If ref count is increased after
fence emission, unreference deletes the fence, which causes SIGSEGV.

Backtrace:
nouveau_fence_del
nouveau_fence_ref
nouveau_fence_next
nouveau_pushbuf_flush
MARK_RING
nv50_screen_fence_emit
nouveau_fence_emit
nv50_flush

This bug manifested as an assertion failure in nouveau_fence.c, because
SIGSEGV handler tried to shutdown the application and used messed up
fence.

This issue was reported by Maxim Levitsky.

(commit e1e03ce4928edf4ea0ef43d853cb869f70b126aa in master)

---

 src/gallium/drivers/nouveau/nouveau_fence.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index ea2038c..26e4775 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -93,8 +93,6 @@ nouveau_fence_emit(struct nouveau_fence *fence)
/* set this now, so that if fence.emit triggers a flush we don't recurse */
fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 
-   screen-fence.emit(screen-base, fence-sequence);
-
++fence-ref;
 
if (screen-fence.tail)
@@ -103,6 +101,8 @@ nouveau_fence_emit(struct nouveau_fence *fence)
   screen-fence.head = fence;
 
screen-fence.tail = fence;
+
+   screen-fence.emit(screen-base, fence-sequence);
 }
 
 void

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


Mesa (7.11): nouveau: fix fence hang

2011-10-17 Thread Marcin Ślusarz
Module: Mesa
Branch: 7.11
Commit: 08fa61dab601d299541778f3a381e859f8f25e1e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08fa61dab601d299541778f3a381e859f8f25e1e

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Oct  8 23:05:25 2011 +0200

nouveau: fix fence hang

If there is not enough space in pushbuffer for fence emission
(nouveau_fence_emit - nv50_screen_fence_emit - MARK_RING),
the pushbuffer is flushed, which through flush_notify -
nv50_default_flush_notify - nouveau_fence_update marks currently
emitting fence as flushed. But actual emission is done after this mark.
So later when there is a need to wait on this fence and pushbuffer
was not flushed in between, fence wait will never finish causing
application to hang.

To fix this, introduce new fence state between AVAILABLE and EMITTED,
set it before emission and handle it everywhere.

Additionally obtain fence sequence numbers after possible flush in
MARK_RING, because we want to emit fences in correct order.

Reviewed-by: Christoph Bumiller e0425...@student.tuwien.ac.at

(commit 9849f366cbfd781ebeca725058029b70c96836f9 in master)

---

 src/gallium/drivers/nouveau/nouveau_fence.c  |   17 +++--
 src/gallium/drivers/nouveau/nouveau_fence.h  |7 ---
 src/gallium/drivers/nouveau/nouveau_screen.h |2 +-
 src/gallium/drivers/nv50/nv50_screen.c   |8 ++--
 src/gallium/drivers/nvc0/nvc0_screen.c   |8 ++--
 5 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index 26e4775..a2fcafe 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -86,12 +86,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 {
struct nouveau_screen *screen = fence-screen;
 
-   fence-sequence = ++screen-fence.sequence;
-
assert(fence-state == NOUVEAU_FENCE_STATE_AVAILABLE);
 
/* set this now, so that if fence.emit triggers a flush we don't recurse */
-   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
+   fence-state = NOUVEAU_FENCE_STATE_EMITTING;
 
++fence-ref;
 
@@ -102,7 +100,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 
screen-fence.tail = fence;
 
-   screen-fence.emit(screen-base, fence-sequence);
+   screen-fence.emit(screen-base, fence-sequence);
+
+   assert(fence-state == NOUVEAU_FENCE_STATE_EMITTING);
+   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 }
 
 void
@@ -162,7 +163,8 @@ nouveau_fence_update(struct nouveau_screen *screen, boolean 
flushed)
 
if (flushed) {
   for (fence = next; fence; fence = fence-next)
- fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
+ if (fence-state == NOUVEAU_FENCE_STATE_EMITTED)
+fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
}
 }
 
@@ -185,6 +187,9 @@ nouveau_fence_wait(struct nouveau_fence *fence)
struct nouveau_screen *screen = fence-screen;
uint32_t spins = 0;
 
+   /* wtf, someone is waiting on a fence in flush_notify handler? */
+   assert(fence-state != NOUVEAU_FENCE_STATE_EMITTING);
+
if (fence-state  NOUVEAU_FENCE_STATE_EMITTED) {
   nouveau_fence_emit(fence);
 
@@ -216,7 +221,7 @@ nouveau_fence_wait(struct nouveau_fence *fence)
 void
 nouveau_fence_next(struct nouveau_screen *screen)
 {
-   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTED)
+   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTING)
   nouveau_fence_emit(screen-fence.current);
 
nouveau_fence_ref(NULL, screen-fence.current);
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.h 
b/src/gallium/drivers/nouveau/nouveau_fence.h
index 680c75e..3984a9a 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.h
+++ b/src/gallium/drivers/nouveau/nouveau_fence.h
@@ -6,9 +6,10 @@
 #include util/u_double_list.h
 
 #define NOUVEAU_FENCE_STATE_AVAILABLE 0
-#define NOUVEAU_FENCE_STATE_EMITTED   1
-#define NOUVEAU_FENCE_STATE_FLUSHED   2
-#define NOUVEAU_FENCE_STATE_SIGNALLED 3
+#define NOUVEAU_FENCE_STATE_EMITTING  1
+#define NOUVEAU_FENCE_STATE_EMITTED   2
+#define NOUVEAU_FENCE_STATE_FLUSHED   3
+#define NOUVEAU_FENCE_STATE_SIGNALLED 4
 
 struct nouveau_fence_work {
struct list_head list;
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index d910809..40d2351 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -24,7 +24,7 @@ struct nouveau_screen {
struct nouveau_fence *current;
u32 sequence;
u32 sequence_ack;
-   void (*emit)(struct pipe_screen *, u32 sequence);
+   void (*emit)(struct pipe_screen *, u32 *sequence);
u32  (*update)(struct pipe_screen *);
} fence;
 
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index cc921d0..9606c99 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ 

Mesa (7.11): i965: fix the constant interp bitmask for flat mode

2011-10-17 Thread Kenneth Graunke
Module: Mesa
Branch: 7.11
Commit: c3fd76ce092a0c6aa6b5c466f61619511dbb2349
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3fd76ce092a0c6aa6b5c466f61619511dbb2349

Author: Yuanhan Liu yuanhan@linux.intel.com
Date:   Tue Sep  6 09:29:37 2011 +0800

i965: fix the constant interp bitmask for flat mode

Fix the constant interpolation enable bit mask for flat light mode.
FRAG_BIT_COL0 attribute bit might be 0, in which case we need to
shift one more bit right.

This would fix the oglc specularColor test fail on both Sandybridge and
Ivybridge.

v2: move the constant interp bitmask setup code into for(; attr 
FRAG_ATTRIB_MAX; attr++) loop suggested by Eric.

Also fixes the Civilization 4 intro videos.

Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
Signed-off-by: Xiang, Haihao haihao.xi...@intel.com
(cherry picked from commit cd6b8421cac2df89dc6365ce368232e461caffcd)

---

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

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 5bb731d..cc9bdf4 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -231,12 +231,6 @@ upload_sf_state(struct brw_context *brw)
 (1  GEN6_SF_TRIFAN_PROVOKE_SHIFT);
}
 
-   /* flat shading */
-   if (ctx-Light.ShadeModel == GL_FLAT) {
-   dw17 |= ((brw-fragment_program-Base.InputsRead  (FRAG_BIT_COL0 | 
FRAG_BIT_COL1)) 
-((brw-fragment_program-Base.InputsRead  FRAG_BIT_WPOS) ? 0 
: 1));
-   }
-
/* Create the mapping from the FS inputs we produce to the VS outputs
 * they source from.
 */
@@ -254,6 +248,19 @@ upload_sf_state(struct brw_context *brw)
   if (attr == FRAG_ATTRIB_PNTC)
 dw16 |= (1  input_index);
 
+  /* flat shading */
+  if (ctx-Light.ShadeModel == GL_FLAT) {
+ /*
+  * Setup the Constant Interpolation Enable bit mask for each
+  * corresponding attribute(currently, we only care two attrs:
+  * FRAG_BIT_COL0 and FRAG_BIT_COL1).
+  *
+  * FIXME: should we care other attributes?
+  */
+ if (attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1)
+ dw17 |= (1  input_index);
+  }
+
   /* The hardware can only do the overrides on 16 overrides at a
* time, and the other up to 16 have to be lined up so that the
* input index = the output index.  We'll need to do some
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 0f97cea..6910e02 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -58,13 +58,7 @@ upload_sbe_state(struct brw_context *brw)
   dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT;
 
dw10 = 0;
-
-   /* _NEW_LIGHT (flat shading) */
dw11 = 0;
-   if (ctx-Light.ShadeModel == GL_FLAT) {
-   dw11 |= ((brw-fragment_program-Base.InputsRead  (FRAG_BIT_COL0 | 
FRAG_BIT_COL1)) 
-((brw-fragment_program-Base.InputsRead  FRAG_BIT_WPOS) ? 0 
: 1));
-   }
 
/* Create the mapping from the FS inputs we produce to the VS outputs
 * they source from.
@@ -82,6 +76,19 @@ upload_sbe_state(struct brw_context *brw)
   if (attr == FRAG_ATTRIB_PNTC)
 dw10 |= (1  input_index);
 
+  /* flat shading */
+  if (ctx-Light.ShadeModel == GL_FLAT) {
+ /*
+  * Setup the Constant Interpolation Enable bit mask for each
+  * corresponding attribute(currently, we only care two attrs:
+  * FRAG_BIT_COL0 and FRAG_BIT_COL1).
+  *
+  * FIXME: should we care other attributes?
+  */
+ if (attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1)
+ dw11 |= (1  input_index);
+  }
+
   /* The hardware can only do the overrides on 16 overrides at a
* time, and the other up to 16 have to be lined up so that the
* input index = the output index.  We'll need to do some

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


Mesa (master): r600g: Use the bitfield define matching the register it is used for.

2011-10-17 Thread Mathias Fröhlich
Module: Mesa
Branch: master
Commit: e556983fc8f0ac9046c5a5e3e34e8ea036587ac7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e556983fc8f0ac9046c5a5e3e34e8ea036587ac7

Author: Mathias Fröhlich mathias.froehl...@gmx.net
Date:   Fri Sep 23 19:43:31 2011 +0200

r600g: Use the bitfield define matching the register it is used for.

Fix a typo that should result in the same code.

---

 src/gallium/drivers/r600/r600_state.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index 03e6958..1aa4105 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -2108,8 +2108,8 @@ void r600_pipe_shader_ps(struct pipe_context *ctx, struct 
r600_pipe_shader *shad
0, 0x, shader-bo, RADEON_USAGE_READ);
r600_pipe_state_add_reg(rstate,
R_028850_SQ_PGM_RESOURCES_PS,
-   S_028868_NUM_GPRS(rshader-bc.ngpr) |
-   S_028868_STACK_SIZE(rshader-bc.nstack),
+   S_028850_NUM_GPRS(rshader-bc.ngpr) |
+   S_028850_STACK_SIZE(rshader-bc.nstack),
0x, NULL, 0);
r600_pipe_state_add_reg(rstate,
R_028854_SQ_PGM_EXPORTS_PS,

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


Mesa (master): i915g: Add TODO.

2011-10-17 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 3637b5f0dd7e4b514f446c264827d80d7ac14289
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3637b5f0dd7e4b514f446c264827d80d7ac14289

Author: Stéphane Marchesin marc...@chromium.org
Date:   Sat Oct 15 23:12:05 2011 -0700

i915g: Add TODO.

---

 src/gallium/drivers/i915/TODO |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/i915/TODO b/src/gallium/drivers/i915/TODO
index 0e511ab..e10f473 100644
--- a/src/gallium/drivers/i915/TODO
+++ b/src/gallium/drivers/i915/TODO
@@ -36,5 +36,7 @@ Random list of problems with i915g:
 
 - i915_delete_fs_state doesn't call draw_delete_fragment_shader. Why?
 
+- Schedule instructions to minimize the number of phases.
+
 Other bugs can be found here:
 
https://bugs.freedesktop.org/buglist.cgi?bug_status=NEWbug_status=ASSIGNEDbug_status=REOPENEDcomponent=Drivers/Gallium/i915g

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


Mesa (master): i915g: Use the right shader limits.

2011-10-17 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 0b3842edb1a0bc1a2163571ef476e080f7c40b0f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b3842edb1a0bc1a2163571ef476e080f7c40b0f

Author: Stéphane Marchesin marc...@chromium.org
Date:   Mon Oct 17 21:43:19 2011 -0700

i915g: Use the right shader limits.

---

 src/gallium/drivers/i915/i915_fpc.h|2 +-
 src/gallium/drivers/i915/i915_reg.h|4 
 src/gallium/drivers/i915/i915_screen.c |8 
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_fpc.h 
b/src/gallium/drivers/i915/i915_fpc.h
index 26cf2fb..bfd658f 100644
--- a/src/gallium/drivers/i915/i915_fpc.h
+++ b/src/gallium/drivers/i915/i915_fpc.h
@@ -37,7 +37,7 @@
 
 #include tgsi/tgsi_parse.h
 
-#define I915_PROGRAM_SIZE 192
+#define I915_PROGRAM_SIZE (3 * I915_MAX_INSN)
 
 /* Use those indices for pos/face routing, must be = num of inputs */
 #define I915_SEMANTIC_POS  100
diff --git a/src/gallium/drivers/i915/i915_reg.h 
b/src/gallium/drivers/i915/i915_reg.h
index e48a942..620c64e 100644
--- a/src/gallium/drivers/i915/i915_reg.h
+++ b/src/gallium/drivers/i915/i915_reg.h
@@ -488,6 +488,10 @@
 #define I915_MAX_DECL_INSN27
 #define I915_MAX_TEMPORARY16
 
+#define I915_MAX_INSN  (I915_MAX_DECL_INSN + \
+   I915_MAX_TEX_INSN + \
+   I915_MAX_ALU_INSN)
+
 
 /* Each instruction is 3 dwords long, though most don't require all
  * this space.  Maximum of 123 instructions.  Smaller maxes per insn
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 4e14b2f..75545f4 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -117,11 +117,11 @@ i915_get_shader_param(struct pipe_screen *screen, 
unsigned shader, enum pipe_sha
   /* XXX: these are just shader model 2.0 values, fix this! */
   switch(cap) {
   case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
- return 96;
+ return I915_MAX_ALU_INSN + I915_MAX_TEX_INSN;
   case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
- return 64;
+ return I915_MAX_ALU_INSN;
   case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
- return 32;
+ return I915_MAX_TEX_INSN;
   case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
  return 8;
   case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
@@ -150,7 +150,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned 
shader, enum pipe_sha
   case PIPE_SHADER_CAP_INTEGERS:
  return 0;
   case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
- return 8;
+ return I915_TEX_UNITS;
   default:
  debug_printf(%s: Unknown cap %u.\n, __FUNCTION__, cap);
  return 0;

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