Re: [Mesa-dev] [PATCH RFC] gallium: interface changes necessary to implement transform feedback

2011-10-07 Thread Christoph Bumiller
On 07.10.2011 04:04, Marek Olšák wrote:
 On Fri, Oct 7, 2011 at 3:21 AM, Zack Rusin za...@vmware.com wrote:
 On Thursday, October 06, 2011 04:58:45 PM Marek Olšák wrote:
 I am cc'ing Zack, because he was the one to design the first interface.
 Hi Marek.

 I'm swamped right now and won't have time to review the patches. FWIW, the
 interface initially did have the stream output data in the shader state,
 ultimately though Keith and I just didn't like it. I don't quite remember 
 what
 the issue was. Also I noticed you removed draw stream output auto, which 
 seems
 useful interface wise because it allows rendering without needing to know the
 amount of data that was written to the buffers.
 The draw auto functionality was moved to pipe_draw_info.

 Ultimately though I think this is a perfect feature to implement in a feature
 branch. Interface changes just for the purpose of interface changes always
 endup badly. We've been huge offenders in the past because we were working on
 proprietary state trackers but we shouldn't go that road again and we should
 require that interface changes always go along an implementation.
 It just makes it a lot easier to see how everything fits together.
 That's exactly my plan. It won't a Mesa branch though -- I like to
 rebase and modify commits all the time.

 more concerned about the queries. There is PIPE_QUERY_GPU_FINISHED,
 which looks equivalent to fences. Besides that,
 PIPE_QUERY_PRIMITIVES_EMITTED is a strict subset of
 PIPE_QUERY_SO_STATISTICS, which returns a structure instead of one
 number.
 Yes, the primitives emitted should go and so statistics should stay as it is.
 The d3d query model is nicer than the GL one, so I'd strongly suggest to
 follow it.
 http://msdn.microsoft.com/en-us/library/windows/desktop/bb205335(v=vs.85).aspx
 I agree with the so queries, but I'd like to keep fences and not
 GPU_FINISHED. The fences seem more natural to how it's done under the
 hood. Both can be implemented easily though.

Could we please keep GPU_FINISHED, it coincides with the D3D EVENT query
(it doesn't require a call to begin_query, only to end).

And no it's not more natural to how it's done by hardware, nv50+ fences
are also just queries.
(https://github.com/chrisbmr/Mesa-3D/blob/d3d1x/src/gallium/drivers/nvc0/nvc0_query.c#L309)

Thanks.

 Marek
 ___
 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


[Mesa-dev] [PATCH] mesa: fix software mipmap generation code for packed Z/stencil formats

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=32458
---
 src/mesa/main/formats.c |8 
 src/mesa/main/mipmap.c  |   38 +-
 2 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 02b2028..6307f8e 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -2075,13 +2075,13 @@ _mesa_format_to_type_and_comps(gl_format format,
   return;
 
case MESA_FORMAT_Z24_S8:
-  *datatype = GL_UNSIGNED_INT;
-  *comps = 1; /* XXX OK? */
+  *datatype = GL_UNSIGNED_INT_24_8_MESA;
+  *comps = 2;
   return;
 
case MESA_FORMAT_S8_Z24:
-  *datatype = GL_UNSIGNED_INT;
-  *comps = 1; /* XXX OK? */
+  *datatype = GL_UNSIGNED_INT_8_24_REV_MESA;
+  *comps = 2;
   return;
 
case MESA_FORMAT_Z16:
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index f04a98b..46d71bb 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -43,7 +43,13 @@
 static GLint
 bytes_per_pixel(GLenum datatype, GLuint comps)
 {
-   GLint b = _mesa_sizeof_packed_type(datatype);
+   GLint b;
+
+   if (datatype == GL_UNSIGNED_INT_8_24_REV_MESA ||
+   datatype == GL_UNSIGNED_INT_24_8_MESA)
+  return 4;
+
+   b = _mesa_sizeof_packed_type(datatype);
assert(b = 0);
 
if (_mesa_type_is_packed(datatype))
@@ -717,6 +723,36 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
   }
}
 
+   else if (datatype == GL_UNSIGNED_INT_24_8_MESA  comps == 2) {
+  GLuint i, j, k;
+  const GLuint *rowA = (const GLuint *) srcRowA;
+  const GLuint *rowB = (const GLuint *) srcRowB;
+  GLuint *dst = (GLuint *) dstRow;
+  /* note: averaging stencil values seems weird, but what else? */
+  for (i = j = 0, k = k0; i  (GLuint) dstWidth;
+   i++, j += colStride, k += colStride) {
+ GLuint z = (((rowA[j]  8) + (rowA[k]  8) +
+  (rowB[j]  8) + (rowB[k]  8)) / 4)  8;
+ GLuint s = ((rowA[j]  0xff) + (rowA[k]  0xff) +
+ (rowB[j]  0xff) + (rowB[k]  0xff)) / 4;
+ dst[i] = z | s;
+  }
+   }
+   else if (datatype == GL_UNSIGNED_INT_8_24_REV_MESA  comps == 2) {
+  GLuint i, j, k;
+  const GLuint *rowA = (const GLuint *) srcRowA;
+  const GLuint *rowB = (const GLuint *) srcRowB;
+  GLuint *dst = (GLuint *) dstRow;
+  for (i = j = 0, k = k0; i  (GLuint) dstWidth;
+   i++, j += colStride, k += colStride) {
+ GLuint z = ((rowA[j]  0xff) + (rowA[k]  0xff) +
+ (rowB[j]  0xff) + (rowB[k]  0xff)) / 4;
+ GLuint s = (((rowA[j]  24) + (rowA[k]  24) +
+  (rowB[j]  24) + (rowB[k]  24)) / 4)  24;
+ dst[i] = z | s;
+  }
+   }
+
else {
   _mesa_problem(NULL, bad format in do_row());
}
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 1/5] intel: silence uninitialized var warning

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

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

diff --git a/src/mesa/drivers/dri/intel/intel_decode.c 
b/src/mesa/drivers/dri/intel/intel_decode.c
index ac8d690..b4de42d 100644
--- a/src/mesa/drivers/dri/intel/intel_decode.c
+++ b/src/mesa/drivers/dri/intel/intel_decode.c
@@ -881,7 +881,7 @@ decode_3d_1d(uint32_t *data, int count,
 int *failures)
 {
 unsigned int len, i, c, idx, word, map, sampler, instr;
-char *format, *zformat, *type;
+char *format = , *zformat, *type;
 uint32_t opcode;
 
 struct {
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/5] i965: silence unused var warnings in non-debug builds

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

---
 src/mesa/drivers/dri/i965/brw_fs.cpp |1 +
 src/mesa/drivers/dri/i965/brw_wm.c   |1 +
 2 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 2000180..e073eaa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1773,6 +1773,7 @@ fs_visitor::run()
 
   /* Make sure we didn't try to sneak in an extra uniform */
   assert(orig_nr_params == c-prog_data.nr_params);
+  (void) orig_nr_params;
}
 
return !failed;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c 
b/src/mesa/drivers/dri/i965/brw_wm.c
index f746b31..fdb2d15 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -467,6 +467,7 @@ static void brw_prepare_wm_prog(struct brw_context *brw)
 brw-wm.prog_offset, brw-wm.prog_data)) {
   bool success = do_wm_prog(brw, ctx-Shader.CurrentFragmentProgram, fp,
key);
+  (void) success;
   assert(success);
}
 }
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 3/5] i915: silence unused var warnings in non-debug builds

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

---
 src/mesa/drivers/dri/i915/i830_vtbl.c |2 ++
 src/mesa/drivers/dri/i915/i915_vtbl.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 7810f56..d8f9634 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -717,6 +717,8 @@ i830_update_draw_buffer(struct intel_context *intel)
struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
 
+   (void) fb_has_hiz;
+
if (!fb) {
   /* this can happen during the initial context initialization */
   return;
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 1e84c6d..f4d8dff 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -717,6 +717,8 @@ i915_update_draw_buffer(struct intel_context *intel)
struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
 
+   (void) fb_has_hiz;
+
if (!fb) {
   /* this can happen during the initial context initialization */
   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 4/5] i965: make size_swizzles[] static const

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

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

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 5f44268..1caf1a6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -50,7 +50,7 @@ class dst_reg;
 static int
 swizzle_for_size(int size)
 {
-   int size_swizzles[4] = {
+   static const int size_swizzles[4] = {
   BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X),
   BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y),
   BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z),
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 5/5] i965: make swizzle_for_size() return unsigned

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

Silences a warning about comparing to an unsigned variable.  It looks like
the result of swizzle_for_size() is always assigned to unsigned vars.
---
 src/mesa/drivers/dri/i965/brw_vec4.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 1caf1a6..eae841c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -47,10 +47,10 @@ class dst_reg;
  * channels, as that will tell optimization passes that those other
  * channels are used.
  */
-static int
+static unsigned
 swizzle_for_size(int size)
 {
-   static const int size_swizzles[4] = {
+   static const unsigned size_swizzles[4] = {
   BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X),
   BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y),
   BRW_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z),
-- 
1.7.3.4

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


Re: [Mesa-dev] Mesa 7.11 and osmesa

2011-10-07 Thread Paul Gotzel
Brain,

I'm using osmesa with VTK and in this particular test I'm rendering
just lines.  The ratios stay the same for just triangles.  Just for
these simple primitives 7.11 seems to be about 4 times slower that
7.6.1.

Can you give me some pointers on where to get started with a new
gallium based osmesa interface? I'd certainly like to make a stab at
developing this capability.  This is something that would be quite
valuable for my purposes as well.

Regards,
Paul

On Thu, Oct 6, 2011 at 10:27 AM, Brian Paul bri...@vmware.com wrote:
 On 10/04/2011 01:22 PM, Paul Gotzel wrote:

 Hello,

 I've recently upgraded to mesa 7.11 and I've noticed significant
 performance degradation when using osmesa.  Here's my results when
 comparing the versions:

 Version       Time
 7.6.1            4s
 7.10.3          16s
 7.11             23s

 This is the time to render a single frame (including the initial
 program overhead).   Any thoughts?


 I don't have time to investigate this in any depth.  One thing that comes to
 mind is the software texturing code.  Most of the ubyte-based texture
 sampling code was replaced by floating point so if you're doing a lot of
 texture mapping, that could be a reason.

 To learn more, someone would have to do a bisection.

 What kind of rendering featurs are you using (plain shaded tris, texturing,
 shaders, etc)?


 I'm not using the gallium
 framework.  Would enabling gallium help in some way?

 LLVMpipe would almost certainly be a lot faster.  I've been meaning to write
 a new OSMesa interface for gallium but haven't found the time. That would be
 a valuable project for at least a few people.

 -Brian


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


[Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

This fixes a bug where we'd wind up emitting an invalid instruction like
MOVE R[0]., R[1];  - note the empty/zero writemask.  If we don't write to
any dest register channels, cull the instruction.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index d8ef8a3..44b1149 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3776,8 +3776,14 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
  iter.remove();
  delete inst;
  removed++;
-  } else
+  } else {
  inst-dst.writemask = ~(inst-dead_mask);
+ if (inst-dst.writemask == 0) {
+iter.remove();
+delete inst;
+removed++;
+ }
+  }
}
 
ralloc_free(write_level);
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH] mesa: fix software mipmap generation code for packed Z/stencil formats

2011-10-07 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/07/2011 07:21 AM, Brian Paul wrote:
 From: Brian Paul bri...@vmware.com
 
 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=32458
 ---
  src/mesa/main/formats.c |8 
  src/mesa/main/mipmap.c  |   38 +-
  2 files changed, 41 insertions(+), 5 deletions(-)

The arithmetic looks good to me.
Reviewed-by: Chad Versace c...@chad-versace.us

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOjx8PAAoJEAIvNt057x8iWKYQAIoEkWtDRR3Jo6ncQndSwFYZ
L2jTqSFViCh1jmRZjdnX9F0S1TYNMdqPo8lxL0JkUcbzHPzIBnrKqlOfJ+qg3pJx
qTJkQhrcN3aHErMNyuNgI1Zq7Ue2iDzWYwitj7lLl9fJDf04qFLm1m0nsR6PW2V7
IH5wWm9o0F1jJ8SBixiR9i5yeXJZgj+dORCIcfKrl7E4tGI1KGLlzwIrUrUaJeGz
hZwOLRBIqI4iLXrOzS0up8dEiotEZK4nx3cifTQAKkL+EEYmKPiq4uQzkAFOr1Ad
VEQBM+F9TbaFT0hcUjHPMbjHqIvsp9meT/m86CDxH5H4AfSvDVPA6rixA21G1aA4
c1YmISqZ+moSmNCxNvhDZGbDeztfsyPikPYV2km8w1IbUlFBg5HABADmJPGj49+D
GMAqpsmIGVNuetR3pKaWcC3lfiOEFlGfhWMk1I54Xa55i570hjIzLz1aeA9eiX+w
1CnFsZctp4ZMgrpoW3073QgIpx2IE+EfacBNq6r6P8FXSQg2H+7hHmDaRgB9iEGx
9beSgyxTjcDqW5xyWT4NGsSqhM4PJqn/fUnbV24uPiR8tAfNTVmY+ce10OG3+74w
Qo2ba5wUMigK+EtyNmhN2zirTfry5ROd/zoOJmpZQomDpuj/Id+QKHyVVsejlQiw
upjpLt21JBboDi0Uqcw6
=sWqy
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 7.11 and osmesa

2011-10-07 Thread Kevin H. Hobbs
On 10/07/2011 10:53 AM, Paul Gotzel wrote:
 Brain,
 
 I'm using osmesa with VTK and in this particular test I'm rendering
 just lines.  The ratios stay the same for just triangles.  Just for
 these simple primitives 7.11 seems to be about 4 times slower that
 7.6.1.

These builds on the VTK dashboard use a nightly build of OSMesa from git :

http://www.cdash.org/CDash/index.php?project=VTKfiltercount=1showfilters=1field1=buildname/stringcompare1=63value1=OSMesa

If there is a particularly relevant test the timing data might show the
change.



signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] i915: silence unused var warnings in non-debug builds

2011-10-07 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/07/2011 07:30 AM, Brian Paul wrote:
 From: Brian Paul bri...@vmware.com
 
 ---
  src/mesa/drivers/dri/i915/i830_vtbl.c |2 ++
  src/mesa/drivers/dri/i915/i915_vtbl.c |2 ++
  2 files changed, 4 insertions(+), 0 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
 b/src/mesa/drivers/dri/i915/i830_vtbl.c
 index 7810f56..d8f9634 100644
 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c
 +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
 @@ -717,6 +717,8 @@ i830_update_draw_buffer(struct intel_context *intel)
 struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
 bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
  
 +   (void) fb_has_hiz;
 +
 if (!fb) {
/* this can happen during the initial context initialization */
return;
 diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
 b/src/mesa/drivers/dri/i915/i915_vtbl.c
 index 1e84c6d..f4d8dff 100644
 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c
 +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
 @@ -717,6 +717,8 @@ i915_update_draw_buffer(struct intel_context *intel)
 struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
 bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
  
 +   (void) fb_has_hiz;
 +
 if (!fb) {
/* this can happen during the initial context initialization */
return;

Since fb_has_hiz is never used in these functions, the variable shouldn't be
declared and the call to intel_framebuffer_has_hiz just wastes CPU time.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOjye8AAoJEAIvNt057x8iUV0P/2f5gblrqnroWHABWjWtpDJI
SDx6SwKdX5kI5w4TfG13cq1FQntZLoPzT2BBnoLhvFiTceLTGrnwgyDbngoTaDWh
x9mPSkA3yLYVB4LaSSs/BnNPm/HLh6gXkU6Q8FwfTOvvlzSsOTsMhvUuhj6MY3Au
4iewlY6DmWzsg0B1e5p89vJSBWdjOcGrsb7DYrgT1UH4YHp5NA06XmFt6nhK4HPX
TjjKyNTs+VqLUTK91EPiL9vGCceK548LXfZyF9J9yBw4AqQKChLRMc7o3o5EXv0m
sUcbJyWd+PHdRKFRMzvktggtTsUXdRBGSwZK/wVwrKD3mvH3+vVZ7oGP9HJxdYVE
zPYeYWBPCrnSX3goULtiZWRpsKWkLPJUCkxV6m68U9Ur0bfxXZLlVE1sexSDNxOK
C0Sw/M7FSOkvcoiTGVbrTRM22tACZtR2/VLB1HFOBY13w9rzApm3JTALomKuTtWR
TUJ2l8brpklsGofuapCSu7ZRS8S/KbiFK4nvGrUdKshVdfMmaw7ejeLJk/X0Sle1
6LQdUTOwwKf1EGWusAhzTpQ7TrqfAaWgQjd38tdCFEWCie5Ifzdh4vp8O4hmOO18
iLT67Q9fB2qFleEvgVyhJoZSurrwXiA3j0zWRdmmChfFGUk3keS4iREHO3nV0DZV
1mNZ8pC9PCqoeXN7BlP3
=svVy
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i915: remove unused fb_has_hiz vars only used in assertions

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com

This previously generated unused variable warnings in non-debug builds.
---
 src/mesa/drivers/dri/i915/i830_vtbl.c |3 +--
 src/mesa/drivers/dri/i915/i915_vtbl.c |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 7810f56..6ea0e6f 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -715,7 +715,6 @@ i830_update_draw_buffer(struct intel_context *intel)
struct gl_framebuffer *fb = ctx-DrawBuffer;
struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL;
struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
-   bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
 
if (!fb) {
   /* this can happen during the initial context initialization */
@@ -792,7 +791,7 @@ i830_update_draw_buffer(struct intel_context *intel)
 
/* Check for depth fallback. */
if (irbDepth  irbDepth-region) {
-  assert(!fb_has_hiz || irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
+  assert(irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
   FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_FALSE);
   depthRegion = irbDepth-region;
} else if (irbDepth  !irbDepth-region) {
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 1e84c6d..f56aade 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -715,7 +715,6 @@ i915_update_draw_buffer(struct intel_context *intel)
struct gl_framebuffer *fb = ctx-DrawBuffer;
struct intel_region *colorRegion = NULL, *depthRegion = NULL;
struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
-   bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
 
if (!fb) {
   /* this can happen during the initial context initialization */
@@ -762,7 +761,7 @@ i915_update_draw_buffer(struct intel_context *intel)
 
/* Check for depth fallback. */
if (irbDepth  irbDepth-region) {
-  assert(!fb_has_hiz || irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
+  assert(irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
   FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_FALSE);
   depthRegion = irbDepth-region;
} else if (irbDepth  !irbDepth-region) {
-- 
1.7.3.4

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


Re: [Mesa-dev] Mesa 7.11 and osmesa

2011-10-07 Thread Kevin H. Hobbs
On 10/07/2011 12:10 PM, Kevin H. Hobbs wrote:
 On 10/07/2011 10:53 AM, Paul Gotzel wrote:
 Brain,

 I'm using osmesa with VTK and in this particular test I'm rendering
 just lines.  The ratios stay the same for just triangles.  Just for
 these simple primitives 7.11 seems to be about 4 times slower that
 7.6.1.
 
 These builds on the VTK dashboard use a nightly build of OSMesa from git :
 
 http://www.cdash.org/CDash/index.php?project=VTKfiltercount=1showfilters=1field1=buildname/stringcompare1=63value1=OSMesa
 
 If there is a particularly relevant test the timing data might show the
 change.
 

In particular I see what might be a timing increase around in late July
here :


http://www.cdash.org/CDash/testDetails.php?test=118152795build=1601123

and :

http://www.cdash.org/CDash/testDetails.php?test=118152797build=1601123

Although I don't know how much actual line rendering is in these tests.



signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 41441] Crashes introduced in f7f678331d5e95d2266fe6b3ea1cfa47d6421065

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

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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #3 from Brian Paul brian.e.p...@gmail.com 2011-10-07 10:00:36 PDT 
---
Fixed with commit 793d29d6d3fd0df72aabe4648bf6814ec2d4aecd

-- 
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] i915: remove unused fb_has_hiz vars only used in assertions

2011-10-07 Thread Brian Paul

No problem, Chad.  I'll let you take care of it completely.

I usually run debug builds but some (useful) warnings only pop up in 
optimized builds so I was just trying to clean those up.  Maybe you 
can make an optimized build when you're done to check for warnings. 
Thanks.


-Brian

On 10/07/2011 11:04 AM, Chad Versace wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Brian,

I'm sorry to trouble you about this patch again. These assertions are for
non-obvious assumptions in the Intel drivers that come into play
only when an experimental hardware feature (HiZ) is enabled. I'd like to
comb the i915 driver later today and clean up the HiZ-related assertions there.

So, I give my r-b to the first patch :). And I'll kill the call to
intel_framebuffer_has_hiz later today, if that's ok with you.

- --
Chad Versace
c...@chad-versace.us

On 10/07/2011 09:41 AM, Brian Paul wrote:

From: Brian Paulbri...@vmware.com

This previously generated unused variable warnings in non-debug builds.
---
  src/mesa/drivers/dri/i915/i830_vtbl.c |3 +--
  src/mesa/drivers/dri/i915/i915_vtbl.c |3 +--
  2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 7810f56..6ea0e6f 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -715,7 +715,6 @@ i830_update_draw_buffer(struct intel_context *intel)
 struct gl_framebuffer *fb = ctx-DrawBuffer;
 struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL;
 struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
-   bool fb_has_hiz = intel_framebuffer_has_hiz(fb);

 if (!fb) {
/* this can happen during the initial context initialization */
@@ -792,7 +791,7 @@ i830_update_draw_buffer(struct intel_context *intel)

 /* Check for depth fallback. */
 if (irbDepth  irbDepth-region) {
-  assert(!fb_has_hiz || irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
+  assert(irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_FALSE);
depthRegion = irbDepth-region;
 } else if (irbDepth  !irbDepth-region) {
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 1e84c6d..f56aade 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -715,7 +715,6 @@ i915_update_draw_buffer(struct intel_context *intel)
 struct gl_framebuffer *fb = ctx-DrawBuffer;
 struct intel_region *colorRegion = NULL, *depthRegion = NULL;
 struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
-   bool fb_has_hiz = intel_framebuffer_has_hiz(fb);

 if (!fb) {
/* this can happen during the initial context initialization */
@@ -762,7 +761,7 @@ i915_update_draw_buffer(struct intel_context *intel)

 /* Check for depth fallback. */
 if (irbDepth  irbDepth-region) {
-  assert(!fb_has_hiz || irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
+  assert(irbDepth-Base.Format != MESA_FORMAT_S8_Z24);
FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_FALSE);
depthRegion = irbDepth-region;
 } else if (irbDepth  !irbDepth-region) {

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

iQIcBAEBAgAGBQJOjzECAAoJEAIvNt057x8ib54P/34V0iK924Md7hakgxNWigCs
uBoCAGDKVdXcW/2rxL3nm1sWBnoUwco9XoDWyCZWqxn8XmtVa5o0MVr/q8cpFE/b
zVqJwuu0gh2JSf3XkuQnOcGKenkQj8B/EhvHoBLqnaJWKtEiXESPfh6LHvZlIqdP
oOoavJacx42EkJ2Tvl9pU9pHk33KcNItyxAtSJ6/fRUhvWkIJmml3xXpf356NSr+
2ubXitRf+ytRXe28O48Bk5BBZNjnR5n8v3T/iLX3izqpZYHwb4awwx/muorygpe9
QDSkxyBDdkX+7Du3kGkB9I07dOC4qd39Oe/KfMUNy/MTJd/Ae9bpw0Y8pCS7voCN
ezmDVYaY18h4ojZ3Xp2q+uvXmef43VSjQLEShVgoSxAyMuk8ZyAt4C4bexuEKOl/
CPCTdmr3oP0KLNChQgFnGhswJ02Qn9ji0ebjZ8pHr4YOXGHe7oYa5YSzF0HyZVbS
3uATZbzyouYzaagSJssFdnKSeIH8pFWF8P5lU9InpNfDD1bIyZWZXay5sSseBxVD
lKvZe2eZ9vI5g7HEdNNe2FaKSyoUEeVgklpSeSX1gwfTDkzNeeAUiyKONW7lbtUq
mEeicEBXUtFG93QywAxzrmwXR+/S06Cep/B1IknuOOj48qHRQfw/QEKrHtjJ4AnG
MFpqXmJcwYLiHu6xQvsh
=2WLL
-END PGP SIGNATURE-
___
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


[Mesa-dev] mesa/gallium: integer support

2011-10-07 Thread Dave Airlie
These are 5 more patches in the integer support set, the first just
adds a pack int routine, the second fixes up the texture format picking.
The 3rd adds all the gallium formats I've needed so far, we may require
R8G8B8X8 formats as well, I need to write more tests. The last two
patches add state tracker support for integer texture format picking
and to the readpixels path.

Dave.

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


[Mesa-dev] [PATCH 2/5] mesa/texformat: add integer fallbacks to other formats

2011-10-07 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This fixes up the integer format choosing to pick the closest mesa format
then the most likely fallback.

(the formatting in this file needs cleaning in another patch).

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/mesa/main/texformat.c |  204 +
 1 files changed, 131 insertions(+), 73 deletions(-)

diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index ccc3c49..7f262d6 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -591,86 +591,144 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint 
internalFormat,
 
if (ctx-Extensions.EXT_texture_integer) {
   switch (internalFormat) {
-  case GL_RGBA32UI_EXT:
-  case GL_RGB32UI_EXT:
-  case GL_ALPHA32UI_EXT:
-  case GL_INTENSITY32UI_EXT:
-  case GL_LUMINANCE32UI_EXT:
-  case GL_LUMINANCE_ALPHA32UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
-break;
-  case GL_RGBA16UI_EXT:
-  case GL_RGB16UI_EXT:
+  case GL_ALPHA8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
   case GL_ALPHA16UI_EXT:
-  case GL_INTENSITY16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+  case GL_ALPHA32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+  case GL_ALPHA8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+  case GL_ALPHA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+  case GL_ALPHA32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+  case GL_LUMINANCE8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
   case GL_LUMINANCE16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+  case GL_LUMINANCE32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+  case GL_LUMINANCE8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+  case GL_LUMINANCE16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+  case GL_LUMINANCE32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+  case GL_LUMINANCE_ALPHA8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
   case GL_LUMINANCE_ALPHA16UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
-break;
-  case GL_RGBA8UI_EXT:
-  case GL_RGB8UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
-break;
-  case GL_ALPHA8UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8);
-break;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+  case GL_LUMINANCE_ALPHA32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+  case GL_LUMINANCE_ALPHA8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+  case GL_LUMINANCE_ALPHA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+  case GL_LUMINANCE_ALPHA32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
   case GL_INTENSITY8UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT8);
-break;
-  case GL_LUMINANCE8UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8);
-break;
-  case GL_LUMINANCE_ALPHA8UI_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8);
-break;
-  case GL_RGBA32I_EXT:
-  case GL_RGB32I_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
-break;
-  case GL_ALPHA32I_EXT:
-RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32);
-break;
+ 

[Mesa-dev] [PATCH 3/5] gallium: add initial pure integer support (v2)

2011-10-07 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This add support for unsigned/signed integer types via adding a 'pure' bit
in the format description table. It adds 4 new u_format get/put hooks,
for get/put uint and get/put sint so that accessors can get native access
to the integer bits. This is used to avoid precision loss via float converting
paths.

It doesn't add any float fetchers for these types at the moment, GL doesn't
require float fetching from these types and I expect we'll introduce a lot
of hidden bugs if we start allowing such conversions without an API mandating
it.

It adds all formats from EXT_texture_integer and EXT_texture_rg.

0 regressions on llvmpipe here with this.

(there is some more follow on code in my gallium-int-work branch, bringing
 softpipe and mesa to a pretty integer clean state)

v2: fixup python generator to get signed-unsigned and unsigned-signed
fetches working.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/gallium/auxiliary/util/u_format.c|  139 ++
 src/gallium/auxiliary/util/u_format.csv  |   61 +++
 src/gallium/auxiliary/util/u_format.h|   66 -
 src/gallium/auxiliary/util/u_format_pack.py  |   70 +++--
 src/gallium/auxiliary/util/u_format_parse.py |   18 +++-
 src/gallium/auxiliary/util/u_format_table.py |   23 -
 src/gallium/auxiliary/util/u_tile.c  |  138 +
 src/gallium/auxiliary/util/u_tile.h  |   39 +++
 src/gallium/drivers/llvmpipe/lp_tile_soa.py  |2 +-
 src/gallium/include/pipe/p_format.h  |   59 +++
 10 files changed, 595 insertions(+), 20 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.c 
b/src/gallium/auxiliary/util/u_format.c
index 9bf4258..045cf94 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -124,6 +124,62 @@ util_format_is_luminance(enum pipe_format format)
return FALSE;
 }
 
+boolean
+util_format_is_pure_integer(enum pipe_format format)
+{
+   const struct util_format_description *desc = 
util_format_description(format);
+   int i;
+   /* Find the first non-void channel. */
+   for (i = 0; i  4; i++) {
+  if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+  }
+   }
+
+   if (i == 4) {
+  return FALSE;
+   }
+
+   return desc-channel[i].pure_integer ? TRUE : FALSE;
+}
+
+boolean
+util_format_is_pure_sint(enum pipe_format format)
+{
+   const struct util_format_description *desc = 
util_format_description(format);
+   int i;
+   /* Find the first non-void channel. */
+   for (i = 0; i  4; i++) {
+  if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+  }
+   }
+
+   if (i == 4) {
+  return FALSE;
+   }
+
+   return (desc-channel[i].type == UTIL_FORMAT_TYPE_SIGNED  
desc-channel[i].pure_integer) ? TRUE : FALSE;
+}
+
+boolean
+util_format_is_pure_uint(enum pipe_format format)
+{
+   const struct util_format_description *desc = 
util_format_description(format);
+   int i;
+   /* Find the first non-void channel. */
+   for (i = 0; i  4; i++) {
+  if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+  }
+   }
+
+   if (i == 4) {
+  return FALSE;
+   }
+
+   return (desc-channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED  
desc-channel[i].pure_integer) ? TRUE : FALSE;
+}
 
 boolean
 util_format_is_luminance_alpha(enum pipe_format format)
@@ -262,6 +318,89 @@ util_format_write_4ub(enum pipe_format format, const 
uint8_t *src, unsigned src_
format_desc-pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, 
h);
 }
 
+void
+util_format_read_4ui(enum pipe_format format,
+ unsigned *dst, unsigned dst_stride,
+ const void *src, unsigned src_stride,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   const uint8_t *src_row;
+   unsigned *dst_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc-block.width == 0);
+   assert(y % format_desc-block.height == 0);
+
+   src_row = (const uint8_t *)src + y*src_stride + 
x*(format_desc-block.bits/8);
+   dst_row = dst;
+
+   format_desc-unpack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, 
h);
+}
+
+void
+util_format_write_4ui(enum pipe_format format,
+  const unsigned int *src, unsigned src_stride,
+  void *dst, unsigned dst_stride,
+  unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   uint8_t *dst_row;
+   const unsigned *src_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc-block.width == 0);
+   assert(y % format_desc-block.height == 0);
+
+   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc-block.bits/8);
+   src_row = src;
+
+   format_desc-pack_rgba_uint(dst_row, dst_stride, src_row, src_stride, 

[Mesa-dev] [PATCH 5/5] st/mesa: add readpixel integer support

2011-10-07 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This adds support for readpixels integer paths, it deals with the 
signed/unsigned crossovers.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/mesa/state_tracker/st_cb_readpixels.c |   40 +++-
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_readpixels.c 
b/src/mesa/state_tracker/st_cb_readpixels.c
index e2b29fe..7fa1672 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -387,6 +387,8 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, 
GLsizei width, GLsizei h
GLsizei i, j;
GLint yStep, dfStride;
GLfloat *df;
+   GLuint *dui;
+   GLint *di;
struct st_renderbuffer *strb;
struct gl_pixelstore_attrib clippedPacking = *pack;
struct pipe_transfer *trans;
@@ -454,10 +456,13 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, 
GLsizei width, GLsizei h
}
else {
   /* write tile(row) into temp row buffer */
-  df = (GLfloat *) temp;
+  df = (GLfloat *)temp;
   dfStride = 0;
}
 
+   dui = (GLuint *)df;
+   di = (GLint *)df;
+
if (st_fb_orientation(ctx-ReadBuffer) == Y_0_TOP) {
   /* convert GL Y to Gallium Y */
   y = strb-Base.Height - y - height;
@@ -611,7 +616,38 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, 
GLsizei width, GLsizei h
 dst += dstStride;
  }
   }
-  else {
+  else if (util_format_is_pure_sint(pformat)) {
+ for (i = 0; i  height; i++) {
+if (type == GL_UNSIGNED_INT)
+   pipe_get_tile_ui_format(pipe, trans, 0, y, width, 1,
+   pformat, dui);
+else
+   pipe_get_tile_i_format(pipe, trans, 0, y, width, 1,
+  pformat, di);
+y += yStep;
+if (!dfStride) {
+   _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4])temp,
+format, type, dst);
+   dst += dstStride;
+}
+}
+  } else if (util_format_is_pure_uint(pformat)) {
+ for (i = 0; i  height; i++) {
+if (type == GL_UNSIGNED_INT)
+   pipe_get_tile_ui_format(pipe, trans, 0, y, width, 1,
+   pformat, dui);
+else
+   pipe_get_tile_i_format(pipe, trans, 0, y, width, 1,
+  pformat, di);
+y += yStep;
+df += dfStride;
+if (!dfStride) {
+   _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4])temp,
+format, type, dst);
+   dst += dstStride;
+}
+ }
+  } else {
  /* RGBA format */
  /* Do a row at a time to flip image data vertically */
  for (i = 0; i  height; i++) {
-- 
1.7.6.2

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


[Mesa-dev] [PATCH 4/5] st/mesa: add support for int type conversion

2011-10-07 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

---
 src/mesa/state_tracker/st_format.c |  453 ++--
 1 files changed, 386 insertions(+), 67 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 6eb8a50..6e8ab94 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -291,20 +291,112 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
   return PIPE_FORMAT_R16G16B16A16_UNORM;
 
/* signed int formats */
+   case MESA_FORMAT_ALPHA_UINT8:
+  return PIPE_FORMAT_A8_UINT;
+   case MESA_FORMAT_ALPHA_UINT16:
+  return PIPE_FORMAT_A16_UINT;
+   case MESA_FORMAT_ALPHA_UINT32:
+  return PIPE_FORMAT_A32_UINT;
+
+   case MESA_FORMAT_ALPHA_INT8:
+  return PIPE_FORMAT_A8_SINT;
+   case MESA_FORMAT_ALPHA_INT16:
+  return PIPE_FORMAT_A16_SINT;
+   case MESA_FORMAT_ALPHA_INT32:
+  return PIPE_FORMAT_A32_SINT;
+
+   case MESA_FORMAT_INTENSITY_UINT8:
+  return PIPE_FORMAT_I8_UINT;
+   case MESA_FORMAT_INTENSITY_UINT16:
+  return PIPE_FORMAT_I16_UINT;
+   case MESA_FORMAT_INTENSITY_UINT32:
+  return PIPE_FORMAT_I32_UINT;
+
+   case MESA_FORMAT_INTENSITY_INT8:
+  return PIPE_FORMAT_I8_SINT;
+   case MESA_FORMAT_INTENSITY_INT16:
+  return PIPE_FORMAT_I16_SINT;
+   case MESA_FORMAT_INTENSITY_INT32:
+  return PIPE_FORMAT_I32_SINT;
+
+   case MESA_FORMAT_LUMINANCE_UINT8:
+  return PIPE_FORMAT_L8_UINT;
+   case MESA_FORMAT_LUMINANCE_UINT16:
+  return PIPE_FORMAT_L16_UINT;
+   case MESA_FORMAT_LUMINANCE_UINT32:
+  return PIPE_FORMAT_L32_UINT;
+
+   case MESA_FORMAT_LUMINANCE_INT8:
+  return PIPE_FORMAT_L8_SINT;
+   case MESA_FORMAT_LUMINANCE_INT16:
+  return PIPE_FORMAT_L16_SINT;
+   case MESA_FORMAT_LUMINANCE_INT32:
+  return PIPE_FORMAT_L32_SINT;
+
+   case MESA_FORMAT_LUMINANCE_ALPHA_UINT8:
+  return PIPE_FORMAT_L8A8_UINT;
+   case MESA_FORMAT_LUMINANCE_ALPHA_UINT16:
+  return PIPE_FORMAT_L16A16_UINT;
+   case MESA_FORMAT_LUMINANCE_ALPHA_UINT32:
+  return PIPE_FORMAT_L32A32_UINT;
+
+   case MESA_FORMAT_LUMINANCE_ALPHA_INT8:
+  return PIPE_FORMAT_L8A8_SINT;
+   case MESA_FORMAT_LUMINANCE_ALPHA_INT16:
+  return PIPE_FORMAT_L16A16_SINT;
+   case MESA_FORMAT_LUMINANCE_ALPHA_INT32:
+  return PIPE_FORMAT_L32A32_SINT;
+
+   case MESA_FORMAT_R_INT8:
+  return PIPE_FORMAT_R8_SINT;
+   case MESA_FORMAT_RG_INT8:
+  return PIPE_FORMAT_R8G8_SINT;
+   case MESA_FORMAT_RGB_INT8:
+  return PIPE_FORMAT_R8G8B8_SINT;
case MESA_FORMAT_RGBA_INT8:
-  return PIPE_FORMAT_R8G8B8A8_SSCALED;
+  return PIPE_FORMAT_R8G8B8A8_SINT;
+   case MESA_FORMAT_R_INT16:
+  return PIPE_FORMAT_R16_SINT;
+   case MESA_FORMAT_RG_INT16:
+  return PIPE_FORMAT_R16G16_SINT;
+   case MESA_FORMAT_RGB_INT16:
+  return PIPE_FORMAT_R16G16B16_SINT;
case MESA_FORMAT_RGBA_INT16:
-  return PIPE_FORMAT_R16G16B16A16_SSCALED;
+  return PIPE_FORMAT_R16G16B16A16_SINT;
+   case MESA_FORMAT_R_INT32:
+  return PIPE_FORMAT_R32_SINT;
+   case MESA_FORMAT_RG_INT32:
+  return PIPE_FORMAT_R32G32_SINT;
+   case MESA_FORMAT_RGB_INT32:
+  return PIPE_FORMAT_R32G32B32_SINT;
case MESA_FORMAT_RGBA_INT32:
-  return PIPE_FORMAT_R32G32B32A32_SSCALED;
+  return PIPE_FORMAT_R32G32B32A32_SINT;
 
/* unsigned int formats */
+   case MESA_FORMAT_R_UINT8:
+  return PIPE_FORMAT_R8_UINT;
+   case MESA_FORMAT_RG_UINT8:
+  return PIPE_FORMAT_R8G8_UINT;
+   case MESA_FORMAT_RGB_UINT8:
+  return PIPE_FORMAT_R8G8B8_UINT;
case MESA_FORMAT_RGBA_UINT8:
-  return PIPE_FORMAT_R8G8B8A8_USCALED;
+  return PIPE_FORMAT_R8G8B8A8_UINT;
+   case MESA_FORMAT_R_UINT16:
+  return PIPE_FORMAT_R16_UINT;
+   case MESA_FORMAT_RG_UINT16:
+  return PIPE_FORMAT_R16G16_UINT;
+   case MESA_FORMAT_RGB_UINT16:
+  return PIPE_FORMAT_R16G16B16_UINT;
case MESA_FORMAT_RGBA_UINT16:
-  return PIPE_FORMAT_R16G16B16A16_USCALED;
+  return PIPE_FORMAT_R16G16B16A16_UINT;
+   case MESA_FORMAT_R_UINT32:
+  return PIPE_FORMAT_R32_UINT;
+   case MESA_FORMAT_RG_UINT32:
+  return PIPE_FORMAT_R32G32_UINT;
+   case MESA_FORMAT_RGB_UINT32:
+  return PIPE_FORMAT_R32G32B32_UINT;
case MESA_FORMAT_RGBA_UINT32:
-  return PIPE_FORMAT_R32G32B32A32_USCALED;
+  return PIPE_FORMAT_R32G32B32A32_UINT;
 
case MESA_FORMAT_RED_RGTC1:
   return PIPE_FORMAT_RGTC1_UNORM;
@@ -519,20 +611,111 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_R16G16_UNORM:
   return MESA_FORMAT_RG1616;
 
-   /* signed int formats */
-   case PIPE_FORMAT_R8G8B8A8_SSCALED:
+   case PIPE_FORMAT_A8_UINT:
+  return MESA_FORMAT_ALPHA_UINT8;
+   case PIPE_FORMAT_A16_UINT:
+  return MESA_FORMAT_ALPHA_UINT16;
+   case PIPE_FORMAT_A32_UINT:
+  return MESA_FORMAT_ALPHA_UINT32;
+   case PIPE_FORMAT_A8_SINT:
+  return MESA_FORMAT_ALPHA_INT8;
+   case PIPE_FORMAT_A16_SINT:
+  return 

[Mesa-dev] [Bug 41571] New: libglapi.so.0: undefined symbol: is_selinux_enabled

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

   Summary: libglapi.so.0: undefined symbol: is_selinux_enabled
   Product: Mesa
   Version: git
  Platform: All
OS/Version: All
Status: NEW
  Severity: critical
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: alexandre.f.dem...@gmail.com


After building mesa from git and trying to launch some application, it seems
there is a problem with a missing link to selinux.

Poking libglapi gives the following:

ldd -r /usr/lib/x86_64-linux-gnu/libglapi.so.0
linux-vdso.so.1 =  (0x7fffba5ff000)
libpthread.so.0 = /lib/x86_64-linux-gnu/libpthread.so.0
(0x7f620ab0c000)
libc.so.6 = /lib/x86_64-linux-gnu/libc.so.6 (0x7f620a76d000)
/lib64/ld-linux-x86-64.so.2 (0x7f620af9)
undefined symbol: security_get_boolean_active   
(/usr/lib/x86_64-linux-gnu/libglapi.so.0)
undefined symbol: is_selinux_enabled   
(/usr/lib/x86_64-linux-gnu/libglapi.so.0)
undefined symbol: security_get_boolean_pending   
(/usr/lib/x86_64-linux-gnu/libglapi.so.0)


It was also reported by someone else in Red Hat's bugs list:
https://bugzilla.redhat.com/show_bug.cgi?id=737259

-- 
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 3/5] gallium: add initial pure integer support (v2)

2011-10-07 Thread Jose Fonseca
Looks good overall. Comments inline.

- Original Message -
 From: Dave Airlie airl...@redhat.com
 
 This add support for unsigned/signed integer types via adding a
 'pure' bit
 in the format description table. It adds 4 new u_format get/put
 hooks,
 for get/put uint and get/put sint so that accessors can get native
 access
 to the integer bits. This is used to avoid precision loss via float
 converting
 paths.
 
 It doesn't add any float fetchers for these types at the moment, GL
 doesn't
 require float fetching from these types and I expect we'll introduce
 a lot
 of hidden bugs if we start allowing such conversions without an API
 mandating
 it.

I'm Ok with this for the time being, but as I said when we discussed this, the 
ability of converting to/from floats is useful for debugging/visualization and 
to emulate unsupported formats.

 It adds all formats from EXT_texture_integer and EXT_texture_rg.
 
 0 regressions on llvmpipe here with this.
 
 (there is some more follow on code in my gallium-int-work branch,
 bringing
  softpipe and mesa to a pretty integer clean state)
 
 v2: fixup python generator to get signed-unsigned and
 unsigned-signed
 fetches working.
 
 Signed-off-by: Dave Airlie airl...@redhat.com
 ---
  src/gallium/auxiliary/util/u_format.c|  139
  ++
  src/gallium/auxiliary/util/u_format.csv  |   61 +++
  src/gallium/auxiliary/util/u_format.h|   66 -
  src/gallium/auxiliary/util/u_format_pack.py  |   70 +++--
  src/gallium/auxiliary/util/u_format_parse.py |   18 +++-
  src/gallium/auxiliary/util/u_format_table.py |   23 -
  src/gallium/auxiliary/util/u_tile.c  |  138
  +
  src/gallium/auxiliary/util/u_tile.h  |   39 +++
  src/gallium/drivers/llvmpipe/lp_tile_soa.py  |2 +-
  src/gallium/include/pipe/p_format.h  |   59 +++
  10 files changed, 595 insertions(+), 20 deletions(-)
 
 diff --git a/src/gallium/auxiliary/util/u_format.c
 b/src/gallium/auxiliary/util/u_format.c
 index 9bf4258..045cf94 100644
 --- a/src/gallium/auxiliary/util/u_format.c
 +++ b/src/gallium/auxiliary/util/u_format.c
 @@ -124,6 +124,62 @@ util_format_is_luminance(enum pipe_format
 format)
 return FALSE;
  }
  
 +boolean
 +util_format_is_pure_integer(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   int i;
 +   /* Find the first non-void channel. */
 +   for (i = 0; i  4; i++) {
 +  if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
 + break;
 +  }
 +   }
 +
 +   if (i == 4) {
 +  return FALSE;
 +   }
 +
 +   return desc-channel[i].pure_integer ? TRUE : FALSE;
 +}
 +
 +boolean
 +util_format_is_pure_sint(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   int i;
 +   /* Find the first non-void channel. */
 +   for (i = 0; i  4; i++) {
 +  if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
 + break;
 +  }
 +   }
 +
 +   if (i == 4) {
 +  return FALSE;
 +   }
 +
 +   return (desc-channel[i].type == UTIL_FORMAT_TYPE_SIGNED 
 desc-channel[i].pure_integer) ? TRUE : FALSE;
 +}
 +
 +boolean
 +util_format_is_pure_uint(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   int i;
 +   /* Find the first non-void channel. */
 +   for (i = 0; i  4; i++) {
 +  if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
 + break;
 +  }
 +   }
 +
 +   if (i == 4) {
 +  return FALSE;
 +   }
 +
 +   return (desc-channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED 
 desc-channel[i].pure_integer) ? TRUE : FALSE;
 +}

Please refactor out the duplicated code in the above three functions into a 
common function.

  boolean
  util_format_is_luminance_alpha(enum pipe_format format)
 @@ -262,6 +318,89 @@ util_format_write_4ub(enum pipe_format format,
 const uint8_t *src, unsigned src_
 format_desc-pack_rgba_8unorm(dst_row, dst_stride, src_row,
 src_stride, w, h);
  }
  
 +void
 +util_format_read_4ui(enum pipe_format format,
 + unsigned *dst, unsigned dst_stride,
 + const void *src, unsigned src_stride,
 + unsigned x, unsigned y, unsigned w, unsigned h)
 +{
 +   const struct util_format_description *format_desc;
 +   const uint8_t *src_row;
 +   unsigned *dst_row;
 +
 +   format_desc = util_format_description(format);
 +
 +   assert(x % format_desc-block.width == 0);
 +   assert(y % format_desc-block.height == 0);
 +
 +   src_row = (const uint8_t *)src + y*src_stride +
 x*(format_desc-block.bits/8);
 +   dst_row = dst;
 +
 +   format_desc-unpack_rgba_uint(dst_row, dst_stride, src_row,
 src_stride, w, h);
 +}
 +
 +void
 +util_format_write_4ui(enum pipe_format format,
 +  const unsigned int *src, unsigned src_stride,
 +  void *dst, unsigned 

Re: [Mesa-dev] [PATCH 3/5] gallium: add initial pure integer support (v2)

2011-10-07 Thread Marek Olšák
On Fri, Oct 7, 2011 at 10:48 PM, Jose Fonseca jfons...@vmware.com wrote:
 Looks good overall. Comments inline.

 - Original Message -
 From: Dave Airlie airl...@redhat.com

 This add support for unsigned/signed integer types via adding a
 'pure' bit
 in the format description table. It adds 4 new u_format get/put
 hooks,
 for get/put uint and get/put sint so that accessors can get native
 access
 to the integer bits. This is used to avoid precision loss via float
 converting
 paths.

 It doesn't add any float fetchers for these types at the moment, GL
 doesn't
 require float fetching from these types and I expect we'll introduce
 a lot
 of hidden bugs if we start allowing such conversions without an API
 mandating
 it.

 I'm Ok with this for the time being, but as I said when we discussed this, 
 the ability of converting to/from floats is useful for 
 debugging/visualization and to emulate unsupported formats.

 It adds all formats from EXT_texture_integer and EXT_texture_rg.

 0 regressions on llvmpipe here with this.

 (there is some more follow on code in my gallium-int-work branch,
 bringing
  softpipe and mesa to a pretty integer clean state)

 v2: fixup python generator to get signed-unsigned and
 unsigned-signed
 fetches working.

 Signed-off-by: Dave Airlie airl...@redhat.com
 ---
  src/gallium/auxiliary/util/u_format.c        |  139
  ++
  src/gallium/auxiliary/util/u_format.csv      |   61 +++
  src/gallium/auxiliary/util/u_format.h        |   66 -
  src/gallium/auxiliary/util/u_format_pack.py  |   70 +++--
  src/gallium/auxiliary/util/u_format_parse.py |   18 +++-
  src/gallium/auxiliary/util/u_format_table.py |   23 -
  src/gallium/auxiliary/util/u_tile.c          |  138
  +
  src/gallium/auxiliary/util/u_tile.h          |   39 +++
  src/gallium/drivers/llvmpipe/lp_tile_soa.py  |    2 +-
  src/gallium/include/pipe/p_format.h          |   59 +++
  10 files changed, 595 insertions(+), 20 deletions(-)

 diff --git a/src/gallium/auxiliary/util/u_format.c
 b/src/gallium/auxiliary/util/u_format.c
 index 9bf4258..045cf94 100644
 --- a/src/gallium/auxiliary/util/u_format.c
 +++ b/src/gallium/auxiliary/util/u_format.c
 @@ -124,6 +124,62 @@ util_format_is_luminance(enum pipe_format
 format)
     return FALSE;
  }

 +boolean
 +util_format_is_pure_integer(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   int i;
 +   /* Find the first non-void channel. */
 +   for (i = 0; i  4; i++) {
 +      if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
 +         break;
 +      }
 +   }
 +
 +   if (i == 4) {
 +      return FALSE;
 +   }
 +
 +   return desc-channel[i].pure_integer ? TRUE : FALSE;
 +}
 +
 +boolean
 +util_format_is_pure_sint(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   int i;
 +   /* Find the first non-void channel. */
 +   for (i = 0; i  4; i++) {
 +      if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
 +         break;
 +      }
 +   }
 +
 +   if (i == 4) {
 +      return FALSE;
 +   }
 +
 +   return (desc-channel[i].type == UTIL_FORMAT_TYPE_SIGNED 
 desc-channel[i].pure_integer) ? TRUE : FALSE;
 +}
 +
 +boolean
 +util_format_is_pure_uint(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   int i;
 +   /* Find the first non-void channel. */
 +   for (i = 0; i  4; i++) {
 +      if (desc-channel[i].type != UTIL_FORMAT_TYPE_VOID) {
 +         break;
 +      }
 +   }
 +
 +   if (i == 4) {
 +      return FALSE;
 +   }
 +
 +   return (desc-channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED 
 desc-channel[i].pure_integer) ? TRUE : FALSE;
 +}

 Please refactor out the duplicated code in the above three functions into a 
 common function.

  boolean
  util_format_is_luminance_alpha(enum pipe_format format)
 @@ -262,6 +318,89 @@ util_format_write_4ub(enum pipe_format format,
 const uint8_t *src, unsigned src_
     format_desc-pack_rgba_8unorm(dst_row, dst_stride, src_row,
     src_stride, w, h);
  }

 +void
 +util_format_read_4ui(enum pipe_format format,
 +                     unsigned *dst, unsigned dst_stride,
 +                     const void *src, unsigned src_stride,
 +                     unsigned x, unsigned y, unsigned w, unsigned h)
 +{
 +   const struct util_format_description *format_desc;
 +   const uint8_t *src_row;
 +   unsigned *dst_row;
 +
 +   format_desc = util_format_description(format);
 +
 +   assert(x % format_desc-block.width == 0);
 +   assert(y % format_desc-block.height == 0);
 +
 +   src_row = (const uint8_t *)src + y*src_stride +
 x*(format_desc-block.bits/8);
 +   dst_row = dst;
 +
 +   format_desc-unpack_rgba_uint(dst_row, dst_stride, src_row,
 src_stride, w, h);
 +}
 +
 +void
 +util_format_write_4ui(enum pipe_format format,
 +                      const unsigned int *src, 

[Mesa-dev] [PATCH] pb_bufmgr_cache: flush cache when create_buffer fails and try again

2011-10-07 Thread Marek Olšák
NOTE: This is a candidate for the stable branches.
---
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c 
b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 58721c0..0e6896a 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -324,6 +324,13 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
   return NULL;

buf-buffer = mgr-provider-create_buffer(mgr-provider, size, desc);
+
+   /* Empty the cache and try again. */
+   if (!buf-buffer) {
+  mgr-base.flush(mgr-base);
+  buf-buffer = mgr-provider-create_buffer(mgr-provider, size, desc);
+   }
+
if(!buf-buffer) {
   FREE(buf);
   return NULL;
-- 
1.7.4.1

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


[Mesa-dev] [PATCH 1/4] mesa: Close Doxygen group

2011-10-07 Thread Chad Versace
In dd_function_table, close the Doxygen group beginning with
   \name Support for multiple TL engines
---
 src/mesa/main/dd.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 7875564..4e017ae 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -901,6 +901,7 @@ struct dd_function_table {
 */
void (*EndCallList)( struct gl_context *ctx );
 
+   /**@}*/
 
/**
 * \name GL_ARB_sync interfaces
-- 
1.7.6.2

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


[Mesa-dev] [PATCH 2/4] mesa: Declare _mesa_RenderMode as non-static

2011-10-07 Thread Chad Versace
This is required in order for meta-ops to save/restore the GL_RENDER_MODE
state, which is implemented in the next commit.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/main/feedback.c |2 +-
 src/mesa/main/feedback.h |3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index cb5f49f..f95e3b5 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -418,7 +418,7 @@ _mesa_PopName( void )
  * __struct gl_contextRec::RenderMode and notifies the driver via the
  * dd_function_table::RenderMode callback.
  */
-static GLint GLAPIENTRY
+GLint GLAPIENTRY
 _mesa_RenderMode( GLenum mode )
 {
GET_CURRENT_CONTEXT(ctx);
diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h
index 6d256ee..c64db31 100644
--- a/src/mesa/main/feedback.h
+++ b/src/mesa/main/feedback.h
@@ -33,6 +33,9 @@
 
 #if FEATURE_feedback
 
+extern GLint GLAPIENTRY
+_mesa_RenderMode( GLenum mode );
+
 extern void
 _mesa_feedback_vertex( struct gl_context *ctx,
const GLfloat win[4],
-- 
1.7.6.2

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


[Mesa-dev] [PATCH 3/4] meta: Add flag MESA_META_SELECT_FEEDBACK

2011-10-07 Thread Chad Versace
If this flag is set, then _mesa_meta_begin will save/restore the state of
GL_SELECT and GL_FEEDBACK render modes.

Intel's futue resolve meta-ops will require this, since buffer resolves
may occur when the GL_RENDER_MODE is GL_SELECT.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/common/meta.c |   26 ++
 src/mesa/drivers/common/meta.h |1 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 5b73dcd..fc25f92 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -172,6 +172,11 @@ struct save_state
struct gl_query_object *CondRenderQuery;
GLenum CondRenderMode;
 
+   /** MESA_META_SELECT_FEEDBACK */
+   GLenum RenderMode;
+   struct gl_selection Select;
+   struct gl_feedback Feedback;
+
/** Miscellaneous (always disabled) */
GLboolean Lighting;
 };
@@ -608,6 +613,17 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 _mesa_EndConditionalRender();
}
 
+   if (state  MESA_META_SELECT_FEEDBACK) {
+  save-RenderMode = ctx-RenderMode;
+  if (ctx-RenderMode == GL_SELECT) {
+save-Select = ctx-Select; /* struct copy */
+_mesa_RenderMode(GL_RENDER);
+  } else if (ctx-RenderMode == GL_FEEDBACK) {
+save-Feedback = ctx-Feedback; /* struct copy */
+_mesa_RenderMode(GL_RENDER);
+  }
+   }
+
/* misc */
{
   save-Lighting = ctx-Light.Enabled;
@@ -893,6 +909,16 @@ _mesa_meta_end(struct gl_context *ctx)
  save-CondRenderMode);
}
 
+   if (state  MESA_META_SELECT_FEEDBACK) {
+  if (save-RenderMode == GL_SELECT) {
+ctx-Select = save-Select;
+_mesa_RenderMode(GL_SELECT);
+  } else if (save-RenderMode == GL_FEEDBACK) {
+ctx-Feedback = save-Feedback;
+_mesa_RenderMode(GL_FEEDBACK);
+  }
+   }
+
/* misc */
if (save-Lighting) {
   _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 7ec5683..e0435a8 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -54,6 +54,7 @@
 #define MESA_META_CLAMP_VERTEX_COLOR0x1
 #define MESA_META_CONDITIONAL_RENDER0x2
 #define MESA_META_CLIP  0x4
+#define MESA_META_SELECT_FEEDBACK   0x8
 /**\}*/
 
 extern void
-- 
1.7.6.2

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


[Mesa-dev] [PATCH 4/4] mesa: Bump MAX_META_OPS_DEPTH from 2 to 8

2011-10-07 Thread Chad Versace
Sine i965 will soon use meta-ops to perform HiZ resolves, the meta-op stack
will exceed depth 2. I bumped it to 8 because... 8 is bigger than 2, but
not too big.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/common/meta.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index fc25f92..210786a 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -278,7 +278,7 @@ struct decompress_state
 };
 
 
-#define MAX_META_OPS_DEPTH  2
+#define MAX_META_OPS_DEPTH  8
 /**
  * All per-context meta state.
  */
-- 
1.7.6.2

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


Re: [Mesa-dev] [PATCH 3/4] meta: Add flag MESA_META_SELECT_FEEDBACK

2011-10-07 Thread Brian Paul

On 10/07/2011 04:55 PM, Chad Versace wrote:

If this flag is set, then _mesa_meta_begin will save/restore the state of
GL_SELECT and GL_FEEDBACK render modes.

Intel's futue resolve meta-ops will require this, since buffer resolves
may occur when the GL_RENDER_MODE is GL_SELECT.

Signed-off-by: Chad Versacec...@chad-versace.us
---
  src/mesa/drivers/common/meta.c |   26 ++
  src/mesa/drivers/common/meta.h |1 +
  2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 5b73dcd..fc25f92 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -172,6 +172,11 @@ struct save_state
 struct gl_query_object *CondRenderQuery;
 GLenum CondRenderMode;

+   /** MESA_META_SELECT_FEEDBACK */
+   GLenum RenderMode;
+   struct gl_selection Select;
+   struct gl_feedback Feedback;
+
 /** Miscellaneous (always disabled) */
 GLboolean Lighting;
  };
@@ -608,6 +613,17 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 _mesa_EndConditionalRender();
 }

+   if (state  MESA_META_SELECT_FEEDBACK) {
+  save-RenderMode = ctx-RenderMode;
+  if (ctx-RenderMode == GL_SELECT) {
+save-Select = ctx-Select; /* struct copy */
+_mesa_RenderMode(GL_RENDER);
+  } else if (ctx-RenderMode == GL_FEEDBACK) {
+save-Feedback = ctx-Feedback; /* struct copy */
+_mesa_RenderMode(GL_RENDER);
+  }
+   }
+
 /* misc */
 {
save-Lighting = ctx-Light.Enabled;
@@ -893,6 +909,16 @@ _mesa_meta_end(struct gl_context *ctx)
  save-CondRenderMode);
 }

+   if (state  MESA_META_SELECT_FEEDBACK) {
+  if (save-RenderMode == GL_SELECT) {
+ctx-Select = save-Select;
+_mesa_RenderMode(GL_SELECT);
+  } else if (save-RenderMode == GL_FEEDBACK) {
+ctx-Feedback = save-Feedback;
+_mesa_RenderMode(GL_FEEDBACK);
+  }
+   }


You might need to switch the order of calling _mesa_RenderMode() and 
assigning the ctx-Feedback/Select state.  That is:


 _mesa_RenderMode(GL_FEEDBACK);
 ctx-Feedback = save-Feedback;

I presume that after _mesa_meta_end() is called, we want the 
selection/feedback state to be just as it was before 
_mesa_meta_begin() was called, right?


When _mesa_RenderMode() is called it mucks with various ctx-Select or 
ctx-Feedback fields.  So we need to assign/restore the old 
ctx-Select/Feedback state _after_ that if we want to restore things 
just as they were.


What do you think?

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


[Mesa-dev] [PATCH 2/2] linker: Fix a slightly incorrect comment

2011-10-07 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/glsl/linker.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 9463f53..42075cb 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1342,7 +1342,10 @@ assign_attribute_or_color_locations(gl_shader_program 
*prog,
 }
   }
 
-  /* The location was explicitly assigned, nothing to do here.
+  /* If the variable is not a built-in and has a location statically
+   * assigned in the shader (presumably via a layout qualifier), make sure
+   * that it doesn't collide with other assigned locations.  Otherwise,
+   * add it to the list of variables that need linker-assigned locations.
*/
   const unsigned slots = count_attribute_slots(var-type);
   if (var-location != -1) {
-- 
1.7.6

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


[Mesa-dev] [PATCH 1/2] hash_table: Make string_to_uint_map make a copy of the name

2011-10-07 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

The hash table needs a copy of the key that it can keep for
comparisons during searches.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41499
Cc: Stéphane Marchesin stephane.marche...@gmail.com
Cc: Luzipher luziphermcl...@yahoo.ie
Cc: Michał Lipski tall...@o2.pl
---
 src/mesa/program/hash_table.h |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h
index bfe221b..941d28a 100644
--- a/src/mesa/program/hash_table.h
+++ b/src/mesa/program/hash_table.h
@@ -32,6 +32,7 @@
 #define HASH_TABLE_H
 
 #include string.h
+#include stdlib.h
 #include stdint.h
 #include limits.h
 #include assert.h
@@ -100,6 +101,10 @@ extern void *hash_table_find(struct hash_table *ht, const 
void *key);
  * calls to \c hash_table_find and \c hash_table_remove will return or remove,
  * repsectively, the most recently added instance of \c key.
  *
+ * \warning
+ * The value passed by \c key is kept in the hash table and is used by later
+ * calls to \c hash_table_find.
+ *
  * \sa hash_table_replace
  */
 extern void hash_table_insert(struct hash_table *ht, void *data,
@@ -204,6 +209,7 @@ public:
 
~string_to_uint_map()
{
+  hash_table_call_foreach(this-ht, delete_key, NULL);
   hash_table_dtor(this-ht);
}
 
@@ -243,10 +249,20 @@ public:
* because UINT_MAX+1 = 0.
*/
   assert(value != UINT_MAX);
-  hash_table_replace(ht, (void *) (intptr_t) (value + 1), key);
+  hash_table_replace(this-ht,
+(void *) (intptr_t) (value + 1),
+strdup(key));
}
 
 private:
+   static void delete_key(const void *key, void *data, void *closure)
+   {
+  (void) data;
+  (void) closure;
+
+  free((char *)key);
+   }
+
struct hash_table *ht;
 };
 
-- 
1.7.6

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


Re: [Mesa-dev] [PATCH] pb_bufmgr_cache: flush cache when create_buffer fails and try again

2011-10-07 Thread Jose Fonseca


- Original Message -
 NOTE: This is a candidate for the stable branches.
 ---
  src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)
 
 diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 index 58721c0..0e6896a 100644
 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 @@ -324,6 +324,13 @@ pb_cache_manager_create_buffer(struct pb_manager
 *_mgr,
return NULL;
 
 buf-buffer = mgr-provider-create_buffer(mgr-provider, size,
 desc);


This looks OK, but shouldn't we try flushing the cache first (i.e., invoke 
pb_cache_manager_flush) before flushing the inner buffer manager?

Jose

 +
 +   /* Empty the cache and try again. */
 +   if (!buf-buffer) {
 +  mgr-base.flush(mgr-base);
 +  buf-buffer = mgr-provider-create_buffer(mgr-provider,
 size, desc);
 +   }
 +
 if(!buf-buffer) {
FREE(buf);
return NULL;
 --
 1.7.4.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/4] meta: Add flag MESA_META_SELECT_FEEDBACK

2011-10-07 Thread Chad Versace
On 10/07/2011 04:23 PM, Brian Paul wrote:
 On 10/07/2011 04:55 PM, Chad Versace wrote:
 If this flag is set, then _mesa_meta_begin will save/restore the state of
 GL_SELECT and GL_FEEDBACK render modes.

 Intel's futue resolve meta-ops will require this, since buffer resolves
 may occur when the GL_RENDER_MODE is GL_SELECT.

 Signed-off-by: Chad Versacec...@chad-versace.us
 ---
   src/mesa/drivers/common/meta.c |   26 ++
   src/mesa/drivers/common/meta.h |1 +
   2 files changed, 27 insertions(+), 0 deletions(-)

 diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
 index 5b73dcd..fc25f92 100644
 --- a/src/mesa/drivers/common/meta.c
 +++ b/src/mesa/drivers/common/meta.c
 @@ -172,6 +172,11 @@ struct save_state
  struct gl_query_object *CondRenderQuery;
  GLenum CondRenderMode;

 +   /** MESA_META_SELECT_FEEDBACK */
 +   GLenum RenderMode;
 +   struct gl_selection Select;
 +   struct gl_feedback Feedback;
 +
  /** Miscellaneous (always disabled) */
  GLboolean Lighting;
   };
 @@ -608,6 +613,17 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield 
 state)
_mesa_EndConditionalRender();
  }

 +   if (state  MESA_META_SELECT_FEEDBACK) {
 +  save-RenderMode = ctx-RenderMode;
 +  if (ctx-RenderMode == GL_SELECT) {
 + save-Select = ctx-Select; /* struct copy */
 + _mesa_RenderMode(GL_RENDER);
 +  } else if (ctx-RenderMode == GL_FEEDBACK) {
 + save-Feedback = ctx-Feedback; /* struct copy */
 + _mesa_RenderMode(GL_RENDER);
 +  }
 +   }
 +
  /* misc */
  {
 save-Lighting = ctx-Light.Enabled;
 @@ -893,6 +909,16 @@ _mesa_meta_end(struct gl_context *ctx)
 save-CondRenderMode);
  }

 +   if (state  MESA_META_SELECT_FEEDBACK) {
 +  if (save-RenderMode == GL_SELECT) {
 + ctx-Select = save-Select;
 + _mesa_RenderMode(GL_SELECT);
 +  } else if (save-RenderMode == GL_FEEDBACK) {
 + ctx-Feedback = save-Feedback;
 + _mesa_RenderMode(GL_FEEDBACK);
 +  }
 +   }
 
 You might need to switch the order of calling _mesa_RenderMode() and 
 assigning the ctx-Feedback/Select state.  That is:
 
  _mesa_RenderMode(GL_FEEDBACK);
  ctx-Feedback = save-Feedback;

My intuition also thought this was the correct order. But a Piglit test proved 
my intuition wrong.
 
 I presume that after _mesa_meta_end() is called, we want the 
 selection/feedback state to be just as it was before _mesa_meta_begin() was 
 called, right?

Right.
 
 When _mesa_RenderMode() is called it mucks with various ctx-Select or 
 ctx-Feedback fields.  So we need to assign/restore the old 
 ctx-Select/Feedback state _after_ that if we want to restore things just as 
 they were.
 
 What do you think?
 
 -Brian

_mesa_RenderMode clobbers and checks the state like this:
current modenew mode  clobbersasserts
--
RENDER  * nothing 
SELECT  * ctx.Select
FEEDBACK* ctx.Feedback.Count
*   RENDERnothing
*   SELECTctx.Select.BufferSize 
 0
*   FEEDBACK  
ctx.Feedback.BufferSize  0
 
So in meta_begin, we need to save the state before calling glRenderMode in 
order to prevent the state from getting clobbered. And in meta_end, we need to 
restore the state before calling glRenderMode in order to prevent the 
assertions from failing.

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] meta: Add flag MESA_META_SELECT_FEEDBACK

2011-10-07 Thread Chad Versace
On 10/07/2011 04:45 PM, Chad Versace wrote:
 On 10/07/2011 04:23 PM, Brian Paul wrote:
 On 10/07/2011 04:55 PM, Chad Versace wrote:
 If this flag is set, then _mesa_meta_begin will save/restore the state of
 GL_SELECT and GL_FEEDBACK render modes.

 Intel's futue resolve meta-ops will require this, since buffer resolves
 may occur when the GL_RENDER_MODE is GL_SELECT.

 Signed-off-by: Chad Versacec...@chad-versace.us
 ---
   src/mesa/drivers/common/meta.c |   26 ++
   src/mesa/drivers/common/meta.h |1 +
   2 files changed, 27 insertions(+), 0 deletions(-)

 diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
 index 5b73dcd..fc25f92 100644
 --- a/src/mesa/drivers/common/meta.c
 +++ b/src/mesa/drivers/common/meta.c
 @@ -172,6 +172,11 @@ struct save_state
  struct gl_query_object *CondRenderQuery;
  GLenum CondRenderMode;

 +   /** MESA_META_SELECT_FEEDBACK */
 +   GLenum RenderMode;
 +   struct gl_selection Select;
 +   struct gl_feedback Feedback;
 +
  /** Miscellaneous (always disabled) */
  GLboolean Lighting;
   };
 @@ -608,6 +613,17 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield 
 state)
_mesa_EndConditionalRender();
  }

 +   if (state  MESA_META_SELECT_FEEDBACK) {
 +  save-RenderMode = ctx-RenderMode;
 +  if (ctx-RenderMode == GL_SELECT) {
 + save-Select = ctx-Select; /* struct copy */
 + _mesa_RenderMode(GL_RENDER);
 +  } else if (ctx-RenderMode == GL_FEEDBACK) {
 + save-Feedback = ctx-Feedback; /* struct copy */
 + _mesa_RenderMode(GL_RENDER);
 +  }
 +   }
 +
  /* misc */
  {
 save-Lighting = ctx-Light.Enabled;
 @@ -893,6 +909,16 @@ _mesa_meta_end(struct gl_context *ctx)
 save-CondRenderMode);
  }

 +   if (state  MESA_META_SELECT_FEEDBACK) {
 +  if (save-RenderMode == GL_SELECT) {
 + ctx-Select = save-Select;
 + _mesa_RenderMode(GL_SELECT);
 +  } else if (save-RenderMode == GL_FEEDBACK) {
 + ctx-Feedback = save-Feedback;
 + _mesa_RenderMode(GL_FEEDBACK);
 +  }
 +   }

 You might need to switch the order of calling _mesa_RenderMode() and 
 assigning the ctx-Feedback/Select state.  That is:

  _mesa_RenderMode(GL_FEEDBACK);
  ctx-Feedback = save-Feedback;
 
 My intuition also thought this was the correct order. But a Piglit test 
 proved my intuition wrong.

 I presume that after _mesa_meta_end() is called, we want the 
 selection/feedback state to be just as it was before _mesa_meta_begin() was 
 called, right?
 
 Right.
  
 When _mesa_RenderMode() is called it mucks with various ctx-Select or 
 ctx-Feedback fields.  So we need to assign/restore the old 
 ctx-Select/Feedback state _after_ that if we want to restore things just as 
 they were.

 What do you think?

 -Brian
 
 _mesa_RenderMode clobbers and checks the state like this:
 current modenew mode  clobbersasserts
 --
 RENDER  * nothing 
 SELECT  * ctx.Select
 FEEDBACK* ctx.Feedback.Count
 *   RENDERnothing
 *   SELECT
 ctx.Select.BufferSize  0
 *   FEEDBACK  
 ctx.Feedback.BufferSize  0
  
 So in meta_begin, we need to save the state before calling glRenderMode in 
 order to prevent the state from getting clobbered. And in meta_end, we need 
 to restore the state before calling glRenderMode in order to prevent the 
 assertions from failing.


Silly me. My brain was tied in a knot. I see your point now. The second hunk 
should be changed to this:

@@ -893,6 +909,16 @@ _mesa_meta_end(struct gl_context *ctx)
save-CondRenderMode);
 }

+   if (state  MESA_META_SELECT_FEEDBACK) {
+  if (save-RenderMode == GL_SELECT) {
+ _mesa_RenderMode(GL_SELECT);
+ ctx-Select = save-Select;
+  } else if (save-RenderMode == GL_FEEDBACK) {
+ _mesa_RenderMode(GL_FEEDBACK);
+ ctx-Feedback = save-Feedback;
+  }
+   }

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 41023] [PATCH] d3d1x: error when building - src/dxgi_native.cpp:1165:40: error: uninitialized const ‘black’

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

Alexandre Demers alexandre.f.dem...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #6 from Alexandre Demers alexandre.f.dem...@gmail.com 2011-10-07 
16:59:27 PDT ---
closing the bug. The fix was included in commit
5def3b7be142cfc6bbb1534bd0557c5f324de8c0 by Christoph
Bumillere0425...@student.tuwien.ac.at.

Tested by Alexandre Demers on October 7th, 2011

-- 
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 0/6] More shader API internal house cleaning

2011-10-07 Thread Ian Romanick
This should be the last batch of internal clean-ups before the real
work.  I should be able to send some cleaned up uniform rework patches
(as discuessed at XDC last month) next week.

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


[Mesa-dev] [PATCH 3/6] mesa: Use glsl_type::gl_type in glGetActiveUniform

2011-10-07 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

This has the same value has gl_program_parameter::DataType field.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/uniform_query.cpp |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 3164d72..ba7d759 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -54,12 +54,14 @@ _mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
if (!param)
   return;
 
+   const struct gl_uniform *const uni = shProg-Uniforms-Uniforms[index];
+
if (nameOut) {
   _mesa_copy_string(nameOut, maxLength, length, param-Name);
}
 
if (size) {
-  GLint typeSize = _mesa_sizeof_glsl_type(param-DataType);
+  GLint typeSize = _mesa_sizeof_glsl_type(uni-Type-gl_type);
   if ((GLint) param-Size  typeSize) {
  /* This is an array.
   * Array elements are placed on vector[4] boundaries so they're
@@ -73,6 +75,6 @@ _mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
}
 
if (type) {
-  *type = param-DataType;
+  *type = uni-Type-gl_type;
}
 }
-- 
1.7.6

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


[Mesa-dev] [PATCH 2/6] mesa: Move _mesa_GetActiveUniformARB to uniform_query.cpp

2011-10-07 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Fold _mesa_get_active_uniform into its only caller in the process.
More changes are coming soon.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/uniform_query.cpp |   78 +++
 src/mesa/main/uniforms.c|   61 +--
 src/mesa/main/uniforms.h|3 +
 src/mesa/sources.mak|3 +-
 4 files changed, 84 insertions(+), 61 deletions(-)
 create mode 100644 src/mesa/main/uniform_query.cpp

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
new file mode 100644
index 000..3164d72
--- /dev/null
+++ b/src/mesa/main/uniform_query.cpp
@@ -0,0 +1,78 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2004-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009-2010  VMware, Inc.  All Rights Reserved.
+ * Copyright © 2010, 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include main/core.h
+#include ir.h
+#include ../glsl/program.h
+
+extern C {
+#include main/shaderapi.h
+#include main/shaderobj.h
+#include uniforms.h
+}
+
+extern C void GLAPIENTRY
+_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
+  GLsizei maxLength, GLsizei *length, GLint *size,
+  GLenum *type, GLcharARB *nameOut)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_shader_program *shProg =
+  _mesa_lookup_shader_program_err(ctx, program, glGetActiveUniform);
+   const struct gl_program_parameter *param;
+
+   if (!shProg)
+  return;
+
+   if (!shProg-Uniforms || index = shProg-Uniforms-NumUniforms) {
+  _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniform(index));
+  return;
+   }
+
+   param = get_uniform_parameter(shProg, index);
+   if (!param)
+  return;
+
+   if (nameOut) {
+  _mesa_copy_string(nameOut, maxLength, length, param-Name);
+   }
+
+   if (size) {
+  GLint typeSize = _mesa_sizeof_glsl_type(param-DataType);
+  if ((GLint) param-Size  typeSize) {
+ /* This is an array.
+  * Array elements are placed on vector[4] boundaries so they're
+  * a multiple of four floats.  We round typeSize up to next multiple
+  * of four to get the right size below.
+  */
+ typeSize = (typeSize + 3)  ~3;
+  }
+  /* Note that the returned size is in units of the type, not bytes */
+  *size = param-Size / typeSize;
+   }
+
+   if (type) {
+  *type = param-DataType;
+   }
+}
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 7252c09..ccaedf9 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -211,7 +211,7 @@ find_uniform_parameter_pos(struct gl_shader_program 
*shProg, GLint index,
  * \param index  the uniform index in [0, NumUniforms-1]
  * \return gl_program_parameter point or NULL if index is invalid
  */
-static const struct gl_program_parameter *
+const struct gl_program_parameter *
 get_uniform_parameter(struct gl_shader_program *shProg, GLint index)
 {
struct gl_program *prog;
@@ -224,54 +224,6 @@ get_uniform_parameter(struct gl_shader_program *shProg, 
GLint index)
 }
 
 
-/**
- * Called by glGetActiveUniform().
- */
-static void
-_mesa_get_active_uniform(struct gl_context *ctx, GLuint program, GLuint index,
- GLsizei maxLength, GLsizei *length, GLint *size,
- GLenum *type, GLchar *nameOut)
-{
-   struct gl_shader_program *shProg =
-  _mesa_lookup_shader_program_err(ctx, program, glGetActiveUniform);
-   const struct gl_program_parameter *param;
-
-   if (!shProg)
-  return;
-
-   if (!shProg-Uniforms || index = shProg-Uniforms-NumUniforms) {
-  _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniform(index));
-  return;
-   }
-
-   param = get_uniform_parameter(shProg, index);
-   if (!param)
-  return;
-
-   if (nameOut) {
-  _mesa_copy_string(nameOut, maxLength, 

[Mesa-dev] [PATCH 6/6] glsl_to_tgsi: Use _mesa_generate_parameters_list_for_uniforms

2011-10-07 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Bryan Cain bryanca...@gmail.com
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  119 +---
 1 files changed, 2 insertions(+), 117 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index c5b816c..5d9469b 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2914,122 +2914,6 @@ check_resources(const struct gl_context *ctx,
 }
 
 
-
-struct uniform_sort {
-   struct gl_uniform *u;
-   int pos;
-};
-
-/* The shader_program-Uniforms list is almost sorted in increasing
- * uniform-{Frag,Vert}Pos locations, but not quite when there are
- * uniforms shared between targets.  We need to add parameters in
- * increasing order for the targets.
- */
-static int
-sort_uniforms(const void *a, const void *b)
-{
-   struct uniform_sort *u1 = (struct uniform_sort *)a;
-   struct uniform_sort *u2 = (struct uniform_sort *)b;
-
-   return u1-pos - u2-pos;
-}
-
-/* Add the uniforms to the parameters.  The linker chose locations
- * in our parameters lists (which weren't created yet), which the
- * uniforms code will use to poke values into our parameters list
- * when uniforms are updated.
- */
-static void
-add_uniforms_to_parameters_list(struct gl_shader_program *shader_program,
-   struct gl_shader *shader,
-   struct gl_program *prog)
-{
-   unsigned int i;
-   unsigned int next_sampler = 0, num_uniforms = 0;
-   struct uniform_sort *sorted_uniforms;
-
-   sorted_uniforms = ralloc_array(NULL, struct uniform_sort,
- shader_program-Uniforms-NumUniforms);
-
-   for (i = 0; i  shader_program-Uniforms-NumUniforms; i++) {
-  struct gl_uniform *uniform = shader_program-Uniforms-Uniforms + i;
-  int parameter_index = -1;
-
-  switch (shader-Type) {
-  case GL_VERTEX_SHADER:
- parameter_index = uniform-VertPos;
- break;
-  case GL_FRAGMENT_SHADER:
- parameter_index = uniform-FragPos;
- break;
-  case GL_GEOMETRY_SHADER:
- parameter_index = uniform-GeomPos;
- break;
-  }
-
-  /* Only add uniforms used in our target. */
-  if (parameter_index != -1) {
- sorted_uniforms[num_uniforms].pos = parameter_index;
- sorted_uniforms[num_uniforms].u = uniform;
- num_uniforms++;
-  }
-   }
-
-   qsort(sorted_uniforms, num_uniforms, sizeof(struct uniform_sort),
- sort_uniforms);
-
-   for (i = 0; i  num_uniforms; i++) {
-  struct gl_uniform *uniform = sorted_uniforms[i].u;
-  int parameter_index = sorted_uniforms[i].pos;
-  const glsl_type *type = uniform-Type;
-  unsigned int size;
-
-  if (type-is_vector() ||
-  type-is_scalar()) {
- size = type-vector_elements;
-  } else {
- size = type_size(type) * 4;
-  }
-
-  gl_register_file file;
-  if (type-is_sampler() ||
-  (type-is_array()  type-fields.array-is_sampler())) {
- file = PROGRAM_SAMPLER;
-  } else {
- file = PROGRAM_UNIFORM;
-  }
-
-  GLint index = _mesa_lookup_parameter_index(prog-Parameters, -1,
-uniform-Name);
-
-  if (index  0) {
- index = _mesa_add_parameter(prog-Parameters, file,
-uniform-Name, size, type-gl_type,
-NULL, NULL, 0x0);
-
- /* Sampler uniform values are stored in prog-SamplerUnits,
-  * and the entry in that array is selected by this index we
-  * store in ParameterValues[].
-  */
- if (file == PROGRAM_SAMPLER) {
-for (unsigned int j = 0; j  size / 4; j++)
-   prog-Parameters-ParameterValues[index + j][0].f = 
next_sampler++;
- }
-
- /* The location chosen in the Parameters list here (returned
-  * from _mesa_add_uniform) has to match what the linker chose.
-  */
- if (index != parameter_index) {
-fail_link(shader_program, Allocation of uniform `%s' to target 
- failed (%d vs %d)\n,
- uniform-Name, index, parameter_index);
- }
-  }
-   }
-
-   ralloc_free(sorted_uniforms);
-}
-
 static void
 set_uniform_initializer(struct gl_context *ctx, void *mem_ctx,
struct gl_shader_program *shader_program,
@@ -4965,7 +4849,8 @@ get_mesa_program(struct gl_context *ctx,
v-glsl_version = ctx-Const.GLSLVersion;
v-native_integers = ctx-Const.NativeIntegers;
 
-   add_uniforms_to_parameters_list(shader_program, shader, prog);
+   _mesa_generate_parameters_list_for_uniforms(shader_program, shader,
+  prog-Parameters);
 
/* Emit intermediate IR for main(). */

[Mesa-dev] [PATCH 5/6] ir_to_mesa: Generate gl_program_parameter list by walking the GLSL IR.

2011-10-07 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Generate the program parameters list by walking the IR instead of by
walking the list of linked uniforms.  This simplifies the code quite a
bit, and is probably a bit more correct.  The list of linked uniforms
should really only be used by the GL API to interact with the
application.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Bryan Cain bryanca...@gmail.com
Cc: Eric Anholt e...@anholt.net
---
 src/mesa/program/ir_to_mesa.cpp |  163 +++
 src/mesa/program/ir_to_mesa.h   |7 ++
 2 files changed, 70 insertions(+), 100 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 8330bc5..fecab50 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2588,121 +2588,83 @@ check_resources(const struct gl_context *ctx,
 }
 
 
-
-struct uniform_sort {
-   struct gl_uniform *u;
-   int pos;
-};
-
-/* The shader_program-Uniforms list is almost sorted in increasing
- * uniform-{Frag,Vert}Pos locations, but not quite when there are
- * uniforms shared between targets.  We need to add parameters in
- * increasing order for the targets.
- */
 static int
-sort_uniforms(const void *a, const void *b)
-{
-   struct uniform_sort *u1 = (struct uniform_sort *)a;
-   struct uniform_sort *u2 = (struct uniform_sort *)b;
-
-   return u1-pos - u2-pos;
-}
-
-/* Add the uniforms to the parameters.  The linker chose locations
- * in our parameters lists (which weren't created yet), which the
- * uniforms code will use to poke values into our parameters list
- * when uniforms are updated.
- */
-static void
-add_uniforms_to_parameters_list(struct gl_shader_program *shader_program,
-   struct gl_shader *shader,
-   struct gl_program *prog)
+add_uniform_to_shader(ir_variable *var,
+ struct gl_program_parameter_list *params,
+ unsigned int next_sampler)
 {
-   unsigned int i;
-   unsigned int next_sampler = 0, num_uniforms = 0;
-   struct uniform_sort *sorted_uniforms;
+   const glsl_type *type = var-type;
+   unsigned int size;
 
-   sorted_uniforms = ralloc_array(NULL, struct uniform_sort,
- shader_program-Uniforms-NumUniforms);
+   if (type-is_vector() || type-is_scalar()) {
+  size = type-vector_elements;
+   } else {
+  size = type_size(type) * 4;
+   }
 
-   for (i = 0; i  shader_program-Uniforms-NumUniforms; i++) {
-  struct gl_uniform *uniform = shader_program-Uniforms-Uniforms + i;
-  int parameter_index = -1;
+   gl_register_file file;
+   if (type-is_sampler() ||
+   (type-is_array()  type-fields.array-is_sampler())) {
+  file = PROGRAM_SAMPLER;
+   } else {
+  file = PROGRAM_UNIFORM;
+   }
 
-  switch (shader-Type) {
-  case GL_VERTEX_SHADER:
-parameter_index = uniform-VertPos;
-break;
-  case GL_FRAGMENT_SHADER:
-parameter_index = uniform-FragPos;
-break;
-  case GL_GEOMETRY_SHADER:
-parameter_index = uniform-GeomPos;
-break;
-  }
+   int index = _mesa_lookup_parameter_index(params, -1, var-name);
+   if (index  0) {
+  index = _mesa_add_parameter(params, file,
+ var-name, size, type-gl_type,
+ NULL, NULL, 0x0);
 
-  /* Only add uniforms used in our target. */
-  if (parameter_index != -1) {
-sorted_uniforms[num_uniforms].pos = parameter_index;
-sorted_uniforms[num_uniforms].u = uniform;
-num_uniforms++;
+  /* Sampler uniform values are stored in prog-SamplerUnits,
+   * and the entry in that array is selected by this index we
+   * store in ParameterValues[].
+   */
+  if (file == PROGRAM_SAMPLER) {
+for (unsigned int j = 0; j  size / 4; j++)
+   params-ParameterValues[index + j][0].f = next_sampler++;
   }
}
 
-   qsort(sorted_uniforms, num_uniforms, sizeof(struct uniform_sort),
-sort_uniforms);
-
-   for (i = 0; i  num_uniforms; i++) {
-  struct gl_uniform *uniform = sorted_uniforms[i].u;
-  int parameter_index = sorted_uniforms[i].pos;
-  const glsl_type *type = uniform-Type;
-  unsigned int size;
-
-  if (type-is_vector() ||
- type-is_scalar()) {
-size = type-vector_elements;
-  } else {
-size = type_size(type) * 4;
-  }
+   return index;
+}
 
-  gl_register_file file;
-  if (type-is_sampler() ||
- (type-is_array()  type-fields.array-is_sampler())) {
-file = PROGRAM_SAMPLER;
-  } else {
-file = PROGRAM_UNIFORM;
-  }
+/**
+ * Generate the program parameters list for the user uniforms in a shader
+ *
+ * \param shader_program Linked shader program.  This is only used to
+ *   emit possible link errors to the info log.
+ * \param sh Shader whose uniforms are to be 

Re: [Mesa-dev] [PATCH 6/6] glsl_to_tgsi: Use _mesa_generate_parameters_list_for_uniforms

2011-10-07 Thread Bryan Cain
On 10/07/2011 07:06 PM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 Cc: Bryan Cain bryanca...@gmail.com
 ---
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  119 
 +---
  1 files changed, 2 insertions(+), 117 deletions(-)


Reviewed-by: Bryan Cain bryanca...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] pb_bufmgr_cache: flush cache when create_buffer fails and try again

2011-10-07 Thread Marek Olšák
On Sat, Oct 8, 2011 at 1:44 AM, Jose Fonseca jfons...@vmware.com wrote:


 - Original Message -
 NOTE: This is a candidate for the stable branches.
 ---
  src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |    7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)

 diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 index 58721c0..0e6896a 100644
 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
 @@ -324,6 +324,13 @@ pb_cache_manager_create_buffer(struct pb_manager
 *_mgr,
        return NULL;

     buf-buffer = mgr-provider-create_buffer(mgr-provider, size,
     desc);


 This looks OK, but shouldn't we try flushing the cache first (i.e., invoke 
 pb_cache_manager_flush) before flushing the inner buffer manager?

That's what the patch does. mgr-base.flush is equal to
pb_cache_manager_flush, but the function is declared later in the
code, so I called it this way.

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


[Mesa-dev] [PATCH] i965: Replace incorrect use of GLboolean with enum brw_compression.

2011-10-07 Thread Kenneth Graunke
brw_set_compression_control took a GLboolean as an argument, then
promptly used a switch statement to compare it with various enumeration
values.  Clearly it's not actually a boolean.

Introduce a new enumeration type, enum brw_compression, and use that.

Found by converting GLboolean to bool; clang then gave warnings about
switching on a boolean and ultimately duplicated case errors.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_defines.h |8 +---
 src/mesa/drivers/dri/i965/brw_eu.c  |4 +++-
 src/mesa/drivers/dri/i965/brw_eu.h  |2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

Only compile tested.  I think this demonstrates that using stdbool instead of
GLboolean is worthwhile: the compiler actually recognizes it as a boolean
data type and offers appropriate warnings---even errors!---when you do stupid
things like this.

I have a follow-on patch that actually does the GLboolean-bool conversion,
should we decide to go that route.  Needs a bit more clean-up but shouldn't
take too long.

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index a111630..21a115b 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -486,9 +486,11 @@
 #define BRW_CHANNEL_Z 2
 #define BRW_CHANNEL_W 3
 
-#define BRW_COMPRESSION_NONE  0
-#define BRW_COMPRESSION_2NDHALF   1
-#define BRW_COMPRESSION_COMPRESSED2
+enum brw_compression {
+   BRW_COMPRESSION_NONE   = 0,
+   BRW_COMPRESSION_2NDHALF= 1,
+   BRW_COMPRESSION_COMPRESSED = 2,
+};
 
 #define GEN6_COMPRESSION_1Q0
 #define GEN6_COMPRESSION_2Q1
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
b/src/mesa/drivers/dri/i965/brw_eu.c
index 0e04af9..b5a858b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -99,7 +99,9 @@ void brw_set_access_mode( struct brw_compile *p, GLuint 
access_mode )
p-current-header.access_mode = access_mode;
 }
 
-void brw_set_compression_control( struct brw_compile *p, GLboolean 
compression_control )
+void
+brw_set_compression_control(struct brw_compile *p,
+   enum brw_compression compression_control)
 {
p-compressed = (compression_control == BRW_COMPRESSION_COMPRESSED);
 
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index 31334ce..8bb 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -790,7 +790,7 @@ void brw_push_insn_state( struct brw_compile *p );
 void brw_set_mask_control( struct brw_compile *p, GLuint value );
 void brw_set_saturate( struct brw_compile *p, GLuint value );
 void brw_set_access_mode( struct brw_compile *p, GLuint access_mode );
-void brw_set_compression_control( struct brw_compile *p, GLboolean control );
+void brw_set_compression_control(struct brw_compile *p, enum brw_compression 
c);
 void brw_set_predicate_control_flag_value( struct brw_compile *p, GLuint value 
);
 void brw_set_predicate_control( struct brw_compile *p, GLuint pc );
 void brw_set_predicate_inverse(struct brw_compile *p, bool predicate_inverse);
-- 
1.7.7

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