Re: [Mesa-dev] [PATCH 11/11] r200: Fix probable thinko in r200EmitArrays

2013-01-12 Thread Roland Scheidegger

Oh pretty sure I wrote that bug ages ago :-).
I think you would hit it iff you'd use 12 generic vertex attributes in a 
vertex program - I guess noone ever did on that hardware...


Reviewed-by: Roland Scheidegger srol...@vmware.com

On 01/11/2013 06:23 PM, Johannes Obermayr wrote:

From: Adam Jackson a...@redhat.com

Effectively this path would always assert.  Move the break statement to
the (probable) intended place.

Note: This is a candidate for the stable branches.

Signed-off-by: Adam Jackson a...@redhat.com
---
  src/mesa/drivers/dri/r200/r200_maos_arrays.c |3 ++-
  1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c 
b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
index 973dcaf..d7607bc 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
@@ -166,8 +166,9 @@ void r200EmitArrays( struct gl_context *ctx, GLubyte 
*vimap_rev )
   /* fallthrough */
case 4:
   vfmt0 |= R200_VTX_W1;
-   break;
+  /* fallthrough */
}
+   break;
 default:
assert(0);
emitsize = 0;



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


Re: [Mesa-dev] [PATCH 05/11] gallium/auxiliary: Build libgallium shared.

2013-01-12 Thread Johannes Obermayr
Am Samstag, 12. Januar 2013, 13:34:34 schrieb Chia-I Wu:
 On Sat, Jan 12, 2013 at 10:23 AM, Johannes Obermayr
 johannesoberm...@gmx.de wrote:
  diff --git a/src/gallium/auxiliary/Makefile.am 
  b/src/gallium/auxiliary/Makefile.am
  index a4eee47..21b3c6b 100644
  --- a/src/gallium/auxiliary/Makefile.am
  +++ b/src/gallium/auxiliary/Makefile.am
  @@ -3,13 +3,17 @@ AUTOMAKE_OPTIONS = subdir-objects
   include Makefile.sources
   include $(top_srcdir)/src/gallium/Automake.inc
 
  -noinst_LTLIBRARIES = libgallium.la
  +lib_LTLIBRARIES = libgallium@VERSION@.la
 I probably missed the discussion.  I suppose libgallium is meant to be
 internal.  What motivates the change?
 

1. It is easiest fix for a runtime fix if you build r600 and radeonsi together.

2. All internal libraries will be shared in future and installed to 
$(libdir)/mesa-$(VERSION) to make packages on distributions much much much 
smaller .
You can follow the way to it here:
https://github.com/jobermayr/mesa/commits/master
(e. g. a full build will be ~ 15 - 20 MiB libraries + ~ 100 - 140 MiB 
debuginfo +? MiB documentation)

3. Maybe some more (main) developers should be also available and follow 
discussions on #dri-devel.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] nv50/nvc0: Build codegen in nv50.

2013-01-12 Thread Johannes Obermayr
This is required to make libnv50 independent of libnvc0.
---
 src/gallium/drivers/nv50/Makefile.sources  |   12 +++-
 src/gallium/drivers/nv50/nv50_miptree.c|   32 ++--
 src/gallium/drivers/nv50/nv50_resource.h   |3 +-
 src/gallium/drivers/nvc0/Makefile.sources  |6 
 .../drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp |2 +-
 src/gallium/drivers/nvc0/nvc0_miptree.c|   26 ++--
 6 Dateien geändert, 45 Zeilen hinzugefügt(+), 36 Zeilen entfernt(-)

diff --git a/src/gallium/drivers/nv50/Makefile.sources 
b/src/gallium/drivers/nv50/Makefile.sources
index c112e82..1092570 100644
--- a/src/gallium/drivers/nv50/Makefile.sources
+++ b/src/gallium/drivers/nv50/Makefile.sources
@@ -15,7 +15,7 @@ C_SOURCES := \
nv50_push.c \
nv50_query.c
 
-CPP_SOURCES := \
+CODEGEN_NV50_SOURCES := \
codegen/nv50_ir.cpp \
codegen/nv50_ir_bb.cpp \
codegen/nv50_ir_build_util.cpp \
@@ -30,3 +30,13 @@ CPP_SOURCES := \
codegen/nv50_ir_target.cpp \
codegen/nv50_ir_target_nv50.cpp \
codegen/nv50_ir_util.cpp
+
+CODEGEN_NVC0_SOURCES := \
+   $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_gk110.cpp \
+   $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp \
+   
$(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp \
+   $(top_srcdir)/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp
+
+CPP_SOURCES := \
+   $(CODEGEN_NV50_SOURCES) \
+   $(CODEGEN_NVC0_SOURCES)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c 
b/src/gallium/drivers/nv50/nv50_miptree.c
index fc9d7f3..7883edb 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -28,10 +28,38 @@
 #include nv50_context.h
 #include nv50_resource.h
 
-static INLINE uint32_t
+uint32_t
+nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz)
+{
+   uint32_t tile_mode = 0x000;
+
+   if (ny  64) tile_mode = 0x040; /* height 128 tiles */
+   else
+   if (ny  32) tile_mode = 0x030; /* height 64 tiles */
+   else
+   if (ny  16) tile_mode = 0x020; /* height 32 tiles */
+   else
+   if (ny   8) tile_mode = 0x010; /* height 16 tiles */
+
+   if (nz == 1)
+  return tile_mode;
+   else
+  if (tile_mode  0x020)
+ tile_mode = 0x020;
+
+   if (nz  16  tile_mode  0x020)
+  return tile_mode | 0x500; /* depth 32 tiles */
+   if (nz  8) return tile_mode | 0x400; /* depth 16 tiles */
+   if (nz  4) return tile_mode | 0x300; /* depth 8 tiles */
+   if (nz  2) return tile_mode | 0x200; /* depth 4 tiles */
+
+   return tile_mode | 0x100;
+}
+
+static uint32_t
 nv50_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
 {
-   return nvc0_tex_choose_tile_dims(nx, ny * 2, nz);
+   return nv50_tex_choose_tile_dims_helper(nx, ny * 2, nz);
 }
 
 static uint32_t
diff --git a/src/gallium/drivers/nv50/nv50_resource.h 
b/src/gallium/drivers/nv50/nv50_resource.h
index 4808955..a2bc980 100644
--- a/src/gallium/drivers/nv50/nv50_resource.h
+++ b/src/gallium/drivers/nv50/nv50_resource.h
@@ -32,8 +32,7 @@ nv50_screen_init_resource_functions(struct pipe_screen 
*pscreen);
 #endif /* __NVC0_RESOURCE_H__ */
 
 uint32_t
-nvc0_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz);
-
+nv50_tex_choose_tile_dims_helper(unsigned nx, unsigned ny, unsigned nz);
 
 struct nv50_miptree_level {
uint32_t offset;
diff --git a/src/gallium/drivers/nvc0/Makefile.sources 
b/src/gallium/drivers/nvc0/Makefile.sources
index 82504bf..d0e213b 100644
--- a/src/gallium/drivers/nvc0/Makefile.sources
+++ b/src/gallium/drivers/nvc0/Makefile.sources
@@ -14,9 +14,3 @@ C_SOURCES := \
nvc0_program.c \
nvc0_shader_state.c \
nvc0_query.c
-
-CPP_SOURCES := \
-   codegen/nv50_ir_emit_gk110.cpp \
-   codegen/nv50_ir_emit_nvc0.cpp \
-   codegen/nv50_ir_lowering_nvc0.cpp \
-   codegen/nv50_ir_target_nvc0.cpp
diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp 
b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
index 749ace5..c5a7772 100644
--- a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
@@ -1096,7 +1096,7 @@ NVC0LoweringPass::visit(Instruction *i)
   break;
default:
   break;
-   }   
+   }
return true;
 }
 
diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c 
b/src/gallium/drivers/nvc0/nvc0_miptree.c
index b63f196..fee89a7 100644
--- a/src/gallium/drivers/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nvc0/nvc0_miptree.c
@@ -28,32 +28,10 @@
 #include nvc0_context.h
 #include nvc0_resource.h
 
-uint32_t
+static uint32_t
 nvc0_tex_choose_tile_dims(unsigned nx, unsigned ny, unsigned nz)
 {
-   uint32_t tile_mode = 0x000;
-
-   if (ny  64) tile_mode = 0x040; /* height 128 tiles */
-   else
-   if (ny  32) tile_mode = 0x030; /* height 64 tiles */
-   else
-   if (ny  16) tile_mode 

[Mesa-dev] [Bug 59281] New: Build failure by not finding wayland-client.h

2013-01-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59281

  Priority: medium
Bug ID: 59281
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: Build failure by not finding wayland-client.h
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: pvuor...@gmail.com
  Hardware: Other
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

Created attachment 72902
  -- https://bugs.freedesktop.org/attachment.cgi?id=72902action=edit
Patch to fix build

On current master. Wayland headers under home directory so not found from the
standard ones.

make[2]: Entering directory
`/home/pvuorela/src/wayland/mesa/src/gallium/winsys/sw/wayland'
  CC wayland_sw_winsys.lo
wayland_sw_winsys.c:39:28: fatal error: wayland-client.h: No such file or
directory
compilation terminated.
make[2]: *** [wayland_sw_winsys.lo] Error 1

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/11] gallium/auxiliary: Build libgallium shared.

2013-01-12 Thread Tom Stellard
On Sat, Jan 12, 2013 at 11:34:04AM +0100, Johannes Obermayr wrote:
 Am Samstag, 12. Januar 2013, 13:34:34 schrieb Chia-I Wu:
  On Sat, Jan 12, 2013 at 10:23 AM, Johannes Obermayr
  johannesoberm...@gmx.de wrote:
   diff --git a/src/gallium/auxiliary/Makefile.am 
   b/src/gallium/auxiliary/Makefile.am
   index a4eee47..21b3c6b 100644
   --- a/src/gallium/auxiliary/Makefile.am
   +++ b/src/gallium/auxiliary/Makefile.am
   @@ -3,13 +3,17 @@ AUTOMAKE_OPTIONS = subdir-objects
include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
  
   -noinst_LTLIBRARIES = libgallium.la
   +lib_LTLIBRARIES = libgallium@VERSION@.la
  I probably missed the discussion.  I suppose libgallium is meant to be
  internal.  What motivates the change?
  
 
 1. It is easiest fix for a runtime fix if you build r600 and radeonsi 
 together.


I'm assuming the runtime errors you are referring are when static LLVM
objects are initialized twice and lead to an assertion failure
somewhere in the LLVM code.

I don't think these runtime errors are caused by building r600 and
radeonsi together, because I get the same LLVM assertion failures
running clover as I do with EGL.

From what I can tell, these runtime errors happen when a state tracker,
like clover or EGL links to certain LLVM libraries and then loads a
pipe_*.so library that has also been linked with these LLVM libraries.

I'm not sure why we weren't getting these errors before the automake
merege.  Maybe we were just lucky, or maybe the linker is doing something
differently with regards to symbol visibility.  It might be helpful to
analyze libOpenCL.so or egl_gallium.so with objdump before and after
the automake merge to see what has changed.  This may helps us figure
out what the correct solution is.

-Tom
 2. All internal libraries will be shared in future and installed to 
 $(libdir)/mesa-$(VERSION) to make packages on distributions much much much 
 smaller .
 You can follow the way to it here:
 https://github.com/jobermayr/mesa/commits/master
 (e. g. a full build will be ~ 15 - 20 MiB libraries + ~ 100 - 140 MiB 
 debuginfo +? MiB documentation)
 
 3. Maybe some more (main) developers should be also available and follow 
 discussions on #dri-devel.
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 59281] Build failure by not finding wayland-client.h

2013-01-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59281

Andreas Boll andreas.boll@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Andreas Boll andreas.boll@gmail.com ---
Thanks!
Fixed with 09a00a141f8cf1cac1a8907df4f9c1cb1edd939c

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/11] gallium/auxiliary: Build libgallium shared.

2013-01-12 Thread Tom Stellard
On Sat, Jan 12, 2013 at 10:04:16AM -0500, Tom Stellard wrote:
 On Sat, Jan 12, 2013 at 11:34:04AM +0100, Johannes Obermayr wrote:
  Am Samstag, 12. Januar 2013, 13:34:34 schrieb Chia-I Wu:
   On Sat, Jan 12, 2013 at 10:23 AM, Johannes Obermayr
   johannesoberm...@gmx.de wrote:
diff --git a/src/gallium/auxiliary/Makefile.am 
b/src/gallium/auxiliary/Makefile.am
index a4eee47..21b3c6b 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -3,13 +3,17 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
   
-noinst_LTLIBRARIES = libgallium.la
+lib_LTLIBRARIES = libgallium@VERSION@.la
   I probably missed the discussion.  I suppose libgallium is meant to be
   internal.  What motivates the change?
   
  
  1. It is easiest fix for a runtime fix if you build r600 and radeonsi 
  together.
 
 
 I'm assuming the runtime errors you are referring are when static LLVM
 objects are initialized twice and lead to an assertion failure
 somewhere in the LLVM code.
 
 I don't think these runtime errors are caused by building r600 and
 radeonsi together, because I get the same LLVM assertion failures
 running clover as I do with EGL.
 
 From what I can tell, these runtime errors happen when a state tracker,
 like clover or EGL links to certain LLVM libraries and then loads a
 pipe_*.so library that has also been linked with these LLVM libraries.
 
 I'm not sure why we weren't getting these errors before the automake
 merege.  Maybe we were just lucky, or maybe the linker is doing something
 differently with regards to symbol visibility.  It might be helpful to
 analyze libOpenCL.so or egl_gallium.so with objdump before and after
 the automake merge to see what has changed.  This may helps us figure
 out what the correct solution is.
 
 -Tom

By the way, you should be able to reproduce these runtime errors by
building r600g with the llvm compiler and enabling egl support in mesa:

--with-gallium-drivers=r600 --enable-r600-llvm-compiler
--enable-gallium-egl --with-egl-platforms=x11,drm

And running one of the egl demos, like eglgears, from the mesa-demos
package.

-Tom



  2. All internal libraries will be shared in future and installed to 
  $(libdir)/mesa-$(VERSION) to make packages on distributions much much much 
  smaller .
  You can follow the way to it here:
  https://github.com/jobermayr/mesa/commits/master
  (e. g. a full build will be ~ 15 - 20 MiB libraries + ~ 100 - 140 MiB 
  debuginfo +? MiB documentation)
  
  3. Maybe some more (main) developers should be also available and follow 
  discussions on #dri-devel.
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] xmlpool: Fix out-of-tree builds.

2013-01-12 Thread Johannes Obermayr
---
 src/mesa/drivers/dri/common/xmlpool/Makefile.am |2 +-
 src/mesa/drivers/dri/i915/Makefile.am   |1 +
 src/mesa/drivers/dri/i965/Makefile.am   |1 +
 src/mesa/drivers/dri/r200/Makefile.am   |1 +
 src/mesa/drivers/dri/radeon/Makefile.am |1 +
 5 Dateien geändert, 5 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile.am 
b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
index b2a423c..b99df40 100644
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile.am
+++ b/src/mesa/drivers/dri/common/xmlpool/Makefile.am
@@ -62,7 +62,7 @@ clean:
 # Default target options.h
 options.h: LOCALEDIR := .
 options.h: t_options.h $(MOS)
-   $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/gen_xmlpool.py 
t_options.h $(LOCALEDIR) $(LANGS)  options.h
+   $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/gen_xmlpool.py 
$(srcdir)/t_options.h $(LOCALEDIR) $(LANGS)  options.h
 
 # Update .mo files from the corresponding .po files.
 %/LC_MESSAGES/options.mo: %.po
diff --git a/src/mesa/drivers/dri/i915/Makefile.am 
b/src/mesa/drivers/dri/i915/Makefile.am
index 4e0dccd..a067cd4 100644
--- a/src/mesa/drivers/dri/i915/Makefile.am
+++ b/src/mesa/drivers/dri/i915/Makefile.am
@@ -30,6 +30,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/intel \
-I$(top_srcdir)/src/mesa/drivers/dri/intel/server \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
$(DEFINES) \
$(API_DEFINES) \
$(VISIBILITY_CFLAGS) \
diff --git a/src/mesa/drivers/dri/i965/Makefile.am 
b/src/mesa/drivers/dri/i965/Makefile.am
index 127becd..71ec635 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -34,6 +34,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mesa/drivers/dri/intel \
-I$(top_srcdir)/src/mesa/drivers/dri/intel/server \
-I$(top_srcdir)/src/gtest/include \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
$(DEFINES) \
$(API_DEFINES) \
$(VISIBILITY_CFLAGS) \
diff --git a/src/mesa/drivers/dri/r200/Makefile.am 
b/src/mesa/drivers/dri/r200/Makefile.am
index 477bd70..774c308 100644
--- a/src/mesa/drivers/dri/r200/Makefile.am
+++ b/src/mesa/drivers/dri/r200/Makefile.am
@@ -31,6 +31,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mesa/ \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/r200/server \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
$(DEFINES) \
$(API_DEFINES) \
$(VISIBILITY_CFLAGS) \
diff --git a/src/mesa/drivers/dri/radeon/Makefile.am 
b/src/mesa/drivers/dri/radeon/Makefile.am
index 753c7af..64999fb 100644
--- a/src/mesa/drivers/dri/radeon/Makefile.am
+++ b/src/mesa/drivers/dri/radeon/Makefile.am
@@ -31,6 +31,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mesa/ \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/radeon/server \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
$(DEFINES) \
$(API_DEFINES) \
$(VISIBILITY_CFLAGS) \
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH 02/11] glapi/gen: remove an obsolete comment from Makefile.am

2013-01-12 Thread Andreas Boll
FYI I've posted an updated version of this patch here:
http://lists.freedesktop.org/archives/mesa-dev/2013-January/032557.html

2013/1/12 Johannes Obermayr johannesoberm...@gmx.de:
 From: Andreas Boll andreas.boll@gmail.com

 ---
  src/mapi/glapi/gen/Makefile.am |5 -
  1 Datei geändert, 5 Zeilen entfernt(-)

 diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
 index 46b2127..f869d28 100644
 --- a/src/mapi/glapi/gen/Makefile.am
 +++ b/src/mapi/glapi/gen/Makefile.am
 @@ -1,8 +1,3 @@
 -# This file isn't used during a normal compilation since we don't want to
 -# require Python in order to compile Mesa.
 -# Instead, when the Mesa developers update/change the API interface it's
 -# up to him/her to re-run this makefile and check in the newly generated 
 files.
 -
  # These are the official xserver indent flags from 
 utils/modular/x-indent.sh
  XORG_INDENT_FLAGS = -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 
 -lc80 -psl -nbbo \
  -nbc -psl -nbfda -nut -nss -T pointer -T ScreenPtr -T ScrnInfoPtr -T 
 pointer \
 --
 1.7.10.4

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


Re: [Mesa-dev] [PATCH 03/11] mesa/dricore: Drop compatibility for the old Mesa build system and -avoid-version.

2013-01-12 Thread Andreas Boll
2013/1/12 Johannes Obermayr johannesoberm...@gmx.de:
 ---
  configure.ac|1 +
  src/mesa/libdricore/Makefile.am |   23 ---
  2 Dateien geändert, 9 Zeilen hinzugefügt(+), 15 Zeilen entfernt(-)

 diff --git a/configure.ac b/configure.ac
 index 72df83c..10b306e 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -945,6 +945,7 @@ AC_ARG_ENABLE([glx-tls],
  [GLX_USE_TLS=$enableval],
  [GLX_USE_TLS=no])
  AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
 +AM_CONDITIONAL(HAVE_GLX_TLS, test x$GLX_USE_TLS = xyes)

  AS_IF([test x$GLX_USE_TLS = xyes -a x$ax_pthread_ok = xyes],
[DEFINES=${DEFINES} -DGLX_USE_TLS -DHAVE_PTHREAD])
 diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
 index 753548e..54c5060 100644
 --- a/src/mesa/libdricore/Makefile.am
 +++ b/src/mesa/libdricore/Makefile.am
 @@ -39,10 +39,16 @@ libdricore@VERSION@_la_SOURCES = \
 $(LIBGLSL_FILES) \
 $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
 $(top_builddir)/src/glsl/builtin_function.cpp
 -libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
 +libdricore@VERSION@_la_LDFLAGS = -Wl,--no-undefined -shared -avoid-version
  libdricore@VERSION@_la_LIBADD = \
  ../program/libdricore_program.la \
 -$()
 +$(DLOPEN_LIBS)
 +
 +if HAVE_SHARED_GLAPI
 +libdricore@VERSION@_la_LIBADD += ../../mapi/shared-glapi/libglapi.la
 +else
 +libdricore@VERSION@_la_LIBADD += ../../mapi/glapi/libglapi.la
 +endif

  if HAVE_X86_ASM
  libdricore@VERSION@_la_SOURCES += $(X86_FILES)
 @@ -67,17 +73,4 @@ endif

  if HAVE_DRI
  lib_LTLIBRARIES = libdricore@VERSION@.la
 -
 -# Provide compatibility with scripts for the old Mesa build system for
 -# a while by putting a link to the driver into /lib of the build tree.
 -all-local: libdricore@VERSION@.la
 -   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
 -   ln -f .libs/libdricore@VERSION@.so.1.0.0 
 $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so.1;
 -   ln -sf libdricore@VERSION@.so.1 
 $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so
  endif
 -
 -CLEANFILES = \
 -   $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so.1 \
 -   $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so
 -
 --include $(DEPENDS)

Please move the dropping compatibility part of this patch to the next patch
and only adjust it here.

 --
 1.7.10.4

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


Re: [Mesa-dev] [PATCH 08/11] tests: AM_CPPFLAGS must include $(top_srcdir) instead of $(top_builddir).

2013-01-12 Thread Andreas Boll
Reviewed-by: Andreas Boll andreas.boll@gmail.com

2013/1/12 Johannes Obermayr johannesoberm...@gmx.de:
 ---
  src/glsl/tests/Makefile.am |9 +
  src/glx/tests/Makefile.am  |   10 +-
  src/mapi/shared-glapi/tests/Makefile.am|6 +++---
  src/mesa/main/tests/hash_table/Makefile.am |2 +-
  4 Dateien geändert, 14 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-)

 diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am
 index 957bb55..eaf5a3c 100644
 --- a/src/glsl/tests/Makefile.am
 +++ b/src/glsl/tests/Makefile.am
 @@ -1,8 +1,9 @@
  AM_CPPFLAGS = \
 -   -I$(top_builddir)/src/gtest/include \
 -   -I$(top_builddir)/src/mesa \
 -   -I$(top_builddir)/src/mapi \
 -   -I$(top_builddir)/src/glsl
 +   -I$(top_srcdir)/src/gtest/include \
 +   -I$(top_srcdir)/src/mesa \
 +   -I$(top_srcdir)/src/mapi \
 +   -I$(top_srcdir)/src/glsl \
 +   -I$(top_srcdir)/include

  TESTS_ENVIRONMENT= \
 export PYTHON2=$(PYTHON2); \
 diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
 index 83626fd..d940712 100644
 --- a/src/glx/tests/Makefile.am
 +++ b/src/glx/tests/Makefile.am
 @@ -1,11 +1,11 @@
  if HAVE_SHARED_GLAPI
  AM_CFLAGS = $(PTHREAD_CFLAGS)
  AM_CPPFLAGS = \
 -   -I$(top_builddir)/src/gtest/include \
 -   -I$(top_builddir)/src/mapi \
 -   -I$(top_builddir)/src/mesa \
 -   -I$(top_builddir)/src/glx \
 -   -I$(top_builddir)/include \
 +   -I$(top_srcdir)/src/gtest/include \
 +   -I$(top_srcdir)/src/mapi \
 +   -I$(top_srcdir)/src/mesa \
 +   -I$(top_srcdir)/src/glx \
 +   -I$(top_srcdir)/include \
 $(X11_CFLAGS)

  TESTS = glx-test
 diff --git a/src/mapi/shared-glapi/tests/Makefile.am 
 b/src/mapi/shared-glapi/tests/Makefile.am
 index 23d0208..98065fc 100644
 --- a/src/mapi/shared-glapi/tests/Makefile.am
 +++ b/src/mapi/shared-glapi/tests/Makefile.am
 @@ -1,9 +1,9 @@
  if HAVE_SHARED_GLAPI
  AM_CFLAGS = $(PTHREAD_CFLAGS)
  AM_CPPFLAGS = \
 -   -I$(top_builddir)/src/gtest/include \
 -   -I$(top_builddir)/src/mapi \
 -   -I$(top_builddir)/include
 +   -I$(top_srcdir)/src/gtest/include \
 +   -I$(top_srcdir)/src/mapi \
 +   -I$(top_srcdir)/include

  TESTS = shared-glapi-test
  check_PROGRAMS = shared-glapi-test
 diff --git a/src/mesa/main/tests/hash_table/Makefile.am 
 b/src/mesa/main/tests/hash_table/Makefile.am
 index 5a4aac3..272c63a 100644
 --- a/src/mesa/main/tests/hash_table/Makefile.am
 +++ b/src/mesa/main/tests/hash_table/Makefile.am
 @@ -19,7 +19,7 @@
  #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

  AM_CPPFLAGS = \
 --I../.. \
 +   -I$(top_srcdir)/src/mesa/main \
 $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)

  LDADD = \
 --
 1.7.10.4

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


Re: [Mesa-dev] [PATCH 09/11] gtest: Build it only for 'make check'.

2013-01-12 Thread Andreas Boll
Reviewed-by: Andreas Boll andreas.boll@gmail.com

2013/1/12 Johannes Obermayr johannesoberm...@gmx.de:
 ---
  src/gtest/Makefile.am |2 +-
  1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

 diff --git a/src/gtest/Makefile.am b/src/gtest/Makefile.am
 index 7defa34..4188c6b 100644
 --- a/src/gtest/Makefile.am
 +++ b/src/gtest/Makefile.am
 @@ -22,7 +22,7 @@
  AM_CFLAGS = $(DEFINES) -I$(top_srcdir)/src/gtest/include
  AM_CXXFLAGS = $(DEFINES) -I$(top_srcdir)/src/gtest/include

 -noinst_LTLIBRARIES = libgtest.la
 +check_LTLIBRARIES = libgtest.la

  libgtest_la_SOURCES = \
 src/gtest-all.cc \
 --
 1.7.10.4

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


Re: [Mesa-dev] [PATCH 04/11] Drop last parts of compatibility for the old Mesa build system.

2013-01-12 Thread Andreas Boll
2013/1/12 Kenneth Graunke kenn...@whitecape.org:
 On 01/11/2013 06:23 PM, Johannes Obermayr wrote:

 diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
 index ca5257a..61192d6 100644
 --- a/src/egl/main/Makefile.am
 +++ b/src/egl/main/Makefile.am
 @@ -116,13 +116,6 @@ libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la
   libEGL_la_LIBADD += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIBS)
   endif

 -# Provide compatibility with scripts for the old Mesa build system for
 -# a while by putting a link to the driver into /lib of the build tree.
 -all-local: libEGL.la
 -   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
 -   ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1
 -   ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so
 -
   pkgconfigdir = $(libdir)/pkgconfig


 Installing a copy of everything in lib/ was actually a convenience for
 developers wanting to test newly built stuff without having to 'make
 install'.  Not really old build system cruft.

 I use this all the time.  I'd be OK with removing it and adjusting to more
 standard practices, but I wanted to make sure everyone was aware it was
 happening.


Maybe we should wait with this patch until we get more response,
because the last time we brought up removing this we get some objections[0].
As a consequence I've had to add all the compatibility links to the
automake-gallium branch.

[0] Thread started here:
http://lists.freedesktop.org/archives/mesa-dev/2012-September/027889.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 04/11] Drop last parts of compatibility for the old Mesa build system.

2013-01-12 Thread Johannes Obermayr
Am Samstag, 12. Januar 2013, 17:42:17 schrieb Andreas Boll:
 2013/1/12 Kenneth Graunke kenn...@whitecape.org:
  On 01/11/2013 06:23 PM, Johannes Obermayr wrote:
 
  diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
  index ca5257a..61192d6 100644
  --- a/src/egl/main/Makefile.am
  +++ b/src/egl/main/Makefile.am
  @@ -116,13 +116,6 @@ libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la
libEGL_la_LIBADD += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIBS)
endif
 
  -# Provide compatibility with scripts for the old Mesa build system for
  -# a while by putting a link to the driver into /lib of the build tree.
  -all-local: libEGL.la
  -   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
  -   ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1
  -   ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so
  -
pkgconfigdir = $(libdir)/pkgconfig
 
 
  Installing a copy of everything in lib/ was actually a convenience for
  developers wanting to test newly built stuff without having to 'make
  install'.  Not really old build system cruft.
 
  I use this all the time.  I'd be OK with removing it and adjusting to more
  standard practices, but I wanted to make sure everyone was aware it was
  happening.
 
 
 Maybe we should wait with this patch until we get more response,
 because the last time we brought up removing this we get some objections[0].
 As a consequence I've had to add all the compatibility links to the
 automake-gallium branch.
 
 [0] Thread started here:
 http://lists.freedesktop.org/archives/mesa-dev/2012-September/027889.html

After shared branch will be merged it shouldn't work anymore.

Then you must use 'make install DESTDIR=$DIR' instead and additionally add 
$DIR/mesa-$VERSION to PATH to find internal shared libs.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCHv2] xmlpool: Fix out-of-tree builds.

2013-01-12 Thread Johannes Obermayr
---
I found more on gallium ...
---
 src/gallium/state_trackers/dri/drm/Makefile.am  |1 +
 src/gallium/state_trackers/dri/sw/Makefile.am   |1 +
 src/gallium/targets/dri-i915/Makefile.am|1 +
 src/gallium/targets/dri-nouveau/Makefile.am |1 +
 src/gallium/targets/dri-r300/Makefile.am|1 +
 src/gallium/targets/dri-r600/Makefile.am|1 +
 src/gallium/targets/dri-radeonsi/Makefile.am|1 +
 src/gallium/targets/dri-vmwgfx/Makefile.am  |1 +
 src/mesa/drivers/dri/common/xmlpool/Makefile.am |2 +-
 src/mesa/drivers/dri/i915/Makefile.am   |1 +
 src/mesa/drivers/dri/i965/Makefile.am   |1 +
 src/mesa/drivers/dri/r200/Makefile.am   |1 +
 src/mesa/drivers/dri/radeon/Makefile.am |1 +
 13 Dateien geändert, 13 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/src/gallium/state_trackers/dri/drm/Makefile.am 
b/src/gallium/state_trackers/dri/drm/Makefile.am
index 235c3b6..f8916b1 100644
--- a/src/gallium/state_trackers/dri/drm/Makefile.am
+++ b/src/gallium/state_trackers/dri/drm/Makefile.am
@@ -28,6 +28,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/gallium/state_trackers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
$(GALLIUM_CFLAGS) \
$(LIBDRM_CFLAGS)
 
diff --git a/src/gallium/state_trackers/dri/sw/Makefile.am 
b/src/gallium/state_trackers/dri/sw/Makefile.am
index 9e4d976..b62161a 100644
--- a/src/gallium/state_trackers/dri/sw/Makefile.am
+++ b/src/gallium/state_trackers/dri/sw/Makefile.am
@@ -27,6 +27,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/gallium/state_trackers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
$(GALLIUM_CFLAGS) \
$(LIBDRM_CFLAGS) \
-D__NOT_HAVE_DRM_H
diff --git a/src/gallium/targets/dri-i915/Makefile.am 
b/src/gallium/targets/dri-i915/Makefile.am
index f9f36f3..d14228e 100644
--- a/src/gallium/targets/dri-i915/Makefile.am
+++ b/src/gallium/targets/dri-i915/Makefile.am
@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mapi \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE \
-DGALLIUM_GALAHAD \
diff --git a/src/gallium/targets/dri-nouveau/Makefile.am 
b/src/gallium/targets/dri-nouveau/Makefile.am
index 2307fdc..a780fc5 100644
--- a/src/gallium/targets/dri-nouveau/Makefile.am
+++ b/src/gallium/targets/dri-nouveau/Makefile.am
@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mapi \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE
 
diff --git a/src/gallium/targets/dri-r300/Makefile.am 
b/src/gallium/targets/dri-r300/Makefile.am
index c42bf88..b152180 100644
--- a/src/gallium/targets/dri-r300/Makefile.am
+++ b/src/gallium/targets/dri-r300/Makefile.am
@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mapi \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE \
-DGALLIUM_GALAHAD
diff --git a/src/gallium/targets/dri-r600/Makefile.am 
b/src/gallium/targets/dri-r600/Makefile.am
index 06b9235..cc4e403 100644
--- a/src/gallium/targets/dri-r600/Makefile.am
+++ b/src/gallium/targets/dri-r600/Makefile.am
@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mapi \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE \
-DGALLIUM_NOOP
diff --git a/src/gallium/targets/dri-radeonsi/Makefile.am 
b/src/gallium/targets/dri-radeonsi/Makefile.am
index 342adad..e1cd803 100644
--- a/src/gallium/targets/dri-radeonsi/Makefile.am
+++ b/src/gallium/targets/dri-radeonsi/Makefile.am
@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mapi \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE \
-DGALLIUM_NOOP
diff --git a/src/gallium/targets/dri-vmwgfx/Makefile.am 
b/src/gallium/targets/dri-vmwgfx/Makefile.am
index 0da1c0c..a2c3211 100644
--- a/src/gallium/targets/dri-vmwgfx/Makefile.am
+++ b/src/gallium/targets/dri-vmwgfx/Makefile.am
@@ -31,6 +31,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/winsys \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/src/mapi \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
-DGALLIUM_RBUG \
-DGALLIUM_TRACE
 
diff --git 

Re: [Mesa-dev] [PATCH 01/11] Remove hacks for static Makefiles

2013-01-12 Thread Matt Turner
On Fri, Jan 11, 2013 at 6:23 PM, Johannes Obermayr
johannesoberm...@gmx.de wrote:
 From: Matt Turner matts...@gmail.com

Previously when I asked for testing feedback, some people said they
didn't want to see the library links in lib/ removed.

So, I think there are two parts to this patch, really. The first is
the removal of the TOP variable, and the other is removing the binary
symlinks. The first shouldn't cause anyone problems. I guess we need
to have a discussion about the second.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/11] Remove hacks for static Makefiles

2013-01-12 Thread Matt Turner
On Sat, Jan 12, 2013 at 11:07 AM, Matt Turner matts...@gmail.com wrote:
 On Fri, Jan 11, 2013 at 6:23 PM, Johannes Obermayr
 johannesoberm...@gmx.de wrote:
 From: Matt Turner matts...@gmail.com

 Previously when I asked for testing feedback, some people said they
 didn't want to see the library links in lib/ removed.

 So, I think there are two parts to this patch, really. The first is
 the removal of the TOP variable, and the other is removing the binary
 symlinks. The first shouldn't cause anyone problems. I guess we need
 to have a discussion about the second.

Oh, I didn't look closely enough. This patch just removes the
convenience library links. That's perfectly okay in any case.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glxinfo: add support for creating/querying core-profile contexts (v2)

2013-01-12 Thread Dave Airlie
From: Brian Paul bri...@vmware.com

[airlied: Based on Brian's patch, I've fixed it up to always report a non-core
and core profile, after each other, and dropped the -c flag as its redunant
now]

The -c flag says to try to create a core profile (no legacy features)
using glXCreateContextAttribsARB().  A core profile may advertise a
different set of extensions than a compatibility profile (though,
the only difference with NVIDIA's driver is the presence of
GL_ARB_compatibility).  Also note that extensions need to be queried
one at a time with glGetStringi().

Be more careful with creating direct vs. indirect contexts.  If
we're trying to get a direct context, don't immediately settle for
indirect.  Try indirect only after failing to get direct.
---
 src/xdemos/glxinfo.c | 564 +--
 1 file changed, 456 insertions(+), 108 deletions(-)

diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index 38bd384..d49bb91 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -29,6 +29,7 @@
  *  -b only print ID of best visual on screen 0
  *  -i use indirect rendering connection only
  *  -l print interesting OpenGL limits (added 5 Sep 2002)
+ *  -c request a core profile rendering context
  *
  * Brian Paul  26 January 2000
  */
@@ -62,6 +63,8 @@
 #define GLX_COLOR_INDEX_BIT0x0002
 #endif
 
+#define ELEMENTS(array) (sizeof(array) / sizeof(array[0]))
+
 typedef enum
 {
Normal,
@@ -108,6 +111,43 @@ struct visual_attribs
 };
 

+/** list of known OpenGL versions */
+static struct { int major, minor; } gl_versions[] = {
+   {1, 0},
+   {1, 1},
+   {1, 2},
+   {1, 3},
+   {1, 4},
+   {1, 5},
+   {2, 0},
+   {2, 1},
+   {3, 0},
+   {3, 1},
+   {3, 2},
+   {3, 3},
+   {4, 0},
+   {4, 1},
+   {4, 2},
+   {4, 3},
+   {0, 0} /* end of list */
+};
+
+#define NUM_GL_VERSIONS ELEMENTS(gl_versions)
+
+
+/**
+ * GL Error checking/warning.
+ */
+static void
+CheckError(int line)
+{
+   int n;
+   n = glGetError();
+   if (n)
+  printf(Warning: GL error 0x%x at line %d\n, n, line);
+}
+
+
 /*
  * qsort callback for string comparison.
  */
@@ -219,6 +259,45 @@ print_extension_list(const char *ext, Bool singleLine)
 }
 
 
+/**
+ * Get list of OpenGL extensions using core profile's glGetStringi().
+ */
+static char *
+build_core_profile_extension_list(void)
+{
+   GLint i, n, totalLen;
+   char *buffer;
+   static PFNGLGETSTRINGIPROC glGetStringi_func = NULL;
+
+   if (!glGetStringi_func) {
+  glGetStringi_func = (PFNGLGETSTRINGIPROC)
+ glXGetProcAddressARB((GLubyte *) glGetStringi);
+   }
+
+   glGetIntegerv(GL_NUM_EXTENSIONS, n);
+
+   /* compute totalLen */
+   totalLen = 0;
+   for (i = 0; i  n; i++) {
+  const char *ext = (const char *) glGetStringi_func(GL_EXTENSIONS, i);
+  totalLen += strlen(ext) + 1; /* plus a space */
+   }
+
+   buffer = malloc(totalLen);
+   if (buffer) {
+  int pos = 0;
+  for (i = 0; i  n; i++) {
+ const char *ext = (const char *) glGetStringi_func(GL_EXTENSIONS, i);
+ strcpy(buffer + pos, ext);
+ pos += strlen(ext);
+ buffer[pos++] = ' ';
+  }
+   }
+   return buffer;
+}
+
+
+
 static void
 print_display_info(Display *dpy)
 {
@@ -373,7 +452,7 @@ extension_supported(const char *ext, const char 
*extensionsList)
  * Print interesting OpenGL implementation limits.
  */
 static void
-print_limits(const char *extensions)
+print_limits(const char *extensions, const char *oglstring)
 {
struct token_name {
   GLuint count;
@@ -436,7 +515,7 @@ print_limits(const char *extensions)
};
GLint i, max[2];
 
-   printf(OpenGL limits:\n);
+   printf(%s limits:\n, oglstring);
for (i = 0; limits[i].count; i++) {
   if (!limits[i].extension ||
   extension_supported(limits[i].extension, extensions)) {
@@ -480,10 +559,249 @@ print_limits(const char *extensions)
 }
 
 
-static void
-print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, 
Bool singleLine)
+struct bit_info
+{
+   int bit;
+   const char *name;
+};
+
+
+/**
+ * Return string representation for bits in a bitmask.
+ */
+static const char *
+bitmask_to_string(const struct bit_info bits[], int numBits, int mask)
+{
+   static char buffer[256], *p;
+   int i;
+
+   strcpy(buffer, (none));
+   p = buffer;
+   for (i = 0; i  numBits; i++) {
+  if (mask  bits[i].bit) {
+ if (p  buffer)
+*p++ = ',';
+ strcpy(p, bits[i].name);
+ p += strlen(bits[i].name);
+  }
+   }
+
+   return buffer;
+}
+
+/**
+ * Return string representation for the bitmask returned by
+ * GL_CONTEXT_PROFILE_MASK (OpenGL 3.2 or later).
+ */
+static const char *
+profile_mask_string(int mask)
+{
+   const static struct bit_info bits[] = {
+#ifdef GL_CONTEXT_CORE_PROFILE_BIT
+  { GL_CONTEXT_CORE_PROFILE_BIT, core profile},
+#endif
+#ifdef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
+   

Re: [Mesa-dev] [PATCHv2] xmlpool: Fix out-of-tree builds.

2013-01-12 Thread Kenneth Graunke

On 01/12/2013 09:39 AM, Johannes Obermayr wrote:

---
I found more on gallium ...
---
  src/gallium/state_trackers/dri/drm/Makefile.am  |1 +
  src/gallium/state_trackers/dri/sw/Makefile.am   |1 +
  src/gallium/targets/dri-i915/Makefile.am|1 +
  src/gallium/targets/dri-nouveau/Makefile.am |1 +
  src/gallium/targets/dri-r300/Makefile.am|1 +
  src/gallium/targets/dri-r600/Makefile.am|1 +
  src/gallium/targets/dri-radeonsi/Makefile.am|1 +
  src/gallium/targets/dri-vmwgfx/Makefile.am  |1 +
  src/mesa/drivers/dri/common/xmlpool/Makefile.am |2 +-
  src/mesa/drivers/dri/i915/Makefile.am   |1 +
  src/mesa/drivers/dri/i965/Makefile.am   |1 +
  src/mesa/drivers/dri/r200/Makefile.am   |1 +
  src/mesa/drivers/dri/radeon/Makefile.am |1 +
  13 Dateien geändert, 13 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)


Looks good to me.

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

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


Re: [Mesa-dev] [PATCH] i965: Add an INTEL_DEBUG=no16 option.

2013-01-12 Thread Eric Anholt
Kenneth Graunke kenn...@whitecape.org writes:
 exec_list *simd16_instructions = NULL;
 fs_visitor v2(brw, c, prog, fp, 16);
 -   if (intel-gen = 5  c-prog_data.nr_pull_params == 0) {
 +   bool no16 = INTEL_DEBUG  DEBUG_NO16;
 +   if (intel-gen = 5  c-prog_data.nr_pull_params == 0  
 unlikely(!no16)) {

Your likeliness check here is backwards.

Other than that,

Reviewed-by: Eric Anholt e...@anholt.net


pgpT2yGzBKbgt.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: Use UNIFORM_PULL_CONSTANT_LOAD_GEN7 for normal uniforms too.

2013-01-12 Thread Kenneth Graunke
Previously, we used UNIFORM_PULL_CONSTANT_LOAD_GEN7 only for UBO-loads.
This patch refactors out the UBO-load code and uses it for pull constant
setup as well.

This gives us the benefit of send-from-GRF for normal pull constants.
Additionally, it means that the code generator only needs to handle
either the pre-Gen7 or Gen7 variant of the opcode, rather than needing
to handle both.

Cc: Eric Anholt e...@anholt.net
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 51 ++--
 src/mesa/drivers/dri/i965/brw_fs.h   |  3 ++
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 31 +++--
 3 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index ae26d07..c1e7757 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -220,6 +220,42 @@ fs_visitor::CMP(fs_reg dst, fs_reg src0, fs_reg src1, 
uint32_t condition)
 }
 
 exec_list
+fs_visitor::UNIFORM_PULL_CONSTANT_LOAD(fs_reg dst,
+   unsigned surf_index,
+   unsigned offset)
+{
+   exec_list instructions;
+   fs_inst *inst;
+
+   if (intel-gen = 7) {
+  fs_reg payload = fs_reg(this, glsl_type::uint_type);
+
+  struct brw_reg g0 = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD);
+  inst = MOV(payload, fs_reg(g0));
+  inst-force_writemask_all = true;
+  instructions.push_tail(inst);
+
+  /* We don't need the second half of this vgrf to be filled with g1
+   * in the 16-wide case, but if we use force_uncompressed then live
+   * variable analysis won't consider this a def!
+   */
+  inst = new(mem_ctx) fs_inst(FS_OPCODE_SET_GLOBAL_OFFSET, payload, 
payload,
+  fs_reg(offset / 16));
+  instructions.push_tail(inst);
+  inst = new(mem_ctx) fs_inst(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD_GEN7,
+  dst, fs_reg(surf_index), payload);
+  instructions.push_tail(inst);
+   } else {
+  inst = new(mem_ctx) fs_inst(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD,
+  dst, fs_reg(surf_index), fs_reg(offset));
+  inst-base_mrf = 14;
+  inst-mlen = 1;
+  instructions.push_tail(inst);
+   }
+   return instructions;
+}
+
+exec_list
 fs_visitor::VARYING_PULL_CONSTANT_LOAD(fs_reg dst, fs_reg surf_index,
fs_reg offset)
 {
@@ -1662,17 +1698,10 @@ fs_visitor::setup_pull_constants()
  assert(!inst-src[i].reladdr);
 
 fs_reg dst = fs_reg(this, glsl_type::float_type);
-fs_reg index = fs_reg((unsigned)SURF_INDEX_FRAG_CONST_BUFFER);
-fs_reg offset = fs_reg((unsigned)(pull_index * 4)  ~15);
-fs_inst *pull =
-new(mem_ctx) fs_inst(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD,
- dst, index, offset);
-pull-ir = inst-ir;
-pull-annotation = inst-annotation;
-pull-base_mrf = 14;
-pull-mlen = 1;
-
-inst-insert_before(pull);
+ exec_list list =
+UNIFORM_PULL_CONSTANT_LOAD(dst, SURF_INDEX_FRAG_CONST_BUFFER,
+   (pull_index * 4)  ~15);
+ inst-insert_before(list);
 
 inst-src[i].file = GRF;
 inst-src[i].reg = dst.reg;
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index b47b0d0..40cc785 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -290,6 +290,9 @@ public:
   fs_inst *end,
   fs_reg reg);
 
+   exec_list UNIFORM_PULL_CONSTANT_LOAD(fs_reg dst,
+unsigned surf_index,
+unsigned offset);
exec_list VARYING_PULL_CONSTANT_LOAD(fs_reg dst, fs_reg surf_index,
 fs_reg offset);
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index e70d6bf..57895d9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -571,36 +571,13 @@ fs_visitor::visit(ir_expression *ir)
*/
   ir_constant *uniform_block = ir-operands[0]-as_constant();
   ir_constant *const_offset = ir-operands[1]-as_constant();
-  fs_reg surf_index = 
fs_reg((unsigned)SURF_INDEX_WM_UBO(uniform_block-value.u[0]));
+  unsigned surf_index = SURF_INDEX_WM_UBO(uniform_block-value.u[0]);
   if (const_offset) {
  fs_reg packed_consts = fs_reg(this, glsl_type::float_type);
  packed_consts.type = result.type;
 
- if (intel-gen = 7) {
-fs_reg const_offset_reg = fs_reg(const_offset-value.u[0] / 16);
-fs_reg payload = fs_reg(this, glsl_type::uint_type);
-struct brw_reg g0 = 

Re: [Mesa-dev] [PATCH] glxinfo: add support for creating/querying core-profile contexts (v2)

2013-01-12 Thread Dave Airlie
On Sun, Jan 13, 2013 at 8:16 AM, Kaelyn Uhrain kaelyn.al...@gmail.com wrote:
 Hi Dave,

 I just tried out the patch to glxinfo on two of my Gentoo systems and
 get the following error:

 [xcb] Unknown sequence number while processing queue
 [xcb] Most likely this is a multi-threaded client and XInitThreads has
 not been called
 [xcb] Aborting, sorry about that.
 glxinfo: 
 /var/tmp/portage/x11-libs/libX11-1.5.0/work/libX11-1.5.0/src/xcb_io.c:273:
 poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
 Aborted

Thanks for that, I've seen it on another box here alright, though not
on my main machine,

I'll add the XSync though it seems unnecessary, must be missing something else.

will post a new version now.

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


[Mesa-dev] [PATCH] glxinfo: add support for creating/querying core-profile contexts (v2.1)

2013-01-12 Thread Dave Airlie
From: Brian Paul bri...@vmware.com

[airlied: Based on Brian's patch, I've fixed it up to always report a non-core
and core profile, after each other, and dropped the -c flag as its redunant
now]

The -c flag says to try to create a core profile (no legacy features)
using glXCreateContextAttribsARB().  A core profile may advertise a
different set of extensions than a compatibility profile (though,
the only difference with NVIDIA's driver is the presence of
GL_ARB_compatibility).  Also note that extensions need to be queried
one at a time with glGetStringi().

Be more careful with creating direct vs. indirect contexts.  If
we're trying to get a direct context, don't immediately settle for
indirect.  Try indirect only after failing to get direct.

xsync workaround from Kaelyn Uhrain
v2.1: add xsync to stop wierd xcb bug, drop [-c]

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/xdemos/glxinfo.c | 565 +--
 1 file changed, 457 insertions(+), 108 deletions(-)

diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index 38bd384..c1ecdfd 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -29,6 +29,7 @@
  *  -b only print ID of best visual on screen 0
  *  -i use indirect rendering connection only
  *  -l print interesting OpenGL limits (added 5 Sep 2002)
+ *  -c request a core profile rendering context
  *
  * Brian Paul  26 January 2000
  */
@@ -62,6 +63,8 @@
 #define GLX_COLOR_INDEX_BIT0x0002
 #endif
 
+#define ELEMENTS(array) (sizeof(array) / sizeof(array[0]))
+
 typedef enum
 {
Normal,
@@ -108,6 +111,43 @@ struct visual_attribs
 };
 

+/** list of known OpenGL versions */
+static struct { int major, minor; } gl_versions[] = {
+   {1, 0},
+   {1, 1},
+   {1, 2},
+   {1, 3},
+   {1, 4},
+   {1, 5},
+   {2, 0},
+   {2, 1},
+   {3, 0},
+   {3, 1},
+   {3, 2},
+   {3, 3},
+   {4, 0},
+   {4, 1},
+   {4, 2},
+   {4, 3},
+   {0, 0} /* end of list */
+};
+
+#define NUM_GL_VERSIONS ELEMENTS(gl_versions)
+
+
+/**
+ * GL Error checking/warning.
+ */
+static void
+CheckError(int line)
+{
+   int n;
+   n = glGetError();
+   if (n)
+  printf(Warning: GL error 0x%x at line %d\n, n, line);
+}
+
+
 /*
  * qsort callback for string comparison.
  */
@@ -219,6 +259,45 @@ print_extension_list(const char *ext, Bool singleLine)
 }
 
 
+/**
+ * Get list of OpenGL extensions using core profile's glGetStringi().
+ */
+static char *
+build_core_profile_extension_list(void)
+{
+   GLint i, n, totalLen;
+   char *buffer;
+   static PFNGLGETSTRINGIPROC glGetStringi_func = NULL;
+
+   if (!glGetStringi_func) {
+  glGetStringi_func = (PFNGLGETSTRINGIPROC)
+ glXGetProcAddressARB((GLubyte *) glGetStringi);
+   }
+
+   glGetIntegerv(GL_NUM_EXTENSIONS, n);
+
+   /* compute totalLen */
+   totalLen = 0;
+   for (i = 0; i  n; i++) {
+  const char *ext = (const char *) glGetStringi_func(GL_EXTENSIONS, i);
+  totalLen += strlen(ext) + 1; /* plus a space */
+   }
+
+   buffer = malloc(totalLen);
+   if (buffer) {
+  int pos = 0;
+  for (i = 0; i  n; i++) {
+ const char *ext = (const char *) glGetStringi_func(GL_EXTENSIONS, i);
+ strcpy(buffer + pos, ext);
+ pos += strlen(ext);
+ buffer[pos++] = ' ';
+  }
+   }
+   return buffer;
+}
+
+
+
 static void
 print_display_info(Display *dpy)
 {
@@ -373,7 +452,7 @@ extension_supported(const char *ext, const char 
*extensionsList)
  * Print interesting OpenGL implementation limits.
  */
 static void
-print_limits(const char *extensions)
+print_limits(const char *extensions, const char *oglstring)
 {
struct token_name {
   GLuint count;
@@ -436,7 +515,7 @@ print_limits(const char *extensions)
};
GLint i, max[2];
 
-   printf(OpenGL limits:\n);
+   printf(%s limits:\n, oglstring);
for (i = 0; limits[i].count; i++) {
   if (!limits[i].extension ||
   extension_supported(limits[i].extension, extensions)) {
@@ -480,10 +559,249 @@ print_limits(const char *extensions)
 }
 
 
-static void
-print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, 
Bool singleLine)
+struct bit_info
+{
+   int bit;
+   const char *name;
+};
+
+
+/**
+ * Return string representation for bits in a bitmask.
+ */
+static const char *
+bitmask_to_string(const struct bit_info bits[], int numBits, int mask)
+{
+   static char buffer[256], *p;
+   int i;
+
+   strcpy(buffer, (none));
+   p = buffer;
+   for (i = 0; i  numBits; i++) {
+  if (mask  bits[i].bit) {
+ if (p  buffer)
+*p++ = ',';
+ strcpy(p, bits[i].name);
+ p += strlen(bits[i].name);
+  }
+   }
+
+   return buffer;
+}
+
+/**
+ * Return string representation for the bitmask returned by
+ * GL_CONTEXT_PROFILE_MASK (OpenGL 3.2 or later).
+ */
+static const char *
+profile_mask_string(int mask)
+{
+   const static struct bit_info bits[] = {
+#ifdef 

Re: [Mesa-dev] thread safe llvmpipe

2013-01-12 Thread Jose Fonseca
That work has been merged (w/ LLVM 3.1 and MC-JIT support), however it's quite 
likely that's there are still race conditions, as nobody has been pursuing 
llvmpipe thread-safety so far. 

Jose 

- Original Message -

 Last year end of march i remember there was a discusssion about the
 thread safety in llvmpipe.
 It seems that llvmpipe was not thread safe since the underlying LLVM
 contexts were shared, but there was a branch mentioned that fixes
 this issue and that was planned to be merged to the mainline in the
 future.

 When working with the latest mesa version i currently still notice
 that llvmpipe is currently not thread safe - so i assume that this
 changes that bring separated LLVM context handling have not been
 submitted to the main line so far.
 Any new information available concerning this topic?
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/4] llvmpipe: trivial code and comment cleanup.

2013-01-12 Thread sroland
From: Roland Scheidegger srol...@vmware.com

---
 src/gallium/drivers/llvmpipe/lp_state_fs.c |   26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 3eae162..83b902d 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1010,7 +1010,7 @@ lp_blend_type_from_format_desc(const struct 
util_format_description *format_desc
 
 
 /**
- * Scale a normalised value from src_bits to dst_bits
+ * Scale a normalized value from src_bits to dst_bits
  */
 static INLINE LLVMValueRef
 scale_bits(struct gallivm_state *gallivm,
@@ -1047,7 +1047,7 @@ scale_bits(struct gallivm_state *gallivm,
 
  result = LLVMBuildOr(builder, result, lower, );
   } else if (db  src_bits) {
- /* Need to repeatedely copy src bits to fill remainder in dst */
+ /* Need to repeatedly copy src bits to fill remainder in dst */
  unsigned n;
 
  for (n = src_bits; n  dst_bits; n *= 2) {
@@ -1213,7 +1213,7 @@ convert_from_blend_type(struct gallivm_state *gallivm,
   }
}
 
-   /* No bit arithmitic to do */
+   /* No bit arithmetic to do */
if (!is_arith) {
   return;
}
@@ -1578,6 +1578,7 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
 unsigned pixels = block_size / src_count;
 unsigned channels = pad_inline ? TGSI_NUM_CHANNELS : dst_channels;
 unsigned alpha_span = 1;
+LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
 
 /* Check if we need 2 src_alphas for our shuffles */
 if (pixels  alpha_type.length) {
@@ -1585,8 +1586,15 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
 }
 
 /* Broadcast alpha across all channels, e.g. a1a2 to 
a1a1a1a1a2a2a2a2 */
+for (j = 0; j  row_type.length; ++j) {
+   if (j  pixels * channels) {
+  shuffles[j] = lp_build_const_int32(gallivm, j / channels);
+   } else {
+  shuffles[j] = 
LLVMGetUndef(LLVMInt32TypeInContext(gallivm-context));
+   }
+}
+
 for (i = 0; i  src_count; ++i) {
-   LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
unsigned idx1 = i, idx2 = i;
 
if (alpha_span  1){
@@ -1594,14 +1602,6 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
   idx2 = idx1 + 1;
}
 
-   for (j = 0; j  row_type.length; ++j) {
-  if (j  pixels * channels) {
- shuffles[j] = lp_build_const_int32(gallivm, j / channels);
-  } else {
- shuffles[j] = 
LLVMGetUndef(LLVMInt32TypeInContext(gallivm-context));
-  }
-   }
-
src_alpha[i] = LLVMBuildShuffleVector(builder,
  src_alpha[idx1],
  src_alpha[idx2],
@@ -2685,8 +2685,6 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
 
 
 
-
-
 void
 llvmpipe_init_fs_funcs(struct llvmpipe_context *llvmpipe)
 {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 1/4] llvmpipe: fix using wrong format with MRT in blend code

2013-01-12 Thread sroland
From: Roland Scheidegger srol...@vmware.com

We were passing in the rt index however this was always 0 for non-independent
blend case. (The format was only actually used to decide if the color mask
covered all channels so this went unnoticed and was discovered by accident.)
Additionally, there was a second problem because we do fixups in the key based
on color buffer format we cannot use non-independent blend anyway as the fixed
up values would never get used.
So always turn non-independent blending into independent.
---
 src/gallium/drivers/llvmpipe/lp_bld_blend.h |2 +-
 src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c |6 ++---
 src/gallium/drivers/llvmpipe/lp_state_fs.c  |   27 ++-
 src/gallium/drivers/llvmpipe/lp_test_blend.c|2 +-
 4 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend.h 
b/src/gallium/drivers/llvmpipe/lp_bld_blend.h
index 0a1cea1..3a3be81 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend.h
@@ -56,7 +56,7 @@ lp_build_blend(struct lp_build_context *bld,
 LLVMValueRef
 lp_build_blend_aos(struct gallivm_state *gallivm,
const struct pipe_blend_state *blend,
-   const enum pipe_format *cbuf_format,
+   const enum pipe_format cbuf_format,
struct lp_type type,
unsigned rt,
LLVMValueRef src,
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c 
b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
index 641c253..65f66e0 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
@@ -266,7 +266,7 @@ lp_build_blend_factor(struct lp_build_blend_aos_context 
*bld,
  * @param blend the blend state of the shader variant
  * @param cbuf_format   format of the colour buffer
  * @param type  data type of the pixel vector
- * @param rtrt number
+ * @param rtrender target index
  * @param src   blend src
  * @param dst   blend dst
  * @param mask  optional mask to apply to the blending result
@@ -278,7 +278,7 @@ lp_build_blend_factor(struct lp_build_blend_aos_context 
*bld,
 LLVMValueRef
 lp_build_blend_aos(struct gallivm_state *gallivm,
const struct pipe_blend_state *blend,
-   const enum pipe_format *cbuf_format,
+   const enum pipe_format cbuf_format,
struct lp_type type,
unsigned rt,
LLVMValueRef src,
@@ -298,7 +298,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
unsigned alpha_swizzle = UTIL_FORMAT_SWIZZLE_NONE;
unsigned i;
 
-   desc = util_format_description(cbuf_format[rt]);
+   desc = util_format_description(cbuf_format);
 
/* Setup build context */
memset(bld, 0, sizeof bld);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 5a8351b..3eae162 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1645,12 +1645,21 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
/*
 * Blending
 */
+   /* XXX this is broken for RGB8 formats -
+* they get expanded from 12 to 16 elements (to include alpha)
+* by convert_to_blend_type then reduced to 15 instead of 12
+* by convert_from_blend_type (a simple fix though breaks A8...).
+* R16G16B16 also crashes differently however something going wrong
+* inside llvm handling npot vector sizes seemingly.
+* It seems some cleanup could be done here (like skipping conversion/blend
+* when not needed).
+*/
convert_to_blend_type(gallivm, out_format_desc, dst_type, row_type, dst, 
src_count);
 
for (i = 0; i  src_count; ++i) {
   dst[i] = lp_build_blend_aos(gallivm,
   variant-key.blend,
-  variant-key.cbuf_format,
+  out_format,
   row_type,
   rt,
   src[i],
@@ -1999,7 +2008,6 @@ generate_fragment(struct llvmpipe_context *lp,
   LLVMValueRef color_ptr;
   LLVMValueRef stride;
   LLVMValueRef index = lp_build_const_int32(gallivm, cbuf);
-  unsigned rt = key-blend.independent_blend_enable ? cbuf : 0;
 
   boolean do_branch = ((key-depth.enabled
 || key-stencil[0].enabled
@@ -2016,7 +2024,7 @@ generate_fragment(struct llvmpipe_context *lp,
  LLVMBuildGEP(builder, stride_ptr, index, 1, ),
  );
 
-  generate_unswizzled_blend(gallivm, rt, variant, key-cbuf_format[cbuf],
+  generate_unswizzled_blend(gallivm, cbuf, variant, key-cbuf_format[cbuf],
 num_fs, fs_type, 

[Mesa-dev] [PATCH 3/4] llvmpipe: more fixes for integer color buffers

2013-01-12 Thread sroland
From: Roland Scheidegger srol...@vmware.com

Cast back the fake floats to ints, and make sure we don't try to do scaling
in format conversion (which only makes sense with normalized values).
Also need to disable blending and alpha test (as per spec) for such buffers.
This makes fbo-blending from the piglit ext_texture_integer tests work for most
formats (some crash, and the luminance and intensity variants have the GB or
GBA channels respectively wrong).
---
 src/gallium/drivers/llvmpipe/lp_state_fs.c |   42 ++--
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 83b902d..cf936d0 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1143,7 +1143,10 @@ convert_to_blend_type(struct gallivm_state *gallivm,
  );
 
  /* Scale bits */
- chans[j] = scale_bits(gallivm, src_fmt-channel[j].size, 
blend_type.width, chans[j], src_type);
+ if (src_type.norm) {
+chans[j] = scale_bits(gallivm, src_fmt-channel[j].size,
+  blend_type.width, chans[j], src_type);
+ }
 
  /* Insert bits into correct position */
  chans[j] = LLVMBuildShl(builder,
@@ -1250,7 +1253,10 @@ convert_from_blend_type(struct gallivm_state *gallivm,
  );
 
  /* Scale down bits */
- chans[j] = scale_bits(gallivm, blend_type.width, 
src_fmt-channel[j].size, chans[j], src_type);
+ if (src_type.norm) {
+chans[j] = scale_bits(gallivm, blend_type.width,
+  src_fmt-channel[j].size, chans[j], 
src_type);
+ }
 
  /* Insert bits */
  chans[j] = LLVMBuildShl(builder,
@@ -1438,6 +1444,25 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
   }
}
 
+   if (util_format_is_pure_integer(out_format)) {
+  /*
+   * In this case fs_type was really ints or uints disguised as floats,
+   * fix that up now.
+   */
+  fs_type.floating = 0;
+  fs_type.sign = dst_type.sign;
+  for (i = 0; i  num_fs; ++i) {
+ for (j = 0; j  dst_channels; ++j) {
+fs_src[i][j] = LLVMBuildBitCast(builder, fs_src[i][j],
+lp_build_vec_type(gallivm, 
fs_type), );
+ }
+ if (dst_channels == 3  !has_alpha) {
+fs_src[i][3] = LLVMBuildBitCast(builder, fs_src[i][3],
+lp_build_vec_type(gallivm, 
fs_type), );
+ }
+  }
+   }
+
 
/*
 * Pixel twiddle from fragment shader order to memory order
@@ -2498,7 +2523,11 @@ make_variant_key(struct llvmpipe_context *lp,
   }
}
 
-   key-alpha.enabled = lp-depth_stencil-alpha.enabled;
+   /* alpha test only applies if render buffer 0 is non-integer (or does not 
exist) */
+   if (!lp-framebuffer.nr_cbufs ||
+   !util_format_is_pure_integer(lp-framebuffer.cbufs[0]-format)) {
+  key-alpha.enabled = lp-depth_stencil-alpha.enabled;
+   }
if(key-alpha.enabled)
   key-alpha.func = lp-depth_stencil-alpha.func;
/* alpha.ref_value is passed in jit_context */
@@ -2539,6 +2568,13 @@ make_variant_key(struct llvmpipe_context *lp,
   blend_rt-colormask = util_format_colormask(format_desc);
 
   /*
+   * Disable blend for integer formats.
+   */
+  if (util_format_is_pure_integer(format)) {
+ blend_rt-blend_enable = 0;
+  }
+
+  /*
* Our swizzled render tiles always have an alpha channel, but the linear
* render target format often does not, so force here the dst alpha to be
* one.
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 4/4] llvmpipe: turn on integer texture support

2013-01-12 Thread sroland
From: Roland Scheidegger srol...@vmware.com

Now that things mostly seem to work enable those formats.
Some formats cause crashes (notably RGB8 variants) so switch these off
(these crashes are not specific to INT/UINT variants but the state tracker
doesn't use them for UNORM etc. formats so it went unnoticed so far).
---
 src/gallium/drivers/llvmpipe/lp_screen.c |   22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index b99e617..66a84c0 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -334,6 +334,20 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
 
   if (!format_desc-is_array  !format_desc-is_bitmask)
  return FALSE;
+
+  /*
+   * XXX refuse formats known to crash in generate_unswizzled_blend().
+   * These include all 3-channel 24bit RGB8 variants, plus 48bit
+   * (except those using floats) 3-channel RGB16 variants (the latter
+   * seems to be more of a llvm bug though).
+   * The mesa state tracker only seems to use these for SINT/UINT formats.
+   */
+  if (format_desc-is_array  format_desc-nr_channels == 3) {
+ if (format_desc-block.bits == 24 || (format_desc-block.bits == 48 
+   !util_format_is_float(format))) {
+return FALSE;
+ }
+  }
}
 
if (bind  PIPE_BIND_DISPLAY_TARGET) {
@@ -358,14 +372,10 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
}
 
/*
-* Everything can be supported by u_format.
+* Everything can be supported by u_format
+* (those without fetch_rgba_float might be not but shouldn't hit that)
 */
 
-   if (format_desc-colorspace != UTIL_FORMAT_COLORSPACE_ZS 
-   !format_desc-fetch_rgba_float) {
-  return FALSE;
-   }
-
return TRUE;
 }
 
-- 
1.7.9.5

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


[Mesa-dev] [Bug 59304] New: Meta Bug for regressions caused by automake conversion

2013-01-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59304

  Priority: medium
Bug ID: 59304
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: Meta Bug for regressions caused by automake conversion
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: tstel...@gmail.com
  Hardware: Other
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

This bug is for tracking all the outstanding regressions from the recent
automake conversion.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 59304] Meta Bug for regressions caused by automake conversion

2013-01-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59304

Tom Stellard tstel...@gmail.com changed:

   What|Removed |Added

 Depends on||59238

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 59238] many new symbols after recent automake work

2013-01-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59238

Tom Stellard tstel...@gmail.com changed:

   What|Removed |Added

 Blocks||59304

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 59304] Meta Bug for regressions caused by automake conversion

2013-01-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59304

Tom Stellard tstel...@gmail.com changed:

   What|Removed |Added

 Depends on||59282

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 00/18] GLES3 changes for readpix/teximage/FBO

2013-01-12 Thread Jordan Justen
v2:
 * Note that I am still relying on patch NAK'ed by idr to pass gles3-gtf
   - [18/18] fbobject: add additional fbo completeness checks for GLES
 * Six reviewed patches were pushed to master
 * Fix various v1 concerns:
   - Drop changes related to int vs. non-int readpix
   - Drop changes to i965 TexImage
   - Drop int=ubyte clamp change
 * Implementation format/type: updated to return format/type
   that better matches the current color read buffer
   - [17/18] framebuffer: update allowed implementation format/type
 * Fix patch partitioning issue with teximage (rb_internal_format
   variable declared in patch after first usage.)
 * _mesa_get_read_renderbuffer = _mesa_get_read_renderbuffer_for_format

v1:
 * various 2101010 texture tweaks
 * integer/signed-int/unsigned-int texture tweaks
 * readpix/teximage/copyteximage ES3 error checks
 * additional FBO completeness checks for GLES
 * tested with i965+gen7
 * crash=pass: gles3-gtf/packed_pixels/packed_pixels
 * crash=pass: gles3-gtf/packed_pixels/packed_pixels_pbo
 * crash=pass: gles3-gtf/packed_pixels/packed_pixels_pixelstore
 * pass=fail: gles3-gtf/half_float/half_float_textures
   - suspect test mismatch with spec
 * no change: piglit/quick-driver

Jordan Justen (16):
  fbobject: add VERBOSE=api message for check framebuffer status
  fbobject: add VERBOSE=api message for renderbuffer storage
  fbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on ES/Core
  framebuffer: add _mesa_get_read_renderbuffer
  copyteximage: update signed vs. unsigned format matching
  copyteximage: make sure is_srgb(src) == is_srgb(dst)
  copyteximage: Use Driver's AllocTextureImageBuffer instead of
TexImage
  copyteximage: update error checking for GLES3
  readpix: add error checking for GLES3
  glformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3
  pack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV case
  readpix: check FBO completeness before trying to access the
read-buffer
  extensions: enable EXT_color_buffer_float for ES2/ES3
  readpix: allow implementation format/type
  framebuffer: update allowed implementation format/type
  fbobject: add additional fbo completeness checks for GLES

Matt Turner (2):
  glformats: add _mesa_es3_error_check_format_and_type
  teximage: use _mesa_es3_error_check_format_and_type for GLES3

 src/mesa/main/extensions.c  |1 +
 src/mesa/main/fbobject.c|   96 --
 src/mesa/main/framebuffer.c |   47 -
 src/mesa/main/framebuffer.h |5 +
 src/mesa/main/glformats.c   |  447 +++
 src/mesa/main/glformats.h   |5 +
 src/mesa/main/pack.c|   12 +-
 src/mesa/main/readpix.c |   83 +++-
 src/mesa/main/teximage.c|  125 ++--
 9 files changed, 777 insertions(+), 44 deletions(-)

-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 01/18] fbobject: add VERBOSE=api message for check framebuffer status

2013-01-12 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/fbobject.c |4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index b991c76..15e8f10 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1919,6 +1919,10 @@ _mesa_CheckFramebufferStatus(GLenum target)
 
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
 
+   if (MESA_VERBOSE  VERBOSE_API)
+  _mesa_debug(ctx, glCheckFramebufferStatus(%s)\n,
+  _mesa_lookup_enum_by_nr(target));
+
buffer = get_framebuffer_target(ctx, target);
if (!buffer) {
   _mesa_error(ctx, GL_INVALID_ENUM, glCheckFramebufferStatus(target));
-- 
1.7.10.4

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



[Mesa-dev] [PATCH v2 02/18] fbobject: add VERBOSE=api message for renderbuffer storage

2013-01-12 Thread Jordan Justen
Add API debug trace message for:
 * glRenderbufferStorage
 * glRenderbufferStorageMultisample

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/fbobject.c |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 15e8f10..c2be3ff 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1393,13 +1393,28 @@ renderbuffer_storage(GLenum target, GLenum 
internalFormat,
  GLsizei width, GLsizei height, GLsizei samples)
 {
const char *func = samples == NO_SAMPLES ?
-  glRenderbufferStorage : RenderbufferStorageMultisample;
+  glRenderbufferStorage : glRenderbufferStorageMultisample;
struct gl_renderbuffer *rb;
GLenum baseFormat;
GET_CURRENT_CONTEXT(ctx);
 
ASSERT_OUTSIDE_BEGIN_END(ctx);
 
+   if (MESA_VERBOSE  VERBOSE_API) {
+  if (samples == NO_SAMPLES)
+ _mesa_debug(ctx, %s(%s, %s, %d, %d)\n,
+ func,
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(internalFormat),
+ width, height);
+  else
+ _mesa_debug(ctx, %s(%s, %s, %d, %d, %d)\n,
+ func,
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(internalFormat),
+ width, height, samples);
+   }
+
if (target != GL_RENDERBUFFER_EXT) {
   _mesa_error(ctx, GL_INVALID_ENUM, %s(target), func);
   return;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 05/18] teximage: use _mesa_es3_error_check_format_and_type for GLES3

2013-01-12 Thread Jordan Justen
From: Matt Turner matts...@gmail.com

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/teximage.c |   19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7d3abb7..d87808d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1893,23 +1893,30 @@ texture_error_check( struct gl_context *ctx,
 * requires GL_OES_texture_float) are filtered elsewhere.
 */
 
-   if (_mesa_is_gles(ctx)  !_mesa_is_gles3(ctx)) {
-  if (format != internalFormat) {
+   if (_mesa_is_gles(ctx)) {
+  if (_mesa_is_gles3(ctx)) {
+ err = _mesa_es3_error_check_format_and_type(format, type,
+ internalFormat,
+ dimensions);
+  } else {
+ if (format != internalFormat) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
  glTexImage%dD(format = %s, internalFormat = %s),
  dimensions,
  _mesa_lookup_enum_by_nr(format),
  _mesa_lookup_enum_by_nr(internalFormat));
  return GL_TRUE;
-  }
+ }
 
-  err = _mesa_es_error_check_format_and_type(format, type, dimensions);
+ err = _mesa_es_error_check_format_and_type(format, type, dimensions);
+  }
   if (err != GL_NO_ERROR) {
  _mesa_error(ctx, err,
- glTexImage%dD(format = %s, type = %s),
+ glTexImage%dD(format = %s, type = %s, internalFormat = 
%s),
  dimensions,
  _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(type));
+ _mesa_lookup_enum_by_nr(type),
+ _mesa_lookup_enum_by_nr(internalFormat));
  return GL_TRUE;
   }
}
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 04/18] glformats: add _mesa_es3_error_check_format_and_type

2013-01-12 Thread Jordan Justen
From: Matt Turner matts...@gmail.com

This function checks for ES3 compatible
format/type/internalFormat/dimension combinations.

[jordan.l.jus...@intel.com: additional tweaks for gles3-gtf]
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/glformats.c |  439 +
 src/mesa/main/glformats.h |5 +
 2 files changed, 444 insertions(+)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 74d9242..342af6d 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1680,3 +1680,442 @@ _mesa_es_error_check_format_and_type(GLenum format, 
GLenum type,
 
return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION;
 }
+
+
+/**
+ * Do error checking of format/type combinations for OpenGL ES 3
+ * glTex[Sub]Image.
+ * \return error code, or GL_NO_ERROR.
+ */
+GLenum
+_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
+  GLenum internalFormat,
+  unsigned dimensions)
+{
+   GLboolean type_valid = GL_TRUE;
+
+   switch (format) {
+   case GL_RGBA:
+  switch (type) {
+  case GL_UNSIGNED_BYTE:
+ switch (internalFormat) {
+ case GL_RGBA:
+ case GL_RGBA8:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ case GL_SRGB8_ALPHA8_EXT:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  case GL_BYTE:
+ if (internalFormat != GL_RGBA8_SNORM)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_UNSIGNED_SHORT_4_4_4_4:
+ switch (internalFormat) {
+ case GL_RGBA:
+ case GL_RGBA4:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  case GL_UNSIGNED_SHORT_5_5_5_1:
+ switch (internalFormat) {
+ case GL_RGBA:
+ case GL_RGB5_A1:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  case GL_UNSIGNED_INT_2_10_10_10_REV:
+ switch (internalFormat) {
+ case GL_RGBA: /* GL_EXT_texture_type_2_10_10_10_REV */
+ case GL_RGB10_A2:
+ case GL_RGB5_A1:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  case GL_HALF_FLOAT:
+ if (internalFormat != GL_RGBA16F)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_FLOAT:
+ switch (internalFormat) {
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  default:
+ return GL_INVALID_OPERATION;
+  }
+  break;
+
+   case GL_RGBA_INTEGER:
+  switch (type) {
+  case GL_UNSIGNED_BYTE:
+ if (internalFormat != GL_RGBA8UI)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_BYTE:
+ if (internalFormat != GL_RGBA8I)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_UNSIGNED_SHORT:
+ if (internalFormat != GL_RGBA16UI)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_SHORT:
+ if (internalFormat != GL_RGBA16I)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_UNSIGNED_INT:
+ if (internalFormat != GL_RGBA32UI)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_INT:
+ if (internalFormat != GL_RGBA32I)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (internalFormat != GL_RGB10_A2UI)
+return GL_INVALID_OPERATION;
+ break;
+
+  default:
+ return GL_INVALID_OPERATION;
+  }
+  break;
+
+   case GL_RGB:
+  switch (type) {
+  case GL_UNSIGNED_BYTE:
+ switch (internalFormat) {
+ case GL_RGB:
+ case GL_RGB8:
+ case GL_RGB565:
+ case GL_SRGB8:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  case GL_BYTE:
+ if (internalFormat != GL_RGB8_SNORM)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_UNSIGNED_SHORT_5_6_5:
+ switch (internalFormat) {
+ case GL_RGB:
+ case GL_RGB565:
+break;
+ default:
+return GL_INVALID_OPERATION;
+ }
+ break;
+
+  case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ if (internalFormat != GL_R11F_G11F_B10F)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_UNSIGNED_INT_5_9_9_9_REV:
+ if (internalFormat != GL_RGB9_E5)
+return GL_INVALID_OPERATION;
+ break;
+
+  case GL_HALF_FLOAT:
+ switch (internalFormat) {
+ case GL_RGB16F:
+ case GL_R11F_G11F_B10F:

[Mesa-dev] [PATCH v2 03/18] fbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on ES/Core

2013-01-12 Thread Jordan Justen
v2:
 * Only allow on GL Legacy contexts

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/fbobject.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index c2be3ff..a219398 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -511,7 +511,8 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, 
GLenum baseFormat)
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
case GL_ALPHA:
-  return ctx-Extensions.ARB_framebuffer_object;
+  return ctx-API == API_OPENGL_COMPAT 
+ ctx-Extensions.ARB_framebuffer_object;
case GL_RED:
case GL_RG:
   return ctx-Extensions.ARB_texture_rg;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 06/18] framebuffer: add _mesa_get_read_renderbuffer

2013-01-12 Thread Jordan Justen
This returns the current read renderbuffer for the specified
format type.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/framebuffer.c |   21 +
 src/mesa/main/framebuffer.h |5 +
 2 files changed, 26 insertions(+)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 13887f8..8cbfbd6 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -42,6 +42,7 @@
 #include framebuffer.h
 #include renderbuffer.h
 #include texobj.h
+#include glformats.h
 
 
 
@@ -899,6 +900,26 @@ _mesa_get_color_read_type(struct gl_context *ctx)
 
 
 /**
+ * Returns the read renderbuffer for the specified format.
+ */
+struct gl_renderbuffer *
+_mesa_get_read_renderbuffer_for_format(struct gl_context *ctx,
+   GLenum format)
+{
+   struct gl_framebuffer *rfb = ctx-ReadBuffer;
+
+   if (_mesa_is_color_format(format)) {
+  return rfb-Attachment[rfb-_ColorReadBufferIndex].Renderbuffer;
+   } else if (_mesa_is_depth_format(format) ||
+  _mesa_is_depthstencil_format(format)) {
+  return rfb-Attachment[BUFFER_DEPTH].Renderbuffer;
+   } else {
+  return rfb-Attachment[BUFFER_STENCIL].Renderbuffer;
+   }
+}
+
+
+/**
  * Print framebuffer info to stderr, for debugging.
  */
 void
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index ad53d8c..06db049 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -30,6 +30,7 @@
 
 struct gl_config;
 struct gl_context;
+struct gl_renderbuffer;
 
 extern struct gl_framebuffer *
 _mesa_create_framebuffer(const struct gl_config *visual);
@@ -96,6 +97,10 @@ _mesa_get_color_read_type(struct gl_context *ctx);
 extern GLenum
 _mesa_get_color_read_format(struct gl_context *ctx);
 
+extern struct gl_renderbuffer *
+_mesa_get_read_renderbuffer_for_format(struct gl_context *ctx,
+   GLenum format);
+
 extern void
 _mesa_print_framebuffer(const struct gl_framebuffer *fb);
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 08/18] copyteximage: make sure is_srgb(src) == is_srgb(dst)

2013-01-12 Thread Jordan Justen
v2:
 * Remove _EXT on enums
 * Remove compressed forms of sRGB from is_srgb_format
 * Add comment referencing GL Core spec

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/teximage.c |   32 
 1 file changed, 32 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d62fea6..ed52577 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2323,6 +2323,20 @@ texsubimage_error_check(struct gl_context *ctx, GLuint 
dimensions,
 }
 
 
+static bool
+is_srgb_format(GLenum internalFormat)
+{
+   switch (internalFormat) {
+   case GL_SRGB:
+   case GL_SRGB8:
+   case GL_SRGB_ALPHA:
+   case GL_SRGB8_ALPHA8:
+  return true;
+   default:
+  return false;
+   }
+}
+
 /**
  * Test glCopyTexImage[12]D() parameters for errors.
  * 
@@ -2426,6 +2440,24 @@ copytexture_error_check( struct gl_context *ctx, GLuint 
dimensions,
}
 
rb_internal_format = rb-InternalFormat;
+   if (is_srgb_format(internalFormat) != is_srgb_format(rb_internal_format)) {
+  /* Page 190 (page 211 of the PDF) in section 8.6 of the OpenGL 4.3
+   * Core Profile spec says:
+   *
+   * An INVALID_OPERATION error is generated under any of the
+   * following conditions:
+   *
+   * ...
+   *
+   * - if the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
+   *   for the framebuffer attachment corresponding to the read
+   *   buffer is SRGB and internalformat is not one of the sRGB
+   *   formats. in table 8.23.
+   */
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  glCopyTexImage%dD(srgb usage mismatch), dimensions);
+  return GL_TRUE;
+   }
 
if (!_mesa_source_buffer_exists(ctx, baseFormat)) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 11/18] readpix: add error checking for GLES3

2013-01-12 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/readpix.c |   56 +++
 1 file changed, 56 insertions(+)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 5b80e9a..d9c840e 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -674,12 +674,59 @@ _mesa_readpixels(struct gl_context *ctx,
 }
 
 
+static GLenum
+read_pixels_es3_error_check(GLenum format, GLenum type,
+const struct gl_renderbuffer *rb)
+{
+   const GLenum internalFormat = rb-InternalFormat;
+   const GLenum data_type = _mesa_get_format_datatype(rb-Format);
+   GLboolean is_unsigned_int = GL_FALSE;
+   GLboolean is_signed_int = GL_FALSE;
+
+   if (!_mesa_is_color_format(internalFormat)) {
+  return GL_INVALID_OPERATION;
+   }
+
+   is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat);
+   if (!is_unsigned_int) {
+  is_signed_int = _mesa_is_enum_format_signed_int(internalFormat);
+   }
+
+   switch (format) {
+   case GL_RGBA:
+  if (type == GL_UNSIGNED_BYTE  data_type == GL_UNSIGNED_NORMALIZED)
+ return GL_NO_ERROR;
+  if (internalFormat == GL_RGB10_A2 
+  type == GL_UNSIGNED_INT_2_10_10_10_REV)
+ return GL_NO_ERROR;
+  if (internalFormat == GL_RGB10_A2UI  type == GL_UNSIGNED_BYTE)
+ return GL_NO_ERROR;
+  break;
+   case GL_BGRA:
+  /* GL_EXT_read_format_bgra */
+  if (type == GL_UNSIGNED_BYTE ||
+  type == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+  type == GL_UNSIGNED_SHORT_1_5_5_5_REV)
+ return GL_NO_ERROR;
+  break;
+   case GL_RGBA_INTEGER:
+  if ((is_signed_int  type == GL_INT) ||
+  (is_unsigned_int  type == GL_UNSIGNED_INT))
+ return GL_NO_ERROR;
+  break;
+   }
+
+   return GL_INVALID_OPERATION;
+}
+
+
 void GLAPIENTRY
 _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
  GLenum format, GLenum type, GLsizei bufSize,
   GLvoid *pixels )
 {
GLenum err = GL_NO_ERROR;
+   struct gl_renderbuffer *rb;
 
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -699,6 +746,13 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
   return;
}
 
+   rb = _mesa_get_read_renderbuffer_for_format(ctx, format);
+   if (rb == NULL) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  glReadPixels(read buffer));
+  return;
+   }
+
/* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
 * combinations of format and type that can be used.
 *
@@ -715,6 +769,8 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
err = GL_INVALID_OPERATION;
 }
  }
+  } else {
+ err = read_pixels_es3_error_check(format, type, rb);
   }
 
   if (err == GL_NO_ERROR  (format == GL_DEPTH_COMPONENT
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 10/18] copyteximage: update error checking for GLES3

2013-01-12 Thread Jordan Justen
Changes based on GTF/gles3 conformance test suite.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/teximage.c |   38 +-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 12c9caf..eeb977e 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2361,6 +2361,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint 
dimensions,
  GLint width, GLint height, GLint border )
 {
GLint baseFormat;
+   GLint rb_base_format;
struct gl_renderbuffer *rb;
GLenum rb_internal_format;
 
@@ -2434,12 +2435,47 @@ copytexture_error_check( struct gl_context *ctx, GLuint 
dimensions,
 
baseFormat = _mesa_base_tex_format(ctx, internalFormat);
if (baseFormat  0) {
-  _mesa_error(ctx, GL_INVALID_VALUE,
+  _mesa_error(ctx, GL_INVALID_OPERATION,
   glCopyTexImage%dD(internalFormat), dimensions);
   return GL_TRUE;
}
 
rb_internal_format = rb-InternalFormat;
+   rb_base_format = _mesa_base_tex_format(ctx, rb-InternalFormat);
+   if (_mesa_is_color_format(internalFormat)) {
+  if (rb_base_format  0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ glCopyTexImage%dD(internalFormat), dimensions);
+ return GL_TRUE;
+  }
+   }
+
+   if (_mesa_is_gles(ctx)) {
+  bool valid = true;
+  if (_mesa_base_format_component_count(baseFormat) 
+  _mesa_base_format_component_count(rb_base_format)) {
+ valid = false;
+  }
+  if (baseFormat == GL_DEPTH_COMPONENT ||
+  baseFormat == GL_DEPTH_STENCIL ||
+  rb_base_format == GL_DEPTH_COMPONENT ||
+  rb_base_format == GL_DEPTH_STENCIL ||
+  ((baseFormat == GL_LUMINANCE_ALPHA ||
+baseFormat == GL_ALPHA) 
+   rb_base_format != GL_RGBA) ||
+  internalFormat == GL_RGB9_E5) {
+ valid = false;
+  }
+  if (internalFormat == GL_RGB9_E5) {
+ valid = false;
+  }
+  if (!valid) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ glCopyTexImage%dD(internalFormat), dimensions);
+ return GL_TRUE;
+  }
+   }
+
if (is_srgb_format(internalFormat) != is_srgb_format(rb_internal_format)) {
   /* Page 190 (page 211 of the PDF) in section 8.6 of the OpenGL 4.3
* Core Profile spec says:
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 09/18] copyteximage: Use Driver's AllocTextureImageBuffer instead of TexImage

2013-01-12 Thread Jordan Justen
Call Driver.AllocTextureImageBuffer rather than calling
Driver.TexImage with NULL data, format=GL_NONE and type=GL_NONE.

v2:
 * This replaces two i965 teximage changes in v1

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Cc: Eric Anholt e...@anholt.net
---
 src/mesa/main/teximage.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ed52577..12c9caf 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3397,9 +3397,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
 border, internalFormat, texFormat);
 
  /* Allocate texture memory (no pixel data yet) */
- ctx-Driver.TexImage(ctx, dims, texImage,
-  GL_NONE, GL_NONE,
-  NULL, ctx-Unpack);
+ ctx-Driver.AllocTextureImageBuffer(ctx, texImage);
 
  if (_mesa_clip_copytexsubimage(ctx, dstX, dstY, srcX, srcY,
 width, height)) {
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 12/18] glformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3

2013-01-12 Thread Jordan Justen
This format is allowed by the GL_EXT_texture_type_2_10_10_10_REV
extension.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/glformats.c |8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 342af6d..7969f77 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1289,6 +1289,10 @@ _mesa_error_check_format_and_type(const struct 
gl_context *ctx,
   ctx-Extensions.ARB_texture_rgb10_a2ui) {
  break; /* OK */
   }
+  if (type == GL_UNSIGNED_INT_2_10_10_10_REV  format == GL_RGB 
+  ctx-API == API_OPENGLES2) {
+ break; /* OK by GL_EXT_texture_type_2_10_10_10_REV */
+  }
   return GL_INVALID_OPERATION;
 
case GL_UNSIGNED_INT_24_8:
@@ -1402,6 +1406,10 @@ _mesa_error_check_format_and_type(const struct 
gl_context *ctx,
 case GL_UNSIGNED_SHORT_5_6_5:
 case GL_UNSIGNED_SHORT_5_6_5_REV:
return GL_NO_ERROR;
+case GL_UNSIGNED_INT_2_10_10_10_REV:
+   /* OK by GL_EXT_texture_type_2_10_10_10_REV */
+   return (ctx-API == API_OPENGLES2)
+  ? GL_NO_ERROR : GL_INVALID_ENUM;
 case GL_HALF_FLOAT:
return ctx-Extensions.ARB_half_float_pixel
   ? GL_NO_ERROR : GL_INVALID_ENUM;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 13/18] pack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV case

2013-01-12 Thread Jordan Justen
For floats, if GL_RGB is the source, then alpha should be set to
1.0F.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/pack.c |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 4f0caa7..d6a97b3 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -3641,7 +3641,11 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
rgba[i][rDst] = ((p  )  0x3ff) * rs;
rgba[i][gDst] = ((p  10)  0x3ff) * gs;
rgba[i][bDst] = ((p  20)  0x3ff) * bs;
-   rgba[i][aDst] = ((p  30)) * as;
+   if (aSrc  0) {
+  rgba[i][aDst] = 1.0F;
+   } else {
+  rgba[i][aDst] = (p  30) * as;
+   }
 }
  }
  else {
@@ -3652,7 +3656,11 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
rgba[i][rDst] = ((p  )  0x3ff) * rs;
rgba[i][gDst] = ((p  10)  0x3ff) * gs;
rgba[i][bDst] = ((p  20)  0x3ff) * bs;
-   rgba[i][aDst] = ((p  30)) * as;
+   if (aSrc  0) {
+  rgba[i][aDst] = 1.0F;
+   } else {
+  rgba[i][aDst] = (p  30) * as;
+   }
 }
  }
  break;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 15/18] extensions: enable EXT_color_buffer_float for ES2/ES3

2013-01-12 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/extensions.c |1 +
 src/mesa/main/fbobject.c   |   26 +-
 src/mesa/main/readpix.c|2 ++
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index c3c73fc..8461195 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -231,6 +231,7 @@ static const struct extension extension_table[] = {
{ GL_EXT_unpack_subimage, o(dummy_true),  
   ES2, 2011 },
{ GL_EXT_vertex_array_bgra,   o(EXT_vertex_array_bgra),   
GL, 2008 },
{ GL_EXT_vertex_array,o(dummy_true),  
GLL,1995 },
+   { GL_EXT_color_buffer_float,  o(dummy_true),  
ES2,2013 },
 
/* OES extensions */
{ GL_OES_blend_equation_separate, 
o(EXT_blend_equation_separate),  ES1,   2009 },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index a219398..abb9f34 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1217,21 +1217,27 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
  ctx-Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_R16F:
case GL_R32F:
-  return (_mesa_is_desktop_gl(ctx) 
- ctx-Extensions.ARB_texture_rg 
- ctx-Extensions.ARB_texture_float) ? GL_RED : 0;
+  return ((_mesa_is_desktop_gl(ctx) 
+   ctx-Extensions.ARB_texture_rg 
+   ctx-Extensions.ARB_texture_float) ||
+  (ctx-API == API_OPENGLES2) /* EXT_color_buffer_float */ )
+ ? GL_RED : 0;
case GL_RG16F:
case GL_RG32F:
-  return (_mesa_is_desktop_gl(ctx) 
- ctx-Extensions.ARB_texture_rg 
- ctx-Extensions.ARB_texture_float) ? GL_RG : 0;
+  return ((_mesa_is_desktop_gl(ctx) 
+   ctx-Extensions.ARB_texture_rg 
+   ctx-Extensions.ARB_texture_float) ||
+  (ctx-API == API_OPENGLES2) /* EXT_color_buffer_float */ )
+ ? GL_RG : 0;
case GL_RGB16F:
case GL_RGB32F:
   return (_mesa_is_desktop_gl(ctx)  ctx-Extensions.ARB_texture_float)
  ? GL_RGB : 0;
case GL_RGBA16F:
case GL_RGBA32F:
-  return (_mesa_is_desktop_gl(ctx)  ctx-Extensions.ARB_texture_float)
+  return ((_mesa_is_desktop_gl(ctx) 
+   ctx-Extensions.ARB_texture_float) ||
+  (ctx-API == API_OPENGLES2) /* EXT_color_buffer_float */ )
  ? GL_RGBA : 0;
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
@@ -1258,7 +1264,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
ctx-Extensions.EXT_texture_shared_exponent)
  ? GL_RGB : 0;
case GL_R11F_G11F_B10F:
-  return (_mesa_is_desktop_gl(ctx)  ctx-Extensions.EXT_packed_float)
+  return ((_mesa_is_desktop_gl(ctx)  ctx-Extensions.EXT_packed_float) ||
+  (ctx-API == API_OPENGLES2) /* EXT_color_buffer_float */ )
  ? GL_RGB : 0;
 
case GL_RGBA8UI_EXT:
@@ -1423,7 +1430,8 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
 
baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
if (baseFormat == 0) {
-  _mesa_error(ctx, GL_INVALID_ENUM, %s(internalFormat), func);
+  _mesa_error(ctx, GL_INVALID_ENUM, %s(internalFormat=%s),
+  func, _mesa_lookup_enum_by_nr(internalFormat));
   return;
}
 
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index cb4d02d..994e589 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -694,6 +694,8 @@ read_pixels_es3_error_check(GLenum format, GLenum type,
 
switch (format) {
case GL_RGBA:
+  if (type == GL_FLOAT  data_type == GL_FLOAT)
+ return GL_NO_ERROR; /* EXT_color_buffer_float */
   if (type == GL_UNSIGNED_BYTE  data_type == GL_UNSIGNED_NORMALIZED)
  return GL_NO_ERROR;
   if (internalFormat == GL_RGB10_A2 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 14/18] readpix: check FBO completeness before trying to access the read-buffer

2013-01-12 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/readpix.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index d9c840e..cb4d02d 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -746,6 +746,15 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
   return;
}
 
+   if (ctx-NewState)
+  _mesa_update_state(ctx);
+
+   if (ctx-ReadBuffer-_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+  _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+  glReadPixels(incomplete framebuffer) );
+  return;
+   }
+
rb = _mesa_get_read_renderbuffer_for_format(ctx, format);
if (rb == NULL) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
@@ -786,9 +795,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
   }
}
 
-   if (ctx-NewState)
-  _mesa_update_state(ctx);
-
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
   _mesa_error(ctx, err, glReadPixels(invalid format %s and/or type %s),
@@ -797,12 +803,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
   return;
}
 
-   if (ctx-ReadBuffer-_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-  _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
-  glReadPixels(incomplete framebuffer) );
-  return;
-   }
-
if (_mesa_is_user_fbo(ctx-ReadBuffer) 
ctx-ReadBuffer-Visual.samples  0) {
   _mesa_error(ctx, GL_INVALID_OPERATION, glReadPixels(multisample FBO));
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 16/18] readpix: allow implementation format/type

2013-01-12 Thread Jordan Justen
For GLES2/3 allow reading of pixels with format/type based on:
 * GL_IMPLEMENTATION_COLOR_READ_FORMAT
 * GL_IMPLEMENTATION_COLOR_READ_TYPE

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/readpix.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 994e589..6b07563 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -773,7 +773,12 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
 * combination is, and Mesa can handle anything valid.  Just work instead.
 */
if (_mesa_is_gles(ctx)) {
-  if (ctx-Version  30) {
+  if (ctx-API == API_OPENGLES2 
+  _mesa_is_color_format(format) 
+  _mesa_get_color_read_format(ctx) == format 
+  _mesa_get_color_read_type(ctx) == type) {
+ err = GL_NO_ERROR;
+  } else if (ctx-Version  30) {
  err = _mesa_es_error_check_format_and_type(format, type, 2);
  if (err == GL_NO_ERROR) {
 if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 17/18] framebuffer: update allowed implementation format/type

2013-01-12 Thread Jordan Justen
Allow additional format/type combinations based on the
color render buffer to fix failures with gles3-gtf.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/framebuffer.c |   26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 8cbfbd6..0597de2 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -871,13 +871,20 @@ _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum 
format)
 GLenum
 _mesa_get_color_read_format(struct gl_context *ctx)
 {
+   const GLenum data_type = _mesa_get_format_datatype(
+   ctx-ReadBuffer-_ColorReadBuffer-Format);
+
switch (ctx-ReadBuffer-_ColorReadBuffer-Format) {
case MESA_FORMAT_ARGB:
   return GL_BGRA;
case MESA_FORMAT_RGB565:
   return GL_BGR;
default:
-  return GL_RGBA;
+  if (data_type == GL_UNSIGNED_INT || data_type == GL_INT) {
+ return GL_RGBA_INTEGER;
+  } else {
+ return GL_RGBA;
+  }
}
 }
 
@@ -888,12 +895,25 @@ _mesa_get_color_read_format(struct gl_context *ctx)
 GLenum
 _mesa_get_color_read_type(struct gl_context *ctx)
 {
+   const GLenum data_type = _mesa_get_format_datatype(
+   ctx-ReadBuffer-_ColorReadBuffer-Format);
+
switch (ctx-ReadBuffer-_ColorReadBuffer-Format) {
-   case MESA_FORMAT_ARGB:
-  return GL_UNSIGNED_BYTE;
case MESA_FORMAT_RGB565:
   return GL_UNSIGNED_SHORT_5_6_5_REV;
default:
+  break;
+   }
+
+   switch (data_type) {
+   case GL_SIGNED_NORMALIZED:
+  return GL_BYTE;
+   case GL_UNSIGNED_INT:
+   case GL_INT:
+   case GL_FLOAT:
+  return data_type;
+   case GL_UNSIGNED_NORMALIZED:
+   default:
   return GL_UNSIGNED_BYTE;
}
 }
-- 
1.7.10.4

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


[Mesa-dev] [PATCH v2 18/18] fbobject: add additional fbo completeness checks for GLES

2013-01-12 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 src/mesa/main/fbobject.c |   46 +-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index abb9f34..f5e2971 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -523,6 +523,50 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, 
GLenum baseFormat)
 
 
 /**
+ * Is the given base format a legal format for a color renderbuffer?
+ */
+static GLboolean
+is_format_color_renderable(const struct gl_context *ctx, gl_format format, 
GLenum internalFormat)
+{
+   const GLenum baseFormat =
+  _mesa_get_format_base_format(format);
+   GLboolean valid;
+
+   valid = _mesa_is_legal_color_format(ctx, baseFormat);
+   if (!valid || _mesa_is_desktop_gl(ctx)) {
+  return valid;
+   }
+
+   /* Reject additional cases for GLES */
+   switch (internalFormat) {
+   case GL_RGBA8_SNORM:
+   case GL_RGB32F:
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   case GL_RGB16F:
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   case GL_RGB8_SNORM:
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   case GL_SRGB8:
+   case GL_RGB9_E5:
+   case GL_RG8_SNORM:
+   case GL_R8_SNORM:
+  return GL_FALSE;
+   default:
+  break;
+   }
+
+   if (format == MESA_FORMAT_ARGB2101010  internalFormat != GL_RGB10_A2) {
+  return GL_FALSE;
+   }
+
+   return GL_TRUE;
+}
+
+
+/**
  * Is the given base format a legal format for a depth/stencil renderbuffer?
  */
 static GLboolean
@@ -770,7 +814,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
  f = texImg-_BaseFormat;
  attFormat = texImg-TexFormat;
  numImages++;
- if (!_mesa_is_legal_color_format(ctx, f) 
+ if (!is_format_color_renderable(ctx, attFormat, 
texImg-InternalFormat) 
  !is_legal_depth_format(ctx, f)) {
 fb-_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
 fbo_incomplete(texture attachment incomplete, -1);
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH v2 03/18] fbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on ES/Core

2013-01-12 Thread Kenneth Graunke

On 01/12/2013 08:10 PM, Jordan Justen wrote:

v2:
  * Only allow on GL Legacy contexts

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
  src/mesa/main/fbobject.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index c2be3ff..a219398 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -511,7 +511,8 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, 
GLenum baseFormat)
 case GL_LUMINANCE_ALPHA:
 case GL_INTENSITY:
 case GL_ALPHA:
-  return ctx-Extensions.ARB_framebuffer_object;
+  return ctx-API == API_OPENGL_COMPAT 
+ ctx-Extensions.ARB_framebuffer_object;
 case GL_RED:
 case GL_RG:
return ctx-Extensions.ARB_texture_rg;


Could we get a spec citation for this?  I sure see a lot of references 
to these formats in the ES 3.0 spec, and it isn't immediately clear to 
me that they're gone.  (Though, they should be, and I definitely hope 
they are!)

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


[Mesa-dev] default texture buffer object

2013-01-12 Thread Dave Airlie
Hi,

so the gallium state tracker falls over with one of the TBO tests and
I wsa wondering what the correct solution is.

After the tests run, the test leaves the fragment shader bound, but
has deleted the texture object and the buffer object,
so we just have the ctx-Shared-DefaultTex[TEXTURE_BUFFER_INDEX],
however since this has no buffer object bound
the code falls over.

Now the docs say the results of sampling from an tbo with no buffer
object is undefined, but crashing isn't probably the right solution

The intel driver seems to deal with there being no backing BO by
binding an object at address 0 with w/h = 0.

Suggestions?

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


[Mesa-dev] [PATCH] st/mesa: fix crash with default TBO.

2013-01-12 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

(this is my hacky attempt at fixing the problem previously described,
maybe its correct).

The formats test triggers this once it finishes.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/mesa/state_tracker/st_atom_texture.c | 6 --
 src/mesa/state_tracker/st_cb_texture.c   | 9 +
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_texture.c 
b/src/mesa/state_tracker/st_atom_texture.c
index dba1d82..e6b0c9e 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -214,7 +214,9 @@ update_single_texture(struct st_context *st,
}
 
/* Determine the format of the texture sampler view */
-   st_view_format = stObj-pt-format;
+   st_view_format = 0;
+   if (stObj-pt)
+  st_view_format = stObj-pt-format;
 
{
   gl_format texFormat;
@@ -238,7 +240,7 @@ update_single_texture(struct st_context *st,
 firstImageFormat = st_mesa_format_to_pipe_format(linearFormat);
   }
 
-  if (firstImageFormat != stObj-pt-format)
+  if (firstImageFormat != st_view_format)
 st_view_format = firstImageFormat;
}
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index b5c1f1f..eccac68 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1329,6 +1329,15 @@ st_finalize_texture(struct gl_context *ctx,
if (tObj-Target == GL_TEXTURE_BUFFER) {
   struct st_buffer_object *st_obj = st_buffer_object(tObj-BufferObject);
 
+  if (!st_obj) {
+ pipe_resource_reference(stObj-pt, NULL);
+ pipe_sampler_view_release(st-pipe, stObj-sampler_view);
+ stObj-width0 = 0;
+ stObj-height0 = 0;
+ stObj-depth0 = 0;
+ return GL_TRUE;
+  }
+
   if (st_obj-buffer != stObj-pt) {
  pipe_resource_reference(stObj-pt, st_obj-buffer);
  pipe_sampler_view_release(st-pipe, stObj-sampler_view);
-- 
1.8.0.2

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