Re: [Mesa-dev] [PATCH] intel: FBOs with texture border are unsupported

2012-02-03 Thread Eric Anholt
On Wed,  1 Feb 2012 10:31:23 -0700, Ian Romanick i...@freedesktop.org wrote:
 ---
  src/mesa/drivers/dri/intel/intel_fbo.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
 b/src/mesa/drivers/dri/intel/intel_fbo.c
 index 2ba43ac..62ed754 100644
 --- a/src/mesa/drivers/dri/intel/intel_fbo.c
 +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
 @@ -746,6 +746,7 @@ intel_validate_framebuffer(struct gl_context *ctx, struct 
 gl_framebuffer *fb)
  
 for (i = 0; i  Elements(fb-Attachment); i++) {
struct gl_renderbuffer *rb;
 +  struct gl_texture_object *tex;
struct intel_renderbuffer *irb;
  
if (fb-Attachment[i].Type == GL_NONE)
 @@ -762,6 +763,18 @@ intel_validate_framebuffer(struct gl_context *ctx, 
 struct gl_framebuffer *fb)
continue;
}
  
 +  tex = fb-Attachment[i].Texture;
 +  if (tex != NULL) {
 +  const unsigned face = fb-Attachment[i].CubeMapFace;
 +  const unsigned level = fb-Attachment[i].TextureLevel;
 +
 +  if (tex-Image[face][level]-Border) {
 + DBG(texture with border\n);
 + fb-_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
 + continue;
 +  }
 +  }

_mesa_get_attachment_teximage(struct gl_renderbuffer_attachment *att)
can make this shorter.  Other than that,

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


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


Re: [Mesa-dev] [PATCH] intel: Also check renderability in intel_renderbuffer_update_wrapper

2012-02-03 Thread Eric Anholt
On Wed,  1 Feb 2012 12:29:39 -0700, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 A similar check was removed in 05ab8fc.  The check is not complete
 redundand because some paths, such as
 _mesa_meta_check_generate_mipmap_fallback, can get to
 intel_renderbuffer_update_wrapper but not get to
 intel_validate_framebuffer.  This occurs when trying to generate
 mipmaps for GL_SLUMINANCE8 textures.

Err, are you saying that glCheckFramebufferStatusEXT in the meta is not
triggering intel_validate_framebuffer?  That seems Bad.


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


Re: [Mesa-dev] Mesa (master): dri: make sure to build libdricommon.la

2012-02-03 Thread Eric Anholt
On Thu, 02 Feb 2012 10:54:22 +, Jon TURNEY jon.tur...@dronecode.org.uk 
wrote:
 On 27/01/2012 20:20, Matt Turner wrote:
  On Fri, Jan 27, 2012 at 8:11 PM, Jon TURNEY wrote:
  On 27/01/2012 08:03, Eric Anholt wrote:
  On Thu, 26 Jan 2012 16:32:24 -0800 (PST), matts...@kemper.freedesktop.org 
  (Matt Turner) wrote:
  Module: Mesa
  Branch: master
  Commit: 80aa78142d12b21dd7d4f0edc786af98a159a80f
  URL:
  http://cgit.freedesktop.org/mesa/mesa/commit/?id=80aa78142d12b21dd7d4f0edc786af98a159a80f
 
  Author: Matt Turner matts...@gmail.com
  Date:   Thu Jan 26 19:31:12 2012 -0500
 
  dri: make sure to build libdricommon.la
 
  Ouch.  Sorry about this, folks, I built with a dirty tree and didn't
  notice that the rebase off of the drirc changes wasn't good enough.
 
  This commit breaks the ability to build when ./configured -with-driver=dri
  --disable-driglx-direct --with-dri-drivers=swrast for platforms which don't
  have DRM (See [1]), as it tries to build libdricommon.la even if we aren't
  building a dri driver which requires it.
 
  Attached is a patch which fixes this, although I'm not sure if that's the 
  best
  way of solving this problem (it might make more sense to conditionalize on
  DRI_DIRS containing something other than swrast if all dri drivers are 
  going
  to use libdricommon)
 
 Attached is a patch which fixes this the other way, which I think is probably
 better.

This looks good, except that the HAVE_ check should be put around the
definitions in common/, not the SUBDIRs.

(this is a general automake rule, and something that we're failing at in
Mesa).


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


Re: [Mesa-dev] [PATCH] intel: Avoid divide by zero for very small linear blits

2012-02-03 Thread Eric Anholt
On Thu,  2 Feb 2012 16:50:32 -0700, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 If size is small (such as 1),
 
pitch = ROUND_DOWN_TO(MIN2(size, (1  15) - 1), 4);
 
 makes pitch = 0.  Then
 
height = size / pitch;
 
 causes a division-by-zero exception.  If pitch is zero, set height to
 1 and avoid the division.
 
 This fixes piglit's bin/getteximage-formats test and glean's
 bufferObject test.

Looks simpler than my patch, while correct.

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


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


Re: [Mesa-dev] Mesa (master): dri: make sure to build libdricommon.la

2012-02-03 Thread Jon TURNEY
On 03/02/2012 09:28, Eric Anholt wrote:
 On Thu, 02 Feb 2012 10:54:22 +, Jon TURNEY wrote:
 On 27/01/2012 20:20, Matt Turner wrote:
 On Fri, Jan 27, 2012 at 8:11 PM, Jon TURNEY wrote:
 On 27/01/2012 08:03, Eric Anholt wrote:
 On Thu, 26 Jan 2012 16:32:24 -0800 (PST), (Matt Turner) wrote:
 Module: Mesa
 Branch: master
 Commit: 80aa78142d12b21dd7d4f0edc786af98a159a80f
 URL:
 http://cgit.freedesktop.org/mesa/mesa/commit/?id=80aa78142d12b21dd7d4f0edc786af98a159a80f

 Author: Matt Turner matts...@gmail.com
 Date:   Thu Jan 26 19:31:12 2012 -0500

 dri: make sure to build libdricommon.la

 Ouch.  Sorry about this, folks, I built with a dirty tree and didn't
 notice that the rebase off of the drirc changes wasn't good enough.

 This commit breaks the ability to build when ./configured -with-driver=dri
 --disable-driglx-direct --with-dri-drivers=swrast for platforms which don't
 have DRM (See [1]), as it tries to build libdricommon.la even if we aren't
 building a dri driver which requires it.

 Attached is a patch which fixes this, although I'm not sure if that's the 
 best
 way of solving this problem (it might make more sense to conditionalize on
 DRI_DIRS containing something other than swrast if all dri drivers are 
 going
 to use libdricommon)

 Attached is a patch which fixes this the other way, which I think is probably
 better.
 
 This looks good, except that the HAVE_ check should be put around the
 definitions in common/, not the SUBDIRs.
 
 (this is a general automake rule, and something that we're failing at in
 Mesa).

Can you be a bit more explicit about what rule we are violating here?

Conditionally constructing SUBDIRS in this fashion is described in the
automake manual (see [1]), and seems to be a common style in automakefiles.

[1]
http://www.gnu.org/software/automake/manual/html_node/Subdirectories-with-AM_005fCONDITIONAL.html#Subdirectories-with-AM_005fCONDITIONAL
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 45571] fatal error: program/symbol_table.h: No such file or directory

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45571

--- Comment #1 from Tom Stellard tstel...@gmail.com 2012-02-03 06:16:09 PST 
---
(In reply to comment #0)
 Building from latest git (8cbe699c0dd9b8d4accf1eaa570689f813aa3c2f) and it
 fails with the following error:
 
 In file included from glsl_parser_extras.h:35:0,
  from ast.h:30,
  from glsl_parser.yy:29:
 glsl_symbol_table.h:32:34: fatal error: program/symbol_table.h: No such file 
 or
 directory
 compilation terminated.
 make[2]: *** [glsl_parser.o] Error 1

I've run into this error too, and I think it means you have an old version of
glsl_lexer.cc and glsl_parser.cc left over from a different build.  Try
deleting
src/glsl/glsl_lexer.cc and src/glsl/glsl_parser.cc and then build again.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 45577] main/image.c:1597: _mesa_convert_colors: Assertion `dstType == 0x1406' failed.

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45577

Brian Paul bri...@vmware.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE

--- Comment #1 from Brian Paul bri...@vmware.com 2012-02-03 07:20:43 PST ---
This really the same bug as 45578.

*** This bug has been marked as a duplicate of bug 45578 ***

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 45578] main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45578

--- Comment #1 from Brian Paul bri...@vmware.com 2012-02-03 07:20:43 PST ---
*** Bug 45577 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 45578] main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45578

--- Comment #2 from Brian Paul bri...@vmware.com 2012-02-03 07:21:36 PST ---
Created attachment 56575
  -- https://bugs.freedesktop.org/attachment.cgi?id=56575
don't use _mesa_format_to_type_and_comps() to choose color type

Can you give this patch a try?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 45578] main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45578

Brian Paul bri...@vmware.com changed:

   What|Removed |Added

 CC||i...@freedesktop.org

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/5] mesa: new _mesa_error_check_format_and_type() function

2012-02-03 Thread Brian Paul
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.
---
 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(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
+  ? 

[Mesa-dev] [PATCH 2/5] mesa: remove redundant format/type checks in glGetTexImage()

2012-02-03 Thread Brian Paul
The _mesa_error_check_format_and_type() function will catch all those
cases now.
---
 src/mesa/main/texgetimage.c |   34 --
 1 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 58fed11..bff003d 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -746,40 +746,6 @@ getteximage_error_check(struct gl_context *ctx, GLenum 
target, GLint level,
   return GL_TRUE;
}
 
-   if (_mesa_sizeof_packed_type(type) = 0) {
-  _mesa_error( ctx, GL_INVALID_ENUM, glGetTexImage(type) );
-  return GL_TRUE;
-   }
-
-   if (_mesa_components_in_format(format) = 0 ||
-   format == GL_STENCIL_INDEX ||
-   format == GL_COLOR_INDEX) {
-  _mesa_error( ctx, GL_INVALID_ENUM, glGetTexImage(format) );
-  return GL_TRUE;
-   }
-
-   if (!ctx-Extensions.ARB_depth_texture  _mesa_is_depth_format(format)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, glGetTexImage(format));
-  return GL_TRUE;
-   }
-
-   if (!ctx-Extensions.MESA_ycbcr_texture  _mesa_is_ycbcr_format(format)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, glGetTexImage(format));
-  return GL_TRUE;
-   }
-
-   if (!ctx-Extensions.EXT_packed_depth_stencil
-_mesa_is_depthstencil_format(format)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, glGetTexImage(format));
-  return GL_TRUE;
-   }
-
-   if (!ctx-Extensions.ATI_envmap_bumpmap
-_mesa_is_dudv_format(format)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, glGetTexImage(format));
-  return;
-   }
-
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
   _mesa_error(ctx, err, glGetTexImage(format/type));
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 3/5] mesa: remove redundant format/type checks in glReadPixels()

2012-02-03 Thread Brian Paul
These are done in _mesa_error_check_format_and_type().
---
 src/mesa/main/readpix.c |   35 ---
 1 files changed, 0 insertions(+), 35 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 6c64cbe..b753e40 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -593,23 +593,6 @@ _mesa_error_check_format_type(struct gl_context *ctx, 
GLenum format,
/* state validation should have already been done */
ASSERT(ctx-NewState == 0x0);
 
-   if (ctx-Extensions.EXT_packed_depth_stencil
-type == GL_UNSIGNED_INT_24_8_EXT
-format != GL_DEPTH_STENCIL_EXT) {
-  _mesa_error(ctx, GL_INVALID_OPERATION,
-  gl%sPixels(format is not GL_DEPTH_STENCIL_EXT), readDraw);
-  return GL_TRUE;
-   }
-
-   if (ctx-Extensions.ARB_depth_buffer_float
-type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV
-format != GL_DEPTH_STENCIL_EXT) {
-  _mesa_error(ctx, GL_INVALID_OPERATION,
-  gl%sPixels(format is not GL_DEPTH_STENCIL_EXT), readDraw);
-  return GL_TRUE;
-   }
-
-   /* basic combinations test */
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
   _mesa_error(ctx, err, gl%sPixels(format or type), readDraw);
@@ -690,24 +673,6 @@ _mesa_error_check_format_type(struct gl_context *ctx, 
GLenum format,
   }
   break;
case GL_DEPTH_STENCIL_EXT:
-  /* Check validity of the type first. */
-  switch (type) {
- case GL_UNSIGNED_INT_24_8_EXT:
-if (!ctx-Extensions.EXT_packed_depth_stencil) {
-   _mesa_error(ctx, GL_INVALID_ENUM, gl%sPixels(type), readDraw);
-   return GL_TRUE;
-}
-break;
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
-if (!ctx-Extensions.ARB_depth_buffer_float) {
-   _mesa_error(ctx, GL_INVALID_ENUM, gl%sPixels(type), readDraw);
-   return GL_TRUE;
-}
-break;
- default:
-_mesa_error(ctx, GL_INVALID_ENUM, gl%sPixels(type), readDraw);
-return GL_TRUE;
-  }
   if ((drawing  !_mesa_dest_buffer_exists(ctx, format)) ||
   (reading  !_mesa_source_buffer_exists(ctx, format))) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 4/5] mesa: remove unneeded glReadPixels(GL_COLOR_INDEX) code

2012-02-03 Thread Brian Paul
---
 src/mesa/main/readpix.c |8 +---
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index b753e40..3882e09 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -643,17 +643,11 @@ _mesa_error_check_format_type(struct gl_context *ctx, 
GLenum format,
  }
   }
   else {
- /* reading */
- if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
-_mesa_error(ctx, GL_INVALID_OPERATION,
-glReadPixels(no color buffer));
-return GL_TRUE;
- }
  /* We no longer support CI-mode color buffers so trying to read
   * GL_COLOR_INDEX pixels is always an error.
   */
  _mesa_error(ctx, GL_INVALID_OPERATION,
- glReadPixels(color buffer is RGB));
+ glReadPixels(no color index buffer));
  return GL_TRUE;
   }
   break;
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 5/5] mesa: add error for glReadPixels(GL_DEPTH_COMPONENT) buffer

2012-02-03 Thread Brian Paul
Trying to read depth values from a non-existant depth buffer should
generate GL_INVALID_OPERATION.
---
 src/mesa/main/readpix.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 3882e09..9193def 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -660,7 +660,8 @@ _mesa_error_check_format_type(struct gl_context *ctx, 
GLenum format,
   }
   break;
case GL_DEPTH_COMPONENT:
-  if ((drawing  !_mesa_dest_buffer_exists(ctx, format))) {
+  if ((drawing  !_mesa_dest_buffer_exists(ctx, format)) ||
+  (reading  !_mesa_source_buffer_exists(ctx, format))) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
  gl%sPixels(no depth buffer), readDraw);
  return GL_TRUE;
-- 
1.7.3.4

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


[Mesa-dev] [PATCH] mesa: Fix xcb-dri2 link flags leaking into LIBS.

2012-02-03 Thread Eric Anholt
Fixes the build of builtin_compiler on my 32-bit build where xcb-dri2
is in a custom prefix but the custom prefix flags weren't available.
It shouldn't have been in LIBS anyway.
---
 configure.ac |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 316c715..e859d4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1415,8 +1415,10 @@ if test x$enable_egl = xyes; then
 EGL_DRIVER_DRI2=dri2
 DEFINES=$DEFINES -DHAVE_XCB_DRI2
 # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
+   save_LIBS=$LIBS
 AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
   [DEFINES=$DEFINES 
-DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN])
+   LIBS=$save_LIBS
 fi
fi
 
-- 
1.7.9

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


[Mesa-dev] [Bug 45594] New: [r600g] Piglit: spec/EXT_texture_integer/fbo_integer_precision_clear crashes in u_vbuf_draw_begin()

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45594

 Bug #: 45594
   Summary: [r600g] Piglit:
spec/EXT_texture_integer/fbo_integer_precision_clear
crashes in u_vbuf_draw_begin()
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: k...@dev.carbon-project.org


Created attachment 56578
  -- https://bugs.freedesktop.org/attachment.cgi?id=56578
GDB backtrace for the crash

The Piglit test spec/EXT_texture_integer/fbo_integer_precision_clear causes a
crash (SIGSEGV) in u_vbuf_draw_begin() with r600g. I've attached a backtrace,
if you need something else, let me know.

As this is the first revision where the EXT_texture_integer tests weren't
skipped, that I've tested, I can't say, whether this is a regression or not.

Used stack:
libdrm: 2.4.30-1
Mesa: master/0fcc5189 (r600g)
Linux: 3.2.2
DDX: 6.14.3 + commits from Git up until and including master/ae45d7e6
X.org: 1.11.3.901 (1.11.4 RC 1)
Hardware: 1002:9553

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCHv3] r600g: Use a fake reloc to sleep for fences

2012-02-03 Thread Simon Farnsworth
r300g is able to sleep until a fence completes rather than busywait because
it creates a special buffer object and relocation that stays busy until the
CS containing the fence is finished.

Copy the idea into r600g, and use it to sleep if the user asked for an
infinite wait, falling back to busywaiting if the user provided a timeout.

Signed-off-by: Simon Farnsworth simon.farnswo...@onelan.co.uk
---

v3: At Dave Airlie's suggestion on dri-devel, make use of the BO to give us
a fighting chance of recovering after a GPU reset.

We know that the fence will never be signalled by hardware if the dummy BO
has gone idle - we use that information to escape the loop. This might be a
useful addition to the 8.0 branch.

v2: Address Michel's review comments.

The fake bo is now unconditional, and is unreferenced when the fence is
moved to the fence pool by fence_reference. This entailed shifting to
r600_resource, which cleaned the code up a little to boot.

 src/gallium/drivers/r600/r600.h|2 +-
 src/gallium/drivers/r600/r600_hw_context.c |9 -
 src/gallium/drivers/r600/r600_pipe.c   |   18 +++---
 src/gallium/drivers/r600/r600_pipe.h   |1 +
 4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index baf09c1..c5813c2 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -284,7 +284,7 @@ void r600_context_queries_resume(struct r600_context *ctx);
 void r600_query_predication(struct r600_context *ctx, struct r600_query 
*query, int operation,
int flag_wait);
 void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource 
*fence,
- unsigned offset, unsigned value);
+ unsigned offset, unsigned value, struct 
r600_resource **sleep_bo);
 void r600_context_flush_all(struct r600_context *ctx, unsigned flush_flags);
 void r600_context_flush_dest_caches(struct r600_context *ctx);
 
diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
b/src/gallium/drivers/r600/r600_hw_context.c
index 8eb8e6d..acfa494 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -1603,7 +1603,7 @@ void r600_context_flush(struct r600_context *ctx, 
unsigned flags)
}
 }
 
-void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource 
*fence_bo, unsigned offset, unsigned value)
+void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource 
*fence_bo, unsigned offset, unsigned value, struct r600_resource **sleep_bo)
 {
uint64_t va;
 
@@ -1623,6 +1623,13 @@ void r600_context_emit_fence(struct r600_context *ctx, 
struct r600_resource *fen
ctx-pm4[ctx-pm4_cdwords++] = 0;   /* DATA_HI */
ctx-pm4[ctx-pm4_cdwords++] = PKT3(PKT3_NOP, 0, 0);
ctx-pm4[ctx-pm4_cdwords++] = r600_context_bo_reloc(ctx, fence_bo, 
RADEON_USAGE_WRITE);
+
+   /* Create a dummy BO so that fence_finish without a timeout can sleep 
waiting for completion */
+   *sleep_bo = (struct r600_resource*)
+   pipe_buffer_create(ctx-screen-screen, 
PIPE_BIND_CUSTOM,
+  PIPE_USAGE_STAGING, 1);
+   /* Add the fence as a dummy relocation. */
+   r600_context_bo_reloc(ctx, *sleep_bo, RADEON_USAGE_READWRITE);
 }
 
 static unsigned r600_query_read_result(char *map, unsigned start_index, 
unsigned end_index,
diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index c38fbc5..9b6015c 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -115,7 +115,7 @@ static struct r600_fence *r600_create_fence(struct 
r600_pipe_context *ctx)
pipe_reference_init(fence-reference, 1);
 
rscreen-fences.data[fence-index] = 0;
-   r600_context_emit_fence(ctx-ctx, rscreen-fences.bo, fence-index, 1);
+   r600_context_emit_fence(ctx-ctx, rscreen-fences.bo, fence-index, 1, 
fence-sleep_bo);
 out:
pipe_mutex_unlock(rscreen-fences.mutex);
return fence;
@@ -572,6 +572,7 @@ static void r600_fence_reference(struct pipe_screen 
*pscreen,
if (pipe_reference((*oldf)-reference, newf-reference)) {
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
pipe_mutex_lock(rscreen-fences.mutex);
+   pipe_resource_reference((struct 
pipe_resource**)(*oldf)-sleep_bo, NULL);
LIST_ADDTAIL((*oldf)-head, rscreen-fences.pool);
pipe_mutex_unlock(rscreen-fences.mutex);
}
@@ -605,6 +606,17 @@ static boolean r600_fence_finish(struct pipe_screen 
*pscreen,
}
 
while (rscreen-fences.data[rfence-index] == 0) {
+   /* Special-case infinite timeout - wait for the dummy BO to 
become idle */
+   if (timeout == PIPE_TIMEOUT_INFINITE) {
+   

[Mesa-dev] [Bug 45578] main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45578

--- Comment #3 from Ian Romanick i...@freedesktop.org 2012-02-03 10:03:00 PST 
---
(In reply to comment #2)
 Created attachment 56575 [details] [review]
 don't use _mesa_format_to_type_and_comps() to choose color type
 
 Can you give this patch a try?

I haven't tried it, but that patch looks completely reasonable.  We'll also
need this fix on the 8.0 branch.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 45571] fatal error: program/symbol_table.h: No such file or directory

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45571

Matt Turner matts...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID

--- Comment #2 from Matt Turner matts...@gmail.com 2012-02-03 10:31:47 PST ---
You should run `git clean -dfx` and rerun autogen.sh after changes to Mesa.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600g tiling final

2012-02-03 Thread Jerome Glisse
Hi,

So tiling work is i believe done. I have run piglit accross wide range
of hw and sw combination. Bottom line is new mesa on top of either old
kernel or old ddx won't regress anything. New mesa on top of proper
kernel will get you 2D tiling for texture and anything allocated by
mesa, and if you have proper DDX with option ColorTiling2D enabled you
will also get 2D tiling for front buffer and depth/stencil buffer.

For libdrm you need the lastest master. I will do a libdrm release
on monday. Afterward i will commit mesa  ddx with proper autoconf
voodoo to check for the new libdrm.

kernel patches :
http://people.freedesktop.org/~glisse/tiling/0001-drm-radeon-kms-add-support-for-streamout-v7.patch
http://people.freedesktop.org/~glisse/tiling/0001-drm-radeon-add-support-for-evergreen-ni-tiling-infor.patch

mesa patch:
http://people.freedesktop.org/~glisse/tiling/0001-r600g-add-support-for-common-surface-allocator-for-t.patch

ddx patch:
http://people.freedesktop.org/~glisse/tiling/0001-r600-evergreen-use-common-surface-allocator-for-tili.patch

Link to piglit test:
http://people.freedesktop.org/~glisse/tiling/cayman/changes.html
http://people.freedesktop.org/~glisse/tiling/cedar/changes.html
http://people.freedesktop.org/~glisse/tiling/redwood/changes.html
http://people.freedesktop.org/~glisse/tiling/juniper/changes.html
http://people.freedesktop.org/~glisse/tiling/fusion/changes.html
http://people.freedesktop.org/~glisse/tiling/rv770/changes.html
http://people.freedesktop.org/~glisse/tiling/rv710/changes.html
http://people.freedesktop.org/~glisse/tiling/rv635/changes.html
http://people.freedesktop.org/~glisse/tiling/rv610/changes.html

first column GPU name is unpatched mesa,unpatched ddx,unpatched kernel

second column surf0-ddx0 is patched mesa,patched ddx with 2d tiling
disabled and new mesa code path disabled (basicly check that nothing
regress in old code path).

third column patched mesa, unpatched ddx using new mesa code path.
This check that mesa on top of old userspace doesn't break anything.

fourth column patched mesa, patched ddx, unpatched kernel. This check
that new mesa on top of old kernel works properly.

fith column is everything is patched and 2D tiling is enabled everywhere.


Note that few test just randomly switch from pass to fail (fbo-sys-blit*,
read-front, ...).

I also tested a lot the old userspace on top of new kernel for evergreen
to make sure that the command checker doesn't regress anything. While it
reject some command stream thus were wrong and never successfully completed.
Leading to no regression in piglit (basicly second column).

Fusion doesn't have unpatched kernel run as things keep locking up for me
with unpatched kernel.

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


Re: [Mesa-dev] [PATCH] mesa: Fix xcb-dri2 link flags leaking into LIBS.

2012-02-03 Thread Kenneth Graunke

On 02/03/2012 03:10 AM, Eric Anholt wrote:

Fixes the build of builtin_compiler on my 32-bit build where xcb-dri2
is in a custom prefix but the custom prefix flags weren't available.
It shouldn't have been in LIBS anyway.
---
  configure.ac |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 316c715..e859d4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1415,8 +1415,10 @@ if test x$enable_egl = xyes; then
  EGL_DRIVER_DRI2=dri2
  DEFINES=$DEFINES -DHAVE_XCB_DRI2
  # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
+   save_LIBS=$LIBS
  AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
[DEFINES=$DEFINES 
-DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN])
+   LIBS=$save_LIBS
  fi
fi


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

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


Re: [Mesa-dev] [PATCH] intel: Also check renderability in intel_renderbuffer_update_wrapper

2012-02-03 Thread Ian Romanick

On 02/03/2012 02:11 AM, Eric Anholt wrote:

On Wed,  1 Feb 2012 12:29:39 -0700, Ian Romanicki...@freedesktop.org  wrote:

From: Ian Romanickian.d.roman...@intel.com

A similar check was removed in 05ab8fc.  The check is not complete
redundand because some paths, such as
_mesa_meta_check_generate_mipmap_fallback, can get to
intel_renderbuffer_update_wrapper but not get to
intel_validate_framebuffer.  This occurs when trying to generate
mipmaps for GL_SLUMINANCE8 textures.


Err, are you saying that glCheckFramebufferStatusEXT in the meta is not
triggering intel_validate_framebuffer?  That seems Bad.


The last call to intel_renderbuffer_update_wrapper before the test case 
starts crying is not followed by a call to intel_validate_framebuffer or 
_mesa_CheckFramebufferStatusEXT.  The backtrace is below.  It appears 
that the texture is already bound to an FBO.  The expectation is that 
the glTexImage1D call will automatically update the framebuffer status 
based on any changes made to the texture.


#0  intel_renderbuffer_update_wrapper (intel=0x75511040, 
irb=0x2da4db0, image=0x2cd06d0, layer=0) at intel_fbo.c:471
#1  0x76276968 in intel_render_texture (ctx=0x75511040, 
fb=0x28ec1b0, att=0x2c0f640) at intel_fbo.c:631
#2  0x75e07b80 in check_rtt_cb (key=1, data=0x2c0f3f0, 
userData=0x7fffd250) at main/teximage.c:2236
#3  0x75d95695 in _mesa_HashWalk (table=0x2929d30, 
callback=0x75e07a61 check_rtt_cb,

userData=0x7fffd250) at main/hash.c:334
#4  0x75e07c00 in _mesa_update_fbo_texture (ctx=0x75511040, 
texObj=0x2b91f90, face=0, level=0)

at main/teximage.c:2263
#5  0x75e086aa in teximage (ctx=0x75511040, dims=1, 
target=3552, level=0, internalFormat=35911, width=64,
height=1, depth=1, border=0, format=6409, type=5121, 
pixels=0x2dc5b80) at main/teximage.c:2546
#6  0x75e087a8 in _mesa_TexImage1D (target=3552, level=0, 
internalFormat=35911, width=64, border=0,

format=6409, type=5121, pixels=0x2dc5b80) at main/teximage.c:2571
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] mesa: stop using _mesa_error_check_format_type() in glDrawPixels

2012-02-03 Thread Brian Paul
The _mesa_error_check_format_type() function does two things: check
that format/type is legal and check that the destination (or source
buffer for glReadPixels) actually exists.  Just move the relevant
parts of that into _mesa_DrawPixels().

We'll do a similar change in glReadPixels then get rid of the function
altogether.
---
 src/mesa/main/drawpix.c |   38 +++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 01983d9..c2f7db2 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -33,7 +33,6 @@
 #include image.h
 #include mfeatures.h
 #include pbo.h
-#include readpix.h
 #include state.h
 #include dispatch.h
 
@@ -48,6 +47,7 @@ static void GLAPIENTRY
 _mesa_DrawPixels( GLsizei width, GLsizei height,
   GLenum format, GLenum type, const GLvoid *pixels )
 {
+   GLenum err;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
@@ -94,8 +94,40 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
   goto end;
}
 
-   if (_mesa_error_check_format_type(ctx, format, type, GL_TRUE)) {
-  goto end;  /* the error code was recorded */
+   err = _mesa_error_check_format_and_type(ctx, format, type);
+   if (err != GL_NO_ERROR) {
+  _mesa_error(ctx, err, glDrawPixels(invalid format %s and/or type %s),
+  _mesa_lookup_enum_by_nr(format),
+  _mesa_lookup_enum_by_nr(type));
+  goto end;
+   }
+
+   /* do special format-related checks */
+   switch (format) {
+   case GL_STENCIL_INDEX:
+   case GL_DEPTH_COMPONENT:
+   case GL_DEPTH_STENCIL_EXT:
+  /* these buffers must exist */
+  if (!_mesa_dest_buffer_exists(ctx, format)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ glDrawPixels(missing deest buffer));
+ goto end;
+  }
+  break;
+   case GL_COLOR_INDEX:
+  if (ctx-PixelMaps.ItoR.Size == 0 ||
+  ctx-PixelMaps.ItoG.Size == 0 ||
+  ctx-PixelMaps.ItoB.Size == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+glDrawPixels(drawing color index pixels into RGB buffer));
+ goto end;
+  }
+  break;
+   default:
+  /* for color formats it's not an error if the destination color
+   * buffer doesn't exist.
+   */
+  break;
}
 
if (ctx-RasterDiscard) {
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/3] mesa: stop using _mesa_error_check_format_type() in glReadPixels

2012-02-03 Thread Brian Paul
Basically the same story as the previous commit.  But we were
already calling _mesa_source_buffer_exists() in ReadPixels().
Yeah, we were calling it twice.
---
 src/mesa/main/readpix.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 3882e09..d935e0d 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -691,6 +691,8 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
  GLenum format, GLenum type, GLsizei bufSize,
   GLvoid *pixels )
 {
+   GLenum err;
+
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
@@ -712,9 +714,11 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, 
GLsizei height,
if (ctx-NewState)
   _mesa_update_state(ctx);
 
-   if (_mesa_error_check_format_type(ctx, format, type, GL_FALSE)) {
-  /* found an error */
-  return;
+   err = _mesa_error_check_format_and_type(ctx, format, type);
+   if (err != GL_NO_ERROR) {
+  _mesa_error(ctx, err, glReadPixels(invalid format %s and/or type %s),
+  _mesa_lookup_enum_by_nr(format),
+  _mesa_lookup_enum_by_nr(type));
}
 
/* Check that the destination format and source buffer are both
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 3/3] mesa: remove unused _mesa_error_check_format_type() function

2012-02-03 Thread Brian Paul
This was only used by glReadPixels and glDrawPixels.  Now those
functions do the corresponding error checks.
---
 src/mesa/main/readpix.c |  111 ---
 src/mesa/main/readpix.h |4 --
 2 files changed, 0 insertions(+), 115 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index d935e0d..3a44ac8 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -575,117 +575,6 @@ _mesa_readpixels(struct gl_context *ctx,
 }
 
 
-/**
- * Do error checking of the format/type parameters to glReadPixels and
- * glDrawPixels.
- * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
- *for ReadPixels.
- * \return GL_TRUE if error detected, GL_FALSE if no errors
- */
-GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
-  GLenum type, GLboolean drawing)
-{
-   const char *readDraw = drawing ? Draw : Read;
-   const GLboolean reading = !drawing;
-   GLenum err;
-
-   /* state validation should have already been done */
-   ASSERT(ctx-NewState == 0x0);
-
-   err = _mesa_error_check_format_and_type(ctx, format, type);
-   if (err != GL_NO_ERROR) {
-  _mesa_error(ctx, err, gl%sPixels(format or type), readDraw);
-  return GL_TRUE;
-   }
-
-   /* additional checks */
-   switch (format) {
-   case GL_RG:
-   case GL_RED:
-   case GL_GREEN:
-   case GL_BLUE:
-   case GL_ALPHA:
-   case GL_LUMINANCE:
-   case GL_LUMINANCE_ALPHA:
-   case GL_RGB:
-   case GL_BGR:
-   case GL_RGBA:
-   case GL_BGRA:
-   case GL_ABGR_EXT:
-   case GL_RED_INTEGER_EXT:
-   case GL_GREEN_INTEGER_EXT:
-   case GL_BLUE_INTEGER_EXT:
-   case GL_ALPHA_INTEGER_EXT:
-   case GL_RGB_INTEGER_EXT:
-   case GL_RGBA_INTEGER_EXT:
-   case GL_BGR_INTEGER_EXT:
-   case GL_BGRA_INTEGER_EXT:
-   case GL_LUMINANCE_INTEGER_EXT:
-   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
-  if (!drawing) {
- /* reading */
- if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
-_mesa_error(ctx, GL_INVALID_OPERATION,
-glReadPixels(no color buffer));
-return GL_TRUE;
- }
-  }
-  break;
-   case GL_COLOR_INDEX:
-  if (drawing) {
- if (ctx-PixelMaps.ItoR.Size == 0 ||
-ctx-PixelMaps.ItoG.Size == 0 ||
-ctx-PixelMaps.ItoB.Size == 0) {
-_mesa_error(ctx, GL_INVALID_OPERATION,
-   glDrawPixels(drawing color index pixels into RGB buffer));
-return GL_TRUE;
- }
-  }
-  else {
- /* We no longer support CI-mode color buffers so trying to read
-  * GL_COLOR_INDEX pixels is always an error.
-  */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- glReadPixels(no color index buffer));
- return GL_TRUE;
-  }
-  break;
-   case GL_STENCIL_INDEX:
-  if ((drawing  !_mesa_dest_buffer_exists(ctx, format)) ||
-  (reading  !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- gl%sPixels(no stencil buffer), readDraw);
- return GL_TRUE;
-  }
-  break;
-   case GL_DEPTH_COMPONENT:
-  if ((drawing  !_mesa_dest_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- gl%sPixels(no depth buffer), readDraw);
- return GL_TRUE;
-  }
-  break;
-   case GL_DEPTH_STENCIL_EXT:
-  if ((drawing  !_mesa_dest_buffer_exists(ctx, format)) ||
-  (reading  !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- gl%sPixels(no depth or stencil buffer), readDraw);
- return GL_TRUE;
-  }
-  break;
-   default:
-  /* this should have been caught in _mesa_error_check_format_type() */
-  _mesa_problem(ctx, unexpected format in _mesa_%sPixels, readDraw);
-  return GL_TRUE;
-   }
-
-   /* no errors */
-   return GL_FALSE;
-}
-  
-
-
 void GLAPIENTRY
 _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
  GLenum format, GLenum type, GLsizei bufSize,
diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h
index 6caaf3a..5a5f73f 100644
--- a/src/mesa/main/readpix.h
+++ b/src/mesa/main/readpix.h
@@ -33,10 +33,6 @@ struct gl_context;
 struct gl_pixelstore_attrib;
 
 
-extern GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum 
type,
-  GLboolean drawing);
-
 extern void
 _mesa_readpixels(struct gl_context *ctx,
  GLint x, GLint y, GLsizei width, GLsizei height,
-- 
1.7.3.4

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


[Mesa-dev] Print error message when switching to indirect rendering

2012-02-03 Thread Carl Worth
I recently had a problem with a dri driver failing to load, (it turned
out to be a case of the driver being built for 64-bit, but running a
32-bit application).

At the time, mesa switched over to indirect rendering without me
realizing it at all. This left me quite confused. Finally, a kind
friend pointed me to LIBGL_DEBUG=verbose and I was able to diagnose
the problem.

I think mesa could have been that friend first. Here's a patch series
to introduce a new CriticalErrorMessageF macro which will print a
message even if LIBGL_DEBUG is unset, (but, like ErrorMessageF, will
still silence the message if LIBGL_DEBUG is set to quiet).

Then, the error messages regarding switching to indirect and
software-direct rendering are moved from ErrorMessageF to
CriticalErrorMessageF.

I think this makes mesa a bit kinder when things go wrong, without
spewing excessive noise in common cases. Any diagreement? Are their
other obvious candidates for CriticalErrorMessageF?

-Carl

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


[Mesa-dev] [PATCH 3/4] dri: Make reverting to indirect rendering a critical error.

2012-02-03 Thread Carl Worth
Something has gone wrong if we have to revert to indirect rendering,
(such as a driver failing to load for some reason). The user really
should be made aware of this, (and instructed to set LIBGL_DEBUG
for more details).
---
 src/glx/drisw_glx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 833ea7d..f8d050d 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -702,7 +702,7 @@ driswCreateScreen(int screen, struct glx_display *priv)
glx_screen_cleanup(psc-base);
Xfree(psc);
 
-   ErrorMessageF(reverting to indirect rendering\n);
+   CriticalErrorMessageF(reverting to indirect rendering\n);
 
return NULL;
 }
-- 
1.7.8.3

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


[Mesa-dev] [PATCH 2/4] dri: Add a CriticalErrorMessageF macro.

2012-02-03 Thread Carl Worth
Sometimes an error is so sever that we want to print it even when the
user hasn't specifically requested debugging by setting LIBGL_DEBUG.

Add a CriticalErrorMessageF macro to be used for this case. (The error
message can still be slienced with the existing LIBGL_DEBUG=quiet).

For critical error messages we also direct the user to set the
LIBGL_DEBUG environment variable for more details.
---
 src/glx/dri_common.c |   24 
 src/glx/dri_common.h |2 ++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 5096c1f..0e06d51 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -84,6 +84,30 @@ ErrorMessageF(const char *f, ...)
}
 }
 
+/**
+ * Print error message unless LIBGL_DEBUG is set to quiet.
+ *
+ * The distinction between CriticalErrorMessageF and ErrorMessageF is
+ * that critcial errors will be printed by default, (even when
+ * LIBGL_DEBUG is unset).
+ */
+_X_HIDDEN void
+CriticalErrorMessageF(const char *f, ...)
+{
+   va_list args;
+   const char *env;
+
+   if (!(env = getenv(LIBGL_DEBUG)) || !strstr(env, quiet)) {
+  fprintf(stderr, libGL error: );
+  va_start(args, f);
+  vfprintf(stderr, f, args);
+  va_end(args);
+
+  if (!env || !strstr(env, verbose))
+ fprintf(stderr, libGL error: Try again with LIBGL_DEBUG=verbose for 
more details.\n);
+   }
+}
+
 #ifndef DEFAULT_DRIVER_DIR
 /* this is normally defined in Mesa/configs/default with 
DRI_DRIVER_SEARCH_PATH */
 #define DEFAULT_DRIVER_DIR /usr/local/lib/dri
diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
index 3bcdebc..f5c7d45 100644
--- a/src/glx/dri_common.h
+++ b/src/glx/dri_common.h
@@ -65,6 +65,8 @@ extern void InfoMessageF(const char *f, ...);
 
 extern void ErrorMessageF(const char *f, ...);
 
+extern void CriticalErrorMessageF(const char *f, ...);
+
 extern void *driOpenDriver(const char *driverName);
 
 extern bool
-- 
1.7.8.3

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


[Mesa-dev] [PATCH 1/4] dri: Clarify comments on InfoMessageF and ErrorMessageF macros.

2012-02-03 Thread Carl Worth
The description of ErrorMessageF was misleading in the case of
LIBGL_DEBUG being unset, (the previous comment could be understood to
mean the error should be printed, but the code does not print in this
case).

InfoMessageF previously had no comment at all.
---
 src/glx/dri_common.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index ed0b134..5096c1f 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -48,6 +48,10 @@
 #define RTLD_GLOBAL 0
 #endif
 
+/**
+ * Print informational message to stderr if LIBGL_DEBUG is set to
+ * verbose.
+ */
 _X_HIDDEN void
 InfoMessageF(const char *f, ...)
 {
@@ -63,7 +67,8 @@ InfoMessageF(const char *f, ...)
 }
 
 /**
- * Print error to stderr, unless LIBGL_DEBUG==quiet.
+ * Print error message to stderr if LIBGL_DEBUG is set to anything but
+ * quiet, (do nothing if LIBGL_DEBUG is unset).
  */
 _X_HIDDEN void
 ErrorMessageF(const char *f, ...)
-- 
1.7.8.3

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


[Mesa-dev] [PATCH 4/4] dri: Make reverting to software direct rendering a critical error.

2012-02-03 Thread Carl Worth
Something has gone wrong if we have to revert to software rendering.
The user really should be made aware of this, (and instructed to set
LIBGL_DEBUG for more details).
---
 src/glx/dri_glx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 0cd7cca..213ef47 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -503,7 +503,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct 
dri_screen *psc,
 
XF86DRICloseConnection(dpy, scrn);
 
-   ErrorMessageF(reverting to software direct rendering\n);
+   CriticalErrorMessageF(reverting to software direct rendering\n);
 
return NULL;
 }
-- 
1.7.8.3

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


[Mesa-dev] [Bug 45571] fatal error: program/symbol_table.h: No such file or directory

2012-02-03 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=45571

--- Comment #3 from Alexandre Demers alexandre.f.dem...@gmail.com 2012-02-03 
19:24:26 UTC ---
(In reply to comment #2)
 You should run `git clean -dfx` and rerun autogen.sh after changes to Mesa.

I'll try it tomorrow. However, I'm suprised since I always do a make
realclean before getting new commits and compiling. Shouldn't it clean
everything by itself? Or should I run git clean -dfx instead or in
combination with make realclean?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev