Re: [Mesa-dev] [PATCH 1/9] st/vdpau: fix chroma_format handling in VideoSurfaceQueryGetPutBitsYCbCrCapabilities

2012-03-08 Thread Christian König

On 08.03.2012 00:19, Andy Furniss wrote:

Emeric Grange wrote:


With today series I get that output :
http://img807.imageshack.us/img807/5593/cran07032012184105.png


I see the same as you - xine works, but can be made to fail.
Well, thanks for testing. Emerics comment that the problem with your 
xine is the drawing of the background, it's just that you guys have 
another default skin set up with xine. So your xine is probably playing 
/usr/share/xine/skins/xine-ui_logo.mpv at startup, which in turn is 
just an MPEG1 video, which in turn we doesn't support



mplayer sw decode + yuy2 vdpau output is corrupted.
Yeah, still working on that. The problem is tilling related, just 
disable 2D tilling and it works like a charm. I think I've found the 
problem right now and going to send out some fixed patches in the next 
couple of minutes.



By the way something seemed wrong while reading mplayer's log :
(the use of the software scaler and the DRI failure)


The DRI failure is something I see output at the start of some streams 
- it doesn't seem to affect anything and happens without vdpau being 
involved.


The swscaler is because the codec is outputting planar 422 but the -vo 
needs packed, so it converts it.
Unfortunately mplayer just doesn't tries to use a planar 422 format 
(something which is really easy to support).


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


Re: [Mesa-dev] [PATCH] i915: fallback when point sprite is enabled while handling varying inputs

2012-03-08 Thread Yuanhan Liu
On Thu, Mar 08, 2012 at 02:30:30PM +0800, Yuanhan Liu wrote:
 The current code would use tex coord to implement varying inputs. If
 point sprite is enabled(always enabled in chrome and firefox), the tex
 coord would be replaced with the value (x, y, 0, 1) where x and y vary
 from 0 to 1. Thus you will find that the value of the varying inputs
 doesn't work anymore.
 
 Why chrome(and firefox) would always enable GL_POINT_SPRITE to enable
 webglc, if you would ask, here is the answer I find from the code of
 chrome at file gpu/command_buffer/service/gles2_cmd_decoder.cc:
 
   // OpenGL ES 2.0 implicitly enables the desktop GL capability
   // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact
   // isn't well documented; it was discovered in the Khronos OpenGL ES
   // mailing list archives. It also implicitly enables the desktop GL
   // capability GL_POINT_SPRITE to provide access to the gl_PointCoord
   // variable in fragment shaders.
   if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
 glEnable(GL_POINT_SPRITE);
   }
 
 So, fallback when point sprite is enabled while handling varying inputs
 before finding a better way to not use tex coord to implement varying
 inputs.
 
 This would _really_ fix the following webglc case on pineview this time:
 https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/conformance-suites/1.0.1/conformance/rendering/point-size.html
 
 NOTE: This is a candidate for stable release branches.
 
 Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
 ---
  src/mesa/drivers/dri/i915/i915_fragprog.c |   23 ---
  1 files changed, 20 insertions(+), 3 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c 
 b/src/mesa/drivers/dri/i915/i915_fragprog.c
 index 5b7e93e..c2390fe 100644
 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c
 +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
 @@ -132,9 +132,26 @@ src_vector(struct i915_fragment_program *p,
case FRAG_ATTRIB_VAR0 + 5:
case FRAG_ATTRIB_VAR0 + 6:
case FRAG_ATTRIB_VAR0 + 7:
 - src = i915_emit_decl(p, REG_TYPE_T,
 -  T_TEX0 + (source-Index - FRAG_ATTRIB_VAR0),
 -  D0_CHANNEL_ALL);
 + /*
 +  * The current code would use tex coord to implement varying inputs.
 +  * If point sprite is enabled(always enabled in chrome and firefox),
 +  * the tex coord would be replaced with the value (x, y, 0, 1) where
 +  * x and y vary from 0 to 1. Thus you will find that the value of 
 the
 +  * varying inputs doesn't work anymore.
 +  *
 +  * So, fallback when point sprite is enabled.
 +  *
 +  * FIXME: a better way to not use tex coord to add the support of
 +  *varying inputs?
 +  */
 + if (p-ctx-Point.PointSprite) {
 + i915_program_error(p, Point Sprite is enabled while using 
 +   tex coord to implement varying inputs);
 + } else {
 + src = i915_emit_decl(p, REG_TYPE_T,
 +  T_TEX0 + (source-Index - 
 FRAG_ATTRIB_VAR0),
 +  D0_CHANNEL_ALL);
 + }


Honestly, I don't like this patch myself: it makes lots of webglc test
case fallback to swrast. Though I somehow understand why you use tex
coord to implement varying inputs. But I still don't figure a better
way to handle varying inputs. 

Then I tried to get rid of such fallback and came the following patch,
which I think is much better than this one.


From ddd1a9d8f0d82c2f5fcb78a471608a005a6a077c Mon Sep 17 00:00:00 2001
From: Yuanhan Liu yuanhan@linux.intel.com
Date: Thu, 8 Mar 2012 18:48:54 +0800
Subject: [PATCH] i915: set SPRITE_POINT_ENABLE bit just when we need do coord
 replace

When SPRITE_POINT_ENABLE bit is set, the texture coord would be
replaced, and this is only needed when we called something like
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).

Since we currently handling varying inputs as tex coord, we would be
careful when setting this bit and set it just when needed, or you will
find the value of varying input is not right and changed.

With handling the bit setup at i915ValidateFragmentProgram, we don't
need the code at i915Enable then.

This patch would _really_ fix the webglc point-size.html test case and
of course, not regress piglit point-sprite and glean-pointSprite testcase.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
---
 src/mesa/drivers/dri/i915/i915_fragprog.c |5 +
 src/mesa/drivers/dri/i915/i915_state.c|   13 +
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c 
b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 5b7e93e..8829e8d 100644
--- 

[Mesa-dev] [PATCH 1/9] u_format: add util_format_is_subsampled helper function

2012-03-08 Thread Christian König
Also fix comment about subsampled formats.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/auxiliary/util/u_format.h |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.h 
b/src/gallium/auxiliary/util/u_format.h
index b9ae7c1..3f47e7a 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -54,7 +54,7 @@ enum util_format_layout {
/**
 * Formats with sub-sampled channels.
 *
-* This is for formats like YV12 where there is less than one sample per
+* This is for formats like YVYU where there is less than one sample per
 * pixel.
 */
UTIL_FORMAT_LAYOUT_SUBSAMPLED = 3,
@@ -468,6 +468,13 @@ util_format_is_s3tc(enum pipe_format format)
 }
 
 static INLINE boolean 
+util_format_is_subsampled(enum pipe_format format)
+{
+   const struct util_format_description *desc = 
util_format_description(format);
+   return desc-layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED ? TRUE : FALSE;
+}
+
+static INLINE boolean
 util_format_is_srgb(enum pipe_format format)
 {
const struct util_format_description *desc = 
util_format_description(format);
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 3/9] gallivm: add support for R8G8_R8B8 and G8R8_B8R8 formats

2012-03-08 Thread Christian König
Just to keep lp_test_format happy.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c |   42 +
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c 
b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
index cdf1956..ccc8320 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
@@ -398,6 +398,42 @@ grgb_to_rgba_aos(struct gallivm_state *gallivm,
return rgba;
 }
 
+/**
+ * Convert from n x i32 packed GR_BR to 4n x i8 RGBA AoS
+ */
+static LLVMValueRef
+grbr_to_rgba_aos(struct gallivm_state *gallivm,
+ unsigned n,
+ LLVMValueRef packed,
+ LLVMValueRef i)
+{
+   LLVMValueRef r, g, b;
+   LLVMValueRef rgba;
+
+   uyvy_to_yuv_soa(gallivm, n, packed, i, r, g, b);
+   rgba = rgb_to_rgba_aos(gallivm, n, r, g, b);
+
+   return rgba;
+}
+
+
+/**
+ * Convert from n x i32 packed RG_RB to 4n x i8 RGBA AoS
+ */
+static LLVMValueRef
+rgrb_to_rgba_aos(struct gallivm_state *gallivm,
+ unsigned n,
+ LLVMValueRef packed,
+ LLVMValueRef i)
+{
+   LLVMValueRef r, g, b;
+   LLVMValueRef rgba;
+
+   yuyv_to_yuv_soa(gallivm, n, packed, i, r, g, b);
+   rgba = rgb_to_rgba_aos(gallivm, n, r, g, b);
+
+   return rgba;
+}
 
 /**
  * @param n  is the number of pixels processed
@@ -439,6 +475,12 @@ lp_build_fetch_subsampled_rgba_aos(struct gallivm_state 
*gallivm,
case PIPE_FORMAT_G8R8_G8B8_UNORM:
   rgba = grgb_to_rgba_aos(gallivm, n, packed, i);
   break;
+   case PIPE_FORMAT_G8R8_B8R8_UNORM:
+  rgba = grbr_to_rgba_aos(gallivm, n, packed, i);
+  break;
+   case PIPE_FORMAT_R8G8_R8B8_UNORM:
+  rgba = rgrb_to_rgba_aos(gallivm, n, packed, i);
+  break;
default:
   assert(0);
   rgba =  
LLVMGetUndef(LLVMVectorType(LLVMInt8TypeInContext(gallivm-context), 4*n));
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 2/9] gallium: add R8G8_R8B8 and G8R8_B8R8 formats

2012-03-08 Thread Christian König
v2: simplify implementation by using correct swizzle
v3: fix mix with successor patch

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/auxiliary/util/u_format.csv   |2 +
 src/gallium/auxiliary/util/u_format_yuv.c |   48 +
 src/gallium/auxiliary/util/u_format_yuv.h |   46 +++
 src/gallium/include/pipe/p_format.h   |3 ++
 4 files changed, 99 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.csv 
b/src/gallium/auxiliary/util/u_format.csv
index 345cc9d..05f04b5 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -145,6 +145,8 @@ PIPE_FORMAT_YUYV , subsampled, 2, 1, x32 ,  
   , , , xyz
 # same subsampling but with rgb channels
 PIPE_FORMAT_R8G8_B8G8_UNORM  , subsampled, 2, 1, x32 , , , , 
xyz1, rgb
 PIPE_FORMAT_G8R8_G8B8_UNORM  , subsampled, 2, 1, x32 , , , , 
xyz1, rgb
+PIPE_FORMAT_G8R8_B8R8_UNORM  , subsampled, 2, 1, x32 , , , , 
yxz1, rgb
+PIPE_FORMAT_R8G8_R8B8_UNORM  , subsampled, 2, 1, x32 , , , , 
yxz1, rgb
 
 # some special formats not fitting anywhere else
 PIPE_FORMAT_R11G11B10_FLOAT   , other,  1,  1, x32 , , , , 
xyz1, rgb
diff --git a/src/gallium/auxiliary/util/u_format_yuv.c 
b/src/gallium/auxiliary/util/u_format_yuv.c
index 38a25b1..c7fdaa0 100644
--- a/src/gallium/auxiliary/util/u_format_yuv.c
+++ b/src/gallium/auxiliary/util/u_format_yuv.c
@@ -1142,3 +1142,51 @@ util_format_nv21_pack_rgba_float(uint8_t *dst_row, 
unsigned dst_stride,
 void
 util_format_nv21_fetch_rgba_float(float *dst, const uint8_t *src,
  unsigned i, unsigned j) {}
+
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_float(float *dst_row, unsigned 
dst_stride,
+ const uint8_t *src_row, unsigned 
src_stride,
+ unsigned width, unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned 
dst_stride,
+  const uint8_t *src_row, unsigned 
src_stride,
+  unsigned width, unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned 
dst_stride,
+   const float *src_row, unsigned 
src_stride,
+   unsigned width, unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned 
dst_stride,
+const uint8_t *src_row, unsigned 
src_stride,
+unsigned width, unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+unsigned i, unsigned j) {}
+
+void
+util_format_g8r8_b8r8_unorm_unpack_rgba_float(float *dst_row, unsigned 
dst_stride,
+ const uint8_t *src_row, unsigned 
src_stride,
+ unsigned width, unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned 
dst_stride,
+  const uint8_t *src_row, unsigned 
src_stride,
+  unsigned width, unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned 
dst_stride,
+   const float *src_row, unsigned 
src_stride,
+   unsigned width, unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned 
dst_stride,
+const uint8_t *src_row, unsigned 
src_stride,
+unsigned width, unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+unsigned i, unsigned j) {}
diff --git a/src/gallium/auxiliary/util/u_format_yuv.h 
b/src/gallium/auxiliary/util/u_format_yuv.h
index 4cb22df..4ec3981 100644
--- a/src/gallium/auxiliary/util/u_format_yuv.h
+++ b/src/gallium/auxiliary/util/u_format_yuv.h
@@ -313,6 +313,52 @@ void
 util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
 unsigned i, unsigned j);
 
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_float(float *dst_row, unsigned 
dst_stride,
+ const uint8_t *src_row, unsigned 
src_stride,
+ unsigned width, unsigned height);
+
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned 
dst_stride,
+  const uint8_t *src_row, unsigned 
src_stride,
+  

[Mesa-dev] [PATCH 4/9] r600g: add support for subsampled rgb formats

2012-03-08 Thread Christian König
v2: r600 formats are msb first!

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/drivers/r600/r600_texture.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index 923efce..ce66117 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -1135,6 +1135,21 @@ uint32_t r600_translate_texformat(struct pipe_screen 
*screen,
}
}
 
+   if (desc-layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
+   switch (format) {
+   case PIPE_FORMAT_R8G8_B8G8_UNORM:
+   case PIPE_FORMAT_G8R8_B8R8_UNORM:
+   result = FMT_GB_GR;
+   goto out_word4;
+   case PIPE_FORMAT_G8R8_G8B8_UNORM:
+   case PIPE_FORMAT_R8G8_R8B8_UNORM:
+   result = FMT_BG_RG;
+   goto out_word4;
+   default:
+   goto out_unknown;
+   }
+   }
+
if (format == PIPE_FORMAT_R9G9B9E5_FLOAT) {
result = FMT_5_9_9_9_SHAREDEXP;
goto out_word4;
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 5/9] vl/video_buffer: add YUYV and UYVY support

2012-03-08 Thread Christian König
This gets xine working with VDPAU.

v2: some minor bugfixes.
v3: create the resource with the subsampled
format to avoid tilling problems

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/auxiliary/vl/vl_video_buffer.c |   53 ---
 1 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c 
b/src/gallium/auxiliary/vl/vl_video_buffer.c
index df21769..400463c 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -62,6 +62,18 @@ const enum pipe_format const_resource_formats_VUYA[3] = {
PIPE_FORMAT_NONE
 };
 
+const enum pipe_format const_resource_formats_YUYV[3] = {
+   PIPE_FORMAT_R8G8_R8B8_UNORM,
+   PIPE_FORMAT_NONE,
+   PIPE_FORMAT_NONE
+};
+
+const enum pipe_format const_resource_formats_UYVY[3] = {
+   PIPE_FORMAT_G8R8_B8R8_UNORM,
+   PIPE_FORMAT_NONE,
+   PIPE_FORMAT_NONE
+};
+
 const unsigned const_resource_plane_order_YUV[3] = {
0,
1,
@@ -90,6 +102,12 @@ vl_video_buffer_formats(struct pipe_screen *screen, enum 
pipe_format format)
case PIPE_FORMAT_B8G8R8A8_UNORM:
   return const_resource_formats_VUYA;
 
+   case PIPE_FORMAT_YUYV:
+  return const_resource_formats_YUYV;
+
+   case PIPE_FORMAT_UYVY:
+  return const_resource_formats_UYVY;
+
default:
   return NULL;
}
@@ -98,13 +116,15 @@ vl_video_buffer_formats(struct pipe_screen *screen, enum 
pipe_format format)
 const unsigned *
 vl_video_buffer_plane_order(enum pipe_format format)
 {
-switch(format) {
+   switch(format) {
case PIPE_FORMAT_YV12:
   return const_resource_plane_order_YVU;
 
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_YUYV:
+   case PIPE_FORMAT_UYVY:
   return const_resource_plane_order_YUV;
 
default:
@@ -112,6 +132,16 @@ vl_video_buffer_plane_order(enum pipe_format format)
}
 }
 
+static enum pipe_format
+vl_video_buffer_surface_format(enum pipe_format format)
+{
+   /* a subsampled formats can't work as surface use RGBA instead */
+   if (util_format_is_subsampled(format))
+  return PIPE_FORMAT_R8G8B8A8_UNORM;
+
+   return format;
+}
+
 boolean
 vl_video_buffer_is_format_supported(struct pipe_screen *screen,
 enum pipe_format format,
@@ -125,10 +155,17 @@ vl_video_buffer_is_format_supported(struct pipe_screen 
*screen,
   return false;
 
for (i = 0; i  VL_NUM_COMPONENTS; ++i) {
-  if (!resource_formats[i])
+  enum pipe_format format = resource_formats[i];
+
+  if (format == PIPE_FORMAT_NONE)
  continue;
 
-  if (!screen-is_format_supported(screen, resource_formats[i], 
PIPE_TEXTURE_2D, 0, PIPE_USAGE_STATIC))
+  /* we at least need to sample from it */
+  if (!screen-is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 
PIPE_BIND_SAMPLER_VIEW))
+ return false;
+
+  format = vl_video_buffer_surface_format(format);
+  if (!screen-is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 
PIPE_BIND_RENDER_TARGET))
  return false;
}
 
@@ -262,6 +299,7 @@ vl_video_buffer_sampler_view_components(struct 
pipe_video_buffer *buffer)
struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer;
struct pipe_sampler_view sv_templ;
struct pipe_context *pipe;
+   const enum pipe_format *sampler_format;
const unsigned *plane_order;
unsigned i, j, component;
 
@@ -269,18 +307,21 @@ vl_video_buffer_sampler_view_components(struct 
pipe_video_buffer *buffer)
 
pipe = buf-base.context;
 
+   sampler_format = vl_video_buffer_formats(pipe-screen, 
buf-base.buffer_format);
plane_order = vl_video_buffer_plane_order(buf-base.buffer_format);
 
for (component = 0, i = 0; i  buf-num_planes; ++i ) {
   struct pipe_resource *res = buf-resources[plane_order[i]];
   unsigned nr_components = util_format_get_nr_components(res-format);
+  if (util_format_is_subsampled(res-format))
+ nr_components = 3;
 
   for (j = 0; j  nr_components; ++j, ++component) {
  assert(component  VL_NUM_COMPONENTS);
 
  if (!buf-sampler_view_components[component]) {
 memset(sv_templ, 0, sizeof(sv_templ));
-u_sampler_view_default_template(sv_templ, res, res-format);
+u_sampler_view_default_template(sv_templ, res, 
sampler_format[plane_order[i]]);
 sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = 
PIPE_SWIZZLE_RED + j;
 sv_templ.swizzle_a = PIPE_SWIZZLE_ONE;
 buf-sampler_view_components[component] = 
pipe-create_sampler_view(pipe, res, sv_templ);
@@ -289,6 +330,7 @@ vl_video_buffer_sampler_view_components(struct 
pipe_video_buffer *buffer)
  }
   }
}
+   assert(component == VL_NUM_COMPONENTS);
 
return buf-sampler_view_components;
 
@@ -323,7 +365,7 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer)
 
 

[Mesa-dev] [PATCH 6/9] st/vdpau: add xine workaround

2012-03-08 Thread Christian König
For reasons I don't understand xine tries to set
the surface format by using a zero pitch.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/state_trackers/vdpau/surface.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/surface.c 
b/src/gallium/state_trackers/vdpau/surface.c
index 9162602..c829c1f 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -292,7 +292,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
 
for (i = 0; i  3; ++i) {
   struct pipe_sampler_view *sv = sampler_views[i];
-  if (!sv) continue;
+  if (!sv || !source_pitches[i]) continue;
 
   for (j = 0; j  sv-texture-depth0; ++j) {
  struct pipe_box dst_box = {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 7/9] st/vdpau: fix two small memory leaks

2012-03-08 Thread Christian König
Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/state_trackers/vdpau/device.c |4 ++--
 src/gallium/state_trackers/vdpau/output.c |4 
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/device.c 
b/src/gallium/state_trackers/vdpau/device.c
index 5af1570..2e38f6c 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -292,8 +292,8 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct 
pipe_surface *surface, str
   struct pipe_sampler_view sv_templ;
 
   vlVdpDefaultSamplerViewTemplate(sv_templ, res);
-  pipe_sampler_view_reference(vlsurface-sampler_view,
- dev-context-create_sampler_view(dev-context, res, sv_templ));
+  pipe_sampler_view_reference(vlsurface-sampler_view, NULL);
+  vlsurface-sampler_view = 
dev-context-create_sampler_view(dev-context, res, sv_templ);
}
 
return;
diff --git a/src/gallium/state_trackers/vdpau/output.c 
b/src/gallium/state_trackers/vdpau/output.c
index 7e3d74d..5b25e63 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -133,16 +133,20 @@ VdpStatus
 vlVdpOutputSurfaceDestroy(VdpOutputSurface surface)
 {
vlVdpOutputSurface *vlsurface;
+   struct pipe_context *pipe;
 
vlsurface = vlGetDataHTAB(surface);
if (!vlsurface)
   return VDP_STATUS_INVALID_HANDLE;
 
+   pipe = vlsurface-device-context;
+
pipe_mutex_lock(vlsurface-device-mutex);
vlVdpResolveDelayedRendering(vlsurface-device, NULL, NULL);
 
pipe_surface_reference(vlsurface-surface, NULL);
pipe_sampler_view_reference(vlsurface-sampler_view, NULL);
+   pipe-screen-fence_reference(pipe-screen, vlsurface-fence, NULL);
vl_compositor_cleanup_state(vlsurface-cstate);
pipe_mutex_unlock(vlsurface-device-mutex);
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 8/9] vl/mpeg12: make bitstream decoder more robust

2012-03-08 Thread Christian König
Just another xine workaround.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c |2 ++
 src/gallium/auxiliary/vl/vl_vlc.h  |1 -
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c 
b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index f0ad2e4..2358046 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
@@ -825,6 +825,8 @@ decode_slice(struct vl_mpg12_bs *bs, struct 
pipe_video_buffer *target)
   }
   inc += vl_vlc_get_vlclbf(bs-vlc, tbl_B1, 11);
   if (x != -1) {
+ if (!inc)
+return;
  mb.num_skipped_macroblocks = inc - 1;
  bs-decoder-decode_macroblock(bs-decoder, target, bs-desc-base, 
mb.base, 1);
   }
diff --git a/src/gallium/auxiliary/vl/vl_vlc.h 
b/src/gallium/auxiliary/vl/vl_vlc.h
index baaa48a..6223fab 100644
--- a/src/gallium/auxiliary/vl/vl_vlc.h
+++ b/src/gallium/auxiliary/vl/vl_vlc.h
@@ -271,7 +271,6 @@ vl_vlc_get_vlclbf(struct vl_vlc *vlc, const struct 
vl_vlc_entry *tbl, unsigned n
 {
tbl += vl_vlc_peekbits(vlc, num_bits);
vl_vlc_eatbits(vlc, tbl-length);
-   assert(tbl-length);
return tbl-value;
 }
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 9/9] vl: handle DRI2GetBuffers reply with multiple buffers

2012-03-08 Thread Christian König
This fixes a crash in XBMC, but we still doesn't see a picture.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/winsys/g3dvl/dri/dri_winsys.c |   33 
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/gallium/winsys/g3dvl/dri/dri_winsys.c 
b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
index c65c82c..afaabaa 100644
--- a/src/gallium/winsys/g3dvl/dri/dri_winsys.c
+++ b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
@@ -171,11 +171,13 @@ vl_screen_texture_from_drawable(struct vl_screen 
*vscreen, Drawable drawable)
 {
struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
 
-   struct winsys_handle dri2_front_handle;
+   struct winsys_handle dri2_handle;
struct pipe_resource template, *tex;
 
xcb_dri2_get_buffers_reply_t *reply;
-   xcb_dri2_dri2_buffer_t *buffers;
+   xcb_dri2_dri2_buffer_t *buffers, *back_left;
+
+   unsigned i;
 
assert(scrn);
 
@@ -189,28 +191,39 @@ vl_screen_texture_from_drawable(struct vl_screen 
*vscreen, Drawable drawable)
if (!reply)
   return NULL;
 
-   assert(reply-count == 1);
buffers = xcb_dri2_get_buffers_buffers(reply);
if (!buffers)  {
   free(reply);
   return NULL;
}
 
+   for (i = 0; i  reply-count; ++i) {
+  if (buffers[i].attachment == XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT) {
+ back_left = buffers[i];
+ break;
+  }
+   }
+
+   if (i == reply-count) {
+  free(reply);
+  return NULL;
+   }
+
if (reply-width != scrn-width || reply-height != scrn-height) {
   vl_compositor_reset_dirty_area(scrn-dirty_areas[0]);
   vl_compositor_reset_dirty_area(scrn-dirty_areas[1]);
   scrn-width = reply-width;
   scrn-height = reply-height;
 
-   } else if (buffers[0].name != scrn-buffer_names[scrn-current_buffer]) {
+   } else if (back_left-name != scrn-buffer_names[scrn-current_buffer]) {
   vl_compositor_reset_dirty_area(scrn-dirty_areas[scrn-current_buffer]);
-  scrn-buffer_names[scrn-current_buffer] = buffers[0].name;
+  scrn-buffer_names[scrn-current_buffer] = back_left-name;
}
 
-   memset(dri2_front_handle, 0, sizeof(dri2_front_handle));
-   dri2_front_handle.type = DRM_API_HANDLE_TYPE_SHARED;
-   dri2_front_handle.handle = buffers[0].name;
-   dri2_front_handle.stride = buffers[0].pitch;
+   memset(dri2_handle, 0, sizeof(dri2_handle));
+   dri2_handle.type = DRM_API_HANDLE_TYPE_SHARED;
+   dri2_handle.handle = back_left-name;
+   dri2_handle.stride = back_left-pitch;
 
memset(template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
@@ -224,7 +237,7 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, 
Drawable drawable)
template.bind = PIPE_BIND_RENDER_TARGET;
template.flags = 0;
 
-   tex = scrn-base.pscreen-resource_from_handle(scrn-base.pscreen, 
template, dri2_front_handle);
+   tex = scrn-base.pscreen-resource_from_handle(scrn-base.pscreen, 
template, dri2_handle);
free(reply);
 
return tex;
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH] svga: Check vs and fs pointer when updating states.

2012-03-08 Thread Vic Lee

Hi Brian,

Please the the gdb backtrace if I only add vs check. Maybe you have a 
better idea on this issue. I am using the git 8.0 branch.



vic@debian:~/mesa/src/gallium$ git diff
diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c 
b/src/gallium/drivers/svga/svga_state_need_swtnl.c

index 8c39a4b..3b193c0 100644
--- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -136,7 +136,7 @@ update_need_pipeline( struct svga_context *svga,

/* EDGEFLAGS
 */
-if (vs-base.info.writes_edgeflag) {
+   if (vs  vs-base.info.writes_edgeflag) {
   SVGA_DBG(DEBUG_SWTNL, %s: edgeflags\n, __FUNCTION__);
   need_pipeline = TRUE;
}
vic@debian:~/mesa/src/gallium$ gdb ./test
GNU gdb (GDB) 7.4-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as x86_64-linux-gnu.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/vic/mesa/src/gallium/test...done.
(gdb) r
Starting program: /home/vic/mesa/src/gallium/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1.

Program received signal SIGSEGV, Segmentation fault.
0x004476e0 in update_need_pipeline (svga=0x124eed0, 
dirty=4294967295) at svga_state_need_swtnl.c:148

148   unsigned generic_inputs = svga-curr.fs-generic_inputs;
(gdb) bt
#0  0x004476e0 in update_need_pipeline (svga=0x124eed0, 
dirty=4294967295) at svga_state_need_swtnl.c:148
#1  0x00446f37 in update_state (svga=0x124eed0, atoms=0x118ab80, 
state=0x12534d8) at svga_state.c:154
#2  0x0044715d in svga_update_state (svga=0x124eed0, 
max_level=1) at svga_state.c:209
#3  0x00441fc0 in try_clear (svga=0x124eed0, buffers=1, 
color=0x7fffe500, depth=0, stencil=1) at svga_pipe_clear.c:51
#4  0x0044221f in svga_clear (pipe=0x124eed0, buffers=1, 
color=0x7fffe500, depth=0, stencil=1) at svga_pipe_clear.c:118

#5  0x0042dd0e in main (argc=1, argv=0x7fffe718) at test.c:97
(gdb)

On 03/08/2012 01:34 AM, Brian Paul wrote:

On 03/07/2012 10:01 AM, Vic Lee wrote:

Hi Brian,

On 03/07/2012 11:44 PM, Brian Paul wrote:

On 03/07/2012 01:08 AM, Vic Lee wrote:

Hi Brian,

I created a smallest possible test case to reproduce the segfault, as
attached.


OK, I was assuming that you found this with an OpenGL program, not with
a custom direct-to-gallium program.

Right, we are experimenting our custom application on VMware platform
which communicates to the driver directly through gallium interface.


Please see file header on how I compile it. vs and fs both
needs to be checked to avoid the segfault.


Hmmm, I only needed to add the null vs check to prevent the segfault.
Are you sure about the fs check? We only use svga-curr.fs when
assigning to the generic_inputs var and we check for a null pointer
there.

Yes, I tried the test case I sent. Without the fs check it will still
segfaults.


Where exactly is the segfault? I'd like to fully understand this before
making the change.

-Brian


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


[Mesa-dev] [Bug 45277] [bisected] Shading not working properly in Heroes of Newerth

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

Damien Grassart dam...@grassart.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #6 from Damien Grassart dam...@grassart.com 2012-03-08 09:13:07 
PST ---
Thanks, it's also working for me as well now so changing status to resolved.

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


[Mesa-dev] [Bug 47066] glxinfo says nouveau on dual seat when on a monitor drived by a radeon card

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

--- Comment #13 from diego.abele...@gmail.com 2012-03-08 10:48:23 PST ---
Ok,
So when I start DISPLAY=:0 glxinfo I get both screens first the nouveau
screen (0) then the radeon one (1).
when I start DISPLAY=:0.0 glxinfo -b I get 33
when I start DISPLAY=:0.1 glxinfo -b I get 33
with the patch applied when I do DISPLAY=:0.0 glxinfo I get both screens
listed (correctly just as before when I used DISPLAY=:0). In fact it is nearly
the same output as DISPLAY=:0 glxinfo except for the first line where after
name of display it shows :0 or :0.0 Was it intended ?

(personnally if I ask for one specific screen I don't care about the other
ones... but it is true that when starting glxinfo without changing DISPLAY
variable it gets as default value the current screen I you can't tell if there
are others, so I guess it is ok this way)

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


Re: [Mesa-dev] [PATCH 1/9] st/vdpau: fix chroma_format handling in VideoSurfaceQueryGetPutBitsYCbCrCapabilities

2012-03-08 Thread Andy Furniss

Christian König wrote:


mplayer sw decode + yuy2 vdpau output is corrupted.

Yeah, still working on that. The problem is tilling related, just
disable 2D tilling and it works like a charm. I think I've found the
problem right now and going to send out some fixed patches in the next
couple of minutes.


Working OK for me now with xine and mplayer using your vlwork git, which 
I assume is the same as applying the latest patches.


Is there a way to disable mesa 2D tiling anymore? I know about the 
xorg.conf options but they don't seem to affect mesa.



Unfortunately mplayer just doesn't tries to use a planar 422 format
(something which is really easy to support).


I think mplayer's vdpau was written by nvidia, so maybe it assumes 
things - but then I don't know that. I do know it blindly tries to use 
yuy2 even if it's not advertised.


One thing I noticed looking at the vdpau spec on their doxygen site is 
that YUY16 isn't even listed.


When -vo gl is used mplayer will directly use 422 planar (which I assume 
is what fourcc.org calles YV16).


As for xine my current issues are the logo, mine is playing

share/xine/skins/xine-ui_logo.png with plugin gdkpixbuf

Before 422 worked properly it was distorted, now it's almost OK, but has 
a green band at the bottom. If I toggle between full screen and window a 
few times I can get it to crash - bt attached.
It works OK with xv, and actually playing a raw 422 yuy2 stream with 
xine + vdpau looks OK and won't crash toggling (it is different size 
though).



Issue 2 is that doing something that makes xine try to render over the 
video eg. skipping or changing volume results in an assert -


vl/vl_video_buffer.c:320:vl_video_buffer_sampler_view_components: 
Assertion `component  3' failed.


bt also attached.





Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb4b55b90 (LWP 2837)]
0xb73e3b6c in memcpy () from /lib/libc.so.6
(gdb) bt full
#0  0xb73e3b6c in memcpy () from /lib/libc.so.6
No symbol table info available.
#1  0xb53ced5c in util_copy_rect (dst=0xabd62400 Address 0xabd62400 out of 
bounds, format=PIPE_FORMAT_R8G8_R8B8_UNORM, dst_stride=1536, dst_x=0, dst_y=0, 
width=1216, height=464, src=0xababd000 Address 0xababd000 out of bounds, 
src_stride=1216, src_x=0, src_y=0) at util/u_rect.c:83
i = 2882938720
__FUNCTION__ = util_copy_rect
#2  0xb53d4ede in u_default_transfer_inline_write (pipe=0x951e1a0, 
resource=0x961ae98, level=0, usage=value optimized out, box=0xb4b550b4, 
data=0xaba36020, stride=1216, layer_stride=0) at util/u_transfer.c:57
src_data = (const uint8_t *) 0xaba36020 
i = 1
transfer = (struct pipe_transfer *) 0x96188e0
map = (uint8_t *) 0xabcb8000 Address 0xabcb8000 out of bounds
__FUNCTION__ = u_default_transfer_inline_write
#3  0xb537b801 in vlVdpVideoSurfacePutBitsYCbCr (surface=33, 
source_ycbcr_format=3, source_data=0xb4b551f0, source_pitches=0xb4b551fc) at 
surface.c:303
dst_box = {x = 0, y = 0, z = 0, width = 608, height = 464, depth = 1}
sv = (struct pipe_sampler_view *) 0x96fde38
pformat = value optimized out
pipe = (struct pipe_context *) 0x951e1a0
sampler_views = (struct pipe_sampler_view **) 0x972d374
j = 1
#4  0xb5646e4f in guarded_vdp_video_surface_putbits_ycbcr (surface=33, 
source_ycbcr_format=3, source_data=0xb4b551f0, source_pitches=0xb4b551fc) at 
video_out_vdpau.c:203
r = VDP_STATUS_OK
#5  0xb564b384 in vdpau_display_frame (this_gen=0x951b770, frame_gen=0x96374d8) 
at video_out_vdpau.c:1790
pitches = {1216, 0, 0}
data = {0xaba36020, 0x0, 0x0}
this = (vdpau_driver_t *) 0x951b770
frame = (vdpau_frame_t *) 0x96374d8
st = VDP_STATUS_OK
surface = 3075176270
chroma = 1
color_standard = 0
mix_w = 608
mix_h = 452
stream_speed = 251933843756417025
redraw_needed = 0
layer_count = 2837
layer = (VdpLayer *) 0x951b770
ovl_layer = {struct_version = 1431655765, source_surface = 1073042773, 
source_rect = 0x504ac9, destination_rect = 0xb74b62fe}
vid_dest = (VdpRect *) 0xb4b552b8
vid_dest_rect = {x0 = 0, y0 = 15, x1 = 156350320, y1 = 4294967280}
vid_source = {x0 = 157504732, y0 = 129, x1 = 3075190796, y1 = 0}
out_dest = {x0 = 157504696, y0 = 157504696, x1 = 3031782024, y1 = 
3077508823}
frame_duration = -1217233232
non_progressive = 157504504
last_time = 13218767150665171072
#6  0xb76e7dd7 in overlay_and_display_frame (this=0x96350d0, img=0x96374d8, 
vpts=5262025) at video_out.c:1370
ite = value optimized out
#7  0xb76e8ca3 in video_out_loop (this_gen=0x96350d0) at video_out.c:1545
vpts = 5262025
img = (vo_frame_t *) 0x96374d8
this = (vos_t *) 0x1c7
next_frame_vpts = 5261925
usec_to_sleep = value optimized out
disable_decoder_flush_from_video_out = 0
#8  0xb74b4120 in 

[Mesa-dev] [Bug 46679] glReadPixels on a luminance texture returns the wrong values

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

Anuj Phogat anuj.pho...@gmail.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 AssignedTo|mesa-dev@lists.freedesktop. |anuj.pho...@gmail.com
   |org |

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


[Mesa-dev] [PATCH 1/3] st/egl: Hook up eglSwapInterval

2012-03-08 Thread Fredrik Höglund
---
 .../state_trackers/egl/common/egl_g3d_api.c|   21 
 src/gallium/state_trackers/egl/common/native.h |5 
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 58e772f..0d45bec 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -308,6 +308,10 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLConfig *conf,
   return NULL;
}
 
+   /* Initialize the swap interval */
+   if (nsurf-swap_interval)
+  nsurf-swap_interval(nsurf, gsurf-base.SwapInterval);
+
nsurf-user_data = gsurf-base;
gsurf-native = nsurf;
 
@@ -655,6 +659,22 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surf,
 }
 
 static EGLBoolean
+egl_g3d_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, 
EGLint interval)
+{
+   interval = CLAMP(interval, surf-Config-MinSwapInterval, 
surf-Config-MaxSwapInterval);
+
+   if (surf-SwapInterval != interval) {
+  struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+  surf-SwapInterval = interval;
+
+  if (gsurf-native  gsurf-native-swap_interval)
+ return gsurf-native-swap_interval(gsurf-native, interval);
+   }
+
+   return EGL_TRUE;
+}
+
+static EGLBoolean
 egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
 {
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
@@ -892,6 +912,7 @@ egl_g3d_init_driver_api(_EGLDriver *drv)
drv-API.MakeCurrent = egl_g3d_make_current;
drv-API.SwapBuffers = egl_g3d_swap_buffers;
drv-API.CopyBuffers = egl_g3d_copy_buffers;
+   drv-API.SwapInterval = egl_g3d_swap_interval;
drv-API.WaitClient = egl_g3d_wait_client;
drv-API.WaitNative = egl_g3d_wait_native;
 
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 312b079..2f7f2e2 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -146,6 +146,11 @@ struct native_surface {
 * Wait until all native commands affecting the surface has been executed.
 */
void (*wait)(struct native_surface *nsurf);
+
+   /**
+* Set the surface swap interval.
+*/
+   boolean (*swap_interval)(struct native_surface *nsurf, int interval);
 };
 
 /**
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 2/3] st/egl: Implement eglSwapInterval in the X11 backend

2012-03-08 Thread Fredrik Höglund
---
 src/gallium/state_trackers/egl/x11/native_dri2.c |   20 +---
 src/gallium/state_trackers/egl/x11/x11_screen.c  |8 
 src/gallium/state_trackers/egl/x11/x11_screen.h  |4 
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 5d7d379..740bd55 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -359,9 +359,6 @@ dri2_surface_present(struct native_surface *nsurf,
 {
boolean ret;
 
-   if (ctrl-swap_interval)
-  return FALSE;
-
switch (ctrl-natt) {
case NATIVE_ATTACHMENT_FRONT_LEFT:
   ret = dri2_surface_flush_frontbuffer(nsurf);
@@ -378,6 +375,18 @@ dri2_surface_present(struct native_surface *nsurf,
 }
 
 static boolean
+dri2_surface_swap_interval(struct native_surface *nsurf, int interval)
+{
+   struct dri2_surface *dri2surf = dri2_surface(nsurf);
+   struct dri2_display *dri2dpy = dri2surf-dri2dpy;
+
+   if (dri2dpy-dri_minor = 2)
+  x11_drawable_swap_interval(dri2dpy-xscr, dri2surf-drawable, interval);
+
+   return TRUE;
+}
+
+static boolean
 dri2_surface_validate(struct native_surface *nsurf, uint attachment_mask,
   unsigned int *seq_num, struct pipe_resource **textures,
   int *width, int *height)
@@ -470,6 +479,7 @@ dri2_display_create_surface(struct native_display *ndpy,
dri2surf-base.present = dri2_surface_present;
dri2surf-base.validate = dri2_surface_validate;
dri2surf-base.wait = dri2_surface_wait;
+   dri2surf-base.swap_interval = dri2_surface_swap_interval;
 
if (drawable) {
   x11_drawable_enable_dri2(dri2dpy-xscr, drawable, TRUE);
@@ -724,6 +734,7 @@ static int
 dri2_display_get_param(struct native_display *ndpy,
enum native_param_type param)
 {
+   struct dri2_display *dri2dpy = dri2_display(ndpy);
int val;
 
switch (param) {
@@ -739,6 +750,9 @@ dri2_display_get_param(struct native_display *ndpy,
   val = TRUE;
   break;
case NATIVE_PARAM_MAX_SWAP_INTERVAL:
+  /* XXX Arbitrary value */
+  val = dri2dpy-dri_minor = 2 ? 1000 : 0;
+  break;
default:
   val = 0;
   break;
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c 
b/src/gallium/state_trackers/egl/x11/x11_screen.c
index 1e20f94..af5021d 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -381,6 +381,14 @@ x11_drawable_get_buffers(struct x11_screen *xscr, Drawable 
drawable,
return (struct x11_drawable_buffer *) dri2bufs;
 }
 
+void
+x11_drawable_swap_interval(struct x11_screen *xscr, Drawable drawable,
+   int interval)
+{
+   /* XXX Check vblank_mode? */
+   DRI2SwapInterval(xscr-dpy, drawable, interval);
+}
+
 /**
  * Create a mode list of the given size.
  */
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.h 
b/src/gallium/state_trackers/egl/x11/x11_screen.h
index ad7aa97..197e16a 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.h
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.h
@@ -129,6 +129,10 @@ x11_drawable_get_buffers(struct x11_screen *xscr, Drawable 
drawable,
  int *width, int *height, unsigned int *attachments,
  boolean with_format, int num_ins, int *num_outs);
 
+void
+x11_drawable_swap_interval(struct x11_screen *xscr, Drawable drawable,
+   int interval);
+
 #endif /* GLX_DIRECT_RENDERING */
 
 #endif /* _X11_SCREEN_H_ */
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 3/3] st/egl: Use DRI2SwapBuffers in the X11 backend

2012-03-08 Thread Fredrik Höglund
---
 src/gallium/state_trackers/egl/x11/native_dri2.c |   27 +++--
 src/gallium/state_trackers/egl/x11/x11_screen.c  |   11 +
 src/gallium/state_trackers/egl/x11/x11_screen.h  |5 
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 740bd55..34e281a 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -313,8 +313,21 @@ dri2_surface_flush_frontbuffer(struct native_surface 
*nsurf)
 }
 
 static boolean
-dri2_surface_swap_buffers(struct native_surface *nsurf, int num_rects,
-  const int *rects)
+dri2_surface_swap_buffers_msc(struct native_surface *nsurf)
+{
+   struct dri2_surface *dri2surf = dri2_surface(nsurf);
+   struct dri2_display *dri2dpy = dri2surf-dri2dpy;
+   int64_t count;
+
+   x11_drawable_swap_buffers(dri2dpy-xscr, dri2surf-drawable,
+ 0, 0, 1, count);
+
+   return count != -1;
+}
+
+static boolean
+dri2_surface_swap_buffers(struct native_surface *nsurf, boolean preserve,
+  int num_rects, const int *rects)
 {
struct dri2_surface *dri2surf = dri2_surface(nsurf);
struct dri2_display *dri2dpy = dri2surf-dri2dpy;
@@ -357,6 +370,8 @@ static boolean
 dri2_surface_present(struct native_surface *nsurf,
  const struct native_present_control *ctrl)
 {
+   struct dri2_surface *dri2surf = dri2_surface(nsurf);
+   struct dri2_display *dri2dpy = dri2surf-dri2dpy;
boolean ret;
 
switch (ctrl-natt) {
@@ -364,7 +379,13 @@ dri2_surface_present(struct native_surface *nsurf,
   ret = dri2_surface_flush_frontbuffer(nsurf);
   break;
case NATIVE_ATTACHMENT_BACK_LEFT:
-  ret = dri2_surface_swap_buffers(nsurf, ctrl-num_rects, ctrl-rects);
+  if (!ctrl-preserve  ctrl-num_rects == 0 
+  dri2surf-have_back  !dri2surf-have_fake 
+  dri2dpy-dri_minor = 2)
+ ret = dri2_surface_swap_buffers_msc(nsurf);
+  else
+ ret = dri2_surface_swap_buffers(nsurf, ctrl-preserve,
+  ctrl-num_rects, ctrl-rects);
   break;
default:
   ret = FALSE;
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c 
b/src/gallium/state_trackers/egl/x11/x11_screen.c
index af5021d..1ec2b0a 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -338,6 +338,17 @@ x11_drawable_enable_dri2(struct x11_screen *xscr,
 }
 
 /**
+ * Swap the buffers of the DRI2 drawable.
+ */
+void
+x11_drawable_swap_buffers(struct x11_screen *xscr, Drawable drawable, int64_t 
target_msc,
+  int64_t divisor, int64_t remainder, int64_t 
*swap_count)
+{
+   DRI2SwapBuffers(xscr-dpy, drawable, (CARD64)target_msc, (CARD64)divisor,
+   (CARD64)remainder, (CARD64*)swap_count);
+}
+
+/**
  * Copy between buffers of the DRI2 drawable.
  */
 void
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.h 
b/src/gallium/state_trackers/egl/x11/x11_screen.h
index 197e16a..bde359d 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.h
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.h
@@ -108,6 +108,11 @@ x11_drawable_enable_dri2(struct x11_screen *xscr,
  Drawable drawable, boolean on);
 
 void
+x11_drawable_swap_buffers(struct x11_screen *xscr, Drawable drawable,
+  int64_t target_msc, int64_t divisor,
+  int64_t remainder, int64_t *swap_count);
+
+void
 x11_drawable_copy_buffers_region(struct x11_screen *xscr, Drawable drawable,
  int num_rects, const int *rects,
  int src_buf, int dst_buf);
-- 
1.7.7.3

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


Re: [Mesa-dev] [PATCH 1/9] u_format: add util_format_is_subsampled helper function

2012-03-08 Thread Jose Fonseca
The comment fix is good. But I rather not having more of these helper 
functions. More details shortly.. 

Jose

- Original Message -
 Also fix comment about subsampled formats.
 
 Signed-off-by: Christian König deathsim...@vodafone.de
 ---
  src/gallium/auxiliary/util/u_format.h |9 -
  1 files changed, 8 insertions(+), 1 deletions(-)
 
 diff --git a/src/gallium/auxiliary/util/u_format.h
 b/src/gallium/auxiliary/util/u_format.h
 index b9ae7c1..3f47e7a 100644
 --- a/src/gallium/auxiliary/util/u_format.h
 +++ b/src/gallium/auxiliary/util/u_format.h
 @@ -54,7 +54,7 @@ enum util_format_layout {
 /**
  * Formats with sub-sampled channels.
  *
 -* This is for formats like YV12 where there is less than one
 sample per
 +* This is for formats like YVYU where there is less than one
 sample per
  * pixel.
  */
 UTIL_FORMAT_LAYOUT_SUBSAMPLED = 3,
 @@ -468,6 +468,13 @@ util_format_is_s3tc(enum pipe_format format)
  }
  
  static INLINE boolean
 +util_format_is_subsampled(enum pipe_format format)
 +{
 +   const struct util_format_description *desc =
 util_format_description(format);
 +   return desc-layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED ? TRUE :
 FALSE;
 +}
 +
 +static INLINE boolean
  util_format_is_srgb(enum pipe_format format)
  {
 const struct util_format_description *desc =
 util_format_description(format);
 --
 1.7.5.4
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] drirc: Add force_glsl_extensions_warn workaround for Unigine Heaven.

2012-03-08 Thread Kenneth Graunke
Unfortunately, Unigine Heaven 3.0 still needs this.

NOTE: This is a candidate for the 8.0 branch.

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

diff --git a/src/mesa/drivers/dri/common/drirc 
b/src/mesa/drivers/dri/common/drirc
index 59c00d7..755174a 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -6,5 +6,11 @@
 application executable=Tropics
 option name=force_glsl_extensions_warn value=true /
/application
+application executable=heaven_x86
+option name=force_glsl_extensions_warn value=true /
+   /application
+application executable=heaven_x64
+option name=force_glsl_extensions_warn value=true /
+   /application
 /device
 /driconf
-- 
1.7.7.6

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


Re: [Mesa-dev] [PATCH 5/9] vl/video_buffer: add YUYV and UYVY support

2012-03-08 Thread Jose Fonseca


- Original Message -
 This gets xine working with VDPAU.
 
 v2: some minor bugfixes.
 v3: create the resource with the subsampled
 format to avoid tilling problems
 
 Signed-off-by: Christian König deathsim...@vodafone.de
[...]
 @@ -269,18 +307,21 @@ vl_video_buffer_sampler_view_components(struct
 pipe_video_buffer *buffer)
  
 pipe = buf-base.context;
  
 +   sampler_format = vl_video_buffer_formats(pipe-screen,
 buf-base.buffer_format);
 plane_order =
 vl_video_buffer_plane_order(buf-base.buffer_format);
  
 for (component = 0, i = 0; i  buf-num_planes; ++i ) {
struct pipe_resource *res = buf-resources[plane_order[i]];
unsigned nr_components =
util_format_get_nr_components(res-format);
 +  if (util_format_is_subsampled(res-format))

Please, no more of this sort of helpers functions such as  
util_format_get_nr_components() and util_format_is_subsampled() which do 
nothing more than invoking util_format_description() and read a member variable.

Please invoke util_format_description() only once here and then access any info 
as you please.

From now on I'm going to refuse any more u_format helpers that take pipe_format 
as arguments -- they appear to simplify things but in truth they just promote 
inefficient and redundant code. External functions that want to reason about 
formats should invoke util_format_description() or receive the format 
description as parameter.

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


Re: [Mesa-dev] [PATCH 6/7] mesa: Skip looking at debug environment variables when setuid.

2012-03-08 Thread Jose Fonseca
FWIW, I think that debug builds of Mesa should allow debugging options all the 
time. Secure installs should use release builds.

The added code lines are not portable, so they need to be compiled 
conditionally . At least #if !defined(_WIN32) ... #endif .

Jose 

- Original Message -
 When a driver is loaded by the setuid root X Server, you don't want
 the debug flags to apply in case they can be used for nefarious
 purposes.
 ---
  src/mesa/main/imports.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)
 
 diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
 index 82713a1..f371c7a 100644
 --- a/src/mesa/main/imports.c
 +++ b/src/mesa/main/imports.c
 @@ -49,6 +49,7 @@
  #include mtypes.h
  #include version.h
  
 +#include unistd.h
  #ifdef _GNU_SOURCE
  #include locale.h
  #ifdef __APPLE__
 @@ -726,6 +727,9 @@ _mesa_bsearch( const void *key, const void *base,
 size_t nmemb, size_t size,
  char *
  _mesa_getenv( const char *var )
  {
 +   if (geteuid() != getuid())
 +  return NULL;
 +
  #if defined(_XBOX) || defined(_WIN32_WCE)
 return NULL;
  #else
 --
 1.7.9.1
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 37274] Crash in draw_llvm_shader23 (r300g, rs690, in warzone2100)

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

--- Comment #6 from rodrigo2kpere...@gmail.com 2012-03-08 18:22:09 PST ---
Created attachment 58214
  -- https://bugs.freedesktop.org/attachment.cgi?id=58214
RS740 debug info

Same bug on radeon 2100 integrated video (RS740). I don't know how I can help
sending debug info, hope this helps. Ask me for more debug information if you
want. Warzone 2100 crashes when scenario begin moving on the screen if
shadows in video options are enable. Or crashes without shadows generally
when you switch between design mode or breefing mode screens clicking on
icons of this modes.

$ export GALLIUM_DUMP_CPU=1
$ glxinfo 
name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, 
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, 
GLX_OML_swap_method, GLX_SGI_make_current_read, GLX_SGI_swap_control, 
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
GLX_SGIX_visual_select_group, GLX_INTEL_swap_event
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_framebuffer_sRGB, 
GLX_MESA_copy_sub_buffer, GLX_MESA_multithread_makecurrent, 
GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control, 
GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync, 
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap, 
GLX_INTEL_swap_event
GLX version: 1.4
GLX extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context, 
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, 
GLX_MESA_multithread_makecurrent, GLX_MESA_swap_control, 
GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGI_make_current_read, 
GLX_SGI_swap_control, GLX_SGI_video_sync, GLX_SGIS_multisample, 
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, 
GLX_EXT_texture_from_pixmap
OpenGL vendor string: X.Org R300 Project
OpenGL renderer string: Gallium 0.4 on ATI RS740
OpenGL version string: 2.1 Mesa 7.11.2
OpenGL shading language version string: 1.20
OpenGL extensions:
GL_ARB_multisample, GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color, 
GL_EXT_blend_logic_op, GL_EXT_blend_minmax, GL_EXT_blend_subtract, 
GL_EXT_copy_texture, GL_EXT_polygon_offset, GL_EXT_subtexture, 
GL_EXT_texture_object, GL_EXT_vertex_array, GL_EXT_compiled_vertex_array, 
GL_EXT_texture, GL_EXT_texture3D, GL_IBM_rasterpos_clip, 
GL_ARB_point_parameters, GL_EXT_draw_range_elements, GL_EXT_packed_pixels, 
GL_EXT_point_parameters, GL_EXT_rescale_normal, 
GL_EXT_separate_specular_color, GL_EXT_texture_edge_clamp, 
GL_SGIS_generate_mipmap, GL_SGIS_texture_border_clamp, 
GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod, GL_ARB_multitexture, 
GL_IBM_multimode_draw_arrays, GL_IBM_texture_mirrored_repeat, 
GL_ARB_texture_cube_map, GL_ARB_texture_env_add, GL_ARB_transpose_matrix, 
GL_EXT_blend_func_separate, GL_EXT_fog_coord, GL_EXT_multi_draw_arrays, 
GL_EXT_secondary_color, GL_EXT_texture_env_add, 
GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias, 
GL_INGR_blend_func_separate, GL_NV_blend_square, GL_NV_light_max_exponent, 
GL_NV_texgen_reflection, GL_NV_texture_env_combine4, 
GL_SUN_multi_draw_arrays, GL_ARB_texture_border_clamp, 
GL_ARB_texture_compression, GL_EXT_framebuffer_object, 
GL_EXT_texture_env_dot3, GL_MESA_window_pos, GL_NV_packed_depth_stencil, 
GL_NV_texture_rectangle, GL_ARB_depth_texture, GL_ARB_occlusion_query, 
GL_ARB_shadow, GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar, 
GL_ARB_texture_env_dot3, GL_ARB_texture_mirrored_repeat, 
GL_ARB_window_pos, GL_EXT_stencil_two_side, GL_EXT_texture_cube_map, 
GL_APPLE_packed_pixels, GL_APPLE_vertex_array_object, GL_ARB_draw_buffers, 
GL_ARB_fragment_program, GL_ARB_fragment_shader, GL_ARB_shader_objects, 
GL_ARB_vertex_program, GL_ARB_vertex_shader, GL_ATI_draw_buffers, 
GL_ATI_texture_env_combine3, GL_ATI_texture_float, GL_EXT_shadow_funcs, 
GL_EXT_stencil_wrap, GL_MESA_pack_invert, GL_MESA_ycbcr_texture, 
GL_NV_primitive_restart, GL_ARB_fragment_program_shadow, 
GL_ARB_half_float_pixel, GL_ARB_occlusion_query2, GL_ARB_point_sprite, 
GL_ARB_shading_language_100, GL_ARB_sync, GL_ARB_texture_non_power_of_two, 
GL_ARB_vertex_buffer_object, GL_ATI_blend_equation_separate, 
GL_EXT_blend_equation_separate, GL_OES_read_format, 
GL_ARB_pixel_buffer_object, GL_ARB_texture_float, 
GL_ARB_texture_rectangle, GL_ATI_texture_compression_3dc, 
GL_EXT_pixel_buffer_object, 

[Mesa-dev] [PATCH] mesa: fix GL_LUMINANCE handling in glGetTexImage

2012-03-08 Thread Brian Paul
There are several cases in which we need to explicity rebase colors
(ex: set G=B=0) when getting GL_LUMINANCE textures:
1. If the luminance texture is actually stored as rgba
2. If getting a luminance texture, but returning rgba
3. If getting an rgba texture, but returning luminance

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=46679

Also fixes the new piglit getteximage-luminance test.
---
 src/mesa/main/texgetimage.c |   30 --
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 44a828a..05b052a 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -298,6 +298,8 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint 
dimensions,
const gl_format texFormat =
   _mesa_get_srgb_format_linear(texImage-TexFormat);
const GLuint width = texImage-Width;
+   const GLenum destBaseFormat = _mesa_base_tex_format(ctx, format);
+   GLenum rebaseFormat = GL_NONE;
GLuint height = texImage-Height;
GLuint depth = texImage-Depth;
GLuint img, row;
@@ -318,6 +320,28 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint 
dimensions,
   height = 1;
}
 
+   if (texImage-_BaseFormat == GL_LUMINANCE ||
+   texImage-_BaseFormat == GL_INTENSITY ||
+   texImage-_BaseFormat == GL_LUMINANCE_ALPHA) {
+  /* If a luminance (or intensity) texture is read back as RGB(A), the
+   * returned value should be (L,0,0,1), not (L,L,L,1).  Set rebaseFormat
+   * here to get G=B=0.
+   */
+  rebaseFormat = texImage-_BaseFormat;
+   }
+   else if ((texImage-_BaseFormat == GL_RGBA ||
+ texImage-_BaseFormat == GL_RGB) 
+(destBaseFormat == GL_LUMINANCE ||
+ destBaseFormat == GL_LUMINANCE_ALPHA ||
+ destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
+ destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT)) {
+  /* If we're reading back an RGB(A) texture as luminance then we need
+   * to return L=tex(R).  Note, that's different from glReadPixels which
+   * returns L=R+G+B.
+   */
+  rebaseFormat = GL_LUMINANCE_ALPHA; /* this covers GL_LUMINANCE too */
+   }
+
for (img = 0; img  depth; img++) {
   GLubyte *srcMap;
   GLint rowstride;
@@ -335,12 +359,14 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint 
dimensions,
 
if (is_integer) {
   _mesa_unpack_uint_rgba_row(texFormat, width, src, rgba_uint);
-   _mesa_rebase_rgba_uint(width, rgba_uint, texImage-_BaseFormat);
+   if (rebaseFormat)
+  _mesa_rebase_rgba_uint(width, rgba_uint, rebaseFormat);
   _mesa_pack_rgba_span_int(ctx, width, rgba_uint,
format, type, dest);
} else {
   _mesa_unpack_rgba_row(texFormat, width, src, rgba);
-   _mesa_rebase_rgba_float(width, rgba, texImage-_BaseFormat);
+   if (rebaseFormat)
+  _mesa_rebase_rgba_float(width, rgba, rebaseFormat);
   _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
  format, type, dest,
  ctx-Pack, transferOps);
-- 
1.7.3.4

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


[Mesa-dev] [Bug 47124] New: libEGL.la fails during linking

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

 Bug #: 47124
   Summary: libEGL.la fails during linking
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: m...@fireburn.co.uk


Created attachment 58216
  -- https://bugs.freedesktop.org/attachment.cgi?id=58216
Build log from portage

libEGL.la fails during linking when a 64bit libglapi.so is available in
/usr/lib64 but a 32bit version isn't in /usr/lib32

It's not finding the freshly built copy

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


[Mesa-dev] [Bug 47124] libEGL.la fails during linking

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

Mike Lothian m...@fireburn.co.uk changed:

   What|Removed |Added

   Platform|Other   |x86 (IA32)
 OS/Version|All |Linux (All)
 CC||m...@fireburn.co.uk

-- 
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] i965: Enable SIMD16 mode for shaders with loops on Gen6+.

2012-03-08 Thread Kenneth Graunke
The hardware supports it; there's no reason not to.

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

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 15eae43..b4ef80b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1676,7 +1676,7 @@ fs_visitor::visit(ir_loop *ir)
 {
fs_reg counter = reg_undef;
 
-   if (c-dispatch_width == 16) {
+   if (intel-gen  6  c-dispatch_width == 16) {
   fail(Can't support (non-uniform) control flow on 16-wide\n);
}
 
-- 
1.7.7.6

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