Re: [Mesa-dev] unpack functions showing up highly in profiles

2012-03-18 Thread Brian Paul
On Sat, Mar 17, 2012 at 7:55 PM, Matt Turner matts...@gmail.com wrote:
 Hey

 On my i965/SNB system I profiled some games in WINE and saw that some
 unpack_* functions in src/mesa/main/format_unpack.c show up very
 highly.

 In Day of Defeat: Source and Counter Strike: Source, the
 _mesa_unpack_uint_z_row function was 10~30%.

 In Starcraft II, the unpack_ARGB function was 66%!

 I imagine we could optimize them by checking the value of 'n' and
 unrolling the loops if it's large enough, but I suspect the thing to
 do is figure out why they're being called so much to begin with and
 fix that. Any ideas?

Yes, let's try to find out why/where this function is getting called
from.  How about attaching a debugger to the process and setting a
breakpoint on those functions, then looking at the call stack?


 I'm also curious, in the case of unpack_ARGB why does the (texture
 data?) have to be converted from byte integers to floats to begin
 with? Can't we use the integer data directly, or is this an
 inefficiency of WINE?

Getting the call stack should answer that question.

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


Re: [Mesa-dev] unpack functions showing up highly in profiles

2012-03-18 Thread Matt Turner
On Sun, Mar 18, 2012 at 10:13 AM, Brian Paul brian.e.p...@gmail.com wrote:
 On Sat, Mar 17, 2012 at 7:55 PM, Matt Turner matts...@gmail.com wrote:
 Hey

 On my i965/SNB system I profiled some games in WINE and saw that some
 unpack_* functions in src/mesa/main/format_unpack.c show up very
 highly.

 In Day of Defeat: Source and Counter Strike: Source, the
 _mesa_unpack_uint_z_row function was 10~30%.

 In Starcraft II, the unpack_ARGB function was 66%!

 I imagine we could optimize them by checking the value of 'n' and
 unrolling the loops if it's large enough, but I suspect the thing to
 do is figure out why they're being called so much to begin with and
 fix that. Any ideas?

 Yes, let's try to find out why/where this function is getting called
 from.  How about attaching a debugger to the process and setting a
 breakpoint on those functions, then looking at the call stack?

I pasted the functions wrong. SC2 spends an enormous amount of time in
unpack_uint_z_X8_Z24 and the HL2 games in unpack_ARGB.

SC2's call chain for unpack_uint_z_X8_Z24 is

unpack_uint_z_X8_Z24
 - _mesa_unpack_uint_z_row
  - _mesa_readpixels
   - intelReadPixels
- copy_tex_sub_image.isra.3
 - intelCopyTexSubImage2D
  - copyteximage
   - shared_dispatch_stub_324
- surface_load_ds_location
 - drawPrimitive
  - wined3d_device_draw_indexed_primitive
   - IDirect3DDevice9Impl_DrawIndexedPrimitive
- ??

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


[Mesa-dev] [PATCH] softpipe: set max cube texture size to 4Kx4K

2012-03-18 Thread Brian Paul
The max size was 16Kx16K so a 4 byte/pixel, six-sided cube would require
6 GBytes of memory.  If mipmapped, 8 GB.  Reduce the max size to 4K to
make the total size more reasonable.

Fixes a crash with the new piglit max-texture-size test.
---
 src/gallium/drivers/softpipe/sp_limits.h |1 +
 src/gallium/drivers/softpipe/sp_screen.c |2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_limits.h 
b/src/gallium/drivers/softpipe/sp_limits.h
index a7a24c9..ada5c0c 100644
--- a/src/gallium/drivers/softpipe/sp_limits.h
+++ b/src/gallium/drivers/softpipe/sp_limits.h
@@ -32,6 +32,7 @@
 
 #define SP_MAX_TEXTURE_2D_LEVELS 15  /* 16K x 16K */
 #define SP_MAX_TEXTURE_3D_LEVELS 9   /* 512 x 512 x 512 */
+#define SP_MAX_TEXTURE_CUBE_LEVELS 13  /* 4K x 4K */
 
 
 /** Max surface size */
diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index c983ef5..183ed9a 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -94,7 +94,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
   return SP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
-  return SP_MAX_TEXTURE_2D_LEVELS;
+  return SP_MAX_TEXTURE_CUBE_LEVELS;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
   return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 01/13] mesa: make _mesa_reference_sampler_object() an inline function

2012-03-18 Thread Brian Paul
To make the no-change case faster, as we do for the other object-reference
functions.
---
 src/mesa/main/samplerobj.c |9 -
 src/mesa/main/samplerobj.h |   12 +++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 7cf0654..5d1b2ad 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -55,12 +55,11 @@ _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name)
  * Handle reference counting.
  */
 void
-_mesa_reference_sampler_object(struct gl_context *ctx,
-   struct gl_sampler_object **ptr,
-   struct gl_sampler_object *samp)
+_mesa_reference_sampler_object_(struct gl_context *ctx,
+struct gl_sampler_object **ptr,
+struct gl_sampler_object *samp)
 {
-   if (*ptr == samp)
-  return;
+   assert(*ptr != samp); /* The inline wrapper should prevent no-op calls */
 
if (*ptr) {
   /* Unreference the old sampler */
diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h
index fe7d5a7..c22d025 100644
--- a/src/mesa/main/samplerobj.h
+++ b/src/mesa/main/samplerobj.h
@@ -38,9 +38,19 @@ _mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
 }
 
 extern void
+_mesa_reference_sampler_object_(struct gl_context *ctx,
+struct gl_sampler_object **ptr,
+struct gl_sampler_object *samp);
+
+static inline void
 _mesa_reference_sampler_object(struct gl_context *ctx,
struct gl_sampler_object **ptr,
-   struct gl_sampler_object *samp);
+   struct gl_sampler_object *samp)
+{
+   if (*ptr != samp)
+  _mesa_reference_sampler_object_(ctx, ptr, samp);
+}
+
 
 extern void
 _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name);
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 02/13] mesa: use MAX3() macro for 3D texture in _mesa_test_texobj_completeness()

2012-03-18 Thread Brian Paul
---
 src/mesa/main/texobj.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 5905948..def09e2 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -465,9 +465,9 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   maxLevels = ctx-Const.MaxTextureLevels;
}
else if (t-Target == GL_TEXTURE_3D) {
-  GLint max = MAX2(t-Image[0][baseLevel]-WidthLog2,
-   t-Image[0][baseLevel]-HeightLog2);
-  maxLog2 = MAX2(max, (GLint)(t-Image[0][baseLevel]-DepthLog2));
+  maxLog2 = MAX3(t-Image[0][baseLevel]-WidthLog2,
+ t-Image[0][baseLevel]-HeightLog2,
+ t-Image[0][baseLevel]-DepthLog2);
   maxLevels = ctx-Const.Max3DTextureLevels;
}
else if (t-Target == GL_TEXTURE_CUBE_MAP_ARB) {
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 04/13] mesa: move some code in _mesa_test_texobj_completeness()

2012-03-18 Thread Brian Paul
Move the simple MaxLevel  BaseLevel test earlier to be closer to where
we error-check BaseLevel.  Also, use the local baseLevel var in more places.
---
 src/mesa/main/texobj.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 1611ba7..9934f2a 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -438,6 +438,12 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   return;
}
 
+   if (t-MaxLevel  baseLevel) {
+  incomplete(t, MAX_LEVEL (%d)  BASE_LEVEL (%d),
+t-MaxLevel, baseLevel);
+  return;
+   }
+
/* Always need the base level image */
if (!t-Image[0][baseLevel]) {
   incomplete(t, Image[baseLevel=%d] == NULL, baseLevel);
@@ -491,18 +497,12 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
 
ASSERT(maxLevels  0);
 
-   if (t-MaxLevel  t-BaseLevel) {
-  incomplete(t, MAX_LEVEL (%d)  BASE_LEVEL (%d),
-t-MaxLevel, t-BaseLevel);
-  return;
-   }
-
t-_MaxLevel = baseLevel + maxLog2;
t-_MaxLevel = MIN2(t-_MaxLevel, t-MaxLevel);
t-_MaxLevel = MIN2(t-_MaxLevel, maxLevels - 1);
 
/* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
-   t-_MaxLambda = (GLfloat) (t-_MaxLevel - t-BaseLevel);
+   t-_MaxLambda = (GLfloat) (t-_MaxLevel - baseLevel);
 
if (t-Immutable) {
   /* This texture object was created with glTexStorage1/2/3D() so we
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 05/13] mesa: better debug message in _mesa_test_texobj_completeness()

2012-03-18 Thread Brian Paul
---
 src/mesa/main/texobj.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 9934f2a..3d89ca1 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -454,7 +454,7 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
if (t-Image[0][baseLevel]-Width == 0 ||
t-Image[0][baseLevel]-Height == 0 ||
t-Image[0][baseLevel]-Depth == 0) {
-  incomplete(t, texture width = 0);
+  incomplete(t, texture width or height or depth = 0);
   return;
}
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 06/13] mesa: add comments in _mesa_test_texobj_completeness() related to the spec

2012-03-18 Thread Brian Paul
---
 src/mesa/main/texobj.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 3d89ca1..2f2223a 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -497,9 +497,9 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
 
ASSERT(maxLevels  0);
 
-   t-_MaxLevel = baseLevel + maxLog2;
+   t-_MaxLevel = baseLevel + maxLog2;  /* 'p' in the GL spec */
t-_MaxLevel = MIN2(t-_MaxLevel, t-MaxLevel);
-   t-_MaxLevel = MIN2(t-_MaxLevel, maxLevels - 1);
+   t-_MaxLevel = MIN2(t-_MaxLevel, maxLevels - 1); /* 'q' in the GL spec */
 
/* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
t-_MaxLambda = (GLfloat) (t-_MaxLevel - baseLevel);
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 07/13] mesa: use new baseImage var to simplify _mesa_test_texobj_completeness()

2012-03-18 Thread Brian Paul
---
 src/mesa/main/texobj.c |   51 +--
 1 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2f2223a..535ea74 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -426,6 +426,7 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
 struct gl_texture_object *t )
 {
const GLint baseLevel = t-BaseLevel;
+   const struct gl_texture_image *baseImage;
GLint maxLog2 = 0, maxLevels = 0;
 
t-_Complete = GL_TRUE;  /* be optimistic */
@@ -444,16 +445,18 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   return;
}
 
+   baseImage = t-Image[0][baseLevel];
+
/* Always need the base level image */
-   if (!t-Image[0][baseLevel]) {
+   if (!baseImage) {
   incomplete(t, Image[baseLevel=%d] == NULL, baseLevel);
   return;
}
 
/* Check width/height/depth for zero */
-   if (t-Image[0][baseLevel]-Width == 0 ||
-   t-Image[0][baseLevel]-Height == 0 ||
-   t-Image[0][baseLevel]-Depth == 0) {
+   if (baseImage-Width == 0 ||
+   baseImage-Height == 0 ||
+   baseImage-Depth == 0) {
   incomplete(t, texture width or height or depth = 0);
   return;
}
@@ -464,24 +467,24 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
switch (t-Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY_EXT:
-  maxLog2 = t-Image[0][baseLevel]-WidthLog2;
+  maxLog2 = baseImage-WidthLog2;
   maxLevels = ctx-Const.MaxTextureLevels;
   break;
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_ARRAY_EXT:
-  maxLog2 = MAX2(t-Image[0][baseLevel]-WidthLog2,
- t-Image[0][baseLevel]-HeightLog2);
+  maxLog2 = MAX2(baseImage-WidthLog2,
+ baseImage-HeightLog2);
   maxLevels = ctx-Const.MaxTextureLevels;
   break;
case GL_TEXTURE_3D:
-  maxLog2 = MAX3(t-Image[0][baseLevel]-WidthLog2,
- t-Image[0][baseLevel]-HeightLog2,
- t-Image[0][baseLevel]-DepthLog2);
+  maxLog2 = MAX3(baseImage-WidthLog2,
+ baseImage-HeightLog2,
+ baseImage-DepthLog2);
   maxLevels = ctx-Const.Max3DTextureLevels;
   break;
case GL_TEXTURE_CUBE_MAP_ARB:
-  maxLog2 = MAX2(t-Image[0][baseLevel]-WidthLog2,
- t-Image[0][baseLevel]-HeightLog2);
+  maxLog2 = MAX2(baseImage-WidthLog2,
+ baseImage-HeightLog2);
   maxLevels = ctx-Const.MaxCubeTextureLevels;
   break;
case GL_TEXTURE_RECTANGLE_NV:
@@ -515,8 +518,8 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
 
if (t-Target == GL_TEXTURE_CUBE_MAP_ARB) {
   /* make sure that all six cube map level 0 images are the same size */
-  const GLuint w = t-Image[0][baseLevel]-Width2;
-  const GLuint h = t-Image[0][baseLevel]-Height2;
+  const GLuint w = baseImage-Width2;
+  const GLuint h = baseImage-Height2;
   GLuint face;
   for (face = 1; face  6; face++) {
  if (t-Image[face][baseLevel] == NULL ||
@@ -545,11 +548,11 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   /* Test dimension-independent attributes */
   for (i = minLevel; i = maxLevel; i++) {
  if (t-Image[0][i]) {
-if (t-Image[0][i]-TexFormat != 
t-Image[0][baseLevel]-TexFormat) {
+if (t-Image[0][i]-TexFormat != baseImage-TexFormat) {
incomplete(t, Format[i] != Format[baseLevel]);
return;
 }
-if (t-Image[0][i]-Border != t-Image[0][baseLevel]-Border) {
+if (t-Image[0][i]-Border != baseImage-Border) {
incomplete(t, Border[i] != Border[baseLevel]);
return;
 }
@@ -560,7 +563,7 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   if ((t-Target == GL_TEXTURE_1D) ||
   (t-Target == GL_TEXTURE_1D_ARRAY_EXT)) {
  /* Test 1-D mipmaps */
- GLuint width = t-Image[0][baseLevel]-Width2;
+ GLuint width = baseImage-Width2;
  for (i = baseLevel + 1; i  maxLevels; i++) {
 if (width  1) {
width /= 2;
@@ -584,8 +587,8 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   else if ((t-Target == GL_TEXTURE_2D) ||
(t-Target == GL_TEXTURE_2D_ARRAY_EXT)) {
  /* Test 2-D mipmaps */
- GLuint width = t-Image[0][baseLevel]-Width2;
- GLuint height = t-Image[0][baseLevel]-Height2;
+ GLuint width = baseImage-Width2;
+ GLuint height = baseImage-Height2;
  for (i = baseLevel + 1; i  maxLevels; i++) {
 if (width  1) {
width /= 2;
@@ -615,9 +618,9 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   }
   else if (t-Target == GL_TEXTURE_3D) {
  /* Test 3-D mipmaps */
- 

[Mesa-dev] [PATCH 08/13] mesa: rewrite/consolidate code in _mesa_test_texobj_completeness()

2012-03-18 Thread Brian Paul
Merge the mipmap level checking code that was separate cases for 1D,
2D, 3D and CUBE before.
---
 src/mesa/main/texobj.c |  183 
 1 files changed, 45 insertions(+), 138 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 535ea74..c07e1ce 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -531,179 +531,86 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   }
}
 
-   /* extra checking for mipmaps */
+   /*
+* Do mipmap consistency checking
+*/
if (t-Sampler.MinFilter != GL_NEAREST  t-Sampler.MinFilter != 
GL_LINEAR) {
   /*
* Mipmapping: determine if we have a complete set of mipmaps
*/
   GLint i;
-  GLint minLevel = baseLevel;
-  GLint maxLevel = t-_MaxLevel;
+  const GLint minLevel = baseLevel;
+  const GLint maxLevel = t-_MaxLevel;
+  GLuint width, height, depth, face, numFaces = 1;
 
   if (minLevel  maxLevel) {
  incomplete(t, minLevel  maxLevel);
  return;
   }
 
-  /* Test dimension-independent attributes */
-  for (i = minLevel; i = maxLevel; i++) {
- if (t-Image[0][i]) {
-if (t-Image[0][i]-TexFormat != baseImage-TexFormat) {
-   incomplete(t, Format[i] != Format[baseLevel]);
-   return;
-}
-if (t-Image[0][i]-Border != baseImage-Border) {
-   incomplete(t, Border[i] != Border[baseLevel]);
-   return;
-}
+  /* Get the base image's dimensions */
+  width = baseImage-Width2;
+  height = baseImage-Height2;
+  depth = baseImage-Depth2;
+
+  /* Note: this loop will be a no-op for RECT, BUFFER, EXTERNAL textures */
+  for (i = baseLevel + 1; i  maxLevels; i++) {
+ /* Compute the expected size of image at level[i] */
+ if (width  1) {
+width /= 2;
+ }
+ if (height  1  t-Target != GL_TEXTURE_1D_ARRAY) {
+height /= 2;
+ }
+ if (depth  1  t-Target != GL_TEXTURE_2D_ARRAY) {
+depth /= 2;
  }
-  }
 
-  /* Test things which depend on number of texture image dimensions */
-  if ((t-Target == GL_TEXTURE_1D) ||
-  (t-Target == GL_TEXTURE_1D_ARRAY_EXT)) {
- /* Test 1-D mipmaps */
- GLuint width = baseImage-Width2;
- for (i = baseLevel + 1; i  maxLevels; i++) {
-if (width  1) {
-   width /= 2;
-}
+ /* loop over cube faces (or single face otherwise) */
+ for (face = 0; face  numFaces; face++) {
 if (i = minLevel  i = maxLevel) {
-   const struct gl_texture_image *img = t-Image[0][i];
+   const struct gl_texture_image *img = t-Image[face][i];
+
if (!img) {
-  incomplete(t, 1D Image[%d] is missing, i);
+  incomplete(t, TexImage[%d] is missing, i);
   return;
}
-   if (img-Width2 != width ) {
-  incomplete(t, 1D Image[%d] bad width %u, i, img-Width2);
+   if (img-TexFormat != baseImage-TexFormat) {
+  incomplete(t, Format[i] != Format[baseLevel]);
   return;
}
-}
-if (width == 1) {
-   return;  /* found smallest needed mipmap, all done! */
-}
- }
-  }
-  else if ((t-Target == GL_TEXTURE_2D) ||
-   (t-Target == GL_TEXTURE_2D_ARRAY_EXT)) {
- /* Test 2-D mipmaps */
- GLuint width = baseImage-Width2;
- GLuint height = baseImage-Height2;
- for (i = baseLevel + 1; i  maxLevels; i++) {
-if (width  1) {
-   width /= 2;
-}
-if (height  1) {
-   height /= 2;
-}
-if (i = minLevel  i = maxLevel) {
-   const struct gl_texture_image *img = t-Image[0][i];
-   if (!img) {
-  incomplete(t, 2D Image[%d of %d] is missing, i, maxLevel);
+   if (img-Border != baseImage-Border) {
+  incomplete(t, Border[i] != Border[baseLevel]);
   return;
}
if (img-Width2 != width) {
-  incomplete(t, 2D Image[%d] bad width %u, i, img-Width2);
+  incomplete(t, TexImage[%d] bad width %u, i, img-Width2);
   return;
}
if (img-Height2 != height) {
-  incomplete(t, 2D Image[i] bad height %u, i, img-Height2);
-  return;
-   }
-   if (width==1  height==1) {
-  return;  /* found smallest needed mipmap, all done! */
-   }
-}
- }
-  }
-  else if (t-Target == GL_TEXTURE_3D) {
- /* Test 3-D mipmaps */
- GLuint width = baseImage-Width2;
- GLuint 

[Mesa-dev] [PATCH 12/13] mesa: rework texture completeness testing

2012-03-18 Thread Brian Paul
Instead of gl_texture_object::_Complete there are now two fields:
_BaseComplete and _MipmapComplete.  The former indicates whether the base
texture level is valid.  The later indicates whether the whole mipmap is
valid.

With sampler objects, a single texture can appear to be both complete and
incomplete at the same time.  See the GL_ARB_sampler_objects spec for more
details.  To implement this we now check if the texture is complete with
respect to a sampler state.

Another benefit of this is we no longer need to invalidate a texture's
completeness state when we change the minification/magnification filters
with glTexParameter().
---
 src/mesa/main/mtypes.h |3 +-
 src/mesa/main/texobj.c |   69 ---
 src/mesa/main/texobj.h |   13 ++
 src/mesa/main/texparam.c   |7 +--
 src/mesa/main/texstate.c   |7 ++-
 src/mesa/state_tracker/st_cb_texture.c |2 +-
 src/mesa/swrast/s_context.c|5 ++-
 src/mesa/swrast/s_texfilter.c  |6 ++-
 src/mesa/swrast/s_texfilter.h  |3 +-
 9 files changed, 78 insertions(+), 37 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f76096a..c6e5b94 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1316,7 +1316,8 @@ struct gl_texture_object
GLenum Swizzle[4];   /** GL_EXT_texture_swizzle */
GLuint _Swizzle; /** same as Swizzle, but SWIZZLE_* format */
GLboolean GenerateMipmap;/** GL_SGIS_generate_mipmap */
-   GLboolean _Complete;/** Is texture object complete? */
+   GLboolean _BaseComplete; /** Is the base texture level valid? */
+   GLboolean _MipmapComplete;   /** Is the whole mipmap valid? */
GLboolean _RenderToTexture;  /** Any rendering to this texture? */
GLboolean Purgeable; /** Is the buffer purgeable under memory 
pressure? */
GLboolean Immutable; /** GL_ARB_texture_storage */
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index c07e1ce..5419cd3 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -262,7 +262,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest-_MaxLevel = src-_MaxLevel;
dest-_MaxLambda = src-_MaxLambda;
dest-GenerateMipmap = src-GenerateMipmap;
-   dest-_Complete = src-_Complete;
+   dest-_BaseComplete = src-_BaseComplete;
+   dest-_MipmapComplete = src-_MipmapComplete;
COPY_4V(dest-Swizzle, src-Swizzle);
dest-_Swizzle = src-_Swizzle;
 
@@ -386,14 +387,26 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr,
 }
 
 
+enum base_mipmap { BASE, MIPMAP };
+
 
 /**
- * Mark a texture object as incomplete.
+ * Mark a texture object as incomplete.  There are actually three kinds of
+ * (in)completeness:
+ * 1. base incomplete: the base level of the texture is invalid so no
+ *texturing is possible.
+ * 2. mipmap incomplete: a non-base level of the texture is invalid so
+ *mipmap filtering isn't possible, but non-mipmap filtering is.
+ * 3. texture incompleteness: some combination of texture state and
+ *sampler state renders the texture incomplete.
+ *
  * \param t  texture object
+ * \param bm  either BASE or MIPMAP to indicate what's incomplete
  * \param fmt...  string describing why it's incomplete (for debugging).
  */
 static void
-incomplete(struct gl_texture_object *t, const char *fmt, ...)
+incomplete(struct gl_texture_object *t, enum base_mipmap bm,
+   const char *fmt, ...)
 {
 #if 0
va_list args;
@@ -405,7 +418,9 @@ incomplete(struct gl_texture_object *t, const char *fmt, 
...)
 
printf(Texture Obj %d incomplete because: %s\n, t-Name, s);
 #endif
-   t-_Complete = GL_FALSE;
+   if (bm == BASE)
+  t-_BaseComplete = GL_FALSE;
+   t-_MipmapComplete = GL_FALSE;
 }
 
 
@@ -429,18 +444,20 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
const struct gl_texture_image *baseImage;
GLint maxLog2 = 0, maxLevels = 0;
 
-   t-_Complete = GL_TRUE;  /* be optimistic */
+   /* We'll set these to FALSE if tests fail below */
+   t-_BaseComplete = GL_TRUE;
+   t-_MipmapComplete = GL_TRUE;
 
/* Detect cases where the application set the base level to an invalid
 * value.
 */
if ((baseLevel  0) || (baseLevel = MAX_TEXTURE_LEVELS)) {
-  incomplete(t, base level = %d is invalid, baseLevel);
+  incomplete(t, BASE, base level = %d is invalid, baseLevel);
   return;
}
 
if (t-MaxLevel  baseLevel) {
-  incomplete(t, MAX_LEVEL (%d)  BASE_LEVEL (%d),
+  incomplete(t, BASE, MAX_LEVEL (%d)  BASE_LEVEL (%d),
 t-MaxLevel, baseLevel);
   return;
}
@@ -449,7 +466,7 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
 
/* Always need the base level image */
if (!baseImage) {
-  incomplete(t, Image[baseLevel=%d] == NULL, baseLevel);
+  incomplete(t, BASE, Image[baseLevel=%d] == NULL, 

[Mesa-dev] [PATCH 09/13] mesa: use _mesa_dirty_texobj() function

2012-03-18 Thread Brian Paul
To mark the texture object as incomplete.
---
 src/mesa/main/teximage.c |   17 +
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index cf0a0cb..c541182 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -43,6 +43,7 @@
 #include state.h
 #include texcompress.h
 #include teximage.h
+#include texobj.h
 #include texstate.h
 #include texpal.h
 #include mtypes.h
@@ -2602,9 +2603,7 @@ teximage(struct gl_context *ctx, GLuint dims,
 
_mesa_update_fbo_texture(ctx, texObj, face, level);
 
-   /* state update */
-   texObj-_Complete = GL_FALSE;
-   ctx-NewState |= _NEW_TEXTURE;
+   _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
 }
 else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, glTexImage%uD, dims);
@@ -2702,9 +2701,7 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, 
GLeglImageOES image)
   ctx-Driver.EGLImageTargetTexture2D(ctx, target,
  texObj, texImage, image);
 
-  /* state update */
-  texObj-_Complete = GL_FALSE;
-  ctx-NewState |= _NEW_TEXTURE;
+  _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
_mesa_unlock_texture(ctx, texObj);
 
@@ -2965,9 +2962,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
 
 _mesa_update_fbo_texture(ctx, texObj, face, level);
 
-/* state update */
-texObj-_Complete = GL_FALSE;
-ctx-NewState |= _NEW_TEXTURE;
+_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
  }
  else {
 /* probably too large of image */
@@ -3598,9 +3593,7 @@ compressedteximage(struct gl_context *ctx, GLuint dims,
 
check_gen_mipmap(ctx, target, texObj, level);
 
-   /* state update */
-   texObj-_Complete = GL_FALSE;
-   ctx-NewState |= _NEW_TEXTURE;
+   _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
 }
 else {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 10/13] mesa: use _mesa_dirty_texobj() in glTexParameter code

2012-03-18 Thread Brian Paul
---
 src/mesa/main/texparam.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 9a2ec51..205f51f 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -41,6 +41,7 @@
 #include main/mtypes.h
 #include main/state.h
 #include main/texcompress.h
+#include main/texobj.h
 #include main/texparam.h
 #include main/teximage.h
 #include main/texstate.h
@@ -221,7 +222,7 @@ static inline void
 incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
-   texObj-_Complete = GL_FALSE;
+   _mesa_dirty_texobj(ctx, texObj, 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 11/13] mesa: add _mesa_is_mipmap_filter() helper

2012-03-18 Thread Brian Paul
---
 src/mesa/main/samplerobj.h |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h
index c22d025..0bfda43 100644
--- a/src/mesa/main/samplerobj.h
+++ b/src/mesa/main/samplerobj.h
@@ -37,6 +37,15 @@ _mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
   return ctx-Texture.Unit[unit]._Current-Sampler;
 }
 
+
+/** Does the given filter state do mipmap filtering? */
+static inline GLboolean
+_mesa_is_mipmap_filter(const struct gl_sampler_object *samp)
+{
+   return samp-MinFilter != GL_NEAREST  samp-MinFilter != GL_LINEAR;
+}
+
+
 extern void
 _mesa_reference_sampler_object_(struct gl_context *ctx,
 struct gl_sampler_object **ptr,
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 13/13] mesa: add integer texture completeness check

2012-03-18 Thread Brian Paul
Per the spec, only nearest filtering is supported for integer textures.
Otherwise, the texture is incomplete.
---
 src/mesa/main/mtypes.h |1 +
 src/mesa/main/texobj.c |6 ++
 src/mesa/main/texobj.h |8 
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c6e5b94..a3827d4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1318,6 +1318,7 @@ struct gl_texture_object
GLboolean GenerateMipmap;/** GL_SGIS_generate_mipmap */
GLboolean _BaseComplete; /** Is the base texture level valid? */
GLboolean _MipmapComplete;   /** Is the whole mipmap valid? */
+   GLboolean _IsIntegerFormat;  /** Does the texture store integer values? */
GLboolean _RenderToTexture;  /** Any rendering to this texture? */
GLboolean Purgeable; /** Is the buffer purgeable under memory 
pressure? */
GLboolean Immutable; /** GL_ARB_texture_storage */
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 5419cd3..2be95b0 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -478,6 +478,12 @@ _mesa_test_texobj_completeness( const struct gl_context 
*ctx,
   return;
}
 
+   /* Check if the texture values are integer */
+   {
+  GLenum datatype = _mesa_get_format_datatype(baseImage-TexFormat);
+  t-_IsIntegerFormat = datatype == GL_INT || datatype == GL_UNSIGNED_INT;
+   }
+
/* Compute _MaxLevel (the maximum mipmap level we'll sample from given the
 * mipmap image sizes and GL_TEXTURE_MAX_LEVEL state).
 */
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 850091e..c020b90 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -83,6 +83,14 @@ static inline GLboolean
 _mesa_is_texture_complete(const struct gl_texture_object *texObj,
   const struct gl_sampler_object *sampler)
 {
+   if (texObj-_IsIntegerFormat 
+   (sampler-MagFilter != GL_NEAREST ||
+(sampler-MinFilter != GL_NEAREST 
+ sampler-MinFilter != GL_NEAREST_MIPMAP_NEAREST))) {
+  /* If the format is integer, only nearest filtering is allowed */
+  return GL_FALSE;
+   }
+
if (_mesa_is_mipmap_filter(sampler))
   return texObj-_MipmapComplete;
else
-- 
1.7.3.4

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


Re: [Mesa-dev] unpack functions showing up highly in profiles

2012-03-18 Thread Henri Verbeet
On 18 March 2012 17:47, Matt Turner matts...@gmail.com wrote:
 SC2's call chain for unpack_uint_z_X8_Z24 is

 unpack_uint_z_X8_Z24
  - _mesa_unpack_uint_z_row
  - _mesa_readpixels
   - intelReadPixels
    - copy_tex_sub_image.isra.3
     - intelCopyTexSubImage2D
      - copyteximage
       - shared_dispatch_stub_324
        - surface_load_ds_location
         - drawPrimitive
          - wined3d_device_draw_indexed_primitive
           - IDirect3DDevice9Impl_DrawIndexedPrimitive
            - ??

That's copying depth data, maybe stencil too. IIRC that used to hit a
fallback on at least some Intel hardware, maybe it still does. The
code in question on the Wine side will eventually go away, but for the
moment you can try setting the
HKCU/Software/Wine/Direct3D/AlwaysOffscreen registry key to
enabled (you'll probably have to create it) and see if that makes it
any better. For the Gallium based drivers a similar issue was fixed by
d958202.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47478] New: [wine] Passing 0xffffffff as GLX_DRAWABLE_TYPE

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

 Bug #: 47478
   Summary: [wine] Passing 0x as GLX_DRAWABLE_TYPE
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: s...@whiz.se


Some OpenGL games running in Wine (such as the multiplayer part of Wolfenstein)
does not work with Mesa drivers. 

The problem is apparently that Mesa doesn't like Wine passing 0x as
GLX_DRAWABLE_TYPE. There's a longer explanation of the issue here:
http://bugs.winehq.org/show_bug.cgi?id=26763

I tried using apitrace to trace the game with fglrx but the resulting trace
runs with Mesa drivers so it can't be used to reproduce the 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


Re: [Mesa-dev] [PATCH 1/6] glx: Convert to automake.

2012-03-18 Thread Marek Olšák
On Tue, Mar 6, 2012 at 3:37 AM, Eric Anholt e...@anholt.net wrote:
 On Thu, 1 Mar 2012 19:18:50 +0100, Marek Olšák mar...@gmail.com wrote:
 On Thu, Mar 1, 2012 at 5:28 PM, Eric Anholt e...@anholt.net wrote:
  On Thu, 1 Mar 2012 16:50:40 +0100, Marek Olšák mar...@gmail.com wrote:
  Hi Eric,
 
  this commit breaks StarCraft II running on Wine traced by apitrace
  on r600g. Wine is most probably stuck in a deadlock. It prints these
  error messages:
 
  err:seh:setup_exception_record stack overflow 2412 bytes in thread
  0024 eip 00437fdb esp 00c409c4 stack 0xc4-0xc41000-0xd4
  err:ntdll:RtlpWaitForCriticalSection section 0x7dce41e0
  x11drv_main.c: X11DRV_CritSection wait timed out in thread 0025,
  blocked by 0024, retrying (60 sec)
  err:ntdll:RtlpWaitForCriticalSection section 0x72e200 ? wait timed
  out in thread 0023, blocked by 0024, retrying (60 sec)
  err:ntdll:RtlpWaitForCriticalSection section 0x72e200 ? wait timed
  out in thread 0009, blocked by 0024, retrying (60 sec)
  etc.
 
  Reverting this commit (and also the egl automake commits to avoid
  conflicts) fixes the issue.
 
  Do you have any idea about what might have gone wrong?
 
  Hmm, weird.  Defines were my first idea, the diff of all defines used in
  the compile is:
 [...]
 
  Could you stick a debugger on it and see where it's stopped, at least?

 Sorry, I haven't been able to obtain a useful backtrace from wine. I
 have no idea how to debug this.

 Just to be clear: Is the failure mode only when apitracing wine, and not
 when running wine standalone or when running glretrace of any resulting
 trace?

Sorry that I did not reply earlier.

The failure is only when apitracing wine.


 Does it require SC2, or can other apps be used to reproduce the failure?
 Any freely downloadable apps by chance?

It seems that all wine apps segfault or deadlock with Mesa master when
apitracing. It's always stack overflow. Surprisingly enough, they
don't segfault with the glx patch reverted.

Reverting the patch is not trivial without build and other failures.
Here's what I had to do:
http://cgit.freedesktop.org/~mareko/mesa/log/?h=revert-glx-automake

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


Re: [Mesa-dev] [PATCH 2/6] intel: Ask libdrm to dump an AUB file if INTEL_DEBUG=aub.

2012-03-18 Thread Yuanhan Liu
On Fri, Mar 16, 2012 at 04:26:42PM -0700, Eric Anholt wrote:
 It also asks for BMPs in the aub file at SwapBuffers time.
 ---
  src/mesa/drivers/dri/intel/intel_context.c |4 +++
  src/mesa/drivers/dri/intel/intel_context.h |1 +
  src/mesa/drivers/dri/intel/intel_screen.c  |   32 
 
  3 files changed, 37 insertions(+), 0 deletions(-)

Reviewed-by: Yuanhan Liu yuanhan@linux.intel.com

 
 diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
 b/src/mesa/drivers/dri/intel/intel_context.c
 index 7b2bdad..ff721fb 100644
 --- a/src/mesa/drivers/dri/intel/intel_context.c
 +++ b/src/mesa/drivers/dri/intel/intel_context.c
 @@ -477,6 +477,7 @@ static const struct dri_debug_control debug_control[] = {
 { urb,   DEBUG_URB },
 { vs,DEBUG_VS },
 { clip,  DEBUG_CLIP },
 +   { aub,   DEBUG_AUB },
 { NULL,0 }
  };
  
 @@ -754,6 +755,9 @@ intelInitContext(struct intel_context *intel,
 if (INTEL_DEBUG  DEBUG_BUFMGR)
dri_bufmgr_set_debug(intel-bufmgr, true);
  
 +   if (INTEL_DEBUG  DEBUG_AUB)
 +  drm_intel_bufmgr_gem_set_aub_dump(intel-bufmgr, true);
 +
 intel_batchbuffer_init(intel);
  
 intel_fbo_init(intel);
 diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
 b/src/mesa/drivers/dri/intel/intel_context.h
 index ef024b1..7b42009 100644
 --- a/src/mesa/drivers/dri/intel/intel_context.h
 +++ b/src/mesa/drivers/dri/intel/intel_context.h
 @@ -472,6 +472,7 @@ extern int INTEL_DEBUG;
  #define DEBUG_URB   0x80
  #define DEBUG_VS0x100
  #define DEBUG_CLIP  0x200
 +#define DEBUG_AUB   0x400
  
  #define DBG(...) do {\
   if (unlikely(INTEL_DEBUG  FILE_DEBUG_FLAG))\
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 48762d0..7939c4d 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -125,6 +125,38 @@ intelDRI2Flush(__DRIdrawable *drawable)
  
 if (intel-batch.used)
intel_batchbuffer_flush(intel);
 +
 +   if (INTEL_DEBUG  DEBUG_AUB) {
 +  struct gl_framebuffer *fb = ctx-DrawBuffer;
 +
 +  for (int i = 0; i  fb-_NumColorDrawBuffers; i++) {
 +  struct intel_renderbuffer *irb =
 + intel_renderbuffer(fb-_ColorDrawBuffers[i]);
 +
 +  if (irb  irb-mt) {
 + enum aub_dump_bmp_format format;
 +
 + switch (irb-Base.Base.Format) {
 + case MESA_FORMAT_ARGB:
 + case MESA_FORMAT_XRGB:
 +format = AUB_DUMP_BMP_FORMAT_ARGB_;
 +break;
 + default:
 +continue;
 + }
 +
 + drm_intel_gem_bo_aub_dump_bmp(irb-mt-region-bo,
 +   irb-draw_x,
 +   irb-draw_y,
 +   irb-Base.Base.Width,
 +   irb-Base.Base.Height,
 +   format,
 +   irb-mt-region-pitch *
 +   irb-mt-region-cpp,
 +   0);
 +  }
 +  }
 +   }
  }
  
  static const struct __DRI2flushExtensionRec intelFlushExtension = {
 -- 
 1.7.9.1
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/6] intel: Handle devid overrides using libdrm.

2012-03-18 Thread Yuanhan Liu
On Fri, Mar 16, 2012 at 04:26:43PM -0700, Eric Anholt wrote:
 ---
  src/mesa/drivers/dri/intel/intel_screen.c |   23 ---
  1 files changed, 4 insertions(+), 19 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 7939c4d..3f1ef87 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -624,8 +624,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
 __DRIscreen *spriv = intelScreen-driScrnPriv;
 int num_fences = 0;
  
 -   intelScreen-no_hw = (getenv(INTEL_NO_HW) != NULL ||
 -  getenv(INTEL_DEVID_OVERRIDE) != NULL);
 +   intelScreen-no_hw = getenv(INTEL_NO_HW) != NULL;

Seems that we are doing duplicate things here in Mesa and Libdrm-intel:
  mesa will bypass hardware rendering if INTEL_NO_HW env is set
  libdrm-intel also will bypass hardware rendering if INTEL_DEVID_OVERRIDE is 
set

They are doing the same thing, but by different env variable, is that
necessary?

  
 intelScreen-bufmgr = intel_bufmgr_gem_init(spriv-fd, BATCH_SZ);
 if (intelScreen-bufmgr == NULL) {
 @@ -736,7 +735,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 GLenum fb_format[3];
 GLenum fb_type[3];
 unsigned int api_mask;
 -   char *devid_override;
  
 static const GLenum back_buffer_modes[] = {
 GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
 @@ -758,20 +756,10 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 intelScreen-driScrnPriv = psp;
 psp-driverPrivate = (void *) intelScreen;
  
 -   /* Determine chipset ID */
 -   if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
 - intelScreen-deviceID))
 -  return false;
 +   if (!intel_init_bufmgr(intelScreen))
 +   return false;
  
 -   /* Allow an override of the device ID for the purpose of making the
 -* driver produce dumps for debugging of new chipset enablement.
 -* This implies INTEL_NO_HW, to avoid programming your actual GPU
 -* incorrectly.
 -*/
 -   devid_override = getenv(INTEL_DEVID_OVERRIDE);
 -   if (devid_override) {
 -  intelScreen-deviceID = strtod(devid_override, NULL);
 -   }
 +   intelScreen-deviceID = 
 drm_intel_bufmgr_gem_get_devid(intelScreen-bufmgr);
  
 intelScreen-kernel_has_gen7_sol_reset =
intel_get_boolean(intelScreen-driScrnPriv,
 @@ -818,9 +806,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 if (IS_9XX(intelScreen-deviceID) || IS_965(intelScreen-deviceID))
psp-api_mask = api_mask;
  
 -   if (!intel_init_bufmgr(intelScreen))
 -   return false;
 -
 intelScreen-hw_has_swizzling = intel_detect_swizzling(intelScreen);
  
 psp-extensions = intelScreenExtensions;
 -- 
 1.7.9.1
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] softpipe: set max cube texture size to 4Kx4K

2012-03-18 Thread Yuanhan Liu
On Sun, Mar 18, 2012 at 10:49:00AM -0600, Brian Paul wrote:
 The max size was 16Kx16K so a 4 byte/pixel, six-sided cube would require
 6 GBytes of memory.  If mipmapped, 8 GB.  Reduce the max size to 4K to
 make the total size more reasonable.
 
 Fixes a crash with the new piglit max-texture-size test.

Reviewed-by: Yuanhan Liu yuanhan@linux.intel.com
 ---
  src/gallium/drivers/softpipe/sp_limits.h |1 +
  src/gallium/drivers/softpipe/sp_screen.c |2 +-
  2 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/src/gallium/drivers/softpipe/sp_limits.h 
 b/src/gallium/drivers/softpipe/sp_limits.h
 index a7a24c9..ada5c0c 100644
 --- a/src/gallium/drivers/softpipe/sp_limits.h
 +++ b/src/gallium/drivers/softpipe/sp_limits.h
 @@ -32,6 +32,7 @@
  
  #define SP_MAX_TEXTURE_2D_LEVELS 15  /* 16K x 16K */
  #define SP_MAX_TEXTURE_3D_LEVELS 9   /* 512 x 512 x 512 */
 +#define SP_MAX_TEXTURE_CUBE_LEVELS 13  /* 4K x 4K */
  
  
  /** Max surface size */
 diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
 b/src/gallium/drivers/softpipe/sp_screen.c
 index c983ef5..183ed9a 100644
 --- a/src/gallium/drivers/softpipe/sp_screen.c
 +++ b/src/gallium/drivers/softpipe/sp_screen.c
 @@ -94,7 +94,7 @@ softpipe_get_param(struct pipe_screen *screen, enum 
 pipe_cap param)
 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return SP_MAX_TEXTURE_3D_LEVELS;
 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
 -  return SP_MAX_TEXTURE_2D_LEVELS;
 +  return SP_MAX_TEXTURE_CUBE_LEVELS;
 case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
 case PIPE_CAP_INDEP_BLEND_ENABLE:
 -- 
 1.7.3.4
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/6] glx: Convert to automake.

2012-03-18 Thread Matt Turner
On Mon, Mar 5, 2012 at 9:37 PM, Eric Anholt e...@anholt.net wrote:
 On Thu, 1 Mar 2012 19:18:50 +0100, Marek Olšák mar...@gmail.com wrote:
 On Thu, Mar 1, 2012 at 5:28 PM, Eric Anholt e...@anholt.net wrote:
  On Thu, 1 Mar 2012 16:50:40 +0100, Marek Olšák mar...@gmail.com wrote:
  Hi Eric,
 
  this commit breaks StarCraft II running on Wine traced by apitrace
  on r600g. Wine is most probably stuck in a deadlock. It prints these
  error messages:
 
  err:seh:setup_exception_record stack overflow 2412 bytes in thread
  0024 eip 00437fdb esp 00c409c4 stack 0xc4-0xc41000-0xd4
  err:ntdll:RtlpWaitForCriticalSection section 0x7dce41e0
  x11drv_main.c: X11DRV_CritSection wait timed out in thread 0025,
  blocked by 0024, retrying (60 sec)
  err:ntdll:RtlpWaitForCriticalSection section 0x72e200 ? wait timed
  out in thread 0023, blocked by 0024, retrying (60 sec)
  err:ntdll:RtlpWaitForCriticalSection section 0x72e200 ? wait timed
  out in thread 0009, blocked by 0024, retrying (60 sec)
  etc.
 
  Reverting this commit (and also the egl automake commits to avoid
  conflicts) fixes the issue.
 
  Do you have any idea about what might have gone wrong?
 
  Hmm, weird.  Defines were my first idea, the diff of all defines used in
  the compile is:
 [...]
 
  Could you stick a debugger on it and see where it's stopped, at least?

 Sorry, I haven't been able to obtain a useful backtrace from wine. I
 have no idea how to debug this.

 Just to be clear: Is the failure mode only when apitracing wine, and not
 when running wine standalone or when running glretrace of any resulting
 trace?

 Does it require SC2, or can other apps be used to reproduce the failure?
 Any freely downloadable apps by chance?

 (That said, wine appears to be totally hosed for me currently, on 8.0 or
 master, with a segfault almost all the time due to a missing buffer
 object for one of my winsys renderbuffers)

In the process of trying to figure out why SC2 was so slow today, I
hit a GPU hang, so I tried apitracing it and hit this problem.

I reverted automaking glx and was able to trace it. I tried to replay
the trace (this time with a 64-bit apitrace and i965_dri.so, which
crashed). I rebuilt 64-bit Mesa with automake glx reverted and sure
enough it worked, so I've got a trace that works before and fails
after. Hopefully it'll point to the problem of SC2 hanging under
WINE/apitrace.

I'll figure out how to trim it (it's 5.4GB now) and send it to you.

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


Re: [Mesa-dev] [PATCH 1/6] glx: Convert to automake.

2012-03-18 Thread Matt Turner
On Sun, Mar 18, 2012 at 10:17 PM, Matt Turner matts...@gmail.com wrote:
 On Mon, Mar 5, 2012 at 9:37 PM, Eric Anholt e...@anholt.net wrote:
 On Thu, 1 Mar 2012 19:18:50 +0100, Marek Olšák mar...@gmail.com wrote:
 On Thu, Mar 1, 2012 at 5:28 PM, Eric Anholt e...@anholt.net wrote:
  On Thu, 1 Mar 2012 16:50:40 +0100, Marek Olšák mar...@gmail.com wrote:
  Hi Eric,
 
  this commit breaks StarCraft II running on Wine traced by apitrace
  on r600g. Wine is most probably stuck in a deadlock. It prints these
  error messages:
 
  err:seh:setup_exception_record stack overflow 2412 bytes in thread
  0024 eip 00437fdb esp 00c409c4 stack 0xc4-0xc41000-0xd4
  err:ntdll:RtlpWaitForCriticalSection section 0x7dce41e0
  x11drv_main.c: X11DRV_CritSection wait timed out in thread 0025,
  blocked by 0024, retrying (60 sec)
  err:ntdll:RtlpWaitForCriticalSection section 0x72e200 ? wait timed
  out in thread 0023, blocked by 0024, retrying (60 sec)
  err:ntdll:RtlpWaitForCriticalSection section 0x72e200 ? wait timed
  out in thread 0009, blocked by 0024, retrying (60 sec)
  etc.
 
  Reverting this commit (and also the egl automake commits to avoid
  conflicts) fixes the issue.
 
  Do you have any idea about what might have gone wrong?
 
  Hmm, weird.  Defines were my first idea, the diff of all defines used in
  the compile is:
 [...]
 
  Could you stick a debugger on it and see where it's stopped, at least?

 Sorry, I haven't been able to obtain a useful backtrace from wine. I
 have no idea how to debug this.

 Just to be clear: Is the failure mode only when apitracing wine, and not
 when running wine standalone or when running glretrace of any resulting
 trace?

 Does it require SC2, or can other apps be used to reproduce the failure?
 Any freely downloadable apps by chance?

 (That said, wine appears to be totally hosed for me currently, on 8.0 or
 master, with a segfault almost all the time due to a missing buffer
 object for one of my winsys renderbuffers)

 In the process of trying to figure out why SC2 was so slow today, I
 hit a GPU hang, so I tried apitracing it and hit this problem.

 I reverted automaking glx and was able to trace it. I tried to replay
 the trace (this time with a 64-bit apitrace and i965_dri.so, which
 crashed). I rebuilt 64-bit Mesa with automake glx reverted and sure
 enough it worked, so I've got a trace that works before and fails
 after. Hopefully it'll point to the problem of SC2 hanging under
 WINE/apitrace.

 I'll figure out how to trim it (it's 5.4GB now) and send it to you.

 Matt

Or maybe it was just a bug in apitrace. I cannot reproduce it now.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev