Mesa (master): st/mesa: always call FLUSH_CURRENT before st->pipe->flush()

2010-02-18 Thread Keith Whitwell
Module: Mesa
Branch: master
Commit: 37e955d491664d27b1335c60ee40b730af6a1515
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=37e955d491664d27b1335c60ee40b730af6a1515

Author: Keith Whitwell 
Date:   Thu Feb 18 08:59:19 2010 +

st/mesa: always call FLUSH_CURRENT before st->pipe->flush()

Undoes part of commit f455ca6 which would permit pipe->flush() to be
called while the VBO module still had its buffers mapped.  Some
drivers care deeply about this.  Sorry for not spotting this earlier.

---

 src/mesa/state_tracker/st_cb_flush.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_flush.c 
b/src/mesa/state_tracker/st_cb_flush.c
index 0ddfce4..573c783 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -91,8 +91,7 @@ display_front_buffer(struct st_context *st)
 void st_flush( struct st_context *st, uint pipeFlushFlags,
struct pipe_fence_handle **fence )
 {
-   if (pipeFlushFlags & PIPE_FLUSH_RENDER_CACHE)
-  FLUSH_CURRENT(st->ctx, 0);
+   FLUSH_CURRENT(st->ctx, 0);
 
/* Release any vertex buffers that might potentially be accessed in
 * successive frames:

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


Mesa (master): progs/redbook: Fix array out-of-bounds access.

2010-02-18 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 7f7b7b9a0207ae9e51f68e7f9ddc2834f4727fc9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f7b7b9a0207ae9e51f68e7f9ddc2834f4727fc9

Author: Vinson Lee 
Date:   Thu Feb 18 01:17:26 2010 -0800

progs/redbook: Fix array out-of-bounds access.

---

 progs/redbook/combiner.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/progs/redbook/combiner.c b/progs/redbook/combiner.c
index 92e4de4..7682e0c 100644
--- a/progs/redbook/combiner.c
+++ b/progs/redbook/combiner.c
@@ -249,7 +249,7 @@ static void display(void)
glCallList(1);
glPopMatrix();
 
-   constColor[4] = 0.8;
+   constColor[3] = 0.8;
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constColor);
glPushMatrix();
glTranslatef(4.0, 3.0, 0.0);

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


Mesa (master): progs/trivial: Update .gitignore.

2010-02-18 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 82e5a11077cabcf58ec9e1e7f12dcc5dd7d1cf89
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82e5a11077cabcf58ec9e1e7f12dcc5dd7d1cf89

Author: Vinson Lee 
Date:   Thu Feb 18 01:24:20 2010 -0800

progs/trivial: Update .gitignore.

---

 progs/trivial/.gitignore |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore
index 4317eb6..caf930d 100644
--- a/progs/trivial/.gitignore
+++ b/progs/trivial/.gitignore
@@ -80,6 +80,8 @@ quadstrip-flat
 readtex.c
 readtex.h
 readpixels
+sub-tex
+tex-quads
 tri
 tri-alpha
 tri-alpha-tex
@@ -111,6 +113,7 @@ tri-logicop-xor
 tri-mask-tri
 tri-multitex-vbo
 tri-orig
+tri-point-line-clipped
 tri-query
 tri-repeat
 tri-scissor-tri
@@ -149,6 +152,7 @@ vbo-drawrange
 vbo-noninterleaved
 vbo-tri
 vp-array
+vp-array-hf
 vp-array-int
 vp-clip
 vp-line-clip

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


Mesa (gallium-winsys-handle): i965g: Finish the conversion to winsys handle

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: gallium-winsys-handle
Commit: ba274fc6f8041ba5323cd8c9c2e098bf9597fc0c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba274fc6f8041ba5323cd8c9c2e098bf9597fc0c

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 02:01:24 2010 +

i965g: Finish the conversion to winsys handle

---

 src/gallium/drivers/i965/brw_screen_texture.c |  228 +++--
 src/gallium/drivers/i965/brw_winsys.h |   10 +
 src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c |   18 +-
 3 files changed, 136 insertions(+), 120 deletions(-)

diff --git a/src/gallium/drivers/i965/brw_screen_texture.c 
b/src/gallium/drivers/i965/brw_screen_texture.c
index f5f12dd..0df8bc5 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -300,6 +300,119 @@ fail:
return NULL;
 }
 
+static struct pipe_texture * 
+brw_texture_from_handle(struct pipe_screen *screen,
+const struct pipe_texture *templ,
+struct winsys_handle *whandle)
+{
+   struct brw_screen *bscreen = brw_screen(screen);
+   struct brw_texture *tex;
+   struct brw_winsys_buffer *buffer;
+   unsigned tiling;
+   unsigned pitch;
+
+   if (templ->target != PIPE_TEXTURE_2D ||
+   templ->last_level != 0 ||
+   templ->depth0 != 1)
+  return NULL;
+
+   if (util_format_is_compressed(templ->format))
+  return NULL;
+
+   tex = CALLOC_STRUCT(brw_texture);
+   if (!tex)
+  return NULL;
+
+   if (bscreen->sws->bo_from_handle(bscreen->sws, whandle, &pitch, &tiling, 
&buffer) != PIPE_OK)
+  goto fail;
+
+   memcpy(&tex->base, templ, sizeof *templ);
+   pipe_reference_init(&tex->base.reference, 1);
+   tex->base.screen = screen;
+
+   /* XXX: cpp vs. blocksize
+*/
+   tex->cpp = util_format_get_blocksize(tex->base.format);
+   tex->tiling = tiling;
+
+   make_empty_list(&tex->views[0]);
+   make_empty_list(&tex->views[1]);
+
+   if (!brw_texture_layout(bscreen, tex))
+  goto fail;
+
+   /* XXX Maybe some more checks? */
+   if ((pitch / tex->cpp) < tex->pitch)
+  goto fail;
+
+   tex->pitch = pitch / tex->cpp;
+
+   tex->bo = buffer;
+
+   /* fix this warning */
+#if 0
+   if (tex->size > buffer->size)
+  goto fail;
+#endif
+
+   tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
+   tex->ss.ss0.surface_type = translate_tex_target(tex->base.target);
+   tex->ss.ss0.surface_format = translate_tex_format(tex->base.format);
+   assert(tex->ss.ss0.surface_format != BRW_SURFACEFORMAT_INVALID);
+
+   /* This is ok for all textures with channel width 8bit or less:
+*/
+/*tex->ss.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
+
+
+   /* XXX: what happens when tex->bo->offset changes???
+*/
+   tex->ss.ss1.base_addr = 0; /* reloc */
+   tex->ss.ss2.mip_count = tex->base.last_level;
+   tex->ss.ss2.width = tex->base.width0 - 1;
+   tex->ss.ss2.height = tex->base.height0 - 1;
+
+   switch (tex->tiling) {
+   case BRW_TILING_NONE:
+  tex->ss.ss3.tiled_surface = 0;
+  tex->ss.ss3.tile_walk = 0;
+  break;
+   case BRW_TILING_X:
+  tex->ss.ss3.tiled_surface = 1;
+  tex->ss.ss3.tile_walk = BRW_TILEWALK_XMAJOR;
+  break;
+   case BRW_TILING_Y:
+  tex->ss.ss3.tiled_surface = 1;
+  tex->ss.ss3.tile_walk = BRW_TILEWALK_YMAJOR;
+  break;
+   }
+
+   tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1;
+   tex->ss.ss3.depth = tex->base.depth0 - 1;
+
+   tex->ss.ss4.min_lod = 0;
+
+   return &tex->base;
+
+fail:
+   FREE(tex);
+   return NULL;
+}
+
+static boolean
+brw_texture_get_handle(struct pipe_screen *screen,
+   struct pipe_texture *texture,
+   struct winsys_handle *whandle)
+{
+   struct brw_screen *bscreen = brw_screen(screen);
+   struct brw_texture *tex = brw_texture(texture);
+   unsigned stride;
+
+   stride = tex->pitch * tex->cpp;
+
+   return bscreen->sws->bo_get_handle(tex->bo, whandle, stride);
+}
+
 static struct pipe_texture *brw_texture_blanket(struct pipe_screen *screen,
const struct pipe_texture 
*templ,
const unsigned *stride,
@@ -447,123 +560,12 @@ brw_tex_transfer_destroy(struct pipe_transfer *trans)
FREE(trans);
 }
 
-
-/*
- * Functions exported to the winsys
- */
-
-boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
-  struct brw_winsys_buffer **buffer,
-  unsigned *stride)
-{
-   struct brw_texture *tex = brw_texture(texture);
-
-   *buffer = tex->bo;
-   if (stride)
-  *stride = tex->pitch * tex->cpp;
-
-   return TRUE;
-}
-
-struct pipe_texture * 
-brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
-  const struct pipe_texture *templ,
-  unsigned pitch,
- unsigned tiling,
-

Mesa (master): intel: Include main/hash.h using "" instead of <>

2010-02-18 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 0aa610571162eafc8c31c3d26c3676b6aead82df
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0aa610571162eafc8c31c3d26c3676b6aead82df

Author: Kristian Høgsberg 
Date:   Thu Feb 18 07:49:14 2010 -0500

intel: Include main/hash.h using "" instead of <>

---

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

diff --git a/src/mesa/drivers/dri/intel/intel_regions.c 
b/src/mesa/drivers/dri/intel/intel_regions.c
index 62b4ce6..f63d3a4 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -42,7 +42,7 @@
 #include 
 #include 
 
-#include 
+#include "main/hash.h"
 #include "intel_context.h"
 #include "intel_regions.h"
 #include "intel_blit.h"

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


Mesa (master): Revert "st/mesa: Make the frontbuffer visible on st_flush( PIPE_FLUSH_FRAME)."

2010-02-18 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 196214bf2b677a83653d49f79d03752f29df44ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=196214bf2b677a83653d49f79d03752f29df44ec

Author: Francisco Jerez 
Date:   Thu Feb 18 13:37:09 2010 +0100

Revert "st/mesa: Make the frontbuffer visible on st_flush(PIPE_FLUSH_FRAME)."

We probably don't want to propagate this condition to the pipe driver,
this reverts commit f455ca6490fcb65781b21f81c7117bd923e250d1 and the
dri_update_buffer flush altogether until an agreement is reached.

---

 src/gallium/state_trackers/dri/dri_drawable.c |2 --
 src/mesa/state_tracker/st_cb_flush.c  |   12 
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index 195ae7b..8843e08 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -288,8 +288,6 @@ dri_update_buffer(struct pipe_screen *screen, void 
*context_private)
ctx->r_stamp == *ctx->rPriv->pStamp)
   return;
 
-   st_flush(ctx->st, PIPE_FLUSH_FRAME, NULL);
-
ctx->d_stamp = *ctx->dPriv->pStamp;
ctx->r_stamp = *ctx->rPriv->pStamp;
 
diff --git a/src/mesa/state_tracker/st_cb_flush.c 
b/src/mesa/state_tracker/st_cb_flush.c
index 573c783..1329f80 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -102,10 +102,6 @@ void st_flush( struct st_context *st, uint pipeFlushFlags,
util_gen_mipmap_flush(st->gen_mipmap);
 
st->pipe->flush( st->pipe, pipeFlushFlags, fence );
-
-   if ((pipeFlushFlags & PIPE_FLUSH_FRAME) &&
-   is_front_buffer_dirty(st))
-  display_front_buffer(st);
 }
 
 
@@ -139,6 +135,10 @@ static void st_glFlush(GLcontext *ctx)
 * problems that need to be fixed elsewhere.
 */
st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
+
+   if (is_front_buffer_dirty(st)) {
+  display_front_buffer(st);
+   }
 }
 
 
@@ -150,6 +150,10 @@ static void st_glFinish(GLcontext *ctx)
struct st_context *st = ctx->st;
 
st_finish(st);
+
+   if (is_front_buffer_dirty(st)) {
+  display_front_buffer(st);
+   }
 }
 
 

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


Mesa (gallium-vertexelementcso): gallium: use cso state handling for pipe_vertex_element state

2010-02-18 Thread Roland Scheidegger
Module: Mesa
Branch: gallium-vertexelementcso
Commit: 51d139f03898e5e46af6363c6bba131455738cc4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=51d139f03898e5e46af6363c6bba131455738cc4

Author: Roland Scheidegger 
Date:   Thu Feb 18 16:36:25 2010 +0100

gallium: use cso state handling for pipe_vertex_element state

---

 src/gallium/auxiliary/cso_cache/cso_cache.c   |   21 +++
 src/gallium/auxiliary/cso_cache/cso_cache.h   |   11 +++-
 src/gallium/auxiliary/cso_cache/cso_context.c |   74 +
 src/gallium/auxiliary/cso_cache/cso_context.h |7 ++-
 src/gallium/include/pipe/p_context.h  |9 ++-
 5 files changed, 117 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c 
b/src/gallium/auxiliary/cso_cache/cso_cache.c
index a6a07e7..900c64d 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -43,6 +43,7 @@ struct cso_cache {
struct cso_hash *vs_hash;
struct cso_hash *rasterizer_hash;
struct cso_hash *sampler_hash;
+   struct cso_hash *velements_hash;
intmax_size;
 
cso_sanitize_callback sanitize_cb;
@@ -108,6 +109,9 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache 
*sc, enum cso_cache_
case CSO_VERTEX_SHADER:
   hash = sc->vs_hash;
   break;
+   case CSO_VELEMENTS:
+  hash = sc->velements_hash;
+  break;
}
 
return hash;
@@ -161,6 +165,13 @@ static void delete_vs_state(void *state, void *data)
FREE(state);
 }
 
+static void delete_velements(void *state, void *data)
+{
+   struct cso_velements *cso = (struct cso_velements *)state;
+   if (cso->delete_state)
+  cso->delete_state(cso->context, cso->data);
+   FREE(state);
+}
 
 static INLINE void delete_cso(void *state, enum cso_cache_type type)
 {
@@ -183,6 +194,9 @@ static INLINE void delete_cso(void *state, enum 
cso_cache_type type)
case CSO_VERTEX_SHADER:
   delete_vs_state(state, 0);
   break;
+   case CSO_VELEMENTS:
+  delete_velements(state, 0);
+  break;
default:
   assert(0);
   FREE(state);
@@ -294,6 +308,7 @@ struct cso_cache *cso_cache_create(void)
sc->rasterizer_hash= cso_hash_create();
sc->fs_hash= cso_hash_create();
sc->vs_hash= cso_hash_create();
+   sc->velements_hash = cso_hash_create();
sc->sanitize_cb= sanitize_cb;
sc->sanitize_data  = 0;
 
@@ -325,6 +340,9 @@ void cso_for_each_state(struct cso_cache *sc, enum 
cso_cache_type type,
case CSO_VERTEX_SHADER:
   hash = sc->vs_hash;
   break;
+   case CSO_VELEMENTS:
+  hash = sc->velements_hash;
+  break;
}
 
iter = cso_hash_first_node(hash);
@@ -351,6 +369,7 @@ void cso_cache_delete(struct cso_cache *sc)
cso_for_each_state(sc, CSO_VERTEX_SHADER, delete_vs_state, 0);
cso_for_each_state(sc, CSO_RASTERIZER, delete_rasterizer_state, 0);
cso_for_each_state(sc, CSO_SAMPLER, delete_sampler_state, 0);
+   cso_for_each_state(sc, CSO_VELEMENTS, delete_velements, 0);
 
cso_hash_delete(sc->blend_hash);
cso_hash_delete(sc->sampler_hash);
@@ -358,6 +377,7 @@ void cso_cache_delete(struct cso_cache *sc)
cso_hash_delete(sc->rasterizer_hash);
cso_hash_delete(sc->fs_hash);
cso_hash_delete(sc->vs_hash);
+   cso_hash_delete(sc->velements_hash);
FREE(sc);
 }
 
@@ -372,6 +392,7 @@ void cso_set_maximum_cache_size(struct cso_cache *sc, int 
number)
sanitize_hash(sc, sc->vs_hash, CSO_VERTEX_SHADER, sc->max_size);
sanitize_hash(sc, sc->rasterizer_hash, CSO_RASTERIZER, sc->max_size);
sanitize_hash(sc, sc->sampler_hash, CSO_SAMPLER, sc->max_size);
+   sanitize_hash(sc, sc->velements_hash, CSO_VELEMENTS, sc->max_size);
 }
 
 int cso_maximum_cache_size(const struct cso_cache *sc)
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.h 
b/src/gallium/auxiliary/cso_cache/cso_cache.h
index eea60b9..d884d54 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.h
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.h
@@ -53,6 +53,7 @@
   * - rasterizer (old setup)
   * - sampler
   * - vertex shader
+  * - vertex elements
   *
   * Things that are not constant state objects include:
   * - blend_color
@@ -90,7 +91,8 @@ enum cso_cache_type {
CSO_DEPTH_STENCIL_ALPHA,
CSO_RASTERIZER,
CSO_FRAGMENT_SHADER,
-   CSO_VERTEX_SHADER
+   CSO_VERTEX_SHADER,
+   CSO_VELEMENTS
 };
 
 typedef void (*cso_state_callback)(void *ctx, void *obj);
@@ -144,6 +146,13 @@ struct cso_sampler {
struct pipe_context *context;
 };
 
+struct cso_velements {
+   struct pipe_vertex_element state[PIPE_MAX_ATTRIBS];
+   void *data;
+   cso_state_callback delete_state;
+   struct pipe_context *context;
+};
+
 unsigned cso_construct_key(void *item, int item_size);
 
 struct cso_cache *cso_cache_create(void);
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index b5241fa..95e3c18 100644
--- a/src/gallium/auxiliary/cso_ca

Mesa (mesa_7_7_branch): swrast: fix left side clipping

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: mesa_7_7_branch
Commit: 7c34c237a2f6732b2c013543523617e375c1f534
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c34c237a2f6732b2c013543523617e375c1f534

Author: Brian Paul 
Date:   Thu Feb 18 09:37:55 2010 -0700

swrast: fix left side clipping

Fixes bug 26623.  Original patch was submitted by Mathias Frohlich
and modified by Brian.

---

 src/mesa/swrast/s_span.c |   39 ---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 07248c7..e772c60 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -784,14 +784,47 @@ clip_span( GLcontext *ctx, SWspan *span )
   * For arrays of values, shift them left.
   */
  for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+if (span->interpMask & (1 << i)) {
+   GLuint j;
+   for (j = 0; j < 4; j++) {
+  span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
+   }
+}
+ }
+
+ span->red += leftClip * span->redStep;
+ span->green += leftClip * span->greenStep;
+ span->blue += leftClip * span->blueStep;
+ span->alpha += leftClip * span->alphaStep;
+ span->index += leftClip * span->indexStep;
+ span->z += leftClip * span->zStep;
+ span->intTex[0] += leftClip * span->intTexStep[0];
+ span->intTex[1] += leftClip * span->intTexStep[1];
+
+#define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
+ memcpy(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
+
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
 if (span->arrayAttribs & (1 << i)) {
/* shift array elements left by 'leftClip' */
-   _mesa_memcpy(span->array->attribs[i],
-span->array->attribs[i] + leftClip,
-(n - leftClip) * 4 * sizeof(GLfloat));
+   SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
 }
  }
 
+ SHIFT_ARRAY(span->array->mask, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba8, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba16, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->x, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->y, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->z, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->index, leftClip, n - leftClip);
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+SHIFT_ARRAY(span->array->lambda[i], leftClip, n - leftClip);
+ }
+ SHIFT_ARRAY(span->array->coverage, leftClip, n - leftClip);
+
+#undef SHIFT_ARRAY
+
  span->leftClip = leftClip;
  span->x = xmin;
  span->end -= leftClip;

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


Mesa (master): swrast: fix left side clipping

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a61dce363929bbc3520f91cefa3ba15bbe31c5bd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a61dce363929bbc3520f91cefa3ba15bbe31c5bd

Author: Brian Paul 
Date:   Thu Feb 18 09:40:38 2010 -0700

swrast: fix left side clipping

Fixes bug 26623.  Original patch was submitted by Mathias Frohlich
and modified by Brian.

(cherry picked from commit 7c34c237a2f6732b2c013543523617e375c1f534)

---

 src/mesa/swrast/s_span.c |   39 ---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 905cf3d..85d30cc 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -784,14 +784,47 @@ clip_span( GLcontext *ctx, SWspan *span )
   * For arrays of values, shift them left.
   */
  for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+if (span->interpMask & (1 << i)) {
+   GLuint j;
+   for (j = 0; j < 4; j++) {
+  span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
+   }
+}
+ }
+
+ span->red += leftClip * span->redStep;
+ span->green += leftClip * span->greenStep;
+ span->blue += leftClip * span->blueStep;
+ span->alpha += leftClip * span->alphaStep;
+ span->index += leftClip * span->indexStep;
+ span->z += leftClip * span->zStep;
+ span->intTex[0] += leftClip * span->intTexStep[0];
+ span->intTex[1] += leftClip * span->intTexStep[1];
+
+#define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
+ memcpy(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
+
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
 if (span->arrayAttribs & (1 << i)) {
/* shift array elements left by 'leftClip' */
-   _mesa_memcpy(span->array->attribs[i],
-span->array->attribs[i] + leftClip,
-(n - leftClip) * 4 * sizeof(GLfloat));
+   SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
 }
  }
 
+ SHIFT_ARRAY(span->array->mask, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba8, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba16, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->x, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->y, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->z, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->index, leftClip, n - leftClip);
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+SHIFT_ARRAY(span->array->lambda[i], leftClip, n - leftClip);
+ }
+ SHIFT_ARRAY(span->array->coverage, leftClip, n - leftClip);
+
+#undef SHIFT_ARRAY
+
  span->leftClip = leftClip;
  span->x = xmin;
  span->end -= leftClip;

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


Mesa (mesa_7_7_branch): drm/vmware: Latest interface changes are backwards incopatible

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: mesa_7_7_branch
Commit: 86870a691ca807c3fd31ab30cad31cae55b2ffa8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86870a691ca807c3fd31ab30cad31cae55b2ffa8

Author: Jakob Bornecrantz 
Date:   Thu Feb 11 14:41:40 2010 +0100

drm/vmware: Latest interface changes are backwards incopatible

Since the execbuffer change actually changed size off the ioctl
struct and not just a reuse of padded bits, we can't support
old kernels as easily as the scanout change was.

---

 .../winsys/drm/vmware/core/vmw_screen_dri.c|2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c 
b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
index b0ea975..a9a34ea 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
@@ -48,7 +48,7 @@ static struct dri1_api_version ddx_required = { 0, 1, 0 };
 static struct dri1_api_version ddx_compat = { 0, 0, 0 };
 static struct dri1_api_version dri_required = { 4, 0, 0 };
 static struct dri1_api_version dri_compat = { 4, 0, 0 };
-static struct dri1_api_version drm_required = { 0, 1, 0 };
+static struct dri1_api_version drm_required = { 1, 0, 0 };
 static struct dri1_api_version drm_compat = { 1, 0, 0 };
 static struct dri1_api_version drm_scanout = { 0, 9, 0 };
 

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


Mesa (mesa_7_7_branch): st/xorg: Make default of debugging fallbacks smart

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: mesa_7_7_branch
Commit: eb7590a0d95005ab3d9650afd8feca1aef49688a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb7590a0d95005ab3d9650afd8feca1aef49688a

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 15:51:59 2010 +0100

st/xorg: Make default of debugging fallbacks smart

Set it to the same as 2d acceleration

---

 src/gallium/state_trackers/xorg/xorg_driver.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c 
b/src/gallium/state_trackers/xorg/xorg_driver.c
index 90b8b8b..ad4f38f 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -673,7 +673,7 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, 
char **argv)
 xf86SetBlackWhitePixels(pScreen);
 
 ms->accelerate_2d = xf86ReturnOptValBool(ms->Options, OPTION_2D_ACCEL, 
FALSE);
-ms->debug_fallback = xf86ReturnOptValBool(ms->Options, 
OPTION_DEBUG_FALLBACK, TRUE);
+ms->debug_fallback = xf86ReturnOptValBool(ms->Options, 
OPTION_DEBUG_FALLBACK, ms->accelerate_2d);
 
 if (ms->screen) {
ms->exa = xorg_exa_init(pScrn, ms->accelerate_2d);

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


Mesa (mesa_7_7_branch): st/xorg: A bit more debugging info

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: mesa_7_7_branch
Commit: a69a7b9688f14142a7e3dd424e6bd8614a4b7b56
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a69a7b9688f14142a7e3dd424e6bd8614a4b7b56

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 15:53:42 2010 +0100

st/xorg: A bit more debugging info

---

 src/gallium/state_trackers/xorg/xorg_driver.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c 
b/src/gallium/state_trackers/xorg/xorg_driver.c
index ad4f38f..b92f643 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -684,6 +684,11 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int 
argc, char **argv)
 #endif
 }
 
+xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
"##\n");
+xf86DrvMsg(pScrn->scrnIndex, X_INFO, "# Usefull debugging info follows 
#\n");
+xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
"##\n");
+xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %s backend\n",
+  ms->screen ? "Gallium3D" : "libkms");
 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "2D Acceleration is %s\n",
   ms->screen && ms->accelerate_2d ? "enabled" : "disabled");
 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fallback debugging is %s\n",
@@ -694,6 +699,7 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, 
char **argv)
 #else
 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is disabled\n");
 #endif
+xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
"##\n");
 
 miInitializeBackingStore(pScreen);
 xf86SetBackingStore(pScreen);

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


Mesa (mesa_7_7_branch): st/xorg: Fixup configure

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: mesa_7_7_branch
Commit: 46cf606cd35d6740b28fd26bd32dbdfdde2c7833
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=46cf606cd35d6740b28fd26bd32dbdfdde2c7833

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 16:42:06 2010 +0100

st/xorg: Fixup configure

Make sure we always test for XEXT version.
Make sure that the user has a recent version of libkms and libdrm installed.

Not that the st/xorg code requires so new versions to work but these are
needed to make a proper vmwgfx_drv.so driver which is the only real user.

---

 configure.ac |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index a15ca11..d8a1263 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,8 @@ AC_CANONICAL_HOST
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.15
 LIBDRM_RADEON_REQUIRED=2.4.17
+LIBDRM_XORG_REQUIRED=2.4.17
+LIBKMS_XORG_REQUIRED=1.0.0
 DRI2PROTO_REQUIRED=1.99.3
 
 dnl Check for progs
@@ -1149,7 +1151,7 @@ yes)
 GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
 fi
 # Have only tested st/xorg on 1.6.0 servers
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= 
$LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
 HAVE_XORG="yes"; 
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
 HAVE_XORG="no")
 ;;
@@ -1166,15 +1168,21 @@ yes)
 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
 fi
 if test "$tracker" = xorg; then
-   PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
-  HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES 
-DHAVE_XEXTPROTO_71",
-  HAVE_XEXTPROTO_71="no")
+PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
+PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
+HAVE_XORG="yes"
 fi
 done
 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
 ;;
 esac
 
+if test "x$HAVE_XORG" = xyes; then
+PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
+HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
+HAVE_XEXTPROTO_71="no")
+fi
+
 AC_ARG_WITH([xorg-driver-dir],
 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
 [Default xorg driver 
directory[[default=${libdir}/xorg/modules/drivers]]])],

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


Mesa (mesa_7_7_branch): vmware/xorg: Export modinfo just as the other vmware X drivers does

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: mesa_7_7_branch
Commit: eaa4066bfc4b6f5c1cbfb2f894ec0d6525695035
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eaa4066bfc4b6f5c1cbfb2f894ec0d6525695035

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 16:02:03 2010 +0100

vmware/xorg: Export modinfo just as the other vmware X drivers does

---

 src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c |   45 +++--
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c 
b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
index cd273d0..bc5d39f 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
@@ -33,12 +33,50 @@
 
 #include "vmw_hook.h"
 
+
+/*
+ * Defines and modinfo
+ */
+
+#define VMWGFX_DRIVER_NAME "vmwgfx"
+
+#define VMW_STRING_INNER(s) #s
+#define VMW_STRING(str) VMW_STRING_INNER(str)
+
+#define VMWGFX_VERSION_MAJOR 10
+#define VMWGFX_VERSION_MINOR 16
+#define VMWGFX_VERSION_PATCH 9
+#define VMWGFX_VERSION_STRING_MAJOR VMW_STRING(VMWGFX_VERSION_MAJOR)
+#define VMWGFX_VERSION_STRING_MINOR VMW_STRING(VMWGFX_VERSION_MINOR)
+#define VMWGFX_VERSION_STRING_PATCH VMW_STRING(VMWGFX_VERSION_PATCH)
+
+#define VMWGFX_DRIVER_VERSION \
+   (VMWGFX_VERSION_MAJOR * 65536 + VMWGFX_VERSION_MINOR * 256 + 
VMWGFX_VERSION_PATCH)
+#define VMWGFX_DRIVER_VERSION_STRING \
+VMWGFX_VERSION_STRING_MAJOR "." VMWGFX_VERSION_STRING_MINOR \
+"." VMWGFX_VERSION_STRING_PATCH
+
+/*
+ * Standard four digit version string expected by VMware Tools installer.
+ * As the driver's version is only  {major, minor, patchlevel}, simply append 
an
+ * extra zero for the fourth digit.
+ */
+#ifdef __GNUC__
+_X_EXPORT const char vmwgfx_drv_modinfo[] 
__attribute__((section(".modinfo"),unused)) =
+"version=" VMWGFX_DRIVER_VERSION_STRING ".0";
+#endif
+
 static void vmw_xorg_identify(int flags);
 _X_EXPORT Bool vmw_xorg_pci_probe(DriverPtr driver,
  int entity_num,
  struct pci_device *device,
  intptr_t match_data);
 
+
+/*
+ * Tables
+ */
+
 static const struct pci_id_match vmw_xorg_device_match[] = {
 {0x15ad, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0},
 {0, 0, 0, 0, 0, 0, 0},
@@ -55,12 +93,12 @@ static PciChipsets vmw_xorg_pci_devices[] = {
 };
 
 static XF86ModuleVersionInfo vmw_xorg_version = {
-"vmwgfx",
+VMWGFX_DRIVER_NAME,
 MODULEVENDORSTRING,
 MODINFOSTRING1,
 MODINFOSTRING2,
 XORG_VERSION_CURRENT,
-0, 1, 0, /* major, minor, patch */
+VMWGFX_VERSION_MAJOR, VMWGFX_VERSION_MINOR, VMWGFX_VERSION_PATCH,
 ABI_CLASS_VIDEODRV,
 ABI_VIDEODRV_VERSION,
 MOD_CLASS_VIDEODRV,
@@ -73,7 +111,7 @@ static XF86ModuleVersionInfo vmw_xorg_version = {
 
 _X_EXPORT DriverRec vmwgfx = {
 1,
-"vmwgfx",
+VMWGFX_DRIVER_NAME,
 vmw_xorg_identify,
 NULL,
 xorg_tracker_available_options,
@@ -92,6 +130,7 @@ _X_EXPORT XF86ModuleData vmwgfxModuleData = {
 NULL
 };
 
+
 /*
  * Xorg driver functions
  */

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


Mesa (mesa_7_7_branch): svga: Temporarily create a sw vertex buf when failed to create a hw buf.

2010-02-18 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: 770945cff48bef2d0552aba39ee0fd7b8740dc14
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=770945cff48bef2d0552aba39ee0fd7b8740dc14

Author: José Fonseca 
Date:   Thu Feb 18 18:11:50 2010 +

svga: Temporarily create a sw vertex buf when failed to create a hw buf.

Many apps don't check the return of map buffer so it is better not to
fail.

---

 src/gallium/drivers/svga/svga_screen_buffer.c |   27 ++--
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c 
b/src/gallium/drivers/svga/svga_screen_buffer.c
index cb4de42..a4db1d9 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -409,18 +409,31 @@ svga_buffer_map_range( struct pipe_screen *screen,
struct svga_buffer *sbuf = svga_buffer( buf );
void *map;
 
-   if(sbuf->swbuf) {
+   if (!sbuf->swbuf && !sbuf->hw.buf) {
+  if (svga_buffer_create_hw_storage(ss, sbuf) != PIPE_OK) {
+ /*
+  * We can't create a hardware buffer big enough, so create a malloc
+  * buffer instead.
+  */
+
+ debug_printf("%s: failed to allocate %u KB of DMA, splitting DMA 
transfers\n",
+  __FUNCTION__,
+  (sbuf->base.size + 1023)/1024);
+
+ sbuf->swbuf = align_malloc(sbuf->base.size, sbuf->base.alignment);
+  }
+   }
+
+   if (sbuf->swbuf) {
   /* User/malloc buffer */
   map = sbuf->swbuf;
}
-   else {
-  if(!sbuf->hw.buf) {
- if(svga_buffer_create_hw_storage(ss, sbuf) != PIPE_OK)
-return NULL;
-  }
- 
+   else if (sbuf->hw.buf) {
   map = sws->buffer_map(sws, sbuf->hw.buf, usage);
}
+   else {
+  map = NULL;
+   }
 
if(map) {
   pipe_mutex_lock(ss->swc_mutex);

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


Mesa (mesa_7_7_branch): svga: Further cleanup/comment svga buffer code.

2010-02-18 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: a51d638ff305915e882aa5a3bf9e9942196679c2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a51d638ff305915e882aa5a3bf9e9942196679c2

Author: José Fonseca 
Date:   Thu Feb 18 14:05:57 2010 +

svga: Further cleanup/comment svga buffer code.

Just cosmetic changes -- no behavior change.

---

 src/gallium/drivers/svga/svga_screen_buffer.c |  144 
 src/gallium/drivers/svga/svga_screen_buffer.h |  110 ---
 2 files changed, 142 insertions(+), 112 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c 
b/src/gallium/drivers/svga/svga_screen_buffer.c
index a4db1d9..6915da3 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -83,7 +83,7 @@ svga_buffer_create_host_surface(struct svga_screen *ss,
* as svga_screen_surface_create might have passed a recycled host
* buffer.
*/
-  sbuf->hw.flags.discard = TRUE;
+  sbuf->dma.flags.discard = TRUE;
 
   SVGA_DBG(DEBUG_DMA, "   --> got sid %p sz %d (buffer)\n", sbuf->handle, 
sbuf->base.size);
}
@@ -109,10 +109,10 @@ svga_buffer_destroy_hw_storage(struct svga_screen *ss, 
struct svga_buffer *sbuf)
struct svga_winsys_screen *sws = ss->sws;
 
assert(!sbuf->map.count);
-   assert(sbuf->hw.buf);
-   if(sbuf->hw.buf) {
-  sws->buffer_destroy(sws, sbuf->hw.buf);
-  sbuf->hw.buf = NULL;
+   assert(sbuf->hwbuf);
+   if(sbuf->hwbuf) {
+  sws->buffer_destroy(sws, sbuf->hwbuf);
+  sbuf->hwbuf = NULL;
}
 }
 
@@ -151,16 +151,16 @@ static INLINE enum pipe_error
 svga_buffer_create_hw_storage(struct svga_screen *ss,
   struct svga_buffer *sbuf)
 {
-   if(!sbuf->hw.buf) {
+   if(!sbuf->hwbuf) {
   unsigned alignment = sbuf->base.alignment;
   unsigned usage = 0;
   unsigned size = sbuf->base.size;
   
-  sbuf->hw.buf = svga_winsys_buffer_create(ss, alignment, usage, size);
-  if(!sbuf->hw.buf)
+  sbuf->hwbuf = svga_winsys_buffer_create(ss, alignment, usage, size);
+  if(!sbuf->hwbuf)
  return PIPE_ERROR_OUT_OF_MEMORY;
   
-  assert(!sbuf->needs_flush);
+  assert(!sbuf->dma.pending);
}

return PIPE_OK;
@@ -175,12 +175,12 @@ svga_buffer_upload_command(struct svga_context *svga,
struct svga_buffer *sbuf)
 {
struct svga_winsys_context *swc = svga->swc;
-   struct svga_winsys_buffer *guest = sbuf->hw.buf;
+   struct svga_winsys_buffer *guest = sbuf->hwbuf;
struct svga_winsys_surface *host = sbuf->handle;
SVGA3dTransferType transfer = SVGA3D_WRITE_HOST_VRAM;
-   SVGA3dSurfaceDMAFlags flags = sbuf->hw.flags;
+   SVGA3dSurfaceDMAFlags flags = sbuf->dma.flags;
SVGA3dCmdSurfaceDMA *cmd;
-   uint32 numBoxes = sbuf->hw.num_ranges;
+   uint32 numBoxes = sbuf->map.num_ranges;
SVGA3dCopyBox *boxes;
SVGA3dCmdSurfaceDMASuffix *pSuffix;
unsigned region_flags;
@@ -218,8 +218,8 @@ svga_buffer_upload_command(struct svga_context *svga,
 
cmd->transfer = transfer;
 
-   sbuf->hw.boxes = (SVGA3dCopyBox *)&cmd[1];
-   sbuf->hw.svga = svga;
+   sbuf->dma.boxes = (SVGA3dCopyBox *)&cmd[1];
+   sbuf->dma.svga = svga;
 
/* Increment reference count */
dummy = NULL;
@@ -248,10 +248,10 @@ svga_buffer_upload_flush(struct svga_context *svga,
unsigned i;
 
assert(sbuf->handle); 
-   assert(sbuf->hw.buf);
-   assert(sbuf->hw.num_ranges);
-   assert(sbuf->hw.svga == svga);
-   assert(sbuf->hw.boxes);
+   assert(sbuf->hwbuf);
+   assert(sbuf->map.num_ranges);
+   assert(sbuf->dma.svga == svga);
+   assert(sbuf->dma.boxes);

/*
 * Patch the DMA command with the final copy box.
@@ -259,34 +259,34 @@ svga_buffer_upload_flush(struct svga_context *svga,
 
SVGA_DBG(DEBUG_DMA, "dma to sid %p\n", sbuf->handle);
 
-   boxes = sbuf->hw.boxes;
-   for(i = 0; i < sbuf->hw.num_ranges; ++i) {
+   boxes = sbuf->dma.boxes;
+   for(i = 0; i < sbuf->map.num_ranges; ++i) {
   SVGA_DBG(DEBUG_DMA, "  bytes %u - %u\n",
-   sbuf->hw.ranges[i].start, sbuf->hw.ranges[i].end);
+   sbuf->map.ranges[i].start, sbuf->map.ranges[i].end);
 
-  boxes[i].x = sbuf->hw.ranges[i].start;
+  boxes[i].x = sbuf->map.ranges[i].start;
   boxes[i].y = 0;
   boxes[i].z = 0;
-  boxes[i].w = sbuf->hw.ranges[i].end - sbuf->hw.ranges[i].start;
+  boxes[i].w = sbuf->map.ranges[i].end - sbuf->map.ranges[i].start;
   boxes[i].h = 1;
   boxes[i].d = 1;
-  boxes[i].srcx = sbuf->hw.ranges[i].start;
+  boxes[i].srcx = sbuf->map.ranges[i].start;
   boxes[i].srcy = 0;
   boxes[i].srcz = 0;
}
 
-   sbuf->hw.num_ranges = 0;
-   memset(&sbuf->hw.flags, 0, sizeof sbuf->hw.flags);
+   sbuf->map.num_ranges = 0;
+   memset(&sbuf->dma.flags, 0, sizeof sbuf->dma.flags);
 
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
 #ifdef DEBUG
sbuf->head.next = sbuf->head.pr

Mesa (mesa_7_7_branch): svga: Break uploads of big buffers into smaller pieces.

2010-02-18 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: 12617c7e3072fbbc65b66adb9cd8e32927b70d8b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12617c7e3072fbbc65b66adb9cd8e32927b70d8b

Author: José Fonseca 
Date:   Thu Feb 18 16:40:14 2010 +

svga: Break uploads of big buffers into smaller pieces.

Fixes crash in Homeworld2 which tries to create a 14MB buffer, because we
now avoid creating GMR buffers larger than 8MB to ensure progress given
we have only a 16MB pool.

---

 src/gallium/drivers/svga/svga_screen_buffer.c |  159 +
 src/gallium/drivers/svga/svga_screen_buffer.h |   10 ++
 2 files changed, 147 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c 
b/src/gallium/drivers/svga/svga_screen_buffer.c
index 7e8772c..684210e 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -178,7 +178,6 @@ svga_buffer_upload_command(struct svga_context *svga,
struct svga_winsys_buffer *guest = sbuf->hwbuf;
struct svga_winsys_surface *host = sbuf->handle;
SVGA3dTransferType transfer = SVGA3D_WRITE_HOST_VRAM;
-   SVGA3dSurfaceDMAFlags flags = sbuf->dma.flags;
SVGA3dCmdSurfaceDMA *cmd;
uint32 numBoxes = sbuf->map.num_ranges;
SVGA3dCopyBox *boxes;
@@ -228,9 +227,11 @@ svga_buffer_upload_command(struct svga_context *svga,
pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + 
numBoxes * sizeof *boxes);
pSuffix->suffixSize = sizeof *pSuffix;
pSuffix->maximumOffset = sbuf->base.size;
-   pSuffix->flags = flags;
+   pSuffix->flags = sbuf->dma.flags;
 
-   swc->commit(swc);
+   SVGA_FIFOCommitAll(swc);
+
+   sbuf->dma.flags.discard = FALSE;
 
return PIPE_OK;
 }
@@ -276,7 +277,6 @@ svga_buffer_upload_flush(struct svga_context *svga,
}
 
sbuf->map.num_ranges = 0;
-   memset(&sbuf->dma.flags, 0, sizeof sbuf->dma.flags);
 
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
@@ -626,7 +626,6 @@ svga_buffer_update_hw(struct svga_screen *ss, struct 
svga_buffer *sbuf)
  return PIPE_ERROR;
   
   ret = svga_buffer_create_hw_storage(ss, sbuf);
-  assert(ret == PIPE_OK);
   if(ret != PIPE_OK)
  return ret;
 
@@ -635,7 +634,8 @@ svga_buffer_update_hw(struct svga_screen *ss, struct 
svga_buffer *sbuf)
   assert(map);
   if(!map) {
 pipe_mutex_unlock(ss->swc_mutex);
- return PIPE_ERROR_OUT_OF_MEMORY;
+ svga_buffer_destroy_hw_storage(ss, sbuf);
+ return PIPE_ERROR;
   }
 
   memcpy(map, sbuf->swbuf, sbuf->base.size);
@@ -651,10 +651,86 @@ svga_buffer_update_hw(struct svga_screen *ss, struct 
svga_buffer *sbuf)
  sbuf->swbuf = NULL;
   }
   
-  svga_buffer_add_range(sbuf, 0, sbuf->base.size);
+  pipe_mutex_unlock(ss->swc_mutex);
}

-   pipe_mutex_unlock(ss->swc_mutex);
+   return PIPE_OK;
+}
+
+
+/**
+ * Upload the buffer to the host in a piecewise fashion.
+ *
+ * Used when the buffer is too big to fit in the GMR aperture.
+ */
+static INLINE enum pipe_error
+svga_buffer_upload_piecewise(struct svga_screen *ss,
+ struct svga_context *svga,
+ struct svga_buffer *sbuf)
+{
+   struct svga_winsys_screen *sws = ss->sws;
+   const unsigned alignment = sbuf->base.alignment;
+   const unsigned usage = 0;
+   unsigned size = sbuf->base.size;
+   unsigned offset = 0;
+
+   SVGA_DBG(DEBUG_DMA, "dma to sid %p\n", sbuf->handle);
+
+   /*
+* TODO: upload only the modified ranges
+*/
+
+   offset = 0;
+   while (offset < sbuf->base.size) {
+  struct svga_winsys_buffer *hwbuf;
+  uint8_t *map;
+  enum pipe_error ret;
+
+  if (offset + size > sbuf->base.size)
+ size = sbuf->base.size - offset;
+
+  hwbuf = svga_winsys_buffer_create(ss, alignment, usage, size);
+  while (!hwbuf) {
+ size /= 2;
+ if (!size)
+return PIPE_ERROR_OUT_OF_MEMORY;
+ hwbuf = svga_winsys_buffer_create(ss, alignment, usage, size);
+  }
+
+  SVGA_DBG(DEBUG_DMA, "  bytes %u - %u\n",
+   offset, offset + size);
+
+  map = sws->buffer_map(sws, hwbuf,
+PIPE_BUFFER_USAGE_CPU_WRITE |
+PIPE_BUFFER_USAGE_DISCARD);
+  assert(map);
+  if (map) {
+ memcpy(map, sbuf->swbuf, size);
+ sws->buffer_unmap(sws, hwbuf);
+  }
+
+  ret = SVGA3D_BufferDMA(svga->swc,
+ hwbuf, sbuf->handle,
+ SVGA3D_WRITE_HOST_VRAM,
+ size, offset, sbuf->dma.flags);
+  if(ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret =  SVGA3D_BufferDMA(svga->swc,
+ hwbuf, sbuf->handle,
+ SVGA3D_WRITE_HOST_VRAM,
+ size, offset, sbuf->dma.flags);
+ assert(ret == PIPE

Mesa (mesa_7_7_branch): svga: Upload the dirty ranges instead of the whole buffer.

2010-02-18 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: 18ff85e91d75570342cac787eb2d30112d182e32
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=18ff85e91d75570342cac787eb2d30112d182e32

Author: José Fonseca 
Date:   Thu Feb 18 17:21:53 2010 +

svga: Upload the dirty ranges instead of the whole buffer.

---

 src/gallium/drivers/svga/svga_screen_buffer.c |   93 +
 1 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c 
b/src/gallium/drivers/svga/svga_screen_buffer.c
index 684210e..7499bd7 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -611,7 +611,7 @@ svga_screen_init_buffer_functions(struct pipe_screen 
*screen)
 }
 
 
-/** 
+/**
  * Copy the contents of the user buffer / malloc buffer to a hardware buffer.
  */
 static INLINE enum pipe_error
@@ -669,64 +669,67 @@ svga_buffer_upload_piecewise(struct svga_screen *ss,
  struct svga_buffer *sbuf)
 {
struct svga_winsys_screen *sws = ss->sws;
-   const unsigned alignment = sbuf->base.alignment;
+   const unsigned alignment = sizeof(void *);
const unsigned usage = 0;
-   unsigned size = sbuf->base.size;
-   unsigned offset = 0;
+   unsigned i;
+
+   assert(sbuf->map.num_ranges);
+   assert(!sbuf->dma.pending);
 
SVGA_DBG(DEBUG_DMA, "dma to sid %p\n", sbuf->handle);
 
-   /*
-* TODO: upload only the modified ranges
-*/
+   for (i = 0; i < sbuf->map.num_ranges; ++i) {
+  struct svga_buffer_range *range = &sbuf->map.ranges[i];
+  unsigned offset = range->start;
+  unsigned size = range->end - range->start;
 
-   offset = 0;
-   while (offset < sbuf->base.size) {
-  struct svga_winsys_buffer *hwbuf;
-  uint8_t *map;
-  enum pipe_error ret;
+  while (offset < range->end) {
+ struct svga_winsys_buffer *hwbuf;
+ uint8_t *map;
+ enum pipe_error ret;
 
-  if (offset + size > sbuf->base.size)
- size = sbuf->base.size - offset;
+ if (offset + size > range->end)
+size = range->end - offset;
 
-  hwbuf = svga_winsys_buffer_create(ss, alignment, usage, size);
-  while (!hwbuf) {
- size /= 2;
- if (!size)
-return PIPE_ERROR_OUT_OF_MEMORY;
  hwbuf = svga_winsys_buffer_create(ss, alignment, usage, size);
-  }
+ while (!hwbuf) {
+size /= 2;
+if (!size)
+   return PIPE_ERROR_OUT_OF_MEMORY;
+hwbuf = svga_winsys_buffer_create(ss, alignment, usage, size);
+ }
 
-  SVGA_DBG(DEBUG_DMA, "  bytes %u - %u\n",
-   offset, offset + size);
+ SVGA_DBG(DEBUG_DMA, "  bytes %u - %u\n",
+  offset, offset + size);
 
-  map = sws->buffer_map(sws, hwbuf,
-PIPE_BUFFER_USAGE_CPU_WRITE |
-PIPE_BUFFER_USAGE_DISCARD);
-  assert(map);
-  if (map) {
- memcpy(map, sbuf->swbuf, size);
- sws->buffer_unmap(sws, hwbuf);
-  }
+ map = sws->buffer_map(sws, hwbuf,
+   PIPE_BUFFER_USAGE_CPU_WRITE |
+   PIPE_BUFFER_USAGE_DISCARD);
+ assert(map);
+ if (map) {
+memcpy(map, sbuf->swbuf, size);
+sws->buffer_unmap(sws, hwbuf);
+ }
 
-  ret = SVGA3D_BufferDMA(svga->swc,
- hwbuf, sbuf->handle,
- SVGA3D_WRITE_HOST_VRAM,
- size, offset, sbuf->dma.flags);
-  if(ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret =  SVGA3D_BufferDMA(svga->swc,
- hwbuf, sbuf->handle,
- SVGA3D_WRITE_HOST_VRAM,
- size, offset, sbuf->dma.flags);
- assert(ret == PIPE_OK);
-  }
+ ret = SVGA3D_BufferDMA(svga->swc,
+hwbuf, sbuf->handle,
+SVGA3D_WRITE_HOST_VRAM,
+size, offset, sbuf->dma.flags);
+ if(ret != PIPE_OK) {
+svga_context_flush(svga, NULL);
+ret =  SVGA3D_BufferDMA(svga->swc,
+hwbuf, sbuf->handle,
+SVGA3D_WRITE_HOST_VRAM,
+size, offset, sbuf->dma.flags);
+assert(ret == PIPE_OK);
+ }
 
-  sbuf->dma.flags.discard = FALSE;
+ sbuf->dma.flags.discard = FALSE;
 
-  sws->buffer_destroy(sws, hwbuf);
+ sws->buffer_destroy(sws, hwbuf);
 
-  offset += size;
+ offset += size;
+  }
}
 
sbuf->map.num_ranges = 0;

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


Mesa (mesa_7_7_branch): svga: Note ranges even when there is no hardware buffer around.

2010-02-18 Thread Jose Fonseca
Module: Mesa
Branch: mesa_7_7_branch
Commit: 5dbf44953c4766ebc54811847f485dd6eb88b238
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5dbf44953c4766ebc54811847f485dd6eb88b238

Author: José Fonseca 
Date:   Thu Feb 18 14:12:31 2010 +

svga: Note ranges even when there is no hardware buffer around.

Not having a hardware buffer around doesn't change the fact that the
range is dirty and needs to be uploaded eventually.

---

 src/gallium/drivers/svga/svga_screen_buffer.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c 
b/src/gallium/drivers/svga/svga_screen_buffer.c
index 6915da3..7e8772c 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -311,7 +311,6 @@ svga_buffer_add_range(struct svga_buffer *sbuf,
unsigned nearest_range;
unsigned nearest_dist;
 
-   assert(sbuf->hwbuf);
assert(end > start);

if (sbuf->map.num_ranges < SVGA_BUFFER_MAX_RANGES) {
@@ -465,8 +464,7 @@ svga_buffer_flush_mapped_range( struct pipe_screen *screen,
assert(sbuf->map.writing);
if(sbuf->map.writing) {
   assert(sbuf->map.flush_explicit);
-  if(sbuf->hwbuf)
- svga_buffer_add_range(sbuf, offset, offset + length);
+  svga_buffer_add_range(sbuf, offset, offset + length);
}
pipe_mutex_unlock(ss->swc_mutex);
 }
@@ -493,8 +491,7 @@ svga_buffer_unmap( struct pipe_screen *screen,
  /* No mapped range was flushed -- flush the whole buffer */
  SVGA_DBG(DEBUG_DMA, "flushing the whole buffer\n");

- if(sbuf->hwbuf)
-svga_buffer_add_range(sbuf, 0, sbuf->base.size);
+ svga_buffer_add_range(sbuf, 0, sbuf->base.size);
   }
   
   sbuf->map.writing = FALSE;

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


Mesa (mesa_7_7_branch): configure: PTHREADS should be defined on cygwin, as well

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: mesa_7_7_branch
Commit: c1a4f249f18a766488da0832fbf6700de93af2f8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1a4f249f18a766488da0832fbf6700de93af2f8

Author: Jon TURNEY 
Date:   Tue Jun 23 00:16:19 2009 +0100

configure: PTHREADS should be defined on cygwin, as well

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

---

 configure.ac |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index d8a1263..1af1cab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,9 @@ linux*|*-gnu*|gnu*)
 solaris*)
 DEFINES="$DEFINES -DPTHREADS -DSVR4"
 ;;
+cygwin*)
+DEFINES="$DEFINES -DPTHREADS"
+;;
 esac
 
 dnl Add flags for gcc and g++

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


Mesa (mesa_7_7_branch): mklib: Teach mklib to fail build if link fails on cygwin

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: mesa_7_7_branch
Commit: 551c96979e643b409535afe868c42cac0d2285ad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=551c96979e643b409535afe868c42cac0d2285ad

Author: Jon TURNEY 
Date:   Thu Feb 18 15:13:41 2010 +

mklib: Teach mklib to fail build if link fails on cygwin

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

---

 bin/mklib |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 3bec160..8471d91 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -920,6 +920,11 @@ case $ARCH in
 
 # make lib
 ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} 
${DEPS}
+# make build fail if link failed
+es=$?
+if [ "$es" -ne "0" ]; then
+exit $es
+fi
 # make usual symlinks
 ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a
 # finish up

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


Mesa (master): configure: PTHREADS should be defined on cygwin, as well

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 979889038ebb5b95b2e609372aaec10fd9da8172
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=979889038ebb5b95b2e609372aaec10fd9da8172

Author: Brian Paul 
Date:   Thu Feb 18 12:46:12 2010 -0700

configure: PTHREADS should be defined on cygwin, as well

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

(cherry picked from commit c1a4f249f18a766488da0832fbf6700de93af2f8)

---

 configure.ac |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index be06adf..485836a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,9 @@ linux*|*-gnu*|gnu*)
 solaris*)
 DEFINES="$DEFINES -DPTHREADS -DSVR4"
 ;;
+cygwin*)
+DEFINES="$DEFINES -DPTHREADS"
+;;
 esac
 
 dnl Add flags for gcc and g++

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


Mesa (master): mklib: Teach mklib to fail build if link fails on cygwin

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 205c9659cffb5f5e7632cabd20938038e7ba2c7b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=205c9659cffb5f5e7632cabd20938038e7ba2c7b

Author: Brian Paul 
Date:   Thu Feb 18 12:46:48 2010 -0700

mklib: Teach mklib to fail build if link fails on cygwin

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

(cherry picked from commit 551c96979e643b409535afe868c42cac0d2285ad)

---

 bin/mklib |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 9e6e46d..2ef9022 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -977,6 +977,11 @@ case $ARCH in
 
 # make lib
 ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} 
${DEPS}
+# make build fail if link failed
+es=$?
+if [ "$es" -ne "0" ]; then
+exit $es
+fi
 # make usual symlinks
 ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a
 # finish up

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


Mesa (master): Make mklib propogate all errors

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d6f55492af3cb82b0113fe6beac0f3494b6e2956
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6f55492af3cb82b0113fe6beac0f3494b6e2956

Author: Jon TURNEY 
Date:   Thu Feb 18 19:25:56 2010 +

Make mklib propogate all errors

Signed-off-by: Jon TURNEY 
Signed-off-by: Brian Paul 

---

 bin/mklib |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 2ef9022..68d2205 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -24,6 +24,12 @@
 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
+# propagate any errors
+function errtrap {
+es=$?
+exit $es
+}
+trap errtrap ERR
 
 # Given a list of files, look for .a archives and unpack them.
 # Return the original list of files minus the .a files plus the unpacked files.

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


Mesa (master): mklib: remove unused -contents_of_archives(), add comments

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: cc66847c1095d01fe766e004ad1d5dbf8c77b380
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc66847c1095d01fe766e004ad1d5dbf8c77b380

Author: Brian Paul 
Date:   Thu Feb 18 13:02:59 2010 -0700

mklib: remove unused -contents_of_archives(), add comments

---

 bin/mklib |   25 -
 1 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 68d2205..fa0c82b 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -24,6 +24,7 @@
 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
+
 # propagate any errors
 function errtrap {
 es=$?
@@ -31,8 +32,11 @@ function errtrap {
 }
 trap errtrap ERR
 
+
 # Given a list of files, look for .a archives and unpack them.
 # Return the original list of files minus the .a files plus the unpacked files.
+# first param:  name of a temp directory (to be deleted when finished)
+# remaining params:  list of .o and .a files
 expand_archives() {
 DIR=$1
 shift
@@ -66,27 +70,6 @@ expand_archives() {
 }
 
 
-# Given a list of files, look for .a archives and return a list of all objects
-# in the .a archives.
-contents_of_archives() {
-FILES=$@
-NEWFILES=""
-for FILE in $FILES ; do
-case $FILE in
-*.a)
-# get list of members in this .a archive
-MEMBERS=`ar t $FILE`
-NEWFILES="$NEWFILES $MEMBERS"
-;;
-*)
-# skip other file types
-;;
-esac
-done
-echo $NEWFILES
-}
-
-
 # Make static library with 'ar'
 # params:
 #options to ar

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


Mesa (master): mesa: silence mklib output for libglapi. c as for other targets

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b69dad2921e4477ce721649e4771e73ea453a03b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b69dad2921e4477ce721649e4771e73ea453a03b

Author: Brian Paul 
Date:   Thu Feb 18 12:54:28 2010 -0700

mesa: silence mklib output for libglapi.c as for other targets

---

 src/mesa/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index f845d93..0cb49e8 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -38,7 +38,7 @@ libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
 
 # Make archive of gl* API dispatcher functions only
 libglapi.a: $(GLAPI_OBJECTS)
-   $(MKLIB) -o glapi -static $(GLAPI_OBJECTS)
+   @ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS)
 
 ##
 # Device drivers

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


Mesa (master): Revert "Make mklib propogate all errors"

2010-02-18 Thread Dan Nicholson
Module: Mesa
Branch: master
Commit: 79cc455cb8f2da1155e4d7fd4ddb9c1914ea5889
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=79cc455cb8f2da1155e4d7fd4ddb9c1914ea5889

Author: Dan Nicholson 
Date:   Thu Feb 18 14:48:53 2010 -0800

Revert "Make mklib propogate all errors"

This reverts commit d6f55492af3cb82b0113fe6beac0f3494b6e2956.

It's both not portable and not safe to trap & exit on ERR. This will
need to use a more invasive approach that tests return code only for
selected, important commands.

---

 bin/mklib |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index fa0c82b..c4b3478 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -25,14 +25,6 @@
 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
-# propagate any errors
-function errtrap {
-es=$?
-exit $es
-}
-trap errtrap ERR
-
-
 # Given a list of files, look for .a archives and unpack them.
 # Return the original list of files minus the .a files plus the unpacked files.
 # first param:  name of a temp directory (to be deleted when finished)

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


Mesa (master): i915: update render buffers at prepare_render time

2010-02-18 Thread Jesse Barnes
Module: Mesa
Branch: master
Commit: 0032525242950bae197b267794193cdcb611c376
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0032525242950bae197b267794193cdcb611c376

Author: Jesse Barnes 
Date:   Thu Feb 18 14:58:17 2010 -0800

i915: update render buffers at prepare_render time

We need to do this before we emit any state dependent on the current
render buffers.

---

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

diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c 
b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 392126b..30aaab7 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -55,6 +55,7 @@ i915_render_prevalidate(struct intel_context *intel)
 static void
 i915_render_start(struct intel_context *intel)
 {
+   intel_prepare_render(intel);
 }
 
 

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


Mesa (master): trace: Propagate api->name up

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: master
Commit: 288e4b15e08fc4c9c94f4a09885cc2c2a073bc3c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=288e4b15e08fc4c9c94f4a09885cc2c2a073bc3c

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 23:13:47 2010 +

trace: Propagate api->name up

---

 src/gallium/drivers/trace/tr_drm.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/trace/tr_drm.c 
b/src/gallium/drivers/trace/tr_drm.c
index 919dc1b..b8adde7 100644
--- a/src/gallium/drivers/trace/tr_drm.c
+++ b/src/gallium/drivers/trace/tr_drm.c
@@ -155,6 +155,7 @@ trace_drm_create(struct drm_api *api)
if (!tr_api)
   goto error;
 
+   tr_api->base.name = api->name;
tr_api->base.driver_name = api->driver_name;
tr_api->base.create_screen = trace_drm_create_screen;
tr_api->base.texture_from_shared_handle = 
trace_drm_texture_from_shared_handle;

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


Mesa (master): pipebuffer: Include fenced buffer manager in build

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: master
Commit: 1ee905bc47272bb5eec1fd7d43cf55b07cb620ca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ee905bc47272bb5eec1fd7d43cf55b07cb620ca

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 22:42:31 2010 +

pipebuffer: Include fenced buffer manager in build

---

 src/gallium/auxiliary/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index ff76951..916f5f6 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -54,6 +54,7 @@ C_SOURCES = \
os/os_stream_str.c \
os/os_stream_null.c \
os/os_time.c \
+   pipebuffer/pb_buffer_fenced.c \
pipebuffer/pb_buffer_malloc.c \
pipebuffer/pb_bufmgr_alt.c \
pipebuffer/pb_bufmgr_cache.c \

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


Mesa (master): identity: Propagate api->name and api->driver_name up

2010-02-18 Thread Jakob Bornecrantz
Module: Mesa
Branch: master
Commit: 2ecdc2ecec6c371439ea21ed40de090f822dd728
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ecdc2ecec6c371439ea21ed40de090f822dd728

Author: Jakob Bornecrantz 
Date:   Thu Feb 18 23:14:11 2010 +

identity: Propagate api->name and api->driver_name up

---

 src/gallium/drivers/identity/id_drm.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/identity/id_drm.c 
b/src/gallium/drivers/identity/id_drm.c
index 12b516b..b89724e 100644
--- a/src/gallium/drivers/identity/id_drm.c
+++ b/src/gallium/drivers/identity/id_drm.c
@@ -142,6 +142,8 @@ identity_drm_create(struct drm_api *api)
if (!id_api)
   goto error;
 
+   id_api->base.name = api->name;
+   id_api->base.driver_name = api->driver_name;
id_api->base.create_screen = identity_drm_create_screen;
id_api->base.texture_from_shared_handle = 
identity_drm_texture_from_shared_handle;
id_api->base.shared_handle_from_texture = 
identity_drm_shared_handle_from_texture;

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


Mesa (mesa_7_7_branch): softpipe: fix depth testing problems

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: mesa_7_7_branch
Commit: d437d905e6924ebc05ec9efe87e1e2c48d75bc13
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d437d905e6924ebc05ec9efe87e1e2c48d75bc13

Author: Brian Paul 
Date:   Thu Feb 18 16:47:27 2010 -0700

softpipe: fix depth testing problems

The optimized Z-test functions assumed that the array of incoming quads
are adjacent, but that's not always true.  The fragment shader can cull
intermediate quads, for example.

Now these Z-test functions can cope with non-adjacent quads.  A little bit
of performance is probably lost, but it's probably not worth worring about.

This fixes broken glBitmap() Z testing, among other things.

---

 src/gallium/drivers/softpipe/sp_quad_depth_test.c |   89 
 1 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c 
b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 5cb17c5..6b93ebb 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -714,9 +714,14 @@ depth_test_quads_fallback(struct quad_stage *qs,
   qs->next->run(qs->next, quads, nr);
 }
 
-/* XXX: this function assumes setup function actually emits linear
- * spans of quads.  It seems a lot more natural to do (early)
- * depth-testing on spans rather than quads.
+
+/**
+ * Special-case Z testing for 16-bit Zbuffer, PIPE_FUNC_LESS and
+ * Z buffer writes enabled.
+ *
+ * NOTE: there's no guarantee that the quads are sequentially side by
+ * side.  The fragment shader may have culled some quads, etc.  Sliver
+ * triangles may generate non-sequential quads.
  */
 static void
 depth_interp_z16_less_write(struct quad_stage *qs, 
@@ -733,25 +738,33 @@ depth_interp_z16_less_write(struct quad_stage *qs,
const float z0 = quads[0]->posCoef->a0[2] + dzdx * fx + dzdy * fy;
struct softpipe_cached_tile *tile;
ushort (*depth16)[TILE_SIZE];
-   ushort idepth[4], depth_step;
+   ushort init_idepth[4], idepth[4], depth_step;
const float scale = 65535.0;
 
-   idepth[0] = (ushort)((z0) * scale);
-   idepth[1] = (ushort)((z0 + dzdx) * scale);
-   idepth[2] = (ushort)((z0 + dzdy) * scale);
-   idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale);
+   /* compute scaled depth of the four pixels in first quad */
+   init_idepth[0] = (ushort)((z0) * scale);
+   init_idepth[1] = (ushort)((z0 + dzdx) * scale);
+   init_idepth[2] = (ushort)((z0 + dzdy) * scale);
+   init_idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale);
 
-   depth_step = (ushort)(dzdx * 2 * scale);
+   depth_step = (ushort)(dzdx * scale);
 
tile = sp_get_cached_tile(qs->softpipe->zsbuf_cache, ix, iy);
 
-   depth16 = (ushort (*)[TILE_SIZE])
-  &tile->data.depth16[iy % TILE_SIZE][ix % TILE_SIZE];
-
for (i = 0; i < nr; i++) {
-  unsigned outmask = quads[i]->inout.mask;
+  const unsigned outmask = quads[i]->inout.mask;
+  const int dx = quads[i]->input.x0 - ix;
   unsigned mask = 0;
-  
+
+  /* compute depth for this quad */
+  idepth[0] = init_idepth[0] + dx * depth_step;
+  idepth[1] = init_idepth[1] + dx * depth_step;
+  idepth[2] = init_idepth[2] + dx * depth_step;
+  idepth[3] = init_idepth[3] + dx * depth_step;
+
+  depth16 = (ushort (*)[TILE_SIZE])
+ &tile->data.depth16[iy % TILE_SIZE][(ix + dx)% TILE_SIZE];
+
   if ((outmask & 1) && idepth[0] < depth16[0][0]) {
  depth16[0][0] = idepth[0];
  mask |= (1 << 0);
@@ -772,13 +785,6 @@ depth_interp_z16_less_write(struct quad_stage *qs,
  mask |= (1 << 3);
   }
 
-  idepth[0] += depth_step;
-  idepth[1] += depth_step;
-  idepth[2] += depth_step;
-  idepth[3] += depth_step;
-
-  depth16 = (ushort (*)[TILE_SIZE]) &depth16[0][2];
-
   quads[i]->inout.mask = mask;
   if (quads[i]->inout.mask)
  quads[pass++] = quads[i];
@@ -790,6 +796,14 @@ depth_interp_z16_less_write(struct quad_stage *qs,
 }
 
 
+/**
+ * Special-case Z testing for 16-bit Zbuffer, PIPE_FUNC_LEQUAL and
+ * Z buffer writes enabled.
+ *
+ * NOTE: there's no guarantee that the quads are sequentially side by
+ * side.  The fragment shader may have culled some quads, etc.  Sliver
+ * triangles may generate non-sequential quads.
+ */
 static void
 depth_interp_z16_lequal_write(struct quad_stage *qs, 
 struct quad_header *quads[],
@@ -805,25 +819,33 @@ depth_interp_z16_lequal_write(struct quad_stage *qs,
const float z0 = quads[0]->posCoef->a0[2] + dzdx * fx + dzdy * fy;
struct softpipe_cached_tile *tile;
ushort (*depth16)[TILE_SIZE];
-   ushort idepth[4], depth_step;
+   ushort init_idepth[4], idepth[4], depth_step;
const float scale = 65535.0;
 
-   idepth[0] = (ushort)((z0) * scale);
-   idepth[1] = (ushort)((z0 + dzdx) * scale);
-   idepth[2] = (ushort)((z0 + dzdy) * scale);
-   idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale);
+   /* compute scaled depth of the four pixels in first quad */
+  

Mesa (master): softpipe: const qualifiers, comments

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 46b5ae71697fd04de103d628d30501fa1a4e59ad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=46b5ae71697fd04de103d628d30501fa1a4e59ad

Author: Brian Paul 
Date:   Thu Feb 18 16:32:36 2010 -0700

softpipe: const qualifiers, comments

---

 src/gallium/drivers/softpipe/sp_setup.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_setup.c 
b/src/gallium/drivers/softpipe/sp_setup.c
index b8590a8..85966bc 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -211,11 +211,11 @@ static void flush_spans( struct setup_context *setup )
const int xright1 = setup->span.right[1];
struct quad_stage *pipe = setup->softpipe->quad.first;
 
-
-   int minleft = block_x(MIN2(xleft0, xleft1));
-   int maxright = MAX2(xright0, xright1);
+   const int minleft = block_x(MIN2(xleft0, xleft1));
+   const int maxright = MAX2(xright0, xright1);
int x;
 
+   /* process quads in horizontal chunks of 16 */
for (x = minleft; x < maxright; x += step) {
   unsigned skip_left0 = CLAMP(xleft0 - x, 0, step);
   unsigned skip_left1 = CLAMP(xleft1 - x, 0, step);

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


Mesa (master): softpipe: comments and whitespace fixes

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 00d1d8aad3b97899e3fab1cc4e4296c3f6ee8513
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=00d1d8aad3b97899e3fab1cc4e4296c3f6ee8513

Author: Brian Paul 
Date:   Thu Feb 18 16:33:26 2010 -0700

softpipe: comments and whitespace fixes

---

 src/gallium/drivers/softpipe/sp_quad_fs.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c 
b/src/gallium/drivers/softpipe/sp_quad_fs.c
index ad04dc2..8ae5a7f 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -65,6 +65,7 @@ quad_shade_stage(struct quad_stage *qs)
 
 /**
  * Execute fragment shader for the four fragments in the quad.
+ * \return TRUE if quad is alive, FALSE if all four pixels are killed
  */
 static INLINE boolean
 shade_quad(struct quad_stage *qs, struct quad_header *quad)
@@ -98,11 +99,14 @@ coverage_quad(struct quad_stage *qs, struct quad_header 
*quad)
 }
 
 
-
+/**
+ * Shade/write an array of quads
+ * Called via quad_stage::run()
+ */
 static void
 shade_quads(struct quad_stage *qs, 
- struct quad_header *quads[],
- unsigned nr)
+struct quad_header *quads[],
+unsigned nr)
 {
struct quad_shade_stage *qss = quad_shade_stage( qs );
struct softpipe_context *softpipe = qs->softpipe;
@@ -116,7 +120,7 @@ shade_quads(struct quad_stage *qs,
 
for (i = 0; i < nr; i++) {
   if (!shade_quad(qs, quads[i]))
- continue;
+ continue; /* quad totally culled/killed */
 
   if (/*do_coverage*/ 0)
  coverage_quad( qs, quads[i] );
@@ -129,9 +133,6 @@ shade_quads(struct quad_stage *qs,
 }

 
-
-
-
 /**
  * Per-primitive (or per-begin?) setup
  */

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


Mesa (master): progs/demos: update arbocclude. c to do multiple queries at once

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 86bf224cac4600ad4706ee101ced9e3f1a9886b4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86bf224cac4600ad4706ee101ced9e3f1a9886b4

Author: Brian Paul 
Date:   Thu Feb 18 16:54:14 2010 -0700

progs/demos: update arbocclude.c to do multiple queries at once

Issue a whole bunch of queries then get the results and render.
Draw the test object in red instead of orange if the result was not
ready when we first queried it.

---

 progs/demos/arbocclude.c |  213 +++---
 1 files changed, 108 insertions(+), 105 deletions(-)

diff --git a/progs/demos/arbocclude.c b/progs/demos/arbocclude.c
index f669a1f..cc787ee 100644
--- a/progs/demos/arbocclude.c
+++ b/progs/demos/arbocclude.c
@@ -32,11 +32,12 @@
 #include 
 #include 
 
-#define TEST_DISPLAY_LISTS 0
+#define NUM_OCC 10
 
 static GLboolean Anim = GL_TRUE;
-static GLfloat Xpos = 0;
-static GLuint OccQuery;
+static GLfloat Xpos[NUM_OCC], Ypos[NUM_OCC];
+static GLfloat Sign[NUM_OCC];
+static GLuint OccQuery[NUM_OCC];
 static GLint Win = 0;
 
 
@@ -54,38 +55,43 @@ PrintString(const char *s)
 static void Idle(void)
 {
static int lastTime = 0;
-   static int sign = +1;
int time = glutGet(GLUT_ELAPSED_TIME);
float step;
+   int i;
 
if (lastTime == 0)
   lastTime = time;
else if (time - lastTime < 20)  /* 50Hz update */
   return;
 
-   step = (time - lastTime) / 1000.0 * sign;
-   lastTime = time;
+   for (i = 0; i < NUM_OCC; i++) {
 
-   Xpos += step;
+  step = (time - lastTime) / 1000.0 * Sign[i];
+
+  Xpos[i] += step;
+
+  if (Xpos[i] > 2.5) {
+ Xpos[i] = 2.5;
+ Sign[i] = -1;
+  }
+  else if (Xpos[i] < -2.5) {
+ Xpos[i] = -2.5;
+ Sign[i] = +1;
+  }
 
-   if (Xpos > 2.5) {
-  Xpos = 2.5;
-  sign = -1;
-   }
-   else if (Xpos < -2.5) {
-  Xpos = -2.5;
-  sign = +1;
}
+
+   lastTime = time;
+
glutPostRedisplay();
 }
 
 
 static void Display( void )
 {
-   GLuint passed;
-   GLint ready;
-   char s[100];
+   int i;
 
+   glClearColor(0.25, 0.25, 0.25, 0.0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 
glMatrixMode( GL_PROJECTION );
@@ -96,97 +102,84 @@ static void Display( void )
glTranslatef( 0.0, 0.0, -15.0 );
 
/* draw the occluding polygons */
-   glColor3f(0, 0.6, 0.8);
+   glColor3f(0, 0.4, 0.6);
glBegin(GL_QUADS);
-   glVertex2f(-1.6, -1.5);
-   glVertex2f(-0.4, -1.5);
-   glVertex2f(-0.4,  1.5);
-   glVertex2f(-1.6,  1.5);
-
-   glVertex2f( 0.4, -1.5);
-   glVertex2f( 1.6, -1.5);
-   glVertex2f( 1.6,  1.5);
-   glVertex2f( 0.4,  1.5);
+   glVertex2f(-1.6, -2.5);
+   glVertex2f(-0.4, -2.5);
+   glVertex2f(-0.4,  2.5);
+   glVertex2f(-1.6,  2.5);
+   glVertex2f( 0.4, -2.5);
+   glVertex2f( 1.6, -2.5);
+   glVertex2f( 1.6,  2.5);
+   glVertex2f( 0.4,  2.5);
glEnd();
 
-   /* draw the test polygon with occlusion testing */
-   glPushMatrix();
-   glTranslatef(Xpos, 0, -0.5);
-   glScalef(0.3, 0.3, 1.0);
-   glRotatef(-90.0 * Xpos, 0, 0, 1);
-
-#if defined(GL_ARB_occlusion_query)
-#if TEST_DISPLAY_LISTS
-   glNewList(10, GL_COMPILE);
-   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery);
-   glEndList();
-   glCallList(10);
-#else
-   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery);
-#endif
 
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
 
-   glBegin(GL_POLYGON);
-   glVertex3f(-1, -1, 0);
-   glVertex3f( 1, -1, 0);
-   glVertex3f( 1,  1, 0);
-   glVertex3f(-1,  1, 0);
-   glEnd();
+   /* draw the test polygons with occlusion testing */
+   for (i = 0; i < NUM_OCC; i++) {
+  glPushMatrix();
+ glTranslatef(Xpos[i], Ypos[i], -0.5);
+ glScalef(0.2, 0.2, 1.0);
+ glRotatef(-90.0 * Xpos[i], 0, 0, 1);
+
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery[i]);
+ glBegin(GL_POLYGON);
+ glVertex3f(-1, -1, 0);
+ glVertex3f( 1, -1, 0);
+ glVertex3f( 1,  1, 0);
+ glVertex3f(-1,  1, 0);
+ glEnd();
+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+
+  glPopMatrix();
+   }
 
-#if TEST_DISPLAY_LISTS
-   glNewList(11, GL_COMPILE);
-   glEndQueryARB(GL_SAMPLES_PASSED_ARB);
-   glEndList();
-   glCallList(11);
-#else
-   glEndQueryARB(GL_SAMPLES_PASSED_ARB);
-#endif
-
-   do {
-  /* do useful work here, if any */
-  glGetQueryObjectivARB(OccQuery, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
-   } while (!ready);
-   glGetQueryObjectuivARB(OccQuery, GL_QUERY_RESULT_ARB, &passed);
-
-   /* turn off occlusion testing */
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
-#endif /* GL_ARB_occlusion_query */
-
-   /* draw the orange rect, so we can see what's going on */
-   glColor3f(0.8, 0.5, 0);
-   glBegin(GL_POLYGON);
-   glVertex3f(-1, -1, 0);
-   glVertex3f( 1, -1, 0);
-   glVertex3f( 1,  1, 0);
-   glVertex3f(-1,  1, 0);
-   glEnd();
 
-   glPopMatrix();
-
-
-   /* Print result message */
-   glMatrixMode( GL_PROJECTION );
-   glLoadIdentity();
-   glOrtho( -

Mesa (master): st/mesa: added some bitmap debug code (disabled)

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0c728030ed76d8b79876b8606cb0486bff96750c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c728030ed76d8b79876b8606cb0486bff96750c

Author: Brian Paul 
Date:   Thu Feb 18 16:56:38 2010 -0700

st/mesa: added some bitmap debug code (disabled)

---

 src/mesa/state_tracker/st_cb_bitmap.c |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bitmap.c 
b/src/mesa/state_tracker/st_cb_bitmap.c
index 25430bb..e029ea7 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -536,9 +536,29 @@ reset_cache(struct st_context *st)
   st->bitmap.tex_format, 0,
   BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
   1, PIPE_TEXTURE_USAGE_SAMPLER);
+}
+
 
+/** Print bitmap image to stdout (debug) */
+static void
+print_cache(const struct bitmap_cache *cache)
+{
+   int i, j, k;
+
+   for (i = 0; i < BITMAP_CACHE_HEIGHT; i++) {
+  k = BITMAP_CACHE_WIDTH * (BITMAP_CACHE_HEIGHT - i - 1);
+  for (j = 0; j < BITMAP_CACHE_WIDTH; j++) {
+ if (cache->buffer[k])
+printf("X");
+ else
+printf(" ");
+ k++;
+  }
+  printf("\n");
+   }
 }
 
+
 static void
 create_cache_trans(struct st_context *st)
 {
@@ -588,6 +608,8 @@ st_flush_bitmap_cache(struct st_context *st)
   * So unmap and release the texture transfer before drawing.
   */
  if (cache->trans) {
+if (0)
+   print_cache(cache);
 screen->transfer_unmap(screen, cache->trans);
 cache->buffer = NULL;
 

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


Mesa (master): softpipe: fix depth testing problems

2010-02-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ae7a7026c77c68748fedb60e5deb7649e894da40
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae7a7026c77c68748fedb60e5deb7649e894da40

Author: Brian Paul 
Date:   Thu Feb 18 17:00:10 2010 -0700

softpipe: fix depth testing problems

The optimized Z-test functions assumed that the array of incoming quads
are adjacent, but that's not always true.  The fragment shader can cull
intermediate quads, for example.

Now these Z-test functions can cope with non-adjacent quads.  A little bit
of performance is probably lost, but it's probably not worth worring about.

This fixes broken glBitmap() Z testing, among other things.

(cherry picked from commit d437d905e6924ebc05ec9efe87e1e2c48d75bc13)

---

 src/gallium/drivers/softpipe/sp_quad_depth_test.c |   89 
 1 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c 
b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 499eebd..dab9565 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -728,9 +728,14 @@ depth_test_quads_fallback(struct quad_stage *qs,
   qs->next->run(qs->next, quads, nr);
 }
 
-/* XXX: this function assumes setup function actually emits linear
- * spans of quads.  It seems a lot more natural to do (early)
- * depth-testing on spans rather than quads.
+
+/**
+ * Special-case Z testing for 16-bit Zbuffer, PIPE_FUNC_LESS and
+ * Z buffer writes enabled.
+ *
+ * NOTE: there's no guarantee that the quads are sequentially side by
+ * side.  The fragment shader may have culled some quads, etc.  Sliver
+ * triangles may generate non-sequential quads.
  */
 static void
 depth_interp_z16_less_write(struct quad_stage *qs, 
@@ -747,25 +752,33 @@ depth_interp_z16_less_write(struct quad_stage *qs,
const float z0 = quads[0]->posCoef->a0[2] + dzdx * fx + dzdy * fy;
struct softpipe_cached_tile *tile;
ushort (*depth16)[TILE_SIZE];
-   ushort idepth[4], depth_step;
+   ushort init_idepth[4], idepth[4], depth_step;
const float scale = 65535.0;
 
-   idepth[0] = (ushort)((z0) * scale);
-   idepth[1] = (ushort)((z0 + dzdx) * scale);
-   idepth[2] = (ushort)((z0 + dzdy) * scale);
-   idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale);
+   /* compute scaled depth of the four pixels in first quad */
+   init_idepth[0] = (ushort)((z0) * scale);
+   init_idepth[1] = (ushort)((z0 + dzdx) * scale);
+   init_idepth[2] = (ushort)((z0 + dzdy) * scale);
+   init_idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale);
 
-   depth_step = (ushort)(dzdx * 2 * scale);
+   depth_step = (ushort)(dzdx * scale);
 
tile = sp_get_cached_tile(qs->softpipe->zsbuf_cache, ix, iy);
 
-   depth16 = (ushort (*)[TILE_SIZE])
-  &tile->data.depth16[iy % TILE_SIZE][ix % TILE_SIZE];
-
for (i = 0; i < nr; i++) {
-  unsigned outmask = quads[i]->inout.mask;
+  const unsigned outmask = quads[i]->inout.mask;
+  const int dx = quads[i]->input.x0 - ix;
   unsigned mask = 0;
-  
+
+  /* compute depth for this quad */
+  idepth[0] = init_idepth[0] + dx * depth_step;
+  idepth[1] = init_idepth[1] + dx * depth_step;
+  idepth[2] = init_idepth[2] + dx * depth_step;
+  idepth[3] = init_idepth[3] + dx * depth_step;
+
+  depth16 = (ushort (*)[TILE_SIZE])
+ &tile->data.depth16[iy % TILE_SIZE][(ix + dx)% TILE_SIZE];
+
   if ((outmask & 1) && idepth[0] < depth16[0][0]) {
  depth16[0][0] = idepth[0];
  mask |= (1 << 0);
@@ -786,13 +799,6 @@ depth_interp_z16_less_write(struct quad_stage *qs,
  mask |= (1 << 3);
   }
 
-  idepth[0] += depth_step;
-  idepth[1] += depth_step;
-  idepth[2] += depth_step;
-  idepth[3] += depth_step;
-
-  depth16 = (ushort (*)[TILE_SIZE]) &depth16[0][2];
-
   quads[i]->inout.mask = mask;
   if (quads[i]->inout.mask)
  quads[pass++] = quads[i];
@@ -804,6 +810,14 @@ depth_interp_z16_less_write(struct quad_stage *qs,
 }
 
 
+/**
+ * Special-case Z testing for 16-bit Zbuffer, PIPE_FUNC_LEQUAL and
+ * Z buffer writes enabled.
+ *
+ * NOTE: there's no guarantee that the quads are sequentially side by
+ * side.  The fragment shader may have culled some quads, etc.  Sliver
+ * triangles may generate non-sequential quads.
+ */
 static void
 depth_interp_z16_lequal_write(struct quad_stage *qs, 
 struct quad_header *quads[],
@@ -819,25 +833,33 @@ depth_interp_z16_lequal_write(struct quad_stage *qs,
const float z0 = quads[0]->posCoef->a0[2] + dzdx * fx + dzdy * fy;
struct softpipe_cached_tile *tile;
ushort (*depth16)[TILE_SIZE];
-   ushort idepth[4], depth_step;
+   ushort init_idepth[4], idepth[4], depth_step;
const float scale = 65535.0;
 
-   idepth[0] = (ushort)((z0) * scale);
-   idepth[1] = (ushort)((z0 + dzdx) * scale);
-   idepth[2] = (ushort)((z0 + dzdy) * scale);
-   idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale);
+   /*

Mesa (master): r300g: remove L8_UNORM from colorbuffer formats

2010-02-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: fc427d23439a2702068209957f08990ea29fe21b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc427d23439a2702068209957f08990ea29fe21b

Author: Marek Olšák 
Date:   Fri Feb 19 04:23:06 2010 +0100

r300g: remove L8_UNORM from colorbuffer formats

Not renderable in OpenGL anyway.

---

 src/gallium/drivers/r300/r300_screen.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_screen.c 
b/src/gallium/drivers/r300/r300_screen.c
index 5fa1ea0..036736c 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -230,7 +230,6 @@ static boolean r300_is_format_supported(struct pipe_screen* 
screen,
 /* Supported formats. */
 /* Colorbuffer */
 case PIPE_FORMAT_A8_UNORM:
-case PIPE_FORMAT_L8_UNORM:
 case PIPE_FORMAT_R5G6B5_UNORM:
 case PIPE_FORMAT_A1R5G5B5_UNORM:
 case PIPE_FORMAT_A4R4G4B4_UNORM:

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


Mesa (master): egl: Silence warnings in check/return macros.

2010-02-18 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: bef4b476d729320599264483113d577ac5eeaff1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bef4b476d729320599264483113d577ac5eeaff1

Author: Chia-I Wu 
Date:   Fri Feb 19 12:08:50 2010 +0800

egl: Silence warnings in check/return macros.

The macros give warnings when compiled with -pedantic.  This commit is
based on a patch by Brian Paul, with minor changes to add do {} while(0)
and rename the check macros.

---

 src/egl/main/eglapi.c |  286 +
 1 files changed, 147 insertions(+), 139 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 2de1ac3..647be65 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -74,49 +74,57 @@
  *
  * These macros will unlock the display and record the error code.
  */
-#define _EGL_ERROR(disp, err, ret)  \
-   ({   \
+#define RETURN_EGL_ERROR(disp, err, ret)\
+   do { \
   if (disp) \
  _eglUnlockDisplay(disp);   \
   /* EGL error codes are non-zero */\
   if (err)  \
  _eglError(err, __FUNCTION__);  \
-  ret;  \
-   })
-#define _EGL_SUCCESS(disp, ret)  _EGL_ERROR(disp, EGL_SUCCESS, ret)
+  return ret;   \
+   } while (0)
+
+#define RETURN_EGL_SUCCESS(disp, ret) \
+   RETURN_EGL_ERROR(disp, EGL_SUCCESS, ret)
+
 /* record EGL_SUCCESS only when ret evaluates to true */
-#define _EGL_EVAL(disp, ret)  _EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret)
+#define RETURN_EGL_EVAL(disp, ret) \
+   RETURN_EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret)
 
 
-/**
+/*
  * A bunch of macros and checks to simplify error checking.
  */
-#define _EGL_CHECK_DISPLAY(disp, ret)   \
-   ({   \
-  _EGLDriver *__drv = _eglCheckDisplay(disp, __FUNCTION__); \
-  if (!__drv)   \
- return _EGL_ERROR(disp, 0, ret);   \
-  __drv;\
-   })
-
-
-#define _EGL_CHECK_OBJECT(disp, type, obj, ret) \
-   ({   \
-  _EGLDriver *__drv = _eglCheck ## type(disp, obj, __FUNCTION__);   \
-  if (!__drv)   \
- return _EGL_ERROR(disp, 0, ret);   \
-  __drv;\
-   })
-#define _EGL_CHECK_SURFACE(disp, surf, ret)  \
-   _EGL_CHECK_OBJECT(disp, Surface, surf, ret)
-#define _EGL_CHECK_CONTEXT(disp, context, ret)   \
-   _EGL_CHECK_OBJECT(disp, Context, context, ret)
-#define _EGL_CHECK_CONFIG(disp, conf, ret)   \
-   _EGL_CHECK_OBJECT(disp, Config, conf, ret)
-#define _EGL_CHECK_SCREEN(disp, scrn, ret)   \
-   _EGL_CHECK_OBJECT(disp, Screen, scrn, ret)
-#define _EGL_CHECK_MODE(disp, m, ret)\
-   _EGL_CHECK_OBJECT(disp, Mode, m, ret)
+
+#define _EGL_CHECK_DISPLAY(disp, ret, drv) \
+   do {\
+  drv = _eglCheckDisplay(disp, __FUNCTION__);  \
+  if (!drv)\
+ RETURN_EGL_ERROR(disp, 0, ret);   \
+   } while (0)
+
+#define _EGL_CHECK_OBJECT(disp, type, obj, ret, drv)  \
+   do {   \
+  drv = _eglCheck ## type(disp, obj, __FUNCTION__);   \
+  if (!drv)   \
+ RETURN_EGL_ERROR(disp, 0, ret);  \
+   } while (0)
+
+#define _EGL_CHECK_SURFACE(disp, surf, ret, drv) \
+   _EGL_CHECK_OBJECT(disp, Surface, surf, ret, drv)
+
+#define _EGL_CHECK_CONTEXT(disp, context, ret, drv) \
+   _EGL_CHECK_OBJECT(disp, Context, context, ret, drv)
+
+#define _EGL_CHECK_CONFIG(disp, conf, ret, drv) \
+   _EGL_CHECK_OBJECT(disp, Config, conf, ret, drv)
+
+#define _EGL_CHECK_SCREEN(disp, scrn, ret, drv) \
+   _EGL_CHECK_OBJECT(disp, Screen, scrn, ret, drv)
+
+#define _EGL_CHECK_MODE(disp, m, ret, drv) \
+   _EGL_CHECK_OBJECT(disp, Mode, m, ret, drv)
+
 
 
 static INLINE _EGLDriver *
@@ -256,7 +264,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
EGLint major_int, minor_int;
 
if (!disp)
-  return _EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
+  RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
 
if (!disp->Initialized) {
   _EGLDriver *drv = disp->Driver;
@@ -265,12 +273,12 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint 
*minor)
  _eglPreloadDrivers();
  drv = _eglMatchDriver(disp);
  if (!drv)
-return _EGL_ERROR

Mesa (master): egl: Silence warnings when compiled with -pedantic.

2010-02-18 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 496724b869d4258a64e8343d3ae66d08bfb19f7b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=496724b869d4258a64e8343d3ae66d08bfb19f7b

Author: Chia-I Wu 
Date:   Fri Feb 19 11:47:54 2010 +0800

egl: Silence warnings when compiled with -pedantic.

Just follow gcc's advices here.

---

 src/egl/main/eglconfig.c   |2 +-
 src/egl/main/egldisplay.h  |2 ++
 src/egl/main/egldriver.c   |8 +++-
 src/egl/main/egltypedefs.h |2 --
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 1190f8c..177cf3e 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -112,7 +112,7 @@ enum {
ATTRIB_CRITERION_ATLEAST,
ATTRIB_CRITERION_MASK,
ATTRIB_CRITERION_SPECIAL,
-   ATTRIB_CRITERION_IGNORE,
+   ATTRIB_CRITERION_IGNORE
 };
 
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 43b39bd..5d69b87 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -14,6 +14,8 @@ enum _egl_resource_type {
 
_EGL_NUM_RESOURCES
 };
+/* this cannot and need not go into egltypedefs.h */
+typedef enum _egl_resource_type _EGLResourceType;
 
 
 /**
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 8748fe5..6384242 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -144,7 +144,13 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
   mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
 #elif defined(_EGL_PLATFORM_POSIX)
if (lib) {
-  mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
+  union {
+ _EGLMain_t func;
+ void *ptr;
+  } tmp = { NULL };
+  /* direct cast gives a warning when compiled with -pedantic */
+  tmp.ptr = dlsym(lib, "_eglMain");
+  mainFunc = tmp.func;
   if (!mainFunc)
  error = dlerror();
}
diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h
index e0c9576..166b133 100644
--- a/src/egl/main/egltypedefs.h
+++ b/src/egl/main/egltypedefs.h
@@ -8,8 +8,6 @@
 
 #include "eglcompiler.h"
 
-typedef enum _egl_resource_type _EGLResourceType;
-
 typedef struct _egl_api _EGLAPI;
 
 typedef struct _egl_config _EGLConfig;

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