Mesa (master): scons: Prefer x86_64-w64-mingw32- prefix.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 191428ccb86af462a8872da6937ab004c5691745
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=191428ccb86af462a8872da6937ab004c5691745

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:21:24 2011 +0100

scons: Prefer x86_64-w64-mingw32- prefix.

This allows to use mingw-w64 binaries on debian systems which already
include a (typically incomplete) 64 cross compiler.

---

 scons/crossmingw.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scons/crossmingw.py b/scons/crossmingw.py
index 4a695a4..949fc4f 100644
--- a/scons/crossmingw.py
+++ b/scons/crossmingw.py
@@ -57,10 +57,10 @@ prefixes32 = SCons.Util.Split(
 i686-w64-mingw32-
 )
 prefixes64 = SCons.Util.Split(
+x86_64-w64-mingw32-
 amd64-mingw32-
 amd64-mingw32msvc-
 amd64-pc-mingw32-
-x86_64-w64-mingw32-
 )
 
 def find(env):

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


Mesa (master): gdi: Remove mesa_wgl.h

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: d290febdc83a828b1cbe6a5e7155e47b29385dad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d290febdc83a828b1cbe6a5e7155e47b29385dad

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:26:36 2011 +0100

gdi: Remove mesa_wgl.h

All commonly used windows toolchains define wgl entrypoints in the windows
headers, and mesa_wgl.h not only is unnecessary but actually often stands
in the waydue to slight inconsistencies.

So remove it.

---

 include/GL/gl.h|6 --
 include/GL/mesa_wgl.h  |  121 
 src/mesa/drivers/windows/gdi/wgl.c |   23 ---
 3 files changed, 0 insertions(+), 150 deletions(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index bca550f..998a83a 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -91,12 +91,6 @@
 #include windows.h
 #endif
 
-#if defined(_WIN32)  !defined(_WINGDI_)  !defined(_WIN32_WCE) \
-  !defined(_GNU_H_WINDOWS32_DEFINES)  !defined(OPENSTEP) \
-  !defined(__CYGWIN__) || defined(__MINGW32__)
-#include GL/mesa_wgl.h
-#endif
-
 #if defined(macintosh)  PRAGMA_IMPORT_SUPPORTED
 #pragma import on
 #endif
diff --git a/include/GL/mesa_wgl.h b/include/GL/mesa_wgl.h
deleted file mode 100644
index ca2e1b8..000
--- a/include/GL/mesa_wgl.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  3.1
- *
- * Copyright (C) 1999  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.
- */
-
-
-/* prototypes for the Mesa WGL functions */
-/* relocated here so that I could make GLUT get them properly */
-
-#ifndef _mesa_wgl_h_
-#define _mesa_wgl_h_
-
-#if defined(__MINGW32__)
-#  define __W32API_USE_DLLIMPORT__
-#endif
-
-#include GL/gl.h
-
-#ifdef __cplusplus
-extern C {
-#endif
-
-
-#ifndef WGLAPI
-#define WGLAPI GLAPI
-#endif
-
-#if defined(__MINGW32__)
-#  ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#  endif
-#  include windows.h
-#endif
-
-
-#if defined(_WIN32)  !defined(_WINGDI_)  
!defined(_GNU_H_WINDOWS32_DEFINES)  !defined(OPENSTEP)
-#ifndef _GNU_H_WINDOWS32_FUNCTIONS
-#  ifdef UNICODE
-#  define wglUseFontBitmaps  wglUseFontBitmapsW
-#  define wglUseFontOutlines  wglUseFontOutlinesW
-#  else
-#  define wglUseFontBitmaps  wglUseFontBitmapsA
-#  define wglUseFontOutlines  wglUseFontOutlinesA
-#  endif /* !UNICODE */
-#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
-typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, 
*PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
-typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, 
*LPGLYPHMETRICSFLOAT;
-typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, 
*PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
-#endif
-
-
-#ifdef _MSC_VER
-#  pragma warning( disable : 4615 ) /* pragma warning : unknown user warning 
type*/
-#  pragma warning( push )
-#  pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. 
dllexport assumed. */
-#endif
-
-
-WGLAPI int   GLAPIENTRY wglSetPixelFormat(HDC, int, const 
PIXELFORMATDESCRIPTOR *);
-WGLAPI int   GLAPIENTRY wglSwapBuffers(HDC hdc);
-WGLAPI int   GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR 
*);
-WGLAPI int   GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, 
LPPIXELFORMATDESCRIPTOR);
-WGLAPI int   GLAPIENTRY wglGetPixelFormat(HDC hdc);
-
-WGLAPI int   GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
-WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
-WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
-WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
-WGLAPI int   GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned 
int,LPLAYERPLANEDESCRIPTOR);
-WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
-WGLAPI HDC   GLAPIENTRY wglGetCurrentDC(void);
-WGLAPI int   GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF 
*);
-WGLAPI PROC  GLAPIENTRY 

Mesa (master): st/wgl: Fix build on mingw-w64

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: ec759b37553226b2b945d6c5d93c4bfb630a38a4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec759b37553226b2b945d6c5d93c4bfb630a38a4

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:28:02 2011 +0100

st/wgl: Fix build on mingw-w64

Which already declares wglSwapMultipleBuffers and WGLSWAP.

---

 src/gallium/state_trackers/wgl/stw_wgl.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_wgl.h 
b/src/gallium/state_trackers/wgl/stw_wgl.h
index 57baaf0..31a391d 100644
--- a/src/gallium/state_trackers/wgl/stw_wgl.h
+++ b/src/gallium/state_trackers/wgl/stw_wgl.h
@@ -59,7 +59,7 @@ wglSetPixelFormat(HDC hdc,
   int iPixelFormat,
   CONST PIXELFORMATDESCRIPTOR *ppfd);
 
-#if defined(__MINGW32__) || (WINVER  0x0500)
+#ifndef WGL_SWAPMULTIPLE_MAX
 
 typedef struct _WGLSWAP
 {
@@ -73,7 +73,7 @@ WINGDIAPI DWORD WINAPI
 wglSwapMultipleBuffers(UINT n,
CONST WGLSWAP *ps);
 
-#endif
+#endif /* !WGL_SWAPMULTIPLE_MAX */
 
 
 #endif /* STW_WGL_H_ */

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


Mesa (master): libgl-gdi: Fix mingw-w64 build.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: a68ba5e0f099e54cf16b6e33a0fc0a8db7455eed
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a68ba5e0f099e54cf16b6e33a0fc0a8db7455eed

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:28:41 2011 +0100

libgl-gdi: Fix mingw-w64 build.

Mingw-w64 actually seems to be closer to MSVC in terms of .DEF parsing.

---

 src/gallium/targets/libgl-gdi/SConscript |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/targets/libgl-gdi/SConscript 
b/src/gallium/targets/libgl-gdi/SConscript
index 49462a8..f6c8e8d 100644
--- a/src/gallium/targets/libgl-gdi/SConscript
+++ b/src/gallium/targets/libgl-gdi/SConscript
@@ -27,7 +27,9 @@ if env['llvm']:
 env.Append(CPPDEFINES = 'HAVE_LLVMPIPE')
 drivers += [llvmpipe]
 
-if env['gcc']:
+if env['gcc'] and 'w64' not in env['CC'].split('-'):
+# DEF parser in certain versions of MinGW is busted, as does not behave as
+# MSVC.  mingw-w64 works fine.
 sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def']
 else:
 sources += ['#src/gallium/state_trackers/wgl/opengl32.def']

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


Mesa (master): Remote *.mgw stuff.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 3ab19bf82af8b62207e7e8585f275593d708a527
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ab19bf82af8b62207e7e8585f275593d708a527

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:35:49 2011 +0100

Remote *.mgw stuff.

Totally broken, and deprecated by scons.

---

 configs/config.mgw   |   42 -
 docs/README.MINGW32  |  153 --
 docs/README.WIN32|2 +
 src/glu/sgi/Makefile.mgw |  230 --
 src/mesa/Makefile.mgw|  216 ---
 5 files changed, 2 insertions(+), 641 deletions(-)

diff --git a/configs/config.mgw b/configs/config.mgw
deleted file mode 100644
index af74fda..000
--- a/configs/config.mgw
+++ /dev/null
@@ -1,42 +0,0 @@
-# MinGW config include file updated for Mesa 7.0
-#
-#  Updated : by Heromyth, on 2007-7-21
-#  Email   : zxpm...@yahoo.com.cn
-#  Bugs: 1) All the default settings work fine. But the setting X86=1 
can't work. 
-#The others havn't been tested yet.
-#2) The generated DLLs are *not* compatible with the ones built
-#with the other compilers like VC8, especially for GLUT. 
-#3) Although more tests are needed, it can be used individually!
-
-# The generated DLLs by MingW with STDCALL are not totally compatible 
-# with the ones linked by Microsoft's compilers.
-#
-# xxx_USING_STDCALL = 1  Compiling MESA with __stdcall. This is 
default!
-# 
-# xxx_USING_STDCALL = 0  Compiling MESA without __stdcall. I like 
this:)
-#  
-
-# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be
-# different. For example:
-#
-#   GL_USING_STDCALL = 0
-#   GLUT_USING_STDCALL = 1
-# 
-# Suggested setting:
-#
-# ALL_USING_STDCALL = 1
-#
-# That's default!
-#
-
-
-ALL_USING_STDCALL = 1
-
-
-ifeq ($(ALL_USING_STDCALL),1)
-  GL_USING_STDCALL = 1
-  GLUT_USING_STDCALL = 1
-else
-  GL_USING_STDCALL = 0
-  GLUT_USING_STDCALL = 0
-endif
diff --git a/docs/README.MINGW32 b/docs/README.MINGW32
deleted file mode 100644
index 9477b2b..000
--- a/docs/README.MINGW32
+++ /dev/null
@@ -1,153 +0,0 @@
-Mesa 6.1 for MinGW32
-
-
-
-
-Quick  dirty start:
-
-
-   mingw32-make -f Makefile.mgw [OPTIONS...]
-
-   Look into the corresponding makefiles for further information.
-   Check README.3DFX to find out how to compile Mesa Glide3 driver
-   with MinGW32!
-
-
-
-***
-The Mingw port for Mesa 3-D Graphics Library was created August 30, 1998 by 
Paul Garceau.
-
-Updated January 13, 2000; June 3, 2005 -- Paul Garceau 
pgarc...@users.sourceforge.net
-
-DISCLAIMER:  I make this port of the Mesa 3-D Graphics Library as a service
-to the general public.  I can, in no way support or make any guarantee that the
-build will work for your system.
-
-Acknowledgements:
-
-   Daniel Borca, whose work and commitment to maintaining the Mingw port 
of the Mesa 3-D Graphics Library has been, and will continue to be greatly 
appreciated by an overworked and underpaid developer such as myself.
-   Without the creative inspiration and personal commitment provided by 
Mumit Khan, Jan-Jaap Vanderhagen and Colin Peters, Mingw would never have 
existed. Acknowledgements also need to be given to all of the 
developers who have worked on Mingw, Mesa and Msys over the years.
-   Last, but certainly far from the least, Brian Paul, who has dedicated 
at least the last seven or eight years of his life to making Mesa 3-D Graphics 
Library what it is today and managing the development for all of those years.
-*
-
-Greetings,
-
-   Feel free to modify or change things related to the Mingw build as you 
see fit, just remember that, the author of the current build may not be able to 
support any modifications you might want to make to the files which have been 
included for the build.
-
-Mesa core components are licensed under XFree-86 (for more on licensing of 
Mesa 3-D Graphics Library, check out the Mesa homepage (http://www.mesa3d.org).
-
-The Mingw generated libraries themselves are licensed under the GNU-LGPL 
license.  Source code for Mingw can be found at http://www.mingw.org.  For 
licensing terms on Mingw, please visit http://www.mingw.org.
-
-   It is recommended that you use the latest stable release of Mingw.  
Candidates are beta testing distributions for Mingw.  Mingw is available at 
http://www.mingw.org.
-
-   This build has been tested under WinNT4/SP6.  Win9x and WinNT5 remain 
untested by me.  I have not tested any of the demos included with Mesa3d.
-
-Installation:
-
-   This readme assumes that you already have extracted the necessary files 
to a working directory/folder that 

Mesa (master): docs: Update scons info regarding mingw.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 282ecaf82cf37b7ac71f83f4c110023371021caf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=282ecaf82cf37b7ac71f83f4c110023371021caf

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:56:20 2011 +0100

docs: Update scons info regarding mingw.

---

 docs/install.html |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/docs/install.html b/docs/install.html
index 228100e..8504791 100644
--- a/docs/install.html
+++ b/docs/install.html
@@ -281,17 +281,14 @@ by -debug for debug builds.
 To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler 
toolchain do
 /p
 pre
-scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa 
drivers=softpipe,trace winsys=gdi
+scons platform=windows toolchain=crossmingw machine=x86 mesagdi libgl-gdi
 /pre
 p
 This will create:
 /p
 ul
+libuild/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll mdash; Mesa 
+ swrast, binary compatible with Windows's opengl32.dll 
 libuild/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll mdash; 
Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll 
-libuild/windows-x86-debug/glut/glx/glut32.dll
-liprogs/build/windows-x86-debug/wgl/wglinfo.exe
-liprogs/build/windows-x86-debug/trivial/tri.exe
-liand many other samples in progs/build/windows-x86-debug/...
 /ul
 p
 Put them all in the same directory to test them.

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


Mesa (master): Remove dead Makefiles.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 99a8150a1a3ad293fe6104a65526e0ee4d095bb7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=99a8150a1a3ad293fe6104a65526e0ee4d095bb7

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 13:59:18 2011 +0100

Remove dead Makefiles.

---

 src/glu/sgi/Makefile.win |  149 --
 src/mesa/drivers/osmesa/Makefile.win |   39 -
 2 files changed, 0 insertions(+), 188 deletions(-)

diff --git a/src/glu/sgi/Makefile.win b/src/glu/sgi/Makefile.win
deleted file mode 100644
index 9321732..000
--- a/src/glu/sgi/Makefile.win
+++ /dev/null
@@ -1,149 +0,0 @@
-# Makefile for Win32
-
-!include win32.mak
-
-.SUFFIXES : .cc
-
-TOP = ..
-
-GLU_SRCS_CC = \
-   libnurbs\interface\bezierEval.cc \
-   libnurbs\interface\bezierPatch.cc \
-   libnurbs\interface\bezierPatchMesh.cc \
-   libnurbs\interface\glcurveval.cc \
-   libnurbs\interface\glinterface.cc \
-   libnurbs\interface\glrenderer.cc \
-   libnurbs\interface\glsurfeval.cc \
-   libnurbs\interface\incurveeval.cc \
-   libnurbs\interface\insurfeval.cc \
-   libnurbs\internals\arc.cc \
-   libnurbs\internals\arcsorter.cc \
-   libnurbs\internals\arctess.cc \
-   libnurbs\internals\backend.cc \
-   libnurbs\internals\basiccrveval.cc \
-   libnurbs\internals\basicsurfeval.cc \
-   libnurbs\internals\bin.cc \
-   libnurbs\internals\bufpool.cc \
-   libnurbs\internals\cachingeval.cc \
-   libnurbs\internals\ccw.cc \
-   libnurbs\internals\coveandtiler.cc \
-   libnurbs\internals\curve.cc \
-   libnurbs\internals\curvelist.cc \
-   libnurbs\internals\curvesub.cc \
-   libnurbs\internals\dataTransform.cc \
-   libnurbs\internals\displaylist.cc \
-   libnurbs\internals\flist.cc \
-   libnurbs\internals\flistsorter.cc \
-   libnurbs\internals\hull.cc \
-   libnurbs\internals\intersect.cc \
-   libnurbs\internals\knotvector.cc \
-   libnurbs\internals\mapdesc.cc \
-   libnurbs\internals\mapdescv.cc \
-   libnurbs\internals\maplist.cc \
-   libnurbs\internals\mesher.cc \
-   libnurbs\internals\monoTriangulationBackend.cc \
-   libnurbs\internals\monotonizer.cc \
-   libnurbs\internals\mycode.cc \
-   libnurbs\internals\nurbsinterfac.cc \
-   libnurbs\internals\nurbstess.cc \
-   libnurbs\internals\patch.cc \
-   libnurbs\internals\patchlist.cc \
-   libnurbs\internals\quilt.cc \
-   libnurbs\internals\reader.cc \
-   libnurbs\internals\renderhints.cc \
-   libnurbs\internals\slicer.cc \
-   libnurbs\internals\sorter.cc \
-   libnurbs\internals\splitarcs.cc \
-   libnurbs\internals\subdivider.cc \
-   libnurbs\internals\tobezier.cc \
-   libnurbs\internals\trimline.cc \
-   libnurbs\internals\trimregion.cc \
-   libnurbs\internals\trimvertpool.cc \
-   libnurbs\internals\uarray.cc \
-   libnurbs\internals\varray.cc \
-   libnurbs\nurbtess\directedLine.cc \
-   libnurbs\nurbtess\gridWrap.cc \
-   libnurbs\nurbtess\monoChain.cc \
-   libnurbs\nurbtess\monoPolyPart.cc \
-   libnurbs\nurbtess\monoTriangulation.cc \
-   libnurbs\nurbtess\partitionX.cc \
-   libnurbs\nurbtess\partitionY.cc \
-   libnurbs\nurbtess\polyDBG.cc \
-   libnurbs\nurbtess\polyUtil.cc \
-   libnurbs\nurbtess\primitiveStream.cc \
-   libnurbs\nurbtess\quicksort.cc \
-   libnurbs\nurbtess\rectBlock.cc \
-   libnurbs\nurbtess\sampleComp.cc \
-   libnurbs\nurbtess\sampleCompBot.cc \
-   libnurbs\nurbtess\sampleCompRight.cc \
-   libnurbs\nurbtess\sampleCompTop.cc \
-   libnurbs\nurbtess\sampleMonoPoly.cc \
-   libnurbs\nurbtess\sampledLine.cc \
-   libnurbs\nurbtess\searchTree.cc
-
-GLU_SRCS = \
-   libtess\dict.c \
-   libtess\geom.c \
-   libtess\memalloc.c \
-   libtess\mesh.c \
-   libtess\normal.c \
-   libtess\priorityq.c \
-   libtess\render.c \
-   libtess\sweep.c \
-   libtess\tess.c \
-   libtess\tessmono.c \
-   libutil\error.c \
-   libutil\glue.c \
-   libutil\mipmap.c \
-   libutil\project.c \
-   libutil\quad.c \
-   libutil\registry.c
-
-SRCS   = $(GLU_SRCS)
-
-all: gludll
-
-!include $(TOP)/mesawin32.mak
-
-gludll : $(GLUDLL)
-
-CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -Iinclude -DBUILD_GL32 
-DLIBRARYBUILD
-LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
-
-LIBS   = ../lib/$(MESALIB) winmm.lib $(guilibsdll)
-
-OBJS   = $(GLU_SRCS_CC:.cc=.obj) $(GLU_SRCS:.c=.obj)
-NURBSINC = -Ilibnurbs\interface -Ilibnurbs\internals -Ilibnurbs\nurbtess 
-CFLAGS  = $(CFLAGS) $(NURBSINC)
-
-$(GLUDLL): $(OBJS) glu.def
-   $(link) $(LFLAGS) -out:$(GLUDLL) -def:glu.def $(OBJS) $(LIBS)
-   @echo copying Mesa GLU dynamic link library to library directory...
-   -copy $(GLUDLL) $(TOP)\lib
-   @echo copying Mesa GLU import library to library directory...
- 

Mesa (master): glu: Fix build on mingw-w64.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 15465949e0e419d4719d84eb0220c4bb56a408db
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15465949e0e419d4719d84eb0220c4bb56a408db

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 14:18:06 2011 +0100

glu: Fix build on mingw-w64.

---

 src/glu/sgi/include/gluos.h |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/glu/sgi/include/gluos.h b/src/glu/sgi/include/gluos.h
index ac0a787..290a06f 100644
--- a/src/glu/sgi/include/gluos.h
+++ b/src/glu/sgi/include/gluos.h
@@ -40,7 +40,13 @@
 #define NOIME
 #define NOMINMAX
 
+#ifdef __MINGW64_VERSION_MAJOR
+  #undef _WIN32_WINNT
+#endif
+
 #ifndef _WIN32_WINNT
+  /* XXX: Workaround a bug in mingw-w64's headers when NOGDI is set and
+   * _WIN32_WINNT = 0x0600 */
   #define _WIN32_WINNT 0x0400
 #endif
 #ifndef STRICT

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


Mesa (master): glu: Avoid defining conflicting DEBUG NDEBUG macros.

2011-08-30 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 0b263aeb8b82d5be1ba9210e06f7eaa7d1cf63bf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b263aeb8b82d5be1ba9210e06f7eaa7d1cf63bf

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Mon Aug 29 14:18:26 2011 +0100

glu: Avoid defining conflicting DEBUG NDEBUG macros.

---

 src/glu/sgi/SConscript |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/glu/sgi/SConscript b/src/glu/sgi/SConscript
index a0c6c65..94c7426 100644
--- a/src/glu/sgi/SConscript
+++ b/src/glu/sgi/SConscript
@@ -11,7 +11,6 @@ env.Prepend(CPPPATH = [
 ])
 
 env.Prepend(CPPDEFINES = [
-'NDEBUG',
 'LIBRARYBUILD',
 'RESOLVE_3D_TEXTURE_SUPPORT',
 ])

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


Mesa (master): mesa: update multisample state on _NEW_BUFFERS

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: fb92fc25b00beda4df48865670c8769c7a669aac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb92fc25b00beda4df48865670c8769c7a669aac

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Sat Aug 27 17:28:01 2011 +0200

mesa: update multisample state on _NEW_BUFFERS

A change in sampleBuffers affects the final enable value.

---

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

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 7ad50bc..457a730 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -631,7 +631,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state  (_NEW_BUFFERS | _NEW_VIEWPORT))
   update_viewport_matrix(ctx);
 
-   if (new_state  _NEW_MULTISAMPLE)
+   if (new_state  (_NEW_MULTISAMPLE | _NEW_BUFFERS))
   update_multisample( ctx );
 
if (new_state  _NEW_COLOR)

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


Mesa (master): nv50, nvc0: reject R8G8B8A8/X8_UNORM for multisample surfaces

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 9f4998639c3c47f0b7ee3e2a29b7f3609d3f7796
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f4998639c3c47f0b7ee3e2a29b7f3609d3f7796

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Sat Aug 27 17:31:04 2011 +0200

nv50,nvc0: reject R8G8B8A8/X8_UNORM for multisample surfaces

The window system buffer will be BGRA and applications will try to
directly resolve to it, which would trigger an INVALID_OPERATION in
BlitFramebuffer if the multisample renderbuffer is RGBA.

---

 src/gallium/drivers/nv50/nv50_screen.c |7 ++-
 src/gallium/drivers/nvc0/nvc0_screen.c |   12 +++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 581aad1..985a55c 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -43,7 +43,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
 unsigned sample_count,
 unsigned bindings)
 {
-   if (sample_count  2  sample_count != 4  sample_count != 8)
+   if (!(0x117  (1  sample_count))) /* 0, 1, 2, 4 or 8 */
   return FALSE;
if (sample_count == 8  util_format_get_blocksizebits(format) = 128)
   return FALSE;
@@ -56,6 +56,11 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
   if (nv50_screen(pscreen)-tesla-grclass  NVA0_3D)
  return FALSE;
   break;
+   case PIPE_FORMAT_R8G8B8A8_UNORM:
+   case PIPE_FORMAT_R8G8B8X8_UNORM:
+  /* HACK: GL requires equal formats for MS resolve and window is BGRA */
+  if (sample_count  1)
+ return FALSE;
default:
   break;
}
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index c79256a..204887d 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -40,12 +40,22 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
 unsigned sample_count,
 unsigned bindings)
 {
-   if (sample_count  2  sample_count != 4  sample_count != 8)
+   if (!(0x117  (1  sample_count))) /* 0, 1, 2, 4 or 8 */
   return FALSE;
 
if (!util_format_is_supported(format, bindings))
   return FALSE;
 
+   switch (format) {
+   case PIPE_FORMAT_R8G8B8A8_UNORM:
+   case PIPE_FORMAT_R8G8B8X8_UNORM:
+  /* HACK: GL requires equal formats for MS resolve and window is BGRA */
+  if (sample_count  1)
+ return FALSE;
+   default:
+  break;
+   }
+
/* transfers  shared are always supported */
bindings = ~(PIPE_BIND_TRANSFER_READ |
  PIPE_BIND_TRANSFER_WRITE |

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


Mesa (master): nv50, nvc0: add states mask to state validation function

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 222b3ea653e5525a4afa57e6a2353335953012d4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=222b3ea653e5525a4afa57e6a2353335953012d4

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Sat Aug 27 20:49:36 2011 +0200

nv50,nvc0: add states mask to state validation function

This prevents null dereferences in validation of interdependent
state after a switch to a pipe context where we mark all state
as dirty but where not all state is valid / set yet.

---

 src/gallium/drivers/nv50/nv50_context.h|3 ++-
 src/gallium/drivers/nv50/nv50_state_validate.c |   15 +++
 src/gallium/drivers/nv50/nv50_surface.c|8 ++--
 src/gallium/drivers/nv50/nv50_vbo.c|2 +-
 src/gallium/drivers/nvc0/nvc0_context.h|3 ++-
 src/gallium/drivers/nvc0/nvc0_state_validate.c |   15 ++-
 src/gallium/drivers/nvc0/nvc0_surface.c|6 +-
 src/gallium/drivers/nvc0/nvc0_vbo.c|3 ++-
 8 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.h 
b/src/gallium/drivers/nv50/nv50_context.h
index 284db69..384ca8f 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -172,7 +172,8 @@ extern void nv50_init_state_functions(struct nv50_context 
*);
 
 /* nv50_state_validate.c */
 /* @words: check for space before emitting relocs */
-extern boolean nv50_state_validate(struct nv50_context *, unsigned words);
+extern boolean nv50_state_validate(struct nv50_context *, uint32_t state_mask,
+   unsigned space_words);
 
 /* nv50_surface.c */
 extern void nv50_clear(struct pipe_context *, unsigned buffers,
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c 
b/src/gallium/drivers/nv50/nv50_state_validate.c
index 44f2d25..369daf8 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -306,7 +306,11 @@ nv50_switch_pipe_context(struct nv50_context *ctx_to)
if (!ctx_to-blend)
   ctx_to-dirty = ~NV50_NEW_BLEND;
if (!ctx_to-rast)
+#ifdef NV50_SCISSORS_CLIPPING
+  ctx_to-dirty = ~(NV50_NEW_RASTERIZER | NV50_NEW_SCISSOR);
+#else
   ctx_to-dirty = ~NV50_NEW_RASTERIZER;
+#endif
if (!ctx_to-zsa)
   ctx_to-dirty = ~NV50_NEW_ZSA;
 
@@ -350,21 +354,24 @@ static struct state_validate {
 #define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
 
 boolean
-nv50_state_validate(struct nv50_context *nv50, unsigned words)
+nv50_state_validate(struct nv50_context *nv50, uint32_t mask, unsigned words)
 {
+   uint32_t state_mask;
unsigned i;
 
if (nv50-screen-cur_ctx != nv50)
   nv50_switch_pipe_context(nv50);
 
-   if (nv50-dirty) {
+   state_mask = nv50-dirty  mask;
+
+   if (state_mask) {
   for (i = 0; i  validate_list_len; ++i) {
  struct state_validate *validate = validate_list[i];
 
- if (nv50-dirty  validate-states)
+ if (state_mask  validate-states)
 validate-func(nv50);
   }
-  nv50-dirty = 0;
+  nv50-dirty = ~state_mask;
}
 
MARK_RING(nv50-screen-base.channel, words, 0);
diff --git a/src/gallium/drivers/nv50/nv50_surface.c 
b/src/gallium/drivers/nv50/nv50_surface.c
index 8bca900..57339f8 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -370,12 +370,10 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
struct nouveau_channel *chan = nv50-screen-base.channel;
struct pipe_framebuffer_state *fb = nv50-framebuffer;
unsigned i;
-   const unsigned dirty = nv50-dirty;
uint32_t mode = 0;
 
/* don't need NEW_BLEND, COLOR_MASK doesn't affect CLEAR_BUFFERS */
-   nv50-dirty = NV50_NEW_FRAMEBUFFER;
-   if (!nv50_state_validate(nv50, 9 + (fb-nr_cbufs * 2)))
+   if (!nv50_state_validate(nv50, NV50_NEW_FRAMEBUFFER, 9 + (fb-nr_cbufs * 
2)))
   return;
 
if (buffers  PIPE_CLEAR_COLOR  fb-nr_cbufs) {
@@ -408,8 +406,6 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
   BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1);
   OUT_RING  (chan, (i  6) | 0x3c);
}
-
-   nv50-dirty = dirty  ~NV50_NEW_FRAMEBUFFER;
 }
 
 
@@ -851,7 +847,7 @@ nv50_resource_resolve(struct pipe_context *pipe,
 
nv50_blitctx_prepare_state(blit);
 
-   nv50_state_validate(nv50, 36);
+   nv50_state_validate(nv50, ~0, 36);
 
x_range =
   (float)(info-src.x1 - info-src.x0) /
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c 
b/src/gallium/drivers/nv50/nv50_vbo.c
index 1c8347a..82ac35e 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -647,7 +647,7 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
if (nv50-vbo_user  !(nv50-dirty  (NV50_NEW_VERTEX | NV50_NEW_ARRAYS)))
   nv50_update_user_vbufs(nv50);
 
-   nv50_state_validate(nv50, 8); /* 8 as minimum, we use 

Mesa (master): nv50: handle TGSI_OPCODE_ROUND

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: eabb9b0fd9d3a8b757c54465618b0d050ae0852f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eabb9b0fd9d3a8b757c54465618b0d050ae0852f

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Sat Aug 27 21:00:39 2011 +0200

nv50: handle TGSI_OPCODE_ROUND

Will round to nearest-even.

---

 src/gallium/drivers/nv50/nv50_pc.c |1 +
 src/gallium/drivers/nv50/nv50_pc.h |3 ++-
 src/gallium/drivers/nv50/nv50_pc_emit.c|6 --
 src/gallium/drivers/nv50/nv50_pc_print.c   |1 +
 src/gallium/drivers/nv50/nv50_tgsi_to_nc.c |2 ++
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_pc.c 
b/src/gallium/drivers/nv50/nv50_pc.c
index 7900bf8..9137f87 100644
--- a/src/gallium/drivers/nv50/nv50_pc.c
+++ b/src/gallium/drivers/nv50/nv50_pc.c
@@ -102,6 +102,7 @@ nv50_nvi_can_load(struct nv_instruction *nvi, int s, struct 
nv_value *value)
case NV_OP_FLOOR:
case NV_OP_TRUNC:
case NV_OP_CVT:
+   case NV_OP_ROUND:
case NV_OP_NEG:
case NV_OP_MAD:
case NV_OP_MUL:
diff --git a/src/gallium/drivers/nv50/nv50_pc.h 
b/src/gallium/drivers/nv50/nv50_pc.h
index 5bb0e12..45804d3 100644
--- a/src/gallium/drivers/nv50/nv50_pc.h
+++ b/src/gallium/drivers/nv50/nv50_pc.h
@@ -86,7 +86,8 @@
 #define NV_OP_SELECT54
 #define NV_OP_EXPORT55
 #define NV_OP_JOIN  56
-#define NV_OP_COUNT 57
+#define NV_OP_ROUND 57
+#define NV_OP_COUNT 58
 
 #define NV_FILE_GPR  0
 #define NV_FILE_OUT  1
diff --git a/src/gallium/drivers/nv50/nv50_pc_emit.c 
b/src/gallium/drivers/nv50/nv50_pc_emit.c
index 600850d..2b177c6 100644
--- a/src/gallium/drivers/nv50/nv50_pc_emit.c
+++ b/src/gallium/drivers/nv50/nv50_pc_emit.c
@@ -94,7 +94,7 @@ const ubyte nv50_inst_min_size_tab[NV_OP_COUNT] =
0, 0, 0, 8, 8, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, /* 15 */
8, 8, 8, 4, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 31 */
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 47 */
-   4, 8, 8, 8, 8, 8, 0, 0, 8
+   4, 8, 8, 8, 8, 8, 0, 0, 8, 8
 };
 
 unsigned
@@ -1009,13 +1009,14 @@ emit_cvt(struct nv_pc *pc, struct nv_instruction *nvi)
}
if (pc-emit[1] == CVT_F32_F32 
(nvi-opcode == NV_OP_CEIL || nvi-opcode == NV_OP_FLOOR ||
-   nvi-opcode == NV_OP_TRUNC))
+nvi-opcode == NV_OP_TRUNC || nvi-opcode == NV_OP_ROUND))
pc-emit[1] |= CVT_RI;
 
switch (nvi-opcode) {
case NV_OP_CEIL:  pc-emit[1] |= CVT_CEIL; break;
case NV_OP_FLOOR: pc-emit[1] |= CVT_FLOOR; break;
case NV_OP_TRUNC: pc-emit[1] |= CVT_TRUNC; break;
+   case NV_OP_ROUND: pc-emit[1] |= CVT_RN; break;
 
case NV_OP_ABS: pc-emit[1] |= CVT_ABS; break;
case NV_OP_SAT: pc-emit[1] |= CVT_SAT; break;
@@ -1163,6 +1164,7 @@ nv50_emit_instruction(struct nv_pc *pc, struct 
nv_instruction *i)
case NV_OP_CEIL:
case NV_OP_FLOOR:
case NV_OP_TRUNC:
+   case NV_OP_ROUND:
   emit_cvt(pc, i);
   break;
case NV_OP_DFDX:
diff --git a/src/gallium/drivers/nv50/nv50_pc_print.c 
b/src/gallium/drivers/nv50/nv50_pc_print.c
index 984f6cb..dabbb83 100644
--- a/src/gallium/drivers/nv50/nv50_pc_print.c
+++ b/src/gallium/drivers/nv50/nv50_pc_print.c
@@ -96,6 +96,7 @@ static const char *nv_opcode_names[NV_OP_COUNT + 1] = {
select,
export,
join,
+   round,
BAD_OP
 };
 
diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c 
b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index 15aa40c..4b11ae1 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -803,6 +803,7 @@ translate_opcode(uint opcode)
case TGSI_OPCODE_CEIL: return NV_OP_CEIL;
case TGSI_OPCODE_FLR: return NV_OP_FLOOR;
case TGSI_OPCODE_TRUNC: return NV_OP_TRUNC;
+   case TGSI_OPCODE_ROUND: return NV_OP_ROUND;
case TGSI_OPCODE_COS: return NV_OP_COS;
case TGSI_OPCODE_SIN: return NV_OP_SIN;
case TGSI_OPCODE_DDX: return NV_OP_DFDX;
@@ -1819,6 +1820,7 @@ bld_instruction(struct bld_context *bld,
case TGSI_OPCODE_CEIL:
case TGSI_OPCODE_FLR:
case TGSI_OPCODE_TRUNC:
+   case TGSI_OPCODE_ROUND:
case TGSI_OPCODE_DDX:
case TGSI_OPCODE_DDY:
   FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {

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


Mesa (master): nv50: align pitch of linear surfaces correctly

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 55bab45a7c6c8e659e31b398b4ccd6e790c2738b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=55bab45a7c6c8e659e31b398b4ccd6e790c2738b

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Tue Aug 30 13:06:03 2011 +0200

nv50: align pitch of linear surfaces correctly

---

 src/gallium/drivers/nv50/nv50_miptree.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_miptree.c 
b/src/gallium/drivers/nv50/nv50_miptree.c
index bc81604..3537681 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -185,6 +185,7 @@ boolean
 nv50_miptree_init_layout_linear(struct nv50_miptree *mt)
 {
struct pipe_resource *pt = mt-base.base;
+   const unsigned blocksize = util_format_get_blocksize(pt-format);
 
if (util_format_is_depth_or_stencil(pt-format))
   return FALSE;
@@ -194,7 +195,7 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt)
if (mt-ms_x | mt-ms_y)
   return FALSE;
 
-   mt-level[0].pitch = align(pt-width0, 64);
+   mt-level[0].pitch = align(pt-width0 * blocksize, 64);
 
mt-total_size = mt-level[0].pitch * pt-height0;
 

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


Mesa (master): nv50: add support for linear textures and render targets

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 0a3f0ff2645d03d5f572cc26932595b8df400505
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a3f0ff2645d03d5f572cc26932595b8df400505

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Tue Aug 30 13:08:27 2011 +0200

nv50: add support for linear textures and render targets

---

 src/gallium/drivers/nouveau/nouveau_winsys.h   |2 +
 src/gallium/drivers/nv50/nv50_miptree.c|3 ++
 src/gallium/drivers/nv50/nv50_state_validate.c |   27 -
 src/gallium/drivers/nv50/nv50_surface.c|   12 +-
 src/gallium/drivers/nv50/nv50_tex.c|   29 ---
 src/gallium/drivers/nv50/nv50_winsys.h |2 +-
 src/gallium/drivers/nvc0/nvc0_winsys.h |2 +-
 7 files changed, 63 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h 
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 484f870..37416f7 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -17,6 +17,8 @@
 #define NV04_PFIFO_MAX_PACKET_LEN 2047
 #endif
 
+#define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV  0)
+
 static INLINE uint32_t
 nouveau_screen_transfer_flags(unsigned pipe)
 {
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c 
b/src/gallium/drivers/nv50/nv50_miptree.c
index 3537681..239be19 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -107,6 +107,9 @@ nv50_mt_choose_storage_type(struct nv50_miptree *mt, 
boolean compressed)
if (!compressed)
   tile_flags = ~0x3;
 
+   if (unlikely(mt-base.base.flags  NOUVEAU_RESOURCE_FLAG_LINEAR))
+  tile_flags = ~0x3ff00;
+
return tile_flags;
 }
 
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c 
b/src/gallium/drivers/nv50/nv50_state_validate.c
index 369daf8..05f32ea 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -31,13 +31,26 @@ nv50_validate_fb(struct nv50_context *nv50)
   OUT_RELOCh(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
   OUT_RELOCl(chan, bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
   OUT_RING  (chan, nv50_format_table[sf-base.format].rt);
-  OUT_RING  (chan, mt-level[sf-base.u.tex.level].tile_mode  4);
-  OUT_RING  (chan, mt-layer_stride  2);
-  BEGIN_RING(chan, RING_3D(RT_HORIZ(i)), 2);
-  OUT_RING  (chan, sf-width);
-  OUT_RING  (chan, sf-height);
-  BEGIN_RING(chan, RING_3D(RT_ARRAY_MODE), 1);
-  OUT_RING  (chan, sf-depth);
+  if (likely(nouveau_bo_tile_layout(bo))) {
+ OUT_RING  (chan, mt-level[sf-base.u.tex.level].tile_mode  4);
+ OUT_RING  (chan, mt-layer_stride  2);
+ BEGIN_RING(chan, RING_3D(RT_HORIZ(i)), 2);
+ OUT_RING  (chan, sf-width);
+ OUT_RING  (chan, sf-height);
+ BEGIN_RING(chan, RING_3D(RT_ARRAY_MODE), 1);
+ OUT_RING  (chan, sf-depth);
+  } else {
+ OUT_RING  (chan, 0);
+ OUT_RING  (chan, 0);
+ BEGIN_RING(chan, RING_3D(RT_HORIZ(i)), 2);
+ OUT_RING  (chan, NV50_3D_RT_HORIZ_LINEAR | mt-level[0].pitch);
+ OUT_RING  (chan, sf-height);
+ BEGIN_RING(chan, RING_3D(RT_ARRAY_MODE), 1);
+ OUT_RING  (chan, 0);
+
+ assert(!fb-zsbuf);
+ assert(!mt-ms_mode);
+  }
 
   ms_mode = mt-ms_mode;
 
diff --git a/src/gallium/drivers/nv50/nv50_surface.c 
b/src/gallium/drivers/nv50/nv50_surface.c
index 57339f8..b0a8497 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -290,11 +290,19 @@ nv50_clear_render_target(struct pipe_context *pipe,
OUT_RING  (chan, mt-level[sf-base.u.tex.level].tile_mode  4);
OUT_RING  (chan, 0);
BEGIN_RING(chan, RING_3D(RT_HORIZ(0)), 2);
-   OUT_RING  (chan, sf-width);
+   if (nouveau_bo_tile_layout(bo))
+  OUT_RING(chan, sf-width);
+   else
+  OUT_RING(chan, NV50_3D_RT_HORIZ_LINEAR | mt-level[0].pitch);
OUT_RING  (chan, sf-height);
BEGIN_RING(chan, RING_3D(RT_ARRAY_MODE), 1);
OUT_RING  (chan, 1);
 
+   if (!nouveau_bo_tile_layout(bo)) {
+  BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1);
+  OUT_RING  (chan, 0);
+   }
+
/* NOTE: only works with D3D clear flag (5097/0x143c bit 4) */
 
BEGIN_RING(chan, RING_3D(VIEWPORT_HORIZ(0)), 2);
@@ -324,6 +332,8 @@ nv50_clear_depth_stencil(struct pipe_context *pipe,
struct nouveau_bo *bo = mt-base.bo;
uint32_t mode = 0;
 
+   assert(nouveau_bo_tile_layout(bo)); /* ZETA cannot be linear */
+
if (clear_flags  PIPE_CLEAR_DEPTH) {
   BEGIN_RING(chan, RING_3D(CLEAR_DEPTH), 1);
   OUT_RINGf (chan, depth);
diff --git a/src/gallium/drivers/nv50/nv50_tex.c 
b/src/gallium/drivers/nv50/nv50_tex.c
index 73db9ca..9436ac2 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -51,6 +51,24 @@ nv50_tic_swizzle(uint32_t tc, 

Mesa (master): nvfx: use common NOUVEAU_RESOURCE_FLAG_LINEAR define

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 3b3d2e53bc11f9b5fbda812953700b216cd8ab93
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b3d2e53bc11f9b5fbda812953700b216cd8ab93

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Tue Aug 30 13:44:31 2011 +0200

nvfx: use common NOUVEAU_RESOURCE_FLAG_LINEAR define

---

 src/gallium/drivers/nouveau/nouveau_winsys.h |3 ++-
 src/gallium/drivers/nvfx/nv30_fragtex.c  |2 +-
 src/gallium/drivers/nvfx/nvfx_buffer.c   |5 +++--
 src/gallium/drivers/nvfx/nvfx_miptree.c  |8 
 src/gallium/drivers/nvfx/nvfx_resource.h |3 +--
 src/gallium/drivers/nvfx/nvfx_state_fb.c |2 +-
 src/gallium/drivers/nvfx/nvfx_surface.c  |6 +++---
 src/gallium/drivers/nvfx/nvfx_transfer.c |2 +-
 8 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h 
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 37416f7..553a5e6 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -17,7 +17,8 @@
 #define NV04_PFIFO_MAX_PACKET_LEN 2047
 #endif
 
-#define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV  0)
+#define NOUVEAU_RESOURCE_FLAG_LINEAR   (PIPE_RESOURCE_FLAG_DRV_PRIV  0)
+#define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV  1)
 
 static INLINE uint32_t
 nouveau_screen_transfer_flags(unsigned pipe)
diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c 
b/src/gallium/drivers/nvfx/nv30_fragtex.c
index b609891..6fe5932 100644
--- a/src/gallium/drivers/nvfx/nv30_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv30_fragtex.c
@@ -58,7 +58,7 @@ nv30_sampler_view_init(struct pipe_context *pipe,
if(pt-height0 = 1 || util_format_is_compressed(sv-base.format))
sv-u.nv30.rect = -1;
else
-   sv-u.nv30.rect = !!(pt-flags  NVFX_RESOURCE_FLAG_LINEAR);
+   sv-u.nv30.rect = !!(pt-flags  NOUVEAU_RESOURCE_FLAG_LINEAR);
 
sv-lod_offset = sv-base.u.tex.first_level - level;
sv-max_lod_limit = sv-base.u.tex.last_level - level;
diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c 
b/src/gallium/drivers/nvfx/nvfx_buffer.c
index b407429..76b7f45 100644
--- a/src/gallium/drivers/nvfx/nvfx_buffer.c
+++ b/src/gallium/drivers/nvfx/nvfx_buffer.c
@@ -31,7 +31,7 @@ nvfx_buffer_create(struct pipe_screen *pscreen,
return NULL;
 
buffer-base.base = *template;
-   buffer-base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+   buffer-base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
pipe_reference_init(buffer-base.base.reference, 1);
buffer-base.base.screen = pscreen;
buffer-size = util_format_get_stride(template-format, 
template-width0);
@@ -56,7 +56,8 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen,
return NULL;
 
pipe_reference_init(buffer-base.base.reference, 1);
-   buffer-base.base.flags = NVFX_RESOURCE_FLAG_LINEAR | 
NVFX_RESOURCE_FLAG_USER;
+   buffer-base.base.flags =
+   NOUVEAU_RESOURCE_FLAG_LINEAR | NVFX_RESOURCE_FLAG_USER;
buffer-base.base.screen = pscreen;
buffer-base.base.format = PIPE_FORMAT_R8_UNORM;
buffer-base.base.usage = PIPE_USAGE_IMMUTABLE;
diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c 
b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 1be84b9..8695aa3 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -33,13 +33,13 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt)
|| util_format_is_compressed(pt-format)
|| no_swizzle
)
-   mt-base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+   mt-base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
 
/* non compressed formats with uniform pitch must be linear, and vice 
versa */
if(!util_format_is_s3tc(pt-format)
-(uniform_pitch || mt-base.base.flags  
NVFX_RESOURCE_FLAG_LINEAR))
+(uniform_pitch || mt-base.base.flags  
NOUVEAU_RESOURCE_FLAG_LINEAR))
{
-   mt-base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+   mt-base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
uniform_pitch = 1;
}
 
@@ -175,7 +175,7 @@ nvfx_miptree_from_handle(struct pipe_screen *pscreen, const 
struct pipe_resource
 unsigned stride;
 if(whandle-stride) {
mt-linear_pitch = whandle-stride;
-   mt-base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
+   mt-base.base.flags |= NOUVEAU_RESOURCE_FLAG_LINEAR;
 } else
nvfx_miptree_choose_format(mt);
 
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h 
b/src/gallium/drivers/nvfx/nvfx_resource.h
index 070f897..6e0493f 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.h
+++ b/src/gallium/drivers/nvfx/nvfx_resource.h
@@ -23,8 +23,7 @@ struct nvfx_resource *nvfx_resource(struct 

Mesa (master): winsys/radeon: Create async thread only once

2011-08-30 Thread Christian König
Module: Mesa
Branch: master
Commit: 210ddf0819b5acf87a614214b6d4b02193aafa4a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=210ddf0819b5acf87a614214b6d4b02193aafa4a

Author: Maarten Lankhorst m.b.lankho...@gmail.com
Date:   Sat Aug 27 22:57:19 2011 +0200

winsys/radeon: Create async thread only once

I noticed that a thread was created for every time async flush was called, so I 
moved it and used some semaphores to synch.

Signed-off-by: Maarten Lankhorst m.b.lankho...@gmail.com
Reviewed-by: Marek Olšák mar...@gmail.com
Signed-off-by: Christian König deathsim...@vodafone.de

---

 src/gallium/winsys/radeon/drm/radeon_drm_cs.c |   69 +
 src/gallium/winsys/radeon/drm/radeon_drm_cs.h |2 +
 2 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index c309354..2a1de53 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -130,6 +130,9 @@ static void radeon_destroy_cs_context(struct 
radeon_cs_context *csc)
 FREE(csc-relocs);
 }
 
+DEBUG_GET_ONCE_BOOL_OPTION(thread, RADEON_THREAD, TRUE)
+static PIPE_THREAD_ROUTINE(radeon_drm_cs_emit_ioctl, param);
+
 static struct radeon_winsys_cs *radeon_drm_cs_create(struct radeon_winsys *rws)
 {
 struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
@@ -139,6 +142,8 @@ static struct radeon_winsys_cs *radeon_drm_cs_create(struct 
radeon_winsys *rws)
 if (!cs) {
 return NULL;
 }
+pipe_semaphore_init(cs-flush_queued, 0);
+pipe_semaphore_init(cs-flush_completed, 0);
 
 cs-ws = ws;
 
@@ -158,6 +163,8 @@ static struct radeon_winsys_cs *radeon_drm_cs_create(struct 
radeon_winsys *rws)
 cs-base.buf = cs-csc-buf;
 
 p_atomic_inc(ws-num_cs);
+if (cs-ws-num_cpus  1  debug_get_option_thread())
+cs-thread = pipe_thread_create(radeon_drm_cs_emit_ioctl, cs);
 return cs-base;
 }
 
@@ -357,9 +364,8 @@ static void radeon_drm_cs_write_reloc(struct 
radeon_winsys_cs *rcs,
 OUT_CS(cs-base, index * RELOC_DWORDS);
 }
 
-static PIPE_THREAD_ROUTINE(radeon_drm_cs_emit_ioctl, param)
+static void radeon_drm_cs_emit_ioctl_oneshot(struct radeon_cs_context *csc)
 {
-struct radeon_cs_context *csc = (struct radeon_cs_context*)param;
 unsigned i;
 
 if (drmCommandWriteRead(csc-fd, DRM_RADEON_CS,
@@ -381,20 +387,32 @@ static PIPE_THREAD_ROUTINE(radeon_drm_cs_emit_ioctl, 
param)
 p_atomic_dec(csc-relocs_bo[i]-num_active_ioctls);
 
 radeon_cs_context_cleanup(csc);
+}
+
+static PIPE_THREAD_ROUTINE(radeon_drm_cs_emit_ioctl, param)
+{
+struct radeon_drm_cs *cs = (struct radeon_drm_cs*)param;
+
+while (1) {
+pipe_semaphore_wait(cs-flush_queued);
+if (cs-kill_thread)
+break;
+radeon_drm_cs_emit_ioctl_oneshot(cs-cst);
+pipe_semaphore_signal(cs-flush_completed);
+}
+pipe_semaphore_signal(cs-flush_completed);
 return NULL;
 }
 
 void radeon_drm_cs_sync_flush(struct radeon_drm_cs *cs)
 {
 /* Wait for any pending ioctl to complete. */
-if (cs-thread) {
-pipe_thread_wait(cs-thread);
-cs-thread = 0;
+if (cs-thread  cs-flush_started) {
+pipe_semaphore_wait(cs-flush_completed);
+cs-flush_started = 0;
 }
 }
 
-DEBUG_GET_ONCE_BOOL_OPTION(thread, RADEON_THREAD, TRUE)
-
 static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, unsigned flags)
 {
 struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
@@ -402,33 +420,33 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs 
*rcs, unsigned flags)
 
 radeon_drm_cs_sync_flush(cs);
 
-/* If the CS is not empty, emit it in a newly-spawned thread. */
+/* Flip command streams. */
+tmp = cs-csc;
+cs-csc = cs-cst;
+cs-cst = tmp;
+
+/* If the CS is not empty, emit it in a separate thread. */
 if (cs-base.cdw) {
-unsigned i, crelocs = cs-csc-crelocs;
+unsigned i, crelocs = cs-cst-crelocs;
 
-cs-csc-chunks[0].length_dw = cs-base.cdw;
+cs-cst-chunks[0].length_dw = cs-base.cdw;
 
 for (i = 0; i  crelocs; i++) {
 /* Update the number of active asynchronous CS ioctls for the 
buffer. */
-p_atomic_inc(cs-csc-relocs_bo[i]-num_active_ioctls);
+p_atomic_inc(cs-cst-relocs_bo[i]-num_active_ioctls);
 }
 
-if (cs-ws-num_cpus  1  debug_get_option_thread() 
+if (cs-thread 
 (flags  RADEON_FLUSH_ASYNC)) {
-cs-thread = pipe_thread_create(radeon_drm_cs_emit_ioctl, cs-csc);
-assert(cs-thread);
+cs-flush_started = 1;
+pipe_semaphore_signal(cs-flush_queued);
 } else {
-radeon_drm_cs_emit_ioctl(cs-csc);
+radeon_drm_cs_emit_ioctl_oneshot(cs-cst);
 }
 } else {
-radeon_cs_context_cleanup(cs-csc);
+radeon_cs_context_cleanup(cs-cst);
 }
 
-/* Flip command 

Mesa (master): nouveau/mm: move slabs to correct list on memory release

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 8476232b080821b859b02add4cb7869fa4a4f2b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8476232b080821b859b02add4cb7869fa4a4f2b3

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Tue Aug 30 14:29:23 2011 +0200

nouveau/mm: move slabs to correct list on memory release

Should get rid of destroying GPU memory cache with some buffers
still in use message.

---

 src/gallium/drivers/nouveau/nouveau_mm.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_mm.c 
b/src/gallium/drivers/nouveau/nouveau_mm.c
index 6c6d28c..91532d7 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/src/gallium/drivers/nouveau/nouveau_mm.c
@@ -210,13 +210,13 @@ nouveau_mm_free(struct nouveau_mm_allocation *alloc)
 
mm_slab_free(slab, alloc-offset  slab-order);
 
+   if (slab-free == slab-count) {
+  LIST_DEL(slab-head);
+  LIST_ADDTAIL(slab-head, bucket-free);
+   } else
if (slab-free == 1) {
   LIST_DEL(slab-head);
-
-  if (slab-count  1)
- LIST_ADDTAIL(slab-head, bucket-used);
-  else
- LIST_ADDTAIL(slab-head, bucket-free);
+  LIST_ADDTAIL(slab-head, bucket-used);
}
 
FREE(alloc);

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


Mesa (master): nouveau: use PRIu64 for printing uint64_t

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: d49525d0c52601f8c4abec82590ca4ffb896a614
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d49525d0c52601f8c4abec82590ca4ffb896a614

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Tue Aug 30 14:41:13 2011 +0200

nouveau: use PRIu64 for printing uint64_t

---

 src/gallium/drivers/nouveau/nouveau_mm.c |4 +++-
 src/gallium/drivers/nouveau/nouveau_winsys.h |2 ++
 src/gallium/drivers/nv50/nv50_screen.c   |2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_mm.c 
b/src/gallium/drivers/nouveau/nouveau_mm.c
index 91532d7..2a4e322 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/src/gallium/drivers/nouveau/nouveau_mm.c
@@ -1,4 +1,6 @@
 
+#include inttypes.h
+
 #include util/u_inlines.h
 #include util/u_memory.h
 #include util/u_double_list.h
@@ -143,7 +145,7 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order)
 
cache-allocated += size;
 
-   debug_printf(MM: new slab, total memory = %llu KiB\n,
+   debug_printf(MM: new slab, total memory = %PRIu64 KiB\n,
 cache-allocated / 1024);
 
return PIPE_OK;
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h 
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 553a5e6..524e636 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -2,6 +2,8 @@
 #define NOUVEAU_WINSYS_H
 
 #include stdint.h
+#include inttypes.h
+
 #include pipe/p_defines.h
 
 #include nouveau/nouveau_bo.h
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 985a55c..b1d0b1c 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -492,7 +492,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
 
screen-tls_size = tls_space * max_warps * 32;
 
-   debug_printf(max_warps = %i, tls_size = %llu KiB\n,
+   debug_printf(max_warps = %i, tls_size = %PRIu64 KiB\n,
 max_warps, screen-tls_size  10);
 
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1  16, screen-tls_size,

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


Mesa (master): r600g: Make unaligned 3D textures work on +evergreen

2011-08-30 Thread Christian König
Module: Mesa
Branch: master
Commit: 8f4ec55f77a993ec44db56726187bdd4f041880e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f4ec55f77a993ec44db56726187bdd4f041880e

Author: Christian König deathsim...@vodafone.de
Date:   Mon Aug 29 12:14:30 2011 +0200

r600g: Make unaligned 3D textures work on +evergreen

The layersize calculation is slightly different on +evergreen.
This makes mpeg2 video decoding and piglits texture-packed-formats
test work correctly on this hardware.

---

 src/gallium/drivers/r600/r600_texture.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index 3bd5350..691cc48 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -262,7 +262,11 @@ static void r600_setup_miptree(struct pipe_screen *screen,
nblocksx = r600_texture_get_nblocksx(screen, rtex, i);
nblocksy = r600_texture_get_nblocksy(screen, rtex, i);
 
-   layer_size = nblocksx * nblocksy * blocksize;
+   if (chipc = EVERGREEN  array_mode == 
V_038000_ARRAY_LINEAR_GENERAL)
+   layer_size = align(nblocksx, 64) * nblocksy * blocksize;
+   else
+   layer_size = nblocksx * nblocksy * blocksize;
+
if (ptex-target == PIPE_TEXTURE_CUBE) {
if (chipc = R700)
size = layer_size * 8;

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


Mesa (master): make: Remove duplicate defintion of COMMON_SOURCES in Radeon makefiles

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 08701b6c952e2c65a06f26305633eb699dabe748
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=08701b6c952e2c65a06f26305633eb699dabe748

Author: Chad Versace c...@chad-versace.us
Date:   Sun Aug 28 07:58:28 2011 -0700

make: Remove duplicate defintion of COMMON_SOURCES in Radeon makefiles

Remove defintion of COMMON_SOURCES from {r300,r660}/Makefile. The
defintion is a duplicate of that found in
src/mesa/drivers/dri/Makefile.defines.

Reviewed-by: Ian Romanick i...@freedesktop.org
Signed-off-by: Chad Versace c...@chad-versace.us

---

 src/mesa/drivers/dri/r300/Makefile |9 -
 src/mesa/drivers/dri/r600/Makefile |9 -
 2 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/Makefile 
b/src/mesa/drivers/dri/r300/Makefile
index 9f23a84..a0a00e0 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -11,15 +11,6 @@ ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
 
-COMMON_SOURCES = \
-   ../../common/driverfuncs.c \
-   ../common/drirenderbuffer.c \
-   ../common/utils.c \
-   ../common/texmem.c \
-   ../common/vblank.c \
-   ../common/xmlconfig.c \
-   ../common/dri_util.c
-
 RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
radeon_buffer_objects.c \
diff --git a/src/mesa/drivers/dri/r600/Makefile 
b/src/mesa/drivers/dri/r600/Makefile
index bec0b5a..2adc352 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -11,15 +11,6 @@ ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
 
-COMMON_SOURCES = \
-   ../../common/driverfuncs.c \
-   ../common/drirenderbuffer.c \
-   ../common/utils.c \
-   ../common/texmem.c \
-   ../common/vblank.c \
-   ../common/xmlconfig.c \
-   ../common/dri_util.c
-
 RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
radeon_common_context.c \

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


Mesa (master): make: Remove duplicate occurence of driverfuncs.c

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: e4a6ebdd87cbff4d6c23db2a8d220ce212093620
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4a6ebdd87cbff4d6c23db2a8d220ce212093620

Author: Chad Versace c...@chad-versace.us
Date:   Thu Aug 25 20:32:13 2011 -0700

make: Remove duplicate occurence of driverfuncs.c

driverfuncs.o is already contained in libmesa.a, so remove it from the
following source lists:
src/mesa/drivers/dri/Makefiles.defines:COMMON_SOURCES.
src/mesa/drivers/dri/swrast/Makefile:SWRAST_COMMON_SOURCES

Reviewed-by: Ian Romanick i...@freedesktop.org
Signed-off-by: Chad Versace c...@chad-versace.us

---

 src/mesa/drivers/dri/Makefile.defines |1 -
 src/mesa/drivers/dri/swrast/Makefile  |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/Makefile.defines 
b/src/mesa/drivers/dri/Makefile.defines
index 19b6de8..90ae551 100644
--- a/src/mesa/drivers/dri/Makefile.defines
+++ b/src/mesa/drivers/dri/Makefile.defines
@@ -7,7 +7,6 @@ COMMON_GALLIUM_SOURCES = \
 ../common/xmlconfig.c
 
 COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-../../common/driverfuncs.c \
 ../common/texmem.c \
 ../common/drirenderbuffer.c
 
diff --git a/src/mesa/drivers/dri/swrast/Makefile 
b/src/mesa/drivers/dri/swrast/Makefile
index 4cb99fd..509fa28 100644
--- a/src/mesa/drivers/dri/swrast/Makefile
+++ b/src/mesa/drivers/dri/swrast/Makefile
@@ -20,7 +20,6 @@ C_SOURCES = \
 ASM_SOURCES =
 
 SWRAST_COMMON_SOURCES = \
-   ../../common/driverfuncs.c \
../common/utils.c \
../common/drisw_util.c
 

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


Mesa (master): make: Factor out source lists from drivers/dri/ common into Makefile.sources

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 16f442e9d58cc50a40d1f85e90a13a909fc9cab1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16f442e9d58cc50a40d1f85e90a13a909fc9cab1

Author: Chad Versace c...@chad-versace.us
Date:   Thu Aug 25 17:55:42 2011 -0700

make: Factor out source lists from drivers/dri/common into Makefile.sources

In order that the Autoconf and Android build can share the same source
lists, move the lists from
src/mesa/drivers/dri/Makefile.defines
into
src/mesa/drivers/dri/common/Makefile.sources

I would like for Android to just reuse Makefile.defines, but the file is
unsuitable for reuse.

Reviewed-by: Chia-I Wu o...@lunarg.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Signed-off: Chad Versace c...@chad-versace.us

---

 src/mesa/drivers/dri/Makefile.defines|   20 +++-
 src/mesa/drivers/dri/common/Makefile.sources |   19 +++
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/Makefile.defines 
b/src/mesa/drivers/dri/Makefile.defines
index 90ae551..6ff8df5 100644
--- a/src/mesa/drivers/dri/Makefile.defines
+++ b/src/mesa/drivers/dri/Makefile.defines
@@ -1,14 +1,13 @@
 # -*-makefile-*-
 
+# Import mesa_dri_common_*
+include ../common/Makefile.sources
+
 COMMON_GALLIUM_SOURCES = \
-../common/utils.c \
-../common/vblank.c \
-../common/dri_util.c \
-../common/xmlconfig.c
+   $(addprefix ../common/, $(mesa_dri_common_gallium_SOURCES))
 
-COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-../common/texmem.c \
-../common/drirenderbuffer.c
+COMMON_SOURCES = \
+   $(addprefix ../common/, $(mesa_dri_common_SOURCES))
 
 INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
 
@@ -20,13 +19,8 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 ### Include directories
 SHARED_INCLUDES = \
-I. \
-   -I$(TOP)/src/mesa/drivers/dri/common \
-Iserver \
-   -I$(TOP)/include \
-   -I$(TOP)/src/mapi \
-   -I$(TOP)/src/mesa \
-   -I$(TOP)/src/egl/main \
-   -I$(TOP)/src/egl/drivers/dri \
+   $(addprefix -I$(TOP)/, $(mesa_dri_common_INCLUDES)) \
$(LIBDRM_CFLAGS)
 
 INCLUDES += $(API_DEFINES)
diff --git a/src/mesa/drivers/dri/common/Makefile.sources 
b/src/mesa/drivers/dri/common/Makefile.sources
new file mode 100644
index 000..3432dda
--- /dev/null
+++ b/src/mesa/drivers/dri/common/Makefile.sources
@@ -0,0 +1,19 @@
+mesa_dri_common_gallium_SOURCES := \
+   utils.c \
+   vblank.c \
+   dri_util.c \
+   xmlconfig.c
+
+mesa_dri_common_SOURCES := \
+   $(mesa_dri_common_gallium_SOURCES) \
+texmem.c \
+drirenderbuffer.c
+
+# Paths are relative to MESA_TOP.
+mesa_dri_common_INCLUDES := \
+   include \
+   src/egl/drivers/dri \
+   src/egl/main \
+   src/mapi \
+   src/mesa \
+   src/mesa/drivers/dri/common

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


Mesa (master): tnl: use buffer helper functions to improve readbility

2011-08-30 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 642bbc6f596722492470c4322a9c011e1705a951
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=642bbc6f596722492470c4322a9c011e1705a951

Author: Brian Paul bri...@vmware.com
Date:   Tue Aug 30 09:44:47 2011 -0600

tnl: use buffer helper functions to improve readbility

---

 src/mesa/tnl/t_draw.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 86af4b7..a5225c4 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -26,6 +26,7 @@
  */
 
 #include main/glheader.h
+#include main/bufferobj.h
 #include main/condrender.h
 #include main/context.h
 #include main/imports.h
@@ -346,7 +347,8 @@ static void bind_indices( struct gl_context *ctx,
   return;
}
 
-   if (ib-obj-Name  !ib-obj-Pointer) {
+   if (_mesa_is_bufferobj(ib-obj)  !_mesa_bufferobj_mapped(ib-obj)) {
+  /* if the buffer object isn't mapped yet, map it now */
   unsigned map_size;
 
   switch (ib-type) {

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


Mesa (master): tnl: add const qualifier to silence warning

2011-08-30 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 788d9bf12174ce59584f4ed768a24a9626f5d9b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=788d9bf12174ce59584f4ed768a24a9626f5d9b7

Author: Brian Paul bri...@vmware.com
Date:   Tue Aug 30 09:47:25 2011 -0600

tnl: add const qualifier to silence warning

---

 src/mesa/tnl/t_draw.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index a5225c4..283ab69 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -340,7 +340,7 @@ static void bind_indices( struct gl_context *ctx,
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = tnl-vb;
GLuint i;
-   void *ptr;
+   const void *ptr;
 
if (!ib) {
   VB-Elts = NULL;

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


Mesa (master): tnl: fix regression in bind_indices()

2011-08-30 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5d9e242c3e28046e9c8ae1760533f92841d0cfaf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d9e242c3e28046e9c8ae1760533f92841d0cfaf

Author: Brian Paul bri...@vmware.com
Date:   Tue Aug 30 09:49:00 2011 -0600

tnl: fix regression in bind_indices()

Commit 2ea1ff38164d95f8291ef2e5dfe2cb13936a60f2 caused the regression.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=40413

---

 src/mesa/tnl/t_draw.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 283ab69..03424d7 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -372,7 +372,8 @@ static void bind_indices( struct gl_context *ctx,
   GL_MAP_READ_BIT, ib-obj);
   assert(ib-obj-Pointer);
} else {
-  ptr = ib-ptr;
+  /* user-space elements, or buffer already mapped */
+  ptr = ADD_POINTERS(ib-obj-Pointer, ib-ptr);
}
 
if (ib-type == GL_UNSIGNED_INT  VB-Primitive[0].basevertex == 0) {

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


Mesa (master): mesa: Build libmesa_dricore.a for Android

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 3758173149325a16d2044be01a70ad3b4fa7260d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3758173149325a16d2044be01a70ad3b4fa7260d

Author: Chad Versace c...@chad-versace.us
Date:   Fri Aug 26 13:29:20 2011 -0700

mesa: Build libmesa_dricore.a for Android

libmesa_dricore.a is analogous to the libmesa.a built by the Autoconf
build.

Reviewed-by: Chia-I Wu o...@lunarg.com
Signed-off-by: Chad Versace c...@chad-versace.us

---

 src/mesa/Android.mk |   29 +
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 67808d4..5f0f4af 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -83,6 +83,35 @@ include $(BUILD_STATIC_LIBRARY)
 endif # MESA_BUILD_GALLIUM
 
 # ---
+# Build libmesa_dricore for DRI modules
+# ---
+
+ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_dricore
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+LOCAL_CFLAGS := \
+   $(common_CFLAGS) \
+   -DFEATURE_GL=1
+
+LOCAL_C_INCLUDES := \
+   $(common_C_INCLUDES)
+
+LOCAL_SRC_FILES := \
+$(MESA_SOURCES) \
+$(MESA_CXX_SOURCES) \
+$(common_ASM)
+
+include $(LOCAL_PATH)/Android.gen.mk
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+endif # MESA_BUILD_CLASSIC
+
+# ---
 # Build libmesa_glsl_utils
 #
 # It is used to avoid circular dependency between core mesa and glsl.

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


Mesa (master): make: Document imported variables

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 05049e709efc1658ddd21047fba6081cbbdca6fe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05049e709efc1658ddd21047fba6081cbbdca6fe

Author: Chad Versace c...@chad-versace.us
Date:   Fri Aug 26 15:48:29 2011 -0700

make: Document imported variables

In src/mesa/Android.mk, it is non-trivial to determine which variables are
imported by `include sources.mak`. So document them.

Reviewed-by: Chia-I Wu o...@lunarg.com
Signed-off-by: Chad Versace c...@chad-versace.us

---

 src/mesa/Android.mk |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 5f0f4af..f21ba3a 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -25,6 +25,12 @@
 
 LOCAL_PATH := $(call my-dir)
 
+# Import the following variables:
+# MESA_CXX_SOURCES
+# MESA_GALLIUM_CXX_SOURCES
+# MESA_GALLIUM_SOURCES
+# MESA_SOURCES
+# X86_SOURCES
 include $(LOCAL_PATH)/sources.mak
 
 common_CFLAGS := \

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


Mesa (master): dri: Build libmesa_dri_common for Android

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 34349d4431831e8e0ccfb8c149d2178630b780dd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=34349d4431831e8e0ccfb8c149d2178630b780dd

Author: Chad Versace c...@chad-versace.us
Date:   Fri Aug 26 16:00:33 2011 -0700

dri: Build libmesa_dri_common for Android

libmesa_dri_common is a static library that contains the sources in
src/mesa/drivers/dri/common. Each DRI driver should link to it.

Reviewed-by: Chia-I Wu o...@lunarg.com
Signed-off-by: Chad Versace c...@chad-versace.us

---

 Android.mk |4 ++-
 src/mesa/drivers/dri/Android.mk|   27 +
 src/mesa/drivers/dri/common/Android.mk |   41 
 3 files changed, 71 insertions(+), 1 deletions(-)

diff --git a/Android.mk b/Android.mk
index bc4b74e..2ad83a0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -78,7 +78,9 @@ SUBDIRS := \
src/egl/main
 
 ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
-SUBDIRS += src/egl/drivers/dri2
+SUBDIRS += \
+   src/egl/drivers/dri2 \
+   src/mesa/drivers/dri
 endif
 
 ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
new file mode 100644
index 000..05b02cb
--- /dev/null
+++ b/src/mesa/drivers/dri/Android.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2011 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the Software),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+SUBDIRS := common
+
+include $(foreach d, $(SUBDIRS), $(LOCAL_PATH)/$(d)/Android.mk)
diff --git a/src/mesa/drivers/dri/common/Android.mk 
b/src/mesa/drivers/dri/common/Android.mk
new file mode 100644
index 000..76464a1
--- /dev/null
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -0,0 +1,41 @@
+#
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2011 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the Software),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#
+# Build libmesa_dri_common
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+include $(LOCAL_PATH)/Makefile.sources
+
+LOCAL_MODULE := libmesa_dri_common
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+LOCAL_C_INCLUDES := $(MESA_DRI_C_INCLUDES)
+LOCAL_SRC_FILES := $(mesa_dri_common_SOURCES)
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)

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


Mesa (master): i965: Fix Android build by removing relative includes

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 2f0edc60f4bd2ae5999a6afa656e3bb3f181bf0f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f0edc60f4bd2ae5999a6afa656e3bb3f181bf0f

Author: Chad Versace c...@chad-versace.us
Date:   Fri Aug 26 13:58:41 2011 -0700

i965: Fix Android build by removing relative includes

Replace each occurence of
#include ../glsl/*.h
with
#include glsl/*.h

Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Signed-off-by: Chad Versace c...@chad-versace.us

---

 src/mesa/drivers/dri/i965/brw_clip.c   |2 +-
 src/mesa/drivers/dri/i965/brw_context.c|2 +-
 .../drivers/dri/i965/brw_cubemap_normalize.cpp |4 ++--
 src/mesa/drivers/dri/i965/brw_eu.c |2 +-
 src/mesa/drivers/dri/i965/brw_eu_emit.c|2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp   |4 ++--
 src/mesa/drivers/dri/i965/brw_fs.h |4 ++--
 .../dri/i965/brw_fs_channel_expressions.cpp|6 +++---
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp  |2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |6 +++---
 .../dri/i965/brw_fs_schedule_instructions.cpp  |6 +++---
 .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |   10 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |6 +++---
 src/mesa/drivers/dri/i965/brw_gs.c |2 +-
 src/mesa/drivers/dri/i965/brw_program.c|2 +-
 src/mesa/drivers/dri/i965/brw_sf.c |2 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp   |4 ++--
 src/mesa/drivers/dri/i965/brw_state_batch.c|2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   |2 +-
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|2 +-
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +-
 src/mesa/drivers/dri/i965/brw_vs.c |2 +-
 src/mesa/drivers/dri/i965/brw_vtbl.c   |2 +-
 src/mesa/drivers/dri/i965/brw_wm.c |2 +-
 24 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clip.c 
b/src/mesa/drivers/dri/i965/brw_clip.c
index d82206b..b49c9f4 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -42,7 +42,7 @@
 #include brw_state.h
 #include brw_clip.h
 
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 #define FRONT_UNFILLED_BIT  0x1
 #define BACK_UNFILLED_BIT   0x2
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index e00e248..898ad8a 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -40,7 +40,7 @@
 #include brw_state.h
 #include intel_span.h
 #include tnl/t_pipeline.h
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 /***
  * Mesa's Driver Functions
diff --git a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp 
b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
index 8574169..ff9485c 100644
--- a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
@@ -30,8 +30,8 @@
  * \author Eric Anholt e...@anholt.net
  */
 
-#include ../glsl/glsl_types.h
-#include ../glsl/ir.h
+#include glsl/glsl_types.h
+#include glsl/ir.h
 
 class brw_cubemap_normalize_visitor : public ir_hierarchical_visitor {
 public:
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
b/src/mesa/drivers/dri/i965/brw_eu.c
index c1f2520..0e04af9 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -34,7 +34,7 @@
 #include brw_defines.h
 #include brw_eu.h
 
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 /* Returns the corresponding conditional mod for swapping src0 and
  * src1 in e.g. CMP.
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index c5013de..e8d0998 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -34,7 +34,7 @@
 #include brw_defines.h
 #include brw_eu.h
 
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 /***
  * Internal helper for constructing instructions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0b0445e..8b85f3b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -46,8 +46,8 @@ extern C {
 }
 #include brw_shader.h
 #include brw_fs.h
-#include ../glsl/glsl_types.h
-#include ../glsl/ir_print_visitor.h
+#include glsl/glsl_types.h
+#include glsl/ir_print_visitor.h
 
 #define MAX_INSTRUCTION (1  30)
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index a06949e..f3d8fbf 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -44,8 +44,8 @@ extern C {
 #include brw_eu.h
 #include brw_wm.h
 }
-#include 

Mesa (master): i965: Build i965_dri.so for Android

2011-08-30 Thread Chad Versace
Module: Mesa
Branch: master
Commit: 1995d1e2070f8cda9e2ce489c694e0949749c8cb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1995d1e2070f8cda9e2ce489c694e0949749c8cb

Author: Chad Versace c...@chad-versace.us
Date:   Fri Aug 26 15:35:47 2011 -0700

i965: Build i965_dri.so for Android

Compile tested only.

Reviewed-by: Chia-I Wu o...@lunarg.com
Signed-off-by: Chad Versace c...@chad-versace.us

---

 Android.mk   |4 +-
 src/mesa/drivers/dri/Android.mk  |   35 +++
 src/mesa/drivers/dri/i965/Android.mk |   61 ++
 3 files changed, 98 insertions(+), 2 deletions(-)

diff --git a/Android.mk b/Android.mk
index 2ad83a0..7c7c55a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -23,7 +23,7 @@
 
 # BOARD_GPU_DRIVERS should be defined.  The valid values are
 #
-#   classic drivers:
+#   classic drivers: i965
 #   gallium drivers: swrast i915g nouveau r300g r600g vmwgfx
 #
 # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
@@ -36,7 +36,7 @@ MESA_PYTHON2 := python
 DRM_TOP := external/drm
 DRM_GRALLOC_TOP := hardware/drm_gralloc
 
-classic_drivers :=
+classic_drivers := i965
 gallium_drivers := swrast i915g nouveau r300g r600g vmwgfx
 
 MESA_GPU_DRIVERS := $(strip $(BOARD_GPU_DRIVERS))
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 05b02cb..b8ccd0c 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -22,6 +22,41 @@
 
 LOCAL_PATH := $(call my-dir)
 
+# Import mesa_dri_common_INCLUDES.
+include $(LOCAL_PATH)/common/Makefile.sources
+
+#---
+# Variables common to all DRI drivers
+
+MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/dri
+MESA_DRI_MODULE_UNSTRIPPED_PATH := 
$(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
+
+MESA_DRI_C_INCLUDES := \
+   $(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
+   $(DRM_TOP) \
+   $(DRM_TOP)/include/drm \
+   external/expat/lib
+
+MESA_DRI_WHOLE_STATIC_LIBRARIES := \
+   libmesa_glsl \
+   libmesa_dri_common \
+   libmesa_dricore
+
+MESA_DRI_SHARED_LIBRARIES := \
+   libcutils \
+   libdl \
+   libdrm \
+   libexpat \
+   libglapi \
+   liblog
+
+#---
+# Build drivers and libmesa_dri_common
+
 SUBDIRS := common
 
+ifneq ($(filter i965, $(MESA_GPU_DRIVERS)),)
+   SUBDIRS += i965
+endif
+
 include $(foreach d, $(SUBDIRS), $(LOCAL_PATH)/$(d)/Android.mk)
diff --git a/src/mesa/drivers/dri/i965/Android.mk 
b/src/mesa/drivers/dri/i965/Android.mk
new file mode 100644
index 000..2a289dd
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2011 Intel Corporation
+# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
+# Copyright (C) 2010-2011 LunarG
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the Software),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := i965_dri
+LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
+LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
+
+# Import variables i965_*.
+include $(LOCAL_PATH)/Makefile.sources
+
+# Overriding LOCAL_CC below is an ugly workaround.  We cannot place -std=c99
+# in LOCAL_C_FLAGS because Android appends LOCAL_C_FLAGS to LOCAL_CPP_FLAGS.
+LOCAL_CC := $(CC) -std=c99
+
+LOCAL_C_FLAGS := \
+   $(MESA_DRI_C_FLAGS) \
+   -DI965
+
+LOCAL_C_INCLUDES := \
+   $(i965_INCLUDES) \
+   $(MESA_DRI_C_INCLUDES) \
+   $(DRM_TOP)/intel
+
+LOCAL_SRC_FILES := \
+   $(i965_C_SOURCES) \
+   $(i965_CXX_SOURCES) \
+   $(i965_ASM_SOURCES)
+
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+   $(MESA_DRI_WHOLE_STATIC_LIBRARIES)
+
+LOCAL_SHARED_LIBRARIES := \
+   $(MESA_DRI_SHARED_LIBRARIES) \
+   libdrm_intel
+
+include $(MESA_COMMON_MK)
+include $(BUILD_SHARED_LIBRARY)

___
mesa-commit mailing 

Mesa (master): i965/vs: Move the flag for whether to use the new backend to the context.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 2f82c33deefba61b3e72edb4375850c0629af224
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f82c33deefba61b3e72edb4375850c0629af224

Author: Eric Anholt e...@anholt.net
Date:   Fri Aug 19 11:42:50 2011 -0700

i965/vs: Move the flag for whether to use the new backend to the context.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i965/brw_context.c |2 ++
 src/mesa/drivers/dri/i965/brw_context.h |1 +
 src/mesa/drivers/dri/i965/brw_vs.c  |6 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 898ad8a..6c2e3e4 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -248,6 +248,8 @@ GLboolean brwCreateContext( int api,
 
brw_draw_init( brw );
 
+   brw-new_vs_backend = (getenv(INTEL_NEW_VS) != NULL);
+
return GL_TRUE;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index df63fe1..e936a88 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -523,6 +523,7 @@ struct brw_context
GLboolean has_negative_rhw_bug;
GLboolean has_aa_line_parameters;
GLboolean has_pln;
+   GLboolean new_vs_backend;
 
struct {
   struct brw_state_flags dirty;
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index f3a394b..3fb389a 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -54,7 +54,6 @@ do_vs_prog(struct brw_context *brw,
void *mem_ctx;
int aux_size;
int i;
-   static int new_vs = -1;
 
memset(c, 0, sizeof(c));
memcpy(c.key, key, sizeof(*key));
@@ -90,10 +89,7 @@ do_vs_prog(struct brw_context *brw,
 
/* Emit GEN4 code.
 */
-   if (new_vs == -1)
-  new_vs = getenv(INTEL_NEW_VS) != NULL;
-
-   if (new_vs  prog) {
+   if (brw-new_vs_backend  prog) {
   if (!brw_vs_emit(prog, c)) {
 ralloc_free(mem_ctx);
 return false;

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


Mesa (master): i965: Use native integer uniforms when the new VS backend is in use.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 55b7fbb70ffc1f4def5c3ded63c3ef569e693731
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=55b7fbb70ffc1f4def5c3ded63c3ef569e693731

Author: Eric Anholt e...@anholt.net
Date:   Fri Aug 19 11:51:43 2011 -0700

i965: Use native integer uniforms when the new VS backend is in use.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i965/brw_context.c|6 +
 src/mesa/drivers/dri/i965/brw_context.h|2 -
 src/mesa/drivers/dri/i965/brw_curbe.c  |3 +-
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|1 -
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   29 ---
 src/mesa/drivers/dri/i965/gen6_vs_state.c  |3 +-
 6 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 6c2e3e4..6ef0fcb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -250,6 +250,12 @@ GLboolean brwCreateContext( int api,
 
brw-new_vs_backend = (getenv(INTEL_NEW_VS) != NULL);
 
+   /* If we're using the new shader backend, we require integer uniforms
+* stored as actual integers.
+*/
+   if (brw-new_vs_backend)
+  ctx-Const.NativeIntegers = true;
+
return GL_TRUE;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index e936a88..21068d9 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -321,9 +321,7 @@ struct brw_vs_prog_data {
GLuint urb_entry_size;
 
const float *param[MAX_UNIFORMS * 4]; /* should be: BRW_MAX_CURBE */
-   enum param_conversion param_convert[MAX_UNIFORMS * 4];
const float *pull_param[MAX_UNIFORMS * 4];
-   enum param_conversion pull_param_convert[MAX_UNIFORMS * 4];
 
bool uses_new_param_layout;
 };
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c 
b/src/mesa/drivers/dri/i965/brw_curbe.c
index 960be10..b9a4beb 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -246,8 +246,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
 
   if (brw-vs.prog_data-uses_new_param_layout) {
 for (i = 0; i  brw-vs.prog_data-nr_params; i++) {
-   buf[offset + i] = convert_param(brw-vs.prog_data-param_convert[i],
-   brw-vs.prog_data-param[i]);
+   buf[offset + i] = *brw-vs.prog_data-param[i];
 }
   } else {
 /* Load the subset of push constants that will get used when
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 47031bc..11d0278 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -120,7 +120,6 @@ vec4_visitor::setup_uniforms(int reg)
 unsigned int slot = this-uniforms * 4 + i;
 
 c-prog_data.param[slot] = NULL;
-c-prog_data.param_convert[slot] = PARAM_CONVERT_ZERO;
   }
 
   this-uniforms++;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index b3a07bd..46f826c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -362,32 +362,14 @@ vec4_visitor::setup_uniform_values(int loc, const 
glsl_type *type)
case GLSL_TYPE_INT:
case GLSL_TYPE_BOOL:
   for (unsigned int i = 0; i  type-vector_elements; i++) {
-int slot = this-uniforms * 4 + i;
-switch (type-base_type) {
-case GLSL_TYPE_FLOAT:
-   c-prog_data.param_convert[slot] = PARAM_NO_CONVERT;
-   break;
-case GLSL_TYPE_UINT:
-   c-prog_data.param_convert[slot] = PARAM_CONVERT_F2U;
-   break;
-case GLSL_TYPE_INT:
-   c-prog_data.param_convert[slot] = PARAM_CONVERT_F2I;
-   break;
-case GLSL_TYPE_BOOL:
-   c-prog_data.param_convert[slot] = PARAM_CONVERT_F2B;
-   break;
-default:
-   assert(!not reached);
-   c-prog_data.param_convert[slot] = PARAM_NO_CONVERT;
-   break;
-}
-c-prog_data.param[slot] = values[i];
+c-prog_data.param[this-uniforms * 4 + i] = values[i];
   }
 
+  /* Set up pad elements to get things aligned to a vec4 boundary. */
   for (unsigned int i = type-vector_elements; i  4; i++) {
-c-prog_data.param_convert[this-uniforms * 4 + i] =
-   PARAM_CONVERT_ZERO;
-c-prog_data.param[this-uniforms * 4 + i] = NULL;
+static float zero = 0;
+
+c-prog_data.param[this-uniforms * 4 + i] = zero;
   }
 
   this-uniform_size[this-uniforms] = type-vector_elements;
@@ -448,7 +430,6 @@ vec4_visitor::setup_builtin_uniform_values(ir_variable *ir)
 last_swiz = swiz;
 
 c-prog_data.param[this-uniforms * 4 + j] = 

Mesa (master): mesa: Fix glGetUniform() type conversions.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 9fa41f0742b7486e462e088a66bef8cebdf114f5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fa41f0742b7486e462e088a66bef8cebdf114f5

Author: Eric Anholt e...@anholt.net
Date:   Tue Aug 23 13:46:12 2011 -0700

mesa: Fix glGetUniform() type conversions.

We were primarily failing to convert in the NativeIntegers case, which
this fixes.  However, we were also just truncating float uniforms when
converting to integer, which does not appear to be the correct
behavior.  Note, however, that the NVIDIA drivers also truncate
instead of rounding.

GL_DOUBLE return type is dropped because it was never used and
completely broken.  It can be added when there's test code.

Fixes piglit ARB_shader_objects/getuniform

v2: This is a rewrite of my previous glGetUniform patch, which Ken
pointed out missed storage_type-based conversions to integer,
which was totally broken still thanks to a typo in the testcase.
v3: Quote the spec justifying the rounding behavior.

Acked-by: Kenneth Graunke kenn...@whitecape.org
Acked-by: Ian Romanick ian.d.roman...@intel.com

---

 src/mesa/main/uniforms.c |  137 ++---
 1 files changed, 79 insertions(+), 58 deletions(-)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index cda840f..fe1ce6d 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -55,17 +55,24 @@ static GLenum
 base_uniform_type(GLenum type)
 {
switch (type) {
-#if 0 /* not needed, for now */
case GL_BOOL:
case GL_BOOL_VEC2:
case GL_BOOL_VEC3:
case GL_BOOL_VEC4:
   return GL_BOOL;
-#endif
case GL_FLOAT:
case GL_FLOAT_VEC2:
case GL_FLOAT_VEC3:
case GL_FLOAT_VEC4:
+   case GL_FLOAT_MAT2:
+   case GL_FLOAT_MAT2x3:
+   case GL_FLOAT_MAT2x4:
+   case GL_FLOAT_MAT3x2:
+   case GL_FLOAT_MAT3:
+   case GL_FLOAT_MAT3x4:
+   case GL_FLOAT_MAT4x2:
+   case GL_FLOAT_MAT4x3:
+   case GL_FLOAT_MAT4:
   return GL_FLOAT;
case GL_UNSIGNED_INT:
case GL_UNSIGNED_INT_VEC2:
@@ -408,8 +415,12 @@ get_uniform(struct gl_context *ctx, GLuint program, GLint 
location,
else {
   const struct gl_program_parameter *p =
  prog-Parameters-Parameters[paramPos];
+  gl_constant_value (*values)[4];
   GLint rows, cols, i, j, k;
   GLsizei numBytes;
+  GLenum storage_type;
+
+  values = prog-Parameters-ParameterValues + paramPos + offset;
 
   get_uniform_rows_cols(p, rows, cols);
 
@@ -421,62 +432,72 @@ get_uniform(struct gl_context *ctx, GLuint program, GLint 
location,
  return;
   }
 
-  switch (returnType) {
-  case GL_FLOAT:
- {
-GLfloat *params = (GLfloat *) paramsOut;
-k = 0;
-for (i = 0; i  rows; i++) {
-   const int base = paramPos + offset + i;
-   for (j = 0; j  cols; j++ ) {
-  params[k++] = prog-Parameters-ParameterValues[base][j].f;
-   }
-}
- }
- break;
-  case GL_DOUBLE:
- {
-GLfloat *params = (GLfloat *) paramsOut;
-k = 0;
-for (i = 0; i  rows; i++) {
-   const int base = paramPos + offset + i;
-   for (j = 0; j  cols; j++ ) {
-  params[k++] = (GLdouble)
- prog-Parameters-ParameterValues[base][j].f;
-   }
-}
- }
- break;
-  case GL_INT:
- {
-GLint *params = (GLint *) paramsOut;
-k = 0;
-for (i = 0; i  rows; i++) {
-   const int base = paramPos + offset + i;
-   for (j = 0; j  cols; j++ ) {
-  params[k++] = ctx-Const.NativeIntegers ?
- prog-Parameters-ParameterValues[base][j].i :
- (GLint) prog-Parameters-ParameterValues[base][j].f;
-   }
-}
- }
- break;
-  case GL_UNSIGNED_INT:
- {
-GLuint *params = (GLuint *) paramsOut;
-k = 0;
-for (i = 0; i  rows; i++) {
-   const int base = paramPos + offset + i;
-   for (j = 0; j  cols; j++ ) {
-  params[k++] = ctx-Const.NativeIntegers ?
- prog-Parameters-ParameterValues[base][j].u :
- (GLuint) prog-Parameters-ParameterValues[base][j].f;
-   }
-}
- }
- break;
-  default:
- _mesa_problem(ctx, bad returnType in get_uniform());
+  if (ctx-Const.NativeIntegers) {
+storage_type = base_uniform_type(p-DataType);
+  } else {
+storage_type = GL_FLOAT;
+  }
+
+  k = 0;
+  for (i = 0; i  rows; i++) {
+for (j = 0; j  cols; j++ ) {
+   void *out = (char *)paramsOut + 4 * k;
+
+   switch (returnType) {
+   case GL_FLOAT:
+  switch (storage_type) {
+  case GL_FLOAT:
+ 

Mesa (master): mesa: Make the gl_constant_value' s bool occupy the same space as float/int.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 7708b25e2b5e05f262c19dde5d7f3612a7e7e166
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7708b25e2b5e05f262c19dde5d7f3612a7e7e166

Author: Eric Anholt e...@anholt.net
Date:   Fri Aug 19 11:58:43 2011 -0700

mesa: Make the gl_constant_value's bool occupy the same space as float/int.

At least for Intel, all our uniform components are of uint32_t size, either
float or signed or unsigned int.  For uploading uniform data in the driver,
it's much easier to upload a full dword per uniform element instead of trying
to pick out the bool byte and then fill in the top 3 bytes of pad with 0.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/program/prog_parameter.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/prog_parameter.h 
b/src/mesa/program/prog_parameter.h
index 1a5ed34..4c2773a 100644
--- a/src/mesa/program/prog_parameter.h
+++ b/src/mesa/program/prog_parameter.h
@@ -53,7 +53,7 @@
 typedef union gl_constant_value
 {
GLfloat f;
-   GLboolean b;
+   GLint b;
GLint i;
GLuint u;
 } gl_constant_value;

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


Mesa (master): i965: Make the old VS backend record pull constant references in pull_params[].

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 8654931d117f178fa575d3fdc5bbff9f8bf9e816
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8654931d117f178fa575d3fdc5bbff9f8bf9e816

Author: Eric Anholt e...@anholt.net
Date:   Mon Aug 22 11:32:11 2011 -0700

i965: Make the old VS backend record pull constant references in pull_params[].

We'll be using that to track things for the new VS backend, and this will
avoid cluttering brw_vs_surface_state.c for it.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i965/brw_context.h  |1 +
 src/mesa/drivers/dri/i965/brw_vs_emit.c  |   14 ++
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c |   19 ++-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 21068d9..69821d9 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -312,6 +312,7 @@ struct brw_vs_prog_data {
GLuint total_grf;
GLbitfield64 outputs_written;
GLuint nr_params;   /** number of float params/constants */
+   GLuint nr_pull_params; /** number of dwords referenced by pull_param[] */
GLuint total_scratch;
 
GLuint inputs_read;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c 
b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index bfee811..63d4061 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -147,6 +147,8 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
int constant = 0;
int vert_result_reoder[VERT_RESULT_MAX];
int bfc = 0;
+   struct brw_vertex_program *vp = c-vp;
+   const struct gl_program_parameter_list *params = 
vp-program.Base.Parameters;
 
/* Determine whether to use a real constant buffer or use a block
 * of GRF registers for constants.  The later is faster but only
@@ -249,6 +251,18 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
if (constant == max_constant)
   c-vp-use_const_buffer = GL_TRUE;
 
+   /* Set up the references to the pull parameters if present.  This backend
+* uses a 1:1 mapping from Mesa IR's index to location in the pull constant
+* buffer, while the new VS backend allocates values to the pull buffer on
+* demand.
+*/
+   if (c-vp-use_const_buffer) {
+  for (i = 0; i  params-NumParameters * 4; i++) {
+c-prog_data.pull_param[i] = params-ParameterValues[i / 4][i % 4].f;
+  }
+  c-prog_data.nr_pull_params = i;
+   }
+
for (i = 0; i  constant; i++) {
   c-regs[PROGRAM_STATE_VAR][i] = stride(brw_vec4_grf(reg + i / 2,
  (i % 2) * 4),
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 f9ee4d1..6748ff9 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -47,10 +47,10 @@ prepare_vs_constants(struct brw_context *brw)
 {
struct gl_context *ctx = brw-intel.ctx;
struct intel_context *intel = brw-intel;
+   /* BRW_NEW_VERTEX_PROGRAM */
struct brw_vertex_program *vp =
   (struct brw_vertex_program *) brw-vertex_program;
const struct gl_program_parameter_list *params = 
vp-program.Base.Parameters;
-   const int size = params-NumParameters * 4 * sizeof(GLfloat);
int i;
 
if (vp-program.IsNVProgram)
@@ -61,8 +61,8 @@ prepare_vs_constants(struct brw_context *brw)
 */
_mesa_load_state_parameters(brw-intel.ctx, vp-program.Base.Parameters);
 
-   /* BRW_NEW_VERTEX_PROGRAM */
-   if (!vp-use_const_buffer) {
+   /* CACHE_NEW_VS_PROG */
+   if (!brw-vs.prog_data-nr_pull_params) {
   if (brw-vs.const_bo) {
 drm_intel_bo_unreference(brw-vs.const_bo);
 brw-vs.const_bo = NULL;
@@ -74,13 +74,14 @@ prepare_vs_constants(struct brw_context *brw)
/* _NEW_PROGRAM_CONSTANTS */
drm_intel_bo_unreference(brw-vs.const_bo);
brw-vs.const_bo = drm_intel_bo_alloc(intel-bufmgr, vp_const_buffer,
-size, 64);
+brw-vs.prog_data-nr_pull_params * 4,
+64);
 
drm_intel_gem_bo_map_gtt(brw-vs.const_bo);
-   for (i = 0; i  params-NumParameters; i++) {
-  memcpy(brw-vs.const_bo-virtual + i * 4 * sizeof(float),
-params-ParameterValues[i],
-4 * sizeof(float));
+   for (i = 0; i  brw-vs.prog_data-nr_pull_params; i++) {
+  memcpy(brw-vs.const_bo-virtual + i * 4,
+brw-vs.prog_data-pull_param[i],
+4);
}
 
if (0) {
@@ -99,7 +100,7 @@ const struct brw_tracked_state brw_vs_constants = {
.dirty = {
   .mesa = (_NEW_PROGRAM_CONSTANTS),
   .brw = (BRW_NEW_VERTEX_PROGRAM),
-  .cache = 0
+  .cache = CACHE_NEW_VS_PROG,
},
.prepare = prepare_vs_constants,
 };


Mesa (master): i965/vs: Restructure emit() functions around a vec4_instruction constructor.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 88e08de8017b69591b37dafde9afd15f796fb404
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=88e08de8017b69591b37dafde9afd15f796fb404

Author: Eric Anholt e...@anholt.net
Date:   Fri Aug 26 16:37:37 2011 -0700

i965/vs: Restructure emit() functions around a vec4_instruction constructor.

We sometimes want to put an instruction somewhere besides the end of
the instruction stream, and we also want per-opcode instruction
generation to enable compile-time checking of operands.

---

 src/mesa/drivers/dri/i965/brw_vec4.h   |8 +
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   41 ++-
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index c03d204..c607154 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -239,6 +239,12 @@ public:
   return node;
}
 
+   vec4_instruction(vec4_visitor *v, enum opcode opcode,
+   dst_reg dst = dst_reg(),
+   src_reg src0 = src_reg(),
+   src_reg src1 = src_reg(),
+   src_reg src2 = src_reg());
+
struct brw_reg get_dst(void);
struct brw_reg get_src(int i);
 
@@ -384,6 +390,8 @@ public:
bool dead_code_eliminate();
bool virtual_grf_interferes(int a, int b);
 
+   vec4_instruction *emit(vec4_instruction *inst);
+
vec4_instruction *emit(enum opcode opcode);
 
vec4_instruction *emit(enum opcode opcode, dst_reg dst, src_reg src0);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 46f826c..9121455 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -72,43 +72,52 @@ dst_reg::dst_reg(src_reg reg)
this-fixed_hw_reg = reg.fixed_hw_reg;
 }
 
-vec4_instruction *
-vec4_visitor::emit(enum opcode opcode, dst_reg dst,
-  src_reg src0, src_reg src1, src_reg src2)
+vec4_instruction::vec4_instruction(vec4_visitor *v,
+  enum opcode opcode, dst_reg dst,
+  src_reg src0, src_reg src1, src_reg src2)
 {
-   vec4_instruction *inst = new(mem_ctx) vec4_instruction();
-
-   inst-opcode = opcode;
-   inst-dst = dst;
-   inst-src[0] = src0;
-   inst-src[1] = src1;
-   inst-src[2] = src2;
-   inst-ir = this-base_ir;
-   inst-annotation = this-current_annotation;
+   this-opcode = opcode;
+   this-dst = dst;
+   this-src[0] = src0;
+   this-src[1] = src1;
+   this-src[2] = src2;
+   this-ir = v-base_ir;
+   this-annotation = v-current_annotation;
+}
 
+vec4_instruction *
+vec4_visitor::emit(vec4_instruction *inst)
+{
this-instructions.push_tail(inst);
 
return inst;
 }
 
+vec4_instruction *
+vec4_visitor::emit(enum opcode opcode, dst_reg dst,
+  src_reg src0, src_reg src1, src_reg src2)
+{
+   return emit(new(mem_ctx) vec4_instruction(this, opcode, dst,
+src0, src1, src2));
+}
+
 
 vec4_instruction *
 vec4_visitor::emit(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1)
 {
-   return emit(opcode, dst, src0, src1, src_reg());
+   return emit(new(mem_ctx) vec4_instruction(this, opcode, dst, src0, src1));
 }
 
 vec4_instruction *
 vec4_visitor::emit(enum opcode opcode, dst_reg dst, src_reg src0)
 {
-   assert(dst.writemask != 0);
-   return emit(opcode, dst, src0, src_reg(), src_reg());
+   return emit(new(mem_ctx) vec4_instruction(this, opcode, dst, src0));
 }
 
 vec4_instruction *
 vec4_visitor::emit(enum opcode opcode)
 {
-   return emit(opcode, dst_reg(), src_reg(), src_reg(), src_reg());
+   return emit(new(mem_ctx) vec4_instruction(this, opcode, dst_reg()));
 }
 
 void

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


Mesa (master): i965/vs: Add support for pull constant loads for uniform arrays.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 483f5b348b0f3c0ca7082fd2047c354e8af285e7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=483f5b348b0f3c0ca7082fd2047c354e8af285e7

Author: Eric Anholt e...@anholt.net
Date:   Mon Aug 22 10:35:24 2011 -0700

i965/vs: Add support for pull constant loads for uniform arrays.

v2: reworked the instruction emit and made use of gen6_resolve_implied_move,
from Ken's review

---

 src/mesa/drivers/dri/i965/brw_defines.h|1 +
 src/mesa/drivers/dri/i965/brw_eu.h |3 +
 src/mesa/drivers/dri/i965/brw_eu_emit.c|2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   |   11 ++
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|   46 -
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  137 +++-
 6 files changed, 195 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index d1799c0..5f34939 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -643,6 +643,7 @@ enum opcode {
VS_OPCODE_URB_WRITE,
VS_OPCODE_SCRATCH_READ,
VS_OPCODE_SCRATCH_WRITE,
+   VS_OPCODE_PULL_CONSTANT_LOAD,
 };
 
 #define BRW_PREDICATE_NONE 0
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index af50305..31334ce 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -807,6 +807,9 @@ void brw_set_dest(struct brw_compile *p, struct 
brw_instruction *insn,
 void brw_set_src0(struct brw_compile *p, struct brw_instruction *insn,
  struct brw_reg reg);
 
+void gen6_resolve_implied_move(struct brw_compile *p,
+  struct brw_reg *src,
+  GLuint msg_reg_nr);
 
 /* Helpers for regular instructions:
  */
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index e8d0998..f9f8d49 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -58,7 +58,7 @@ static void guess_execution_size(struct brw_compile *p,
  * On Sandybridge, this is no longer the case.  This function performs the
  * explicit move; it should be called before emitting a SEND instruction.
  */
-static void
+void
 gen6_resolve_implied_move(struct brw_compile *p,
  struct brw_reg *src,
  GLuint msg_reg_nr)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index c607154..1bb1501 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -370,6 +370,7 @@ public:
 */
dst_reg output_reg[VERT_RESULT_MAX];
int uniform_size[MAX_UNIFORMS];
+   int uniform_vector_size[MAX_UNIFORMS];
int uniforms;
 
struct hash_table *variable_ht;
@@ -386,6 +387,7 @@ public:
void reg_allocate_trivial();
void reg_allocate();
void move_grf_array_access_to_scratch();
+   void move_uniform_array_access_to_pull_constants();
void calculate_live_intervals();
bool dead_code_eliminate();
bool virtual_grf_interferes(int a, int b);
@@ -447,6 +449,8 @@ public:
 
src_reg get_scratch_offset(vec4_instruction *inst,
  src_reg *reladdr, int reg_offset);
+   src_reg get_pull_constant_offset(vec4_instruction *inst,
+   src_reg *reladdr, int reg_offset);
void emit_scratch_read(vec4_instruction *inst,
  dst_reg dst,
  src_reg orig_src,
@@ -455,6 +459,10 @@ public:
   src_reg temp,
   dst_reg orig_dst,
   int base_offset);
+   void emit_pull_constant_load(vec4_instruction *inst,
+   dst_reg dst,
+   src_reg orig_src,
+   int base_offset);
 
GLboolean try_emit_sat(ir_expression *ir);
 
@@ -490,6 +498,9 @@ public:
void generate_scratch_read(vec4_instruction *inst,
  struct brw_reg dst,
  struct brw_reg index);
+   void generate_pull_constant_load(vec4_instruction *inst,
+   struct brw_reg dst,
+   struct brw_reg index);
 };
 
 } /* namespace brw */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 11d0278..4951407 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -114,7 +114,7 @@ vec4_visitor::setup_uniforms(int reg)
 * matter what, or the GPU would hang.
 */
if (intel-gen  6  this-uniforms == 0) {
-  this-uniform_size[this-uniforms] = 1;
+  this-uniform_vector_size[this-uniforms] = 1;
 
   for (unsigned int i = 0; i  4; i++) {
 unsigned int slot = this-uniforms 

Mesa (master): i965/vs: Don't lower uniform array indexing.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: ddca4592a7fa08cc294403d221a5f329ee4991e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddca4592a7fa08cc294403d221a5f329ee4991e9

Author: Eric Anholt e...@anholt.net
Date:   Mon Aug 22 11:48:04 2011 -0700

i965/vs: Don't lower uniform array indexing.

This avoids the massive conditional move array access, and brings code
generation quality for the new VS backend into the realm of efficiency
of the old backend (roughly 20% more instructions generated than
before across shader-db, instead of assertion failing for generating
over 10,000 instructions on many shaders!).

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 597c4cd..0a21094 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -119,7 +119,7 @@ brw_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
   bool input = true;
   bool output = stage == MESA_SHADER_FRAGMENT;
   bool temp = stage == MESA_SHADER_FRAGMENT;
-  bool uniform = true;
+  bool uniform = stage == MESA_SHADER_FRAGMENT;
 
   lower_variable_index_to_cond_assign(shader-ir,
  input, output, temp, uniform);

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


Mesa (master): i965/vs: Track uniforms as separate vectors once we' ve done array access.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 7c84b9d303345fa5075dba8c4ea7af449d93b0f8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c84b9d303345fa5075dba8c4ea7af449d93b0f8

Author: Eric Anholt e...@anholt.net
Date:   Tue Aug 23 10:22:50 2011 -0700

i965/vs: Track uniforms as separate vectors once we've done array access.

This will make it easier to figure out which elements are totally
unused and not upload them.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i965/brw_vec4.cpp |   30 
 src/mesa/drivers/dri/i965/brw_vec4.h   |1 +
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |7 +
 3 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 760bc1f..cdbbb55 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -158,4 +158,34 @@ vec4_visitor::dead_code_eliminate()
return progress;
 }
 
+void
+vec4_visitor::split_uniform_registers()
+{
+   /* Prior to this, uniforms have been in an array sized according to
+* the number of vector uniforms present, sparsely filled (so an
+* aggregate results in reg indices being skipped over).  Now we're
+* going to cut those aggregates up so each .reg index is one
+* vector.  The goal is to make elimination of unused uniform
+* components easier later.
+*/
+   foreach_list(node, this-instructions) {
+  vec4_instruction *inst = (vec4_instruction *)node;
+
+  for (int i = 0 ; i  3; i++) {
+if (inst-src[i].file != UNIFORM)
+   continue;
+
+assert(!inst-src[i].reladdr);
+
+inst-src[i].reg += inst-src[i].reg_offset;
+inst-src[i].reg_offset = 0;
+  }
+   }
+
+   /* Update that everything is now vector-sized. */
+   for (int i = 0; i  this-uniforms; i++) {
+  this-uniform_size[i] = 1;
+   }
+}
+
 } /* namespace brw */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 1bb1501..945eea5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -388,6 +388,7 @@ public:
void reg_allocate();
void move_grf_array_access_to_scratch();
void move_uniform_array_access_to_pull_constants();
+   void split_uniform_registers();
void calculate_live_intervals();
bool dead_code_eliminate();
bool virtual_grf_interferes(int a, int b);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index c4a3bba..dc11d98 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2202,6 +2202,13 @@ 
vec4_visitor::move_uniform_array_access_to_pull_constants()
 inst-src[i].reladdr = NULL;
   }
}
+
+   /* Now there are no accesses of the UNIFORM file with a reladdr, so
+* no need to track them as larger-than-vec4 objects.  This will be
+* relied on in cutting out unused uniform vectors from push
+* constants.
+*/
+   split_uniform_registers();
 }
 
 vec4_visitor::vec4_visitor(struct brw_vs_compile *c,

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


Mesa (master): i965/vs: Pack live uniform vectors together in the push constant upload.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 72cfc6f3778d8297e52c254a5861a88eb62e4d67
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72cfc6f3778d8297e52c254a5861a88eb62e4d67

Author: Eric Anholt e...@anholt.net
Date:   Tue Aug 23 12:13:14 2011 -0700

i965/vs: Pack live uniform vectors together in the push constant upload.

At some point we need to also move uniform accesses out to pull
constants when there are just too many in use, but we lack tests for
that at the moment.

Fixes glsl-vs-large-uniform-array.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i965/brw_vec4.cpp |   89 
 src/mesa/drivers/dri/i965/brw_vec4.h   |1 +
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|5 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |6 ++
 4 files changed, 98 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index cdbbb55..9d64a40 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -188,4 +188,93 @@ vec4_visitor::split_uniform_registers()
}
 }
 
+void
+vec4_visitor::pack_uniform_registers()
+{
+   bool uniform_used[this-uniforms];
+   int new_loc[this-uniforms];
+   int new_chan[this-uniforms];
+
+   memset(uniform_used, 0, sizeof(uniform_used));
+   memset(new_loc, 0, sizeof(new_loc));
+   memset(new_chan, 0, sizeof(new_chan));
+
+   /* Find which uniform vectors are actually used by the program.  We
+* expect unused vector elements when we've moved array access out
+* to pull constants, and from some GLSL code generators like wine.
+*/
+   foreach_list(node, this-instructions) {
+  vec4_instruction *inst = (vec4_instruction *)node;
+
+  for (int i = 0 ; i  3; i++) {
+if (inst-src[i].file != UNIFORM)
+   continue;
+
+uniform_used[inst-src[i].reg] = true;
+  }
+   }
+
+   int new_uniform_count = 0;
+
+   /* Now, figure out a packing of the live uniform vectors into our
+* push constants.
+*/
+   for (int src = 0; src  uniforms; src++) {
+  int size = this-uniform_vector_size[src];
+
+  if (!uniform_used[src]) {
+this-uniform_vector_size[src] = 0;
+continue;
+  }
+
+  int dst;
+  /* Find the lowest place we can slot this uniform in. */
+  for (dst = 0; dst  src; dst++) {
+if (this-uniform_vector_size[dst] + size = 4)
+   break;
+  }
+
+  if (src == dst) {
+new_loc[src] = dst;
+new_chan[src] = 0;
+  } else {
+new_loc[src] = dst;
+new_chan[src] = this-uniform_vector_size[dst];
+
+/* Move the references to the data */
+for (int j = 0; j  size; j++) {
+   c-prog_data.param[dst * 4 + new_chan[src] + j] =
+  c-prog_data.param[src * 4 + j];
+}
+
+this-uniform_vector_size[dst] += size;
+this-uniform_vector_size[src] = 0;
+  }
+
+  new_uniform_count = MAX2(new_uniform_count, dst + 1);
+   }
+
+   this-uniforms = new_uniform_count;
+
+   /* Now, update the instructions for our repacked uniforms. */
+   foreach_list(node, this-instructions) {
+  vec4_instruction *inst = (vec4_instruction *)node;
+
+  for (int i = 0 ; i  3; i++) {
+int src = inst-src[i].reg;
+
+if (inst-src[i].file != UNIFORM)
+   continue;
+
+inst-src[i].reg = new_loc[src];
+
+int sx = BRW_GET_SWZ(inst-src[i].swizzle, 0) + new_chan[src];
+int sy = BRW_GET_SWZ(inst-src[i].swizzle, 1) + new_chan[src];
+int sz = BRW_GET_SWZ(inst-src[i].swizzle, 2) + new_chan[src];
+int sw = BRW_GET_SWZ(inst-src[i].swizzle, 3) + new_chan[src];
+inst-src[i].swizzle = BRW_SWIZZLE4(sx, sy, sz, sw);
+  }
+   }
+}
+
 } /* namespace brw */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 945eea5..3279773 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -389,6 +389,7 @@ public:
void move_grf_array_access_to_scratch();
void move_uniform_array_access_to_pull_constants();
void split_uniform_registers();
+   void pack_uniform_registers();
void calculate_live_intervals();
bool dead_code_eliminate();
bool virtual_grf_interferes(int a, int b);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 4951407..f084a7f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -128,9 +128,6 @@ vec4_visitor::setup_uniforms(int reg)
   reg += ALIGN(uniforms, 2) / 2;
}
 
-   /* for now, we are not doing any elimination of unused slots, nor
-* are we packing our uniforms.
-*/
c-prog_data.nr_params = this-uniforms * 4;
 
c-prog_data.curb_read_length = reg - 1;
@@ -607,6 +604,8 @@ vec4_visitor::run()
   progress = dead_code_eliminate() || 

Mesa (master): i965/vs: Fix GL_FIXED setup when a writemask is present.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 81a0b2166991a3015f8336e184c34cf6a92adfe0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81a0b2166991a3015f8336e184c34cf6a92adfe0

Author: Eric Anholt e...@anholt.net
Date:   Tue Aug 23 13:30:42 2011 -0700

i965/vs: Fix GL_FIXED setup when a writemask is present.

By emitting code before generate_code(), we ended up in align1 mode
where writemasks don't exist, so we rescaled gl_Vertex.w and things
went badly.  By moving GL_FIXED support to the visitor, we end up with
normal codegen, and as a bonus the GL_FIXED setup ends up getting
printed appropriately in debug output.

Fixes gtf/GL2Tests/fixed_data_type

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|   25 +++
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   12 +++
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index f084a7f..067f1c9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -42,24 +42,23 @@ vec4_visitor::setup_attributes(int payload_reg)
   if (prog_data-inputs_read  BITFIELD64_BIT(i)) {
 attribute_map[i] = payload_reg + nr_attributes;
 nr_attributes++;
-
-/* Do GL_FIXED rescaling for GLES2.0.  Our GL_FIXED
- * attributes come in as floating point conversions of the
- * integer values.
- */
-if (c-key.gl_fixed_input_size[i] != 0) {
-   struct brw_reg reg = brw_vec8_grf(attribute_map[i], 0);
-
-   brw_MUL(p,
-   brw_writemask(reg, (1  c-key.gl_fixed_input_size[i]) - 
1),
-   reg, brw_imm_f(1.0 / 65536.0));
-}
   }
}
 
foreach_list(node, this-instructions) {
   vec4_instruction *inst = (vec4_instruction *)node;
 
+  /* We have to support ATTR as a destination for GL_FIXED fixup. */
+  if (inst-dst.file == ATTR) {
+int grf = attribute_map[inst-dst.reg + inst-dst.reg_offset];
+
+struct brw_reg reg = brw_vec8_grf(grf, 0);
+reg.dw1.bits.writemask = inst-dst.writemask;
+
+inst-dst.file = HW_REG;
+inst-dst.fixed_hw_reg = reg;
+  }
+
   for (int i = 0; i  3; i++) {
 if (inst-src[i].file != ATTR)
continue;
@@ -625,7 +624,7 @@ vec4_visitor::run()
 void
 vec4_visitor::generate_code()
 {
-   int last_native_inst = p-nr_insn;
+   int last_native_inst = 0;
const char *last_annotation_string = NULL;
ir_instruction *last_annotation_ir = NULL;
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 6939904..4babc56 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -666,6 +666,18 @@ vec4_visitor::visit(ir_variable *ir)
switch (ir-mode) {
case ir_var_in:
   reg = new(mem_ctx) dst_reg(ATTR, ir-location);
+
+  /* Do GL_FIXED rescaling for GLES2.0.  Our GL_FIXED attributes
+   * come in as floating point conversions of the integer values.
+   */
+  for (int i = ir-location; i  ir-location + type_size(ir-type); i++) {
+if (!c-key.gl_fixed_input_size[i])
+   continue;
+
+dst_reg dst = *reg;
+dst.writemask = (1  c-key.gl_fixed_input_size[i]) - 1;
+emit(BRW_OPCODE_MUL, dst, src_reg(dst), src_reg(1.0f / 65536.0f));
+  }
   break;
 
case ir_var_out:

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


Mesa (master): intel: Remove the passthrough TexSubImage[13]D functions.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: b26a08402f645aebadfabc91e08eac568e1a40c3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b26a08402f645aebadfabc91e08eac568e1a40c3

Author: Eric Anholt e...@anholt.net
Date:   Tue Aug 30 10:33:23 2011 -0700

intel: Remove the passthrough TexSubImage[13]D functions.

All we need for these is _mesa_store_texsubimage[13]d(), since we
don't do the blit path.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Tested-by: Ian Romanick ian.d.roman...@intel.com

---

 src/mesa/drivers/dri/intel/intel_tex_subimage.c |   42 ---
 1 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c 
b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 49c8ae9..851b09e 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -148,27 +148,6 @@ intelTexSubimage(struct gl_context * ctx,
 packing, texObj, texImage);
 }
 
-
-static void
-intelTexSubImage3D(struct gl_context * ctx,
-   GLenum target,
-   GLint level,
-   GLint xoffset, GLint yoffset, GLint zoffset,
-   GLsizei width, GLsizei height, GLsizei depth,
-   GLenum format, GLenum type,
-   const GLvoid * pixels,
-   const struct gl_pixelstore_attrib *packing,
-   struct gl_texture_object *texObj,
-   struct gl_texture_image *texImage)
-{
-   intelTexSubimage(ctx, 3,
-target, level,
-xoffset, yoffset, zoffset,
-width, height, depth, 0,
-format, type, pixels, packing, texObj, texImage);
-}
-
-
 static void
 intelTexSubImage2D(struct gl_context * ctx,
GLenum target,
@@ -189,29 +168,8 @@ intelTexSubImage2D(struct gl_context * ctx,
 }
 
 
-static void
-intelTexSubImage1D(struct gl_context * ctx,
-   GLenum target,
-   GLint level,
-   GLint xoffset,
-   GLsizei width,
-   GLenum format, GLenum type,
-   const GLvoid * pixels,
-   const struct gl_pixelstore_attrib *packing,
-   struct gl_texture_object *texObj,
-   struct gl_texture_image *texImage)
-{
-   intelTexSubimage(ctx, 1,
-target, level,
-xoffset, 0, 0,
-width, 1, 1, 0,
-format, type, pixels, packing, texObj, texImage);
-}
-
 void
 intelInitTextureSubImageFuncs(struct dd_function_table *functions)
 {
-   functions-TexSubImage1D = intelTexSubImage1D;
functions-TexSubImage2D = intelTexSubImage2D;
-   functions-TexSubImage3D = intelTexSubImage3D;
 }

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


Mesa (master): intel: Restructure TexSubImage as just the 2D implementation and blit func.

2011-08-30 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 0b96b3ffa92285d281de82442743402cf374973a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b96b3ffa92285d281de82442743402cf374973a

Author: Eric Anholt e...@anholt.net
Date:   Tue Aug 30 10:31:41 2011 -0700

intel: Restructure TexSubImage as just the 2D implementation and blit func.

Fixes a segfault in piglit copyteximage where I accidentally removed
the dst_bo setup in the previous cleanup.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40474
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Tested-by: Sean McNamara gm.potato...@gmail.com
Tested-by: Ian Romanick ian.d.roman...@intel.com

---

 src/mesa/drivers/dri/intel/intel_tex_subimage.c |  214 ---
 1 files changed, 114 insertions(+), 100 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c 
b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 851b09e..1492740 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -40,112 +40,121 @@
 
 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
-static void
-intelTexSubimage(struct gl_context * ctx,
- GLint dims,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLsizei imageSize,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+static bool
+intel_blit_texsubimage(struct gl_context * ctx,
+  GLenum target, GLint level,
+  GLint xoffset, GLint yoffset,
+  GLint width, GLint height,
+  GLenum format, GLenum type, const void *pixels,
+  const struct gl_pixelstore_attrib *packing,
+  struct gl_texture_object *texObj,
+  struct gl_texture_image *texImage)
 {
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intelImage = intel_texture_image(texImage);
GLuint dstRowStride = 0;
drm_intel_bo *temp_bo = NULL, *dst_bo = NULL;
unsigned int blit_x = 0, blit_y = 0;
+   unsigned long pitch;
+   uint32_t tiling_mode = I915_TILING_NONE;
 
/* Try to do a blit upload of the subimage if the texture is
 * currently busy.
 */
-   if (intelImage-mt 
-   intelImage-mt-region-tiling != I915_TILING_Y 
-   intel-gen  6  target == GL_TEXTURE_2D 
-   drm_intel_bo_busy(dst_bo)) {
-  unsigned long pitch;
-  uint32_t tiling_mode = I915_TILING_NONE;
-
-  DBG(BLT subimage %s target %s level %d offset %d,%d %dx%d\n,
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(target),
- level, xoffset, yoffset, width, height);
-
-  pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
-  format, type, pixels, packing,
-  glTexSubImage);
-  if (!pixels)
-return;
-
-  temp_bo = drm_intel_bo_alloc_tiled(intel-bufmgr,
-subimage blit bo,
-width, height,
-intelImage-mt-cpp,
-tiling_mode,
-pitch,
-0);
-  if (temp_bo == NULL) {
-_mesa_error(ctx, GL_OUT_OF_MEMORY, intelTexSubImage);
-return;
-  }
-
-  if (drm_intel_gem_bo_map_gtt(temp_bo)) {
-_mesa_error(ctx, GL_OUT_OF_MEMORY, intelTexSubImage);
-return;
-  }
-
-  texImage-Data = temp_bo-virtual;
-  texImage-ImageOffsets[0] = 0;
-  dstRowStride = pitch;
-
-  intel_miptree_get_image_offset(intelImage-mt, level,
-intelImage-base.Face, 0,
-blit_x, blit_y);
-  blit_x += xoffset;
-  blit_y += yoffset;
-  xoffset = 0;
-  yoffset = 0;
-
-  if (!_mesa_texstore(ctx, dims, texImage-_BaseFormat,
- texImage-TexFormat,
- texImage-Data,
- xoffset, yoffset, zoffset,
- dstRowStride,
- texImage-ImageOffsets,
- width, height, depth,
- format, type, pixels, packing)) {
-_mesa_error(ctx, GL_OUT_OF_MEMORY, intelTexSubImage);
-  }
-
-  GLboolean ret;
-  unsigned int dst_pitch = intelImage-mt-region-pitch *
-intelImage-mt-cpp;
-
-  drm_intel_gem_bo_unmap_gtt(temp_bo);
-  texImage-Data = NULL;
-
-  ret = intelEmitCopyBlit(intel,
- 

Mesa (master): nv50,nvc0: fix multisample format hack

2011-08-30 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 66e8d223b61dc034fb941e7d704a85ee44d7bbcc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=66e8d223b61dc034fb941e7d704a85ee44d7bbcc

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Tue Aug 30 23:44:27 2011 +0200

nv50,nvc0: fix multisample format hack

Advertising different format support based on sample count was a
bad idea, it made resolve to window work, but resolve to anything
else would fail.

See 9f4998639c3c47f0b7ee3e2a29b7f3609d3f7796.

---

 src/gallium/drivers/nv50/nv50_screen.c |2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index b1d0b1c..235cd82 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -59,7 +59,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8X8_UNORM:
   /* HACK: GL requires equal formats for MS resolve and window is BGRA */
-  if (sample_count  1)
+  if (bindings  PIPE_BIND_RENDER_TARGET)
  return FALSE;
default:
   break;
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index 204887d..d3027de 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -50,7 +50,7 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8X8_UNORM:
   /* HACK: GL requires equal formats for MS resolve and window is BGRA */
-  if (sample_count  1)
+  if (bindings  PIPE_BIND_RENDER_TARGET)
  return FALSE;
default:
   break;

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


Mesa (master): egl_dri2: set ctx-WindowRenderBuffer

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

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Aug 27 01:42:16 2011 +0800

egl_dri2: set ctx-WindowRenderBuffer

Set ctx-WindowRenderBuffer to EGL_BACK_BUFFER.  As EGL_WINDOW_BIT of a
config is set only when there is dri_double_buffer, that makes sure
window surfaces are always double-buffered and contexts will render to
the back buffer.

Reviewed-by: Chad Versace c...@chad-versace.us

---

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

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 4aa1df0..0099a0d 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -697,6 +697,12 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
  dri_config = dri2_config-dri_double_config;
   else
  dri_config = dri2_config-dri_single_config;
+
+  /* EGL_WINDOW_BIT is set only when there is a dri_double_config.  This
+   * makes sure the back buffer will always be used.
+   */
+  if (conf-SurfaceType  EGL_WINDOW_BIT)
+ dri2_ctx-base.WindowRenderBuffer = EGL_BACK_BUFFER;
}
else
   dri_config = NULL;

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


Mesa (master): egl_dri2: check the surface type in platform_android

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

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Aug 26 22:09:56 2011 +0800

egl_dri2: check the surface type in platform_android

Check the surface type is EGL_WINDOW_BIT before doing anything, in
preparation for pbuffer support.

Reviewed-by: Chad Versace c...@chad-versace.us

---

 src/egl/drivers/dri2/platform_android.c |  101 +--
 1 files changed, 56 insertions(+), 45 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 2bbd210..a5374b4 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -149,23 +149,6 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
struct dri2_egl_surface *dri2_surf;
-   int format;
-
-   (void) drv;
-
-   if (!window || window-common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
-  _eglError(EGL_BAD_NATIVE_WINDOW, droid_create_surface);
-  return NULL;
-   }
-   if (window-query(window, NATIVE_WINDOW_FORMAT, format)) {
-  _eglError(EGL_BAD_NATIVE_WINDOW, droid_create_surface);
-  return NULL;
-   }
-   if (format != dri2_conf-base.NativeVisualID) {
-  _eglLog(_EGL_WARNING, Native format mismatch: 0x%x != 0x%x,
-format, dri2_conf-base.NativeVisualID);
-   }
-
dri2_surf = calloc(1, sizeof *dri2_surf);
if (!dri2_surf) {
   _eglError(EGL_BAD_ALLOC, droid_create_surface);
@@ -173,7 +156,28 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
}
 
if (!_eglInitSurface(dri2_surf-base, disp, type, conf, attrib_list))
-  goto cleanup_surf;
+  goto cleanup_surface;
+
+   if (type == EGL_WINDOW_BIT) {
+  int format;
+
+  if (!window || window-common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
+ _eglError(EGL_BAD_NATIVE_WINDOW, droid_create_surface);
+ goto cleanup_surface;
+  }
+  if (window-query(window, NATIVE_WINDOW_FORMAT, format)) {
+ _eglError(EGL_BAD_NATIVE_WINDOW, droid_create_surface);
+ goto cleanup_surface;
+  }
+
+  if (format != dri2_conf-base.NativeVisualID) {
+ _eglLog(_EGL_WARNING, Native format mismatch: 0x%x != 0x%x,
+   format, dri2_conf-base.NativeVisualID);
+  }
+
+  window-query(window, NATIVE_WINDOW_WIDTH, dri2_surf-base.Width);
+  window-query(window, NATIVE_WINDOW_HEIGHT, dri2_surf-base.Height);
+   }
 
dri2_surf-dri_drawable =
   (*dri2_dpy-dri2-createNewDrawable)(dri2_dpy-dri_screen,
@@ -181,18 +185,17 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
dri2_surf);
if (dri2_surf-dri_drawable == NULL) {
   _eglError(EGL_BAD_ALLOC, dri2-createNewDrawable);
-  goto cleanup_surf;
+  goto cleanup_surface;
}
 
-   window-common.incRef(window-common);
-   window-query(window, NATIVE_WINDOW_WIDTH, dri2_surf-base.Width);
-   window-query(window, NATIVE_WINDOW_HEIGHT, dri2_surf-base.Height);
-
-   dri2_surf-window = window;
+   if (window) {
+  window-common.incRef(window-common);
+  dri2_surf-window = window;
+   }
 
return dri2_surf-base;
 
-cleanup_surf:
+cleanup_surface:
free(dri2_surf);
 
return NULL;
@@ -233,10 +236,12 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
 
droid_free_local_buffers(dri2_surf);
 
-   if (dri2_surf-buffer)
-  droid_window_cancel_buffer(dri2_surf);
+   if (dri2_surf-base.Type == EGL_WINDOW_BIT) {
+  if (dri2_surf-buffer)
+ droid_window_cancel_buffer(dri2_surf);
 
-   dri2_surf-window-common.decRef(dri2_surf-window-common);
+  dri2_surf-window-common.decRef(dri2_surf-window-common);
+   }
 
(*dri2_dpy-core-destroyDrawable)(dri2_surf-dri_drawable);
 
@@ -253,6 +258,9 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
_EGLContext *ctx;
 
+   if (dri2_surf-base.Type != EGL_WINDOW_BIT)
+  return EGL_TRUE;
+
if (dri2_drv-glFlush) {
   ctx = _eglGetCurrentContext();
   if (ctx  ctx-DrawSurface == dri2_surf-base)
@@ -384,14 +392,16 @@ droid_get_buffers_parse_attachments(struct 
dri2_egl_surface *dri2_surf,
 
   switch (attachments[i]) {
   case __DRI_BUFFER_BACK_LEFT:
- buf-attachment = attachments[i];
- buf-name = get_native_buffer_name(dri2_surf-buffer);
- buf-cpp = get_format_bpp(dri2_surf-buffer-format);
- buf-pitch = dri2_surf-buffer-stride * buf-cpp;
- buf-flags = 0;
-
- if (buf-name)
-num_buffers++;
+ if (dri2_surf-base.Type == EGL_WINDOW_BIT) {
+buf-attachment 

Mesa (master): egl_dri2: refactor droid_get_buffers_with_format

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

Author: Chia-I Wu o...@lunarg.com
Date:   Fri Aug 26 23:49:04 2011 +0800

egl_dri2: refactor droid_get_buffers_with_format

Move the loop to parse attachments to its own function.

Reviewed-by: Chad Versace c...@chad-versace.us

---

 src/egl/drivers/dri2/platform_android.c |   66 ++-
 1 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 284dc3a..2bbd210 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -369,36 +369,18 @@ droid_flush_front_buffer(__DRIdrawable * driDrawable, 
void *loaderPrivate)
 {
 }
 
-static __DRIbuffer *
-droid_get_buffers_with_format(__DRIdrawable * driDrawable,
-int *width, int *height,
-unsigned int *attachments, int count,
-int *out_count, void *loaderPrivate)
+static int
+droid_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf,
+unsigned int *attachments, int count)
 {
-   struct dri2_egl_surface *dri2_surf = loaderPrivate;
-   struct dri2_egl_display *dri2_dpy =
-  dri2_egl_display(dri2_surf-base.Resource.Display);
-   int i;
+   int num_buffers = 0, i;
 
-   if (!dri2_surf-buffer) {
-  if (!droid_window_dequeue_buffer(dri2_surf))
- return NULL;
-   }
-
-   /* free outdated buffers and update the surface size */
-   if (dri2_surf-base.Width != dri2_surf-buffer-width ||
-   dri2_surf-base.Height != dri2_surf-buffer-height) {
-  droid_free_local_buffers(dri2_surf);
-  dri2_surf-base.Width = dri2_surf-buffer-width;
-  dri2_surf-base.Height = dri2_surf-buffer-height;
-   }
-
-   dri2_surf-buffer_count = 0;
+   /* fill dri2_surf-buffers */
for (i = 0; i  count * 2; i += 2) {
   __DRIbuffer *buf, *local;
 
-  assert(dri2_surf-buffer_count  ARRAY_SIZE(dri2_surf-buffers));
-  buf = dri2_surf-buffers[dri2_surf-buffer_count];
+  assert(num_buffers  ARRAY_SIZE(dri2_surf-buffers));
+  buf = dri2_surf-buffers[num_buffers];
 
   switch (attachments[i]) {
   case __DRI_BUFFER_BACK_LEFT:
@@ -409,7 +391,7 @@ droid_get_buffers_with_format(__DRIdrawable * driDrawable,
  buf-flags = 0;
 
  if (buf-name)
-dri2_surf-buffer_count++;
+num_buffers++;
  break;
   case __DRI_BUFFER_DEPTH:
   case __DRI_BUFFER_STENCIL:
@@ -421,7 +403,7 @@ droid_get_buffers_with_format(__DRIdrawable * driDrawable,
 
  if (local) {
 *buf = *local;
-dri2_surf-buffer_count++;
+num_buffers++;
  }
  break;
   case __DRI_BUFFER_FRONT_LEFT:
@@ -435,6 +417,36 @@ droid_get_buffers_with_format(__DRIdrawable * driDrawable,
   }
}
 
+   return num_buffers;
+}
+
+static __DRIbuffer *
+droid_get_buffers_with_format(__DRIdrawable * driDrawable,
+int *width, int *height,
+unsigned int *attachments, int count,
+int *out_count, void *loaderPrivate)
+{
+   struct dri2_egl_surface *dri2_surf = loaderPrivate;
+   struct dri2_egl_display *dri2_dpy =
+  dri2_egl_display(dri2_surf-base.Resource.Display);
+   int i;
+
+   if (!dri2_surf-buffer) {
+  if (!droid_window_dequeue_buffer(dri2_surf))
+ return NULL;
+   }
+
+   /* free outdated buffers and update the surface size */
+   if (dri2_surf-base.Width != dri2_surf-buffer-width ||
+   dri2_surf-base.Height != dri2_surf-buffer-height) {
+  droid_free_local_buffers(dri2_surf);
+  dri2_surf-base.Width = dri2_surf-buffer-width;
+  dri2_surf-base.Height = dri2_surf-buffer-height;
+   }
+
+   dri2_surf-buffer_count =
+  droid_get_buffers_parse_attachments(dri2_surf, attachments, count);
+
if (width)
   *width = dri2_surf-base.Width;
if (height)

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


Mesa (master): egl_dri2: add pbuffer support to platform_android

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

Author: Chia-I Wu o...@lunarg.com
Date:   Sat Aug 27 00:00:18 2011 +0800

egl_dri2: add pbuffer support to platform_android

This is a simple change thanks to allocateBuffer.

Reviewed-by: Chad Versace c...@chad-versace.us

---

 src/egl/drivers/dri2/platform_android.c |   21 -
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index a5374b4..a0e4c65 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -222,7 +222,8 @@ static _EGLSurface *
 droid_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, const EGLint *attrib_list)
 {
-   return NULL;
+   return droid_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
+ NULL, attrib_list);
 }
 
 static EGLBoolean
@@ -401,8 +402,10 @@ droid_get_buffers_parse_attachments(struct 
dri2_egl_surface *dri2_surf,
 
 if (buf-name)
num_buffers++;
+
+break;
  }
- break;
+ /* fall through for pbuffers */
   case __DRI_BUFFER_DEPTH:
   case __DRI_BUFFER_STENCIL:
   case __DRI_BUFFER_ACCUM:
@@ -491,10 +494,11 @@ droid_add_configs_for_visuals(_EGLDriver *drv, 
_EGLDisplay *dpy)
   int format_count = 0;
 
   for (j = 0; dri2_dpy-driver_configs[j]; j++) {
+ const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
  struct dri2_egl_config *dri2_conf;
 
  dri2_conf = dri2_add_config(dpy, dri2_dpy-driver_configs[j],
-   count + 1, visuals[i].size, EGL_WINDOW_BIT, NULL,
+   count + 1, visuals[i].size, surface_type, NULL,
visuals[i].rgba_masks);
  if (dri2_conf) {
 dri2_conf-base.NativeVisualID = visuals[i].format;
@@ -518,9 +522,16 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay 
*dpy)
   dri2_conf-base.RenderableType = ~EGL_OPENGL_BIT;
   dri2_conf-base.Conformant = ~EGL_OPENGL_BIT;
 
-  /* and we want to make sure GL_DRAW_BUFFER is always GL_BACK */
+  /*
+   * We want to make sure GL_DRAW_BUFFER for windows or pbuffers is always
+   * GL_BACK.  For EGL configs that do not have a double DRI config, clear
+   * the surface type.
+   *
+   * This is just to be on the safe side.  dri2_add_config never sets
+   * EGL_WINDOW_BIT or EGL_PBUFFER_BIT for such configs.
+   */
   if (!dri2_conf-dri_double_config)
- dri2_conf-base.SurfaceType = ~EGL_WINDOW_BIT;
+ dri2_conf-base.SurfaceType = 0;
}
 
return (count != 0);

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