[Mesa-dev] [Bug 38085] Mesa: User error: GL_INVALID_ENUM in glTexParameter(param=0x2901)

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=38085

--- Comment #6 from Brian Paul brian.e.p...@gmail.com 2011-06-10 06:44:06 PDT 
---
It's best to ssh in from another computer and do your debugging from there.

-- 
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 37274] Crash in draw_llvm_shader23 (r300g, rs690, in warzone2100)

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=37274

José Fonseca jfons...@vmware.com changed:

   What|Removed |Added

 CC||jfons...@vmware.com

--- Comment #3 from José Fonseca jfons...@vmware.com 2011-06-10 07:10:50 PDT 
---
(In reply to comment #2)
 crash is still present :-( (few days old git)

Please past the disassembly of the draw_llvm_shader??? JIT function where the
crash happend (not llvm_pipeline_generic, which is its caller). That is, if
'bt' shows:

  #3  0x7f5f522374ba in 0x7f5f522374ba ()

then type in 'disassemble 0x7f5f52237400,0x7f5f522374ff', i.e., a few
tenths bytes before/after the crashin IP address.

Also paste the 'info registers' 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 37274] Crash in draw_llvm_shader23 (r300g, rs690, in warzone2100)

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=37274

--- Comment #4 from Brian Paul brian.e.p...@gmail.com 2011-06-10 07:25:33 PDT 
---
This might be a CPU-caps-dependent issue.  Can you do export
GALLIUM_DUMP_CPU=1 then run any GL test/app?  That'll print your CPU's
features.

BTW, a short-hand for disassembling in gdb is x/Ni ADDR.  For example, x/20i
0x7f5f52237400 will print 20 instructions starting at the given address.

-- 
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 37862] Mesa 7.11-devel implementation error: _mesa_texstore_null() is called

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=37862

--- Comment #8 from Pepi pe...@hotmail.com 2011-06-10 07:37:58 PDT ---
Thanks Benjamin,
But I'm not sure did everything went right?:

The command:
# LD_LIBRARY_PATH=/usr/local/lib LIBGL_DRIVERS_PATH=/usr/local/lib/dri
glxinfo

Gives me:

.
.
.
OpenGL renderer string: Gallium 0.4 on AMD RV770
OpenGL version string: 2.1 Mesa 7.11-devel
OpenGL shading language version string: 1.20
.
.


These are now on the /usr/local/lib:
libGL.so - libGL.so.1
libGL.so.1 - libGL.so.1.2



Dummy Section
I just thought these should not be in the lib64, as I'm running 64 bit Fedora.
/Dummy Section

-- 
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 38129] Account request

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=38129

Bryan Cain bryancain3+...@gmail.com changed:

   What|Removed |Added

 CC||bryancain3+...@gmail.com

-- 
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 38129] Account request

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=38129

Brian Paul brian.e.p...@gmail.com changed:

   What|Removed |Added

Product|Mesa|freedesktop.org
  Component|Other   |New Accounts
 AssignedTo|mesa-dev@lists.freedesktop. |sitewranglers@lists.freedes
   |org |ktop.org

--- Comment #2 from Brian Paul brian.e.p...@gmail.com 2011-06-10 08:15:54 PDT 
---
OK, reassigning to the admins.

I presume you'll bring your changes into a branch first for testing before
merging to master?

-- 
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] st/mesa: remove asserts in st_texture_image_copy

2011-06-10 Thread Marek Olšák
This is for 7.10 only. The fix in master looks too complex to be
cherry-picked.

The assertions fail when generating mipmaps for NPOT textures.

This fixes:
- fbo-generatemipmap-formats (all of them)
---
 src/mesa/state_tracker/st_texture.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_texture.c 
b/src/mesa/state_tracker/st_texture.c
index 155ea39..4a794f6 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -285,10 +285,6 @@ st_texture_image_copy(struct pipe_context *pipe,
struct pipe_box src_box;
GLuint i;
 
-   assert(u_minify(src-width0, srcLevel) == width);
-   assert(u_minify(src-height0, srcLevel) == height);
-   assert(u_minify(src-depth0, srcLevel) == depth);
-
src_box.x = 0;
src_box.y = 0;
src_box.width = width;
-- 
1.7.4.1

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


[Mesa-dev] [Bug 37862] Mesa 7.11-devel implementation error: _mesa_texstore_null() is called

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=37862

--- Comment #9 from Benjamin Bellec b.bel...@gmail.com 2011-06-10 10:57:20 
PDT ---
So try with $ LD_LIBRARY_PATH=/usr/local/lib64
LIBGL_DRIVERS_PATH=/usr/local/lib64/dri glxinfo

But, anyway, when you execute autogen, you have a summary of what you will
compile and install.

-- 
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] Fix format not a string literal error with -Werror=format-security

2011-06-10 Thread Eugeni Dodonov
From: Eugeni Dodonov eug...@mandriva.com

A trivial fix for error: format not a string literal and no format
arguments with compiling with -Werror=format-security flags.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 09033ae..7c73a8f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -100,7 +100,7 @@ fs_visitor::fail(const char *format, ...)
this-fail_msg = msg;
 
if (INTEL_DEBUG  DEBUG_WM) {
-  fprintf(stderr, msg);
+  fprintf(stderr, %s,  msg);
}
 }
 
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH 2/4] intel: Clean up intel_render_texture with a rename and a helper function.

2011-06-10 Thread Kenneth Graunke

On 06/07/2011 11:47 AM, Eric Anholt wrote:

The newImage isn't particularly new -- it might be the same texture
that was attached to the same attachment point before.  This function
also gets called when just rebinding back to an FBO with a texture
attachment.
---
  src/mesa/drivers/dri/intel/intel_fbo.c |   16 ++--
  1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 0a67caa..8fda37b 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -567,16 +567,12 @@ intel_render_texture(struct gl_context * ctx,
   struct gl_framebuffer *fb,
   struct gl_renderbuffer_attachment *att)
  {
-   struct gl_texture_image *newImage
-  = att-Texture-Image[att-CubeMapFace][att-TextureLevel];
+   struct gl_texture_image *image = _mesa_get_attachment_teximage(att);
 struct intel_renderbuffer *irb = intel_renderbuffer(att-Renderbuffer);
-   struct intel_texture_image *intel_image;
+   struct intel_texture_image *intel_image = intel_texture_image(image);

 (void) fb;

-   ASSERT(newImage);
-
-   intel_image = intel_texture_image(newImage);
 if (!intel_image-mt) {
/* Fallback on drawing to a texture that doesn't have a miptree
 * (has a border, width/height 0, etc.)
@@ -586,7 +582,7 @@ intel_render_texture(struct gl_context * ctx,


Any particular reason for removing the assertion?

Patches 1 and 2 are
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

Patch 3 seems nice but I don't know enough about that code to properly 
review it.


Patch 4 seems to be fixing a bug, but I don't see any statement of 
impact on either piglit or applications.  Was this actually breaking 
something in the wild, or just found by inspection (and allergic 
reactions to piles of yak hair)? :)

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


[Mesa-dev] [PATCH 02/11] intel: Add the MESA_FORMAT as a field of the miptree.

2011-06-10 Thread Eric Anholt
We only had internal_format before, which is way more irritating to work with.
---
 src/mesa/drivers/dri/intel/intel_fbo.c  |1 +
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |8 ++--
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |3 +++
 src/mesa/drivers/dri/intel/intel_tex_image.c|5 +++--
 src/mesa/drivers/dri/intel/intel_tex_validate.c |1 +
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index c0d001c..0520386 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -641,6 +641,7 @@ intel_render_texture(struct gl_context * ctx,
   texel_bytes = _mesa_get_format_bytes(intel_image-base.TexFormat);
 
   new_mt = intel_miptree_create(intel, image-TexObject-Target,
+   intel_image-base.TexFormat,
intel_image-base._BaseFormat,
intel_image-base.InternalFormat,
intel_image-level,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index d63f56e..aa6fc5b 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -55,6 +55,7 @@ target_to_target(GLenum target)
 static struct intel_mipmap_tree *
 intel_miptree_create_internal(struct intel_context *intel,
  GLenum target,
+ gl_format format,
  GLenum internal_format,
  GLuint first_level,
  GLuint last_level,
@@ -72,6 +73,7 @@ intel_miptree_create_internal(struct intel_context *intel,
first_level, last_level, mt);
 
mt-target = target_to_target(target);
+   mt-format = format;
mt-internal_format = internal_format;
mt-first_level = first_level;
mt-last_level = last_level;
@@ -104,6 +106,7 @@ intel_miptree_create_internal(struct intel_context *intel,
 struct intel_mipmap_tree *
 intel_miptree_create(struct intel_context *intel,
 GLenum target,
+gl_format format,
 GLenum base_format,
 GLenum internal_format,
 GLuint first_level,
@@ -125,7 +128,7 @@ intel_miptree_create(struct intel_context *intel,
 tiling = I915_TILING_X;
}
 
-   mt = intel_miptree_create_internal(intel, target, internal_format,
+   mt = intel_miptree_create_internal(intel, target, format, internal_format,
  first_level, last_level, width0,
  height0, depth0, cpp, compress_byte,
  tiling);
@@ -156,6 +159,7 @@ intel_miptree_create(struct intel_context *intel,
 struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
GLenum target,
+   gl_format format,
GLenum internal_format,
struct intel_region *region,
GLuint depth0,
@@ -163,7 +167,7 @@ intel_miptree_create_for_region(struct intel_context *intel,
 {
struct intel_mipmap_tree *mt;
 
-   mt = intel_miptree_create_internal(intel, target, internal_format,
+   mt = intel_miptree_create_internal(intel, target, format, internal_format,
  0, 0,
  region-width, region-height, 1,
  region-cpp, compress_byte,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 325e391..0ce8c09 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -91,6 +91,7 @@ struct intel_mipmap_tree
/* Effectively the key:
 */
GLenum target;
+   gl_format format;
GLenum internal_format;
 
GLuint first_level;
@@ -136,6 +137,7 @@ struct intel_mipmap_tree
 
 struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,
GLenum target,
+  gl_format format,
GLenum base_format,
GLenum internal_format,
GLuint first_level,
@@ -150,6 +152,7 @@ struct intel_mipmap_tree *intel_miptree_create(struct 
intel_context *intel,
 struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
GLenum target,
+   gl_format format,
GLenum internal_format,
struct intel_region 

[Mesa-dev] [PATCH 04/11] i915: Drop dead argument to translate_texture_format().

2011-06-10 Thread Eric Anholt
---
 src/mesa/drivers/dri/i915/i830_texstate.c |5 ++---
 src/mesa/drivers/dri/i915/i915_texstate.c |4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c 
b/src/mesa/drivers/dri/i915/i830_texstate.c
index 3298dbb..d4af5e5 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -40,7 +40,7 @@
 
 
 static GLuint
-translate_texture_format(GLuint mesa_format, GLuint internal_format)
+translate_texture_format(GLuint mesa_format)
 {
switch (mesa_format) {
case MESA_FORMAT_L8:
@@ -156,8 +156,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
 */
i830-state.tex_offset[unit] = dst_x * intelObj-mt-cpp + dst_y * pitch;
 
-   format = translate_texture_format(firstImage-TexFormat,
-firstImage-InternalFormat);
+   format = translate_texture_format(firstImage-TexFormat);
 
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
(LOAD_TEXTURE_MAP0  unit) | 4);
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 5aa2ea1..bcf42d5 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -39,8 +39,7 @@
 
 
 static GLuint
-translate_texture_format(gl_format mesa_format, GLuint internal_format,
-GLenum DepthMode)
+translate_texture_format(gl_format mesa_format, GLenum DepthMode)
 {
switch (mesa_format) {
case MESA_FORMAT_L8:
@@ -165,7 +164,6 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
i915-state.tex_offset[unit] = 0; /* Always the origin of the miptree */
 
format = translate_texture_format(firstImage-TexFormat,
-firstImage-InternalFormat,
 sampler-DepthMode);
pitch = intelObj-mt-region-pitch * intelObj-mt-cpp;
 
-- 
1.7.5.3

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


[Mesa-dev] [PATCH 09/11] intel: Drop the cpp argument to intel_miptree_create().

2011-06-10 Thread Eric Anholt
---
 src/mesa/drivers/dri/intel/intel_fbo.c  |5 +
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |9 -
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |1 -
 src/mesa/drivers/dri/intel/intel_tex_image.c|4 
 src/mesa/drivers/dri/intel/intel_tex_validate.c |1 -
 5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 156f76f..f9a464e 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -633,9 +633,6 @@ intel_render_texture(struct gl_context * ctx,
   struct intel_context *intel = intel_context(ctx);
   struct intel_mipmap_tree *old_mt = intel_image-mt;
   struct intel_mipmap_tree *new_mt;
-  int texel_bytes;
-
-  texel_bytes = _mesa_get_format_bytes(intel_image-base.TexFormat);
 
   new_mt = intel_miptree_create(intel, image-TexObject-Target,
intel_image-base.TexFormat,
@@ -644,7 +641,7 @@ intel_render_texture(struct gl_context * ctx,
intel_image-base.Width,
intel_image-base.Height,
intel_image-base.Depth,
-   texel_bytes, GL_TRUE);
+   GL_TRUE);
 
   intel_miptree_image_copy(intel,
new_mt,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index eb3a45b..3589f3e 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -61,7 +61,7 @@ intel_miptree_create_internal(struct intel_context *intel,
  GLuint last_level,
  GLuint width0,
  GLuint height0,
- GLuint depth0, GLuint cpp,
+ GLuint depth0,
  uint32_t tiling)
 {
GLboolean ok;
@@ -83,7 +83,7 @@ intel_miptree_create_internal(struct intel_context *intel,
mt-width0 = width0;
mt-height0 = height0;
mt-depth0 = depth0;
-   mt-cpp = compress_byte ? compress_byte : cpp;
+   mt-cpp = compress_byte ? compress_byte : 
_mesa_get_format_bytes(mt-format);
mt-compressed = compress_byte ? 1 : 0;
mt-refcount = 1; 
 
@@ -114,7 +114,7 @@ intel_miptree_create(struct intel_context *intel,
 GLuint last_level,
 GLuint width0,
 GLuint height0,
-GLuint depth0, GLuint cpp,
+GLuint depth0,
 GLboolean expect_accelerated_upload)
 {
struct intel_mipmap_tree *mt;
@@ -132,7 +132,7 @@ intel_miptree_create(struct intel_context *intel,
 
mt = intel_miptree_create_internal(intel, target, format,
  first_level, last_level, width0,
- height0, depth0, cpp,
+ height0, depth0,
  tiling);
/*
 * pitch == 0 || height == 0  indicates the null texture
@@ -170,7 +170,6 @@ intel_miptree_create_for_region(struct intel_context *intel,
mt = intel_miptree_create_internal(intel, target, format,
  0, 0,
  region-width, region-height, 1,
- region-cpp,
  I915_TILING_NONE);
if (!mt)
   return mt;
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index a531ecf..ea86590 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -142,7 +142,6 @@ struct intel_mipmap_tree *intel_miptree_create(struct 
intel_context *intel,
GLuint width0,
GLuint height0,
GLuint depth0,
-   GLuint cpp,
   GLboolean 
expect_accelerated_upload);
 
 struct intel_mipmap_tree *
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 6fa5c13..90d4117 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -55,7 +55,6 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
GLuint height = intelImage-base.Height;
GLuint depth = intelImage-base.Depth;
GLuint i;
-   GLuint texelBytes;
 
DBG(%s\n, __FUNCTION__);
 
@@ -108,8 +107,6 @@ intel_miptree_create_for_teximage(struct intel_context 
*intel,
   }
}
 
-   texelBytes = _mesa_get_format_bytes(intelImage-base.TexFormat);
-

[Mesa-dev] [PATCH 2/4] mesa: Remove compressed code from generate_mipmaps_uncompressed().

2011-06-10 Thread Eric Anholt
---
 src/mesa/main/mipmap.c |  118 ++--
 1 files changed, 4 insertions(+), 114 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 2bdb111..45fcc27 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1892,79 +1892,10 @@ generate_mipmap_uncompressed(struct gl_context *ctx, 
GLenum target,
 GLuint maxLevel)
 {
GLint level;
-   gl_format convertFormat;
-   const GLubyte *srcData = NULL;
-   GLubyte *dstData = NULL;
GLenum datatype;
GLuint comps;
 
-   /* Find convertFormat - the format that do_row() will process */
-   if (_mesa_is_format_compressed(srcImage-TexFormat)) {
-  /* setup for compressed textures - need to allocate temporary
-   * image buffers to hold uncompressed images.
-   */
-  GLuint row;
-  GLint  components, size;
-  GLchan *dst;
-
-  assert(texObj-Target == GL_TEXTURE_2D ||
- texObj-Target == GL_TEXTURE_CUBE_MAP_ARB);
-
-  if (srcImage-_BaseFormat == GL_RGB) {
- convertFormat = MESA_FORMAT_RGB888;
- components = 3;
-  } else if (srcImage-_BaseFormat == GL_RED) {
- convertFormat = MESA_FORMAT_R8;
- components = 1;
-  } else if (srcImage-_BaseFormat == GL_RG) {
- convertFormat = MESA_FORMAT_RG88;
- components = 2;
-  } else if (srcImage-_BaseFormat == GL_RGBA) {
- convertFormat = MESA_FORMAT_RGBA;
- components = 4;
-  } else if (srcImage-_BaseFormat == GL_LUMINANCE) {
- convertFormat = MESA_FORMAT_L8;
- components = 1;
-  } else if (srcImage-_BaseFormat == GL_LUMINANCE_ALPHA) {
- convertFormat = MESA_FORMAT_AL88;
- components = 2;
-  } else {
- _mesa_problem(ctx, bad srcImage-_BaseFormat in 
_mesa_generate_mipmaps);
- return;
-  }
-
-  /* allocate storage for uncompressed GL_RGB or GL_RGBA images */
-  size = _mesa_bytes_per_pixel(srcImage-_BaseFormat, CHAN_TYPE)
- * srcImage-Width * srcImage-Height * srcImage-Depth + 20;
-  /* 20 extra bytes, just be safe when calling last FetchTexel */
-  srcData = (GLubyte *) malloc(size);
-  if (!srcData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
- return;
-  }
-  dstData = (GLubyte *) malloc(size / 2);  /* 1/4 would probably be OK */
-  if (!dstData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
- free((void *) srcData);
- return;
-  }
-
-  /* decompress base image here */
-  dst = (GLchan *) srcData;
-  for (row = 0; row  srcImage-Height; row++) {
- GLuint col;
- for (col = 0; col  srcImage-Width; col++) {
-srcImage-FetchTexelc(srcImage, col, row, 0, dst);
-dst += components;
- }
-  }
-   }
-   else {
-  /* uncompressed */
-  convertFormat = srcImage-TexFormat;
-   }
-
-   _mesa_format_to_type_and_comps(convertFormat, datatype, comps);
+   _mesa_format_to_type_and_comps(srcImage-TexFormat, datatype, comps);
 
for (level = texObj-BaseLevel; level  maxLevel; level++) {
   /* generate image[level+1] from image[level] */
@@ -1986,14 +1917,8 @@ generate_mipmap_uncompressed(struct gl_context *ctx, 
GLenum target,
   nextLevel = next_mipmap_level_size(target, border,
  srcWidth, srcHeight, srcDepth,
  dstWidth, dstHeight, dstDepth);
-  if (!nextLevel) {
- /* all done */
- if (_mesa_is_format_compressed(srcImage-TexFormat)) {
-free((void *) srcData);
-free(dstData);
- }
+  if (!nextLevel)
  return;
-  }
 
   /* get dest gl_texture_image */
   dstImage = _mesa_get_tex_image(ctx, texObj, target, level + 1);
@@ -2025,50 +1950,15 @@ generate_mipmap_uncompressed(struct gl_context *ctx, 
GLenum target,
  }
   }
 
-  /* Setup src and dest data pointers */
-  if (_mesa_is_format_compressed(dstImage-TexFormat)) {
- /* srcData and dstData are already set */
- ASSERT(srcData);
- ASSERT(dstData);
-  }
-  else {
- srcData = (const GLubyte *) srcImage-Data;
- dstData = (GLubyte *) dstImage-Data;
-  }
-
   ASSERT(dstImage-TexFormat);
   ASSERT(dstImage-FetchTexelc);
   ASSERT(dstImage-FetchTexelf);
 
   _mesa_generate_mipmap_level(target, datatype, comps, border,
   srcWidth, srcHeight, srcDepth,
-  srcData, srcImage-RowStride,
+  srcImage-Data, srcImage-RowStride,
   dstWidth, dstHeight, dstDepth,
-  dstData, dstImage-RowStride);
-
-
-  if (_mesa_is_format_compressed(dstImage-TexFormat)) {
- GLubyte *temp;
- /* compress image from dstData into 

[Mesa-dev] [PATCH 4/4] mesa: Switch generate_mipmaps_compressed() to using TexImage2D to upload.

2011-06-10 Thread Eric Anholt
The code was playing fast and loose with rowstrides, which meant that
if a driver chose anything different for its alignment requirements,
the generated mipmaps came out garbage.  Unlike the uncompressed case,
we can't generate mipmaps directly into image-Data, so by using
TexImage2D we cut out most of the weird logic that existed to generate
in-place into -Data.  The up/downside is that the driver recovery
code for the fact that _mesa_generate_mipmaps whacked -Data has to be
turned off for compressed now.

Fixes 6 piglit tests about compressed mipmap gen.
---
 src/mesa/drivers/dri/intel/intel_tex.c |3 +-
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |6 +-
 src/mesa/drivers/dri/radeon/radeon_texture.c   |8 ++
 src/mesa/main/mipmap.c |  104 +---
 4 files changed, 52 insertions(+), 69 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex.c 
b/src/mesa/drivers/dri/intel/intel_tex.c
index 2c3eab2..32e1fb7 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -75,6 +75,7 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target,
   /* sw path: need to map texture images */
   struct intel_context *intel = intel_context(ctx);
   struct intel_texture_object *intelObj = intel_texture_object(texObj);
+  struct gl_texture_image *first_image = 
texObj-Image[0][texObj-BaseLevel];
 
   fallback_debug(%s - fallback to swrast\n, __FUNCTION__);
 
@@ -82,7 +83,7 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target,
   _mesa_generate_mipmap(ctx, target, texObj);
   intel_tex_unmap_level_images(intel, intelObj, texObj-BaseLevel);
 
-  {
+  if (!_mesa_is_format_compressed(first_image-TexFormat)) {
  GLuint nr_faces = (texObj-Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
  GLuint face, i;
  /* Update the level information in our private data in the new images,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 36e68c9..dcfd316 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -688,8 +688,10 @@ nouveau_generate_mipmap(struct gl_context *ctx, GLenum 
target,
_mesa_generate_mipmap(ctx, target, t);
nouveau_teximage_unmap(ctx, base);
 
-   store_mipmap(ctx, target, t-BaseLevel + 1,
-get_last_level(t), t);
+   if (!_mesa_is_format_compressed(base-TexFormat)) {
+   store_mipmap(ctx, target, t-BaseLevel + 1,
+get_last_level(t), t);
+   }
 
} else {
_mesa_meta_GenerateMipmap(ctx, target, t);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c 
b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 9ec5388..ce0df32 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -249,6 +249,7 @@ static void radeon_generate_mipmap(struct gl_context *ctx, 
GLenum target,
radeonTexObj* t = radeon_tex_obj(texObj);
GLuint nr_faces = (t-base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
int i, face;
+   struct gl_texture_image *first_image;
 
radeon_print(RADEON_TEXTURE, RADEON_VERBOSE,
%s(%p, tex %p) Target type %s.\n,
@@ -257,6 +258,13 @@ static void radeon_generate_mipmap(struct gl_context *ctx, 
GLenum target,
 
_mesa_generate_mipmap(ctx, target, texObj);
 
+   /* For the compressed case, we don't need to do the
+* non-TexImage recovery path below.
+*/
+   first_image = texObj-Image[0][texObj-BaseLevel];
+   if (_mesa_is_format_compressed(first_image-TexFormat))
+   return;
+
for (face = 0; face  nr_faces; face++) {
for (i = texObj-BaseLevel + 1; i  texObj-MaxLevel; i++) {
radeon_texture_image *image;
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 43eea50..f2724db 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1971,13 +1971,12 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
 {
GLint level;
gl_format temp_format;
-   const GLubyte *srcData = NULL;
-   GLubyte *dstData = NULL;
-   GLenum datatype, temp_base_format;
+   GLenum datatype;
GLuint comps;
GLuint row;
-   GLint components, size;
-   GLchan *dst;
+   GLint components;
+   GLuint temp_src_stride, temp_dst_stride; /* in bytes */
+   GLchan *temp_src = NULL, *temp_dst = NULL;
 
/* Choose the format we will do _mesa_generate_mipmap_level() in,
 * and uncompress the firstImage into a temporary of that format.
@@ -2009,25 +2008,18 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
}
 
/* allocate storage for uncompressed GL_RGB or GL_RGBA images */
-   size = 

[Mesa-dev] [PATCH 3/4] mesa: Remove uncompressed code from generate_mipmaps_compressed().

2011-06-10 Thread Eric Anholt
---
 src/mesa/main/mipmap.c |  177 +---
 1 files changed, 77 insertions(+), 100 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 45fcc27..43eea50 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1970,79 +1970,72 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
   GLuint maxLevel)
 {
GLint level;
-   gl_format convertFormat;
+   gl_format temp_format;
const GLubyte *srcData = NULL;
GLubyte *dstData = NULL;
-   GLenum datatype;
+   GLenum datatype, temp_base_format;
GLuint comps;
+   GLuint row;
+   GLint components, size;
+   GLchan *dst;
 
-   /* Find convertFormat - the format that do_row() will process */
-   if (_mesa_is_format_compressed(srcImage-TexFormat)) {
-  /* setup for compressed textures - need to allocate temporary
-   * image buffers to hold uncompressed images.
-   */
-  GLuint row;
-  GLint  components, size;
-  GLchan *dst;
-
-  assert(texObj-Target == GL_TEXTURE_2D ||
- texObj-Target == GL_TEXTURE_CUBE_MAP_ARB);
-
-  if (srcImage-_BaseFormat == GL_RGB) {
- convertFormat = MESA_FORMAT_RGB888;
- components = 3;
-  } else if (srcImage-_BaseFormat == GL_RED) {
- convertFormat = MESA_FORMAT_R8;
- components = 1;
-  } else if (srcImage-_BaseFormat == GL_RG) {
- convertFormat = MESA_FORMAT_RG88;
- components = 2;
-  } else if (srcImage-_BaseFormat == GL_RGBA) {
- convertFormat = MESA_FORMAT_RGBA;
- components = 4;
-  } else if (srcImage-_BaseFormat == GL_LUMINANCE) {
- convertFormat = MESA_FORMAT_L8;
- components = 1;
-  } else if (srcImage-_BaseFormat == GL_LUMINANCE_ALPHA) {
- convertFormat = MESA_FORMAT_AL88;
- components = 2;
-  } else {
- _mesa_problem(ctx, bad srcImage-_BaseFormat in 
_mesa_generate_mipmaps);
- return;
-  }
+   /* Choose the format we will do _mesa_generate_mipmap_level() in,
+* and uncompress the firstImage into a temporary of that format.
+*/
+   assert(texObj-Target == GL_TEXTURE_2D ||
+ texObj-Target == GL_TEXTURE_CUBE_MAP_ARB);
+
+   if (srcImage-_BaseFormat == GL_RGB) {
+  temp_format = MESA_FORMAT_RGB888;
+  components = 3;
+   } else if (srcImage-_BaseFormat == GL_RED) {
+  temp_format = MESA_FORMAT_R8;
+  components = 1;
+   } else if (srcImage-_BaseFormat == GL_RG) {
+  temp_format = MESA_FORMAT_RG88;
+  components = 2;
+   } else if (srcImage-_BaseFormat == GL_RGBA) {
+  temp_format = MESA_FORMAT_RGBA;
+  components = 4;
+   } else if (srcImage-_BaseFormat == GL_LUMINANCE) {
+  temp_format = MESA_FORMAT_L8;
+  components = 1;
+   } else if (srcImage-_BaseFormat == GL_LUMINANCE_ALPHA) {
+  temp_format = MESA_FORMAT_AL88;
+  components = 2;
+   } else {
+  _mesa_problem(ctx, bad srcImage-_BaseFormat in 
_mesa_generate_mipmaps);
+  return;
+   }
 
-  /* allocate storage for uncompressed GL_RGB or GL_RGBA images */
-  size = _mesa_bytes_per_pixel(srcImage-_BaseFormat, CHAN_TYPE)
- * srcImage-Width * srcImage-Height * srcImage-Depth + 20;
-  /* 20 extra bytes, just be safe when calling last FetchTexel */
-  srcData = (GLubyte *) malloc(size);
-  if (!srcData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
- return;
-  }
-  dstData = (GLubyte *) malloc(size / 2);  /* 1/4 would probably be OK */
-  if (!dstData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
- free((void *) srcData);
- return;
-  }
+   /* allocate storage for uncompressed GL_RGB or GL_RGBA images */
+   size = _mesa_bytes_per_pixel(srcImage-_BaseFormat, CHAN_TYPE)
+  * srcImage-Width * srcImage-Height * srcImage-Depth + 20;
+   /* 20 extra bytes, just be safe when calling last FetchTexel */
+   srcData = (GLubyte *) malloc(size);
+   if (!srcData) {
+  _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
+  return;
+   }
+   dstData = (GLubyte *) malloc(size / 2);  /* 1/4 would probably be OK */
+   if (!dstData) {
+  _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
+  free((void *) srcData);
+  return;
+   }
 
-  /* decompress base image here */
-  dst = (GLchan *) srcData;
-  for (row = 0; row  srcImage-Height; row++) {
- GLuint col;
- for (col = 0; col  srcImage-Width; col++) {
-srcImage-FetchTexelc(srcImage, col, row, 0, dst);
-dst += components;
- }
+   /* decompress base image here */
+   dst = (GLchan *) srcData;
+   for (row = 0; row  srcImage-Height; row++) {
+  GLuint col;
+  for (col = 0; col  srcImage-Width; col++) {
+srcImage-FetchTexelc(srcImage, col, row, 0, dst);
+dst += components;
   }
}
-   else {
-  /* uncompressed */
-  convertFormat = 

Re: [Mesa-dev] [PATCH 2/4] intel: Clean up intel_render_texture with a rename and a helper function.

2011-06-10 Thread Eric Anholt
On Fri, 10 Jun 2011 12:58:12 -0700, Kenneth Graunke kenn...@whitecape.org 
wrote:
 On 06/07/2011 11:47 AM, Eric Anholt wrote:
  The newImage isn't particularly new -- it might be the same texture
  that was attached to the same attachment point before.  This function
  also gets called when just rebinding back to an FBO with a texture
  attachment.
  ---
src/mesa/drivers/dri/intel/intel_fbo.c |   16 ++--
1 files changed, 6 insertions(+), 10 deletions(-)
 
  diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
  b/src/mesa/drivers/dri/intel/intel_fbo.c
  index 0a67caa..8fda37b 100644
  --- a/src/mesa/drivers/dri/intel/intel_fbo.c
  +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
  @@ -567,16 +567,12 @@ intel_render_texture(struct gl_context * ctx,
 struct gl_framebuffer *fb,
 struct gl_renderbuffer_attachment *att)
{
  -   struct gl_texture_image *newImage
  -  = att-Texture-Image[att-CubeMapFace][att-TextureLevel];
  +   struct gl_texture_image *image = _mesa_get_attachment_teximage(att);
   struct intel_renderbuffer *irb = intel_renderbuffer(att-Renderbuffer);
  -   struct intel_texture_image *intel_image;
  +   struct intel_texture_image *intel_image = intel_texture_image(image);
 
   (void) fb;
 
  -   ASSERT(newImage);
  -
  -   intel_image = intel_texture_image(newImage);
   if (!intel_image-mt) {
  /* Fallback on drawing to a texture that doesn't have a miptree
   * (has a border, width/height 0, etc.)
  @@ -586,7 +582,7 @@ intel_render_texture(struct gl_context * ctx,
 
 Any particular reason for removing the assertion?

Trying not to confuse people about there being some risk here. :)

 Patch 4 seems to be fixing a bug, but I don't see any statement of 
 impact on either piglit or applications.  Was this actually breaking 
 something in the wild, or just found by inspection (and allergic 
 reactions to piles of yak hair)? :)

Mostly just trying to increase sanity of the code.  No more This code
is written in an absurd fashion, and would be better the way it is
after the patch.  It's also one less place for me to worry about
_ColorDrawBuffers[], which I still haven't decided to kill/rescue yet.
No testcase.


pgpaiX6GbuTGU.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 03/11] intel: Add block alignment for RGTC textures.

2011-06-10 Thread Brian Paul

On 06/10/2011 02:38 PM, Eric Anholt wrote:

We were using the default 4x2 alignment instead of the 4x4 required
for non-FXT compressed textures.
---
  src/mesa/drivers/dri/i965/brw_tex_layout.c |2 +-
  src/mesa/drivers/dri/intel/intel_mipmap_tree.c |6 +--
  src/mesa/drivers/dri/intel/intel_tex_layout.c  |   42 +---
  src/mesa/drivers/dri/intel/intel_tex_layout.h  |3 +-
  4 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 4a3a2bf..f462f32 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -88,7 +88,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
GLuint align_w = 4;

mt-total_height = 0;
-  intel_get_texture_alignment_unit(mt-internal_format,align_w,align_h);
+  intel_get_texture_alignment_unit(mt-format,align_w,align_h);

if (mt-compressed) {
mt-total_width = ALIGN(width, align_w);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index aa6fc5b..9a1fb18 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -402,8 +402,7 @@ intel_miptree_image_data(struct intel_context *intel,
if(dst-compressed) {
 unsigned int align_w, align_h;

-intel_get_texture_alignment_unit(dst-internal_format,
-   align_w,align_h);
+intel_get_texture_alignment_unit(dst-format,align_w,align_h);
 height = (height + align_h - 1) / align_h;
 width = ALIGN(width, align_w);
}
@@ -445,8 +444,7 @@ intel_miptree_image_copy(struct intel_context *intel,
 if (dst-compressed) {
 GLuint align_w, align_h;

-   intel_get_texture_alignment_unit(dst-internal_format,
-align_w,align_h);
+   intel_get_texture_alignment_unit(dst-format,align_w,align_h);
 height = (height + 3) / 4;
 width = ALIGN(width, align_w);
 }
diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c 
b/src/mesa/drivers/dri/intel/intel_tex_layout.c
index d39733b..7493b42 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
@@ -35,32 +35,22 @@
  #include intel_context.h
  #include main/macros.h

-void intel_get_texture_alignment_unit(GLenum internalFormat, GLuint *w, GLuint 
*h)
+void
+intel_get_texture_alignment_unit(gl_format format,
+unsigned int *w, unsigned int *h)
  {
-switch (internalFormat) {
-case GL_COMPRESSED_RGB_FXT1_3DFX:
-case GL_COMPRESSED_RGBA_FXT1_3DFX:
-*w = 8;
-*h = 4;
-break;
-
-case GL_RGB_S3TC:
-case GL_RGB4_S3TC:
-case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-case GL_RGBA_S3TC:
-case GL_RGBA4_S3TC:
-case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-*w = 4;
-*h = 4;
-break;
-
-default:
-*w = 4;
-*h = 2;
-break;
-}
+   if (_mesa_is_format_compressed(format)) {
+  if (format == MESA_FORMAT_RGB_FXT1 || format == MESA_FORMAT_RGBA_FXT1) {
+*w = 8;
+*h = 4;
+  } else {
+*w = 4;
+*h = 4;
+  }
+   } else {
+  *w = 4;
+  *h = 2;
+   }


Could you make use of _mesa_get_format_block_size() here?

-Brian

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


Re: [Mesa-dev] [PATCH] st/mesa: remove asserts in st_texture_image_copy

2011-06-10 Thread Brian Paul

On 06/10/2011 11:44 AM, Marek Olšák wrote:

This is for 7.10 only. The fix in master looks too complex to be
cherry-picked.

The assertions fail when generating mipmaps for NPOT textures.

This fixes:
- fbo-generatemipmap-formats (all of them)
---
  src/mesa/state_tracker/st_texture.c |4 
  1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_texture.c 
b/src/mesa/state_tracker/st_texture.c
index 155ea39..4a794f6 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -285,10 +285,6 @@ st_texture_image_copy(struct pipe_context *pipe,
 struct pipe_box src_box;
 GLuint i;

-   assert(u_minify(src-width0, srcLevel) == width);
-   assert(u_minify(src-height0, srcLevel) == height);
-   assert(u_minify(src-depth0, srcLevel) == depth);
-
 src_box.x = 0;
 src_box.y = 0;
 src_box.width = width;


Reviewed-by: Brian Paul bri...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/11] intel: Add block alignment for RGTC textures.

2011-06-10 Thread Eric Anholt
On Fri, 10 Jun 2011 15:17:12 -0600, Brian Paul bri...@vmware.com wrote:
 On 06/10/2011 02:38 PM, Eric Anholt wrote:
  We were using the default 4x2 alignment instead of the 4x4 required
  for non-FXT compressed textures.
  ---
src/mesa/drivers/dri/i965/brw_tex_layout.c |2 +-
src/mesa/drivers/dri/intel/intel_mipmap_tree.c |6 +--
src/mesa/drivers/dri/intel/intel_tex_layout.c  |   42 
  +---
src/mesa/drivers/dri/intel/intel_tex_layout.h  |3 +-
4 files changed, 21 insertions(+), 32 deletions(-)
 
  diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
  b/src/mesa/drivers/dri/i965/brw_tex_layout.c
  index 4a3a2bf..f462f32 100644
  --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
  +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
  @@ -88,7 +88,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
  GLuint align_w = 4;
 
  mt-total_height = 0;
  -  
  intel_get_texture_alignment_unit(mt-internal_format,align_w,align_h);
  +  intel_get_texture_alignment_unit(mt-format,align_w,align_h);
 
  if (mt-compressed) {
  mt-total_width = ALIGN(width, align_w);
  diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
  b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
  index aa6fc5b..9a1fb18 100644
  --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
  +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
  @@ -402,8 +402,7 @@ intel_miptree_image_data(struct intel_context *intel,
  if(dst-compressed) {
   unsigned int align_w, align_h;
 
  -intel_get_texture_alignment_unit(dst-internal_format,
  -   align_w,align_h);
  +intel_get_texture_alignment_unit(dst-format,align_w,align_h);
   height = (height + align_h - 1) / align_h;
   width = ALIGN(width, align_w);
  }
  @@ -445,8 +444,7 @@ intel_miptree_image_copy(struct intel_context *intel,
   if (dst-compressed) {
   GLuint align_w, align_h;
 
  -   intel_get_texture_alignment_unit(dst-internal_format,
  -align_w,align_h);
  +   intel_get_texture_alignment_unit(dst-format,align_w,align_h);
   height = (height + 3) / 4;
   width = ALIGN(width, align_w);
   }
  diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c 
  b/src/mesa/drivers/dri/intel/intel_tex_layout.c
  index d39733b..7493b42 100644
  --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
  +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
  @@ -35,32 +35,22 @@
#include intel_context.h
#include main/macros.h
 
  -void intel_get_texture_alignment_unit(GLenum internalFormat, GLuint *w, 
  GLuint *h)
  +void
  +intel_get_texture_alignment_unit(gl_format format,
  +unsigned int *w, unsigned int *h)
{
  -switch (internalFormat) {
  -case GL_COMPRESSED_RGB_FXT1_3DFX:
  -case GL_COMPRESSED_RGBA_FXT1_3DFX:
  -*w = 8;
  -*h = 4;
  -break;
  -
  -case GL_RGB_S3TC:
  -case GL_RGB4_S3TC:
  -case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
  -case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
  -case GL_RGBA_S3TC:
  -case GL_RGBA4_S3TC:
  -case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
  -case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
  -*w = 4;
  -*h = 4;
  -break;
  -
  -default:
  -*w = 4;
  -*h = 2;
  -break;
  -}
  +   if (_mesa_is_format_compressed(format)) {
  +  if (format == MESA_FORMAT_RGB_FXT1 || format == 
  MESA_FORMAT_RGBA_FXT1) {
  +*w = 8;
  +*h = 4;
  +  } else {
  +*w = 4;
  +*h = 4;
  +  }
  +   } else {
  +  *w = 4;
  +  *h = 2;
  +   }
 
 Could you make use of _mesa_get_format_block_size() here?

The compressed formats happen to match, but the default case doesn't.
Given that this is coming out of a table in the hardware spec (and we're
going to need a bunch of overrides for it in the future with MSAA and
things), I'd rather just reproduce the hw spec here.


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


[Mesa-dev] [PATCH] i965/fs: Check for compilation failure and bail as soon as possible.

2011-06-10 Thread Kenneth Graunke
Prior to this patch, it would happily continue compiling and even
optimizing after a failure was detected.  This seems wasteful.

More importantly, the message length  11 failure seems to choke the
instruction scheduler, making it somehow use an undefined value and
segmentation fault.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7c73a8f..19c4de3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1532,6 +1532,8 @@ fs_visitor::run()
 base_ir = ir;
 this-result = reg_undef;
 ir-accept(this);
+if (failed)
+   return false;
   }
 
   emit_fb_writes();
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH] mapi: Fix tls with shared/es-glapi on x86-64

2011-06-10 Thread Chia-I Wu
On Wed, Jun 8, 2011 at 10:07 PM, Benjamin Franzke
benjaminfran...@googlemail.com wrote:
 2011/6/7 Chia-I Wu olva...@gmail.com:
 How is that the case?  It seems the symbol is not used elsewhere.


 Right, seems i tried solve the wrong side of the problem.

 x86_64_entry_start is declared similar to a global static variable in
 the asm code,
 so it will be bound local.
 But in entry_get_public its declared as extern, the compiler will generate 
 code
 to lookup a global object, not a local.
 By declaring x86_64_entry_start as static the correct local address is
 loaded here.
I got this warning after applying the patch

  ../../../src/mapi/mapi/entry_x86-64_tls.h:69:1: warning:
‘x86_64_current_tls’ used but never defined

Maybe the function declaration should be decorated with extern?
 Patch attached.




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


[Mesa-dev] [Bug 38172] New: Mesa build errors using build.sh script

2011-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=38172

   Summary: Mesa build errors using build.sh script
   Product: Mesa
   Version: git
  Platform: x86 (IA32)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: jdc...@sccoast.net


I am using the build.sh script to install X.
I have modified the script to use local repository mirrors on my HDD.
However, the environment variable assignments of the script are
unchanged.

I have had a problem compiling mesa for the last year (at least).
The problem has to do with gcc not finding the X headers that were
installed by build.sh.
BTW, I have this problem when using ./configure|make|ETC without using
build.sh.

Without confusing you, let's just say that nouveau and gallium are
disabled because enabling those caused drm and mesa to fail to compile.
I had to butcher both drm and the mesa main makefiles to do that.
(The creator of build.sh is going to get my help passing options to
modules when I get my new system up and running.)
Though I think that I did have gallium enabled several months back when
I last installed X and I still had this same problem.

I have two errors that I'm reporting.

I am attaching a partial output from the make showing the errors.

Building to run Linux / i686 ()
Fri Jun 10 22:39:45 America 2011

Environment variables that build.sh sees :
Libdir = lib ??? set via build.sh. I don't know what it's for.
ACLOCAL = aclocal -I /opt/X/share/aclocal
PKG_CONFIG_PATH
=
/opt/X/share/pkgconfig:/opt/X/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X/lib/pkgconfig:/opt/GNOME/lib/pkgconfig:/opt/GNOME/share/pkgconfig:/usr/local/apr/lib/pkgconfig:/opt/QT/lib/pkgconfig
LD_LIBRARY_PATH
=
/opt/X/lib:/lib:/usr/lib:/usr/local/lib:/opt/X/lib:/opt/GNOME/lib:/usr/local/apr/lib:/opt/JAVA/lib/i386:/srv/mysql/lib/mysql:/opt/QT/lib
PATH =
/opt/X/bin:/bin:/usr/bin:/usr/local/bin:/opt/X/bin:/opt/GNOME/bin:/opt/JAVA/bin:/opt/QT/bin
SHELL=/bin/bash
MAKEFLAGS=-j 1

==
==  Processing module/component:  mesa/
.
.
.
checking for X11... yes
checking for GLPROTO... yes
checking for LIBDRM... yes
checking for DRI2PROTO... yes
checking for XF86VIDMODE... yes
checking for DRIGL... yes
checking for LIBDRM_RADEON... yes
checking expat.h usability... yes
checking expat.h presence... yes
checking for expat.h... yes
checking for XML_ParserCreate in -lexpat... yes
checking for INTEL... yes
checking for LIBUDEV... yes
checking for XCB_DRI2... yes
checking for xcb_dri2_connect_alignment_pad in -lxcb-dri2... no
checking for GLW... yes
checking for GLUT... yes
checking for llvm-config... no  What is this ???
checking for XORG... no
configure: creating ./config.status
config.status: creating configs/autoconf
config.status: executing configs commands

prefix:  /opt/X
exec_prefix: ${prefix}
libdir:  /opt/X/lib
includedir:  ${prefix}/include

OpenGL:  yes (ES1: no ES2: no)
OpenVG:  no

Driver:  dri
OSMesa:  no
DRI drivers: i810 i915 i965 mach64 mga r128 r200 r300 r600
radeon savage sis tdfx unichrome swrast DRI driver dir:
${libdir}/dri Use XCB: no
Shared dricore:  no

GLU: yes
GLw: yes (Motif: no)
glut:yes

EGL: yes
EGL platforms:   x11 drm
EGL drivers: builtin:egl_glx builtin:egl_dri2 egl_gallium
EGL Gallium STs: $(GL_LIB)

llvm:no

Gallium: yes
Gallium dirs:auxiliary drivers state_trackers
Target dirs:  egl
Winsys dirs: sw sw/xlib sw/dri
Driver dirs: softpipe failover galahad trace rbug noop
identity Trackers dirs:   dri egl

Shared libs: yes
Static libs: no

CFLAGS:  -g -O2 -Wall -Wmissing-prototypes -std=c99
-ffast-math -fno-strict-aliasing -fPIC CXXFLAGS:-g -O2
-Wall -fno-strict-aliasing -fPIC Macros:  -D_GNU_SOURCE
-DPTHREADS -DHAVE_POSIX_MEMALIGN -DUSE_EXTERNAL_DXTN_LIB=1
-DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING
-DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2
-DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DUSE_X86_ASM
-DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM

PYTHON2: python

Run 'make' to build Mesa
.
.
.
make[3]: Entering directory
`/home/david/sources/XSOURCES/mesa/src/egl/main'
running /opt/X/bin/makedepend
/opt/X/bin/makedepend -fdepend
-I/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/include
-I/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed
-D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN

Re: [Mesa-dev] [PATCH 06/11] intel: Drop the internal_format field of the mipmap tree.

2011-06-10 Thread Ian Romanick
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/10/2011 01:38 PM, Eric Anholt wrote:
 This has been replaced with the gl_format now.

I just want to make sure I grok this.  2/11 and 6/11 just sap
IntenalFormat for TexFormat, right?

 ---
  src/mesa/drivers/dri/intel/intel_fbo.c  |1 -
  src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |   10 +++---
  src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |3 ---
  src/mesa/drivers/dri/intel/intel_tex_image.c|4 +---
  src/mesa/drivers/dri/intel/intel_tex_validate.c |1 -
  5 files changed, 4 insertions(+), 15 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
 b/src/mesa/drivers/dri/intel/intel_fbo.c
 index 0520386..ac63557 100644
 --- a/src/mesa/drivers/dri/intel/intel_fbo.c
 +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
 @@ -643,7 +643,6 @@ intel_render_texture(struct gl_context * ctx,
new_mt = intel_miptree_create(intel, image-TexObject-Target,
   intel_image-base.TexFormat,
   intel_image-base._BaseFormat,
 - intel_image-base.InternalFormat,
   intel_image-level,
   intel_image-level,
   intel_image-base.Width,
 diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
 b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
 index 3fdb73d..689755a 100644
 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
 +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
 @@ -56,7 +56,6 @@ static struct intel_mipmap_tree *
  intel_miptree_create_internal(struct intel_context *intel,
 GLenum target,
 gl_format format,
 -   GLenum internal_format,
 GLuint first_level,
 GLuint last_level,
 GLuint width0,
 @@ -69,12 +68,11 @@ intel_miptree_create_internal(struct intel_context *intel,
  
 DBG(%s target %s format %s level %d..%d -- %p\n, __FUNCTION__,
 _mesa_lookup_enum_by_nr(target),
 -   _mesa_lookup_enum_by_nr(internal_format), 
 +   _mesa_get_format_name(format),
 first_level, last_level, mt);
  
 mt-target = target_to_target(target);
 mt-format = format;
 -   mt-internal_format = internal_format;
 mt-first_level = first_level;
 mt-last_level = last_level;
 mt-width0 = width0;
 @@ -108,7 +106,6 @@ intel_miptree_create(struct intel_context *intel,
GLenum target,
gl_format format,
GLenum base_format,
 -  GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,
 @@ -128,7 +125,7 @@ intel_miptree_create(struct intel_context *intel,
tiling = I915_TILING_X;
 }
  
 -   mt = intel_miptree_create_internal(intel, target, format, internal_format,
 +   mt = intel_miptree_create_internal(intel, target, format,
 first_level, last_level, width0,
 height0, depth0, cpp, compress_byte,
 tiling);
 @@ -160,14 +157,13 @@ struct intel_mipmap_tree *
  intel_miptree_create_for_region(struct intel_context *intel,
   GLenum target,
   gl_format format,
 - GLenum internal_format,
   struct intel_region *region,
   GLuint depth0,
   GLuint compress_byte)
  {
 struct intel_mipmap_tree *mt;
  
 -   mt = intel_miptree_create_internal(intel, target, format, internal_format,
 +   mt = intel_miptree_create_internal(intel, target, format,
 0, 0,
 region-width, region-height, 1,
 region-cpp, compress_byte,
 diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h 
 b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
 index 0ce8c09..c1eb200 100644
 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
 +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
 @@ -92,7 +92,6 @@ struct intel_mipmap_tree
  */
 GLenum target;
 gl_format format;
 -   GLenum internal_format;
  
 GLuint first_level;
 GLuint last_level;
 @@ -139,7 +138,6 @@ struct intel_mipmap_tree *intel_miptree_create(struct 
 intel_context *intel,
 GLenum target,
  gl_format format,
 GLenum base_format,
 -   GLenum internal_format,
 GLuint first_level,
 GLuint 

Re: [Mesa-dev] [PATCH 10/11] intel: Drop dead preinitialization of align_w, align_h.

2011-06-10 Thread Ian Romanick
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/10/2011 01:38 PM, Eric Anholt wrote:
 ---
  src/mesa/drivers/dri/intel/intel_tex_layout.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c 
 b/src/mesa/drivers/dri/intel/intel_tex_layout.c
 index 7493b42..2002777 100644
 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
 +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
 @@ -57,7 +57,7 @@ void i945_miptree_layout_2d(struct intel_context *intel,
   struct intel_mipmap_tree *mt,
   uint32_t tiling, int nr_images)
  {
 -   GLuint align_h = 2, align_w = 4;
 +   GLuint align_h, align_w;
 GLuint level;
 GLuint x = 0;
 GLuint y = 0;
 @@ -101,7 +101,7 @@ void i945_miptree_layout_2d(struct intel_context *intel,
  height, 1);
  
if (mt-compressed)
 -  img_height = MAX2(1, height/4);
 +  img_height = MAX2(1, height + 3/4);

Is this hunk accidental or just missing from the commit message?  I'm
guessing the later.

else
img_height = ALIGN(height, align_h);
  

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3ywHUACgkQX1gOwKyEAw+fiACgmvGLg6XC51ARocGgnNCAzWq3
GDgAnRjwnDXBZvvEHeHiuX9c8met0aXI
=UZs4
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] mesa: Split _mesa_generate_mipmap along compressed/uncompressed lines.

2011-06-10 Thread Ian Romanick
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/10/2011 06:14 PM, Ian Romanick wrote:
 On 06/10/2011 01:42 PM, Eric Anholt wrote:
 The path taken is wildly different based on this (do we generate from
 a temporary image, or from level-1's data), and we appear to have
 stride bugs in the compressed case that are tough to disentangle.
 
 This just duplicates the code for the moment, the followon commit will
 do the actual changes.  Only real code change here is handling
 maxLevel in one common place.
 ---
  src/mesa/main/mipmap.c |  251 
 +++-
  1 files changed, 225 insertions(+), 26 deletions(-)
 
 diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
 index e9fcb54..2bdb111 100644
 --- a/src/mesa/main/mipmap.c
 +++ b/src/mesa/main/mipmap.c
 @@ -1885,38 +1885,208 @@ next_mipmap_level_size(GLenum target, GLint border,
 }
  }
 
 +static void
 +generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target,
 + struct gl_texture_object *texObj,
 + const struct gl_texture_image *srcImage,
 + GLuint maxLevel)
 +{
 +   GLint level;
 +   gl_format convertFormat;
 +   const GLubyte *srcData = NULL;
 +   GLubyte *dstData = NULL;
 +   GLenum datatype;
 +   GLuint comps;
 
 +   /* Find convertFormat - the format that do_row() will process */
 +   if (_mesa_is_format_compressed(srcImage-TexFormat)) {
 +  /* setup for compressed textures - need to allocate temporary
 +   * image buffers to hold uncompressed images.
 +   */
 +  GLuint row;
 +  GLint  components, size;
 +  GLchan *dst;
 
 +  assert(texObj-Target == GL_TEXTURE_2D ||
 + texObj-Target == GL_TEXTURE_CUBE_MAP_ARB);
 
   || texObj-Target == GL_TEXTURE_2D_ARRAY);

And after seeing all this blown away in the next patch, never mind. :)

 -/**
 - * Automatic mipmap generation.
 - * This is the fallback/default function for ctx-Driver.GenerateMipmap().
 - * Generate a complete set of mipmaps from texObj's BaseLevel image.
 - * Stop at texObj's MaxLevel or when we get to the 1x1 texture.
 - * For cube maps, target will be one of
 - * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP.
 - */
 -void
 -_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
 -  struct gl_texture_object *texObj)
 +  if (srcImage-_BaseFormat == GL_RGB) {
 + convertFormat = MESA_FORMAT_RGB888;
 + components = 3;
 +  } else if (srcImage-_BaseFormat == GL_RED) {
 + convertFormat = MESA_FORMAT_R8;
 + components = 1;
 +  } else if (srcImage-_BaseFormat == GL_RG) {
 + convertFormat = MESA_FORMAT_RG88;
 + components = 2;
 +  } else if (srcImage-_BaseFormat == GL_RGBA) {
 + convertFormat = MESA_FORMAT_RGBA;
 + components = 4;
 +  } else if (srcImage-_BaseFormat == GL_LUMINANCE) {
 + convertFormat = MESA_FORMAT_L8;
 + components = 1;
 +  } else if (srcImage-_BaseFormat == GL_LUMINANCE_ALPHA) {
 + convertFormat = MESA_FORMAT_AL88;
 + components = 2;
 +  } else {
 + _mesa_problem(ctx, bad srcImage-_BaseFormat in 
 _mesa_generate_mipmaps);
 + return;
 +  }
 +
 +  /* allocate storage for uncompressed GL_RGB or GL_RGBA images */
 +  size = _mesa_bytes_per_pixel(srcImage-_BaseFormat, CHAN_TYPE)
 + * srcImage-Width * srcImage-Height * srcImage-Depth + 20;
 +  /* 20 extra bytes, just be safe when calling last FetchTexel */
 +  srcData = (GLubyte *) malloc(size);
 +  if (!srcData) {
 + _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
 + return;
 +  }
 +  dstData = (GLubyte *) malloc(size / 2);  /* 1/4 would probably be OK 
 */
 +  if (!dstData) {
 + _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
 + free((void *) srcData);
 + return;
 +  }
 +
 +  /* decompress base image here */
 +  dst = (GLchan *) srcData;
 +  for (row = 0; row  srcImage-Height; row++) {
 + GLuint col;
 + for (col = 0; col  srcImage-Width; col++) {
 +srcImage-FetchTexelc(srcImage, col, row, 0, dst);
 +dst += components;
 + }
 +  }
 +   }
 +   else {
 +  /* uncompressed */
 +  convertFormat = srcImage-TexFormat;
 +   }
 +
 +   _mesa_format_to_type_and_comps(convertFormat, datatype, comps);
 +
 +   for (level = texObj-BaseLevel; level  maxLevel; level++) {
 +  /* generate image[level+1] from image[level] */
 +  const struct gl_texture_image *srcImage;
 +  struct gl_texture_image *dstImage;
 +  GLint srcWidth, srcHeight, srcDepth;
 +  GLint dstWidth, dstHeight, dstDepth;
 +  GLint border;
 +  GLboolean nextLevel;
 +
 +  /* get src image parameters */
 +  srcImage = _mesa_select_tex_image(ctx, texObj, target, level);
 +  ASSERT(srcImage);
 +  srcWidth = 

Re: [Mesa-dev] [PATCH] i965/fs: Check for compilation failure and bail as soon as possible.

2011-06-10 Thread Eric Anholt
On Fri, 10 Jun 2011 16:07:31 -0700, Kenneth Graunke kenn...@whitecape.org 
wrote:
 Prior to this patch, it would happily continue compiling and even
 optimizing after a failure was detected.  This seems wasteful.
 
 More importantly, the message length  11 failure seems to choke the
 instruction scheduler, making it somehow use an undefined value and
 segmentation fault.

Odd to have it inside that loop -- if it needs to be in there (instead
of just outside afterwards), that would indicate that that check needs
to be all over the place in the visitor.  Pretty sure it doesn't need
to, though.

mlen  11 might have been an issue by overflowing a
16-entry-on-the-stack array in the scheduler


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


[Mesa-dev] [PATCH] mesa: move texrender.c to swrast

2011-06-10 Thread Brian Paul
This stuff is really for software rendering, it's not core Mesa.
A small step toward pushing the FetchTexel() stuff down into swrast.
---
 src/mesa/SConscript  |2 +-
 src/mesa/drivers/common/driverfuncs.c|5 +-
 src/mesa/drivers/dri/intel/intel_fbo.c   |8 +-
 src/mesa/drivers/dri/radeon/radeon_fbo.c |8 +-
 src/mesa/main/texrender.c|  654 --
 src/mesa/main/texrender.h|   18 -
 src/mesa/sources.mak |2 +-
 src/mesa/swrast/s_texrender.c|  654 ++
 src/mesa/swrast/swrast.h |   10 +
 9 files changed, 676 insertions(+), 685 deletions(-)
 delete mode 100644 src/mesa/main/texrender.c
 delete mode 100644 src/mesa/main/texrender.h
 create mode 100644 src/mesa/swrast/s_texrender.c

diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index fdb4d5a..24e2155 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -121,7 +121,6 @@ main_sources = [
 'main/texobj.c',
 'main/texpal.c',
 'main/texparam.c',
-'main/texrender.c',
 'main/texstate.c',
 'main/texstore.c',
 'main/texturebarrier.c',
@@ -174,6 +173,7 @@ swrast_sources = [
 'swrast/s_stencil.c',
 'swrast/s_texcombine.c',
 'swrast/s_texfilter.c',
+'swrast/s_texrender.c',
 'swrast/s_triangle.c',
 'swrast/s_zoom.c',
 ]
diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 0dbc7c3..8ab129d 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -40,7 +40,6 @@
 #include main/texstore.h
 #include main/bufferobj.h
 #include main/fbobject.h
-#include main/texrender.h
 #include main/samplerobj.h
 #include main/syncobj.h
 #include main/texturebarrier.h
@@ -183,8 +182,8 @@ _mesa_init_driver_functions(struct dd_function_table 
*driver)
 
driver-NewFramebuffer = _mesa_new_framebuffer;
driver-NewRenderbuffer = _mesa_new_soft_renderbuffer;
-   driver-RenderTexture = _mesa_render_texture;
-   driver-FinishRenderTexture = _mesa_finish_render_texture;
+   driver-RenderTexture = _swrast_render_texture;
+   driver-FinishRenderTexture = _swrast_finish_render_texture;
driver-FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
driver-ValidateFramebuffer = _mesa_validate_framebuffer;
 
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 83f622d..8277477 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -35,7 +35,7 @@
 #include main/renderbuffer.h
 #include main/context.h
 #include main/teximage.h
-#include main/texrender.h
+#include swrast/s_texrender.h
 #include drivers/common/meta.h
 
 #include intel_context.h
@@ -557,7 +557,7 @@ intel_render_texture(struct gl_context * ctx,
* (has a border, width/height 0, etc.)
*/
   _mesa_reference_renderbuffer(att-Renderbuffer, NULL);
-  _mesa_render_texture(ctx, fb, att);
+  _swrast_render_texture(ctx, fb, att);
   return;
}
else if (!irb) {
@@ -568,14 +568,14 @@ intel_render_texture(struct gl_context * ctx,
   }
   else {
  /* fallback to software rendering */
- _mesa_render_texture(ctx, fb, att);
+ _swrast_render_texture(ctx, fb, att);
  return;
   }
}
 
if (!intel_update_wrapper(ctx, irb, newImage)) {
_mesa_reference_renderbuffer(att-Renderbuffer, NULL);
-   _mesa_render_texture(ctx, fb, att);
+   _swrast_render_texture(ctx, fb, att);
return;
}
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c 
b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index d3c9257..0986ade 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -35,7 +35,7 @@
 #include main/framebuffer.h
 #include main/renderbuffer.h
 #include main/context.h
-#include main/texrender.h
+#include swrast/s_texrender.h
 #include drivers/common/meta.h
 
 #include radeon_common.h
@@ -557,7 +557,7 @@ radeon_render_texture(struct gl_context * ctx,
   /* Fallback on drawing to a texture without a miptree.
*/
   _mesa_reference_renderbuffer(att-Renderbuffer, NULL);
-  _mesa_render_texture(ctx, fb, att);
+  _swrast_render_texture(ctx, fb, att);
   return;
}
else if (!rrb) {
@@ -568,14 +568,14 @@ radeon_render_texture(struct gl_context * ctx,
   }
   else {
  /* fallback to software rendering */
- _mesa_render_texture(ctx, fb, att);
+ _swrast_render_texture(ctx, fb, att);
  return;
   }
}
 
if (!radeon_update_wrapper(ctx, rrb, newImage)) {
_mesa_reference_renderbuffer(att-Renderbuffer, NULL);
-   _mesa_render_texture(ctx, fb, att);
+   _swrast_render_texture(ctx, fb, att);
return;
}
 
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
deleted file mode 100644
index 

[Mesa-dev] [PATCH] i965/fs: Check for compilation failure and bail before optimizing.

2011-06-10 Thread Kenneth Graunke
Prior to this patch, it would attempt to optimize and allocate registers
for the program even if it failed to compile.  This seems wasteful.

More importantly, the message length  11 failure seems to choke the
instruction scheduler, making it somehow use an undefined value and
segmentation fault.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Eric,

Yeah.  Somehow I wasn't thinking straight and thought that'd check for
failure after every instruction.  But it doesn't; those are only the
top-level variable declarations and functions.  No sense in that at all.

This version moves it below the loop---after the bulk of codegen, but
prior to optimizing and register allocation.  Seems reasonable.

The 16-element stack array theory sounds about right.  Presumably we
should never run into that limit for good code, and this ought to reject
the bad code.

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7c73a8f..3a16afe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1533,6 +1533,8 @@ fs_visitor::run()
 this-result = reg_undef;
 ir-accept(this);
   }
+  if (failed)
+return false;
 
   emit_fb_writes();
 
-- 
1.7.5.4

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