[Mesa-dev] [PATCH 4/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Fabio Pedretti
Patch from Debian package
---
 src/gallium/auxiliary/rtasm/rtasm_execmem.c | 2 +-
 src/gallium/include/pipe/p_config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c 
b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 3c4b048..edc1b66 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -38,7 +38,7 @@
 
 #include rtasm_execmem.h
 
-#if defined(PIPE_OS_BSD)
+#ifndef MAP_ANONYMOUS
 #define MAP_ANONYMOUS MAP_ANON
 #endif
 
diff --git a/src/gallium/include/pipe/p_config.h 
b/src/gallium/include/pipe/p_config.h
index 9bccf32..64acd02 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -190,7 +190,7 @@
 #define PIPE_OS_ANDROID
 #endif
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #define PIPE_OS_FREEBSD
 #define PIPE_OS_BSD
 #define PIPE_OS_UNIX
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 3/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Fabio Pedretti
From: Aurelien Jarno aure...@debian.org
From: Cyril Brulebois k...@debian.org

mesa fails to build on GNU/kFreeBSD, since some parts are not enabled.

Debian bug: http://bugs.debian.org/524690

Patch from Debian package
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a25047..e250734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,7 +425,7 @@ if test x$enable_asm = xyes; then
 case $host_cpu in
 i?86)
 case $host_os in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
 test x$enable_64bit = xyes  asm_arch=x86_64 || asm_arch=x86
 ;;
 gnu*)
@@ -435,7 +435,7 @@ if test x$enable_asm = xyes; then
 ;;
 x86_64|amd64)
 case $host_os in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
 test x$enable_32bit = xyes  asm_arch=x86 || asm_arch=x86_64
 ;;
 esac
@@ -974,7 +974,7 @@ if test x$enable_dri = xyes; then
 ;;
 esac
 ;;
-freebsd* | dragonfly* | *netbsd* | openbsd*)
+freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
 DEFINES=$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1
 DEFINES=$DEFINES -DHAVE_ALIAS
 
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 1/4] r600/compute: silence unused var warning

2013-11-05 Thread Fabio Pedretti
---
 src/gallium/drivers/r600/evergreen_compute.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
b/src/gallium/drivers/r600/evergreen_compute.c
index ea77f5e..ffdc5c3 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -392,7 +392,6 @@ static void compute_emit_cs(struct r600_context *ctx, const 
uint *block_layout,
const uint *grid_layout)
 {
struct radeon_winsys_cs *cs = ctx-b.rings.gfx.cs;
-   unsigned flush_flags = 0;
int i;
 
/* make sure that the gfx ring is only one active */
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 2/4] mesa: add aarch64 support

2013-11-05 Thread Fabio Pedretti
Patch from Ubuntu package
---
 src/mesa/main/compiler.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..65c4141 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -312,6 +312,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 defined(__hppa__) || defined(hpux) || \
 defined(__mips) || defined(_MIPS_ARCH) || \
 defined(__arm__) || \
+defined(__aarch64__) || \
 defined(__sh__) || defined(__m32r__) || \
 (defined(__sun)  defined(_IEEE_754)) || \
 defined(__alpha__)
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 1/4] r600/compute: silence unused var warning

2013-11-05 Thread Marek Olšák
Reviewed-by: Marek Olšák marek.ol...@amd.com

Marek

On Tue, Nov 5, 2013 at 12:49 PM, Fabio Pedretti fabio@libero.it wrote:
 ---
  src/gallium/drivers/r600/evergreen_compute.c | 1 -
  1 file changed, 1 deletion(-)

 diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
 b/src/gallium/drivers/r600/evergreen_compute.c
 index ea77f5e..ffdc5c3 100644
 --- a/src/gallium/drivers/r600/evergreen_compute.c
 +++ b/src/gallium/drivers/r600/evergreen_compute.c
 @@ -392,7 +392,6 @@ static void compute_emit_cs(struct r600_context *ctx, 
 const uint *block_layout,
 const uint *grid_layout)
  {
 struct radeon_winsys_cs *cs = ctx-b.rings.gfx.cs;
 -   unsigned flush_flags = 0;
 int i;

 /* make sure that the gfx ring is only one active */
 --
 1.8.3.2

 ___
 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 1/5] mesa: remove Alpha CPU checks

2013-11-05 Thread Aaron Watry
On Mon, Nov 4, 2013 at 7:04 PM, Matt Turner matts...@gmail.com wrote:
 On Mon, Nov 4, 2013 at 4:48 PM, Brian Paul bri...@vmware.com wrote:
 ---
  src/mesa/main/compiler.h |7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)

 diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
 index 61ce5db..2752ca8 100644
 --- a/src/mesa/main/compiler.h
 +++ b/src/mesa/main/compiler.h
 @@ -36,11 +36,7 @@

  #include assert.h
  #include ctype.h
 -#if defined(__alpha__)  defined(CCPML)
 -#include cpml.h /* use Compaq's Fast Math Library on Alpha */
 -#else
  #include math.h
 -#endif
  #include limits.h
  #include stdlib.h
  #include stdio.h
 @@ -317,8 +313,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  defined(__mips) || defined(_MIPS_ARCH) || \
  defined(__arm__) || \
  defined(__sh__) || defined(__m32r__) || \
 -(defined(__sun)  defined(_IEEE_754)) || \
 -defined(__alpha__)
 +(defined(__sun)  defined(_IEEE_754))
  #define USE_IEEE
  #define IEEE_ONE 0x3f80
  #endif
 --
 1.7.10.4

 I actually have an Alpha with an R300. I'd like this hunk to stay.
 CPML support... feel free to drop.

Agreed.  I've got a PWS 500a that I'm in the process of getting
running again, and I'd hate to lose support for it... but it'll be
running Gentoo, so feel free to drop the CPML bits.

--Aaron


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

On Mon, Nov 4, 2013 at 7:04 PM, Matt Turner matts...@gmail.com wrote:
 On Mon, Nov 4, 2013 at 4:48 PM, Brian Paul bri...@vmware.com wrote:
 ---
  src/mesa/main/compiler.h |7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)

 diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
 index 61ce5db..2752ca8 100644
 --- a/src/mesa/main/compiler.h
 +++ b/src/mesa/main/compiler.h
 @@ -36,11 +36,7 @@

  #include assert.h
  #include ctype.h
 -#if defined(__alpha__)  defined(CCPML)
 -#include cpml.h /* use Compaq's Fast Math Library on Alpha */
 -#else
  #include math.h
 -#endif
  #include limits.h
  #include stdlib.h
  #include stdio.h
 @@ -317,8 +313,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  defined(__mips) || defined(_MIPS_ARCH) || \
  defined(__arm__) || \
  defined(__sh__) || defined(__m32r__) || \
 -(defined(__sun)  defined(_IEEE_754)) || \
 -defined(__alpha__)
 +(defined(__sun)  defined(_IEEE_754))
  #define USE_IEEE
  #define IEEE_ONE 0x3f80
  #endif
 --
 1.7.10.4

 I actually have an Alpha with an R300. I'd like this hunk to stay.
 CPML support... feel free to drop.
 ___
 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 6/6] vbo: fix MSVC double-float conversion warnings

2013-11-05 Thread Jose Fonseca
Series looks good AFAICT.

Jose

- Original Message -
 ---
  src/mesa/vbo/vbo_attrib_tmp.h |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
 index 02c283d..bbc0205 100644
 --- a/src/mesa/vbo/vbo_attrib_tmp.h
 +++ b/src/mesa/vbo/vbo_attrib_tmp.h
 @@ -140,7 +140,7 @@ static inline float conv_i10_to_norm_float(const struct
 gl_context *ctx, int i10
 (ctx-API == API_OPENGL_CORE  ctx-Version = 42)) {
/* Equation 2.3 above. */
float f = ((float) val.x) / 511.0F;
 -  return MAX2(f, -1.0);
 +  return MAX2(f, -1.0f);
 } else {
/* Equation 2.2 above. */
return (2.0F * (float)val.x + 1.0F) * (1.0F  / 1023.0F);
 @@ -156,7 +156,7 @@ static inline float conv_i2_to_norm_float(const struct
 gl_context *ctx, int i2)
 (ctx-API == API_OPENGL_CORE  ctx-Version = 42)) {
/* Equation 2.3 above. */
float f = (float) val.x;
 -  return MAX2(f, -1.0);
 +  return MAX2(f, -1.0f);
 } else {
/* Equation 2.2 above. */
return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
 --
 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] mesa: Remove last BEOS checks

2013-11-05 Thread Brian Paul

On 11/04/2013 06:34 PM, Alexander von Gluck IV wrote:

* Goodbye BeOS, we hardly knew thee
* As BeOS was gcc2 only, there was little chance
   of this being useful.
* Doesn't effect Haiku in any meaningful way
---
  include/GL/gl.h  |8 
  scons/gallium.py |2 --
  2 files changed, 10 deletions(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index d0710ba..b484b96 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -36,10 +36,6 @@
   * Begin system-specific stuff.
   */

-#if defined(__BEOS__)
-#include stdlib.h /* to get some BeOS-isms */
-#endif
-
  #if defined(_WIN32)  !defined(__WIN32__)  !defined(__CYGWIN__)
  #define __WIN32__
  #endif
@@ -65,10 +61,6 @@
  #  define GLAPIENTRY
  #endif /* WIN32  !CYGWIN */

-#if (defined(__BEOS__)  defined(__POWERPC__))
-#  define PRAGMA_EXPORT_SUPPORTED  1
-#endif
-
  /*
   * WINDOWS: Include windows.h here to define APIENTRY.
   * It is also useful when applications include this file by
diff --git a/scons/gallium.py b/scons/gallium.py
index be3c3e7..ea8bacd 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -295,8 +295,6 @@ def generate(env):
  cppdefines += ['_DEBUG']
  if platform == 'windows':
  cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
-if platform == 'haiku':
-cppdefines += ['BEOS_THREADS']
  if env['embedded']:
  cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
  if env['texture_float']:



Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH 2/4] mesa: add aarch64 support

2013-11-05 Thread Brian Paul

On 11/05/2013 04:49 AM, Fabio Pedretti wrote:

Patch from Ubuntu package
---
  src/mesa/main/compiler.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..65c4141 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -312,6 +312,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  defined(__hppa__) || defined(hpux) || \
  defined(__mips) || defined(_MIPS_ARCH) || \
  defined(__arm__) || \
+defined(__aarch64__) || \
  defined(__sh__) || defined(__m32r__) || \
  (defined(__sun)  defined(_IEEE_754)) || \
  defined(__alpha__)



I believe that's Arm64, right?  If so, it could go on the same line as 
the __arm__ check.  That would follow the pattern of preceding HP and 
MIPS checks.  But not a big deal.


Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH 3/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Brian Paul

On 11/05/2013 04:49 AM, Fabio Pedretti wrote:

From: Aurelien Jarno aure...@debian.org
From: Cyril Brulebois k...@debian.org

mesa fails to build on GNU/kFreeBSD, since some parts are not enabled.

Debian bug: http://bugs.debian.org/524690

Patch from Debian package
---
  configure.ac | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a25047..e250734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,7 +425,7 @@ if test x$enable_asm = xyes; then
  case $host_cpu in
  i?86)
  case $host_os in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
  test x$enable_64bit = xyes  asm_arch=x86_64 || asm_arch=x86
  ;;
  gnu*)
@@ -435,7 +435,7 @@ if test x$enable_asm = xyes; then
  ;;
  x86_64|amd64)
  case $host_os in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
  test x$enable_32bit = xyes  asm_arch=x86 || asm_arch=x86_64
  ;;
  esac
@@ -974,7 +974,7 @@ if test x$enable_dri = xyes; then
  ;;
  esac
  ;;
-freebsd* | dragonfly* | *netbsd* | openbsd*)
+freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
  DEFINES=$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1
  DEFINES=$DEFINES -DHAVE_ALIAS




For the series:

Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH 2/4] mesa: add arm64 support

2013-11-05 Thread Brian Paul

On 11/05/2013 08:51 AM, Fabio Pedretti wrote:

Patch from Ubuntu package
---
  src/mesa/main/compiler.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..d7a52d2 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -311,7 +311,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  defined(ia64) || defined(__ia64__) || \
  defined(__hppa__) || defined(hpux) || \
  defined(__mips) || defined(_MIPS_ARCH) || \
-defined(__arm__) || \
+defined(__arm__) || defined(__aarch64__) || \
  defined(__sh__) || defined(__m32r__) || \
  (defined(__sun)  defined(_IEEE_754)) || \
  defined(__alpha__)



Reviewed-by: Brian Paul bri...@vmware.com

Thanks.

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


[Mesa-dev] R: Re: [PATCH 2/4] mesa: add aarch64 support

2013-11-05 Thread Fabio Pedretti
On 11/05/2013 04:49 AM, Fabio Pedretti wrote:
 Patch from Ubuntu package
 ---
   src/mesa/main/compiler.h | 1 +
   1 file changed, 1 insertion(+)

 diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
 index 2820913..65c4141 100644
 --- a/src/mesa/main/compiler.h
 +++ b/src/mesa/main/compiler.h
 @@ -312,6 +312,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
   defined(__hppa__) || defined(hpux) || \
   defined(__mips) || defined(_MIPS_ARCH) || \
   defined(__arm__) || \
 +defined(__aarch64__) || \
   defined(__sh__) || defined(__m32r__) || \
   (defined(__sun)  defined(_IEEE_754)) || \
   defined(__alpha__)


I believe that's Arm64, right?  If so, it could go on the same line as 
the __arm__ check.  That would follow the pattern of preceding HP and 
MIPS checks.  But not a big deal.

I sent a new patch with clarified commit message and put on the same line.

Reviewed-by: Brian Paul bri...@vmware.com

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


[Mesa-dev] [RFC] [PATCH 0/3] gbm: Add support for mapping bos

2013-11-05 Thread Ander Conselvan de Oliveira
Hi,

This is a request for comments on the idea of being able to map gbm
bos and how to implement it. The idea here is to take advantage of
UMA atchitectures when the contents on the screen are a mix of GPU
and CPU rendered.

One of the problems of adding a map entry point to gbm is the fact
that it relies on the DRI image extension to do all the work. Instead
of extending that extension, the proposal here is to support different
gbm backends, which may optionally support mapping. However, this
requires changes to the EGL implementation, since the current
implementation is heavily coupled with gbm's dri backend.

The one problem in doing that is that the dri driver and gbm device no
longer share the same fd, so another way of sharing buffers between
then is necessary. As a stop gap measure I added the ability for gbm to
provide gem names (given that dri 2's interface relies on names anyway),
but a better solution is needed.

This would also let the dependency between libgbm and libEGL to be moved
to gbm's dri backend, and open up the possibility of running a Wayland
compositor on KMS with a software renderer that would still be able to
use overlays. This ties with the fast start patches I submitted to the
wayland mailing list.

Still talking about Wayland, I have a rough plan on how to make this
usable with that too. Since gbm is already Wayland aware to some extent,
given that it is able to import wl_buffers into gbm_bos, it seems like
a natural extension that it would be able to do the converse. That
ability together with an entry point for creating a gbm_device for a
given wl_display would be enough for making this available for any
wayland client.

Any comments on this will be highly appreciated.

Thanks,
Ander


Ander Conselvan de Oliveira (3):
  gbm: Add intel backend
  egl/dri: Add gbm platform
  gbm: Add entry points for mapping and unmapping bos

 configure.ac|5 +-
 src/egl/drivers/dri2/Makefile.am|5 +
 src/egl/drivers/dri2/egl_dri2.c |6 +
 src/egl/drivers/dri2/egl_dri2.h |   11 +-
 src/egl/drivers/dri2/platform_gbm.c |  545 +++
 src/egl/main/Makefile.am|5 +
 src/egl/main/egldisplay.c   |3 +-
 src/egl/main/egldisplay.h   |1 +
 src/gbm/Makefile.am |   12 +
 src/gbm/backends/dri/gbm_dri.c  |   11 +
 src/gbm/backends/intel/gbm_intel.c  |  269 +
 src/gbm/backends/intel/gbm_intel.h  |   77 +
 src/gbm/main/backend.c  |2 +
 src/gbm/main/common_drm.h   |1 +
 src/gbm/main/gbm.c  |   54 +++-
 src/gbm/main/gbm.h  |   18 ++
 src/gbm/main/gbmint.h   |5 +
 17 files changed, 1022 insertions(+), 8 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_gbm.c
 create mode 100644 src/gbm/backends/intel/gbm_intel.c
 create mode 100644 src/gbm/backends/intel/gbm_intel.h

-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/3] egl/dri: Add gbm platform

2013-11-05 Thread Ander Conselvan de Oliveira
This adds a GBM platform that doesn't depend on gbm's dri backend. This
can be used, for instance, with the intel backend.

This also adds a gbm_bo_export entrypoint to gbm, so that the EGL code
can access the buffer. This is necessary since EGL won't share the fd
width gbm when using the new platform.

The new platform is mostly a copy from platform-drm.c
---
 configure.ac|5 +-
 src/egl/drivers/dri2/Makefile.am|5 +
 src/egl/drivers/dri2/egl_dri2.c |6 +
 src/egl/drivers/dri2/egl_dri2.h |   11 +-
 src/egl/drivers/dri2/platform_gbm.c |  545 +++
 src/egl/main/Makefile.am|5 +
 src/egl/main/egldisplay.c   |3 +-
 src/egl/main/egldisplay.h   |1 +
 src/gbm/backends/dri/gbm_dri.c  |7 +
 src/gbm/backends/intel/gbm_intel.c  |   21 ++
 src/gbm/backends/intel/gbm_intel.h  |1 +
 src/gbm/main/gbm.c  |   29 +-
 src/gbm/main/gbm.h  |4 +
 src/gbm/main/gbmint.h   |3 +
 14 files changed, 638 insertions(+), 8 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_gbm.c

diff --git a/configure.ac b/configure.ac
index 91b9871..e6beb5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1442,9 +1442,9 @@ for plat in $egl_platforms; do
 fi
;;
 
-   drm)
+   drm|gbm)
test x$enable_gbm = xno 
-   AC_MSG_ERROR([EGL platform drm needs gbm])
+   AC_MSG_ERROR([EGL platform '$plat' needs gbm])
;;
 
android|fbdev|gdi|null)
@@ -1478,6 +1478,7 @@ AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo 
$egl_platforms | grep 'wayland'
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo $egl_platforms | grep 'drm' 
/dev/null 21)
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo $egl_platforms | grep 'fbdev' 
/dev/null 21)
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo $egl_platforms | grep 'null' 
/dev/null 21)
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_GBM, echo $egl_platforms | grep 'gbm' 
/dev/null 21)
 
 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test x$HAVE_EGL_DRIVER_DRI2 != x)
 AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test x$HAVE_EGL_DRIVER_GLX != x)
diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
index 823ef5e..5482a57 100644
--- a/src/egl/drivers/dri2/Makefile.am
+++ b/src/egl/drivers/dri2/Makefile.am
@@ -63,3 +63,8 @@ if HAVE_EGL_PLATFORM_DRM
 libegl_dri2_la_SOURCES += platform_drm.c
 AM_CFLAGS += -DHAVE_DRM_PLATFORM
 endif
+
+if HAVE_EGL_PLATFORM_GBM
+libegl_dri2_la_SOURCES += platform_gbm.c
+AM_CFLAGS += -DHAVE_GBM_PLATFORM
+endif
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 903a1a6..b0797a4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -626,6 +626,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
  return EGL_TRUE;
   return dri2_initialize_drm(drv, disp);
 #endif
+#ifdef HAVE_GBM_PLATFORM
+   case _EGL_PLATFORM_GBM:
+  if (disp-Options.TestOnly)
+ return EGL_TRUE;
+  return dri2_initialize_gbm(drv, disp);
+#endif
 #ifdef HAVE_WAYLAND_PLATFORM
case _EGL_PLATFORM_WAYLAND:
   if (disp-Options.TestOnly)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index a72e7b2..ede72e6 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -183,7 +183,11 @@ struct dri2_egl_surface
struct gbm_dri_surface *gbm_dri_surf;
 #endif
 
-#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
+#ifdef HAVE_GBM_PLATFORM
+   struct gbm_surface *gbm_surf;
+#endif
+
+#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || 
defined(HAVE_GBM_PLATFORM)
__DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
struct {
 #ifdef HAVE_WAYLAND_PLATFORM
@@ -191,7 +195,7 @@ struct dri2_egl_surface
   __DRIimage *dri_image;
   int pitch, name;
 #endif
-#ifdef HAVE_DRM_PLATFORM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_GBM_PLATFORM)
   struct gbm_bo   *bo;
 #endif
   int locked;
@@ -262,6 +266,9 @@ EGLBoolean
 dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
 
 EGLBoolean
+dri2_initialize_gbm(_EGLDriver *drv, _EGLDisplay *disp);
+
+EGLBoolean
 dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
 
 EGLBoolean
diff --git a/src/egl/drivers/dri2/platform_gbm.c 
b/src/egl/drivers/dri2/platform_gbm.c
new file mode 100644
index 000..c28bc4a
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_gbm.c
@@ -0,0 +1,545 @@
+/*
+ * Copyright © 2011-2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell 

Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Keith Packard
Keith Packard kei...@keithp.com writes:

 This sequence first adds a a couple of new DRIimage extensions to the
 dri/common, dri/i915 and dri/i965 directories which define a
 loader-independent API for managing window system operations.

 The last patch adds a new DRI3000 loader using those new interfaces.

I've figured out that I can also re-use dri2CreateNewScreen2 for the
image driver bits, as long as I change that function to also look up the
image loader. That means there are *no* new dri_util functions needed.

To recap, the changes needed to support using the DRIimageExtension
interfaces for allocating buffers from the driver in the loader are:

DRIimageDriverExtension

A proper subset of DRIdri2DriverExtension, which uses
the same five functions involved in creating new objects:

   /* Common DRI functions, shared with DRI2 */
   __DRIcreateNewScreen2createNewScreen2;
   __DRIcreateNewDrawable   createNewDrawable;
   __DRIcreateNewContextcreateNewContext;
   __DRIcreateContextAttribscreateContextAttribs;
   __DRIgetAPIMask  getAPIMask;

DRIimageLoaderExtension

Contains just two functions, one to allocate buffers and one to
copy the fake front to the real front when flushing stuff.

   /**
* Allocate color buffers.
*
* \param driDrawable
* \param width  Width of allocated buffers
* \param height Height of allocated buffers
* \param format one of __DRI_IMAGE_FORMAT_*
* \param stamp  Address of variable to be updated when
*   getBuffers must be called again
* \param loaderPrivate  The loaderPrivate for driDrawable
* \param buffer_maskSet of buffers to allocate
* \param buffersReturned buffers
*/
   int (*getBuffers)(__DRIdrawable *driDrawable,
 int *width, int *height,
 unsigned int format,
 uint32_t *stamp,
 void *loaderPrivate,
 uint32_t buffer_mask,
 struct __DRIimageList *buffers);

/**
 * Flush pending front-buffer rendering
 *
 * Any rendering that has been performed to the
 * fake front will be flushed to the front
 *
 * \param driDrawableDrawable whose front-buffer is to be 
flushed
 * \param loaderPrivate  Loader's private data that was previously 
passed
 *   into 
__DRIdri2ExtensionRec::createNewDrawable
 */
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void 
*loaderPrivate);

Each driver will need to have a path to use the image loader to get
color buffers using the DRIimageLoaderExtension getBuffers function.

-- 
keith.pack...@intel.com


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


[Mesa-dev] [PATCH 1/3] gbm: Add intel backend

2013-11-05 Thread Ander Conselvan de Oliveira
This adds an intel backend that doesn't depend on dri. Its usage is
limited since the current EGL implementation won't work with this as
it is.
---
 src/gbm/Makefile.am|   12 ++
 src/gbm/backends/intel/gbm_intel.c |  227 
 src/gbm/backends/intel/gbm_intel.h |   74 
 src/gbm/main/backend.c |2 +
 src/gbm/main/common_drm.h  |1 +
 5 files changed, 316 insertions(+)
 create mode 100644 src/gbm/backends/intel/gbm_intel.c
 create mode 100644 src/gbm/backends/intel/gbm_intel.h

diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index 1282b14..e808b7f 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -42,6 +42,18 @@ libgbm_la_LIBADD += \
libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la 
$(LIBDRM_LIBS)
 endif
 
+if HAVE_I965_DRI
+noinst_LTLIBRARIES = libgbm_intel.la
+libgbm_intel_la_SOURCES = \
+   backends/intel/gbm_intel.c
+
+libgbm_intel_la_CFLAGS = \
+   $(AM_CFLAGS) $(INTEL_CFLAGS)
+
+libgbm_la_LIBADD += \
+   libgbm_intel.la $(INTEL_LIBS)
+endif
+
 all-local: libgbm.la
$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so
diff --git a/src/gbm/backends/intel/gbm_intel.c 
b/src/gbm/backends/intel/gbm_intel.c
new file mode 100644
index 000..dc9f174
--- /dev/null
+++ b/src/gbm/backends/intel/gbm_intel.c
@@ -0,0 +1,227 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
+ */
+
+#include stdlib.h
+#include stdint.h
+#include string.h
+
+#include gbm_intel.h
+
+#include gbmint.h
+
+static int
+gbm_intel_is_format_supported(struct gbm_device *gbm,
+uint32_t format,
+uint32_t usage)
+{
+   switch (format) {
+   case GBM_BO_FORMAT_XRGB:
+   case GBM_FORMAT_XRGB:
+  break;
+   case GBM_BO_FORMAT_ARGB:
+   case GBM_FORMAT_ARGB:
+  if (usage  GBM_BO_USE_SCANOUT)
+ return 0;
+  break;
+   default:
+  return 0;
+   }
+
+   if (usage  GBM_BO_USE_CURSOR_64X64 
+   usage  GBM_BO_USE_RENDERING)
+  return 0;
+
+   return 1;
+}
+
+static int
+gbm_intel_bo_write(struct gbm_bo *bo, const void *buf, size_t count)
+{
+   struct gbm_intel_bo *ibo = gbm_intel_bo(bo);
+   int ret;
+
+   ret = drm_intel_bo_map(ibo-bo, 1);
+   if (ret  0)
+  return ret;
+
+   memcpy(ibo-bo-virtual, buf, count);
+
+   return drm_intel_bo_unmap(ibo-bo);
+}
+
+static void
+gbm_intel_bo_destroy(struct gbm_bo *_bo)
+{
+   struct gbm_intel_bo *ibo = gbm_intel_bo(_bo);
+
+   drm_intel_bo_unreference(ibo-bo);
+
+   free(ibo);
+}
+
+static inline int
+align(int value, int size)
+{
+   return (value + size - 1)  ~(size - 1);
+}
+
+static struct gbm_intel_bo *
+gbm_intel_bo_create_with_bo(struct gbm_device *gbm,
+uint32_t width, uint32_t height, uint32_t stride,
+uint32_t format, uint32_t usage,
+drm_intel_bo *bo)
+{
+   struct gbm_intel_bo *ibo;
+
+   ibo = calloc(1, sizeof *ibo);
+   if (!ibo)
+  return NULL;
+
+   ibo-bo = bo;
+
+   ibo-base.base.gbm = gbm;
+   ibo-base.base.width = width;
+   ibo-base.base.height = height;
+   ibo-base.base.stride = stride;
+   ibo-base.base.format = format;
+   ibo-base.base.handle.s32 = ibo-bo-handle;
+
+   return ibo;
+}
+
+static struct gbm_bo *
+gbm_intel_bo_create(struct gbm_device *gbm,
+uint32_t width, uint32_t height,
+uint32_t format, uint32_t usage)
+{
+   struct gbm_intel_device *igbm = gbm_intel_device(gbm);
+   struct gbm_intel_bo *ibo;
+   drm_intel_bo *bo;
+   int size, stride;
+
+   switch (format) {
+   case GBM_BO_FORMAT_XRGB:
+   case GBM_FORMAT_XRGB:
+   case 

Re: [Mesa-dev] [PATCH 09/11] mesa: Add Get* support for ARB_vertex_attrib_binding

2013-11-05 Thread Ian Romanick
On 11/04/2013 03:10 PM, Fredrik Höglund wrote:
 On Monday 04 November 2013, Ian Romanick wrote:
 On 10/28/2013 03:33 PM, Fredrik Höglund wrote:

 This needs some extension checks somewhere.
 
 I've added a check for ARB_instanced_arrays in the VERTEX_BINDING_DIVISOR
 case.  I didn't add checks for ARB_vertex_attrib_binding since the intent is 
 to
 always enable it on desktop GL.

I had overlooked that patch #5 enabled the extension unconditionally.
Just adding the checks for ARB_instanced_arrays should be fine.  With that,

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

 Or were you thinking of something else?
 
 ---
  src/mesa/main/get.c  |   24 
  src/mesa/main/get_hash_params.py |3 +++
  src/mesa/main/varray.c   |9 +
  3 files changed, 36 insertions(+)

 diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
 index b39fdfb..caa163e 100644
 --- a/src/mesa/main/get.c
 +++ b/src/mesa/main/get.c
 @@ -1692,6 +1692,30 @@ find_value_indexed(const char *func, GLenum pname, 
 GLuint index, union value *v)
   goto invalid_enum;
v-value_int = ctx-Multisample.SampleMaskValue;
return TYPE_INT;
 +
 +   case GL_VERTEX_BINDING_DIVISOR:
 +  if (!_mesa_is_desktop_gl(ctx))
 +  goto invalid_enum;
 +  if (index = ctx-Const.VertexProgram.MaxAttribs)
 +  goto invalid_value;
 +  v-value_int = 
 ctx-Array.ArrayObj-VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
 +  return TYPE_INT;
 +
 +   case GL_VERTEX_BINDING_OFFSET:
 +  if (!_mesa_is_desktop_gl(ctx))
 +  goto invalid_enum;
 +  if (index = ctx-Const.VertexProgram.MaxAttribs)
 +  goto invalid_value;
 +  v-value_int = 
 ctx-Array.ArrayObj-VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
 +  return TYPE_INT;
 +
 +   case GL_VERTEX_BINDING_STRIDE:
 +  if (!_mesa_is_desktop_gl(ctx))
 +  goto invalid_enum;
 +  if (index = ctx-Const.VertexProgram.MaxAttribs)
 +  goto invalid_value;
 +  v-value_int = 
 ctx-Array.ArrayObj-VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
 +  return TYPE_INT;
 }
  
   invalid_enum:
 diff --git a/src/mesa/main/get_hash_params.py 
 b/src/mesa/main/get_hash_params.py
 index 3204940..4e2f7d2 100644
 --- a/src/mesa/main/get_hash_params.py
 +++ b/src/mesa/main/get_hash_params.py
 @@ -722,6 +722,9 @@ descriptor=[
[ MAX_PROGRAM_TEXTURE_GATHER_OFFSET, 
 CONTEXT_INT(Const.MaxProgramTextureGatherOffset), 
 extra_ARB_texture_gather],
[ MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, 
 CONTEXT_INT(Const.MaxProgramTextureGatherComponents), 
 extra_ARB_texture_gather],
  
 +# GL_ARB_vertex_attrib_binding
 +  [ MAX_VERTEX_ATTRIB_RELATIVE_OFFSET, 
 CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA ],
 +  [ MAX_VERTEX_ATTRIB_BINDINGS, 
 CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA ],
  ]},
  
  # Enums restricted to OpenGL Core profile
 diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
 index 6c56ddd..5b5b8b2 100644
 --- a/src/mesa/main/varray.c
 +++ b/src/mesa/main/varray.c
 @@ -762,6 +762,15 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint 
 index, GLenum pname,
|| _mesa_is_gles3(ctx)) {
   return gl_vertex_buffer_binding(ctx, 
 array-VertexBinding)-InstanceDivisor;
}
 +   case GL_VERTEX_ATTRIB_BINDING:
 +  if (_mesa_is_desktop_gl(ctx)) {
 + return array-VertexBinding - VERT_ATTRIB_GENERIC0;
 +  }
 +  goto error;
 +   case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
 +  if (_mesa_is_desktop_gl(ctx)) {
 + return array-RelativeOffset;
 +  }
goto error;
 default:
; /* fall-through */


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


Re: [Mesa-dev] [PATCH 1/6] st/draw: silence Mingw warning in pointer_to_offset()

2013-11-05 Thread Ian Romanick
On 10/29/2013 01:11 PM, Brian Paul wrote:
 Fixes warning: cast from pointer to integer of different size for
 64-bit builds.
 ---
  src/mesa/state_tracker/st_draw.h |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/mesa/state_tracker/st_draw.h 
 b/src/mesa/state_tracker/st_draw.h
 index 3313fc8..394473b 100644
 --- a/src/mesa/state_tracker/st_draw.h
 +++ b/src/mesa/state_tracker/st_draw.h
 @@ -77,7 +77,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
  static INLINE unsigned
  pointer_to_offset(const void *ptr)
  {
 -   return (unsigned) (((unsigned long) ptr)  0xUL);
 +   return (unsigned) (((GLsizeiptr) ptr)  0xUL);

Would it be better to just use uintptr_t?

  }
  
  

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


[Mesa-dev] 9.2.2 OSMesa classic 80 new regressions in VTK

2013-11-05 Thread burlen
Upgrading from 9.2.0 to 9.2.2 with OSMesa classic I'm seeing 80 new 
regressions in VTK.

http://open.cdash.org/viewTest.php?onlyfailedbuildid=3087854
click Failed to see an image diff. Maybe related to line rendering? 
Any chance a mesa developer could investigate?


Burlen



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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Chris Forbes
 So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...

My understanding is you can't actually, since views can only be
created from immutable-format textures, and GL_LUMINANCE is not a
sized internalformat, so it can't be used with TexStorage?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Paul Berry
Hardware docs say we can only use SIMD8 dispatch in this condition.
---
 src/mesa/drivers/dri/i965/gen6_wm_state.c | 34 ++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c 
b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index 42d8789..e56186b 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -229,8 +229,40 @@ upload_wm_state(struct brw_context *brw)
 
   if (min_inv_per_frag  1)
  dw6 |= GEN6_WM_MSDISPMODE_PERSAMPLE;
-  else
+  else {
  dw6 |= GEN6_WM_MSDISPMODE_PERPIXEL;
+
+ /* From the Sandy Bridge PRM, Vol 2 part 1, 7.7.1 (Pixel Grouping
+  * (Dispatch Size) Control), p.334:
+  *
+  * Note: in the table below, the Valid column indicates which
+  * products that combination is supported on. Combinations of
+  * dispatch enables not listed in the table are not available on
+  * any product.
+  *
+  * A: Valid on all products
+  *
+  * B: Not valid on [DevSNB] if 4x PERPIXEL mode with pixel shader
+  * computed depth.
+  *
+  * D: Valid on all products, except when in non-1x PERSAMPLE mode
+  * (applies to [DevSNB+] only). Not valid on [DevSNB] if 4x
+  * PERPIXEL mode with pixel shader computed depth.
+  *
+  * E: Not valid on [DevSNB] if 4x PERPIXEL mode with pixel shader
+  * computed depth.
+  *
+  * F: Valid on all products, except not valid on [DevSNB] if 4x
+  * PERPIXEL mode with pixel shader computed depth.
+  *
+  * In the table that follows, the only entry with A in the Valid
+  * column is the entry where only 8 pixel dispatch is enabled.
+  * Therefore, when we are in PERPIXEL mode with pixel shader computed
+  * depth, we need to disable SIMD16 dispatch.
+  */
+ if (dw5  GEN6_WM_COMPUTED_DEPTH)
+dw5 = ~GEN6_WM_16_DISPATCH_ENABLE;
+  }
} else {
   dw6 |= GEN6_WM_MSRAST_OFF_PIXEL;
   dw6 |= GEN6_WM_MSDISPMODE_PERSAMPLE;
-- 
1.8.4.2

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


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Chad Versace

On 11/02/2013 12:00 PM, Emil Velikov wrote:

Rip out the source file list from mesa/Makefile.sources, to a
more sensible location/file.
* Split PROGRAM_FILES and GENERATED_FILES.
* Update the automake and Android build systems.

Android
* Slightly reshuffle the Android.mk for readability sake.
* Use GENERATED_FILES, drop the TODO item.
* Use explicit 'call' when executing local macros.

Cc: Chad Versace chad.vers...@linux.intel.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---

Andoid changes are _not_ tested (yet).


The changes to the Andoid.mk look good to me. It's much easier to
understand now. However, I've also not tested the changes. This
path is
Reviewed-by: Chad Versace chad.vers...@linux.intel.com

Adrian, do wish to test this series on Android?


---
  src/mesa/Makefile.sources | 24 ---
  src/mesa/program/Android.mk   | 65 ---
  src/mesa/program/Makefile.am  | 25 +--
  src/mesa/program/Makefile.sources | 27 
  4 files changed, 69 insertions(+), 72 deletions(-)
  create mode 100644 src/mesa/program/Makefile.sources

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index a84f8a7..e4146ae 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -252,30 +252,6 @@ STATETRACKER_FILES = \
$(SRCDIR)state_tracker/st_texture.c \
$(SRCDIR)state_tracker/st_vdpau.c

-PROGRAM_FILES = \
-   $(SRCDIR)program/arbprogparse.c \
-   $(SRCDIR)program/prog_hash_table.c \
-   $(SRCDIR)program/ir_to_mesa.cpp \
-   $(SRCDIR)program/program.c \
-   $(SRCDIR)program/program_parse_extra.c \
-   $(SRCDIR)program/prog_cache.c \
-   $(SRCDIR)program/prog_execute.c \
-   $(SRCDIR)program/prog_instruction.c \
-   $(SRCDIR)program/prog_noise.c \
-   $(SRCDIR)program/prog_optimize.c \
-   $(SRCDIR)program/prog_opt_constant_fold.c \
-   $(SRCDIR)program/prog_parameter.c \
-   $(SRCDIR)program/prog_parameter_layout.c \
-   $(SRCDIR)program/prog_print.c \
-   $(SRCDIR)program/prog_statevars.c \
-   $(SRCDIR)program/programopt.c \
-   $(SRCDIR)program/register_allocate.c \
-   $(SRCDIR)program/sampler.cpp \
-   $(SRCDIR)program/string_to_uint_map.cpp \
-   $(SRCDIR)program/symbol_table.c \
-   $(BUILDDIR)program/lex.yy.c \
-   $(BUILDDIR)program/program_parse.tab.c
-
  ASM_C_FILES = \
$(SRCDIR)x86/common_x86.c \
$(SRCDIR)x86/x86_xform.c \
diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index e85afe6..e340ed4 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -18,8 +18,30 @@
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  # DEALINGS IN THE SOFTWARE.

+# --
+# libmesa_program.a
+# --
  LOCAL_PATH := $(call my-dir)

+# get PROGRAM_FILES and GENERATED_FILES
+include $(LOCAL_PATH)/Makefile.sources
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_program
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+intermediates := $(call local-intermediates-dir)
+
+LOCAL_C_INCLUDES := \
+   $(intermediates) \
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/mesa \
+   $(MESA_TOP)/src/glsl
+
+
+LOCAL_SRC_FILES := $(PROGRAM_FILES)
+LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
+
  define local-l-to-c
@mkdir -p $(dir $@)
@echo Mesa Lex: $(PRIVATE_MODULE) = $
@@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
$(hide) $(YACC) -o $@ -p _mesa_program_ $
  endef

-# --
-# libmesa_program.a
-# --
-
-# Import the following variables:
-# PROGRAM_FILES
-include $(MESA_TOP)/src/mesa/Makefile.sources
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libmesa_program
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-intermediates := $(call local-intermediates-dir)
+$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
+   $(call local-l-to-c)

-# TODO(chadv): In Makefile.sources, move these vars to a different list so we 
can
-# remove this kludge.
-generated_sources_basenames := \
-   lex.yy.c \
-   program_parse.tab.c \
-   program_parse.tab.h
+$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
+   $(call mesa_local-y-to-c-and-h)

-LOCAL_SRC_FILES := \
-   $(filter-out $(generated_sources_basenames),$(subst 
program/,,$(PROGRAM_FILES)))
-
-LOCAL_GENERATED_SOURCES := \
-   $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
-
-$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
-   $(mesa_local-y-to-c-and-h)
-
-$(intermediates)/program/program_parse.tab.h: 
$(intermediates)/program/program_parse.tab.c

[Mesa-dev] [PATCH] gallivm: optimize lp_build_minify for sse

2013-11-05 Thread sroland
From: Roland Scheidegger srol...@vmware.com

SSE can't handle true vector shifts (with variable shift count),
so llvm is turning them into a mess of extracts, scalar shifts and inserts.
It is however possible to emulate them in lp_build_minify with float muls,
which should be way faster (saves over 20 instructions per 8-wide
lp_build_minify). This wouldn't work for generic 32bit shifts though
since we've got only 24bits of mantissa (actually for left shifts it would
work by using sse41 int mul instead of float mul but not for right shifts).
Note that this has very limited scope for now, since this is only used with
per-pixel lod (otherwise we're avoiding the non-constant shift count by doing
per-quad shifts manually), and only 1d textures even then (though the latter
should change).
---
 src/gallium/auxiliary/gallivm/lp_bld_sample.c |   62 +
 src/gallium/auxiliary/gallivm/lp_bld_sample.h |3 +-
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |2 +-
 3 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index a032d9d..e60a035 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -36,6 +36,7 @@
 #include pipe/p_state.h
 #include util/u_format.h
 #include util/u_math.h
+#include util/u_cpu_detect.h
 #include lp_bld_arit.h
 #include lp_bld_const.h
 #include lp_bld_debug.h
@@ -248,7 +249,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
first_level = bld-dynamic_state-first_level(bld-dynamic_state,
  bld-gallivm, texture_unit);
first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
-   int_size = lp_build_minify(int_size_bld, bld-int_size, first_level_vec);
+   int_size = lp_build_minify(int_size_bld, bld-int_size, first_level_vec, 
TRUE);
float_size = lp_build_int_to_float(float_size_bld, int_size);
 
if (cube_rho) {
@@ -1089,12 +1090,14 @@ lp_build_get_mip_offsets(struct lp_build_sample_context 
*bld,
 
 /**
  * Codegen equivalent for u_minify().
+ * @param lod_scalar  if lod is a (broadcasted) scalar
  * Return max(1, base_size  level);
  */
 LLVMValueRef
 lp_build_minify(struct lp_build_context *bld,
 LLVMValueRef base_size,
-LLVMValueRef level)
+LLVMValueRef level,
+boolean lod_scalar)
 {
LLVMBuilderRef builder = bld-gallivm-builder;
assert(lp_check_value(bld-type, base_size));
@@ -1105,10 +1108,49 @@ lp_build_minify(struct lp_build_context *bld,
   return base_size;
}
else {
-  LLVMValueRef size =
- LLVMBuildLShr(builder, base_size, level, minify);
+  LLVMValueRef size;
   assert(bld-type.sign);
-  size = lp_build_max(bld, size, bld-one);
+  if (lod_scalar ||
+ (util_cpu_caps.has_avx2 || !util_cpu_caps.has_sse)) {
+ size = LLVMBuildLShr(builder, base_size, level, minify);
+ size = lp_build_max(bld, size, bld-one);
+  }
+  else {
+ /*
+  * emulate shift with float mul, since intel forgot shifts with
+  * per-element shift count until avx2, which results in terrible
+  * scalar extraction (both count and value), scalar shift,
+  * vector reinsertion. Should not be an issue on any non-x86 cpu
+  * with a vector instruction set.
+  * On cpus with AMD's XOP this should also be unnecessary but I'm
+  * not sure if llvm would emit this with current flags.
+  */
+ LLVMValueRef const127, const23, lf;
+ struct lp_type ftype;
+ struct lp_build_context fbld;
+ ftype = lp_type_float_vec(32, bld-type.length * bld-type.width);
+ lp_build_context_init(fbld, bld-gallivm, ftype);
+ const127 = lp_build_const_int_vec(bld-gallivm, bld-type, 127);
+ const23 = lp_build_const_int_vec(bld-gallivm, bld-type, 23);
+
+ /* calculate 2^(-level) float */
+ lf = lp_build_sub(bld, const127, level);
+ lf = lp_build_shl(bld, lf, const23);
+ lf = LLVMBuildBitCast(builder, lf, fbld.vec_type, );
+
+ /* finish shift operation by doing float mul */
+ base_size = lp_build_int_to_float(fbld, base_size);
+ size = lp_build_mul(fbld, base_size, lf);
+ /*
+  * do the max also with floats because
+  * a) non-emulated int max requires sse41
+  *(this is actually a lie as we could cast to 16bit values
+  *as 16bit is sufficient and 16bit int max is sse2)
+  * b) with avx we can do int max 4-wide but float max 8-wide
+  */
+ size = lp_build_max(fbld, size, fbld.one);
+ size = lp_build_itrunc(fbld, size);
+  }
   return size;
}
 }
@@ -1185,7 +1227,7 @@ lp_build_mipmap_level_sizes(struct 
lp_build_sample_context *bld,
 */
if (bld-num_mips == 1) {
  

Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Matt Turner
On Sat, Nov 2, 2013 at 12:00 PM, Emil Velikov emil.l.veli...@gmail.com wrote:
 Rip out the source file list from mesa/Makefile.sources, to a
 more sensible location/file.
 * Split PROGRAM_FILES and GENERATED_FILES.
 * Update the automake and Android build systems.

 Android
 * Slightly reshuffle the Android.mk for readability sake.
 * Use GENERATED_FILES, drop the TODO item.
 * Use explicit 'call' when executing local macros.

 Cc: Chad Versace chad.vers...@linux.intel.com
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---

 Andoid changes are _not_ tested (yet).

 ---
  src/mesa/Makefile.sources | 24 ---
  src/mesa/program/Android.mk   | 65 
 ---
  src/mesa/program/Makefile.am  | 25 +--
  src/mesa/program/Makefile.sources | 27 
  4 files changed, 69 insertions(+), 72 deletions(-)
  create mode 100644 src/mesa/program/Makefile.sources

 diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
 index a84f8a7..e4146ae 100644
 --- a/src/mesa/Makefile.sources
 +++ b/src/mesa/Makefile.sources
 @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
 $(SRCDIR)state_tracker/st_texture.c \
 $(SRCDIR)state_tracker/st_vdpau.c

 -PROGRAM_FILES = \
 -   $(SRCDIR)program/arbprogparse.c \
 -   $(SRCDIR)program/prog_hash_table.c \
 -   $(SRCDIR)program/ir_to_mesa.cpp \
 -   $(SRCDIR)program/program.c \
 -   $(SRCDIR)program/program_parse_extra.c \
 -   $(SRCDIR)program/prog_cache.c \
 -   $(SRCDIR)program/prog_execute.c \
 -   $(SRCDIR)program/prog_instruction.c \
 -   $(SRCDIR)program/prog_noise.c \
 -   $(SRCDIR)program/prog_optimize.c \
 -   $(SRCDIR)program/prog_opt_constant_fold.c \
 -   $(SRCDIR)program/prog_parameter.c \
 -   $(SRCDIR)program/prog_parameter_layout.c \
 -   $(SRCDIR)program/prog_print.c \
 -   $(SRCDIR)program/prog_statevars.c \
 -   $(SRCDIR)program/programopt.c \
 -   $(SRCDIR)program/register_allocate.c \
 -   $(SRCDIR)program/sampler.cpp \
 -   $(SRCDIR)program/string_to_uint_map.cpp \
 -   $(SRCDIR)program/symbol_table.c \
 -   $(BUILDDIR)program/lex.yy.c \
 -   $(BUILDDIR)program/program_parse.tab.c
 -
  ASM_C_FILES =  \
 $(SRCDIR)x86/common_x86.c \
 $(SRCDIR)x86/x86_xform.c \
 diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
 index e85afe6..e340ed4 100644
 --- a/src/mesa/program/Android.mk
 +++ b/src/mesa/program/Android.mk
 @@ -18,8 +18,30 @@
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  # DEALINGS IN THE SOFTWARE.

 +# --
 +# libmesa_program.a
 +# --
  LOCAL_PATH := $(call my-dir)

 +# get PROGRAM_FILES and GENERATED_FILES
 +include $(LOCAL_PATH)/Makefile.sources
 +include $(CLEAR_VARS)
 +
 +LOCAL_MODULE := libmesa_program
 +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 +
 +intermediates := $(call local-intermediates-dir)
 +
 +LOCAL_C_INCLUDES := \
 +   $(intermediates) \
 +   $(MESA_TOP)/src/mapi \
 +   $(MESA_TOP)/src/mesa \
 +   $(MESA_TOP)/src/glsl
 +
 +
 +LOCAL_SRC_FILES := $(PROGRAM_FILES)
 +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
 +
  define local-l-to-c
 @mkdir -p $(dir $@)
 @echo Mesa Lex: $(PRIVATE_MODULE) = $
 @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
 $(hide) $(YACC) -o $@ -p _mesa_program_ $
  endef

 -# --
 -# libmesa_program.a
 -# --
 -
 -# Import the following variables:
 -# PROGRAM_FILES
 -include $(MESA_TOP)/src/mesa/Makefile.sources
 -
 -include $(CLEAR_VARS)
 -
 -LOCAL_MODULE := libmesa_program
 -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 -
 -intermediates := $(call local-intermediates-dir)
 +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
 +   $(call local-l-to-c)

 -# TODO(chadv): In Makefile.sources, move these vars to a different list so 
 we can
 -# remove this kludge.
 -generated_sources_basenames := \
 -   lex.yy.c \
 -   program_parse.tab.c \
 -   program_parse.tab.h
 +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
 +   $(call mesa_local-y-to-c-and-h)

 -LOCAL_SRC_FILES := \
 -   $(filter-out $(generated_sources_basenames),$(subst 
 program/,,$(PROGRAM_FILES)))
 -
 -LOCAL_GENERATED_SOURCES := \
 -   $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
 -
 -$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
 -   $(mesa_local-y-to-c-and-h)
 -
 -$(intermediates)/program/program_parse.tab.h: 
 $(intermediates)/program/program_parse.tab.c
 +$(intermediates)/program_parse.tab.h: $(intermediates)/program_parse.tab.c
 @

 

Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Courtney Goeltzenleuchter
On Tue, Nov 5, 2013 at 10:44 AM, Chris Forbes chr...@ijw.co.nz wrote:

  So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...

 My understanding is you can't actually, since views can only be
 created from immutable-format textures, and GL_LUMINANCE is not a
 sized internalformat, so it can't be used with TexStorage?


Chris is correct. GL_LUMINANCE is unsized and is not an allowed format for
glTexStorage.

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


Re: [Mesa-dev] [PATCH] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Eric Anholt
Paul Berry stereotype...@gmail.com writes:

 Hardware docs say we can only use SIMD8 dispatch in this condition.

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


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


Re: [Mesa-dev] [PATCH 1/2] mesa: Add unreachable macro.

2013-11-05 Thread Matt Turner
On Mon, Nov 4, 2013 at 4:43 PM, Matt Turner matts...@gmail.com wrote:
 ---
  src/mesa/main/compiler.h | 15 +++
  1 file changed, 15 insertions(+)

 diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
 index 61ce5db..6a25bf5 100644
 --- a/src/mesa/main/compiler.h
 +++ b/src/mesa/main/compiler.h
 @@ -252,6 +252,21 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
(void) sizeof(char [1 - 2*!(COND)]); \
 } while (0)

 +/**
 + * Unreachable macro. Useful for suppressing control reaches end of non-void
 + * function warnings.
 + */
 +#if __GNUC__ = 4  __GNUC_MINOR__ = 5
 +#define unreachable __builtin_unreachable()
 +#elif (defined(__clang__)  defined(__has_builtin))
 +# if __has_builtin(__builtin_unreachable)
 +#  define unreachable __builtin_unreachable()
 +# endif
 +#endif
 +
 +#ifndef unreachable
 +#define unreachable
 +#endif

  #if (__GNUC__ = 3)
  #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
 --
 1.8.3.2


I'm actually going to change these to 'unreachable()' so it looks less funny.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Emil Velikov
On 05/11/13 18:28, Matt Turner wrote:
 On Sat, Nov 2, 2013 at 12:00 PM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Rip out the source file list from mesa/Makefile.sources, to a
 more sensible location/file.
 * Split PROGRAM_FILES and GENERATED_FILES.
 * Update the automake and Android build systems.

 Android
 * Slightly reshuffle the Android.mk for readability sake.
 * Use GENERATED_FILES, drop the TODO item.
 * Use explicit 'call' when executing local macros.

 Cc: Chad Versace chad.vers...@linux.intel.com
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---

 Andoid changes are _not_ tested (yet).

 ---
  src/mesa/Makefile.sources | 24 ---
  src/mesa/program/Android.mk   | 65 
 ---
  src/mesa/program/Makefile.am  | 25 +--
  src/mesa/program/Makefile.sources | 27 
  4 files changed, 69 insertions(+), 72 deletions(-)
  create mode 100644 src/mesa/program/Makefile.sources

 diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
 index a84f8a7..e4146ae 100644
 --- a/src/mesa/Makefile.sources
 +++ b/src/mesa/Makefile.sources
 @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
 $(SRCDIR)state_tracker/st_texture.c \
 $(SRCDIR)state_tracker/st_vdpau.c

 -PROGRAM_FILES = \
 -   $(SRCDIR)program/arbprogparse.c \
 -   $(SRCDIR)program/prog_hash_table.c \
 -   $(SRCDIR)program/ir_to_mesa.cpp \
 -   $(SRCDIR)program/program.c \
 -   $(SRCDIR)program/program_parse_extra.c \
 -   $(SRCDIR)program/prog_cache.c \
 -   $(SRCDIR)program/prog_execute.c \
 -   $(SRCDIR)program/prog_instruction.c \
 -   $(SRCDIR)program/prog_noise.c \
 -   $(SRCDIR)program/prog_optimize.c \
 -   $(SRCDIR)program/prog_opt_constant_fold.c \
 -   $(SRCDIR)program/prog_parameter.c \
 -   $(SRCDIR)program/prog_parameter_layout.c \
 -   $(SRCDIR)program/prog_print.c \
 -   $(SRCDIR)program/prog_statevars.c \
 -   $(SRCDIR)program/programopt.c \
 -   $(SRCDIR)program/register_allocate.c \
 -   $(SRCDIR)program/sampler.cpp \
 -   $(SRCDIR)program/string_to_uint_map.cpp \
 -   $(SRCDIR)program/symbol_table.c \
 -   $(BUILDDIR)program/lex.yy.c \
 -   $(BUILDDIR)program/program_parse.tab.c
 -
  ASM_C_FILES =  \
 $(SRCDIR)x86/common_x86.c \
 $(SRCDIR)x86/x86_xform.c \
 diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
 index e85afe6..e340ed4 100644
 --- a/src/mesa/program/Android.mk
 +++ b/src/mesa/program/Android.mk
 @@ -18,8 +18,30 @@
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  # DEALINGS IN THE SOFTWARE.

 +# --
 +# libmesa_program.a
 +# --
  LOCAL_PATH := $(call my-dir)

 +# get PROGRAM_FILES and GENERATED_FILES
 +include $(LOCAL_PATH)/Makefile.sources
 +include $(CLEAR_VARS)
 +
 +LOCAL_MODULE := libmesa_program
 +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 +
 +intermediates := $(call local-intermediates-dir)
 +
 +LOCAL_C_INCLUDES := \
 +   $(intermediates) \
 +   $(MESA_TOP)/src/mapi \
 +   $(MESA_TOP)/src/mesa \
 +   $(MESA_TOP)/src/glsl
 +
 +
 +LOCAL_SRC_FILES := $(PROGRAM_FILES)
 +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
 +
  define local-l-to-c
 @mkdir -p $(dir $@)
 @echo Mesa Lex: $(PRIVATE_MODULE) = $
 @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
 $(hide) $(YACC) -o $@ -p _mesa_program_ $
  endef

 -# --
 -# libmesa_program.a
 -# --
 -
 -# Import the following variables:
 -# PROGRAM_FILES
 -include $(MESA_TOP)/src/mesa/Makefile.sources
 -
 -include $(CLEAR_VARS)
 -
 -LOCAL_MODULE := libmesa_program
 -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 -
 -intermediates := $(call local-intermediates-dir)
 +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
 +   $(call local-l-to-c)

 -# TODO(chadv): In Makefile.sources, move these vars to a different list so 
 we can
 -# remove this kludge.
 -generated_sources_basenames := \
 -   lex.yy.c \
 -   program_parse.tab.c \
 -   program_parse.tab.h
 +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
 +   $(call mesa_local-y-to-c-and-h)

 -LOCAL_SRC_FILES := \
 -   $(filter-out $(generated_sources_basenames),$(subst 
 program/,,$(PROGRAM_FILES)))
 -
 -LOCAL_GENERATED_SOURCES := \
 -   $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
 -
 -$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
 -   $(mesa_local-y-to-c-and-h)
 -
 -$(intermediates)/program/program_parse.tab.h: 
 $(intermediates)/program/program_parse.tab.c
 +$(intermediates)/program_parse.tab.h: $(intermediates)/program_parse.tab.c
 

Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Emil Velikov
On 05/11/13 18:18, Chad Versace wrote:
 On 11/02/2013 12:00 PM, Emil Velikov wrote:
 Rip out the source file list from mesa/Makefile.sources, to a
 more sensible location/file.
 * Split PROGRAM_FILES and GENERATED_FILES.
 * Update the automake and Android build systems.

 Android
 * Slightly reshuffle the Android.mk for readability sake.
 * Use GENERATED_FILES, drop the TODO item.
 * Use explicit 'call' when executing local macros.

 Cc: Chad Versace chad.vers...@linux.intel.com
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---

 Andoid changes are _not_ tested (yet).
 
 The changes to the Andoid.mk look good to me. It's much easier to
 understand now. However, I've also not tested the changes. This
 path is
 Reviewed-by: Chad Versace chad.vers...@linux.intel.com
 
Cheers Chad.

Seems like I would need an extra harddrive to get the Android build
running. This thing is a crazy, it ate 30GiB like it was nothing and
asks for more :)

 Adrian, do wish to test this series on Android?
 
Adrian, if you can give this patch a test that would be greatly appreciated.

Thanks
Emil

 ---
   src/mesa/Makefile.sources | 24 ---
   src/mesa/program/Android.mk   | 65
 ---
   src/mesa/program/Makefile.am  | 25 +--
   src/mesa/program/Makefile.sources | 27 
   4 files changed, 69 insertions(+), 72 deletions(-)
   create mode 100644 src/mesa/program/Makefile.sources

 diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
 index a84f8a7..e4146ae 100644
 --- a/src/mesa/Makefile.sources
 +++ b/src/mesa/Makefile.sources
 @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
   $(SRCDIR)state_tracker/st_texture.c \
   $(SRCDIR)state_tracker/st_vdpau.c

 -PROGRAM_FILES = \
 -$(SRCDIR)program/arbprogparse.c \
 -$(SRCDIR)program/prog_hash_table.c \
 -$(SRCDIR)program/ir_to_mesa.cpp \
 -$(SRCDIR)program/program.c \
 -$(SRCDIR)program/program_parse_extra.c \
 -$(SRCDIR)program/prog_cache.c \
 -$(SRCDIR)program/prog_execute.c \
 -$(SRCDIR)program/prog_instruction.c \
 -$(SRCDIR)program/prog_noise.c \
 -$(SRCDIR)program/prog_optimize.c \
 -$(SRCDIR)program/prog_opt_constant_fold.c \
 -$(SRCDIR)program/prog_parameter.c \
 -$(SRCDIR)program/prog_parameter_layout.c \
 -$(SRCDIR)program/prog_print.c \
 -$(SRCDIR)program/prog_statevars.c \
 -$(SRCDIR)program/programopt.c \
 -$(SRCDIR)program/register_allocate.c \
 -$(SRCDIR)program/sampler.cpp \
 -$(SRCDIR)program/string_to_uint_map.cpp \
 -$(SRCDIR)program/symbol_table.c \
 -$(BUILDDIR)program/lex.yy.c \
 -$(BUILDDIR)program/program_parse.tab.c
 -
   ASM_C_FILES =\
   $(SRCDIR)x86/common_x86.c \
   $(SRCDIR)x86/x86_xform.c \
 diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
 index e85afe6..e340ed4 100644
 --- a/src/mesa/program/Android.mk
 +++ b/src/mesa/program/Android.mk
 @@ -18,8 +18,30 @@
   # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   # DEALINGS IN THE SOFTWARE.

 +# --
 +# libmesa_program.a
 +# --
   LOCAL_PATH := $(call my-dir)

 +# get PROGRAM_FILES and GENERATED_FILES
 +include $(LOCAL_PATH)/Makefile.sources
 +include $(CLEAR_VARS)
 +
 +LOCAL_MODULE := libmesa_program
 +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 +
 +intermediates := $(call local-intermediates-dir)
 +
 +LOCAL_C_INCLUDES := \
 +$(intermediates) \
 +$(MESA_TOP)/src/mapi \
 +$(MESA_TOP)/src/mesa \
 +$(MESA_TOP)/src/glsl
 +
 +
 +LOCAL_SRC_FILES := $(PROGRAM_FILES)
 +LOCAL_GENERATED_SOURCES := $(addprefix
 $(intermediates)/,$(GENERATED_FILES))
 +
   define local-l-to-c
   @mkdir -p $(dir $@)
   @echo Mesa Lex: $(PRIVATE_MODULE) = $
 @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
   $(hide) $(YACC) -o $@ -p _mesa_program_ $
   endef

 -# --
 -# libmesa_program.a
 -# --
 -
 -# Import the following variables:
 -# PROGRAM_FILES
 -include $(MESA_TOP)/src/mesa/Makefile.sources
 -
 -include $(CLEAR_VARS)
 -
 -LOCAL_MODULE := libmesa_program
 -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 -
 -intermediates := $(call local-intermediates-dir)
 +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
 +$(call local-l-to-c)

 -# TODO(chadv): In Makefile.sources, move these vars to a different
 list so we can
 -# remove this kludge.
 -generated_sources_basenames := \
 -lex.yy.c \
 -program_parse.tab.c \
 -program_parse.tab.h
 +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
 +$(call mesa_local-y-to-c-and-h)

 -LOCAL_SRC_FILES := \
 -$(filter-out $(generated_sources_basenames),$(subst
 program/,,$(PROGRAM_FILES)))
 -
 

Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Chad Versace

On 11/05/2013 10:55 AM, Emil Velikov wrote:

On 05/11/13 18:18, Chad Versace wrote:

On 11/02/2013 12:00 PM, Emil Velikov wrote:

Rip out the source file list from mesa/Makefile.sources, to a
more sensible location/file.
* Split PROGRAM_FILES and GENERATED_FILES.
* Update the automake and Android build systems.

Android
* Slightly reshuffle the Android.mk for readability sake.
* Use GENERATED_FILES, drop the TODO item.
* Use explicit 'call' when executing local macros.

Cc: Chad Versace chad.vers...@linux.intel.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---

Andoid changes are _not_ tested (yet).


The changes to the Andoid.mk look good to me. It's much easier to
understand now. However, I've also not tested the changes. This
path is
Reviewed-by: Chad Versace chad.vers...@linux.intel.com


Cheers Chad.

Seems like I would need an extra harddrive to get the Android build
running. This thing is a crazy, it ate 30GiB like it was nothing and
asks for more :)


And after you acquire sufficient space, you will then need to wait for
hours. If you're lucky, your build will succeed on the first try and
you won't need to restart with a clean build :)

I once attended an hour long presentation at a technical conference whose
sole purpose was to explain how to get Android to build faster. The main
message was Buy a machine with 32-64GB of RAM, and put it all into ramfs.




Adrian, do wish to test this series on Android?


Adrian, if you can give this patch a test that would be greatly appreciated.


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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Ian Romanick
On 11/05/2013 09:44 AM, Chris Forbes wrote:
 So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...
 
 My understanding is you can't actually, since views can only be
 created from immutable-format textures, and GL_LUMINANCE is not a
 sized internalformat, so it can't be used with TexStorage?

I was just using GL_LUMINANCE as shorthand for GL_LUMINANCE4,
GL_LUMINANCE8, GL_LUMINANCE12, and GL_LUMINANCE16.  As far as I can tell,

glGenTextures(1, tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexStorage2D(GL_TEXTURE_2D,
8,
GL_LUMINANCE8,
1024, 1024);

is perfectly valid.  Sayeth GL_ARB_texture_storage:

Accepted by the internalformat parameter of TexStorage* when
implemented on OpenGL ES:

ALPHA8_EXT 0x803C
LUMINANCE8_EXT 0x8040
LUMINANCE8_ALPHA8_EXT  0x8045

I guess that means GL_LUMINANCE4, GL_LUMINANCE12, and GL_LUMINANCE16 are
out.  As are all GL_INTENSITY formats.  There are still these three
legacy formats to handle.

So, if we support GL_ARB_texture_view in a compatibility profile,

glGenTextures(1, view);
glTextureView(view,
GL_TEXTURE_2D,
tex,
GL_LUMINANCE8,
1, 1, 1, 1);

is also valid.

Right?

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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Courtney Goeltzenleuchter
On Tue, Nov 5, 2013 at 12:22 PM, Ian Romanick i...@freedesktop.org wrote:

 On 11/05/2013 09:44 AM, Chris Forbes wrote:
  So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.
  Hmm...
 
  My understanding is you can't actually, since views can only be
  created from immutable-format textures, and GL_LUMINANCE is not a
  sized internalformat, so it can't be used with TexStorage?

 I was just using GL_LUMINANCE as shorthand for GL_LUMINANCE4,
 GL_LUMINANCE8, GL_LUMINANCE12, and GL_LUMINANCE16.  As far as I can tell,

 glGenTextures(1, tex);
 glBindTexture(GL_TEXTURE_2D, tex);
 glTexStorage2D(GL_TEXTURE_2D,
 8,
 GL_LUMINANCE8,
 1024, 1024);

 is perfectly valid.  Sayeth GL_ARB_texture_storage:

 Accepted by the internalformat parameter of TexStorage* when
 implemented on OpenGL ES:

 ALPHA8_EXT 0x803C
 LUMINANCE8_EXT 0x8040
 LUMINANCE8_ALPHA8_EXT  0x8045

 I guess that means GL_LUMINANCE4, GL_LUMINANCE12, and GL_LUMINANCE16 are
 out.  As are all GL_INTENSITY formats.  There are still these three
 legacy formats to handle.

 So, if we support GL_ARB_texture_view in a compatibility profile,

 glGenTextures(1, view);
 glTextureView(view,
 GL_TEXTURE_2D,
 tex,
 GL_LUMINANCE8,
 1, 1, 1, 1);

 is also valid.

 Right?


The spec is pickier than that.  For 8bit texels the allowed internal
formats are:  R8UI, R8I, R8, R8_SNORM
I use the table specified in the ARB_texture_view to translate the target
internalFormat passed to glTextureView into a VIEW_CLASS. GL_LUMINANCE8
does not have a valid VIEW_CLASS and could not match the internal format of
the source texture.

That makes me wonder, should I be trying to map the target internalformat
into a driver internal format?

Courtney


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


Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Eric Anholt
Keith Packard kei...@keithp.com writes:

 Keith Packard kei...@keithp.com writes:

 This sequence first adds a a couple of new DRIimage extensions to the
 dri/common, dri/i915 and dri/i965 directories which define a
 loader-independent API for managing window system operations.

 The last patch adds a new DRI3000 loader using those new interfaces.

 I've figured out that I can also re-use dri2CreateNewScreen2 for the
 image driver bits, as long as I change that function to also look up the
 image loader. That means there are *no* new dri_util functions needed.

 To recap, the changes needed to support using the DRIimageExtension
 interfaces for allocating buffers from the driver in the loader are:

 DRIimageDriverExtension

 A proper subset of DRIdri2DriverExtension, which uses
 the same five functions involved in creating new objects:

/* Common DRI functions, shared with DRI2 */
__DRIcreateNewScreen2createNewScreen2;
__DRIcreateNewDrawable   createNewDrawable;
__DRIcreateNewContextcreateNewContext;
__DRIcreateContextAttribscreateContextAttribs;
__DRIgetAPIMask  getAPIMask;

It seems like we could just stick these things in __DRI_CORE as opposed
to having another new extension to look up.  The downside I see there is
bugs in the server, which have patches at xserver-driinterface-versions
of my tree.  (Unfortunately, I'm having a hard time building the server
currently, so no testing yet).  Having a new extension whose name has
nothing to do with the functions in it seems really weird.

Also, apologies for not having done this myself for my CreateNewScreen2
change.


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


Re: [Mesa-dev] [PATCH] gallivm: optimize lp_build_minify for sse

2013-11-05 Thread Jose Fonseca
Looks great to me

Jose

- Original Message -
 From: Roland Scheidegger srol...@vmware.com
 
 SSE can't handle true vector shifts (with variable shift count),
 so llvm is turning them into a mess of extracts, scalar shifts and inserts.
 It is however possible to emulate them in lp_build_minify with float muls,
 which should be way faster (saves over 20 instructions per 8-wide
 lp_build_minify). This wouldn't work for generic 32bit shifts though
 since we've got only 24bits of mantissa (actually for left shifts it would
 work by using sse41 int mul instead of float mul but not for right shifts).
 Note that this has very limited scope for now, since this is only used with
 per-pixel lod (otherwise we're avoiding the non-constant shift count by doing
 per-quad shifts manually), and only 1d textures even then (though the latter
 should change).
 ---
  src/gallium/auxiliary/gallivm/lp_bld_sample.c |   62
  +
  src/gallium/auxiliary/gallivm/lp_bld_sample.h |3 +-
  src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |2 +-
  3 files changed, 54 insertions(+), 13 deletions(-)
 
 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
 b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
 index a032d9d..e60a035 100644
 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
 +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
 @@ -36,6 +36,7 @@
  #include pipe/p_state.h
  #include util/u_format.h
  #include util/u_math.h
 +#include util/u_cpu_detect.h
  #include lp_bld_arit.h
  #include lp_bld_const.h
  #include lp_bld_debug.h
 @@ -248,7 +249,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
 first_level = bld-dynamic_state-first_level(bld-dynamic_state,
   bld-gallivm,
   texture_unit);
 first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
 -   int_size = lp_build_minify(int_size_bld, bld-int_size, first_level_vec);
 +   int_size = lp_build_minify(int_size_bld, bld-int_size, first_level_vec,
 TRUE);
 float_size = lp_build_int_to_float(float_size_bld, int_size);
  
 if (cube_rho) {
 @@ -1089,12 +1090,14 @@ lp_build_get_mip_offsets(struct
 lp_build_sample_context *bld,
  
  /**
   * Codegen equivalent for u_minify().
 + * @param lod_scalar  if lod is a (broadcasted) scalar
   * Return max(1, base_size  level);
   */
  LLVMValueRef
  lp_build_minify(struct lp_build_context *bld,
  LLVMValueRef base_size,
 -LLVMValueRef level)
 +LLVMValueRef level,
 +boolean lod_scalar)
  {
 LLVMBuilderRef builder = bld-gallivm-builder;
 assert(lp_check_value(bld-type, base_size));
 @@ -1105,10 +1108,49 @@ lp_build_minify(struct lp_build_context *bld,
return base_size;
 }
 else {
 -  LLVMValueRef size =
 - LLVMBuildLShr(builder, base_size, level, minify);
 +  LLVMValueRef size;
assert(bld-type.sign);
 -  size = lp_build_max(bld, size, bld-one);
 +  if (lod_scalar ||
 + (util_cpu_caps.has_avx2 || !util_cpu_caps.has_sse)) {
 + size = LLVMBuildLShr(builder, base_size, level, minify);
 + size = lp_build_max(bld, size, bld-one);
 +  }
 +  else {
 + /*
 +  * emulate shift with float mul, since intel forgot shifts with
 +  * per-element shift count until avx2, which results in terrible
 +  * scalar extraction (both count and value), scalar shift,
 +  * vector reinsertion. Should not be an issue on any non-x86 cpu
 +  * with a vector instruction set.
 +  * On cpus with AMD's XOP this should also be unnecessary but I'm
 +  * not sure if llvm would emit this with current flags.
 +  */
 + LLVMValueRef const127, const23, lf;
 + struct lp_type ftype;
 + struct lp_build_context fbld;
 + ftype = lp_type_float_vec(32, bld-type.length * bld-type.width);
 + lp_build_context_init(fbld, bld-gallivm, ftype);
 + const127 = lp_build_const_int_vec(bld-gallivm, bld-type, 127);
 + const23 = lp_build_const_int_vec(bld-gallivm, bld-type, 23);
 +
 + /* calculate 2^(-level) float */
 + lf = lp_build_sub(bld, const127, level);
 + lf = lp_build_shl(bld, lf, const23);
 + lf = LLVMBuildBitCast(builder, lf, fbld.vec_type, );
 +
 + /* finish shift operation by doing float mul */
 + base_size = lp_build_int_to_float(fbld, base_size);
 + size = lp_build_mul(fbld, base_size, lf);
 + /*
 +  * do the max also with floats because
 +  * a) non-emulated int max requires sse41
 +  *(this is actually a lie as we could cast to 16bit values
 +  *as 16bit is sufficient and 16bit int max is sse2)
 +  * b) with avx we can do int max 4-wide but float max 8-wide
 +  */
 + size = lp_build_max(fbld, size, fbld.one);
 +  

Re: [Mesa-dev] [PATCH] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Chris Forbes
Unfortunate :(

Is the bad behavior from violating this restriction observable?

In any case, Reviewed-by: Chris Forbes chr...@ijw.co.nz

On Wed, Nov 6, 2013 at 7:43 AM, Eric Anholt e...@anholt.net wrote:
 Paul Berry stereotype...@gmail.com writes:

 Hardware docs say we can only use SIMD8 dispatch in this condition.

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

 ___
 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] clover: mark gcc 4.7.3 as broken

2013-11-05 Thread David Heidelberger
---
 configure.ac | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index dc15ad4..20b1769 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,7 @@ if test x$GCC = xyes -a x$acv_mesa_CLANG = xno; then
 if test $? -eq 0; then
 GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
 GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
+GCC_VERSION_MAINTANANCE=`echo $GCC_VERSION | cut -d. -f3`
 fi
 
 if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a 
$GCC_VERSION_MINOR -lt 3 ; then
@@ -1371,8 +1372,10 @@ if test x$enable_opencl = xyes; then
 AC_MSG_ERROR([cannot enable OpenCL without Gallium])
 fi
 
-if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a 
$GCC_VERSION_MINOR -lt 7; then
-AC_MSG_ERROR([gcc = 4.7 is required to build clover])
+if test $GCC_VERSION_MAJOR -lt 4 -o \
+$GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7 -o \
+$GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -eq 7 -a 
$GCC_VERSION_MAINTANANCE -lt 4; then
+AC_MSG_ERROR([gcc = 4.7.1 is required to build clover])
 fi
 
 if test x$have_libclc = xno; then
-- 
1.8.4

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


Re: [Mesa-dev] [PATCH 3/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Andreas Boll
I think we could simplify this a bit.

2013/11/5 Fabio Pedretti fabio@libero.it:
 From: Aurelien Jarno aure...@debian.org
 From: Cyril Brulebois k...@debian.org

 mesa fails to build on GNU/kFreeBSD, since some parts are not enabled.

 Debian bug: http://bugs.debian.org/524690

 Patch from Debian package
 ---
  configure.ac | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/configure.ac b/configure.ac
 index 0a25047..e250734 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -425,7 +425,7 @@ if test x$enable_asm = xyes; then
  case $host_cpu in
  i?86)
  case $host_os in
 -linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
 +linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | 
 kfreebsd*-gnu*)
*freebsd* already includes kfreebsd*-gnu*

  test x$enable_64bit = xyes  asm_arch=x86_64 || asm_arch=x86
  ;;
  gnu*)
 @@ -435,7 +435,7 @@ if test x$enable_asm = xyes; then
  ;;
  x86_64|amd64)
  case $host_os in
 -linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
 +linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | 
 kfreebsd*-gnu*)
same as above

  test x$enable_32bit = xyes  asm_arch=x86 || asm_arch=x86_64
  ;;
  esac
 @@ -974,7 +974,7 @@ if test x$enable_dri = xyes; then
  ;;
  esac
  ;;
 -freebsd* | dragonfly* | *netbsd* | openbsd*)
 +freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)

To be consistent we could use *freebsd* as well.

Andreas.

  DEFINES=$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1
  DEFINES=$DEFINES -DHAVE_ALIAS

 --
 1.8.3.2

 ___
 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] mesa: Add API debug logging to TexStorage

2013-11-05 Thread Courtney Goeltzenleuchter
Give glTexStorage* equivalent debug logging to glTexImage*.

Signed-off-by: Courtney Goeltzenleuchter court...@lunarg.com
---
 src/mesa/main/texstorage.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 7bd8652..84b8f82 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -365,6 +365,13 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
 
GET_CURRENT_CONTEXT(ctx);
 
+   if (MESA_VERBOSE  (VERBOSE_API|VERBOSE_TEXTURE))
+  _mesa_debug(ctx, glTexStorage%uD %s %d %s %d %d %d\n,
+  dims,
+  _mesa_lookup_enum_by_nr(target), levels,
+  _mesa_lookup_enum_by_nr(internalformat),
+  width, height, depth);
+
if (tex_storage_error_check(ctx, dims, target, levels,
internalformat, width, height, depth)) {
   return; /* error was recorded */
-- 
1.8.1.2

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


Re: [Mesa-dev] [v2 5/6] glsl: functions to serialize gl_shader and gl_shader_program

2013-11-05 Thread Paul Berry
On 1 November 2013 02:16, Tapani Pälli tapani.pa...@intel.com wrote:

 These utility functions can be used to (de)serialize gl_shader and
 gl_shader_program structures. This makes it possible to implement a
 shader compiler cache for individual shaders and functionality required
 by OES_get_program_binary extension.

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/glsl/Makefile.sources |   1 +
  src/glsl/ir_cache.cpp | 373
 ++
  src/glsl/ir_cache.h   |  58 +++
  3 files changed, 432 insertions(+)
  create mode 100644 src/glsl/ir_cache.cpp
  create mode 100644 src/glsl/ir_cache.h

 diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
 index 81d5753..99b3c1a 100644
 --- a/src/glsl/Makefile.sources
 +++ b/src/glsl/Makefile.sources
 @@ -30,6 +30,7 @@ LIBGLSL_FILES = \
 $(GLSL_SRCDIR)/hir_field_selection.cpp \
 $(GLSL_SRCDIR)/ir_basic_block.cpp \
 $(GLSL_SRCDIR)/ir_builder.cpp \
 +   $(GLSL_SRCDIR)/ir_cache.cpp \
 $(GLSL_SRCDIR)/ir_cache_serializer.cpp \
 $(GLSL_SRCDIR)/ir_cache_deserializer.cpp \
 $(GLSL_SRCDIR)/ir_clone.cpp \
 diff --git a/src/glsl/ir_cache.cpp b/src/glsl/ir_cache.cpp
 new file mode 100644
 index 000..24e1c77
 --- /dev/null
 +++ b/src/glsl/ir_cache.cpp
 @@ -0,0 +1,373 @@
 +/* -*- c++ -*- */
 +/*
 + * Copyright © 2013 Intel Corporation
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining a
 + * copy of this software and associated documentation files (the
 Software),
 + * to deal in the Software without restriction, including without
 limitation
 + * the rights to use, copy, modify, merge, publish, distribute,
 sublicense,
 + * and/or sell copies of the Software, and to permit persons to whom the
 + * Software is furnished to do so, subject to the following conditions:
 + *
 + * The above copyright notice and this permission notice (including the
 next
 + * paragraph) shall be included in all copies or substantial portions of
 the
 + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR
 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY,
 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
 SHALL
 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 OTHER
 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 + * DEALINGS IN THE SOFTWARE.
 + */
 +
 +#include main/shaderobj.h
 +#include main/uniforms.h
 +#include main/macros.h
 +
 +#include ir_cache_serializer.h
 +#include ir_cache_deserializer.h
 +
 +/**
 + * Serialize gl_shader structure
 + */
 +extern C char *
 +_mesa_shader_serialize(struct gl_shader *shader,
 +   struct _mesa_glsl_parse_state *state,
 +   const char *mesa_sha, size_t *size)
 +{
 +   ir_serializer s;
 +   return s.serialize(shader, state, mesa_sha, size);
 +}
 +
 +
 +static void
 +calc_item(const void *key, void *data, void *closure)


How about increment_count for the name of this function?


 +{
 +   unsigned *sz = (unsigned *) closure;
 +   *sz = *sz + 1;
 +}
 +
 +
 +static unsigned
 +_hash_table_size(struct string_to_uint_map *map)


This function is global, so its name can't start with an underscore--such
names are reserved for library functions.  Same goes for many of the other
functions in this file.


 +{
 +   unsigned size = 0;
 +   map-iterate(calc_item, size);
 +   return size;
 +}
 +
 +
 +static void
 +serialize_item(const void *key, void *data, void *closure)
 +{
 +   memory_writer *blob = (memory_writer *) closure;
 +   uint32_t value = ((intptr_t)data);
 +
 +   blob-write_string((char *)key);
 +   blob-write_uint32(value);
 +}
 +
 +
 +static void
 +_serialize_hash_table(struct string_to_uint_map *map, memory_writer *blob)
 +{
 +   uint32_t size = _hash_table_size(map);
 +   blob-write_uint32(size);
 +   map-iterate(serialize_item, blob);


Rather than take two passes over the hash table (one to compute its size
and one to output its contents), why not do the trick that we do with
overwrite() in ir_cache_serializer.cpp?  (In other words, reserve space for
the size of the hashtable in bytes, then serialize the hashtable, then
overwrite the reserved space with the actual size).


 +}
 +
 +
 +static void
 +_serialize_uniform_storage(gl_uniform_storage *uni, memory_writer blob)
 +{
 +   blob.write_string(uni-name);
 +
 +   save_glsl_type(blob, uni-type);
 +
 +   uint8_t initialized = uni-initialized;
 +   uint8_t row_major = uni-row_major;
 +
 +   blob.write_uint32(uni-array_elements);
 +   blob.write_uint8(initialized);
 +   blob.write_int32(uni-block_index);
 +   blob.write_int32(uni-offset);
 +   blob.write_int32(uni-matrix_stride);
 +   blob.write_uint8(row_major);
 +   blob.write_int32(uni-atomic_buffer_index);
 +
 +   for (unsigned i = 0; i  MESA_SHADER_TYPES; i++) {
 +  uint8_t active = 

Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Kristian Høgsberg
On Tue, Nov 05, 2013 at 12:04:32PM -0800, Eric Anholt wrote:
 Keith Packard kei...@keithp.com writes:
 
  Keith Packard kei...@keithp.com writes:
 
  This sequence first adds a a couple of new DRIimage extensions to the
  dri/common, dri/i915 and dri/i965 directories which define a
  loader-independent API for managing window system operations.
 
  The last patch adds a new DRI3000 loader using those new interfaces.
 
  I've figured out that I can also re-use dri2CreateNewScreen2 for the
  image driver bits, as long as I change that function to also look up the
  image loader. That means there are *no* new dri_util functions needed.
 
  To recap, the changes needed to support using the DRIimageExtension
  interfaces for allocating buffers from the driver in the loader are:
 
  DRIimageDriverExtension
 
  A proper subset of DRIdri2DriverExtension, which uses
  the same five functions involved in creating new objects:
 
 /* Common DRI functions, shared with DRI2 */
 __DRIcreateNewScreen2createNewScreen2;
 __DRIcreateNewDrawable   createNewDrawable;
 __DRIcreateNewContextcreateNewContext;
 __DRIcreateContextAttribscreateContextAttribs;
 __DRIgetAPIMask  getAPIMask;
 
 It seems like we could just stick these things in __DRI_CORE as opposed
 to having another new extension to look up.  The downside I see there is
 bugs in the server, which have patches at xserver-driinterface-versions
 of my tree.  (Unfortunately, I'm having a hard time building the server
 currently, so no testing yet).  Having a new extension whose name has
 nothing to do with the functions in it seems really weird.

It may make more sense to just extend the existing interfaces, but
when we discussed DRIimageDriverExtension, the idea was that we could
phase out DRIdri2Extension.  I think that still makes sense but
introducing more extensions doesn't make this interface better.

The way this was done originally was that we have DRIcoreExtension
which provided DRI1 support.  The DRIdri2Extension extension replaces
some of the core functions (it has a createNewScreen that doesn't take
a sarea handle, for example...) and allows a loader to implement DRI2,
but you have to use both extensions.  DRIswrastExtension works in a
similar for swrast.

The idea was to share the core functionality, but it's obviously messy
to have to mix two extensions to get things working.  If we're
introducing a new extension, I'd suggest we move the functions from
DRIcoreExtension that we still use into this new extension and make it
completely replace DRIcoreExtension and DRIdri2Extension.  The
functions from the core extension we still use are:

void (*destroyScreen)(__DRIscreen *screen);

const __DRIextension **(*getExtensions)(__DRIscreen *screen);

int (*getConfigAttrib)(const __DRIconfig *config,
   unsigned int attrib,
   unsigned int *value);

int (*indexConfigAttrib)(const __DRIconfig *config, int index,
 unsigned int *attrib, unsigned int *value);

void (*destroyDrawable)(__DRIdrawable *drawable);

int (*copyContext)(__DRIcontext *dest,
   __DRIcontext *src,
   unsigned long mask);

void (*destroyContext)(__DRIcontext *context);

int (*bindContext)(__DRIcontext *ctx,
   __DRIdrawable *pdraw,
   __DRIdrawable *pread);

int (*unbindContext)(__DRIcontext *ctx);

and if we add those to DRIimageDriverExtension the loader only needs
to look for that and the DRIimage extension.  Of course, the
implementation is already in dri_util.c, we just need to set the
function pointers to the DRIcoreExtension functions we share.

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


Re: [Mesa-dev] [v2 6/6] mesa: OES_get_program_binary functionality

2013-11-05 Thread Paul Berry
On 1 November 2013 05:08, Tapani Pälli tapani.pa...@intel.com wrote:

 On 11/01/2013 12:38 PM, Erik Faye-Lund wrote:

 On Fri, Nov 1, 2013 at 11:35 AM, Tapani Pälli tapani.pa...@intel.com
 wrote:

 On 11/01/2013 12:21 PM, Erik Faye-Lund wrote:


 Won't using the git-sha1 as a compatibility-criteria cause issues for
 developers with local changes? I'm not so worried about this for
 OES_get_program_binary itself, but once the shader-cache is in place
 it sounds like a potential source of difficult to track down
 misbehavior...


 I agree it might be too aggressive criteria but it is hard to come up
 with
 better and as simple.

 That's not my objection. My objection is that this might give
 headaches for people with local modifications to the glsl-compiler.
 Local modifications does not affect the git-sha1.


 For the automatic shader cache this headache could be helped a bit with a
 environment variable or drirc setting that can be used during development.
 On the other hand an automatic cache must work in a transparent way so it
 should be always able to recover when it fails, so one should only see it
 as 'slower than usual' (since recompilation/relink required) sort of
 behaviour. The WIP of the automatic cache I sent some time earlier also
 marked (renamed) these 'problematic' cached shaders so that they can be
 detected on further runs and cache can ignore those.

 I agree that it might become problematic, on the other hand it is also
 easy to just wipe ~/.cache/mesa and disable cache. Not sure if Nvidia or
 Imagination try to handles these cases with their cache implementations.


I'm also concerned about this, especially for the automatic shader cache.
During development, we frequently make small changes to the front end,
recompile, and then run a small test program, expecting our changes to take
effect.  I'm very worried about requiring developers to remember to set an
environment variable, change a drirc setting, or wipe out a cache when
making changes that haven't been committed yet.  Especially when the
consequence of forgetting to do so is that the change you were trying to
make won't have any observed effect.  That's the sort of thing that leads
people to spend hours chasing phantom bugs.

How about if we have the cache mechanism include the modification time of
the mesa .so in the shader binary (in addition to the sha), and reject
shader binaries that don't have a matching modification time?  That way if
mesa is recompiled, any previously-cached shaders will automatically become
invalid without the developer having to do any work.


A related concern I have is: what happens if someone changes their video
card, or transplants their hard drive into a different machine that has
different graphics hardware?  Different back-ends have different settings
of ctx-ShaderCompilerOptions (some back-ends have different values from
one chipset to another), so even if the version of Mesa is the same and
there are no local developer changes, the linked IR is not going to
necessarily be the same if the graphics hardware changes.

To address this, I'd recommend that we also include the device's PCI ID in
the shader binary, and reject mismatched binaries.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/11] mesa: Restore gl_array_object::NewArray

2013-11-05 Thread Fredrik Höglund
This will be used by the ARB_vertex_attrib_binding implementation.
This reverts commit db38e9a0e179441f59274f6f2a751912c29872e2.

Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/enable.c |2 ++
 src/mesa/main/mtypes.h |3 +++
 src/mesa/main/state.c  |1 +
 src/mesa/main/varray.c |4 
 4 files changed, 10 insertions(+)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index dd6a772..c047f5d 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -135,6 +135,8 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean 
state)
else
   arrayObj-_Enabled = ~flag;
 
+   arrayObj-NewArrays |= flag;
+
if (ctx-Driver.Enable) {
   ctx-Driver.Enable( ctx, cap, state );
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b5c5583..500f670 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1513,6 +1513,9 @@ struct gl_array_object
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
GLbitfield64 _Enabled;
 
+   /** Mask of VERT_BIT_* values indicating changed/dirty arrays */
+   GLbitfield64 NewArrays;
+
/**
 * Min of all enabled arrays' _MaxElement.  When arrays reside inside VBOs
 * we can determine the max legal (in bounds) glDrawElements array index.
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 2392641..bf21631 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -430,6 +430,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
new_state = ctx-NewState | new_prog_state;
ctx-NewState = 0;
ctx-Driver.UpdateState(ctx, new_state);
+   ctx-Array.ArrayObj-NewArrays = 0x0;
 }
 
 
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index dee476a..24cd324 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -286,6 +286,7 @@ update_array(struct gl_context *ctx,
  ctx-Array.ArrayBufferObj);
 
ctx-NewState |= _NEW_ARRAY;
+   ctx-Array.ArrayObj-NewArrays |= VERT_BIT(attrib);
 }
 
 
@@ -537,6 +538,7 @@ _mesa_EnableVertexAttribArray(GLuint index)
   FLUSH_VERTICES(ctx, _NEW_ARRAY);
   arrayObj-VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
   arrayObj-_Enabled |= VERT_BIT_GENERIC(index);
+  arrayObj-NewArrays |= VERT_BIT_GENERIC(index);
}
 }
 
@@ -562,6 +564,7 @@ _mesa_DisableVertexAttribArray(GLuint index)
   FLUSH_VERTICES(ctx, _NEW_ARRAY);
   arrayObj-VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE;
   arrayObj-_Enabled = ~VERT_BIT_GENERIC(index);
+  arrayObj-NewArrays |= VERT_BIT_GENERIC(index);
}
 }
 
@@ -1161,6 +1164,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
if (array-InstanceDivisor != divisor) {
   FLUSH_VERTICES(ctx, _NEW_ARRAY);
   array-InstanceDivisor = divisor;
+  ctx-Array.ArrayObj-NewArrays |= VERT_BIT(VERT_ATTRIB_GENERIC(index));
}
 }
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 10/11] mesa: Enable ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
---
 src/mesa/main/extensions.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 48c4e9f..0815eec 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -165,6 +165,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_uniform_buffer_object,   
o(ARB_uniform_buffer_object),   GL, 2009 },
{ GL_ARB_vertex_array_bgra,   o(EXT_vertex_array_bgra),   
GL, 2008 },
{ GL_ARB_vertex_array_object, o(dummy_true),  
GL, 2006 },
+   { GL_ARB_vertex_attrib_binding,   o(dummy_true),  
GL, 2012 },
{ GL_ARB_vertex_buffer_object,o(dummy_true),  
GLL,2003 },
{ GL_ARB_vertex_program,  o(ARB_vertex_program),  
GLL,2002 },
{ GL_ARB_vertex_shader,   o(ARB_vertex_shader),   
GL, 2002 },
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 07/11] mesa: Add Get* support for ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/get.c  |   24 
 src/mesa/main/get_hash_params.py |4 
 src/mesa/main/varray.c   |   10 ++
 3 files changed, 38 insertions(+)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index a0dd7cf..eee8550 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1740,6 +1740,30 @@ find_value_indexed(const char *func, GLenum pname, 
GLuint index, union value *v)
  goto invalid_value;
   v-value_int64 = ctx-AtomicBufferBindings[index].Size;
   return TYPE_INT64;
+
+   case GL_VERTEX_BINDING_DIVISOR:
+  if (!_mesa_is_desktop_gl(ctx) || !ctx-Extensions.ARB_instanced_arrays)
+  goto invalid_enum;
+  if (index = ctx-Const.VertexProgram.MaxAttribs)
+  goto invalid_value;
+  v-value_int = 
ctx-Array.ArrayObj-VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
+  return TYPE_INT;
+
+   case GL_VERTEX_BINDING_OFFSET:
+  if (!_mesa_is_desktop_gl(ctx))
+  goto invalid_enum;
+  if (index = ctx-Const.VertexProgram.MaxAttribs)
+  goto invalid_value;
+  v-value_int = 
ctx-Array.ArrayObj-VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
+  return TYPE_INT;
+
+   case GL_VERTEX_BINDING_STRIDE:
+  if (!_mesa_is_desktop_gl(ctx))
+  goto invalid_enum;
+  if (index = ctx-Const.VertexProgram.MaxAttribs)
+  goto invalid_value;
+  v-value_int = 
ctx-Array.ArrayObj-VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
+  return TYPE_INT;
}
 
  invalid_enum:
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 5ecfbbc..c961fee 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -737,6 +737,10 @@ descriptor=[
   [ MAX_GEOMETRY_ATOMIC_COUNTERS, 
CONTEXT_INT(Const.GeometryProgram.MaxAtomicCounters), 
extra_ARB_shader_atomic_counters_and_geometry_shader ],
   [ MAX_COMBINED_ATOMIC_COUNTER_BUFFERS, 
CONTEXT_INT(Const.MaxCombinedAtomicBuffers), extra_ARB_shader_atomic_counters 
],
   [ MAX_COMBINED_ATOMIC_COUNTERS, 
CONTEXT_INT(Const.MaxCombinedAtomicCounters), 
extra_ARB_shader_atomic_counters ],
+
+# GL_ARB_vertex_attrib_binding
+  [ MAX_VERTEX_ATTRIB_RELATIVE_OFFSET, 
CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA ],
+  [ MAX_VERTEX_ATTRIB_BINDINGS, 
CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA ],
 ]},
 
 # Enums restricted to OpenGL Core profile
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b0e0286..39e5ad3 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -747,6 +747,16 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint 
index, GLenum pname,
  return arrayObj-VertexBinding[array-VertexBinding].InstanceDivisor;
   }
   goto error;
+   case GL_VERTEX_ATTRIB_BINDING:
+  if (_mesa_is_desktop_gl(ctx)) {
+ return array-VertexBinding - VERT_ATTRIB_GENERIC0;
+  }
+  goto error;
+   case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
+  if (_mesa_is_desktop_gl(ctx)) {
+ return array-RelativeOffset;
+  }
+  goto error;
default:
   ; /* fall-through */
}
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 00/11] Implement GL_ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
So here's ARB_vertex_attrib_binding, take two.

This incorporates all the feedback from Eric and Ian.

Patches 6, 7, and 8 in the previous series have now been squashed into
patch 5.  This is unfortunate, since patch 5 was already larger than
I would have liked, but unfortunately it's necessary to avoid piglit
regressions between patches 5 and 8.

This series is also available at:

git://people.freedesktop.org/~fredrik/mesa arb-vertex-attrib-binding-2

Fredrik

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


[Mesa-dev] [PATCH 05/11] glapi: Add infrastructure for ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml |   58 ++
 src/mapi/glapi/gen/Makefile.am   |1 +
 src/mapi/glapi/gen/gl_API.xml|6 ++-
 src/mesa/main/tests/dispatch_sanity.cpp  |   12 ++---
 src/mesa/main/varray.c   |   43 
 src/mesa/main/varray.h   |   23 +
 6 files changed, 136 insertions(+), 7 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml

diff --git a/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml 
b/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
new file mode 100644
index 000..0ee6a3c
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
@@ -0,0 +1,58 @@
+?xml version=1.0?
+!DOCTYPE OpenGLAPI SYSTEM gl_API.dtd
+
+!-- Note: no GLX protocol info yet. --
+
+OpenGLAPI
+
+category name=GL_ARB_vertex_attrib_binding number=125
+
+function name=BindVertexBuffer offset=assign
+param name=bindingindex type=GLuint/
+param name=buffer type=GLuint/
+param name=offset type=GLintptr/
+param name=stride type=GLsizei/
+/function
+
+function name=VertexAttribFormat offset=assign
+param name=attribindex type=GLuint/
+param name=size type=GLint/
+param name=type type=GLenum/
+param name=normalized type=GLboolean/
+param name=relativeoffset type=GLuint/
+/function
+
+function name=VertexAttribIFormat offset=assign
+param name=attribindex type=GLuint/
+param name=size type=GLint/
+param name=type type=GLenum/
+param name=relativeoffset type=GLuint/
+/function
+
+function name=VertexAttribLFormat offset=assign
+param name=attribindex type=GLuint/
+param name=size type=GLint/
+param name=type type=GLenum/
+param name=relativeoffset type=GLuint/
+/function
+
+function name=VertexAttribBinding offset=assign
+param name=attribindex type=GLuint/
+param name=bindingindex type=GLuint/
+/function
+
+function name=VertexBindingDivisor offset=assign
+param name=attribindex type=GLuint/
+param name=divisor type=GLuint/
+/function
+
+enum name=VERTEX_ATTRIB_BINDING value=0x82D4/
+enum name=VERTEX_ATTRIB_RELATIVE_OFFSET value=0x82D5/
+enum name=VERTEX_BINDING_DIVISOR value=0x82D6/
+enum name=VERTEX_BINDING_OFFSET value=0x82D7/
+enum name=VERTEX_BINDING_STRIDE value=0x82D8/
+enum name=MAX_VERTEX_ATTRIB_RELATIVE_OFFSET value=0x82D9/
+enum name=MAX_VERTEX_ATTRIB_BINDINGS value=0x82DA/
+
+/category
+/OpenGLAPI
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index cbbf659..9c25387 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -125,6 +125,7 @@ API_XML = \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
ARB_vertex_array_object.xml \
+   ARB_vertex_attrib_binding.xml \
AMD_draw_buffers_blend.xml \
AMD_performance_monitor.xml \
ARB_vertex_type_2_10_10_10_rev.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 69014c5..a2d914a 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8458,7 +8458,11 @@
 
 /category
 
-!-- ARB extensions #120...#126 --
+!-- ARB extensions #120...#124 --
+
+xi:include href=ARB_vertex_attrib_binding.xml 
xmlns:xi=http://www.w3.org/2001/XInclude/
+
+!-- ARB extension #126 --
 
 xi:include href=ARB_ES3_compatibility.xml 
xmlns:xi=http://www.w3.org/2001/XInclude/
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 58cff9b..922f0ac 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -854,12 +854,12 @@ const struct function gl_core_functions_possible[] = {
 // { glDispatchComputeIndirect, 43, -1 }, // XXX: Add to xml
 // { glCopyImageSubData, 43, -1 },// XXX: Add to xml
 // { glTextureView, 43, -1 }, // XXX: Add to xml
-// { glBindVertexBuffer, 43, -1 },// XXX: Add to xml
-// { glVertexAttribFormat, 43, -1 },  // XXX: Add to xml
-// { glVertexAttribIFormat, 43, -1 }, // XXX: Add to xml
-// { glVertexAttribLFormat, 43, -1 }, // XXX: Add to xml
-// { glVertexAttribBinding, 43, -1 }, // XXX: Add to xml
-// { glVertexBindingDivisor, 43, -1 },// XXX: Add to xml
+   { glBindVertexBuffer, 43, -1 },
+   { glVertexAttribFormat, 43, -1 },
+   { glVertexAttribIFormat, 43, -1 },
+   { glVertexAttribLFormat, 43, -1 },
+   { glVertexAttribBinding, 43, -1 },
+   { glVertexBindingDivisor, 43, -1 },
 // { glVertexArrayBindVertexBufferEXT, 43, -1 },  // 

[Mesa-dev] [PATCH 09/11] mesa: Optimize rebinding the same VBO

2013-11-05 Thread Fredrik Höglund
Check if the new buffer object has the same name as the current
buffer object before looking it up.

Reviewed-by: Eric Anholt e...@anholt.net
---
 src/mesa/main/varray.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 39e5ad3..1025d67 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1351,9 +1351,10 @@ void GLAPIENTRY
 _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
GLsizei stride)
 {
+   GET_CURRENT_CONTEXT(ctx);
+   const struct gl_array_object *arrayObj = ctx-Array.ArrayObj;
struct gl_buffer_object *vbo;
 
-   GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
 
/* The ARB_vertex_attrib_binding spec says:
@@ -1398,7 +1399,9 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint 
buffer, GLintptr offset,
   return;
}
 
-   if (buffer != 0) {
+   if (buffer == 
arrayObj-VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj-Name) {
+  vbo = 
arrayObj-VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj;
+   } else if (buffer != 0) {
   vbo = _mesa_lookup_bufferobj(ctx, buffer);
 
   /* From the GL_ARB_vertex_attrib_array spec:
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 08/11] mesa: Handle zero-stride arrays in _mesa_update_array_max_element()

2013-11-05 Thread Fredrik Höglund
Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/varray.h |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index a75cb7d..8a9487c 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -51,8 +51,10 @@ _mesa_update_array_max_element(struct gl_client_array *array)
   GLsizeiptrARB bufSize = (GLsizeiptrARB) array-BufferObj-Size;
 
   if (offset  bufSize) {
-array-_MaxElement = (bufSize - offset + array-StrideB
-   - array-_ElementSize) / array-StrideB;
+ const GLuint stride = array-StrideB ?
+ array-StrideB : array-_ElementSize;
+ array-_MaxElement = (bufSize - offset + stride
+  - array-_ElementSize) / stride;
   }
   else {
 array-_MaxElement = 0;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 03/11] mesa: Rename gl_array_object::VertexAttrib to _VertexAttrib

2013-11-05 Thread Fredrik Höglund
This will become derived state as part of the ARB_vertex_attrib_binding
support.

Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/api_arrayelt.c |   36 ++---
 src/mesa/main/api_validate.c |6 ++--
 src/mesa/main/arrayobj.c |   26 +++
 src/mesa/main/attrib.c   |4 +--
 src/mesa/main/bufferobj.c|4 +--
 src/mesa/main/enable.c   |   36 ++---
 src/mesa/main/ffvertex_prog.c|2 +-
 src/mesa/main/get.c  |6 ++--
 src/mesa/main/get_hash_params.py |   66 +++---
 src/mesa/main/getstring.c|   18 +--
 src/mesa/main/mtypes.h   |2 +-
 src/mesa/main/varray.c   |   50 ++---
 src/mesa/vbo/vbo_exec_array.c|   12 +++
 13 files changed, 134 insertions(+), 134 deletions(-)

diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index ea09238..5a316f0 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1486,45 +1486,45 @@ _ae_update_state(struct gl_context *ctx)
actx-nr_vbos = 0;
 
/* conventional vertex arrays */
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
   aa-offset = IndexFuncs[TYPE_IDX(aa-array-Type)];
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_EDGEFLAG];
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_EDGEFLAG];
   aa-offset = _gloffset_EdgeFlagv;
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_NORMAL];
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_NORMAL];
   aa-offset = NormalFuncs[TYPE_IDX(aa-array-Type)];
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_COLOR0];
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_COLOR0];
   aa-offset = ColorFuncs[aa-array-Size-3][TYPE_IDX(aa-array-Type)];
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_COLOR1];
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_COLOR1];
   aa-offset = SecondaryColorFuncs[TYPE_IDX(aa-array-Type)];
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_FOG];
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_FOG];
   aa-offset = FogCoordFuncs[TYPE_IDX(aa-array-Type)];
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
for (i = 0; i  ctx-Const.MaxTextureCoordUnits; i++) {
   struct gl_client_array *attribArray =
- arrayObj-VertexAttrib[VERT_ATTRIB_TEX(i)];
+ arrayObj-_VertexAttrib[VERT_ATTRIB_TEX(i)];
   if (attribArray-Enabled) {
  /* NOTE: we use generic glVertexAttribNV functions here.
   * If we ever remove GL_NV_vertex_program this will have to change.
@@ -1543,7 +1543,7 @@ _ae_update_state(struct gl_context *ctx)
/* generic vertex attribute arrays */
for (i = 1; i  VERT_ATTRIB_GENERIC_MAX; i++) {  /* skip zero! */
   struct gl_client_array *attribArray =
- arrayObj-VertexAttrib[VERT_ATTRIB_GENERIC(i)];
+ arrayObj-_VertexAttrib[VERT_ATTRIB_GENERIC(i)];
   if (attribArray-Enabled) {
  GLint intOrNorm;
  at-array = attribArray;
@@ -1570,18 +1570,18 @@ _ae_update_state(struct gl_context *ctx)
}
 
/* finally, vertex position */
-   if (arrayObj-VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
+   if (arrayObj-_VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
   /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
* issued as the last (provoking) attribute).
*/
-  aa-array = arrayObj-VertexAttrib[VERT_ATTRIB_GENERIC0];
+  aa-array = arrayObj-_VertexAttrib[VERT_ATTRIB_GENERIC0];
   assert(aa-array-Size = 2); /* XXX fix someday? */
   aa-offset = VertexFuncs[aa-array-Size-2][TYPE_IDX(aa-array-Type)];
   check_vbo(actx, aa-array-BufferObj);
   aa++;
}
-   else if 

[Mesa-dev] [PATCH 11/11] docs: Mark ARB_vertex_attrib_binding as done, update relnotes

2013-11-05 Thread Fredrik Höglund
---
 docs/GL3.txt|2 +-
 docs/relnotes/10.0.html |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 03b24ed..c35f014 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -161,7 +161,7 @@ GL_ARB_texture_buffer_range  DONE 
(nv50, nvc0, i965, r60
 GL_ARB_texture_query_levels  DONE (i965)
 GL_ARB_texture_storage_multisample   DONE (all drivers that 
support GL_ARB_texture_multisample)
 GL_ARB_texture_view  not started
-GL_ARB_vertex_attrib_binding started (Fredrik)
+GL_ARB_vertex_attrib_binding DONE (all drivers)
 
 
 GL 4.4:
diff --git a/docs/relnotes/10.0.html b/docs/relnotes/10.0.html
index 5ff5339..82599dd 100644
--- a/docs/relnotes/10.0.html
+++ b/docs/relnotes/10.0.html
@@ -50,6 +50,7 @@ Note: some of the new features are only available with 
certain drivers.
 liGL_ARB_texture_query_levels on i965./li
 liGL_ARB_texture_mirror_clamp_to_edge./li
 liGL_ARB_transform_feedback2, GL_ARB_transform_feedback3, and 
GL_ARB_transform_feedback_instanced on i965/Gen7 (with appropriate kernel 
support)./li
+liGL_ARB_vertex_attrib_binding/li
 liGL_KHR_debug/li
 /ul
 
-- 
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] i965/fs: New peephole optimization to flatten IF/BREAK/ENDIF.

2013-11-05 Thread Paul Berry
On 1 November 2013 17:31, Matt Turner matts...@gmail.com wrote:

 total instructions in shared programs: 1649485 - 1649157 (-0.02%)
 instructions in affected programs: 7823 - 7495 (-4.19%)
 ---
  src/mesa/drivers/dri/i965/Makefile.sources |  1 +
  src/mesa/drivers/dri/i965/brw_fs.cpp   |  1 +
  src/mesa/drivers/dri/i965/brw_fs.h |  1 +
  .../dri/i965/brw_fs_peephole_predicated_break.cpp  | 96
 ++
  4 files changed, 99 insertions(+)
  create mode 100644
 src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp

 diff --git a/src/mesa/drivers/dri/i965/Makefile.sources
 b/src/mesa/drivers/dri/i965/Makefile.sources
 index 14b2f61..fcc6fdb 100644
 --- a/src/mesa/drivers/dri/i965/Makefile.sources
 +++ b/src/mesa/drivers/dri/i965/Makefile.sources
 @@ -59,6 +59,7 @@ i965_FILES = \
 brw_fs_fp.cpp \
 brw_fs_generator.cpp \
 brw_fs_live_variables.cpp \
 +   brw_fs_peephole_predicated_break.cpp \
 brw_fs_reg_allocate.cpp \
 brw_fs_vector_splitting.cpp \
 brw_fs_visitor.cpp \
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 7064910..5c8443f 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -3149,6 +3149,7 @@ fs_visitor::run()
  progress = opt_algebraic() || progress;
  progress = opt_cse() || progress;
  progress = opt_copy_propagate() || progress;
 + progress = opt_peephole_predicated_break() || progress;
  progress = dead_code_eliminate() || progress;
  progress = dead_code_eliminate_local() || progress;
  progress = register_coalesce() || progress;
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
 b/src/mesa/drivers/dri/i965/brw_fs.h
 index 43e4761..09e5174 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.h
 +++ b/src/mesa/drivers/dri/i965/brw_fs.h
 @@ -362,6 +362,7 @@ public:
 bool try_emit_saturate(ir_expression *ir);
 bool try_emit_mad(ir_expression *ir, int mul_arg);
 void try_replace_with_sel();
 +   bool opt_peephole_predicated_break();
 void emit_bool_to_cond_code(ir_rvalue *condition);
 void emit_if_gen6(ir_if *ir);
 void emit_unspill(fs_inst *inst, fs_reg reg, uint32_t spill_offset,
 diff --git
 a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
 new file mode 100644
 index 000..7845113
 --- /dev/null
 +++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
 @@ -0,0 +1,96 @@
 +/*
 + * Copyright © 2013 Intel Corporation
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining a
 + * copy of this software and associated documentation files (the
 Software),
 + * to deal in the Software without restriction, including without
 limitation
 + * the rights to use, copy, modify, merge, publish, distribute,
 sublicense,
 + * and/or sell copies of the Software, and to permit persons to whom the
 + * Software is furnished to do so, subject to the following conditions:
 + *
 + * The above copyright notice and this permission notice (including the
 next
 + * paragraph) shall be included in all copies or substantial portions of
 the
 + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR
 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY,
 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
 SHALL
 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 OTHER
 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS
 + * IN THE SOFTWARE.
 + */
 +
 +#include brw_fs.h
 +#include brw_cfg.h
 +
 +/** @file brw_fs_peephole_predicated_break.cpp
 + *
 + * Loops are often structured as
 + *
 + * loop:
 + *CMP.f0
 + *(+f0) IF
 + *BREAK
 + *ENDIF
 + *...
 + *WHILE loop
 + *
 + * This peephole pass removes the IF and ENDIF instructions and
 predicates the
 + * BREAK, dropping two instructions from the loop body.


Instead of this special-purpose peephole optimization, I'm wondering if it
would be more useful to create a more general optimization pass that just
converts the entire IF block to predicated instructions, assuming certain
conditions hold.  Those conditions would be something like:

- If any instruction but the last writes to the flag register, then don't
do the optimization.
- If there's nested control flow, then don't do the optimization.
- If any instruction inside the IF block is incompatible with predication
(are there any such instructions?  I don't know) then don't do the
optimization.
- If the block is larger than a certain heuristically-determined size, then
don't do the optimization.

Such an optimization could in principle even handle IF/ELSE blocks, by
inverting the predicate 

[Mesa-dev] [PATCH 0/7] Add ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
The following patches add the necessary functions to Mesa
to support ARB_texture_view. These patches do not include
the actual driver elements, just the device independent portion.
This extension requires ARB_texture_storage.

The extension supports one new API call, glTextureView and
a handful of enums that have been added as queriable texture
parameters.

Adds one new driver entry point for the driver to
map the view specified onto the origtexture given.

Passes non-rendering ARB_texture_view piglit tests (recently added).

Courtney Goeltzenleuchter (7):
  mesa: Add API definitions for ARB_texture_view
  mesa: Tracking for ARB_texture_view extension
  mesa: update texture object for ARB_texture_view
  mesa: ARB_texture_view get parameters
  mesa: Update TexStorage to support ARB_texture_view
  mesa: Add driver entry point for ARB_texture_view
  mesa: Fill out ARB_texture_view entry points

 src/mapi/glapi/gen/ARB_texture_view.xml |  23 ++
 src/mapi/glapi/gen/Makefile.am  |   1 +
 src/mapi/glapi/gen/gl_API.xml   |   6 +-
 src/mapi/glapi/gen/gl_genexec.py|   1 +
 src/mesa/Makefile.sources   |   1 +
 src/mesa/SConscript |   1 +
 src/mesa/drivers/common/driverfuncs.c   |   3 +
 src/mesa/main/dd.h  |   5 +
 src/mesa/main/extensions.c  |   1 +
 src/mesa/main/mtypes.h  |   6 +
 src/mesa/main/tests/dispatch_sanity.cpp |   2 +-
 src/mesa/main/texparam.c|  60 ++-
 src/mesa/main/texstorage.c  |  32 ++
 src/mesa/main/textureview.c | 621 
 src/mesa/main/textureview.h |  39 ++
 15 files changed, 796 insertions(+), 6 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_texture_view.xml
 create mode 100644 src/mesa/main/textureview.c
 create mode 100644 src/mesa/main/textureview.h

-- 
1.8.1.2

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


[Mesa-dev] [PATCH 7/7] mesa: Fill out ARB_texture_view entry points

2013-11-05 Thread Courtney Goeltzenleuchter
Add Mesa TextureView logic.
Incorporate feedback on ARB_texture_view
---
 src/mesa/main/texstorage.c  |   3 +-
 src/mesa/main/textureview.c | 558 +++-
 2 files changed, 558 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 4da3c91..8519bb8 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -454,8 +454,7 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
   texObj-NumLevels = levels;
   texObj-MinLayer = 0;
   texObj-NumLayers = 1;
-  switch (target)
-  {
+  switch (target) {
   case GL_TEXTURE_1D_ARRAY:
  texObj-NumLayers = height;
  break;
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 4a6bd62..a30598d 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -42,6 +42,340 @@
 #include textureview.h
 #include mtypes.h
 
+/* Table 3.X.2 (Compatible internal formats for TextureView)
+---
+| Class | Internal formats|
+---
+| VIEW_CLASS_128_BITS   | RGBA32F, RGBA32UI, RGBA32I  |
+---
+| VIEW_CLASS_96_BITS| RGB32F, RGB32UI, RGB32I |
+---
+| VIEW_CLASS_64_BITS| RGBA16F, RG32F, RGBA16UI, RG32UI, RGBA16I,  |
+|   | RG32I, RGBA16, RGBA16_SNORM |
+---
+| VIEW_CLASS_48_BITS| RGB16, RGB16_SNORM, RGB16F, RGB16UI, RGB16I |
+---
+| VIEW_CLASS_32_BITS| RG16F, R11F_G11F_B10F, R32F,|
+|   | RGB10_A2UI, RGBA8UI, RG16UI, R32UI, |
+|   | RGBA8I, RG16I, R32I, RGB10_A2, RGBA8, RG16, |
+|   | RGBA8_SNORM, RG16_SNORM, SRGB8_ALPHA8, RGB9_E5  |
+---
+| VIEW_CLASS_24_BITS| RGB8, RGB8_SNORM, SRGB8, RGB8UI, RGB8I  |
+---
+| VIEW_CLASS_16_BITS| R16F, RG8UI, R16UI, RG8I, R16I, RG8, R16,   |
+|   | RG8_SNORM, R16_SNORM|
+---
+| VIEW_CLASS_8_BITS | R8UI, R8I, R8, R8_SNORM |
+---
+| VIEW_CLASS_RGTC1_RED  | COMPRESSED_RED_RGTC1,   |
+|   | COMPRESSED_SIGNED_RED_RGTC1 |
+---
+| VIEW_CLASS_RGTC2_RG   | COMPRESSED_RG_RGTC2,|
+|   | COMPRESSED_SIGNED_RG_RGTC2  |
+---
+| VIEW_CLASS_BPTC_UNORM | COMPRESSED_RGBA_BPTC_UNORM, |
+|   | COMPRESSED_SRGB_ALPHA_BPTC_UNORM|
+---
+| VIEW_CLASS_BPTC_FLOAT | COMPRESSED_RGB_BPTC_SIGNED_FLOAT,   |
+|   | COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT  |
+---
+ */
+struct internal_format_class_info {
+   GLenum view_class;
+   GLenum internal_format;
+};
+#define INFO(c,f) {GL_##c, GL_##f}
+static const struct internal_format_class_info _compatible_internal_formats[] 
= {
+   INFO(VIEW_CLASS_128_BITS, RGBA32F),
+   INFO(VIEW_CLASS_128_BITS, RGBA32UI),
+   INFO(VIEW_CLASS_128_BITS, RGBA32I),
+   INFO(VIEW_CLASS_96_BITS, RGB32F),
+   INFO(VIEW_CLASS_96_BITS, RGB32UI),
+   INFO(VIEW_CLASS_96_BITS, RGB32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16F),
+   INFO(VIEW_CLASS_64_BITS, RG32F),
+   INFO(VIEW_CLASS_64_BITS, RGBA16UI),
+   INFO(VIEW_CLASS_64_BITS, RG32UI),
+   INFO(VIEW_CLASS_64_BITS, RGBA16I),
+   INFO(VIEW_CLASS_64_BITS, RG32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16),
+   INFO(VIEW_CLASS_64_BITS, RGBA16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16),
+   INFO(VIEW_CLASS_48_BITS, RGB16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16F),
+   INFO(VIEW_CLASS_48_BITS, RGB16UI),
+   INFO(VIEW_CLASS_48_BITS, RGB16I),
+   INFO(VIEW_CLASS_32_BITS, RG16F),
+   INFO(VIEW_CLASS_32_BITS, R11F_G11F_B10F),

[Mesa-dev] [PATCH 6/7] mesa: Add driver entry point for ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
---
 src/mesa/drivers/common/driverfuncs.c | 3 +++
 src/mesa/main/dd.h| 5 +
 2 files changed, 8 insertions(+)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 5faa98a..f185688 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -211,6 +211,9 @@ _mesa_init_driver_functions(struct dd_function_table 
*driver)
/* GL_ARB_texture_storage */
driver-AllocTextureStorage = _mesa_alloc_texture_storage;
 
+   /* GL_ARB_texture_view */
+   driver-TextureView = NULL;
+
/* GL_ARB_texture_multisample */
driver-GetSamplePosition = NULL;
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index d7c4327..6690e5a 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -375,6 +375,11 @@ struct dd_function_table {
 GLsizei levels, GLsizei width,
 GLsizei height, GLsizei depth);
 
+   /** Called as part of glTextureView to add views to origTexObj */
+   GLboolean (*TextureView)(struct gl_context *ctx,
+struct gl_texture_object *texObj,
+struct gl_texture_object *origTexObj);
+
/**
 * Map a renderbuffer into user space.
 * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 1/7] mesa: Add API definitions for ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
Stub in glTextureView API call to go with the
glTextureView API xml definition.
Includes dispatch test for glTextureView
---
 src/mapi/glapi/gen/ARB_texture_view.xml | 23 
 src/mapi/glapi/gen/Makefile.am  |  1 +
 src/mapi/glapi/gen/gl_API.xml   |  6 ++-
 src/mapi/glapi/gen/gl_genexec.py|  1 +
 src/mesa/Makefile.sources   |  1 +
 src/mesa/SConscript |  1 +
 src/mesa/main/tests/dispatch_sanity.cpp |  2 +-
 src/mesa/main/textureview.c | 65 +
 src/mesa/main/textureview.h | 39 
 9 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_texture_view.xml
 create mode 100644 src/mesa/main/textureview.c
 create mode 100644 src/mesa/main/textureview.h

diff --git a/src/mapi/glapi/gen/ARB_texture_view.xml 
b/src/mapi/glapi/gen/ARB_texture_view.xml
new file mode 100644
index 000..3e6b8c9
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_texture_view.xml
@@ -0,0 +1,23 @@
+?xml version=1.0?
+!DOCTYPE OpenGLAPI SYSTEM gl_API.dtd
+
+!-- Note: no GLX protocol info yet. --
+
+OpenGLAPI
+
+category name=GL_ARB_texture_view number=124
+
+   function name=TextureView offset=assign
+  param name=texture type=GLuint/
+  param name=target type=GLenum/
+  param name=origtexture type=GLuint/
+  param name=internalformat type=GLenum/
+  param name=minlevel type=GLuint/
+  param name=numlevels type=GLuint/
+  param name=minlayer type=GLuint/
+  param name=numlayers type=GLuint/
+   /function
+
+/category
+
+/OpenGLAPI
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index cbbf659..68d36cc 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -124,6 +124,7 @@ API_XML = \
ARB_texture_rg.xml \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
+   ARB_texture_view.xml \
ARB_vertex_array_object.xml \
AMD_draw_buffers_blend.xml \
AMD_performance_monitor.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 69014c5..e91cee9 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8458,7 +8458,11 @@
 
 /category
 
-!-- ARB extensions #120...#126 --
+!-- ARB extensions #120...#123 --
+
+xi:include href=ARB_texture_view.xml 
xmlns:xi=http://www.w3.org/2001/XInclude/
+
+!-- ARB extensions #125...#126 --
 
 xi:include href=ARB_ES3_compatibility.xml 
xmlns:xi=http://www.w3.org/2001/XInclude/
 
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 3ce190f..b557b3b 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -102,6 +102,7 @@ header = /**
 #include main/texstate.h
 #include main/texstorage.h
 #include main/texturebarrier.h
+#include main/textureview.h
 #include main/transformfeedback.h
 #include main/mtypes.h
 #include main/varray.h
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index a84f8a7..39525bc 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -103,6 +103,7 @@ MAIN_FILES = \
$(SRCDIR)main/texstate.c \
$(SRCDIR)main/texstorage.c \
$(SRCDIR)main/texstore.c \
+$(SRCDIR)main/textureview.c \
$(SRCDIR)main/texturebarrier.c \
$(SRCDIR)main/transformfeedback.c \
$(SRCDIR)main/uniforms.c \
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 4213498..581bd69 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -136,6 +136,7 @@ main_sources = [
 'main/texstorage.c',
 'main/texstore.c',
 'main/texturebarrier.c',
+'main/textureview.c',
 'main/transformfeedback.c',
 'main/uniform_query.cpp',
 'main/uniforms.c',
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 58cff9b..c28c111 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -853,7 +853,7 @@ const struct function gl_core_functions_possible[] = {
 // { glDispatchCompute, 43, -1 }, // XXX: Add to xml
 // { glDispatchComputeIndirect, 43, -1 }, // XXX: Add to xml
 // { glCopyImageSubData, 43, -1 },// XXX: Add to xml
-// { glTextureView, 43, -1 }, // XXX: Add to xml
+   { glTextureView, 43, -1 },
 // { glBindVertexBuffer, 43, -1 },// XXX: Add to xml
 // { glVertexAttribFormat, 43, -1 },  // XXX: Add to xml
 // { glVertexAttribIFormat, 43, -1 }, // XXX: Add to xml
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
new file mode 100644
index 000..4a6bd62
--- /dev/null
+++ b/src/mesa/main/textureview.c
@@ -0,0 +1,65 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2013 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person 

[Mesa-dev] [PATCH 2/7] mesa: Tracking for ARB_texture_view extension

2013-11-05 Thread Courtney Goeltzenleuchter
---
 src/mesa/main/extensions.c | 1 +
 src/mesa/main/mtypes.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 48c4e9f..75591b0 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -156,6 +156,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_texture_rg,  o(ARB_texture_rg),  
GL, 2008 },
{ GL_ARB_texture_storage, o(dummy_true),  
GL, 2011 },
{ GL_ARB_texture_storage_multisample, o(ARB_texture_multisample), 
GL, 2012 },
+   { GL_ARB_texture_view,o(ARB_texture_view),
GL, 2012 },
{ GL_ARB_texture_swizzle, o(EXT_texture_swizzle), 
GL, 2008 },
{ GL_ARB_timer_query, o(ARB_timer_query), 
GL, 2010 },
{ GL_ARB_transform_feedback2, o(ARB_transform_feedback2), 
GL, 2010 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b5c5583..a35e9d9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3284,6 +3284,7 @@ struct gl_extensions
GLboolean ARB_texture_query_lod;
GLboolean ARB_texture_rg;
GLboolean ARB_texture_rgb10_a2ui;
+   GLboolean ARB_texture_view;
GLboolean ARB_timer_query;
GLboolean ARB_transform_feedback2;
GLboolean ARB_transform_feedback3;
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
TexStorage now updates texture object state needed by
ARB_texture_view extension.

Set appropriate TextureView state in texture object.
---
 src/mesa/main/texstorage.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 84b8f82..4da3c91 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
  return;
   }
 
+  /* If the command is successful,
+   * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
+   * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
+   * If the texture target is TEXTURE_1D_ARRAY then
+   * TEXTURE_VIEW_NUM_LAYERS becomes height.
+   * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
+   * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes 
depth.
+   * If the texture target is TEXTURE_CUBE_MAP, then
+   * TEXTURE_VIEW_NUM_LAYERS becomes 6.
+   * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
+   */
+
   texObj-Immutable = GL_TRUE;
   texObj-ImmutableLevels = levels;
+  texObj-MinLevel = 0;
+  texObj-NumLevels = levels;
+  texObj-MinLayer = 0;
+  texObj-NumLayers = 1;
+  switch (target)
+  {
+  case GL_TEXTURE_1D_ARRAY:
+ texObj-NumLayers = height;
+ break;
+
+  case GL_TEXTURE_2D_ARRAY:
+  case GL_TEXTURE_CUBE_MAP_ARRAY:
+  case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ texObj-NumLayers = depth;
+ break;
+
+  case GL_TEXTURE_CUBE_MAP:
+ texObj-NumLayers = 6;
+ break;
+  }
+
}
 }
 
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 4/7] mesa: ARB_texture_view get parameters

2013-11-05 Thread Courtney Goeltzenleuchter
Add support for ARB_texture_view get parameters:
GL_TEXTURE_VIEW_MIN_LEVEL
GL_TEXTURE_VIEW_NUM_LEVELS
GL_TEXTURE_VIEW_MIN_LAYER
GL_TEXTURE_VIEW_NUM_LAYERS

Incorporate feedback regarding when to allow query of
GL_TEXTURE_IMMUTABLE_LEVELS.
---
 src/mesa/main/texparam.c | 60 
 1 file changed, 56 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d56b7d9..b3e2d0a 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1565,9 +1565,35 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, 
GLfloat *params )
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (!_mesa_is_gles3(ctx))
+ if (_mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx)  ctx-Extensions.ARB_texture_view))
+*params = (GLfloat) obj-ImmutableLevels;
+ else
+goto invalid_pname;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LEVEL:
+ if (!ctx-Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj-MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS:
+ if (!ctx-Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj-NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER:
+ if (!ctx-Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj-MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS:
+ if (!ctx-Extensions.ARB_texture_view)
 goto invalid_pname;
- *params = (GLfloat) obj-ImmutableLevels;
+ *params = (GLfloat) obj-NumLayers;
  break;
 
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
@@ -1746,9 +1772,35 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, 
GLint *params )
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (!_mesa_is_gles3(ctx))
+ if (_mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx)  ctx-Extensions.ARB_texture_view))
+*params = obj-ImmutableLevels;
+ else
+goto invalid_pname;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LEVEL:
+ if (!ctx-Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj-MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS:
+ if (!ctx-Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj-NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER:
+ if (!ctx-Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj-MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS:
+ if (!ctx-Extensions.ARB_texture_view)
 goto invalid_pname;
- *params = obj-ImmutableLevels;
+ *params = (GLint) obj-NumLayers;
  break;
 
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 3/7] mesa: update texture object for ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
Add state needed by glTextureView to the gl_texture_object.
---
 src/mesa/main/mtypes.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a35e9d9..2c5343c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1192,6 +1192,11 @@ struct gl_texture_object
 pressure? */
GLboolean Immutable;/** GL_ARB_texture_storage */
 
+   GLuint MinLevel;/** GL_ARB_texture_view */
+   GLuint MinLayer;/** GL_ARB_texture_view */
+   GLuint NumLevels;   /** GL_ARB_texture_view */
+   GLuint NumLayers;   /** GL_ARB_texture_view */
+
/** Actual texture images, indexed by [cube face] and [mipmap level] */
struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
 
-- 
1.8.1.2

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


[Mesa-dev] [PATCH] configure.ac: Drop no-out-of-tree notice.

2013-11-05 Thread Matt Turner
We do support out of tree builds now.

Cc: Colin Walters walt...@verbum.org
---
 configure.ac | 4 
 1 file changed, 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index bbdad83..433470b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,10 +14,6 @@ AC_CONFIG_MACRO_DIR([m4])
 AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([foreign])
 
-dnl http://people.gnome.org/~walters/docs/build-api.txt
-dnl We don't support srcdir != builddir.
-echo \#buildapi-variable-no-builddir /dev/null
-
 # Support silent build rules, requires at least automake-1.11. Disable
 # by either passing --disable-silent-rules to configure or passing V=1
 # to make
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 3/3] build: Build gen_matypes and matypes.h from src/mesa.

2013-11-05 Thread Matt Turner
---
 configure.ac|  4 +---
 src/mesa/.gitignore |  2 ++
 src/mesa/Makefile.am| 16 +-
 src/mesa/x86-64/.gitignore  |  2 --
 src/mesa/x86-64/Makefile.am | 49 ---
 src/mesa/x86/.gitignore |  2 --
 src/mesa/x86/Makefile.am| 51 -
 7 files changed, 18 insertions(+), 108 deletions(-)
 create mode 100644 src/mesa/.gitignore
 delete mode 100644 src/mesa/x86-64/.gitignore
 delete mode 100644 src/mesa/x86-64/Makefile.am
 delete mode 100644 src/mesa/x86/.gitignore
 delete mode 100644 src/mesa/x86/Makefile.am

diff --git a/configure.ac b/configure.ac
index 951f590..3d4da78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2091,9 +2091,7 @@ AC_CONFIG_FILES([Makefile
src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile
-   src/mesa/main/tests/hash_table/Makefile
-   src/mesa/x86-64/Makefile
-   src/mesa/x86/Makefile])
+   src/mesa/main/tests/hash_table/Makefile])
 
 dnl Sort the dirs alphabetically
 GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr   \n|sort -u|tr \n  `
diff --git a/src/mesa/.gitignore b/src/mesa/.gitignore
new file mode 100644
index 000..ca3130d
--- /dev/null
+++ b/src/mesa/.gitignore
@@ -0,0 +1,2 @@
+gen_matypes
+matypes.h
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 83d3d10..026a517 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -19,7 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-SUBDIRS = x86 x86-64 . main/tests
+SUBDIRS = . main/tests
 
 if HAVE_X11_DRIVER
 SUBDIRS += drivers/x11
@@ -98,6 +98,11 @@ AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
+noinst_PROGRAMS = gen_matypes
+
+gen_matypes_SOURCES = x86/gen_matypes.c
+BUILT_SOURCES += matypes.h
+
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
@@ -138,6 +143,15 @@ $(BUILDDIR)program/lex.yy.c: program/program_lexer.l
 $(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: 
program/program_parse.y
$(AM_V_GEN) $(YACC) -p _mesa_program_ -v -d 
--output=$(BUILDDIR)program/program_parse.tab.c $
 
+if GEN_ASM_OFFSETS
+matypes.h: $(gen_matypes_SOURCES)
+   $(AM_V_GEN)$(COMPILE) $ -DASM_OFFSETS -S -o - | \
+   sed -n '/^-/{s:^-::;/[$$]/{s:^:#define :;s:[$$]::};p}'  $@
+else
+matypes.h: gen_matypes
+   $(AM_V_GEN)./gen_matypes  $@
+endif
+
 # Emacs tags
 tags:
etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
diff --git a/src/mesa/x86-64/.gitignore b/src/mesa/x86-64/.gitignore
deleted file mode 100644
index ca3130d..000
--- a/src/mesa/x86-64/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-gen_matypes
-matypes.h
diff --git a/src/mesa/x86-64/Makefile.am b/src/mesa/x86-64/Makefile.am
deleted file mode 100644
index b62387d..000
--- a/src/mesa/x86-64/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the Software),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-if HAVE_X86_64_ASM
-
-AM_CPPFLAGS = \
-   -I$(top_srcdir)/include \
-   -I$(top_srcdir)/src/mesa \
-   -I$(top_srcdir)/src/mapi \
-   $(DEFINES)
-
-noinst_PROGRAMS = gen_matypes
-
-gen_matypes_SOURCES = ../x86/gen_matypes.c
-BUILT_SOURCES = matypes.h
-CLEANFILES = matypes.h
-
-if GEN_ASM_OFFSETS
-
-matypes.h: $(gen_matypes_SOURCES)
-   $(AM_V_GEN)$(COMPILE) $ -DASM_OFFSETS -S -o - | \
-   sed -n '/^-/{s:^-::;/[$$]/{s:^:#define :;s:[$$]::};p}'  $@
-
-else
-
-matypes.h: gen_matypes
-   $(AM_V_GEN)./gen_matypes  $@
-
-endif
-
-endif
diff --git a/src/mesa/x86/.gitignore b/src/mesa/x86/.gitignore
deleted file mode 100644
index ca3130d..000
--- 

[Mesa-dev] [PATCH 2/3] build: Change HAVE_X86_ASM to mean x86 or x86-64 asm.

2013-11-05 Thread Matt Turner
I want a conditional that says generally we have x86 assembly in the
next patch.
---
 configure.ac   | 2 +-
 src/mapi/glapi/Makefile.am | 5 +++--
 src/mapi/glapi/gen/Makefile.am | 6 +++---
 src/mesa/Makefile.am   | 7 ---
 src/mesa/x86/Makefile.am   | 2 ++
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 633d86e..951f590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1938,7 +1938,7 @@ AM_CONDITIONAL(HAVE_X11_DRIVER, test x$enable_xlib_glx 
= xyes)
 AM_CONDITIONAL(HAVE_OSMESA, test x$enable_osmesa = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test x$enable_gallium_osmesa = xyes)
 
-AM_CONDITIONAL(HAVE_X86_ASM, test x$asm_arch = xx86)
+AM_CONDITIONAL(HAVE_X86_ASM, test x$asm_arch = xx86 -o x$asm_arch = 
xx86_64)
 AM_CONDITIONAL(HAVE_X86_64_ASM, test x$asm_arch = xx86_64)
 AM_CONDITIONAL(HAVE_SPARC_ASM, test x$asm_arch = xsparc)
 
diff --git a/src/mapi/glapi/Makefile.am b/src/mapi/glapi/Makefile.am
index 05c67a6..bf653a3 100644
--- a/src/mapi/glapi/Makefile.am
+++ b/src/mapi/glapi/Makefile.am
@@ -33,10 +33,11 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/mesa
 
 if HAVE_X86_ASM
-GLAPI_ASM_SOURCES = $(X86_API)
-endif
 if HAVE_X86_64_ASM
 GLAPI_ASM_SOURCES = $(X86_64_API)
+else
+GLAPI_ASM_SOURCES = $(X86_API)
+endif
 endif
 if HAVE_SPARC_ASM
 GLAPI_ASM_SOURCES = $(SPARC_API)
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index cbbf659..13a544b 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -32,11 +32,11 @@ MESA_GLAPI_OUTPUTS = \
 
 MESA_GLAPI_ASM_OUTPUTS =
 if HAVE_X86_ASM
-MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
-endif
-
 if HAVE_X86_64_ASM
 MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86-64.S
+else
+MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
+endif
 endif
 
 if HAVE_SPARC_ASM
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index b4ad9fc..83d3d10 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -98,12 +98,13 @@ AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
-MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
-AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
-endif
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
+else
+MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
+endif
 endif
 if HAVE_SPARC_ASM
 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
diff --git a/src/mesa/x86/Makefile.am b/src/mesa/x86/Makefile.am
index 1678576..9b4a2dd 100644
--- a/src/mesa/x86/Makefile.am
+++ b/src/mesa/x86/Makefile.am
@@ -20,6 +20,7 @@
 # IN THE SOFTWARE.
 
 if HAVE_X86_ASM
+if !HAVE_X86_64_ASM
 
 AM_CPPFLAGS = \
-I$(top_srcdir)/include \
@@ -47,3 +48,4 @@ matypes.h: gen_matypes
 endif
 
 endif
+endif
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Emil Velikov
On 05/11/13 18:55, Matt Turner wrote:
 On Tue, Nov 5, 2013 at 10:49 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Now we have one intermediate library (archive), which links against both
 mesa classic and gallium. Whereas with your patch it builds it twice but
 drops the linking part. Is the extra recursion + linking that much more
 significant than rebuilding the exact same source(s) twice ?
 
 It's not building it twice (just like it doesn't build other sources
 common to libmesa and libmesagallium twice).
 
 It builds the sources once and links them into libmesa and
 libmesagallium, instead of going through the intermediate step of
 linking them into libprogram.
 
Not sure where in mesa I saw this, but I could swear it was rebuilding
the same source(s) twice. Seems that I was a bit in the clouds on this one.

I'll drop the moving moving sources list(s) part but would like to
keep the cleanups.

~Emil


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


Re: [Mesa-dev] [PATCH 2/2] mesa: Build program as part of libmesa.

2013-11-05 Thread Emil Velikov
On 05/11/13 00:11, Matt Turner wrote:
 ---
  Makefile.am  |  2 +-
  configure.ac |  1 -
  src/mesa/Makefile.am | 24 +++
  src/mesa/program/Makefile.am | 45 
 
  4 files changed, 17 insertions(+), 55 deletions(-)
  delete mode 100644 src/mesa/program/Makefile.am
 
Hi Matt,
This commit seems to break out-of tree builds on my system :'(

  GEN  main/get_hash.h
  GEN  program/program_parse.tab.c
bison: ./program/program_parse.output: cannot open: No such file or
directory
Makefile:4105: recipe for target 'program/program_parse.tab.c' failed

Cheers
Emil
 diff --git a/Makefile.am b/Makefile.am
 index 343bade..361fb51 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -64,7 +64,7 @@ IGNORE_FILES = \
  
  parsers: configure
   $(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp 
 glcpp/glcpp-lex.c glcpp/glcpp-parse.c glcpp/glcpp-parse.h
 - $(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c 
 program_parse.tab.h
 + $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c 
 program/program_parse.tab.h
  
  # Everything for new a Mesa release:
  ARCHIVES = $(PACKAGE_NAME).tar.gz \
 diff --git a/configure.ac b/configure.ac
 index 0a25047..bbdad83 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -2096,7 +2096,6 @@ AC_CONFIG_FILES([Makefile
   src/mesa/drivers/x11/Makefile
   src/mesa/main/tests/Makefile
   src/mesa/main/tests/hash_table/Makefile
 - src/mesa/program/Makefile
   src/mesa/x86-64/Makefile
   src/mesa/x86/Makefile])
  
 diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
 index 6ce31d2..b4ad9fc 100644
 --- a/src/mesa/Makefile.am
 +++ b/src/mesa/Makefile.am
 @@ -19,7 +19,7 @@
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 DEALINGS
  # IN THE SOFTWARE.
  
 -SUBDIRS = program x86 x86-64 . main/tests
 +SUBDIRS = x86 x86-64 . main/tests
  
  if HAVE_X11_DRIVER
  SUBDIRS += drivers/x11
 @@ -59,9 +59,15 @@ main/git_sha1.h: main/git_sha1.h.tmp
  GLAPI = $(top_srcdir)/src/mapi/glapi/gen
  include $(GLAPI)/glapi_gen.mk
  
 +BUILDDIR = $(builddir)/
 +include Makefile.sources
 +
  BUILT_SOURCES = \
   main/git_sha1.h \
 - main/get_hash.h
 + main/get_hash.h \
 + $(BUILDDIR)program/program_parse.tab.c \
 + $(BUILDDIR)program/program_parse.tab.h \
 + $(BUILDDIR)program/lex.yy.c
  CLEANFILES = \
   $(BUILT_SOURCES) \
   git_sha1.h.tmp
 @@ -85,9 +91,6 @@ if HAVE_GALLIUM
  noinst_LTLIBRARIES += libmesagallium.la
  endif
  
 -BUILDDIR = $(builddir)/
 -include Makefile.sources
 -
  AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
  AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
  AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 @@ -109,26 +112,31 @@ endif
  
  libmesa_la_SOURCES = \
   $(MESA_FILES) \
 + $(PROGRAM_FILES) \
  $(MESA_ASM_FILES_FOR_ARCH)
  
  libmesa_la_LIBADD = \
  $(top_builddir)/src/glsl/libglsl.la \
 -$(top_builddir)/src/mesa/program/libprogram.la \
  $()
 -libmesa_la_LDFLAGS =
  
  libmesagallium_la_SOURCES = \
   $(MESA_GALLIUM_FILES) \
 + $(PROGRAM_FILES) \
  $(MESA_ASM_FILES_FOR_ARCH)
  
  libmesagallium_la_LIBADD = \
  $(top_builddir)/src/glsl/libglsl.la \
 -$(top_builddir)/src/mesa/program/libprogram.la \
  $()
  
  pkgconfigdir = $(libdir)/pkgconfig
  pkgconfig_DATA = gl.pc
  
 +$(BUILDDIR)program/lex.yy.c: program/program_lexer.l
 + $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $
 +
 +$(BUILDDIR)program/program_parse.tab.c 
 $(BUILDDIR)program/program_parse.tab.h: program/program_parse.y
 + $(AM_V_GEN) $(YACC) -p _mesa_program_ -v -d 
 --output=$(BUILDDIR)program/program_parse.tab.c $
 +
  # Emacs tags
  tags:
   etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
 diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
 deleted file mode 100644
 index 5e05782..000
 --- a/src/mesa/program/Makefile.am
 +++ /dev/null
 @@ -1,45 +0,0 @@
 -# Copyright © 2012 Intel Corporation
 -#
 -# Permission is hereby granted, free of charge, to any person obtaining a
 -# copy of this software and associated documentation files (the Software),
 -# to deal in the Software without restriction, including without limitation
 -# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 -# and/or sell copies of the Software, and to permit persons to whom the
 -# Software is furnished to do so, subject to the following conditions:
 -#
 -# The above copyright notice and this permission notice (including the next
 -# paragraph) shall be included in all copies or substantial portions of the
 -# Software.
 -#
 -# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 -# FITNESS FOR A PARTICULAR PURPOSE AND 

[Mesa-dev] [PATCH] st/vdpau: resolve delayed rendering for GL interop

2013-11-05 Thread Grigori Goronzy
Otherwise OutputSurface interop has funny results sometimes.
This fixes interop with the mpv media player.
---
 src/gallium/state_trackers/vdpau/output.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/vdpau/output.c 
b/src/gallium/state_trackers/vdpau/output.c
index def01c8..76c7312 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -734,5 +734,6 @@ struct pipe_resource 
*vlVdpOutputSurfaceGallium(VdpOutputSurface surface)
if (!vlsurface || !vlsurface-surface)
   return NULL;
 
+   vlVdpResolveDelayedRendering(vlsurface-device, NULL, NULL);
return vlsurface-surface-texture;
 }
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH 4/4] i965: Combine {brw, gen7}_update_texture_buffer_surface() functions.

2013-11-05 Thread Paul Berry
On 1 November 2013 20:23, Kenneth Graunke kenn...@whitecape.org wrote:

 Now that brw_update_texture_buffer_surface() uses the virtual
 emit_buffer_surface_state() function, it works for Gen7+ too.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org


Series is:

Reviewed-by: Paul Berry stereotype...@gmail.com


 ---
  src/mesa/drivers/dri/i965/brw_context.h   |  3 ++
  src/mesa/drivers/dri/i965/brw_wm_surface_state.c  |  2 +-
  src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 40
 +--
  3 files changed, 5 insertions(+), 40 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_context.h
 b/src/mesa/drivers/dri/i965/brw_context.h
 index 85bba1d..2294ce0 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.h
 +++ b/src/mesa/drivers/dri/i965/brw_context.h
 @@ -1579,6 +1579,9 @@ void brw_create_constant_surface(struct brw_context
 *brw,
   uint32_t size,
   uint32_t *out_offset,
   bool dword_pitch);
 +void brw_update_buffer_texture_surface(struct gl_context *ctx,
 +   unsigned unit,
 +   uint32_t *surf_offset);
  void
  brw_update_sol_surface(struct brw_context *brw,
 struct gl_buffer_object *buffer_obj,
 diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
 b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
 index 5a60a6b..2088688 100644
 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
 +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
 @@ -226,7 +226,7 @@ gen4_emit_buffer_surface_state(struct brw_context *brw,
 }
  }

 -static void
 +void
  brw_update_buffer_texture_surface(struct gl_context *ctx,
unsigned unit,
uint32_t *surf_offset)
 diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
 b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
 index c52e12d..3f4817d 100644
 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
 +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
 @@ -268,44 +268,6 @@ gen7_emit_buffer_surface_state(struct brw_context
 *brw,
  }

  static void
 -gen7_update_buffer_texture_surface(struct gl_context *ctx,
 -   unsigned unit,
 -   uint32_t *surf_offset)
 -{
 -   struct brw_context *brw = brw_context(ctx);
 -   struct gl_texture_object *tObj = ctx-Texture.Unit[unit]._Current;
 -   struct intel_buffer_object *intel_obj =
 -  intel_buffer_object(tObj-BufferObject);
 -   uint32_t size = tObj-BufferSize;
 -   drm_intel_bo *bo = NULL;
 -
 -   if (intel_obj) {
 -  size = MIN2(size, intel_obj-Base.Size);
 -  bo = intel_bufferobj_buffer(brw, intel_obj, tObj-BufferOffset,
 size);
 -   }
 -
 -   gl_format format = tObj-_BufferObjectFormat;
 -
 -   uint32_t surface_format = brw_format_for_mesa_format(format);
 -   if (surface_format == 0  format != MESA_FORMAT_RGBA_FLOAT32) {
 -  _mesa_problem(NULL, bad format %s for texture buffer\n,
 -_mesa_get_format_name(format));
 -   }
 -
 -   int texel_size = _mesa_get_format_bytes(format);
 -
 -   gen7_emit_buffer_surface_state(brw,
 -  surf_offset,
 -  bo,
 -  tObj-BufferOffset,
 -  surface_format,
 -  size / texel_size,
 -  texel_size,
 -  0 /* mocs */,
 -  false /* rw */);
 -}
 -
 -static void
  gen7_update_texture_surface(struct gl_context *ctx,
  unsigned unit,
  uint32_t *surf_offset,
 @@ -319,7 +281,7 @@ gen7_update_texture_surface(struct gl_context *ctx,
 struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);

 if (tObj-Target == GL_TEXTURE_BUFFER) {
 -  gen7_update_buffer_texture_surface(ctx, unit, surf_offset);
 +  brw_update_buffer_texture_surface(ctx, unit, surf_offset);
return;
 }

 --
 1.8.3.2

 ___
 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 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Keith Packard
Eric Anholt e...@anholt.net writes:

 It seems like we could just stick these things in __DRI_CORE as opposed
 to having another new extension to look up.

Having the driver expose this new extension is how I tell that the
driver is going to actually call the __DRIimage-based loader; the
alternative to a new extension would be to stick a flag in the
__DRI_CORE structure.

 The downside I see there is
 bugs in the server, which have patches at xserver-driinterface-versions
 of my tree.  (Unfortunately, I'm having a hard time building the server
 currently, so no testing yet).  Having a new extension whose name has
 nothing to do with the functions in it seems really weird.

It defines the interface to a driver which will be using the image
loader to allocate color buffers if available. The fact that the image
loader and DRI2 loader can both share the same driver interface is a
happy coincidence.

-- 
keith.pack...@intel.com


pgpUsRp469s5n.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/fs: Fix message setup for SIMD8 spills.

2013-11-05 Thread Eric Anholt
In the SIMD16 spilling changes, I replaced a 1 in the spill path with
mlen, but obviously it wasn't mlen before because spills have the g0
header along with the payload. The interface I was trying to use was
asking for how many physical regs we're writing, so we're looking for 1
or 2.

I'm guessing this actually passed piglit because the high 8 bits of the
execution mask in SIMD8 mode are all 0s.
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 63ac530..83917f5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -757,7 +757,7 @@ fs_generator::generate_scratch_write(fs_inst *inst, struct 
brw_reg src)
   retype(brw_message_reg(inst-base_mrf + 1), BRW_REGISTER_TYPE_UD),
   retype(src, BRW_REGISTER_TYPE_UD));
brw_oword_block_write_scratch(p, brw_message_reg(inst-base_mrf),
- inst-mlen, inst-offset);
+ dispatch_width / 8, inst-offset);
 }
 
 void
-- 
1.8.4.rc3

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


Re: [Mesa-dev] Fix crashes with static LLVM

2013-11-05 Thread Tom Stellard
On Wed, Oct 23, 2013 at 04:26:18PM -0400, Tom Stellard wrote:
 Hi,
 
 The attached patches introduce linker scripts to the pipe-loader and
 egl-static targets.  The linker scripts prevents these targets from
 exporting LLVM (and other) symbols that they shouldn't be.  This fixes
 several crashes in the radeon drivers when statically linking LLVM.
 
 With these patches: clover, glamor, and the egl demos from the mesa-demo repo 
 all
 work for me with statically linked LLVM, but I would like to get confirmation 
 that
 this works for other people too, so if you care about these use cases, please 
 test
 and let me know the results.
 

I have gotten some positive feedback on these patches from testers, so
if there are no objections, I will push these tomorrow.

-Tom

 Thanks,
 Tom
 
 ___
 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/2] mesa: Build program as part of libmesa.

2013-11-05 Thread Matt Turner
---
Right you are! This version fixes out of tree builds by mkdir'ing
the program folder in the builddir.


 Makefile.am  |  2 +-
 configure.ac |  1 -
 src/mesa/Makefile.am | 26 +
 src/mesa/program/Makefile.am | 45 
 4 files changed, 19 insertions(+), 55 deletions(-)
 delete mode 100644 src/mesa/program/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 343bade..361fb51 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,7 @@ IGNORE_FILES = \
 
 parsers: configure
$(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp 
glcpp/glcpp-lex.c glcpp/glcpp-parse.c glcpp/glcpp-parse.h
-   $(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c 
program_parse.tab.h
+   $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c 
program/program_parse.tab.h
 
 # Everything for new a Mesa release:
 ARCHIVES = $(PACKAGE_NAME).tar.gz \
diff --git a/configure.ac b/configure.ac
index 0a25047..bbdad83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2096,7 +2096,6 @@ AC_CONFIG_FILES([Makefile
src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile
src/mesa/main/tests/hash_table/Makefile
-   src/mesa/program/Makefile
src/mesa/x86-64/Makefile
src/mesa/x86/Makefile])
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 6ce31d2..a54b8ac 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -19,7 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-SUBDIRS = program x86 x86-64 . main/tests
+SUBDIRS = x86 x86-64 . main/tests
 
 if HAVE_X11_DRIVER
 SUBDIRS += drivers/x11
@@ -59,11 +59,17 @@ main/git_sha1.h: main/git_sha1.h.tmp
 GLAPI = $(top_srcdir)/src/mapi/glapi/gen
 include $(GLAPI)/glapi_gen.mk
 
+BUILDDIR = $(builddir)/
+include Makefile.sources
+
 BUILT_SOURCES = \
main/git_sha1.h \
-   main/get_hash.h
+   main/get_hash.h \
+   $(BUILDDIR)program/program_parse.tab.c \
+   $(BUILDDIR)program/lex.yy.c
 CLEANFILES = \
$(BUILT_SOURCES) \
+   $(BUILDDIR)program/program_parse.tab.h \
git_sha1.h.tmp
 
 GET_HASH_GEN = main/get_hash_generator.py
@@ -85,9 +91,6 @@ if HAVE_GALLIUM
 noinst_LTLIBRARIES += libmesagallium.la
 endif
 
-BUILDDIR = $(builddir)/
-include Makefile.sources
-
 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
@@ -109,26 +112,33 @@ endif
 
 libmesa_la_SOURCES = \
$(MESA_FILES) \
+   $(PROGRAM_FILES) \
 $(MESA_ASM_FILES_FOR_ARCH)
 
 libmesa_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
-$(top_builddir)/src/mesa/program/libprogram.la \
 $()
-libmesa_la_LDFLAGS =
 
 libmesagallium_la_SOURCES = \
$(MESA_GALLIUM_FILES) \
+   $(PROGRAM_FILES) \
 $(MESA_ASM_FILES_FOR_ARCH)
 
 libmesagallium_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
-$(top_builddir)/src/mesa/program/libprogram.la \
 $()
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
+$(BUILDDIR)program/lex.yy.c: program/program_lexer.l
+   $(MKDIR_P) $(builddir)/program
+   $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $
+
+$(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: 
program/program_parse.y
+   $(MKDIR_P) $(builddir)/program
+   $(AM_V_GEN) $(YACC) -p _mesa_program_ -v -d 
--output=$(BUILDDIR)program/program_parse.tab.c $
+
 # Emacs tags
 tags:
etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
deleted file mode 100644
index 5e05782..000
--- a/src/mesa/program/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the Software),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN 

[Mesa-dev] [PATCH] mesa: for GLSL_DUMP_ON_ERROR, also dump the info log

2013-11-05 Thread Brian Paul
Since it's helpful to know why the shader did not compile.
Also, call fflush() for Windows.
---
 src/mesa/main/shaderapi.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 7da860d..1d9aac3 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -825,6 +825,8 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
  fprintf(stderr, GLSL source for %s shader %d:\n,
  _mesa_glsl_shader_target_name(sh-Type), sh-Name);
  fprintf(stderr, %s\n, sh-Source);
+ fprintf(stderr, Info Log:\n%s\n, sh-InfoLog);
+ fflush(stderr);
   }
 
   if (ctx-Shader.Flags  GLSL_REPORT_ERRORS) {
-- 
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 5/7] mesa: Update TexStorage to support ARB_texture_view

2013-11-05 Thread Chris Forbes
You also need to update teximagemultisample (in teximage.c) which
handles TexStorageMultisample* to do similar things.

-- Chris

On Wed, Nov 6, 2013 at 11:59 AM, Courtney Goeltzenleuchter
court...@lunarg.com wrote:
 TexStorage now updates texture object state needed by
 ARB_texture_view extension.

 Set appropriate TextureView state in texture object.
 ---
  src/mesa/main/texstorage.c | 33 +
  1 file changed, 33 insertions(+)

 diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
 index 84b8f82..4da3c91 100644
 --- a/src/mesa/main/texstorage.c
 +++ b/src/mesa/main/texstorage.c
 @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
 GLenum internalformat,
   return;
}

 +  /* If the command is successful,
 +   * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
 +   * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
 +   * If the texture target is TEXTURE_1D_ARRAY then
 +   * TEXTURE_VIEW_NUM_LAYERS becomes height.
 +   * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
 +   * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS 
 becomes depth.
 +   * If the texture target is TEXTURE_CUBE_MAP, then
 +   * TEXTURE_VIEW_NUM_LAYERS becomes 6.
 +   * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
 +   */
 +
texObj-Immutable = GL_TRUE;
texObj-ImmutableLevels = levels;
 +  texObj-MinLevel = 0;
 +  texObj-NumLevels = levels;
 +  texObj-MinLayer = 0;
 +  texObj-NumLayers = 1;
 +  switch (target)
 +  {
 +  case GL_TEXTURE_1D_ARRAY:
 + texObj-NumLayers = height;
 + break;
 +
 +  case GL_TEXTURE_2D_ARRAY:
 +  case GL_TEXTURE_CUBE_MAP_ARRAY:
 +  case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
 + texObj-NumLayers = depth;
 + break;
 +
 +  case GL_TEXTURE_CUBE_MAP:
 + texObj-NumLayers = 6;
 + break;
 +  }
 +
 }
  }

 --
 1.8.1.2

 ___
 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/3] i965: Fix undefined value usage in ABO setup.

2013-11-05 Thread Eric Anholt
Fixes a compiler warning.
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 46871c7..cbeaa32 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -885,7 +885,7 @@ brw_upload_abo_surfaces(struct brw_context *brw,
   struct intel_buffer_object *intel_bo =
  intel_buffer_object(binding-BufferObject);
   drm_intel_bo *bo = intel_bufferobj_buffer(
- brw, intel_bo, binding-Offset, bo-size - binding-Offset);
+ brw, intel_bo, binding-Offset, intel_bo-Base.Size - 
binding-Offset);
 
   brw-vtbl.create_raw_surface(brw, bo, binding-Offset,
bo-size - binding-Offset,
-- 
1.8.4.rc3

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


[Mesa-dev] [PATCH 1/3] i965: Add a warning if something ever hits a bug I noticed.

2013-11-05 Thread Eric Anholt
We'd have to map the VBO and rewrite things to a lower stride to fix it.
---
 src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 4da1b7e..8b1f0c5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -607,6 +607,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
 
 static void brw_emit_vertices(struct brw_context *brw)
 {
+   struct gl_context *ctx = brw-ctx;
GLuint i, nr_elements;
 
brw_prepare_vertices(brw);
@@ -678,6 +679,9 @@ static void brw_emit_vertices(struct brw_context *brw)
  if (brw-gen == 7)
dw0 |= GEN7_MOCS_L3  16;
 
+ WARN_ONCE(buffer-stride = (brw-gen = 5 ? 2048 : 2047),
+   VBO stride %d too large, bad rendering may occur\n,
+   buffer-stride);
 OUT_BATCH(dw0 | (buffer-stride  BRW_VB0_PITCH_SHIFT));
 OUT_RELOC(buffer-bo, I915_GEM_DOMAIN_VERTEX, 0, buffer-offset);
 if (brw-gen = 5) {
-- 
1.8.4.rc3

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


[Mesa-dev] [PATCH 3/3] i965/fs: Prefer things we know reduce reg pressure when pre-scheduling.

2013-11-05 Thread Eric Anholt
Previously, the best thing we had was to schedule the things unblocked by
the last chosen instruction, on the hope that it would be consuming two
values at the end of their live intervals while only producing one new
value.  But that's just a guess, and we can do counting of usage of
registers to know when an instruction would (almost surely) reduce
register pressure.

The only failure mode I know of in this new dominant heuristic is that
inside of a loop when scheduling the iterator (for example), choosing the
last use of the iterator doesn't actually reduce the live interval of the
iterator.  But it doesn't seem to matter in shader-db:

total instructions in shared programs: 1618700 - 1618700 (0.00%)
instructions in affected programs: 0 - 0
GAINED:13
LOST:  0

Note: The new functions are made virtual because I expect we'll soon lift
the pre-regalloc scheduling heuristic over to the vec4 backend.
---
 .../drivers/dri/i965/brw_schedule_instructions.cpp | 144 +
 1 file changed, 144 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 5a42513..53fffa7 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -417,6 +417,13 @@ public:
   this-instructions_to_schedule = 0;
   this-post_reg_alloc = post_reg_alloc;
   this-time = 0;
+  if (!post_reg_alloc) {
+ this-remaining_grf_uses = rzalloc_array(mem_ctx, int, grf_count);
+ this-grf_active = rzalloc_array(mem_ctx, bool, grf_count);
+  } else {
+ this-remaining_grf_uses = NULL;
+ this-grf_active = NULL;
+  }
}
 
~instruction_scheduler()
@@ -442,6 +449,10 @@ public:
 */
virtual int issue_time(backend_instruction *inst) = 0;
 
+   virtual void count_remaining_grf_uses(backend_instruction *inst) = 0;
+   virtual void update_register_pressure(backend_instruction *inst) = 0;
+   virtual int get_register_pressure_benefit(backend_instruction *inst) = 0;
+
void schedule_instructions(backend_instruction *next_block_header);
 
void *mem_ctx;
@@ -452,6 +463,22 @@ public:
int time;
exec_list instructions;
backend_visitor *bv;
+
+   /**
+* Number of instructions left to schedule that reference each vgrf.
+*
+* Used so that we can prefer scheduling instructions that will end the
+* live intervals of multiple variables, to reduce register pressure.
+*/
+   int *remaining_grf_uses;
+
+   /**
+* Tracks whether each VGRF has had an instruction scheduled that uses it.
+*
+* This is used to estimate whether scheduling a new instruction will
+* increase register pressure.
+*/
+   bool *grf_active;
 };
 
 class fs_instruction_scheduler : public instruction_scheduler
@@ -463,6 +490,10 @@ public:
schedule_node *choose_instruction_to_schedule();
int issue_time(backend_instruction *inst);
fs_visitor *v;
+
+   void count_remaining_grf_uses(backend_instruction *inst);
+   void update_register_pressure(backend_instruction *inst);
+   int get_register_pressure_benefit(backend_instruction *inst);
 };
 
 fs_instruction_scheduler::fs_instruction_scheduler(fs_visitor *v,
@@ -473,6 +504,72 @@ 
fs_instruction_scheduler::fs_instruction_scheduler(fs_visitor *v,
 {
 }
 
+void
+fs_instruction_scheduler::count_remaining_grf_uses(backend_instruction *be)
+{
+   fs_inst *inst = (fs_inst *)be;
+
+   if (!remaining_grf_uses)
+  return;
+
+   if (inst-dst.file == GRF)
+  remaining_grf_uses[inst-dst.reg]++;
+
+   for (int i = 0; i  3; i++) {
+  if (inst-src[i].file != GRF)
+ continue;
+
+  remaining_grf_uses[inst-src[i].reg]++;
+   }
+}
+
+void
+fs_instruction_scheduler::update_register_pressure(backend_instruction *be)
+{
+   fs_inst *inst = (fs_inst *)be;
+
+   if (!remaining_grf_uses)
+  return;
+
+   if (inst-dst.file == GRF) {
+  remaining_grf_uses[inst-dst.reg]--;
+  grf_active[inst-dst.reg] = true;
+   }
+
+   for (int i = 0; i  3; i++) {
+  if (inst-src[i].file == GRF) {
+ remaining_grf_uses[inst-src[i].reg]--;
+ grf_active[inst-src[i].reg] = true;
+  }
+   }
+}
+
+int
+fs_instruction_scheduler::get_register_pressure_benefit(backend_instruction 
*be)
+{
+   fs_inst *inst = (fs_inst *)be;
+   int benefit = 0;
+
+   if (inst-dst.file == GRF) {
+  if (remaining_grf_uses[inst-dst.reg] == 1)
+ benefit += v-virtual_grf_sizes[inst-dst.reg];
+  if (!grf_active[inst-dst.reg])
+ benefit -= v-virtual_grf_sizes[inst-dst.reg];
+   }
+
+   for (int i = 0; i  3; i++) {
+  if (inst-src[i].file != GRF)
+ continue;
+
+  if (remaining_grf_uses[inst-src[i].reg] == 1)
+ benefit += v-virtual_grf_sizes[inst-src[i].reg];
+  if (!grf_active[inst-src[i].reg])
+ benefit -= v-virtual_grf_sizes[inst-src[i].reg];

Re: [Mesa-dev] [PATCH] i965: Fix compiler warning.

2013-11-05 Thread Kenneth Graunke
On 10/30/2013 02:58 PM, Courtney Goeltzenleuchter wrote:
 fix: intel_screen.c:1320:4: warning: initialization from
 incompatible pointer type [enabled by default]
 ---
  src/mesa/drivers/dri/i965/brw_context.c | 2 +-
  src/mesa/drivers/dri/i965/brw_context.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
 b/src/mesa/drivers/dri/i965/brw_context.c
 index 2a923c4..5b4d662d 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.c
 +++ b/src/mesa/drivers/dri/i965/brw_context.c
 @@ -498,7 +498,7 @@ brw_process_driconf_options(struct brw_context *brw)
driQueryOptionb(options, disable_glsl_line_continuations);
  }
  
 -bool
 +GLboolean
  brwCreateContext(gl_api api,
const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
 diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
 b/src/mesa/drivers/dri/i965/brw_context.h
 index 7f7d5c2..c261ae8 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.h
 +++ b/src/mesa/drivers/dri/i965/brw_context.h
 @@ -1446,7 +1446,7 @@ void intel_prepare_render(struct brw_context *brw);
  void intel_resolve_for_dri2_flush(struct brw_context *brw,
__DRIdrawable *drawable);
  
 -bool brwCreateContext(gl_api api,
 +GLboolean brwCreateContext(gl_api api,
 const struct gl_config *mesaVis,
 __DRIcontext *driContextPriv,
unsigned major_version,
 

Whoops...looks like I got a bit overzealous in converting those during
the intel_context/brw_context merges.

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


Re: [Mesa-dev] [v2 6/6] mesa: OES_get_program_binary functionality

2013-11-05 Thread Tapani Pälli

On 11/06/2013 12:14 AM, Paul Berry wrote:
On 1 November 2013 05:08, Tapani Pälli tapani.pa...@intel.com 
mailto:tapani.pa...@intel.com wrote:


On 11/01/2013 12:38 PM, Erik Faye-Lund wrote:

On Fri, Nov 1, 2013 at 11:35 AM, Tapani Pälli
tapani.pa...@intel.com mailto:tapani.pa...@intel.com wrote:

On 11/01/2013 12:21 PM, Erik Faye-Lund wrote:


Won't using the git-sha1 as a compatibility-criteria
cause issues for
developers with local changes? I'm not so worried
about this for
OES_get_program_binary itself, but once the
shader-cache is in place
it sounds like a potential source of difficult to
track down
misbehavior...


I agree it might be too aggressive criteria but it is hard
to come up with
better and as simple.

That's not my objection. My objection is that this might give
headaches for people with local modifications to the
glsl-compiler.
Local modifications does not affect the git-sha1.


For the automatic shader cache this headache could be helped a bit
with a environment variable or drirc setting that can be used
during development. On the other hand an automatic cache must work
in a transparent way so it should be always able to recover when
it fails, so one should only see it as 'slower than usual' (since
recompilation/relink required) sort of behaviour. The WIP of the
automatic cache I sent some time earlier also marked (renamed)
these 'problematic' cached shaders so that they can be detected on
further runs and cache can ignore those.

I agree that it might become problematic, on the other hand it is
also easy to just wipe ~/.cache/mesa and disable cache. Not sure
if Nvidia or Imagination try to handles these cases with their
cache implementations.


I'm also concerned about this, especially for the automatic shader 
cache.  During development, we frequently make small changes to the 
front end, recompile, and then run a small test program, expecting our 
changes to take effect.  I'm very worried about requiring developers 
to remember to set an environment variable, change a drirc setting, or 
wipe out a cache when making changes that haven't been committed yet.  
Especially when the consequence of forgetting to do so is that the 
change you were trying to make won't have any observed effect. That's 
the sort of thing that leads people to spend hours chasing phantom bugs.


How about if we have the cache mechanism include the modification time 
of the mesa .so in the shader binary (in addition to the sha), and 
reject shader binaries that don't have a matching modification time?  
That way if mesa is recompiled, any previously-cached shaders will 
automatically become invalid without the developer having to do any work.




My next plan for adding more validation was to add ir instruction sizes 
and a couple important struct sizes as part of the dump, this would 
allow some amount of sanity checking but mesa modification time addition 
sounds like better idea and would not add so much additional data.




A related concern I have is: what happens if someone changes their 
video card, or transplants their hard drive into a different machine 
that has different graphics hardware?  Different back-ends have 
different settings of ctx-ShaderCompilerOptions (some back-ends have 
different values from one chipset to another), so even if the version 
of Mesa is the same and there are no local developer changes, the 
linked IR is not going to necessarily be the same if the graphics 
hardware changes.


To address this, I'd recommend that we also include the device's PCI 
ID in the shader binary, and reject mismatched binaries.


Thanks, this is is a nice idea, currently there's also the vendor and 
renderer strings in the dump but so far these have been used only for 
debug purposes.


// Tapani

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


Re: [Mesa-dev] [PATCH] i965/fs: New peephole optimization to flatten IF/BREAK/ENDIF.

2013-11-05 Thread Paul Berry
On 5 November 2013 14:58, Paul Berry stereotype...@gmail.com wrote:

 On 1 November 2013 17:31, Matt Turner matts...@gmail.com wrote:

 total instructions in shared programs: 1649485 - 1649157 (-0.02%)
 instructions in affected programs: 7823 - 7495 (-4.19%)
 ---
  src/mesa/drivers/dri/i965/Makefile.sources |  1 +
  src/mesa/drivers/dri/i965/brw_fs.cpp   |  1 +
  src/mesa/drivers/dri/i965/brw_fs.h |  1 +
  .../dri/i965/brw_fs_peephole_predicated_break.cpp  | 96
 ++
  4 files changed, 99 insertions(+)
  create mode 100644
 src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp

 diff --git a/src/mesa/drivers/dri/i965/Makefile.sources
 b/src/mesa/drivers/dri/i965/Makefile.sources
 index 14b2f61..fcc6fdb 100644
 --- a/src/mesa/drivers/dri/i965/Makefile.sources
 +++ b/src/mesa/drivers/dri/i965/Makefile.sources
 @@ -59,6 +59,7 @@ i965_FILES = \
 brw_fs_fp.cpp \
 brw_fs_generator.cpp \
 brw_fs_live_variables.cpp \
 +   brw_fs_peephole_predicated_break.cpp \
 brw_fs_reg_allocate.cpp \
 brw_fs_vector_splitting.cpp \
 brw_fs_visitor.cpp \
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 7064910..5c8443f 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -3149,6 +3149,7 @@ fs_visitor::run()
  progress = opt_algebraic() || progress;
  progress = opt_cse() || progress;
  progress = opt_copy_propagate() || progress;
 + progress = opt_peephole_predicated_break() || progress;
  progress = dead_code_eliminate() || progress;
  progress = dead_code_eliminate_local() || progress;
  progress = register_coalesce() || progress;
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
 b/src/mesa/drivers/dri/i965/brw_fs.h
 index 43e4761..09e5174 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.h
 +++ b/src/mesa/drivers/dri/i965/brw_fs.h
 @@ -362,6 +362,7 @@ public:
 bool try_emit_saturate(ir_expression *ir);
 bool try_emit_mad(ir_expression *ir, int mul_arg);
 void try_replace_with_sel();
 +   bool opt_peephole_predicated_break();
 void emit_bool_to_cond_code(ir_rvalue *condition);
 void emit_if_gen6(ir_if *ir);
 void emit_unspill(fs_inst *inst, fs_reg reg, uint32_t spill_offset,
 diff --git
 a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
 new file mode 100644
 index 000..7845113
 --- /dev/null
 +++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
 @@ -0,0 +1,96 @@
 +/*
 + * Copyright © 2013 Intel Corporation
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining
 a
 + * copy of this software and associated documentation files (the
 Software),
 + * to deal in the Software without restriction, including without
 limitation
 + * the rights to use, copy, modify, merge, publish, distribute,
 sublicense,
 + * and/or sell copies of the Software, and to permit persons to whom the
 + * Software is furnished to do so, subject to the following conditions:
 + *
 + * The above copyright notice and this permission notice (including the
 next
 + * paragraph) shall be included in all copies or substantial portions of
 the
 + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR
 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY,
 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
 SHALL
 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 OTHER
 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS
 + * IN THE SOFTWARE.
 + */
 +
 +#include brw_fs.h
 +#include brw_cfg.h
 +
 +/** @file brw_fs_peephole_predicated_break.cpp
 + *
 + * Loops are often structured as
 + *
 + * loop:
 + *CMP.f0
 + *(+f0) IF
 + *BREAK
 + *ENDIF
 + *...
 + *WHILE loop
 + *
 + * This peephole pass removes the IF and ENDIF instructions and
 predicates the
 + * BREAK, dropping two instructions from the loop body.


 Instead of this special-purpose peephole optimization, I'm wondering if it
 would be more useful to create a more general optimization pass that just
 converts the entire IF block to predicated instructions, assuming certain
 conditions hold.  Those conditions would be something like:

 - If any instruction but the last writes to the flag register, then don't
 do the optimization.
 - If there's nested control flow, then don't do the optimization.
 - If any instruction inside the IF block is incompatible with predication
 (are there any such instructions?  I don't know) then don't do the
 optimization.
 - If the block is larger than a certain heuristically-determined size,
 then don't do the optimization.

 Such an