Mesa (8.0): mesa: add missing GL_UNSIGNED_INT_10F_11F_11F_REV case

2012-06-20 Thread Chad Versace
Module: Mesa
Branch: 8.0
Commit: d715d3f4a82463a00a64d534747d80792508b97f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d715d3f4a82463a00a64d534747d80792508b97f

Author: Brian Paul 
Date:   Mon Feb 13 07:20:27 2012 -0700

mesa: add missing GL_UNSIGNED_INT_10F_11F_11F_REV case

in _mesa_error_check_format_and_type().

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45967
(cherry picked from commit df1cd55ebf362948788c04d2fa7da55c80991605)

---

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

diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 750db94..b6c2645 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -428,6 +428,15 @@ _mesa_error_check_format_and_type(const struct gl_context 
*ctx,
   }
   return GL_NO_ERROR;
 
+   case GL_UNSIGNED_INT_10F_11F_11F_REV:
+  if (!ctx->Extensions.EXT_packed_float) {
+ return GL_INVALID_ENUM;
+  }
+  if (format != GL_RGB) {
+ return GL_INVALID_OPERATION;
+  }
+  return GL_NO_ERROR;
+
default:
   ; /* fall-through */
}

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


Mesa (8.0): mesa: new _mesa_error_check_format_and_type() function

2012-06-20 Thread Chad Versace
Module: Mesa
Branch: 8.0
Commit: af47c324aaad0db9f38cd7edcc8563008636408c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af47c324aaad0db9f38cd7edcc8563008636408c

Author: Brian Paul 
Date:   Tue Feb  7 07:42:33 2012 -0700

mesa: new _mesa_error_check_format_and_type() function

This replaces the _mesa_is_legal_format_and_type() function.

According to the spec, some invalid format/type combinations to
glDrawPixels, ReadPixels and glTexImage should generate
GL_INVALID_ENUM but others should generate GL_INVALID_OPERATION.

With the old function we didn't make that distinction and generated
GL_INVALID_ENUM errors instead of GL_INVALID_OPERATION.  The new
function returns one of those errors or GL_NO_ERROR.

This will also let us remove some redundant format/type checks in
follow-on commit.

v2: add more checks for ARB_texture_rgb10_a2ui at the top of
_mesa_error_check_format_and_type() per Ian.

Signed-off-by: Brian Paul 
(cherry picked from commit 627b435dfe17698a1c69e9a259838fc6f2e6bd4e)

---

 src/mesa/main/image.c   |  216 ++
 src/mesa/main/image.h   |6 +-
 src/mesa/main/readpix.c |9 +-
 src/mesa/main/texgetimage.c |   16 ++--
 src/mesa/main/teximage.c|   25 ++---
 5 files changed, 178 insertions(+), 94 deletions(-)

diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 3491704..750db94 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -356,18 +356,83 @@ _mesa_bytes_per_pixel( GLenum format, GLenum type )
 
 
 /**
- * Test for a legal pixel format and type.
+ * Do error checking of format/type combinations for glReadPixels,
+ * glDrawPixels and glTex[Sub]Image.  Note that depending on the format
+ * and type values, we may either generate GL_INVALID_OPERATION or
+ * GL_INVALID_ENUM.
  *
  * \param format pixel format.
  * \param type pixel type.
  *
- * \return GL_TRUE if the given pixel format and type are legal, or GL_FALSE
- * otherwise.
+ * \return GL_INVALID_ENUM, GL_INVALID_OPERATION or GL_NO_ERROR
  */
-GLboolean
-_mesa_is_legal_format_and_type(const struct gl_context *ctx,
-   GLenum format, GLenum type)
+GLenum
+_mesa_error_check_format_and_type(const struct gl_context *ctx,
+  GLenum format, GLenum type)
 {
+   /* special type-based checks (see glReadPixels, glDrawPixels error lists) */
+   switch (type) {
+   case GL_BITMAP:
+  if (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX) {
+ return GL_INVALID_ENUM;
+  }
+  break;
+
+   case GL_UNSIGNED_BYTE_3_3_2:
+   case GL_UNSIGNED_BYTE_2_3_3_REV:
+   case GL_UNSIGNED_SHORT_5_6_5:
+   case GL_UNSIGNED_SHORT_5_6_5_REV:
+  if (format == GL_RGB) {
+ break; /* OK */
+  }
+  if (format == GL_RGB_INTEGER_EXT &&
+  ctx->Extensions.ARB_texture_rgb10_a2ui) {
+ break; /* OK */
+  }
+  return GL_INVALID_OPERATION;
+
+   case GL_UNSIGNED_SHORT_4_4_4_4:
+   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+   case GL_UNSIGNED_SHORT_5_5_5_1:
+   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+   case GL_UNSIGNED_INT_8_8_8_8:
+   case GL_UNSIGNED_INT_8_8_8_8_REV:
+   case GL_UNSIGNED_INT_10_10_10_2:
+   case GL_UNSIGNED_INT_2_10_10_10_REV:
+  if (format == GL_RGBA ||
+  format == GL_BGRA ||
+  format == GL_ABGR_EXT) {
+ break; /* OK */
+  }
+  if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) &&
+  ctx->Extensions.ARB_texture_rgb10_a2ui) {
+ break; /* OK */
+  }
+  return GL_INVALID_OPERATION;
+
+   case GL_UNSIGNED_INT_24_8:
+  if (!ctx->Extensions.EXT_packed_depth_stencil) {
+ return GL_INVALID_ENUM;
+  }
+  if (format != GL_DEPTH_STENCIL) {
+ return GL_INVALID_OPERATION;
+  }
+  return GL_NO_ERROR;
+
+   case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+  if (!ctx->Extensions.ARB_depth_buffer_float) {
+ return GL_INVALID_ENUM;
+  }
+  if (format != GL_DEPTH_STENCIL) {
+ return GL_INVALID_OPERATION;
+  }
+  return GL_NO_ERROR;
+
+   default:
+  ; /* fall-through */
+   }
+
+   /* now, for each format, check the type for compatibility */
switch (format) {
   case GL_COLOR_INDEX:
   case GL_STENCIL_INDEX:
@@ -380,12 +445,14 @@ _mesa_is_legal_format_and_type(const struct gl_context 
*ctx,
 case GL_INT:
 case GL_UNSIGNED_INT:
 case GL_FLOAT:
-   return GL_TRUE;
-case GL_HALF_FLOAT_ARB:
-   return ctx->Extensions.ARB_half_float_pixel;
+   return GL_NO_ERROR;
+case GL_HALF_FLOAT:
+   return ctx->Extensions.ARB_half_float_pixel
+  ? GL_NO_ERROR : GL_INVALID_ENUM;
 default:
-   return GL_FALSE;
+   return GL_INVALID_ENUM;
  }
+
   case GL_RED:
   case GL_GREEN:
   case GL_BLUE:
@@ -404,16 +471,17 @@ _mesa_is_legal_format_and_type(con

Mesa (8.0): mesa: allow exposing GL3 without EXT_texture_integer

2012-06-20 Thread Chad Versace
Module: Mesa
Branch: 8.0
Commit: 1af70e475f4816d5b9461528cb58f7fde65ff2f2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1af70e475f4816d5b9461528cb58f7fde65ff2f2

Author: Marek Olšák 
Date:   Sun Jan 22 20:25:42 2012 +0100

mesa: allow exposing GL3 without EXT_texture_integer

Strictly speaking, it's not legal to expose EXT_texture_integer without
EXT_gpu_shader4. It might be even dangerous (apps can assume EXT_gpu_shader4
is available without checking for it).

The check in compute_version is removed as well, because that's already
covered by GLSLVersion >= 130.

Reviewed-by: Brian Paul 
(cherry picked from commit 3363e87d7d5b3f19294fc770dc7c506c26646010)

---

 src/mesa/main/fbobject.c  |   16 ++--
 src/mesa/main/image.c |   12 
 src/mesa/main/texformat.c |   10 +-
 src/mesa/main/teximage.c  |   14 ++
 src/mesa/main/version.c   |1 -
 5 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index b5b10aa..64f592a 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1245,7 +1245,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
case GL_RGBA8I_EXT:
case GL_RGBA16I_EXT:
case GL_RGBA32I_EXT:
-  return ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
+  return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
 
case GL_RGB8UI_EXT:
case GL_RGB16UI_EXT:
@@ -1253,7 +1254,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
-  return ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
+  return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
 
case GL_R8UI:
case GL_R8I:
@@ -1261,8 +1263,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
case GL_R16I:
case GL_R32UI:
case GL_R32I:
-  return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer ? GL_RED : 0;
+  return ctx->VersionMajor >= 3 ||
+ (ctx->Extensions.ARB_texture_rg &&
+  ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
 
case GL_RG8UI:
case GL_RG8I:
@@ -1270,8 +1273,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
case GL_RG16I:
case GL_RG32UI:
case GL_RG32I:
-  return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer ? GL_RG : 0;
+  return ctx->VersionMajor >= 3 ||
+ (ctx->Extensions.ARB_texture_rg &&
+  ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
 
case GL_INTENSITY8I_EXT:
case GL_INTENSITY8UI_EXT:
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 8b65cf0..3491704 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -536,7 +536,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
 case GL_UNSIGNED_SHORT:
 case GL_INT:
 case GL_UNSIGNED_INT:
-   return ctx->Extensions.EXT_texture_integer;
+   return ctx->VersionMajor >= 3 ||
+  ctx->Extensions.EXT_texture_integer;
 default:
return GL_FALSE;
  }
@@ -549,7 +550,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
 case GL_UNSIGNED_SHORT:
 case GL_INT:
 case GL_UNSIGNED_INT:
-   return ctx->Extensions.EXT_texture_integer;
+   return ctx->VersionMajor >= 3 ||
+  ctx->Extensions.EXT_texture_integer;
 case GL_UNSIGNED_BYTE_3_3_2:
 case GL_UNSIGNED_BYTE_2_3_3_REV:
 case GL_UNSIGNED_SHORT_5_6_5:
@@ -568,7 +570,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
 case GL_INT:
 case GL_UNSIGNED_INT:
 /* NOTE: no packed formats w/ BGR format */
-   return ctx->Extensions.EXT_texture_integer;
+   return ctx->VersionMajor >= 3 ||
+  ctx->Extensions.EXT_texture_integer;
 default:
return GL_FALSE;
  }
@@ -582,7 +585,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
 case GL_UNSIGNED_SHORT:
 case GL_INT:
 case GL_UNSIGNED_INT:
-   return ctx->Extensions.EXT_texture_integer;
+   return ctx->VersionMajor >= 3 ||
+  ctx->Extensions.EXT_texture_integer;
 case GL_UNSIGNED_SHORT_4_4_4_4:
 case GL_UNSIGNED_SHORT_4_4_4_4_REV:
 case GL_UNSIGNED_SHORT_5_5_5_1:
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 259eb90..5fdc2ab 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -706,6 +706,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLi

Mesa (master): nv50: fix buffer reuse issues

2012-06-20 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 19fd04f5eaf76f6ea5effa69d91c415bba75ba8e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19fd04f5eaf76f6ea5effa69d91c415bba75ba8e

Author: Marcin Slusarz 
Date:   Tue Jun 19 23:38:34 2012 +0200

nv50: fix buffer reuse issues

1) We need to insert a barrier between consecutive transform feedback calls.
2) VBO cache needs to be flushed when TFB output is used as VBO draw input.

Fixes Piglit test EXT_transform_feedback/immediate-reuse.

Thanks to Christoph Bumiller for pointing out bugs in previous versions
of this patch.

---

 src/gallium/drivers/nv50/nv50_shader_state.c |6 ++
 src/gallium/drivers/nv50/nv50_vbo.c  |   12 
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c 
b/src/gallium/drivers/nv50/nv50_shader_state.c
index 1ddcd3c..586eefe 100644
--- a/src/gallium/drivers/nv50/nv50_shader_state.c
+++ b/src/gallium/drivers/nv50/nv50_shader_state.c
@@ -564,6 +564,12 @@ nv50_stream_output_validate(struct nv50_context *nv50)
   return;
}
 
+   /* previous TFB needs to complete */
+   if (nv50->screen->base.class_3d < NVA0_3D_CLASS) {
+  BEGIN_NV04(push, SUBC_3D(NV50_GRAPH_SERIALIZE), 1);
+  PUSH_DATA (push, 0);
+   }
+
ctrl = so->ctrl;
if (nv50->screen->base.class_3d >= NVA0_3D_CLASS)
   ctrl |= NVA0_3D_STRMOUT_BUFFERS_CTRL_LIMIT_MODE_OFFSET;
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c 
b/src/gallium/drivers/nv50/nv50_vbo.c
index 1875d4d..6e81b7b 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -293,6 +293,18 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
else
   nv50->vbo_fifo = 0;
 
+   if (!nv50->vbo_fifo) {
+  /* if vertex buffer was written by GPU - flush VBO cache */
+  for (i = 0; i < nv50->num_vtxbufs; ++i) {
+ struct nv04_resource *buf = nv04_resource(nv50->vtxbuf[i].buffer);
+ if (buf && buf->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING) {
+buf->status &= ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
+nv50->base.vbo_dirty = TRUE;
+break;
+ }
+  }
+   }
+
/* update vertex format state */
BEGIN_NV04(push, NV50_3D(VERTEX_ARRAY_ATTRIB(0)), n);
if (nv50->vbo_fifo) {

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


Mesa (master): st/mesa: fix transform feedback of unsubscripted gl_ClipDistance array

2012-06-20 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 7e63b613a5a067462c450338e0bdce5b5976f6f1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e63b613a5a067462c450338e0bdce5b5976f6f1

Author: Marcin Slusarz 
Date:   Sat Jun 16 20:30:14 2012 +0200

st/mesa: fix transform feedback of unsubscripted gl_ClipDistance array

gl_ClipDistance needs special treatment in form of lowering pass
which transforms gl_ClipDistance representation from float[] to
vec4[]. There are 2 implementations - at glsl linker level (enabled
by LowerClipDistance option) and at glsl_to_tgsi level (enabled
unconditionally for gallium drivers). Second implementation is
incomplete - it does not take into account transform feedback (see
commit 642e5b413e0890b2070ba78fde42db381eaf02e5 "mesa: Fix transform
feedback of unsubscripted gl_ClipDistance array" for details).

There are 2 possible fixes:
- adding transform feedback support into glsl_to_tgsi version
- ripping gl_ClipDistance support from glsl_to_tgsi and enabling
  gl_ClipDistance lowering on glsl linker side

This patch implements 2nd option. All it does is:
- reverts most of the commit 59be691638200797583bce39a83f641d30d97492
  "st/mesa: add support for gl_ClipDistance"
- changes LowerClipDistance to true

Fixes Piglit tests "EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{2,3,4,5,6,7,8}]-no-subscript" at least on nv50
and evergreen cards.

---

 src/mesa/state_tracker/st_extensions.c |1 +
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   49 +++-
 2 files changed, 6 insertions(+), 44 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 17f271f..dacad9b 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -222,6 +222,7 @@ void st_init_limits(struct st_context *st)
  options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, 
sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
   else
  options->MaxUnrollIterations = 255; /* SM3 limit */
+  options->LowerClipDistance = true;
}
 
/* PIPE_SHADER_CAP_MAX_INPUTS for the FS specifies the maximum number
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5802b52..b6abe84 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -304,7 +304,6 @@ public:
int samplers_used;
bool indirect_addr_temps;
bool indirect_addr_consts;
-   int num_clip_distances;

int glsl_version;
bool native_integers;
@@ -2825,7 +2824,6 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
samplers_used = 0;
indirect_addr_temps = false;
indirect_addr_consts = false;
-   num_clip_distances = 0;
glsl_version = 0;
native_integers = false;
mem_ctx = ralloc_context(NULL);
@@ -4593,17 +4591,9 @@ st_translate_program(
   }
 
   for (i = 0; i < numOutputs; i++) {
- if (outputSemanticName[i] == TGSI_SEMANTIC_CLIPDIST) {
-int mask = ((1 << (program->num_clip_distances - 
4*outputSemanticIndex[i])) - 1) & TGSI_WRITEMASK_XYZW;
-t->outputs[i] = ureg_DECL_output_masked(ureg,
-outputSemanticName[i],
-outputSemanticIndex[i],
-mask);
- } else {
-t->outputs[i] = ureg_DECL_output(ureg,
- outputSemanticName[i],
- outputSemanticIndex[i]);
- }
+ t->outputs[i] = ureg_DECL_output(ureg,
+  outputSemanticName[i],
+  outputSemanticIndex[i]);
   }
   if (passthrough_edgeflags)
  emit_edgeflags(t);
@@ -4759,8 +4749,7 @@ out:
 static struct gl_program *
 get_mesa_program(struct gl_context *ctx,
  struct gl_shader_program *shader_program,
- struct gl_shader *shader,
- int num_clip_distances)
+ struct gl_shader *shader)
 {
glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
struct gl_program *prog;
@@ -4800,7 +4789,6 @@ get_mesa_program(struct gl_context *ctx,
v->options = options;
v->glsl_version = ctx->Const.GLSLVersion;
v->native_integers = ctx->Const.NativeIntegers;
-   v->num_clip_distances = num_clip_distances;
 
_mesa_generate_parameters_list_for_uniforms(shader_program, shader,
   prog->Parameters);
@@ -4925,25 +4913,6 @@ get_mesa_program(struct gl_context *ctx,
return prog;
 }
 
-/**
- * Searches through the IR for a declaration of gl_ClipDistance and returns the
- * declared size of the gl_ClipDistance array.  Returns 0 if gl_ClipDistance is
- * not declared in the IR.
- */
-int get_clip_distance_size(exec_list *ir)
-{
-   forea

Mesa (master): i965/msaa: Only do multisample rasterization if GL_MULTISAMPLE enabled.

2012-06-20 Thread Paul Berry
Module: Mesa
Branch: master
Commit: cde6544ad7cbc0f4567d294e4d2ac4214199c6ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cde6544ad7cbc0f4567d294e4d2ac4214199c6ec

Author: Paul Berry 
Date:   Sat Jun 16 11:32:04 2012 -0700

i965/msaa: Only do multisample rasterization if GL_MULTISAMPLE enabled.

>From the GL 3.0 spec (p.116):

"Multisample rasterization is enabled or disabled by calling
Enable or Disable with the symbolic constant MULTISAMPLE."

Elsewhere in the spec, where multisample rasterization is described
(sections 3.4.3, 3.5.4, and 3.6.6), the following text is consistently
used:

"If MULTISAMPLE is enabled, and the value of SAMPLE_BUFFERS is
one, then..."

So, in other words, disabling GL_MULTISAMPLE should prevent
multisample rasterization from occurring, even if the draw framebuffer
is multisampled.  This patch implements that behaviour by setting the
WM and SF stage's "multisample rasterization mode" to
MSRAST_ON_PATTERN only when the draw framebuffer is multisampled *and*
GL_MULTISAMPLE is enabled.

Fixes piglit test spec/EXT_framebuffer_multisample/enable-flag.

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

---

 src/mesa/drivers/dri/i965/gen6_sf_state.c |   10 ++
 src/mesa/drivers/dri/i965/gen6_wm_state.c |   15 ++-
 src/mesa/drivers/dri/i965/gen7_sf_state.c |   10 ++
 src/mesa/drivers/dri/i965/gen7_wm_state.c |   15 ++-
 4 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index e0aaa90..aeed369 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -122,9 +122,9 @@ upload_sf_state(struct brw_context *brw)
int i;
/* _NEW_BUFFER */
bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
-   bool multisampled = false;
+   bool multisampled_fbo = false;
if (ctx->DrawBuffer->_ColorDrawBuffers[0])
-  multisampled = ctx->DrawBuffer->_ColorDrawBuffers[0]->NumSamples > 0;
+  multisampled_fbo = ctx->DrawBuffer->_ColorDrawBuffers[0]->NumSamples > 0;
 
int attr = 0, input_index = 0;
int urb_entry_read_offset = 1;
@@ -242,7 +242,8 @@ upload_sf_state(struct brw_context *brw)
   dw3 |= GEN6_SF_LINE_AA_MODE_TRUE;
   dw3 |= GEN6_SF_LINE_END_CAP_WIDTH_1_0;
}
-   if (multisampled)
+   /* _NEW_MULTISAMPLE */
+   if (multisampled_fbo && ctx->Multisample.Enabled)
   dw3 |= GEN6_SF_MSRAST_ON_PATTERN;
 
/* _NEW_PROGRAM | _NEW_POINT */
@@ -349,7 +350,8 @@ const struct brw_tracked_state gen6_sf_state = {
_NEW_LINE |
_NEW_SCISSOR |
_NEW_BUFFERS |
-   _NEW_POINT),
+   _NEW_POINT |
+_NEW_MULTISAMPLE),
   .brw   = (BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM),
   .cache = CACHE_NEW_VS_PROG
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c 
b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index cba2a57..662435e 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -98,11 +98,11 @@ upload_wm_state(struct brw_context *brw)
const struct brw_fragment_program *fp =
   brw_fragment_program_const(brw->fragment_program);
uint32_t dw2, dw4, dw5, dw6;
-   bool multisampled = false;
+   bool multisampled_fbo = false;
 
/* _NEW_BUFFERS */
if (ctx->DrawBuffer->_ColorDrawBuffers[0])
-  multisampled = ctx->DrawBuffer->_ColorDrawBuffers[0]->NumSamples > 0;
+  multisampled_fbo = ctx->DrawBuffer->_ColorDrawBuffers[0]->NumSamples > 0;
 
 /* CACHE_NEW_WM_PROG */
if (brw->wm.prog_data->nr_params == 0) {
@@ -197,8 +197,12 @@ upload_wm_state(struct brw_context *brw)
 
dw6 |= _mesa_bitcount_64(brw->fragment_program->Base.InputsRead) <<
   GEN6_WM_NUM_SF_OUTPUTS_SHIFT;
-   if (multisampled) {
-  dw6 |= GEN6_WM_MSRAST_ON_PATTERN;
+   if (multisampled_fbo) {
+  /* _NEW_MULTISAMPLE */
+  if (ctx->Multisample.Enabled)
+ dw6 |= GEN6_WM_MSRAST_ON_PATTERN;
+  else
+ dw6 |= GEN6_WM_MSRAST_OFF_PIXEL;
   dw6 |= GEN6_WM_MSDISPMODE_PERPIXEL;
} else {
   dw6 |= GEN6_WM_MSRAST_OFF_PIXEL;
@@ -230,7 +234,8 @@ const struct brw_tracked_state gen6_wm_state = {
_NEW_COLOR |
_NEW_BUFFERS |
_NEW_PROGRAM_CONSTANTS |
-   _NEW_POLYGON),
+   _NEW_POLYGON |
+_NEW_MULTISAMPLE),
   .brw   = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_BATCH),
   .cache = (CACHE_NEW_SAMPLER |
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 8a6c09b..b1fe654 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -161,9 +161,9 @@ upload_sf_state(struct brw_context *brw)
float point_size;
/* _NEW_BUFFERS */
bool render_to_fbo = _mesa_is_user

Mesa (master): glx/tests: Fix signed/unsigned comparison warnings.

2012-06-20 Thread Paul Berry
Module: Mesa
Branch: master
Commit: f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1

Author: Paul Berry 
Date:   Wed Jun 20 11:38:22 2012 -0700

glx/tests: Fix signed/unsigned comparison warnings.

---

 src/glsl/tests/uniform_initializer_utils.cpp |2 +-
 src/glx/tests/clientinfo_unittest.cpp|   40 +-
 src/glx/tests/create_context_unittest.cpp|   14 
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/glsl/tests/uniform_initializer_utils.cpp 
b/src/glsl/tests/uniform_initializer_utils.cpp
index 4794169..e7d274e 100644
--- a/src/glsl/tests/uniform_initializer_utils.cpp
+++ b/src/glsl/tests/uniform_initializer_utils.cpp
@@ -201,7 +201,7 @@ verify_data(gl_constant_value *storage, unsigned 
storage_array_size,
red_zone_size));
   }
} else {
-  ASSERT_EQ(0, storage_array_size);
+  ASSERT_EQ(0u, storage_array_size);
   for (unsigned i = 0; i < val->type->components(); i++) {
 switch (val->type->base_type) {
 case GLSL_TYPE_UINT:
diff --git a/src/glx/tests/clientinfo_unittest.cpp 
b/src/glx/tests/clientinfo_unittest.cpp
index f599c83..b56c94b 100644
--- a/src/glx/tests/clientinfo_unittest.cpp
+++ b/src/glx/tests/clientinfo_unittest.cpp
@@ -523,7 +523,7 @@ TEST_F(glX_send_client_info_test, 
sends_correct_gl_extension_string)
create_single_screen_display(1, 1, "");
__glX_send_client_info(this->glx_dpy);
 
-   ASSERT_EQ(sizeof(ext), gl_ext_length);
+   ASSERT_EQ((int) sizeof(ext), gl_ext_length);
ASSERT_NE((char *) 0, gl_ext_string);
EXPECT_EQ(0, memcmp(gl_ext_string, ext, sizeof(ext)));
 }
@@ -537,26 +537,26 @@ TEST_F(glX_send_client_info_test, gl_versions_are_sane)
 
unsigned versions_below_3_0 = 0;
for (int i = 0; i < num_gl_versions; i++) {
-  EXPECT_LT(0, gl_versions[i * 2]);
-  EXPECT_GE(4, gl_versions[i * 2]);
+  EXPECT_LT(0u, gl_versions[i * 2]);
+  EXPECT_GE(4u, gl_versions[i * 2]);
 
   /* Verify that the minor version advertised with the major version makes
* sense.
*/
   switch (gl_versions[i * 2]) {
   case 1:
-EXPECT_GE(5, gl_versions[i * 2 + 1]);
+EXPECT_GE(5u, gl_versions[i * 2 + 1]);
 versions_below_3_0++;
 break;
   case 2:
-EXPECT_GE(1, gl_versions[i * 2 + 1]);
+EXPECT_GE(1u, gl_versions[i * 2 + 1]);
 versions_below_3_0++;
 break;
   case 3:
-EXPECT_GE(3, gl_versions[i * 2 + 1]);
+EXPECT_GE(3u, gl_versions[i * 2 + 1]);
 break;
   case 4:
-EXPECT_GE(2, gl_versions[i * 2 + 1]);
+EXPECT_GE(2u, gl_versions[i * 2 + 1]);
 break;
   }
}
@@ -566,7 +566,7 @@ TEST_F(glX_send_client_info_test, gl_versions_are_sane)
 * "Only the highest supported version below 3.0 should be sent, since
 * OpenGL 2.1 is backwards compatible with all earlier versions."
 */
-   EXPECT_LE(versions_below_3_0, 1);
+   EXPECT_LE(versions_below_3_0, 1u);
 }
 
 TEST_F(glX_send_client_info_test, gl_versions_and_profiles_are_sane)
@@ -582,37 +582,37 @@ TEST_F(glX_send_client_info_test, 
gl_versions_and_profiles_are_sane)
unsigned versions_below_3_0 = 0;
 
for (int i = 0; i < num_gl_versions; i++) {
-  EXPECT_LT(0, gl_versions[i * 3]);
-  EXPECT_GE(4, gl_versions[i * 3]);
+  EXPECT_LT(0u, gl_versions[i * 3]);
+  EXPECT_GE(4u, gl_versions[i * 3]);
 
   /* Verify that the minor version advertised with the major version makes
* sense.
*/
   switch (gl_versions[i * 3]) {
   case 1:
-EXPECT_GE(5, gl_versions[i * 3 + 1]);
-EXPECT_EQ(0, gl_versions[i * 3 + 2]);
+EXPECT_GE(5u, gl_versions[i * 3 + 1]);
+EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
 versions_below_3_0++;
 break;
   case 2:
-EXPECT_GE(1, gl_versions[i * 3 + 1]);
-EXPECT_EQ(0, gl_versions[i * 3 + 2]);
+EXPECT_GE(1u, gl_versions[i * 3 + 1]);
+EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
 versions_below_3_0++;
 break;
   case 3:
-EXPECT_GE(3, gl_versions[i * 3 + 1]);
+EXPECT_GE(3u, gl_versions[i * 3 + 1]);
 
 /* Profiles were not introduced until OpenGL 3.2.
  */
 if (gl_versions[i * 3 + 1] < 2) {
-   EXPECT_EQ(0, gl_versions[i * 3 + 2]);
+   EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
 } else {
-   EXPECT_EQ(0, gl_versions[i * 3 + 2] & ~all_valid_bits);
+   EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~all_valid_bits);
 }
 break;
   case 4:
-EXPECT_GE(2, gl_versions[i * 3 + 1]);
-EXPECT_EQ(0, gl_versions[i * 3 + 2] & ~all_valid_bits);
+EXPECT_GE(2u, gl_versions[i * 3 + 1]);
+EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~all_valid_bits);
 break;
   }
}
@@ -622,7 +622,7 

Mesa (master): i965/msaa: Disable unsupported formats.

2012-06-20 Thread Paul Berry
Module: Mesa
Branch: master
Commit: 3b0279a69392a8fcc81ad462ca5623ec2a73f890
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b0279a69392a8fcc81ad462ca5623ec2a73f890

Author: Paul Berry 
Date:   Fri Jun 15 10:49:58 2012 -0700

i965/msaa: Disable unsupported formats.

Due to hardware limitations, MSAA is unsupported on Gen6 for formats
containing >64 bits of data per pixel.  From the Sandy Bridge PRM,
vol4 part1, p72 ("Surface Format"):

If Number of Multisamples is set to a value other than
MULTISAMPLECOUNT_1, this field cannot be set to the following
formats:
- any format with greater than 64 bits per element
- any compressed texture format (BC*)
- any YCRCB* format

Gen7 has a similar, but less stringent limitation: formats with >64
bits of data per pixel only support 4x MSAA.

This patch causes the unsupported formats to report
GL_FRAMEBUFFER_UNSUPPORTED.

Fixes piglit "multisample-formats" tests on Gen6.

Acked-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   13 +
 1 files changed, 13 insertions(+), 0 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 4718337..d09fe6d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -576,6 +576,19 @@ brw_render_target_supported(struct intel_context *intel,
rb->_BaseFormat != GL_RED) && _mesa_is_format_integer_color(format))
   return false;
 
+   /* Under some conditions, MSAA is not supported for formats whose width is
+* more than 64 bits.
+*/
+   if (rb->NumSamples > 0 && _mesa_get_format_bytes(format) > 8) {
+  /* Gen6: MSAA on >64 bit formats is unsupported. */
+  if (intel->gen <= 6)
+ return false;
+
+  /* Gen7: 8x MSAA on >64 bit formats is unsupported. */
+  if (rb->NumSamples >= 8)
+ return false;
+   }
+
return brw->format_supported_as_render_target[format];
 }
 

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


Mesa (master): mesa: remove obsolete confdiff.sh

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

Author: Andreas Boll 
Date:   Tue Jun 19 19:49:25 2012 +0200

mesa: remove obsolete confdiff.sh

this script is obsolete since
0cc216676c96efacb0e1eb82457e6a83920ae704

---

 bin/confdiff.sh |   48 
 1 files changed, 0 insertions(+), 48 deletions(-)

diff --git a/bin/confdiff.sh b/bin/confdiff.sh
deleted file mode 100755
index 568fcd6..000
--- a/bin/confdiff.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash -e
-
-usage()
-{
-   echo "Usage: $0  "
-   echo "Highlight differences between Mesa configs"
-   echo "Example:"
-   echo "  $0 linux linux-x86"
-}
-
-die()
-{
-   echo "$@" >&2
-   return 1
-}
-
-case "$1" in
--h|--help) usage; exit 0;;
-esac
-
-[ $# -lt 2 ] && die 2 targets needed. See $0 --help
-target1=$1
-target2=$2
-
-topdir=$(cd "`dirname $0`"/..; pwd)
-cd "$topdir"
-
-[ -f "./configs/$target1" ] || die Missing configs/$target1
-[ -f "./configs/$target2" ] || die Missing configs/$target2
-
-trap 'rm -f "$t1" "$t2"' 0
-
-t1=$(mktemp)
-t2=$(mktemp)
-
-make -f- -n -p < $t1
-TOP = .
-include \$(TOP)/configs/$target1
-default:
-EOF
-
-make -f- -n -p < $t2
-TOP = .
-include \$(TOP)/configs/$target2
-default:
-EOF
-
-diff -pu -I'^#' $t1 $t2

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


Mesa (master): st/vdpau: use template size as default for source_rect.

2012-06-20 Thread Christian König
Module: Mesa
Branch: master
Commit: 0f269c5e7b593eb29d5c1058dcd53fc6476871a9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f269c5e7b593eb29d5c1058dcd53fc6476871a9

Author: Christian König 
Date:   Thu Jun 14 17:52:20 2012 +0200

st/vdpau: use template size as default for source_rect.

Fixes alignment problems with flash player.

Signed-off-by: Christian König 

---

 src/gallium/state_trackers/vdpau/mixer.c |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c 
b/src/gallium/state_trackers/vdpau/mixer.c
index e3c9349..81a5c29 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -216,7 +216,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
 VdpLayer const *layers)
 {
enum vl_compositor_deinterlace deinterlace;
-   struct u_rect rect, clip;
+   struct u_rect rect, clip, *prect;
unsigned i, layer = 0;
 
vlVdpVideoMixer *vmixer;
@@ -281,8 +281,15 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
   pipe_mutex_unlock(vmixer->device->mutex);
   return VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE;
};
-   vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, 
surf->video_buffer,
-  RectToPipe(video_source_rect, &rect), NULL, 
deinterlace);
+   prect = RectToPipe(video_source_rect, &rect);
+   if (!prect) {
+  rect.x0 = 0;
+  rect.y0 = 0;
+  rect.x1 = surf->templat.width;
+  rect.y1 = surf->templat.height;
+  prect = ▭
+   }
+   vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer, 
surf->video_buffer, prect, NULL, deinterlace);
vl_compositor_set_layer_dst_area(&vmixer->cstate, layer++, 
RectToPipe(destination_video_rect, &rect));
 
for (i = 0; i < layer_count; ++i) {

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


Mesa (master): st/vdpau: clear Cb&Cr with 0.5f

2012-06-20 Thread Christian König
Module: Mesa
Branch: master
Commit: d37c3c6ebecfe404d2341b897ac9b81adce5f4d7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d37c3c6ebecfe404d2341b897ac9b81adce5f4d7

Author: Christian König 
Date:   Sat Jun  9 15:33:28 2012 +0200

st/vdpau: clear Cb&Cr with 0.5f

That makes the output black in case of decoding errors.

Signed-off-by: Christian König 

---

 src/gallium/state_trackers/vdpau/surface.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/surface.c 
b/src/gallium/state_trackers/vdpau/surface.c
index fde2336..cc866a6 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -355,12 +355,15 @@ vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf)
 
surfaces = vlsurf->video_buffer->get_surfaces(vlsurf->video_buffer);
for (i = 0; i < VL_MAX_SURFACES; ++i) {
-  union pipe_color_union black = {};
+  union pipe_color_union c = {};
 
   if (!surfaces[i])
  continue;
 
-  pipe->clear_render_target(pipe, surfaces[i], &black, 0, 0,
+  if (i > !!vlsurf->templat.interlaced)
+ c.f[0] = c.f[1] = c.f[2] = c.f[3] = 0.5f;
+
+  pipe->clear_render_target(pipe, surfaces[i], &c, 0, 0,
 surfaces[i]->width, surfaces[i]->height);
}
pipe->flush(pipe, NULL);

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