Mesa (master): gallium/svga: Pass the SVGA3D_SURFACE_HINT_RENDERTARGET flag to the device

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: master
Commit: 4dac89d92c711c01b7909d89b78ba568f9d5e1ef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4dac89d92c711c01b7909d89b78ba568f9d5e1ef

Author: Thomas Hellstrom 
Date:   Tue Jan 10 14:37:33 2012 +0100

gallium/svga: Pass the SVGA3D_SURFACE_HINT_RENDERTARGET flag to the device

Some hardware versions rely on it to render correctly.

Signed-off-by: Thomas Hellstrom 
Reviewed-by: José Fonseca 
Reviewed-by: Jakob Bornecrantz 

---

 src/gallium/drivers/svga/svga_resource_texture.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c 
b/src/gallium/drivers/svga/svga_resource_texture.c
index d374842..92286f9 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -454,16 +454,19 @@ svga_texture_create(struct pipe_screen *screen,
}
 
/* 
-* XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
+* Note: Previously we never passed the
+* SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
 * know beforehand whether a texture will be used as a rendertarget or not
 * and it always requests PIPE_BIND_RENDER_TARGET, therefore
 * passing the SVGA3D_SURFACE_HINT_RENDERTARGET here defeats its purpose.
+*
+* However, this was changed since other state trackers
+* (XA for example) uses it accurately and certain device versions
+* relies on it in certain situations to render correctly.
 */
-#if 0
if((template->bind & PIPE_BIND_RENDER_TARGET) &&
   !util_format_is_s3tc(template->format))
   tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET;
-#endif

if(template->bind & PIPE_BIND_DEPTH_STENCIL)
   tex->key.flags |= SVGA3D_SURFACE_HINT_DEPTHSTENCIL;

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


Mesa (8.0): gallium/svga: Pass the SVGA3D_SURFACE_HINT_RENDERTARGET flag to the device

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: 8.0
Commit: 7465c5d9761762134db86505a637676cc79e622f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7465c5d9761762134db86505a637676cc79e622f

Author: Thomas Hellstrom 
Date:   Tue Jan 10 14:37:33 2012 +0100

gallium/svga: Pass the SVGA3D_SURFACE_HINT_RENDERTARGET flag to the device

Some hardware versions rely on it to render correctly.

Signed-off-by: Thomas Hellstrom 
Reviewed-by: José Fonseca 
Reviewed-by: Jakob Bornecrantz 

---

 src/gallium/drivers/svga/svga_resource_texture.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c 
b/src/gallium/drivers/svga/svga_resource_texture.c
index d374842..92286f9 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -454,16 +454,19 @@ svga_texture_create(struct pipe_screen *screen,
}
 
/* 
-* XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
+* Note: Previously we never passed the
+* SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
 * know beforehand whether a texture will be used as a rendertarget or not
 * and it always requests PIPE_BIND_RENDER_TARGET, therefore
 * passing the SVGA3D_SURFACE_HINT_RENDERTARGET here defeats its purpose.
+*
+* However, this was changed since other state trackers
+* (XA for example) uses it accurately and certain device versions
+* relies on it in certain situations to render correctly.
 */
-#if 0
if((template->bind & PIPE_BIND_RENDER_TARGET) &&
   !util_format_is_s3tc(template->format))
   tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET;
-#endif

if(template->bind & PIPE_BIND_DEPTH_STENCIL)
   tex->key.flags |= SVGA3D_SURFACE_HINT_DEPTHSTENCIL;

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


Mesa (master): softpipe: bump max texture array layers to 256.

2012-01-12 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 16b5fda0328abb65f0bf245e28e85b753984e0c3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16b5fda0328abb65f0bf245e28e85b753984e0c3

Author: Dave Airlie 
Date:   Thu Jan 12 10:13:37 2012 +

softpipe: bump max texture array layers to 256.

This as per GL3 specification.

Signed-off-by: Dave Airlie 

---

 src/gallium/drivers/softpipe/sp_screen.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index 37aa585..32408f3 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -121,7 +121,7 @@ softpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
   return 1;
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
-  return 64; /* matches core Mesa defaults */
+  return 256; /* for GL3 */
case PIPE_CAP_MIN_TEXEL_OFFSET:
   return -8;
case PIPE_CAP_MAX_TEXEL_OFFSET:

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


Mesa (master): svga: Fix user clip planes.

2012-01-12 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: ce2929dde021e5754a3926b77b86b4de3208f4b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce2929dde021e5754a3926b77b86b4de3208f4b0

Author: José Fonseca 
Date:   Wed Jan 11 20:54:13 2012 +

svga: Fix user clip planes.

Dirty flags also need to be updated in face of recent interface change.

Fixes regression in compiz.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_state_framebuffer.c |2 +-
 src/gallium/drivers/svga/svga_state_rss.c |5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c 
b/src/gallium/drivers/svga/svga_state_framebuffer.c
index f3625e0..3244023 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -477,7 +477,7 @@ emit_clip_planes( struct svga_context *svga,
 
/* TODO: just emit directly from svga_set_clip_state()?
 */
-   for (i = 0; i < 6; i++) {
+   for (i = 0; i < SVGA3D_MAX_CLIP_PLANES; i++) {
   /* need to express the plane in D3D-style coordinate space.
* GL coords get converted to D3D coords with the matrix:
* [ 1  0  0  0 ]
diff --git a/src/gallium/drivers/svga/svga_state_rss.c 
b/src/gallium/drivers/svga/svga_state_rss.c
index d94ac35..af68d9c 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -244,8 +244,8 @@ static int emit_rss( struct svga_context *svga,
   EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail );
}
 
-   if (dirty & SVGA_NEW_CLIP) {
-  /* the number of clip planes is how many planes to enable */
+   if (dirty & SVGA_NEW_RAST) {
+  /* bitmask of the enabled clip planes */
   unsigned enabled = svga->curr.rast->templ.clip_plane_enable;
   EMIT_RS( svga, enabled, CLIPPLANEENABLE, fail );
}
@@ -285,7 +285,6 @@ struct svga_tracked_state svga_hw_rss =
 
(SVGA_NEW_BLEND |
 SVGA_NEW_BLEND_COLOR |
-SVGA_NEW_CLIP |
 SVGA_NEW_DEPTH_STENCIL |
 SVGA_NEW_STENCIL_REF |
 SVGA_NEW_RAST |

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


Mesa (master): st/xa: Bump version to 1.0.0 according to the README

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: master
Commit: 8a4f7d1cdc6f3c9e8a5a6f4a0928c3abdb132541
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a4f7d1cdc6f3c9e8a5a6f4a0928c3abdb132541

Author: Thomas Hellstrom 
Date:   Thu Jan 12 11:57:12 2012 +0100

st/xa: Bump version to 1.0.0 according to the README

Signed-off-by: Thomas Hellstrom 
Reviewed-by: Jakob Bornecrantz 

---

 src/gallium/state_trackers/xa/xa_tracker.h |4 ++--
 src/gallium/targets/xa-vmwgfx/Makefile |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/xa/xa_tracker.h 
b/src/gallium/state_trackers/xa/xa_tracker.h
index d3adedb..ffe24f7 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.h
+++ b/src/gallium/state_trackers/xa/xa_tracker.h
@@ -36,8 +36,8 @@
 
 #include 
 
-#define XA_TRACKER_VERSION_MAJOR 0
-#define XA_TRACKER_VERSION_MINOR 6
+#define XA_TRACKER_VERSION_MAJOR 1
+#define XA_TRACKER_VERSION_MINOR 0
 #define XA_TRACKER_VERSION_PATCH 0
 
 #define XA_FLAG_SHARED (1 << 0)
diff --git a/src/gallium/targets/xa-vmwgfx/Makefile 
b/src/gallium/targets/xa-vmwgfx/Makefile
index 26d95cb..f185e1a 100644
--- a/src/gallium/targets/xa-vmwgfx/Makefile
+++ b/src/gallium/targets/xa-vmwgfx/Makefile
@@ -3,8 +3,8 @@ include $(TOP)/configs/current
 
 # MACROS #
 
-XA_MAJOR = 0
-XA_MINOR = 6
+XA_MAJOR = 1
+XA_MINOR = 0
 XA_TINY = 0
 XA_CFLAGS = -Wall -pedantic
 

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


Mesa (master): configure: Add the svga gallium driver to the default gallium drivers

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: master
Commit: 87118d84ff11c040f677c7506afb813def1b9ff9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=87118d84ff11c040f677c7506afb813def1b9ff9

Author: Thomas Hellstrom 
Date:   Thu Jan 12 12:10:53 2012 +0100

configure: Add the svga gallium driver to the default gallium drivers

Signed-off-by: Thomas Hellstrom 
Reviewed-by: Jakob Bornecrantz 

---

 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index e2302de..7c50e3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -662,7 +662,7 @@ AC_ARG_ENABLE([gallium_gbm],
 [enable_gallium_gbm=auto])
 
 # Option for Gallium drivers
-GALLIUM_DRIVERS_DEFAULT="r300,r600,swrast"
+GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
 
 AC_ARG_WITH([gallium-drivers],
 [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],

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


Mesa (8.0): svga: Fix user clip planes.

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: 8.0
Commit: 4b86bd13474cfc6e0ffe5c7a1c2621c5a6171dac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b86bd13474cfc6e0ffe5c7a1c2621c5a6171dac

Author: José Fonseca 
Date:   Wed Jan 11 20:54:13 2012 +

svga: Fix user clip planes.

Dirty flags also need to be updated in face of recent interface change.

Fixes regression in compiz.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_state_framebuffer.c |2 +-
 src/gallium/drivers/svga/svga_state_rss.c |5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c 
b/src/gallium/drivers/svga/svga_state_framebuffer.c
index f3625e0..3244023 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -477,7 +477,7 @@ emit_clip_planes( struct svga_context *svga,
 
/* TODO: just emit directly from svga_set_clip_state()?
 */
-   for (i = 0; i < 6; i++) {
+   for (i = 0; i < SVGA3D_MAX_CLIP_PLANES; i++) {
   /* need to express the plane in D3D-style coordinate space.
* GL coords get converted to D3D coords with the matrix:
* [ 1  0  0  0 ]
diff --git a/src/gallium/drivers/svga/svga_state_rss.c 
b/src/gallium/drivers/svga/svga_state_rss.c
index d94ac35..af68d9c 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -244,8 +244,8 @@ static int emit_rss( struct svga_context *svga,
   EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail );
}
 
-   if (dirty & SVGA_NEW_CLIP) {
-  /* the number of clip planes is how many planes to enable */
+   if (dirty & SVGA_NEW_RAST) {
+  /* bitmask of the enabled clip planes */
   unsigned enabled = svga->curr.rast->templ.clip_plane_enable;
   EMIT_RS( svga, enabled, CLIPPLANEENABLE, fail );
}
@@ -285,7 +285,6 @@ struct svga_tracked_state svga_hw_rss =
 
(SVGA_NEW_BLEND |
 SVGA_NEW_BLEND_COLOR |
-SVGA_NEW_CLIP |
 SVGA_NEW_DEPTH_STENCIL |
 SVGA_NEW_STENCIL_REF |
 SVGA_NEW_RAST |

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


Mesa (8.0): configure: Add the svga gallium driver to the default gallium drivers

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: 8.0
Commit: 57665cb09e00761240afbb93adcd88f3ed139b15
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=57665cb09e00761240afbb93adcd88f3ed139b15

Author: Thomas Hellstrom 
Date:   Thu Jan 12 12:10:53 2012 +0100

configure: Add the svga gallium driver to the default gallium drivers

Signed-off-by: Thomas Hellstrom 
Reviewed-by: Jakob Bornecrantz 

---

 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index e2302de..7c50e3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -662,7 +662,7 @@ AC_ARG_ENABLE([gallium_gbm],
 [enable_gallium_gbm=auto])
 
 # Option for Gallium drivers
-GALLIUM_DRIVERS_DEFAULT="r300,r600,swrast"
+GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
 
 AC_ARG_WITH([gallium-drivers],
 [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],

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


Mesa (8.0): st/xa: Bump version to 1.0.0 according to the README

2012-01-12 Thread Thomas Hellstrom
Module: Mesa
Branch: 8.0
Commit: 372b7f1d35c141994ce9fd212ad6e42f8c01a3a3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=372b7f1d35c141994ce9fd212ad6e42f8c01a3a3

Author: Thomas Hellstrom 
Date:   Thu Jan 12 11:57:12 2012 +0100

st/xa: Bump version to 1.0.0 according to the README

Signed-off-by: Thomas Hellstrom 
Reviewed-by: Jakob Bornecrantz 

---

 src/gallium/state_trackers/xa/xa_tracker.h |4 ++--
 src/gallium/targets/xa-vmwgfx/Makefile |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/xa/xa_tracker.h 
b/src/gallium/state_trackers/xa/xa_tracker.h
index d3adedb..ffe24f7 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.h
+++ b/src/gallium/state_trackers/xa/xa_tracker.h
@@ -36,8 +36,8 @@
 
 #include 
 
-#define XA_TRACKER_VERSION_MAJOR 0
-#define XA_TRACKER_VERSION_MINOR 6
+#define XA_TRACKER_VERSION_MAJOR 1
+#define XA_TRACKER_VERSION_MINOR 0
 #define XA_TRACKER_VERSION_PATCH 0
 
 #define XA_FLAG_SHARED (1 << 0)
diff --git a/src/gallium/targets/xa-vmwgfx/Makefile 
b/src/gallium/targets/xa-vmwgfx/Makefile
index 26d95cb..f185e1a 100644
--- a/src/gallium/targets/xa-vmwgfx/Makefile
+++ b/src/gallium/targets/xa-vmwgfx/Makefile
@@ -3,8 +3,8 @@ include $(TOP)/configs/current
 
 # MACROS #
 
-XA_MAJOR = 0
-XA_MINOR = 6
+XA_MAJOR = 1
+XA_MINOR = 0
 XA_TINY = 0
 XA_CFLAGS = -Wall -pedantic
 

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


Mesa (master): mesa: remove _mesa_ffs(), implement ffs() for non-GNU platforms

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a548c27aa704236cc1d8a5d4ebf68cea9c5c99c

Author: Brian Paul 
Date:   Thu Jan 12 07:30:48 2012 -0700

mesa: remove _mesa_ffs(), implement ffs() for non-GNU platforms

Call ffs() and ffsll() everywhere.  Define our own ffs(), ffsll()
functions when the platform doesn't have them.

v2: remove #ifdef _WIN32, __IBMC__, __IBMCPP_ tests inside ffs()
implementation.  The #else clause was recursive.

Reviewed-by: Kenneth Graunke 
Tested-by: Alexander von Gluck 

---

 src/mesa/drivers/dri/i965/brw_wm_emit.c  |   12 ++--
 src/mesa/drivers/dri/i965/brw_wm_fp.c|4 ++--
 src/mesa/drivers/dri/intel/intel_blit.c  |2 +-
 src/mesa/drivers/dri/intel/intel_clear.c |2 +-
 src/mesa/main/arrayobj.c |2 +-
 src/mesa/main/bitset.h   |2 +-
 src/mesa/main/buffers.c  |4 ++--
 src/mesa/main/ff_fragment_shader.cpp |2 +-
 src/mesa/main/ffvertex_prog.c|2 +-
 src/mesa/main/imports.c  |   15 ++-
 src/mesa/main/imports.h  |   21 -
 src/mesa/main/shaderapi.c|1 +
 src/mesa/program/prog_print.c|4 ++--
 src/mesa/swrast/s_texture.c  |4 ++--
 14 files changed, 35 insertions(+), 42 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c 
b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index 270e321..2647a38 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -766,7 +766,7 @@ void emit_dp2(struct brw_compile *p,
  const struct brw_reg *arg0,
  const struct brw_reg *arg1)
 {
-   int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+   int dst_chan = ffs(mask & WRITEMASK_XYZW) - 1;
 
if (!(mask & WRITEMASK_XYZW))
   return; /* Do not emit dead code */
@@ -787,7 +787,7 @@ void emit_dp3(struct brw_compile *p,
  const struct brw_reg *arg0,
  const struct brw_reg *arg1)
 {
-   int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+   int dst_chan = ffs(mask & WRITEMASK_XYZW) - 1;
 
if (!(mask & WRITEMASK_XYZW))
   return; /* Do not emit dead code */
@@ -809,7 +809,7 @@ void emit_dp4(struct brw_compile *p,
  const struct brw_reg *arg0,
  const struct brw_reg *arg1)
 {
-   int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+   int dst_chan = ffs(mask & WRITEMASK_XYZW) - 1;
 
if (!(mask & WRITEMASK_XYZW))
   return; /* Do not emit dead code */
@@ -832,7 +832,7 @@ void emit_dph(struct brw_compile *p,
  const struct brw_reg *arg0,
  const struct brw_reg *arg1)
 {
-   const int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+   const int dst_chan = ffs(mask & WRITEMASK_XYZW) - 1;
 
if (!(mask & WRITEMASK_XYZW))
   return; /* Do not emit dead code */
@@ -882,7 +882,7 @@ void emit_math1(struct brw_wm_compile *c,
 {
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
-   int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+   int dst_chan = ffs(mask & WRITEMASK_XYZW) - 1;
GLuint saturate = ((mask & SATURATE) ?
  BRW_MATH_SATURATE_SATURATE :
  BRW_MATH_SATURATE_NONE);
@@ -945,7 +945,7 @@ void emit_math2(struct brw_wm_compile *c,
 {
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
-   int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+   int dst_chan = ffs(mask & WRITEMASK_XYZW) - 1;
 
if (!(mask & WRITEMASK_XYZW))
   return; /* Do not emit dead code */
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c 
b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 1358e74..b40c501 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -159,7 +159,7 @@ static struct prog_dst_register dst_undef( void )
 
 static struct prog_dst_register get_temp( struct brw_wm_compile *c )
 {
-   int bit = _mesa_ffs( ~c->fp_temp );
+   int bit = ffs( ~c->fp_temp );
 
if (!bit) {
   printf("%s: out of temporaries\n", __FILE__);
@@ -260,7 +260,7 @@ static struct prog_instruction *emit_scalar_insn(struct 
brw_wm_compile *c,
if (inst0->DstReg.WriteMask == 0)
   return NULL;
 
-   dst_chan = _mesa_ffs(inst0->DstReg.WriteMask) - 1;
+   dst_chan = ffs(inst0->DstReg.WriteMask) - 1;
inst = get_fp_inst(c);
*inst = *inst0;
inst->DstReg.WriteMask = 1 << dst_chan;
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c 
b/src/mesa/drivers/dri/intel/intel_blit.c
index 1369e63..e484fd3 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -261,7 +261,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
/* Loop over all renderbuffers */
mask &= (1 << BUFFER_COUNT) - 1;
while (mask) {
-  GLuint buf = _mesa_ffs(

Mesa (master): configs: fix, simplify RADEON_LIBS, RADEON_CFLAGS

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c7188ece0ee33f13e6f6aa776a5639bcd4047e5b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7188ece0ee33f13e6f6aa776a5639bcd4047e5b

Author: Brian Paul 
Date:   Thu Jan 12 07:53:22 2012 -0700

configs: fix, simplify RADEON_LIBS, RADEON_CFLAGS

Fixes build problems with the r200, radeon drivers.

NOTE: This is a candidate for the 8.0 branch.

---

 configs/linux-dri |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/configs/linux-dri b/configs/linux-dri
index 6990c3a..e63790e 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -70,7 +70,6 @@ INTEL_CFLAGS = $(shell $(PKG_CONFIG) --cflags libdrm_intel)
 NOUVEAU_LIBS = $(shell $(PKG_CONFIG) --libs libdrm_nouveau)
 NOUVEAU_CFLAGS = $(shell $(PKG_CONFIG) --cflags libdrm_nouveau)
 
-LIBDRM_RADEON_LIBS = $(shell $(PKG_CONFIG) --libs libdrm_radeon)
-LIBDRM_RADEON_CFLAGS = $(shell $(PKG_CONFIG) --cflags libdrm_radeon)
-RADEON_CFLAGS = "-DHAVE_LIBDRM_RADEON=1 $(LIBDRM_RADEON_CFLAGS)"
+RADEON_LIBS = $(shell $(PKG_CONFIG) --libs libdrm_radeon)
+RADEON_CFLAGS = $(shell $(PKG_CONFIG) --cflags libdrm_radeon)
 RADEON_LDFLAGS = $(LIBDRM_RADEON_LIBS)

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


Mesa (master): r600g: don't advertise integers yet on r600.

2012-01-12 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 3e044bcc4b2fcf9418f5a8fb682c8fab3bc454e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e044bcc4b2fcf9418f5a8fb682c8fab3bc454e9

Author: Dave Airlie 
Date:   Thu Jan 12 15:05:15 2012 +

r600g: don't advertise integers yet on r600.

Still some work to be done before this is finished.

This is a candidate for 8.0 branch.

Signed-off-by: Dave Airlie 

---

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

diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index e50b5cc..537024c 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -505,8 +505,6 @@ static int r600_get_shader_param(struct pipe_screen* 
pscreen, unsigned shader, e
case PIPE_SHADER_CAP_SUBROUTINES:
return 0;
case PIPE_SHADER_CAP_INTEGERS:
-   if (rscreen->chip_class == EVERGREEN)
-   return 1;
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 16;

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


Mesa (master): st/mesa: fix struct vs. class compilation warning

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9f2963b631cb2a2899fcb0eb384895fd33f9821d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f2963b631cb2a2899fcb0eb384895fd33f9821d

Author: Brian Paul 
Date:   Thu Jan 12 08:28:20 2012 -0700

st/mesa: fix struct vs. class compilation warning

glsl_to_tgsi_visitor is earlier defined as a class, not a struct.
Fixes MSVC warning.

NOTE: This is a candidate for the 8.0 branch.

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f5bee01..26047cf 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5093,7 +5093,7 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
 }
 
 void
-st_translate_stream_output_info(struct glsl_to_tgsi_visitor *glsl_to_tgsi,
+st_translate_stream_output_info(glsl_to_tgsi_visitor *glsl_to_tgsi,
 const GLuint outputMapping[],
 struct pipe_stream_output_info *so)
 {

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


Mesa (master): sofpipe: remove extraneous semicolon

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0c57323de8bcfb5932e14a88ef9554059fc3be72
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c57323de8bcfb5932e14a88ef9554059fc3be72

Author: Brian Paul 
Date:   Thu Jan 12 08:30:52 2012 -0700

sofpipe: remove extraneous semicolon

---

 src/gallium/drivers/softpipe/sp_screen.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index 32408f3..f5ff68c 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -45,7 +45,7 @@
 #include "sp_fence.h"
 #include "sp_public.h"
 
-DEBUG_GET_ONCE_BOOL_OPTION(use_llvm, "SOFTPIPE_USE_LLVM", FALSE);
+DEBUG_GET_ONCE_BOOL_OPTION(use_llvm, "SOFTPIPE_USE_LLVM", FALSE)
 
 static const char *
 softpipe_get_vendor(struct pipe_screen *screen)

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


Mesa (master): st/mesa: re-order #includes in st_manager.c

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8cfaab59e0875bff92179aacfffd690c805906ef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cfaab59e0875bff92179aacfffd690c805906ef

Author: Brian Paul 
Date:   Thu Jan 12 08:39:11 2012 -0700

st/mesa: re-order #includes in st_manager.c

include mesa headers before gallium headers to avoid problem with
ffs() being defined in u_math.h and then again in imports.h

The next commit will add some #ifdefs to prevent multiple definitions
of ffs().

---

 src/mesa/state_tracker/st_manager.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index b83cb23..63920a3 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -26,16 +26,6 @@
  *Chia-I Wu 
  */
 
-#include "state_tracker/st_gl_api.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "util/u_format.h"
-#include "util/u_pointer.h"
-#include "util/u_inlines.h"
-#include "util/u_atomic.h"
-#include "util/u_surface.h"
-
 #include "main/mtypes.h"
 #include "main/context.h"
 #include "main/mfeatures.h"
@@ -54,6 +44,16 @@
 #include "st_cb_flush.h"
 #include "st_manager.h"
 
+#include "state_tracker/st_gl_api.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "util/u_format.h"
+#include "util/u_pointer.h"
+#include "util/u_inlines.h"
+#include "util/u_atomic.h"
+#include "util/u_surface.h"
+
 /**
  * Cast wrapper to convert a struct gl_framebuffer to an st_framebuffer.
  * Return NULL if the struct gl_framebuffer is a user-created framebuffer.

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


Mesa (master): mesa/gallium: add FFS_DEFINED to protect ffs() from multiple definitions

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: eab036a6eaebd532f88c49bd26550c6225f96005
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eab036a6eaebd532f88c49bd26550c6225f96005

Author: Brian Paul 
Date:   Thu Jan 12 08:41:24 2012 -0700

mesa/gallium: add FFS_DEFINED to protect ffs() from multiple definitions

We include both imports.h and u_math.h in the state tracker.  This
leads to multiple, conflicting definitions of ffs() with MSVC.
Use FFS_DEFINED to skip the ffs() in u_math.h.

Reviewed-by: José Fonseca 

---

 src/gallium/auxiliary/util/u_math.h |5 +
 src/mesa/main/imports.h |4 
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 404bd21..f619666 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -340,6 +340,9 @@ util_is_inf_or_nan(float x)
  * Find first bit set in word.  Least significant bit is 1.
  * Return 0 if no bits set.
  */
+#ifndef FFS_DEFINED
+#define FFS_DEFINED 1
+
 #if defined(_MSC_VER) && _MSC_VER >= 1300 && (_M_IX86 || _M_AMD64 || _M_IA64)
 unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
 #pragma intrinsic(_BitScanForward)
@@ -372,6 +375,8 @@ unsigned ffs( unsigned u )
 #define ffs __builtin_ffs
 #endif
 
+#endif /* FFS_DEFINED */
+
 
 /* Destructively loop over all of the bits in a mask as in:
  *
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index bcf125a..ce7b45d 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -566,6 +566,9 @@ _mesa_inv_sqrtf(float x);
 extern void
 _mesa_init_sqrt_table(void);
 
+
+#ifndef FFS_DEFINED
+#define FFS_DEFINED 1
 #ifdef __GNUC__
 
 #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || 
defined(__APPLE__)
@@ -579,6 +582,7 @@ extern int ffs(int i);
 extern int ffsll(long long int i);
 
 #endif /*__ GNUC__ */
+#endif /* FFS_DEFINED */
 
 
 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 
or later */

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


Mesa (master): mesa: remove obsolete comment on _mesa_dest_buffer_exists()

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 45a3b540639921c4b562f4e3bb32d1b2f2f47d39
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=45a3b540639921c4b562f4e3bb32d1b2f2f47d39

Author: Brian Paul 
Date:   Mon Jan  9 09:38:06 2012 -0700

mesa: remove obsolete comment on _mesa_dest_buffer_exists()

---

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

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 730de62..3ce3955 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -851,7 +851,6 @@ _mesa_source_buffer_exists(struct gl_context *ctx, GLenum 
format)
 
 /**
  * As above, but for drawing operations.
- * XXX could do some code merging w/ above function.
  */
 GLboolean
 _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format)

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


Mesa (master): st/mesa: whitespace fixes, 80-column wrapping

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 50ad155d48c2be9d78c18573745d5a1f68368fad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50ad155d48c2be9d78c18573745d5a1f68368fad

Author: Brian Paul 
Date:   Mon Jan  9 09:30:13 2012 -0700

st/mesa: whitespace fixes, 80-column wrapping

---

 src/mesa/state_tracker/st_atom_texture.c |   35 ++
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_texture.c 
b/src/mesa/state_tracker/st_atom_texture.c
index 008e9bd..88e6128 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -1,8 +1,8 @@
 /**
- * 
+ *
  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * "Software"), to deal in the Software without restriction, including
@@ -10,11 +10,11 @@
  * distribute, sub license, 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 NON-INFRINGEMENT.
@@ -22,7 +22,7 @@
  * 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.
- * 
+ *
  **/
 
  /*
@@ -30,7 +30,7 @@
   *   Keith Whitwell 
   *   Brian Paul
   */
- 
+
 
 #include "main/macros.h"
 #include "main/mtypes.h"
@@ -182,8 +182,10 @@ st_get_texture_sampler_view_from_stobj(struct 
st_texture_object *stObj,
return stObj->sampler_view;
 }
 
+
 static GLboolean
-update_single_texture(struct st_context *st, struct pipe_sampler_view 
**sampler_view,
+update_single_texture(struct st_context *st,
+  struct pipe_sampler_view **sampler_view,
  GLuint texUnit)
 {
struct pipe_context *pipe = st->pipe;
@@ -233,7 +235,6 @@ update_single_texture(struct st_context *st, struct 
pipe_sampler_view **sampler_
 st_view_format = firstImageFormat;
}
 
-
/* if sampler view has changed dereference it */
if (stObj->sampler_view) {
   if (check_sampler_swizzle(stObj->sampler_view,
@@ -251,7 +252,8 @@ update_single_texture(struct st_context *st, struct 
pipe_sampler_view **sampler_
return GL_TRUE;
 }
 
-static void 
+
+static void
 update_vertex_textures(struct st_context *st)
 {
const struct gl_context *ctx = st->ctx;
@@ -275,7 +277,8 @@ update_vertex_textures(struct st_context *st)
 
  st->state.num_vertex_textures = su + 1;
   }
-  pipe_sampler_view_reference(&st->state.sampler_vertex_views[su], 
sampler_view);
+  pipe_sampler_view_reference(&st->state.sampler_vertex_views[su],
+  sampler_view);
}
 
if (ctx->Const.MaxVertexTextureImageUnits > 0) {
@@ -287,7 +290,8 @@ update_vertex_textures(struct st_context *st)
}
 }
 
-static void 
+
+static void
 update_fragment_textures(struct st_context *st)
 {
const struct gl_context *ctx = st->ctx;
@@ -319,6 +323,7 @@ update_fragment_textures(struct st_context *st)
   st->state.sampler_views);
 }
 
+
 const struct st_tracked_state st_update_texture = {
"st_update_texture",/* name */
{   /* dirty */
@@ -328,8 +333,9 @@ const struct st_tracked_state st_update_texture = {
update_fragment_textures/* update */
 };
 
+
 const struct st_tracked_state st_update_vertex_texture = {
-   "st_update_vertex_texture", /* name */
+   "st_update_vertex_texture", /* name */
{   /* dirty */
   _NEW_TEXTURE,/* mesa */
   ST_NEW_VERTEX_PROGRAM,   /* st */
@@ -337,7 +343,9 @@ const struct st_tracked_state st_update_vertex_texture = {
update_vertex_textures  /* update */
 };
 
-static void 
+
+
+static void
 finalize_textures(struct st_context *st)
 {
struct gl_context *ctx = st->ctx;
@@ -371,7 +379,6 @@ finalize_textures(struct st_context *st)
 }
 
 
-
 const struct st_tracked_state st_finalize_textures = {
"st_finalize_textures", /* name 

Mesa (master): mesa: use _mesa_is_user_fbo() and _mesa_is_winsys_fbo() functions

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 36ede89687fe2de213f2637ab7acfb80cfd856cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=36ede89687fe2de213f2637ab7acfb80cfd856cd

Author: Brian Paul 
Date:   Thu Jan 12 09:17:23 2012 -0700

mesa: use _mesa_is_user_fbo() and _mesa_is_winsys_fbo() functions

Rather than testing the fbo's name against zero.

Reviewed-by: José Fonseca 

---

 src/mesa/main/buffers.c  |   13 ++-
 src/mesa/main/fbobject.c |   47 -
 src/mesa/main/fbobject.h |   22 +++
 src/mesa/main/framebuffer.c  |8 +++---
 src/mesa/main/renderbuffer.c |2 +-
 src/mesa/main/teximage.c |6 ++--
 src/mesa/main/texobj.c   |2 +-
 7 files changed, 52 insertions(+), 48 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 602dd32..216b6ee 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -35,6 +35,7 @@
 #include "colormac.h"
 #include "context.h"
 #include "enums.h"
+#include "fbobject.h"
 #include "mtypes.h"
 
 
@@ -56,7 +57,7 @@ supported_buffer_bitmask(const struct gl_context *ctx,
 {
GLbitfield mask = 0x0;
 
-   if (fb->Name > 0) {
+   if (_mesa_is_user_fbo(fb)) {
   /* A user-created renderbuffer */
   GLuint i;
   ASSERT(ctx->Extensions.EXT_framebuffer_object);
@@ -357,7 +358,7 @@ updated_drawbuffers(struct gl_context *ctx)
   struct gl_framebuffer *fb = ctx->DrawBuffer;
 
   /* Flag the FBO as requiring validation. */
-  if (fb->Name != 0) {
+  if (_mesa_is_user_fbo(fb)) {
 fb->_Status = 0;
   }
}
@@ -452,7 +453,7 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const 
GLenum *buffers,
   fb->ColorDrawBuffer[buf] = GL_NONE;
}
 
-   if (fb->Name == 0) {
+   if (_mesa_is_winsys_fbo(fb)) {
   /* also set context drawbuffer state */
   for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
  if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
@@ -476,7 +477,7 @@ _mesa_update_draw_buffers(struct gl_context *ctx)
GLuint i;
 
/* should be a window system FBO */
-   assert(ctx->DrawBuffer->Name == 0);
+   assert(_mesa_is_winsys_fbo(ctx->DrawBuffer));
 
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
   buffers[i] = ctx->Color.DrawBuffer[i];
@@ -497,7 +498,7 @@ _mesa_readbuffer(struct gl_context *ctx, GLenum buffer, 
GLint bufferIndex)
 {
struct gl_framebuffer *fb = ctx->ReadBuffer;
 
-   if (fb->Name == 0) {
+   if (_mesa_is_winsys_fbo(fb)) {
   /* Only update the per-context READ_BUFFER state if we're bound to
* a window-system framebuffer.
*/
@@ -533,7 +534,7 @@ _mesa_ReadBuffer(GLenum buffer)
if (MESA_VERBOSE & VERBOSE_API)
   _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
 
-   if (fb->Name > 0 && buffer == GL_NONE) {
+   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
   /* This is legal for user-created framebuffer objects */
   srcBuffer = -1;
}
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index aefcaf3..de94da6 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -79,26 +79,6 @@ static struct gl_renderbuffer DummyRenderbuffer;
 static struct gl_framebuffer IncompleteFramebuffer;
 
 
-/**
- * Is the given FBO a user-created FBO?
- */
-static inline GLboolean
-is_user_fbo(const struct gl_framebuffer *fb)
-{
-   return fb->Name != 0;
-}
-
-
-/**
- * Is the given FBO a window system FBO (like an X window)?
- */
-static inline GLboolean
-is_winsys_fbo(const struct gl_framebuffer *fb)
-{
-   return fb->Name == 0;
-}
-
-
 static void
 delete_dummy_renderbuffer(struct gl_renderbuffer *rb)
 {
@@ -214,7 +194,7 @@ _mesa_get_attachment(struct gl_context *ctx, struct 
gl_framebuffer *fb,
 {
GLuint i;
 
-   assert(is_user_fbo(fb));
+   assert(_mesa_is_user_fbo(fb));
 
switch (attachment) {
case GL_COLOR_ATTACHMENT0_EXT:
@@ -265,7 +245,7 @@ static struct gl_renderbuffer_attachment *
 _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
  GLenum attachment)
 {
-   assert(is_winsys_fbo(fb));
+   assert(_mesa_is_winsys_fbo(fb));
 
switch (attachment) {
case GL_FRONT_LEFT:
@@ -711,7 +691,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
GLint i;
GLuint j;
 
-   assert(is_user_fbo(fb));
+   assert(_mesa_is_user_fbo(fb));
 
numImages = 0;
fb->Width = 0;
@@ -1009,10 +989,10 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint 
*renderbuffers)
_mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
 }
 
-if (is_user_fbo(ctx->DrawBuffer)) {
+if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
 }
-if (is_user_fbo(ctx->ReadBuffer)
+if (_mesa_is_user_fbo(ctx->ReadBuffer)
 && ctx->ReadBuffer != ctx->DrawBuffer) {
 

Mesa (master): mesa: whitespace, 80-column wrapping in buffers.c

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 185ee042ac4c6b08f7842b35d8234f2f8fab7831
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=185ee042ac4c6b08f7842b35d8234f2f8fab7831

Author: Brian Paul 
Date:   Mon Jan  9 11:07:23 2012 -0700

mesa: whitespace, 80-column wrapping in buffers.c

---

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

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 46c785f..602dd32 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -51,7 +51,8 @@
  * \return  bitmask of BUFFER_BIT_* flags
  */
 static GLbitfield
-supported_buffer_bitmask(const struct gl_context *ctx, const struct 
gl_framebuffer *fb)
+supported_buffer_bitmask(const struct gl_context *ctx,
+ const struct gl_framebuffer *fb)
 {
GLbitfield mask = 0x0;
 
@@ -242,7 +243,8 @@ _mesa_DrawBuffer(GLenum buffer)
   destMask = draw_buffer_enum_to_bitmask(buffer);
   if (destMask == BAD_MASK) {
  /* totally bogus buffer */
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer=0x%x)", 
buffer);
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glDrawBuffer(buffer=0x%x)", buffer);
  return;
   }
   destMask &= supportedMask;
@@ -340,6 +342,7 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
   ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
 }
 
+
 /**
  * Performs necessary state updates when _mesa_drawbuffers makes an
  * actual change.
@@ -361,6 +364,7 @@ updated_drawbuffers(struct gl_context *ctx)
 #endif
 }
 
+
 /**
  * Helper function to set the GL_DRAW_BUFFER state in the context and
  * current FBO.  Called via glDrawBuffer(), glDrawBuffersARB()

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


Mesa (master): meta: fix incorrect argument order in setup_texture_coords() call

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 2f0fa456e31a7030c911a563b62c84d448b09800
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f0fa456e31a7030c911a563b62c84d448b09800

Author: Brian Paul 
Date:   Thu Jan 12 09:50:27 2012 -0700

meta: fix incorrect argument order in setup_texture_coords() call

And pass integer width, height values.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca 

---

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

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index ad289aa..abf2f1f 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2920,8 +2920,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
 
/* setup texcoords (XXX what about border?) */
setup_texture_coords(faceTarget,
-0.0f, 0.0f, /* width, height never used here */
 slice,
+0, 0, /* width, height never used here */
 verts[0].tex,
 verts[1].tex,
 verts[2].tex,

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


Mesa (master): mesa: fix incorrect float vs. int values in a few places

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a240c998ac649d79f423bb0c445993132cd56f97
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a240c998ac649d79f423bb0c445993132cd56f97

Author: Brian Paul 
Date:   Thu Jan 12 09:51:21 2012 -0700

mesa: fix incorrect float vs. int values in a few places

In the first case, the newImage[] array contains GLuint values.
In the second case, the parameter type is GLuint, but the maxDepth
value is never used in this case (GL_FLOAT_32_UNSIGNED_INT_24_8_REV).
Pass ~OU just to be safe.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca 

---

 src/mesa/main/texstore.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 512965f..a9c64ce 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -515,9 +515,9 @@ make_temp_uint_image(struct gl_context *ctx, GLuint dims,
  for (k = 0; k < texComponents; k++) {
 GLint j = map[k];
 if (j == ZERO)
-   newImage[i * texComponents + k] = 0.0F;
+   newImage[i * texComponents + k] = 0;
 else if (j == ONE)
-   newImage[i * texComponents + k] = 1.0F;
+   newImage[i * texComponents + k] = 1;
 else
newImage[i * texComponents + k] = tempImage[i * logComponents + 
j];
  }
@@ -4094,7 +4094,7 @@ _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS)
_mesa_unpack_depth_span(ctx, srcWidth,
GL_FLOAT_32_UNSIGNED_INT_24_8_REV, /* 
dst type */
dstRow, /* dst addr */
-   1.0f, srcType, src, srcPacking);
+   ~0U, srcType, src, srcPacking);
 
 if (srcFormat != GL_DEPTH_COMPONENT)
_mesa_unpack_stencil_span(ctx, srcWidth,

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


Mesa (master): mesa: fix ir_variable declaration

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: decd018b992eb0f7f85338ee39083daca04885b6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=decd018b992eb0f7f85338ee39083daca04885b6

Author: Brian Paul 
Date:   Thu Jan 12 09:53:07 2012 -0700

mesa: fix ir_variable declaration

ir_variable is a class, not a struct.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca 

---

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

diff --git a/src/mesa/main/ff_fragment_shader.cpp 
b/src/mesa/main/ff_fragment_shader.cpp
index 7b8d1fe..afc17dc 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -528,7 +528,7 @@ struct texenv_fragment_program {
 */
 
/* Texcoord override from bumpmapping. */
-   struct ir_variable *texcoord_tex[MAX_TEXTURE_COORD_UNITS];
+   ir_variable *texcoord_tex[MAX_TEXTURE_COORD_UNITS];
 
/* Reg containing texcoord for a texture unit,
 * needed for bump mapping, else undef.

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


Mesa (master): swrast: use BITFIELD64_BIT() macro to fix MSVC warnings

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 706400f0a7a59bba89eca8e97a1ada45445ee6df
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=706400f0a7a59bba89eca8e97a1ada45445ee6df

Author: Brian Paul 
Date:   Thu Jan 12 09:54:04 2012 -0700

swrast: use BITFIELD64_BIT() macro to fix MSVC warnings

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca 

---

 src/mesa/swrast/s_aalinetemp.h |2 +-
 src/mesa/swrast/s_context.c|2 +-
 src/mesa/swrast/s_span.c   |6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index d99d9d3..376ef32 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -175,7 +175,7 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, 
const SWvertex *v1)
  line.attrPlane[attr][c]);
 }
  }
- line.span.arrayAttribs |= (1 << attr);
+ line.span.arrayAttribs |= BITFIELD64_BIT(attr);
  if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) {
 const GLuint u = attr - FRAG_ATTRIB_TEX0;
 const struct gl_texture_object *obj = 
ctx->Texture.Unit[u]._Current;
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 94b7fe3..06824ea 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -531,7 +531,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
{
   GLuint i, num = 0;
   for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
- if (attribsMask & (1 << i)) {
+ if (attribsMask & BITFIELD64_BIT(i)) {
 swrast->_ActiveAttribs[num++] = i;
 /* how should this attribute be interpolated? */
 if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 689fe34..e899303 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -175,7 +175,7 @@ interpolate_active_attribs(struct gl_context *ctx, SWspan 
*span,
attrMask &= ~span->arrayAttribs;
 
ATTRIB_LOOP_BEGIN
-  if (attrMask & (1 << attr)) {
+  if (attrMask & BITFIELD64_BIT(attr)) {
  const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3];
  GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3];
  const GLfloat dv0dx = span->attrStepX[attr][0];
@@ -199,8 +199,8 @@ interpolate_active_attribs(struct gl_context *ctx, SWspan 
*span,
 v3 += dv3dx;
 w += dwdx;
  }
- ASSERT((span->arrayAttribs & (1 << attr)) == 0);
- span->arrayAttribs |= (1 << attr);
+ ASSERT((span->arrayAttribs & BITFIELD64_BIT(attr)) == 0);
+ span->arrayAttribs |= BITFIELD64_BIT(attr);
   }
ATTRIB_LOOP_END
 }

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


Mesa (master): mesa: remove incorrect (float) cast in mipmap do_row()

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 003dd8adf39c964d8c7beb86955a61ceb3706ebc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=003dd8adf39c964d8c7beb86955a61ceb3706ebc

Author: Brian Paul 
Date:   Thu Jan 12 09:55:40 2012 -0700

mesa: remove incorrect (float) cast in mipmap do_row()

The array holds GLuint values so remove the float cast.
Note, however, that to compute the average of four GLuints we really
want to do (a+b+c+d)/4 but that could overflow.  This change doesn't
address that for now.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca 

---

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

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 867506c..03ce536 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -476,7 +476,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
   GLuint *dst = (GLuint *) dstRow;
   for (i = j = 0, k = k0; i < (GLuint) dstWidth;
i++, j += colStride, k += colStride) {
- dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] 
/ 4);
+ dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4;
   }
}
 

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


Mesa (master): i965/gen7: Fix depth buffer rendering to tile offsets.

2012-01-12 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: e6d6a10c5a2962f93d4adcd251b9a47a4e438121
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6d6a10c5a2962f93d4adcd251b9a47a4e438121

Author: Eric Anholt 
Date:   Wed Jan 11 15:31:30 2012 -0800

i965/gen7: Fix depth buffer rendering to tile offsets.

Previously, we were saying that everything from the starting tile to
region width+height was part of the limits of our depthbuffer, even if
the tile was near the bottom of the depthbuffer.  This mean that our
range was not clipping to buffer buonds if the start tile was anything
but the start of the buffer.

In bebc91f0f3a1f2d19d36a7f1a4f7c992ace064e9, this was changed to
saying that we're just rendering to a region of the size of the
renderbuffer.  This is great -- we get a range that should actually
match what we want.  However, the hardware's range checking occurs
after the X/Y offset addition, so we were clipping out rendering to
small depth mip levels when an X/Y offset was present.  Just add
tile_x/y to the width in that case -- the WM won't produce negative
x/y values pre-offset, so we just need to get the left/bottom sides of
the region to cover our buffer.

Fixes the following Piglit regressions on gen7:
spec/ARB_depth_buffer_float/fbo-clear-formats
spec/ARB_depth_texture/fbo-clear-formats
spec/EXT_packed_depth_stencil/fbo-clear-formats

NOTE: This is a candidate for the 8.0 branch.

---

 src/mesa/drivers/dri/i965/brw_misc_state.c  |4 ++--
 src/mesa/drivers/dri/i965/gen7_misc_state.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index f9652df..b6bca4b 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -376,8 +376,8 @@ static void emit_depthbuffer(struct brw_context *brw)
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
   OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) |
-   ((depth_irb->Base.Width - 1) << 6) |
-   ((depth_irb->Base.Height - 1) << 19));
+   (((depth_irb->Base.Width + tile_x)- 1) << 6) |
+   (((depth_irb->Base.Height + tile_y) - 1) << 19));
   OUT_BATCH(0);
 
   if (intel->is_g4x || intel->gen >= 5)
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c 
b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index 8a383f5..c2f58d5 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -107,8 +107,8 @@ static void emit_depthbuffer(struct brw_context *brw)
   OUT_RELOC(region->bo,
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
-  OUT_BATCH(((drb->Base.Width - 1) << 4) |
-((drb->Base.Height - 1) << 18));
+  OUT_BATCHdrb->Base.Width + tile_x) - 1) << 4) |
+(((drb->Base.Height + tile_y) - 1) << 18));
   OUT_BATCH(0);
   OUT_BATCH(tile_x | (tile_y << 16));
   OUT_BATCH(0);

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


Mesa (master): meta: Add GL_RED/GL_RG support to meta CopyTexImage.

2012-01-12 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: f83756f80f509fc51030853f8aa0fef3309fe886
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f83756f80f509fc51030853f8aa0fef3309fe886

Author: Eric Anholt 
Date:   Mon Jan  9 16:41:02 2012 -0800

meta: Add GL_RED/GL_RG support to meta CopyTexImage.

Fixes some _mesa_problem()s in oglconform.

Reviewed-by: Brian Paul 
NOTE: This is a candidate for the 8.0 branch.

---

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

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index abf2f1f..dca3613 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3071,6 +3071,8 @@ get_temp_image_type(struct gl_context *ctx, GLenum 
baseFormat)
switch (baseFormat) {
case GL_RGBA:
case GL_RGB:
+   case GL_RG:
+   case GL_RED:
case GL_ALPHA:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
@@ -3086,7 +3088,8 @@ get_temp_image_type(struct gl_context *ctx, GLenum 
baseFormat)
case GL_DEPTH_STENCIL:
   return GL_UNSIGNED_INT_24_8;
default:
-  _mesa_problem(ctx, "Unexpected format in get_temp_image_type()");
+  _mesa_problem(ctx, "Unexpected format %d in get_temp_image_type()",
+   baseFormat);
   return 0;
}
 }

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


Mesa (master): mesa: Avoid short-circuiting realloc of renderbuffers to new sample count.

2012-01-12 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 0e8d156c3cd70a67c99a82e42e7875f69b6a5b94
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e8d156c3cd70a67c99a82e42e7875f69b6a5b94

Author: Eric Anholt 
Date:   Wed Jan 11 13:46:43 2012 -0800

mesa: Avoid short-circuiting realloc of renderbuffers to new sample count.

Fixes piglit EXT_framebuffer_multisample/renderbuffer-samples.

Reviewed-by: Brian Paul 
NOTE: This is a candidate for the 8.0 branch.

---

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

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index de94da6..0524959 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1375,7 +1375,8 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
 
if (rb->InternalFormat == internalFormat &&
rb->Width == (GLuint) width &&
-   rb->Height == (GLuint) height) {
+   rb->Height == (GLuint) height &&
+   rb->NumSamples == samples) {
   /* no change in allocation needed */
   return;
}

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


Mesa (master): mesa: Throw the required error for glReadPixels() from a multisampled FBO.

2012-01-12 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 86b7c6707f915b07347070901d602917bc25dd0f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86b7c6707f915b07347070901d602917bc25dd0f

Author: Eric Anholt 
Date:   Wed Jan 11 13:54:53 2012 -0800

mesa: Throw the required error for glReadPixels() from a multisampled FBO.

Fixes piglit EXT_framebuffer_multisample-negative-readpixels.

Reviewed-by: Brian Paul 
NOTE: This is a candidate for the 8.0 branch.

---

 src/mesa/main/readpix.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 0c0e539..c1489d2 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -782,6 +782,11 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
   return;
}
 
+   if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
+  return;
+   }
+
if (!_mesa_source_buffer_exists(ctx, format)) {
   _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
   return;

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


Mesa (master): mesa: Throw the required error for glCopyTex{Sub, }Image from multisample FBO.

2012-01-12 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 6950a4faf650fe119ee97aa18b006eed099038be
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6950a4faf650fe119ee97aa18b006eed099038be

Author: Eric Anholt 
Date:   Wed Jan 11 14:02:41 2012 -0800

mesa: Throw the required error for glCopyTex{Sub,}Image from multisample FBO.

Fixes piglit EXT_framebuffer_multisample/negative-copyteximage.

Reviewed-by: Brian Paul 
NOTE: This is a candidate for the 8.0 branch.

---

 src/mesa/main/teximage.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ce62248..3973252 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1909,6 +1909,13 @@ copytexture_error_check( struct gl_context *ctx, GLuint 
dimensions,
  "glCopyTexImage%dD(invalid readbuffer)", dimensions);
  return GL_TRUE;
   }
+
+  if (ctx->ReadBuffer->Visual.samples > 0) {
+_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION,
+"glCopyTexImage%dD(multisample FBO)",
+dimensions);
+return GL_TRUE;
+  }
}
 
/* Check border */
@@ -2008,6 +2015,13 @@ copytexsubimage_error_check1( struct gl_context *ctx, 
GLuint dimensions,
  "glCopyTexImage%dD(invalid readbuffer)", dimensions);
  return GL_TRUE;
   }
+
+  if (ctx->ReadBuffer->Visual.samples > 0) {
+_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION,
+"glCopyTexSubImage%dD(multisample FBO)",
+dimensions);
+return GL_TRUE;
+  }
}
 
/* check target (proxies not allowed) */

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


Mesa (master): mesa: Throw the required error for glCopyPixels from multisample FBO.

2012-01-12 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 9be6654c1f75bc402c807ec0caccebde032afa59
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9be6654c1f75bc402c807ec0caccebde032afa59

Author: Eric Anholt 
Date:   Wed Jan 11 14:06:17 2012 -0800

mesa: Throw the required error for glCopyPixels from multisample FBO.

Fixes piglit EXT_framebuffer_multisample/negative-copypixels.

Reviewed-by: Brian Paul 
NOTE: This is a candidate for the 8.0 branch.

---

 src/mesa/main/drawpix.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 9f5b0b3..01983d9 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -203,6 +203,12 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, 
GLsizei height,
   goto end;
}
 
+   if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
+  _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION,
+ "glCopyPixels(multisample FBO)");
+  goto end;
+   }
+
if (!_mesa_source_buffer_exists(ctx, type) ||
!_mesa_dest_buffer_exists(ctx, type)) {
   _mesa_error(ctx, GL_INVALID_OPERATION,

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


Mesa (master): intel: fix mapping of malloc'd renderbuffers

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6dbdc0395698de929e23b4ec1ab399e64ecfd264
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dbdc0395698de929e23b4ec1ab399e64ecfd264

Author: Brian Paul 
Date:   Sat Jan  7 15:05:35 2012 -0700

intel: fix mapping of malloc'd renderbuffers

This fixes accum buffer operations.  The accumulation buffer is the
only malloc-based renderbuffer for the intel drivers.

v2: apply x/y offset to returned pointer

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Eric Anholt 

---

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

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index b95193d..1d8b10e 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -132,6 +132,15 @@ intel_map_renderbuffer(struct gl_context *ctx,
void *map;
int stride;
 
+   if (!irb && rb->Data) {
+  /* this is a malloc'd renderbuffer (accum buffer) */
+  GLint bpp = _mesa_get_format_bytes(rb->Format);
+  GLint rowStride = rb->RowStride * bpp;
+  *out_map = (GLubyte *) rb->Data + y * rowStride + x * bpp;
+  *out_stride = rowStride;
+  return;
+   }
+
/* We sometimes get called with this by our intel_span.c usage. */
if (!irb->mt) {
   *out_map = NULL;
@@ -176,6 +185,12 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
DBG("%s: rb %d (%s)\n", __FUNCTION__,
rb->Name, _mesa_get_format_name(rb->Format));
 
+   if (!irb && rb->Data) {
+  /* this is a malloc'd renderbuffer (accum buffer) */
+  /* nothing to do */
+  return;
+   }
+
intel_miptree_unmap(intel, irb->mt, irb->mt_level, irb->mt_layer);
 }
 

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


Mesa (master): intel: move declaration before code

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 062a4b601edaaea193397bd5d86fea11ceec04f4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=062a4b601edaaea193397bd5d86fea11ceec04f4

Author: Brian Paul 
Date:   Thu Jan 12 11:41:42 2012 -0700

intel: move declaration before code

---

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

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 1d8b10e..c37075c 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -651,10 +651,10 @@ intel_render_texture(struct gl_context * ctx,
struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer);
struct intel_texture_image *intel_image = intel_texture_image(image);
struct intel_mipmap_tree *mt = intel_image->mt;
+   int layer;
 
(void) fb;
 
-   int layer;
if (att->CubeMapFace > 0) {
   assert(att->Zoffset == 0);
   layer = att->CubeMapFace;

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


Mesa (master): osmesa: fix glReadPixels, etc

2012-01-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: cb254b75d7d971b3f1baab45a82cedf0bd6c36c4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb254b75d7d971b3f1baab45a82cedf0bd6c36c4

Author: Brian Paul 
Date:   Thu Jan 12 11:52:22 2012 -0700

osmesa: fix glReadPixels, etc

Needed to implement the Map/UnmapRenderbuffer() driver hooks.
This fixes glRead/Draw/CopyPixels, etc.

See https://bugs.freedesktop.org/show_bug.cgi?id=44723

Note: This is a candidate for the 8.0 branch.

Tested-by: Kevin Hobbs 

---

 src/mesa/drivers/osmesa/osmesa.c |   58 +-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index acfe629..67d329f 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -56,6 +56,8 @@
 #include "vbo/vbo.h"
 
 
+#define OSMESA_RENDERBUFFER_CLASS 0x053
+
 
 /**
  * OSMesa rendering context, derived from core Mesa struct gl_context.
@@ -932,11 +934,12 @@ new_osmesa_renderbuffer(struct gl_context *ctx, GLenum 
format, GLenum type)
   rb->RefCount = 1;
   rb->Delete = osmesa_delete_renderbuffer;
   rb->AllocStorage = osmesa_renderbuffer_storage;
+  rb->ClassID = OSMESA_RENDERBUFFER_CLASS;
 
   rb->InternalFormat = GL_RGBA;
   switch (type) {
   case GL_UNSIGNED_BYTE:
- rb->Format = MESA_FORMAT_RGBA;
+ rb->Format = MESA_FORMAT_RGBA_REV;
  break;
   case GL_UNSIGNED_SHORT:
  rb->Format = MESA_FORMAT_RGBA_16;
@@ -959,6 +962,56 @@ new_osmesa_renderbuffer(struct gl_context *ctx, GLenum 
format, GLenum type)
 }
 
 
+
+static void
+osmesa_MapRenderbuffer(struct gl_context *ctx,
+   struct gl_renderbuffer *rb,
+   GLuint x, GLuint y, GLuint w, GLuint h,
+   GLbitfield mode,
+   GLubyte **mapOut, GLint *rowStrideOut)
+{
+   const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
+
+   if (rb->ClassID == OSMESA_RENDERBUFFER_CLASS) {
+  /* this is an OSMesa renderbuffer which wraps user memory */
+  const GLuint bpp = _mesa_get_format_bytes(rb->Format);
+  GLint rowStride; /* in bytes */
+
+  if (osmesa->userRowLength)
+ rowStride = osmesa->userRowLength * bpp;
+  else
+ rowStride = rb->Width * bpp;
+
+  if (!osmesa->yup) {
+ /* Y=0 is top line of window */
+ y = rb->Height - y - 1;
+ *rowStrideOut = -rowStride;
+  }
+  else {
+ *rowStrideOut = rowStride;
+  }
+
+  *mapOut = (GLubyte *) rb->Data + y * rowStride + x * bpp;
+   }
+   else {
+  _swrast_map_soft_renderbuffer(ctx, rb, x, y, w, h, mode,
+mapOut, rowStrideOut);
+   }
+}
+
+
+static void
+osmesa_UnmapRenderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
+{
+   if (rb->ClassID == OSMESA_RENDERBUFFER_CLASS) {
+  /* no-op */
+   }
+   else {
+  _swrast_unmap_soft_renderbuffer(ctx, rb);
+   }
+}
+
+
 /**/
 /*Public Functions*/
 /**/
@@ -1157,6 +1210,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, 
GLint stencilBits,
  tnl = TNL_CONTEXT(ctx);
  tnl->Driver.RunPipeline = _tnl_run_pipeline;
 
+ ctx->Driver.MapRenderbuffer = osmesa_MapRenderbuffer;
+ ctx->Driver.UnmapRenderbuffer = osmesa_UnmapRenderbuffer;
+
  /* Extend the software rasterizer with our optimized line and triangle
   * drawing functions.
   */

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


Mesa (master): nvc0: fix submission of VertexID and EdgeFlag in push mode

2012-01-12 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 7b6881932a71b36dd47f63200c9dbee8e2b9af4f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b6881932a71b36dd47f63200c9dbee8e2b9af4f

Author: Christoph Bumiller 
Date:   Thu Jan 12 19:12:02 2012 +0100

nvc0: fix submission of VertexID and EdgeFlag in push mode

NOTE: This is a candidate for the 8.0 branch.

---

 src/gallium/drivers/nv50/codegen/nv50_ir.cpp   |1 +
 src/gallium/drivers/nv50/codegen/nv50_ir_driver.h  |1 +
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |7 ++
 src/gallium/drivers/nvc0/nvc0_3d.xml.h |5 ++
 src/gallium/drivers/nvc0/nvc0_context.h|3 -
 src/gallium/drivers/nvc0/nvc0_program.c|8 ++-
 src/gallium/drivers/nvc0/nvc0_program.h|3 +-
 src/gallium/drivers/nvc0/nvc0_push.c   |   74 
 src/gallium/drivers/nvc0/nvc0_vbo.c|3 +-
 9 files changed, 84 insertions(+), 21 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp 
b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp
index a8f0529..7d9b7e2 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp
@@ -938,6 +938,7 @@ nv50_ir_init_prog_info(struct nv50_ir_prog_info *info)
}
info->io.clipDistance = 0xff;
info->io.pointSize = 0xff;
+   info->io.vertexId = 0xff;
info->io.edgeFlagIn = 0xff;
info->io.edgeFlagOut = 0xff;
info->io.fragDepth = 0xff;
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h 
b/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h
index 73fb023..a37a29a 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h
@@ -155,6 +155,7 @@ struct nv50_ir_prog_info
   uint8_t cullDistanceMask;  /* clip distance mode (1 bit per output) */
   int8_t genUserClip;/* request user clip planes for ClipVertex */
   uint8_t pointSize; /* output index for PointSize */
+  uint8_t vertexId;  /* system value index of VertexID */
   uint8_t edgeFlagIn;
   uint8_t edgeFlagOut;
   uint8_t fragDepth; /* output index of FragDepth */
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp 
b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index a1c8f84..c104dbe 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -864,6 +864,13 @@ bool Source::scanDeclaration(const struct 
tgsi_full_declaration *decl)
   }
   break;
case TGSI_FILE_SYSTEM_VALUE:
+  switch (sn) {
+  case TGSI_SEMANTIC_VERTEXID:
+ info->io.vertexId = first;
+ break;
+  default:
+ break;
+  }
   for (i = first; i <= last; ++i, ++si) {
  info->sv[i].sn = sn;
  info->sv[i].si = si;
diff --git a/src/gallium/drivers/nvc0/nvc0_3d.xml.h 
b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
index 8d6ea7e..6a1dff7 100644
--- a/src/gallium/drivers/nvc0/nvc0_3d.xml.h
+++ b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
@@ -913,6 +913,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT  0x0400
 #define NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_CONT  0x0800
 
+#define NVC0_3D_VERTEX_ID_REPLACE  0x161c
+#define NVC0_3D_VERTEX_ID_REPLACE_ENABLE   0x0001
+#define NVC0_3D_VERTEX_ID_REPLACE_SOURCE__MASK 0x0ff0
+#define NVC0_3D_VERTEX_ID_REPLACE_SOURCE__SHIFT4
+
 #define NVC0_3D_VERTEX_DATA0x1640
 
 #define NVC0_3D_PRIM_RESTART_ENABLE0x1644
diff --git a/src/gallium/drivers/nvc0/nvc0_context.h 
b/src/gallium/drivers/nvc0/nvc0_context.h
index af95d1a..b8f0d92 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nvc0/nvc0_context.h
@@ -134,9 +134,6 @@ struct nvc0_context {
struct draw_context *draw;
 };
 
-#define NVC0_USING_EDGEFLAG(ctx) \
-   ((ctx)->vertprog->vp.edgeflag < PIPE_MAX_ATTRIBS)
-
 static INLINE struct nvc0_context *
 nvc0_context(struct pipe_context *pipe)
 {
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c 
b/src/gallium/drivers/nvc0/nvc0_program.c
index 813008c..cff76fe 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -107,7 +107,7 @@ nvc0_vp_assign_input_slots(struct nv50_ir_prog_info *info)
 
for (n = 0, i = 0; i < info->numInputs; ++i) {
   switch (info->in[i].sn) {
-  case TGSI_SEMANTIC_INSTANCEID:
+  case TGSI_SEMANTIC_INSTANCEID: /* for SM4 only, in TGSI they're SVs */
   case TGSI_SEMANTIC_VERTEXID:
  info->in[i].mask = 0x1;
  info->in[i].slot[0] =
@@ -580,7 +580,11 @@ nvc0_program_translate(struct nvc0_program *prog)
prog->relocs = info->bin.relocData;
prog-

Mesa (master): nv50/ir: make use of TGSI_INTERPOLATE_COLOR

2012-01-12 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: af0ce1dba8219ff8628f1fa61cf93c11a77dab94
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af0ce1dba8219ff8628f1fa61cf93c11a77dab94

Author: Christoph Bumiller 
Date:   Thu Jan 12 19:28:03 2012 +0100

nv50/ir: make use of TGSI_INTERPOLATE_COLOR

Flat SHADE_MODEL still overrides any non-flat interpolation
qualifier, but pulling that state out of the rasterizer cso
isn't really worth the effort, is it ?

NOTE: This is a candidate for the 8.0 branch.

---

 src/gallium/drivers/nv50/codegen/nv50_ir_driver.h  |1 +
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |   14 +-
 .../drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp |5 -
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h 
b/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h
index a37a29a..84a5140 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_driver.h
@@ -42,6 +42,7 @@ struct nv50_ir_varying
unsigned mask : 4; /* vec4 mask */
unsigned linear   : 1; /* linearly interpolated if true (and not flat) */
unsigned flat : 1;
+   unsigned sc   : 1; /* special colour interpolation mode (SHADE_MODEL) */
unsigned centroid : 1;
unsigned patch: 1; /* patch constant value */
unsigned regular  : 1; /* driver-specific meaning (e.g. input in sreg) */
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp 
b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
index c104dbe..3fb679b 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
@@ -817,9 +817,11 @@ bool Source::scanDeclaration(const struct 
tgsi_full_declaration *decl)
case TGSI_INTERPOLATE_CONSTANT:
   info->in[i].flat = 1;
   break;
+   case TGSI_INTERPOLATE_COLOR:
+  info->in[i].sc = 1;
+  break;
case TGSI_INTERPOLATE_LINEAR:
-  if (sn != TGSI_SEMANTIC_COLOR) // GL_NICEST
- info->in[i].linear = 1;
+  info->in[i].linear = 1;
   break;
default:
   break;
@@ -1141,7 +1143,7 @@ Converter::makeSym(uint tgsiFile, int fileIdx, int idx, 
int c, uint32_t address)
 static inline uint8_t
 translateInterpMode(const struct nv50_ir_varying *var, operation& op)
 {
-   uint8_t mode;
+   uint8_t mode = NV50_IR_INTERP_PERSPECTIVE;
 
if (var->flat)
   mode = NV50_IR_INTERP_FLAT;
@@ -1149,9 +1151,11 @@ translateInterpMode(const struct nv50_ir_varying *var, 
operation& op)
if (var->linear)
   mode = NV50_IR_INTERP_LINEAR;
else
-  mode = NV50_IR_INTERP_PERSPECTIVE;
+   if (var->sc)
+  mode = NV50_IR_INTERP_SC;
 
-   op = (mode == NV50_IR_INTERP_PERSPECTIVE) ? OP_PINTERP : OP_LINTERP;
+   op = (mode == NV50_IR_INTERP_PERSPECTIVE || mode == NV50_IR_INTERP_SC)
+  ? OP_PINTERP : OP_LINTERP;
 
if (var->centroid)
   mode |= NV50_IR_INTERP_CENTROID;
diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp 
b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
index 5f906e4..1c19651 100644
--- a/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp
@@ -703,11 +703,6 @@ NVC0LoweringPass::visit(Instruction *i)
  assert(prog->getType() != Program::TYPE_FRAGMENT);
   }
   break;
-   case OP_PINTERP:
-  if (i->getSrc(0)->reg.data.offset >= 0x280 &&
-  i->getSrc(0)->reg.data.offset <  0x2c0)
- i->setInterpolate(i->getSampleMode() | NV50_IR_INTERP_SC);
-  break;
default:
   break;
}   

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


Mesa (master): i965 gen4-6: Fix off-by-one errors brw_create_constant_surface()

2012-01-12 Thread Paul Berry
Module: Mesa
Branch: master
Commit: f6f43bd5a276990c58c021bc047e60f9763df479
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6f43bd5a276990c58c021bc047e60f9763df479

Author: Paul Berry 
Date:   Mon Jan  9 14:45:04 2012 -0800

i965 gen4-6: Fix off-by-one errors brw_create_constant_surface()

Commit 9bdc44a52804a64219a0ca1a061b18596863e524 (i965: Replace struct
with bit shifting for WM pull constant surfaces) accidentally
introduced off-by-one errors into the calculation of the surface
width, height, and depth.  This patch restores the correct
computation.

The reason this wasn't noticed by Piglit tests is that the size of our
constant surfaces is always less than 2^20, therefore the off-by-one
error was causing the "depth" field of the surface to be set to all
1's.  The hardware interpreted this as an extremely large surface, so
overflow checking was effectively disabled.

No Piglit regressions on Sandy Bridge.

NOTE: This is a candidate for the 7.11 and 8.0 branches.

Reviewed-by: Eric Anholt 
Reviewed-by: Kenneth Graunke 

---

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

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 dedf594..b40f5e1 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -698,10 +698,10 @@ brw_create_constant_surface(struct brw_context *brw,
 
surf[1] = bo->offset; /* reloc */
 
-   surf[2] = (((w & 0x7f) - 1) << BRW_SURFACE_WIDTH_SHIFT |
- (((w >> 7) & 0x1fff) - 1) << BRW_SURFACE_HEIGHT_SHIFT);
+   surf[2] = ((w & 0x7f) << BRW_SURFACE_WIDTH_SHIFT |
+ ((w >> 7) & 0x1fff) << BRW_SURFACE_HEIGHT_SHIFT);
 
-   surf[3] = w >> 20) & 0x7f) - 1) << BRW_SURFACE_DEPTH_SHIFT |
+   surf[3] = (((w >> 20) & 0x7f) << BRW_SURFACE_DEPTH_SHIFT |
  (width * 16 - 1) << BRW_SURFACE_PITCH_SHIFT);
 
surf[4] = 0;

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


Mesa (master): i965: Set pitch of pull constant buffers to 16.

2012-01-12 Thread Paul Berry
Module: Mesa
Branch: master
Commit: fcd5af4a916b4ba7860ba27eb47404934bde0d08
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fcd5af4a916b4ba7860ba27eb47404934bde0d08

Author: Paul Berry 
Date:   Mon Jan  9 15:36:27 2012 -0800

i965: Set pitch of pull constant buffers to 16.

We always access pull constant buffers using the message types "OWord
Block Read" or "OWord Dual Block Read".  According to the Sandy Bridge
PRM, Vol 4 Part 1, pages 214 and 218, when using these messages:

"the surface pitch is ignored, the surface is treated as a
1-dimensional surface.  An element size (pitch) of 16 bytes is
used to determine the size of the buffer for out-of-bounds
checking if using the surface state model."

Previously we were setting the pitch for pull constant buffers to the
size of the whole constant buffer--this made no sense and would have
led to incorrect behavior if it were not for the fact that the pitch
is ignored.

For clarity, this patch sets the pitch for pull constant buffers to 16
bytes, consistent with the hardware's behavior.

v2: Clarify the meaning of the ignored values by writing them as (16 - 1).

Reviewed-by: Eric Anholt 
Reviewed-by: Kenneth Graunke 

---

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

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 b40f5e1..159509b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -702,7 +702,7 @@ brw_create_constant_surface(struct brw_context *brw,
  ((w >> 7) & 0x1fff) << BRW_SURFACE_HEIGHT_SHIFT);
 
surf[3] = (((w >> 20) & 0x7f) << BRW_SURFACE_DEPTH_SHIFT |
- (width * 16 - 1) << BRW_SURFACE_PITCH_SHIFT);
+ (16 - 1) << BRW_SURFACE_PITCH_SHIFT); /* ignored */
 
surf[4] = 0;
surf[5] = 0;
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 1c0183b..aed0b5d 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -157,7 +157,7 @@ gen7_create_constant_surface(struct brw_context *brw,
surf->ss2.width = w & 0x7f;/* bits 6:0 of size or width */
surf->ss2.height = (w >> 7) & 0x1fff;  /* bits 19:7 of size or width */
surf->ss3.depth = (w >> 20) & 0x7f;/* bits 26:20 of size or width */
-   surf->ss3.pitch = (width * 16) - 1; /* ignored?? */
+   surf->ss3.pitch = (16 - 1); /* ignored */
gen7_set_surface_tiling(surf, I915_TILING_NONE); /* tiling now allowed */
 
/* Emit relocation to surface contents.  Section 5.1.1 of the gen4

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


Mesa (master): i965: Fix Coverity wrong sizeof argument defect.

2012-01-12 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 3e18ad7fd7026e31fd92fe5cf7097d08e5b9a15a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e18ad7fd7026e31fd92fe5cf7097d08e5b9a15a

Author: Vinson Lee 
Date:   Thu Nov  3 00:36:27 2011 -0700

i965: Fix Coverity wrong sizeof argument defect.

NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42542
Reviewed-by: Kenneth Graunke 

---

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

diff --git a/src/mesa/drivers/dri/i965/gen7_viewport_state.c 
b/src/mesa/drivers/dri/i965/gen7_viewport_state.c
index 252a35b..d0b89d5 100644
--- a/src/mesa/drivers/dri/i965/gen7_viewport_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_viewport_state.c
@@ -38,7 +38,7 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw)
struct gen7_sf_clip_viewport *vp;
 
vp = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
-   sizeof(vp), 64, &brw->sf.vp_offset);
+   sizeof(*vp), 64, &brw->sf.vp_offset);
/* Also assign to clip.vp_offset in case something uses it. */
brw->clip.vp_offset = brw->sf.vp_offset;
 

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