[Mesa-dev] [PATCH 0/5] Replace RENDERINPUTS with direct GLbitfield64 usage.

2011-12-26 Thread Mathias Fröhlich

Hi,

Following a series as suggested to me by a review to a recent checkin.

The series replaces the RENDERINPUTS* macros with direct usage of GLbitfield64 
values.
The patchset is piglit quick regression tested with traditional swrast.

Due to the lack of all this old hardware to test, plenty reviews and tests are 
very welcome.

Please review.

Thanks

Mathias

Mathias Fröhlich (5):
  mesa: Convert RENDERINPUTS* macros to GLbitfield64.
  i915: Convert to use GLbitfield64 directly.
  nouveau: Convert to use GLbitfield64 directly.
  radeon: Convert to use GLbitfield64 directly.
  mesa: Convert to use GLbitfield64 directly.

 src/mesa/drivers/dri/i915/i830_context.h   |2 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c  |   24 ++---
 src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c |2 +-
 src/mesa/drivers/dri/nouveau/nv04_render.c |2 +-
 src/mesa/drivers/dri/r200/r200_swtcl.c |   35 +-
 .../drivers/dri/radeon/radeon_common_context.h |2 +-
 src/mesa/drivers/dri/radeon/radeon_swtcl.c |   38 
++--
 src/mesa/main/mtypes.h |6 +++
 src/mesa/swrast_setup/ss_context.c |   30 +++-
 src/mesa/swrast_setup/ss_context.h |2 +-
 src/mesa/tnl/t_context.c   |   20 +--
 src/mesa/tnl/t_context.h   |   19 ++
 12 files changed, 84 insertions(+), 98 deletions(-)

-- 
1.7.4.4

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


[Mesa-dev] [PATCH 2/5] i915: Convert to use GLbitfield64 directly.

2011-12-26 Thread Mathias Fröhlich
Signed-off-by: Mathias Froehlich 
---
 src/mesa/drivers/dri/i915/i830_context.h |2 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c|   24 +++-
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_context.h 
b/src/mesa/drivers/dri/i915/i830_context.h
index 4f15614..d9e2fcf 100644
--- a/src/mesa/drivers/dri/i915/i830_context.h
+++ b/src/mesa/drivers/dri/i915/i830_context.h
@@ -143,7 +143,7 @@ struct i830_context
struct intel_context intel;
 
GLuint lodbias_tm0s3[MAX_TEXTURE_UNITS];
- DECLARE_RENDERINPUTS(last_index_bitset);
+   GLbitfield64 last_index_bitset;
 
struct i830_hw_state state;
 };
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c 
b/src/mesa/drivers/dri/i915/i830_vtbl.c
index e85b2f9..513acb9 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -79,13 +79,11 @@ i830_render_start(struct intel_context *intel)
struct i830_context *i830 = i830_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
-   DECLARE_RENDERINPUTS(index_bitset);
+   GLbitfield64 index_bitset = tnl->render_inputs_bitset;
GLuint v0 = _3DSTATE_VFT0_CMD;
GLuint v2 = _3DSTATE_VFT1_CMD;
GLuint mcsb1 = 0;
 
-   RENDERINPUTS_COPY(index_bitset, tnl->render_inputs_bitset);
-
/* Important:
 */
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
@@ -94,7 +92,7 @@ i830_render_start(struct intel_context *intel)
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
 * build up a hardware vertex.
 */
-   if (RENDERINPUTS_TEST_RANGE(index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX)) 
{
+   if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)) {
   EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VFT0_XYZW);
   intel->coloroffset = 4;
}
@@ -103,33 +101,33 @@ i830_render_start(struct intel_context *intel)
   intel->coloroffset = 3;
}
 
-   if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_POINTSIZE)) {
+   if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_POINTSIZE)) {
   EMIT_ATTR(_TNL_ATTRIB_POINTSIZE, EMIT_1F, VFT0_POINT_WIDTH);
}
 
EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VFT0_DIFFUSE);
 
intel->specoffset = 0;
-   if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_COLOR1) ||
-   RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_FOG)) {
-  if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_COLOR1)) {
+   if (index_bitset & (BITFIELD64_BIT(_TNL_ATTRIB_COLOR1) |
+   BITFIELD64_BIT(_TNL_ATTRIB_FOG))) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
  intel->specoffset = intel->coloroffset + 1;
  EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VFT0_SPEC);
   }
   else
  EMIT_PAD(3);
 
-  if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_FOG))
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG))
  EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1UB_1F, VFT0_SPEC);
   else
  EMIT_PAD(1);
}
 
-   if (RENDERINPUTS_TEST_RANGE(index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX)) 
{
+   if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)) {
   int i, count = 0;
 
   for (i = 0; i < I830_TEX_UNITS; i++) {
- if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_TEX(i))) {
+ if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) {
 GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
 GLuint emit;
 GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] &
@@ -179,7 +177,7 @@ i830_render_start(struct intel_context *intel)
if (v0 != i830->state.Ctx[I830_CTXREG_VF] ||
v2 != i830->state.Ctx[I830_CTXREG_VF2] ||
mcsb1 != i830->state.Ctx[I830_CTXREG_MCSB1] ||
-   !RENDERINPUTS_EQUAL(index_bitset, i830->last_index_bitset)) {
+   index_bitset != i830->last_index_bitset) {
   int k;
 
   I830_STATECHANGE(i830, I830_UPLOAD_CTX);
@@ -198,7 +196,7 @@ i830_render_start(struct intel_context *intel)
   i830->state.Ctx[I830_CTXREG_VF] = v0;
   i830->state.Ctx[I830_CTXREG_VF2] = v2;
   i830->state.Ctx[I830_CTXREG_MCSB1] = mcsb1;
-  RENDERINPUTS_COPY(i830->last_index_bitset, index_bitset);
+  i830->last_index_bitset = index_bitset;
 
   k = i830_check_vertex_size(intel, intel->vertex_size);
   assert(k);
-- 
1.7.4.4

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


[Mesa-dev] [PATCH 1/5] mesa: Convert RENDERINPUTS* macros to GLbitfield64.

2011-12-26 Thread Mathias Fröhlich
Signed-off-by: Mathias Froehlich 
---
 src/mesa/main/mtypes.h   |6 ++
 src/mesa/tnl/t_context.h |   25 +
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 02452aa..28cf6d7 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -56,6 +56,12 @@ typedef GLuint64 GLbitfield64;
 
 /** Set a single bit */
 #define BITFIELD64_BIT(b)  ((GLbitfield64)1 << (b))
+/** Set all bits up to excluding bit b */
+#define BITFIELD64_MASK(b)  \
+   ((b) == 64 ? (~(GLbitfield64)0) : BITFIELD64_BIT(b) - 1)
+/** Set count bits starting from bit b  */
+#define BITFIELD64_RANGE(b, count) \
+   (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
 
 
 /**
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 36b1043..cdeeb1b 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -50,7 +50,6 @@
 #define _T_CONTEXT_H
 
 #include "main/glheader.h"
-#include "main/bitset.h"
 #include "main/mtypes.h"
 
 #include "math/m_vector.h"
@@ -162,6 +161,9 @@ enum {
 #define _TNL_FIRST_MAT   _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC0 */
 #define _TNL_LAST_MAT_TNL_ATTRIB_MAT_BACK_INDEXES  /* GENERIC11 */
 
+/* Number of available texture attributes */
+#define _TNL_NUM_TEX 8
+
 /* Number of available generic attributes */
 #define _TNL_NUM_GENERIC 16
 
@@ -480,17 +482,16 @@ struct tnl_device_driver
 };
 
 
-#define DECLARE_RENDERINPUTS(name) BITSET64_DECLARE(name, _TNL_ATTRIB_MAX)
-#define RENDERINPUTS_COPY BITSET64_COPY
-#define RENDERINPUTS_EQUAL BITSET64_EQUAL
-#define RENDERINPUTS_ZERO BITSET64_ZERO
-#define RENDERINPUTS_ONES BITSET64_ONES
-#define RENDERINPUTS_TEST BITSET64_TEST
-#define RENDERINPUTS_SET BITSET64_SET
-#define RENDERINPUTS_CLEAR BITSET64_CLEAR
-#define RENDERINPUTS_TEST_RANGE BITSET64_TEST_RANGE
-#define RENDERINPUTS_SET_RANGE BITSET64_SET_RANGE
-#define RENDERINPUTS_CLEAR_RANGE BITSET64_CLEAR_RANGE
+#define DECLARE_RENDERINPUTS(name) GLbitfield64 name
+#define RENDERINPUTS_COPY(x, y) do { (x) = (y); } while (0)
+#define RENDERINPUTS_EQUAL(x, y) ((x) == (y))
+#define RENDERINPUTS_ZERO(x) do { (x) = 0; } while (0)
+#define RENDERINPUTS_ONES(x) do { (x) = ~(GLbitfield64)0; } while (0)
+#define RENDERINPUTS_TEST(x, b) (((x) & BITFIELD64_BIT(b)) != 0)
+#define RENDERINPUTS_SET(x, b) ((x) |= BITFIELD64_BIT(b))
+#define RENDERINPUTS_CLEAR(x, b) ((x) &= ~BITFIELD64_BIT(b))
+#define RENDERINPUTS_TEST_RANGE(x, b, e) \
+   (((x) & BITFIELD64_RANGE((b), (e) - (b) + 1)) != 0)
 
 
 /**
-- 
1.7.4.4

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


[Mesa-dev] [PATCH 3/5] nouveau: Convert to use GLbitfield64 directly.

2011-12-26 Thread Mathias Fröhlich
Signed-off-by: Mathias Froehlich 
---
 src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c |2 +-
 src/mesa/drivers/dri/nouveau/nv04_render.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c
index f084f89..26c4c7e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c
@@ -123,7 +123,7 @@ swtnl_choose_attrs(struct gl_context *ctx)
if (!sa->fields)
continue; /* Unsupported attribute. */
 
-   if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, i)) {
+   if (tnl->render_inputs_bitset & BITFIELD64_BIT(i)) {
if (sa->fields > 0)
fields = sa->fields;
else
diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c 
b/src/mesa/drivers/dri/nouveau/nv04_render.c
index ad45093..3061ae5 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -55,7 +55,7 @@ swtnl_emit_attr(struct gl_context *ctx, struct tnl_attr_map 
*m, int attr, int em
 {
TNLcontext *tnl = TNL_CONTEXT(ctx);
 
-   if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, attr))
+   if (tnl->render_inputs_bitset & BITFIELD64_BIT(attr))
*m = (struct tnl_attr_map) {
.attrib = attr,
.format = emit,
-- 
1.7.4.4

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


[Mesa-dev] [PATCH 4/5] radeon: Convert to use GLbitfield64 directly.

2011-12-26 Thread Mathias Fröhlich
Signed-off-by: Mathias Froehlich 
---
 src/mesa/drivers/dri/r200/r200_swtcl.c |   35 +-
 .../drivers/dri/radeon/radeon_common_context.h |2 +-
 src/mesa/drivers/dri/radeon/radeon_swtcl.c |   38 
++--
 3 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c 
b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 303d3fb..25bae21 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -80,13 +80,11 @@ static void r200SetVertexFormat( struct gl_context *ctx )
r200ContextPtr rmesa = R200_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
-   DECLARE_RENDERINPUTS(index_bitset);
+   GLbitfield64 index_bitset = tnl->render_inputs_bitset;
int fmt_0 = 0;
int fmt_1 = 0;
int offset = 0;
 
-   RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
-
/* Important:
 */
if ( VB->NdcPtr != NULL ) {
@@ -103,7 +101,8 @@ static void r200SetVertexFormat( struct gl_context *ctx )
 * build up a hardware vertex.
 */
if ( !rmesa->swtcl.needproj ||
-   RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX 
)) { /* need w coord for projected textures */
+(index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)) ) {
+  /* need w coord for projected textures */
   EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F, R200_VTX_XY | R200_VTX_Z0 | 
R200_VTX_W0 );
   offset = 4;
}
@@ -112,7 +111,7 @@ static void r200SetVertexFormat( struct gl_context *ctx )
   offset = 3;
}
 
-   if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) {
+   if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_POINTSIZE)) {
   EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, R200_VTX_POINT_SIZE );
   offset += 1;
}
@@ -126,11 +125,11 @@ static void r200SetVertexFormat( struct gl_context *ctx 
)
offset += 1;
 
rmesa->swtcl.specoffset = 0;
-   if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) ||
-   RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+   if (index_bitset &
+   (BITFIELD64_BIT(_TNL_ATTRIB_COLOR1) | 
BITFIELD64_BIT(_TNL_ATTRIB_FOG))) {
 
 #if MESA_LITTLE_ENDIAN
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
 rmesa->swtcl.specoffset = offset;
 EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB, (R200_VTX_PK_RGBA << 
R200_VTX_COLOR_1_SHIFT) );
   }
@@ -138,21 +137,21 @@ static void r200SetVertexFormat( struct gl_context *ctx 
)
 EMIT_PAD( 3 );
   }
 
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) {
 EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, (R200_VTX_PK_RGBA << 
R200_VTX_COLOR_1_SHIFT) );
   }
   else {
 EMIT_PAD( 1 );
   }
 #else
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) {
 EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, (R200_VTX_PK_RGBA << 
R200_VTX_COLOR_1_SHIFT) );
   }
   else {
 EMIT_PAD( 1 );
   }
 
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
 rmesa->swtcl.specoffset = offset;
 EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, (R200_VTX_PK_RGBA << 
R200_VTX_COLOR_1_SHIFT) );
   }
@@ -162,11 +161,11 @@ static void r200SetVertexFormat( struct gl_context *ctx 
)
 #endif
}
 
-   if (RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX 
)) {
+   if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)) {
   int i;
 
   for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
+if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) {
GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size;
 
fmt_1 |= sz << (3 * i);
@@ -182,7 +181,7 @@ static void r200SetVertexFormat( struct gl_context *ctx )
   rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= R200_FOG_USE_SPEC_ALPHA;
}
 
-   if (!RENDERINPUTS_EQUAL( rmesa->radeon.tnl_index_bitset, index_bitset ) ||
+   if (rmesa->radeon.tnl_index_bitset != index_bitset ||
(rmesa->hw.vtx.cmd[VTX_VTXFMT_0] != fmt_0) ||
(rmesa->hw.vtx.cmd[VTX_VTXFMT_1] != fmt_1) ) {
   R200_NEWPRIM(rmesa);
@@ -196,7 +195,7 @@ static void r200SetVertexFormat( struct gl_context *ctx )
  rmesa->radeon.swtcl.vertex_attr_count,
  NULL, 0 );
   rmesa->radeon.swtcl.vertex_size /= 4;
-  RENDERINPUTS_COPY( rmesa->radeon.tnl_index_bitset, index_bitset );
+  rmesa->radeon.tnl_index_bitset = index_bitset;
}
 }
 
@@ -254,12 +253,12 @@ void r200ChooseVertexState( struct gl_context *ctx )
/* HW perspe

[Mesa-dev] [PATCH 5/5] mesa: Convert to use GLbitfield64 directly.

2011-12-26 Thread Mathias Fröhlich
Signed-off-by: Mathias Froehlich 
---
 src/mesa/swrast_setup/ss_context.c |   30 +-
 src/mesa/swrast_setup/ss_context.h |2 +-
 src/mesa/tnl/t_context.c   |   20 +---
 src/mesa/tnl/t_context.h   |   14 +-
 4 files changed, 24 insertions(+), 42 deletions(-)

diff --git a/src/mesa/swrast_setup/ss_context.c 
b/src/mesa/swrast_setup/ss_context.c
index 5da2e1e..9c013a4 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -118,38 +118,35 @@ setup_vertex_format(struct gl_context *ctx)
   && CHAN_TYPE != GL_FLOAT;
 
if (intColors != swsetup->intColors ||
-   !RENDERINPUTS_EQUAL(tnl->render_inputs_bitset,
-   swsetup->last_index_bitset)) {
-  DECLARE_RENDERINPUTS(index_bitset);
+   tnl->render_inputs_bitset != swsetup->last_index_bitset) {
+  GLbitfield64 index_bitset = tnl->render_inputs_bitset;
   struct tnl_attr_map map[_TNL_ATTRIB_MAX];
   unsigned int i, e = 0;
 
   swsetup->intColors = intColors;
 
-  RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset );
-
   EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] 
);
 
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR0 )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR0)) {
  if (swsetup->intColors)
 EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
  else
 EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, 
attrib[FRAG_ATTRIB_COL0]);
   }
 
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
  EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]);
   }
 
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) {
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) {
  const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : 
EMIT_1F;
  EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]);
   }
 
-  if (RENDERINPUTS_TEST_RANGE(index_bitset, _TNL_FIRST_TEX, 
_TNL_LAST_TEX))
+  if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX))
   {
  for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
-if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) {
+if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) {
EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F,
   attrib[FRAG_ATTRIB_TEX0 + i] );
 }
@@ -157,24 +154,23 @@ setup_vertex_format(struct gl_context *ctx)
   }
 
   /* shader varying vars */
-  if (RENDERINPUTS_TEST_RANGE( index_bitset,
-   _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC )) {
+  if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_GENERIC0, 
_TNL_NUM_GENERIC)) {
  for (i = 0; i < ctx->Const.MaxVarying; i++) {
-if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) {
+if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i))) {
EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE,
   attrib[FRAG_ATTRIB_VAR0 + i] );
 }
  }
   }
 
-  if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE ))
+  if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_POINTSIZE))
  EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize );
 
   _tnl_install_attrs( ctx, map, e,
   ctx->Viewport._WindowMap.m,
   sizeof(SWvertex) );
 
-  RENDERINPUTS_COPY( swsetup->last_index_bitset, index_bitset );
+  swsetup->last_index_bitset = index_bitset;
}
 }
 
@@ -195,7 +191,7 @@ _swsetup_RenderStart( struct gl_context *ctx )
}
 
if (swsetup->NewState & _NEW_PROGRAM) {
-  RENDERINPUTS_ZERO( swsetup->last_index_bitset );
+  swsetup->last_index_bitset = 0;
}
 
swsetup->NewState = 0;
@@ -259,7 +255,7 @@ _swsetup_Wakeup( struct gl_context *ctx )
_swsetup_InvalidateState( ctx, ~0 );
 
swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf;
-   RENDERINPUTS_ZERO( swsetup->last_index_bitset );
+   swsetup->last_index_bitset = 0;
 }
 
 
diff --git a/src/mesa/swrast_setup/ss_context.h 
b/src/mesa/swrast_setup/ss_context.h
index 56551ab..ecc1f5f 100644
--- a/src/mesa/swrast_setup/ss_context.h
+++ b/src/mesa/swrast_setup/ss_context.h
@@ -35,7 +35,7 @@
 typedef struct {
GLuint NewState;
GLenum render_prim;
-   DECLARE_RENDERINPUTS(last_index_bitset);
+   GLbitfield64 last_index_bitset;
SWvertex *verts;
GLboolean intColors;
 } SScontext;
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index a6da8ca..1ded44c 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -121,20 +121,19 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint 
new_state )
/* Calculate tnl->render_inputs. 

[Mesa-dev] [Bug 44151] New: glXDestroyWindow after glXDestroyContext -> Invalid read

2011-12-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44151

 Bug #: 44151
   Summary: glXDestroyWindow after glXDestroyContext -> Invalid
read
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: GLX
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: cur...@operamail.com


Created attachment 54822
  --> https://bugs.freedesktop.org/attachment.cgi?id=54822
Valgrind log

Mesa 7fd8dc3 / r600g

On exit from any Irrlicht-using app (1.7.2, any of the GL examples will do),
valgrind points out several invalid reads in r600_fence_reference.

The code in question is:
glXDestroyContext(display, Context);
if (glxWin)
glXDestroyWindow(display, glxWin);

Which is a valid order, and also used in some of the mesa demos. Valgrind
doesn't complain on those though. While this may be something irrlicht is doing
wrong, there appears to be a check missing in Mesa that allows these invalid
reads.

-- 
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 44151] glXDestroyWindow after glXDestroyContext -> Invalid read

2011-12-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44151

Lauri Kasanen  changed:

   What|Removed |Added

  Attachment #54822|application/octet-stream|text/plain
  mime type||

-- 
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] Fix build with LLVM >= r145623.

2011-12-26 Thread Johannes Obermayr
Am Dienstag, 20. Dezember 2011, 11:11:25 schrieb Michel 
=?ISO-8859-1?Q?D=E4nzer?=:
> On Mon, 2011-12-19 at 23:11 +0100, Johannes Obermayr wrote: 
> > This is a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=43861.
> > 
> > Actually the issue which makes -pedantic failing should be solved.
> 
> Maybe it should, but that's not for LLVM to enforce on its users.
> 
> 
> > ---
> >  configure.ac |2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index a4943e1..8e809b9 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1753,7 +1753,7 @@ if test "x$enable_gallium_llvm" = xyes; then
> >  
> >  if test "x$LLVM_CONFIG" != xno; then
> > LLVM_VERSION=`$LLVM_CONFIG --version`
> > -   LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed 's/-DNDEBUG\>//g'`
> > +   LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 
> > 's/-pedantic//g'`
> > LLVM_LIBS="`$LLVM_CONFIG --libs`"
> >  
> > LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
> 
> Might want to update configs/linux-llvm as well, but otherwise
> 
> Reviewed-by: Michel Dänzer 
> 
> 
> 

Will it become pushed?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] vl: call decode_bitstream only once

2011-12-26 Thread Christian König
Submit all bitstreams at once to decode_bitstream.

Signed-off-by: Christian König 
---
 src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c |5 +++--
 src/gallium/auxiliary/vl/vl_mpeg12_bitstream.h |3 ++-
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c   |6 --
 src/gallium/include/pipe/p_video_decoder.h |4 +++-
 src/gallium/state_trackers/vdpau/decode.c  |   11 +++
 5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c 
b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index 7e20d71..bd1f091 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
@@ -958,11 +958,12 @@ vl_mpg12_bs_set_picture_desc(struct vl_mpg12_bs *bs, 
struct pipe_mpeg12_picture_
 }
 
 void
-vl_mpg12_bs_decode(struct vl_mpg12_bs *bs, unsigned num_bytes, const uint8_t 
*buffer)
+vl_mpg12_bs_decode(struct vl_mpg12_bs *bs, unsigned num_buffers,
+   const void * const *buffers, const unsigned *sizes)
 {
assert(bs);
 
-   vl_vlc_init(&bs->vlc, 1, (const void * const *)&buffer, &num_bytes);
+   vl_vlc_init(&bs->vlc, num_buffers, buffers, sizes);
while (vl_vlc_bits_left(&bs->vlc) > 32) {
   uint32_t code = vl_vlc_peekbits(&bs->vlc, 32);
 
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.h 
b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.h
index c3f14a1..0ba7f43 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.h
@@ -49,6 +49,7 @@ void
 vl_mpg12_bs_set_picture_desc(struct vl_mpg12_bs *bs, struct 
pipe_mpeg12_picture_desc *picture);
 
 void
-vl_mpg12_bs_decode(struct vl_mpg12_bs *bs, unsigned num_bytes, const uint8_t 
*buffer);
+vl_mpg12_bs_decode(struct vl_mpg12_bs *bs, unsigned num_buffers,
+   const void * const *buffers, const unsigned *sizes);
 
 #endif /* vl_mpeg12_bitstream_h */
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c 
b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 2442d78..e502fc6 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -690,7 +690,9 @@ vl_mpeg12_decode_macroblock(struct pipe_video_decoder 
*decoder,
 
 static void
 vl_mpeg12_decode_bitstream(struct pipe_video_decoder *decoder,
-   unsigned num_bytes, const void *data)
+   unsigned num_buffers,
+   const void * const *buffers,
+   const unsigned *sizes)
 {
struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder *)decoder;
struct vl_mpeg12_buffer *buf;
@@ -706,7 +708,7 @@ vl_mpeg12_decode_bitstream(struct pipe_video_decoder 
*decoder,
   vl_zscan_set_layout(&buf->zscan[i], dec->picture_desc.alternate_scan ?
   dec->zscan_alternate : dec->zscan_normal);
 
-   vl_mpg12_bs_decode(&buf->bs, num_bytes, data);
+   vl_mpg12_bs_decode(&buf->bs, num_buffers, buffers, sizes);
 }
 
 static void
diff --git a/src/gallium/include/pipe/p_video_decoder.h 
b/src/gallium/include/pipe/p_video_decoder.h
index 40b7dcd..aa53589 100644
--- a/src/gallium/include/pipe/p_video_decoder.h
+++ b/src/gallium/include/pipe/p_video_decoder.h
@@ -116,7 +116,9 @@ struct pipe_video_decoder
 * decode a bitstream
 */
void (*decode_bitstream)(struct pipe_video_decoder *decoder,
-unsigned num_bytes, const void *data);
+unsigned num_buffers,
+const void * const *buffers,
+const unsigned *sizes);
 
/**
 * end decoding of the current frame
diff --git a/src/gallium/state_trackers/vdpau/decode.c 
b/src/gallium/state_trackers/vdpau/decode.c
index 47212e3..a5a01fb 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -322,7 +322,6 @@ vlVdpDecoderRenderVC1(struct pipe_video_decoder *decoder,
 {
struct pipe_vc1_picture_desc picture;
struct pipe_video_buffer *ref_frames[2] = {};
-   unsigned i;
 
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding VC-1\n");
 
@@ -385,6 +384,8 @@ vlVdpDecoderRender(VdpDecoder decoder,
uint32_t bitstream_buffer_count,
VdpBitstreamBuffer const *bitstream_buffers)
 {
+   const void * buffers[bitstream_buffer_count];
+   unsigned sizes[bitstream_buffer_count];
vlVdpDecoder *vldecoder;
vlVdpSurface *vlsurf;
VdpStatus ret;
@@ -435,9 +436,11 @@ vlVdpDecoderRender(VdpDecoder decoder,
   return ret;
 
dec->begin_frame(dec);
-   for (i = 0; i < bitstream_buffer_count; ++i)
-  dec->decode_bitstream(dec, bitstream_buffers[i].bitstream_bytes,
-   bitstream_buffers[i].bitstream);
+   for (i = 0; i < bitstream_buffer_count; ++i) {
+  buffers[i] = bitstream_buffers[i].bitstream;
+  sizes[i] = bitstream_buffers[i].bitstream_bytes;
+   }
+   dec->decode_bi

Re: [Mesa-dev] [PATCH 1/2] vl: Remove decode buffers

2011-12-26 Thread Christian König
The patch caused some problems with XvMC (try for example skipping 
forward/backwards, or just fast forward playing).

So I split it up into three separate patches and reworked the handling of 
buffers in the XvMC case, please review.

Christian.

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


[Mesa-dev] [PATCH 2/3] vl: seperate shader buffers from components

2011-12-26 Thread Christian König
Buffers for shader based decoding can now be
released without its component still being around.

Signed-off-by: Christian König 
---
 src/gallium/auxiliary/vl/vl_idct.c   |   29 ++---
 src/gallium/auxiliary/vl/vl_idct.h   |6 +---
 src/gallium/auxiliary/vl/vl_mc.c |   22 ---
 src/gallium/auxiliary/vl/vl_mc.h |6 +---
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c |   15 +++--
 src/gallium/auxiliary/vl/vl_zscan.c  |   17 +-
 src/gallium/auxiliary/vl/vl_zscan.h  |7 ++---
 7 files changed, 38 insertions(+), 64 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_idct.c 
b/src/gallium/auxiliary/vl/vl_idct.c
index a2b3537..325551a 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -614,9 +614,9 @@ init_source(struct vl_idct *idct, struct vl_idct_buffer 
*buffer)
 }
 
 static void
-cleanup_source(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+cleanup_source(struct vl_idct_buffer *buffer)
 {
-   assert(idct && buffer);
+   assert(buffer);
 
pipe_surface_reference(&buffer->fb_state_mismatch.cbufs[0], NULL);
 
@@ -665,13 +665,13 @@ error_surfaces:
 }
 
 static void
-cleanup_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+cleanup_intermediate(struct vl_idct_buffer *buffer)
 {
unsigned i;
 
-   assert(idct && buffer);
+   assert(buffer);
 
-   for(i = 0; i < idct->nr_of_render_targets; ++i)
+   for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i)
   pipe_surface_reference(&buffer->fb_state.cbufs[i], NULL);
 
pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, 
NULL);
@@ -802,8 +802,6 @@ vl_idct_init_buffer(struct vl_idct *idct, struct 
vl_idct_buffer *buffer,
 
memset(buffer, 0, sizeof(struct vl_idct_buffer));
 
-   buffer->idct = idct;
-
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, 
idct->matrix);
pipe_sampler_view_reference(&buffer->sampler_views.individual.source, 
source);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, 
idct->transpose);
@@ -823,20 +821,17 @@ vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer)
 {
assert(buffer);
 
-   cleanup_source(buffer->idct, buffer);
-   cleanup_intermediate(buffer->idct, buffer);
+   cleanup_source(buffer);
+   cleanup_intermediate(buffer);
 
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, NULL);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, 
NULL);
 }
 
 void
-vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_instances)
+vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned 
num_instances)
 {
-   struct vl_idct *idct;
assert(buffer);
-   
-   idct = buffer->idct;
 
idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
idct->pipe->bind_blend_state(idct->pipe, idct->blend);
@@ -859,13 +854,13 @@ vl_idct_flush(struct vl_idct_buffer *buffer, unsigned 
num_instances)
 }
 
 void
-vl_idct_prepare_stage2(struct vl_idct_buffer *buffer)
+vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer)
 {
assert(buffer);
 
/* second stage */
-   buffer->idct->pipe->bind_rasterizer_state(buffer->idct->pipe, 
buffer->idct->rs_state);
-   buffer->idct->pipe->bind_fragment_sampler_states(buffer->idct->pipe, 2, 
buffer->idct->samplers);
-   buffer->idct->pipe->set_fragment_sampler_views(buffer->idct->pipe, 2, 
buffer->sampler_views.stage[1]);
+   idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
+   idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers);
+   idct->pipe->set_fragment_sampler_views(idct->pipe, 2, 
buffer->sampler_views.stage[1]);
 }
 
diff --git a/src/gallium/auxiliary/vl/vl_idct.h 
b/src/gallium/auxiliary/vl/vl_idct.h
index 1d19d81..575a620 100644
--- a/src/gallium/auxiliary/vl/vl_idct.h
+++ b/src/gallium/auxiliary/vl/vl_idct.h
@@ -58,8 +58,6 @@ struct vl_idct
 /* a set of buffers to work with */
 struct vl_idct_buffer
 {
-   struct vl_idct *idct;
-   
struct pipe_viewport_state viewport_mismatch;
struct pipe_viewport_state viewport;
 
@@ -113,9 +111,9 @@ vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer);
 
 /* flush the buffer and start rendering, vertex buffers needs to be setup 
before calling this */
 void
-vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_verts);
+vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned 
num_verts);
 
 void
-vl_idct_prepare_stage2(struct vl_idct_buffer *buffer);
+vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer);
 
 #endif
diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c
index 9534a8f..0f41c68 100644
--- a/src/gallium/auxiliary/vl/vl_mc.c
+++ b/src/gallium/auxiliary/vl/vl_mc.c
@@ -551,8 +551,6 @@ vl_mc_init_buffer(struct vl_mc *renderer, struct 
vl_mc_buffer *buffer)
 {
assert(renderer && buffer)

[Mesa-dev] [PATCH 3/3] vl: replace decode_buffers with auxiliary data field

2011-12-26 Thread Christian König
Based on patches from Maarten Lankhorst 

Signed-off-by: Christian König 
---
 src/gallium/auxiliary/vl/vl_decoder.c  |   20 +---
 src/gallium/auxiliary/vl/vl_decoder.h  |9 +--
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c   |  100 ++--
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.h   |   10 ++-
 src/gallium/auxiliary/vl/vl_video_buffer.c |   29 ++
 src/gallium/auxiliary/vl/vl_video_buffer.h |   16 +++
 src/gallium/drivers/nouveau/nouveau_video.c|2 -
 src/gallium/drivers/nvfx/nvfx_screen.c |2 -
 src/gallium/drivers/r300/r300_screen.c |2 -
 src/gallium/drivers/r600/r600_pipe.c   |2 -
 src/gallium/drivers/softpipe/sp_screen.c   |2 -
 src/gallium/include/pipe/p_context.h   |3 +-
 src/gallium/include/pipe/p_video_decoder.h |   30 +++---
 src/gallium/include/pipe/p_video_enums.h   |3 +-
 src/gallium/state_trackers/vdpau/decode.c  |   43 +
 src/gallium/state_trackers/vdpau/vdpau_private.h   |3 -
 src/gallium/state_trackers/xorg/xvmc/context.c |3 +-
 src/gallium/state_trackers/xorg/xvmc/surface.c |6 -
 .../state_trackers/xorg/xvmc/xvmc_private.h|1 -
 19 files changed, 134 insertions(+), 152 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_decoder.c 
b/src/gallium/auxiliary/vl/vl_decoder.c
index 383e02d..a88347f 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_decoder.c
@@ -44,25 +44,13 @@ vl_profile_supported(struct pipe_screen *screen, enum 
pipe_video_profile profile
}
 }
 
-unsigned
-vl_num_buffers_desired(struct pipe_screen *screen, enum pipe_video_profile 
profile)
-{
-   assert(screen);
-   switch (u_reduce_video_profile(profile)) {
-  case PIPE_VIDEO_CODEC_MPEG12:
- return 4;
-
-  default:
- return 1;
-   }
-}
-
 struct pipe_video_decoder *
 vl_create_decoder(struct pipe_context *pipe,
   enum pipe_video_profile profile,
   enum pipe_video_entrypoint entrypoint,
   enum pipe_video_chroma_format chroma_format,
-  unsigned width, unsigned height, unsigned max_references)
+  unsigned width, unsigned height, unsigned max_references,
+  bool expect_chunked_decode)
 {
unsigned buffer_width, buffer_height;
bool pot_buffers;
@@ -82,7 +70,9 @@ vl_create_decoder(struct pipe_context *pipe,
 
switch (u_reduce_video_profile(profile)) {
   case PIPE_VIDEO_CODEC_MPEG12:
- return vl_create_mpeg12_decoder(pipe, profile, entrypoint, 
chroma_format, buffer_width, buffer_height, max_references);
+ return vl_create_mpeg12_decoder(pipe, profile, entrypoint, 
chroma_format,
+ buffer_width, buffer_height, 
max_references,
+ expect_chunked_decode);
   default:
  return NULL;
}
diff --git a/src/gallium/auxiliary/vl/vl_decoder.h 
b/src/gallium/auxiliary/vl/vl_decoder.h
index a997516..8fa6527 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.h
+++ b/src/gallium/auxiliary/vl/vl_decoder.h
@@ -38,12 +38,6 @@ bool
 vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile 
profile);
 
 /**
- * the desired number of buffers for optimal operation
- */
-unsigned
-vl_num_buffers_desired(struct pipe_screen *screen, enum pipe_video_profile 
profile);
-
-/**
  * standard implementation of pipe->create_video_decoder
  */
 struct pipe_video_decoder *
@@ -51,6 +45,7 @@ vl_create_decoder(struct pipe_context *pipe,
   enum pipe_video_profile profile,
   enum pipe_video_entrypoint entrypoint,
   enum pipe_video_chroma_format chroma_format,
-  unsigned width, unsigned height, unsigned max_references);
+  unsigned width, unsigned height, unsigned max_references,
+  bool expect_chunked_decode);
 
 #endif /* vl_decoder_h */
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c 
b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 04253ef..00d9694 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -383,9 +383,25 @@ UploadYcbcrBlocks(struct vl_mpeg12_decoder *dec,
 }
 
 static void
+vl_mpeg12_destroy_buffer(void *buffer)
+{
+   struct vl_mpeg12_buffer *buf = buffer;
+
+   assert(buf);
+
+   cleanup_zscan_buffer(buf);
+   cleanup_idct_buffer(buf);
+   cleanup_mc_buffer(buf);
+   vl_vb_cleanup(&buf->vertex_stream);
+
+   FREE(buf);
+}
+
+static void
 vl_mpeg12_destroy(struct pipe_video_decoder *decoder)
 {
struct vl_mpeg12_decoder *dec = (struct vl_mpeg12_decoder*)decoder;
+   unsigned i;
 
assert(decoder);
 
@@ -419,17 +435,28 @@ vl_mpeg12_destroy(struct pipe_video_decoder *decoder)
pipe_sampler_view_reference(&dec->zscan_normal, NULL);
pipe_sampler_view_refe

Re: [Mesa-dev] [PATCH 1/3] vl: call decode_bitstream only once

2011-12-26 Thread Maarten Lankhorst
2011/12/26 Christian König :
> Submit all bitstreams at once to decode_bitstream.
>
> Signed-off-by: Christian König 
Signed-off-by: Maarten Lankhorst 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] st/mesa: remove TexSubImage code, use core mesa routines instead.

2011-12-26 Thread Brian Paul
From: Brian Paul 

Since the move to Map/UnmapTextureImage, the core mesa routines are
equivalent to what the state tracker was doing.

The TexImage functions can be replaced too, but there's a few differences
that will need to be handled.
---
 src/mesa/state_tracker/st_cb_texture.c |  143 +---
 1 files changed, 3 insertions(+), 140 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 289ad51..8d30d7a 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -930,143 +930,6 @@ st_GetTexImage(struct gl_context * ctx,
 
 
 static void
-st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
-   GLint xoffset, GLint yoffset, GLint zoffset,
-   GLint width, GLint height, GLint depth,
-   GLenum format, GLenum type, const void *pixels,
-   const struct gl_pixelstore_attrib *packing,
-   struct gl_texture_object *texObj,
-   struct gl_texture_image *texImage)
-{
-   struct st_context *st = st_context(ctx);
-   struct st_texture_image *stImage = st_texture_image(texImage);
-   GLuint dstRowStride;
-   const GLuint srcImageStride =
-  _mesa_image_image_stride(packing, width, height, format, type);
-   GLint i;
-   const GLubyte *src;
-   /* init to silence warning only: */
-   enum pipe_transfer_usage transfer_usage = PIPE_TRANSFER_WRITE;
-   GLubyte *dstMap;
-
-   DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
-   _mesa_lookup_enum_by_nr(target),
-   level, xoffset, yoffset, width, height);
-
-   pixels =
-  _mesa_validate_pbo_teximage(ctx, dims, width, height, depth, format,
-  type, pixels, packing, "glTexSubImage2D");
-   if (!pixels)
-  return;
-
-   /* for a 1D array upload the image as a series of layer with height = 1 */
-   if (target == GL_TEXTURE_1D_ARRAY) {
-  depth = height;
-  height = 1;
-   }
-
-   /* Map buffer if necessary.  Need to lock to prevent other contexts
-* from uploading the buffer under us.
-*/
-   if (stImage->pt) {
-  if (format == GL_DEPTH_COMPONENT &&
-  util_format_is_depth_and_stencil(stImage->pt->format))
- transfer_usage = PIPE_TRANSFER_READ_WRITE;
-  else
- transfer_usage = PIPE_TRANSFER_WRITE;
-
-  dstMap = st_texture_image_map(st, stImage, zoffset, 
-transfer_usage,
-xoffset, yoffset,
-width, height);
-   }
-
-   if (!dstMap) {
-  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
-  goto done;
-   }
-
-   src = (const GLubyte *) pixels;
-   dstRowStride = stImage->transfer->stride;
-
-   for (i = 0; i < depth; i++) {
-  if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
-  texImage->TexFormat,
-  0, 0, 0,
-  dstRowStride,
-  (GLubyte **) &dstMap,
-  width, height, 1,
-  format, type, src, packing)) {
-_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");
-  }
-
-  if (stImage->pt && i + 1 < depth) {
- /* unmap this slice */
-st_texture_image_unmap(st, stImage);
- /* map next slice of 3D texture */
-dstMap = st_texture_image_map(st, stImage,
-   zoffset + i + 1,
-   transfer_usage,
-   xoffset, yoffset,
-   width, height);
-src += srcImageStride;
-  }
-   }
-
-done:
-   _mesa_unmap_teximage_pbo(ctx, packing);
-
-   if (stImage->pt && stImage->transfer) {
-  st_texture_image_unmap(st, stImage);
-   }
-}
-
-
-
-static void
-st_TexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
-   st_TexSubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
-  width, height, depth, format, type,
-  pixels, packing, texObj, texImage);
-}
-
-
-static void
-st_TexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
-   st_TexSubimage(ctx, 2, 

[Mesa-dev] [PATCH 1/4] mesa: simplify Driver.TexSubImage() parameters

2011-12-26 Thread Brian Paul
From: Brian Paul 

There's no need to pass the target, level and texObj parameters since
they can be easily obtained from the texImage pointer.
---
 src/mesa/drivers/common/meta.c  |   18 +-
 src/mesa/drivers/dri/intel/intel_tex_subimage.c |   31 ++--
 src/mesa/drivers/dri/nouveau/nouveau_texture.c  |   45 +++
 src/mesa/main/dd.h  |   44 +++
 src/mesa/main/mipmap.c  |5 +--
 src/mesa/main/teximage.c|   15 +++-
 src/mesa/main/texstore.c|   21 +--
 src/mesa/main/texstore.h|   21 +--
 8 files changed, 89 insertions(+), 111 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e622673..2c1007b 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3155,19 +3155,19 @@ copy_tex_sub_image(struct gl_context *ctx,
 */
_mesa_meta_begin(ctx, MESA_META_PIXEL_STORE);
if (target == GL_TEXTURE_1D) {
-  ctx->Driver.TexSubImage1D(ctx, target, level, xoffset,
-width, format, type, buf,
-&ctx->Unpack, texObj, texImage);
+  ctx->Driver.TexSubImage1D(ctx, texImage,
+xoffset, width,
+format, type, buf, &ctx->Unpack);
}
else if (target == GL_TEXTURE_3D) {
-  ctx->Driver.TexSubImage3D(ctx, target, level, xoffset, yoffset, zoffset,
-width, height, 1, format, type, buf,
-&ctx->Unpack, texObj, texImage);
+  ctx->Driver.TexSubImage3D(ctx, texImage,
+xoffset, yoffset, zoffset, width, height, 1,
+format, type, buf, &ctx->Unpack);
}
else {
-  ctx->Driver.TexSubImage2D(ctx, target, level, xoffset, yoffset,
-width, height, format, type, buf,
-&ctx->Unpack, texObj, texImage);
+  ctx->Driver.TexSubImage2D(ctx, texImage,
+xoffset, yoffset, width, height,
+format, type, buf, &ctx->Unpack);
}
_mesa_meta_end(ctx);
 
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c 
b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 6629588..4572747 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -42,13 +42,11 @@
 
 static bool
 intel_blit_texsubimage(struct gl_context * ctx,
-  GLenum target, GLint level,
+  struct gl_texture_image *texImage,
   GLint xoffset, GLint yoffset,
   GLint width, GLint height,
   GLenum format, GLenum type, const void *pixels,
-  const struct gl_pixelstore_attrib *packing,
-  struct gl_texture_object *texObj,
-  struct gl_texture_image *texImage)
+  const struct gl_pixelstore_attrib *packing)
 {
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intelImage = intel_texture_image(texImage);
@@ -69,7 +67,7 @@ intel_blit_texsubimage(struct gl_context * ctx,
if (intelImage->mt->region->tiling == I915_TILING_Y)
   return false;
 
-   if (target != GL_TEXTURE_2D)
+   if (texImage->TexObject->Target != GL_TEXTURE_2D)
   return false;
 
/* On gen6, it's probably not worth swapping to the blit ring to do
@@ -83,8 +81,8 @@ intel_blit_texsubimage(struct gl_context * ctx,
 
DBG("BLT subimage %s target %s level %d offset %d,%d %dx%d\n",
__FUNCTION__,
-   _mesa_lookup_enum_by_nr(target),
-   level, xoffset, yoffset, width, height);
+   _mesa_lookup_enum_by_nr(texImage->TexObject->Target),
+   texImage->Level, xoffset, yoffset, width, height);
 
pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1,
format, type, pixels, packing,
@@ -112,7 +110,7 @@ intel_blit_texsubimage(struct gl_context * ctx,
dstMap = temp_bo->virtual;
dstRowStride = pitch;
 
-   intel_miptree_get_image_offset(intelImage->mt, level,
+   intel_miptree_get_image_offset(intelImage->mt, texImage->Level,
  intelImage->base.Base.Face, 0,
  &blit_x, &blit_y);
blit_x += xoffset;
@@ -155,26 +153,21 @@ intel_blit_texsubimage(struct gl_context * ctx,
 
 static void
 intelTexSubImage2D(struct gl_context * ctx,
-   GLenum target,
-   GLint level,
+   struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
con

[Mesa-dev] [PATCH 2/4] mesa: simplify Driver.TexImage() parameters

2011-12-26 Thread Brian Paul
From: Brian Paul 

As with TexSubImage(), the target, level and texObj values can be obtained
through the texImage pointer.
---
 src/mesa/drivers/dri/intel/intel_tex_image.c   |   43 
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   42 +--
 src/mesa/drivers/dri/radeon/radeon_texture.c   |   50 +++
 src/mesa/drivers/dri/radeon/radeon_texture.h   |   23 +--
 src/mesa/main/dd.h |   42 +---
 src/mesa/main/teximage.c   |   23 +--
 src/mesa/main/texobj.c |4 +-
 src/mesa/main/texstore.c   |   21 --
 src/mesa/main/texstore.h   |   21 --
 src/mesa/state_tracker/st_cb_texture.c |   50 ++-
 10 files changed, 134 insertions(+), 185 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
b/src/mesa/drivers/dri/intel/intel_tex_image.c
index dd0c6d3..53b22e5 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -200,16 +200,16 @@ try_pbo_upload(struct gl_context *ctx,
 static void
 intelTexImage(struct gl_context * ctx,
   GLint dims,
-  GLenum target, GLint level,
+  struct gl_texture_image *texImage,
   GLint internalFormat,
   GLint width, GLint height, GLint depth,
   GLenum format, GLenum type, const void *pixels,
   const struct gl_pixelstore_attrib *unpack,
-  struct gl_texture_object *texObj,
-  struct gl_texture_image *texImage, GLsizei imageSize)
+  GLsizei imageSize)
 {
DBG("%s target %s level %d %dx%dx%d\n", __FUNCTION__,
-   _mesa_lookup_enum_by_nr(target), level, width, height, depth);
+   _mesa_lookup_enum_by_nr(texImage->TexObject->Target),
+   texImage->Level, width, height, depth);
 
/* Attempt to use the blitter for PBO image uploads.
 */
@@ -222,59 +222,52 @@ intelTexImage(struct gl_context * ctx,
DBG("%s: upload image %dx%dx%d pixels %p\n",
__FUNCTION__, width, height, depth, pixels);
 
-   _mesa_store_teximage3d(ctx, target, level, internalFormat,
+   _mesa_store_teximage3d(ctx, texImage, internalFormat,
  width, height, depth, 0,
- format, type, pixels,
- unpack, texObj, texImage);
+ format, type, pixels, unpack);
 }
 
 
 static void
 intelTexImage3D(struct gl_context * ctx,
-GLenum target, GLint level,
+struct gl_texture_image *texImage,
 GLint internalFormat,
 GLint width, GLint height, GLint depth,
 GLint border,
 GLenum format, GLenum type, const void *pixels,
-const struct gl_pixelstore_attrib *unpack,
-struct gl_texture_object *texObj,
-struct gl_texture_image *texImage)
+const struct gl_pixelstore_attrib *unpack)
 {
-   intelTexImage(ctx, 3, target, level,
+   intelTexImage(ctx, 3, texImage,
  internalFormat, width, height, depth,
- format, type, pixels, unpack, texObj, texImage, 0);
+ format, type, pixels, unpack, 0);
 }
 
 
 static void
 intelTexImage2D(struct gl_context * ctx,
-GLenum target, GLint level,
+struct gl_texture_image *texImage,
 GLint internalFormat,
 GLint width, GLint height, GLint border,
 GLenum format, GLenum type, const void *pixels,
-const struct gl_pixelstore_attrib *unpack,
-struct gl_texture_object *texObj,
-struct gl_texture_image *texImage)
+const struct gl_pixelstore_attrib *unpack)
 {
-   intelTexImage(ctx, 2, target, level,
+   intelTexImage(ctx, 2, texImage,
  internalFormat, width, height, 1,
- format, type, pixels, unpack, texObj, texImage, 0);
+ format, type, pixels, unpack, 0);
 }
 
 
 static void
 intelTexImage1D(struct gl_context * ctx,
-GLenum target, GLint level,
+struct gl_texture_image *texImage,
 GLint internalFormat,
 GLint width, GLint border,
 GLenum format, GLenum type, const void *pixels,
-const struct gl_pixelstore_attrib *unpack,
-struct gl_texture_object *texObj,
-struct gl_texture_image *texImage)
+const struct gl_pixelstore_attrib *unpack)
 {
-   intelTexImage(ctx, 1, target, level,
+   intelTexImage(ctx, 1, texImage,
  internalFormat, width, 1, 1,
- format, type, pixels, unpack, texObj, texImage, 0);
+ format, type, pixels, unpack, 0);
 }
 
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau

[Mesa-dev] [PATCH 3/4] mesa: simplify Driver.CompressedTex[Sub]Image function parameters

2011-12-26 Thread Brian Paul
From: Brian Paul 

As with previous commits, the target, level and texObj info can be
obtained through the texImage pointer.
---
 src/mesa/main/dd.h |   95 +++-
 src/mesa/main/teximage.c   |   30 --
 src/mesa/main/texstore.c   |   64 +++--
 src/mesa/main/texstore.h   |   51 +++--
 src/mesa/state_tracker/st_cb_texture.c |   28 -
 5 files changed, 98 insertions(+), 170 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 05e6d35..5a306e3 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -336,96 +336,65 @@ struct dd_function_table {
 
/**
 * Called by glCompressedTexImage1D().
-*
-* \param target user specified.
-* \param format user specified.
-* \param type user specified.
-* \param pixels user specified.
-* \param packing indicates the image packing of pixels.
-* \param texObj is the target texture object.
-* \param texImage is the target texture image.  It will have the texture \p
-* width, \p height, \p depth, \p border and \p internalFormat information.
-*  
-* \a retainInternalCopy is returned by this function and indicates whether
-* core Mesa should keep an internal copy of the texture image.
-*/
-   void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLsizei width, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
+* The parameters are the same as for glCompressedTexImage1D(), plus a
+* pointer to the destination texure image.
+*/
+   void (*CompressedTexImage1D)(struct gl_context *ctx,
+struct gl_texture_image *texImage,
+GLint internalFormat,
+GLsizei width, GLint border,
+GLsizei imageSize, const GLvoid *data);
/**
 * Called by glCompressedTexImage2D().
 *
 * \sa dd_function_table::CompressedTexImage1D.
 */
-   void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
+   void (*CompressedTexImage2D)(struct gl_context *ctx,
+struct gl_texture_image *texImage,
+GLint internalFormat,
+GLsizei width, GLsizei height, GLint border,
+GLsizei imageSize, const GLvoid *data);
+
/**
 * Called by glCompressedTexImage3D().
 *
 * \sa dd_function_table::CompressedTexImage3D.
 */
-   void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
+   void (*CompressedTexImage3D)(struct gl_context *ctx,
+struct gl_texture_image *texImage,
+GLint internalFormat,
+GLsizei width, GLsizei height, GLsizei depth,
+GLint border,
+GLsizei imageSize, const GLvoid *data);
 
/**
 * Called by glCompressedTexSubImage1D().
-* 
-* \param target user specified.
-* \param level user specified.
-* \param xoffset user specified.
-* \param yoffset user specified.
-* \param zoffset user specified.
-* \param width user specified.
-* \param height user specified.
-* \param depth user specified.
-* \param imageSize user specified.
-* \param data user specified.
-* \param texObj is the target texture object.
-* \param texImage is the target texture image.  It will have the texture \p
-* width, \p height, \p depth, \p border and \p internalFormat information.
-*/
-   void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, 
GLint level,
+*/
+   void (*CompressedTexSubImage1D)(struct gl_context *ctx,
+   struct gl_texture_image *texImage,
GLint xoffse

[Mesa-dev] [PATCH 4/4] mesa: simplify Driver.GetCompressedTexImage() parameters

2011-12-26 Thread Brian Paul
From: Brian Paul 

---
 src/mesa/main/dd.h  |7 +++
 src/mesa/main/texgetimage.c |   10 --
 src/mesa/main/texgetimage.h |7 +++
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 5a306e3..6707e78 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -400,10 +400,9 @@ struct dd_function_table {
/**
 * Called by glGetCompressedTexImage.
 */
-   void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint 
level,
- GLvoid *img,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
+   void (*GetCompressedTexImage)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLvoid *data);
 
/*@}*/
 
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 738c181..f848aa8 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -603,10 +603,9 @@ _mesa_get_teximage(struct gl_context *ctx,
  * All error checking will have been done before this routine is called.
  */
 void
-_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint 
level,
-  GLvoid *img,
-  struct gl_texture_object *texObj,
-  struct gl_texture_image *texImage)
+_mesa_get_compressed_teximage(struct gl_context *ctx,
+  struct gl_texture_image *texImage,
+  GLvoid *img)
 {
const GLuint row_stride =
   _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
@@ -981,8 +980,7 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, 
GLsizei bufSize,
 
_mesa_lock_texture(ctx, texObj);
{
-  ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
-texObj, texImage);
+  ctx->Driver.GetCompressedTexImage(ctx, texImage, img);
}
_mesa_unlock_texture(ctx, texObj);
 }
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
index 02b1cf4..cd8e76e 100644
--- a/src/mesa/main/texgetimage.h
+++ b/src/mesa/main/texgetimage.h
@@ -40,10 +40,9 @@ _mesa_get_teximage(struct gl_context *ctx,
 
 
 extern void
-_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint 
level,
-  GLvoid *img,
-  struct gl_texture_object *texObj,
-  struct gl_texture_image *texImage);
+_mesa_get_compressed_teximage(struct gl_context *ctx,
+  struct gl_texture_image *texImage,
+  GLvoid *data);
 
 
 
-- 
1.7.1

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


[Mesa-dev] [PATCH 1/2] intel: pass xoffset, yoffset = 0 to _mesa_texstore()

2011-12-26 Thread Brian Paul
From: Brian Paul 

---
 src/mesa/drivers/dri/intel/intel_tex_subimage.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c 
b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index 4572747..258c3f5 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -115,12 +115,10 @@ intel_blit_texsubimage(struct gl_context * ctx,
  &blit_x, &blit_y);
blit_x += xoffset;
blit_y += yoffset;
-   xoffset = 0;
-   yoffset = 0;
 
if (!_mesa_texstore(ctx, 2, texImage->_BaseFormat,
   texImage->TexFormat,
-  xoffset, yoffset, 0,
+  0, 0, 0,  /* x, y, z offset in dest buffer */
   dstRowStride,
   &dstMap,
   width, height, 1,
-- 
1.7.1

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


Re: [Mesa-dev] [PATCH] Fix build with LLVM >= r145623.

2011-12-26 Thread Brian Paul
2011/12/26 Johannes Obermayr :
> Am Dienstag, 20. Dezember 2011, 11:11:25 schrieb Michel 
> =?ISO-8859-1?Q?D=E4nzer?=:
>> On Mon, 2011-12-19 at 23:11 +0100, Johannes Obermayr wrote:
>> > This is a workaround for 
>> > https://bugs.freedesktop.org/show_bug.cgi?id=43861.
>> >
>> > Actually the issue which makes -pedantic failing should be solved.
>>
>> Maybe it should, but that's not for LLVM to enforce on its users.
>>
>>
>> > ---
>> >  configure.ac |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/configure.ac b/configure.ac
>> > index a4943e1..8e809b9 100644
>> > --- a/configure.ac
>> > +++ b/configure.ac
>> > @@ -1753,7 +1753,7 @@ if test "x$enable_gallium_llvm" = xyes; then
>> >
>> >      if test "x$LLVM_CONFIG" != xno; then
>> >     LLVM_VERSION=`$LLVM_CONFIG --version`
>> > -   LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed 's/-DNDEBUG\>//g'`
>> > +   LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 
>> > 's/-pedantic//g'`
>> >     LLVM_LIBS="`$LLVM_CONFIG --libs`"
>> >
>> >     LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
>>
>> Might want to update configs/linux-llvm as well, but otherwise
>>
>> Reviewed-by: Michel Dänzer 
>>
>>
>>
>
> Will it become pushed?

Pushed.  Thanks.

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


Re: [Mesa-dev] [PATCH] vbo: Clean up recalculate_input_bindings.

2011-12-26 Thread Brian Paul
2011/12/25 Mathias Fröhlich :
>
> Hi,
>
> I have posted a very similar patch already with the array object change
> series. But I have omitted applying this one because of a general issue that
> Brian pointed me to in a patch prior to this one in the series.
> But it turns out that this one should be still safe.
>
> Please review

LGTM.  I presume you've done a piglit run and tested with a few other things?

Reviewed-by: Brian Paul 

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


Re: [Mesa-dev] [PATCH] gallium/u_pack: fix l8/i8 pack color ub

2011-12-26 Thread Brian Paul
On Sat, Dec 24, 2011 at 12:32 PM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> just noticed this in passing, not sure it actually fixes any issus.
>
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/auxiliary/util/u_pack_color.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_pack_color.h 
> b/src/gallium/auxiliary/util/u_pack_color.h
> index 0bbf769..50ec226 100644
> --- a/src/gallium/auxiliary/util/u_pack_color.h
> +++ b/src/gallium/auxiliary/util/u_pack_color.h
> @@ -122,7 +122,7 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
>    case PIPE_FORMAT_L8_UNORM:
>    case PIPE_FORMAT_I8_UNORM:
>       {
> -         uc->ub = a;
> +         uc->ub = r;
>       }
>       return;
>    case PIPE_FORMAT_R32G32B32A32_FLOAT:
> --

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


Re: [Mesa-dev] [PATCH 1/4] mklib: Add Haiku build support

2011-12-26 Thread Brian Paul
On Sat, Dec 24, 2011 at 9:44 AM, Alexander von Gluck
 wrote:
> On 24.12.2011 07:29, Brian Paul wrote:
>>
>> On Fri, Dec 23, 2011 at 4:24 PM, Alexander von Gluck
>>  wrote:
>>>
>>>
>>> ---
>>>  bin/mklib |   37 +
>>>  1 files changed, 37 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/bin/mklib b/bin/mklib
>>> index 70bd1a2..93dd989 100755
>>> --- a/bin/mklib
>>> +++ b/bin/mklib
>>> @@ -959,6 +959,43 @@ case $ARCH in
>>>         fi
>>>        ;;
>>>
>>> +       'Haiku')
>>> +               if [ $STATIC = 1 ] ; then
>>> +                       LIBNAME="lib${LIBNAME}.a"
>>> +                       if [ "x$LINK" = "x" ] ; then
>>> +                               # -linker was not specified so set
>>> default
>>> link command now
>>> +                               if [ $CPLUSPLUS = 1 ] ; then
>>> +                                       LINK=g++
>>> +                               else
>>> +                                       LINK=gcc
>>> +                               fi
>>> +                       fi
>>> +
>>> +                       OPTS="-ru"
>>> +                       if [ "${ALTOPTS}" ] ; then
>>> +                               OPTS=${ALTOPTS}
>>> +                       fi
>>> +
>>> +                       echo "mklib: Making static library for Haiku: "
>>> ${LIBNAME}
>>> +
>>> +                       # expand .a into .o files
>>> +                       NEW_OBJECTS=`expand_archives ${LIBNAME}.obj
>>> $OBJECTS`
>>> +
>>> +                       # make static lib
>>> +                       FINAL_LIBS=`make_ar_static_lib ${OPTS} 1
>>> ${LIBNAME}
>>> ${NEW_OBJECTS}`
>>> +
>>> +                       # remove temporary extracted .o files
>>> +                       rm -rf ${LIBNAME}.obj
>>> +        else
>>> +                       LIBNAME="lib${LIBNAME}.so"  # prefix with "lib",
>>> suffix with ".so"
>>> +                       OPTS="-shared"
>>> +
>>> +                       echo "mklib: Making shared library for Haiku: "
>>> ${LIBNAME}
>>> +                       ${LINK} ${OPTS} ${LDFLAGS} ${OBJECTS} ${DEPS} -o
>>> ${LIBNAME}
>>> +                       FINAL_LIBS="${LIBNAME}"
>>> +               fi
>>> +       ;;
>>> +
>>>     'example')
>>>        # If you're adding support for a new architecture, you can
>>>        # start with this:
>>
>>
>> Reviewed-by: Brian Paul 
>>
>> Do you need me or someone to commit this?
>
>
> If you feel it's ready.

Pushed.  Thanks.

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


Re: [Mesa-dev] [PATCH 0/5] Replace RENDERINPUTS with direct GLbitfield64 usage.

2011-12-26 Thread Brian Paul
2011/12/26 Mathias Fröhlich :
>
> Hi,
>
> Following a series as suggested to me by a review to a recent checkin.
>
> The series replaces the RENDERINPUTS* macros with direct usage of GLbitfield64
> values.
> The patchset is piglit quick regression tested with traditional swrast.
>
> Due to the lack of all this old hardware to test, plenty reviews and tests are
> very welcome.
>
> Please review.

For the series:
Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] vbo: Clean up recalculate_input_bindings.

2011-12-26 Thread Mathias Fröhlich

Hi,

On Tuesday, December 27, 2011 00:17:09 Brian Paul wrote:
> LGTM.  I presume you've done a piglit run and tested with a few other
> things?
I have run piglit quick with classic swrast an piglit r600g on gallium rv670 
with this change. Also I am pretty sure that I have started osgviewer and 
probably flightgear on this. The full piglit runs are just too heavy running 
with valgrind. I never had the patience to wait for that to finish.

So, I have leared from the past series that classic swrast serves as a good 
testbed for tnl drivers like the intel one - where I do not have hardware at 
hand. I did not do this in former times.
In this case the swrast test is probably my best bet to catch changes in the 
classic paths anyway.

When we are at this, what tests would you recommend?

Thanks

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