Mesa (master): nv10, nv20: Fix build.

2010-01-31 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 71b32cc838ea682e60ea7a4a0e0ae17edce89c9a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=71b32cc838ea682e60ea7a4a0e0ae17edce89c9a

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Jan 31 17:18:09 2010 +0100

nv10, nv20: Fix build.

---

 src/gallium/drivers/nv10/nv10_context.c |2 +-
 src/gallium/drivers/nv20/nv20_context.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv10/nv10_context.c 
b/src/gallium/drivers/nv10/nv10_context.c
index 1ecb73d..900a640 100644
--- a/src/gallium/drivers/nv10/nv10_context.c
+++ b/src/gallium/drivers/nv10/nv10_context.c
@@ -146,7 +146,7 @@ static void nv10_init_hwctx(struct nv10_context *nv10)
OUT_RING  (chan, 0);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_MODEL, 1);
OUT_RING  (chan, 0);
-   BEGIN_RING(chan, celsius, NV10TCL_COLOR_CONTROL, 1);
+   BEGIN_RING(chan, celsius, NV10TCL_SEPARATE_SPECULAR_ENABLE, 1);
OUT_RING  (chan, 0);
BEGIN_RING(chan, celsius, NV10TCL_ENABLED_LIGHTS, 1);
OUT_RING  (chan, 0);
diff --git a/src/gallium/drivers/nv20/nv20_context.c 
b/src/gallium/drivers/nv20/nv20_context.c
index 5b80af2..22185a2 100644
--- a/src/gallium/drivers/nv20/nv20_context.c
+++ b/src/gallium/drivers/nv20/nv20_context.c
@@ -245,7 +245,7 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
}
BEGIN_RING(chan, kelvin, NV20TCL_LIGHTING_ENABLE, 1);
OUT_RING  (chan, 0);
-   BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_CONTROL, 1);
+   BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_MODEL, 1);
OUT_RING  (chan, 0x0002);
BEGIN_RING(chan, kelvin, NV20TCL_SEPARATE_SPECULAR_ENABLE, 1);
OUT_RING  (chan, 0);

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


Mesa (master): nv50/nv40/nv30: fix small memory leak of nouveau_resources on screen_destroy

2010-01-31 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 112def3c17a45f73def02c17509d68b46ff25966
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=112def3c17a45f73def02c17509d68b46ff25966

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Tue Jan 12 15:41:50 2010 +0100

nv50/nv40/nv30: fix small memory leak of nouveau_resources on screen_destroy

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/gallium/drivers/nv30/nv30_screen.c |6 +++---
 src/gallium/drivers/nv40/nv40_screen.c |6 +++---
 src/gallium/drivers/nv50/nv50_screen.c |3 +++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_screen.c 
b/src/gallium/drivers/nv30/nv30_screen.c
index ee83ec5..62ee2e7 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -173,9 +173,9 @@ nv30_screen_destroy(struct pipe_screen *pscreen)
so_ref(NULL, screen-state[i]);
}
 
-   nouveau_resource_free(screen-vp_exec_heap);
-   nouveau_resource_free(screen-vp_data_heap);
-   nouveau_resource_free(screen-query_heap);
+   nouveau_resource_destroy(screen-vp_exec_heap);
+   nouveau_resource_destroy(screen-vp_data_heap);
+   nouveau_resource_destroy(screen-query_heap);
nouveau_notifier_free(screen-query);
nouveau_notifier_free(screen-sync);
nouveau_grobj_free(screen-rankine);
diff --git a/src/gallium/drivers/nv40/nv40_screen.c 
b/src/gallium/drivers/nv40/nv40_screen.c
index b1a7343..56fb809 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -157,9 +157,9 @@ nv40_screen_destroy(struct pipe_screen *pscreen)
so_ref(NULL, screen-state[i]);
}
 
-   nouveau_resource_free(screen-vp_exec_heap);
-   nouveau_resource_free(screen-vp_data_heap);
-   nouveau_resource_free(screen-query_heap);
+   nouveau_resource_destroy(screen-vp_exec_heap);
+   nouveau_resource_destroy(screen-vp_data_heap);
+   nouveau_resource_destroy(screen-query_heap);
nouveau_notifier_free(screen-query);
nouveau_notifier_free(screen-sync);
nouveau_grobj_free(screen-curie);
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index c4465a2..48c7b19 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -195,6 +195,9 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
nouveau_grobj_free(screen-tesla);
nouveau_grobj_free(screen-eng2d);
nouveau_grobj_free(screen-m2mf);
+   nouveau_resource_destroy(screen-immd_heap[0]);
+   nouveau_resource_destroy(screen-parm_heap[0]);
+   nouveau_resource_destroy(screen-parm_heap[1]);
nouveau_screen_fini(screen-base);
FREE(screen);
 }

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


Mesa (master): nv04: Update to new nouveau_class.h

2010-01-31 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: de917c1c610a0f0351bf5ceb6b1ede1a88a359ce
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=de917c1c610a0f0351bf5ceb6b1ede1a88a359ce

Author: Marcin Koƛcielnicki koria...@0x04.net
Date:   Sun Jan 31 19:31:01 2010 +

nv04: Update to new nouveau_class.h

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/gallium/drivers/nv04/nv04_surface_2d.c |   40 ++--
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c 
b/src/gallium/drivers/nv04/nv04_surface_2d.c
index b24a9ce..42c2ca9 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.c
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.c
@@ -60,17 +60,17 @@ nv04_scaled_image_format(enum pipe_format format)
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_L8_UNORM:
case PIPE_FORMAT_I8_UNORM:
-   return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8;
+   return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8;
case PIPE_FORMAT_A1R5G5B5_UNORM:
-   return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5;
+   return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5;
case PIPE_FORMAT_A8R8G8B8_UNORM:
-   return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8;
+   return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8;
case PIPE_FORMAT_X8R8G8B8_UNORM:
-   return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8;
+   return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8;
case PIPE_FORMAT_R5G6B5_UNORM:
case PIPE_FORMAT_R16_SNORM:
case PIPE_FORMAT_A8L8_UNORM:
-   return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5;
+   return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5;
default:
return -1;
}
@@ -155,7 +155,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
 log2i(dst-width)  
NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT |
 log2i(dst-height)  
NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT);
 
-   BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1);
+   BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1);
OUT_RELOCo(chan, src_bo,
 NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE, 1);
@@ -173,22 +173,22 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
OUT_RELOCl(chan, dst_bo, dst-offset,
  NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | 
NOUVEAU_BO_WR);
 
-   BEGIN_RING(chan, sifm, 
NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
-   OUT_RING  (chan, 
NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE);
+   BEGIN_RING(chan, sifm, 
NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
+   OUT_RING  (chan, 
NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE);
OUT_RING  (chan, nv04_scaled_image_format(src-format));
-   OUT_RING  (chan, NV04_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY);
-   OUT_RING  (chan, (x + dx) | ((y + dy)  
NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT));
-   OUT_RING  (chan, sub_h  
NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w);
-   OUT_RING  (chan, (x + dx) | ((y + dy)  
NV04_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT));
-   OUT_RING  (chan, sub_h  
NV04_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w);
+   OUT_RING  (chan, NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY);
+   OUT_RING  (chan, (x + dx) | ((y + dy)  
NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT));
+   OUT_RING  (chan, sub_h  
NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w);
+   OUT_RING  (chan, (x + dx) | ((y + dy)  
NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT));
+   OUT_RING  (chan, sub_h  
NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w);
OUT_RING  (chan, 1  20);
OUT_RING  (chan, 1  20);
 
-   BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
-   OUT_RING  (chan, sub_h  
NV04_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT | sub_w);
+   BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
+   OUT_RING  (chan, sub_h  
NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT | sub_w);
OUT_RING  (chan, src_pitch |
-NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER 
|
-
NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
+NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER 
|
+
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
OUT_RELOCl(chan, src_bo, src-offset + (sy+y) * src_pitch + (sx+x

Mesa (master): Drop incorrectly revived files during the ' gallium-nopointsizeminmax' merge.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Feb 10 00:36:22 2010 +0100

Drop incorrectly revived files during the 'gallium-nopointsizeminmax' merge.

---

 src/gallium/drivers/nv10/nv10_state.c |  590 -
 src/gallium/drivers/nv20/nv20_state.c |  583 
 2 files changed, 0 insertions(+), 1173 deletions(-)

diff --git a/src/gallium/drivers/nv10/nv10_state.c 
b/src/gallium/drivers/nv10/nv10_state.c
deleted file mode 100644
index 6f674d6..000
--- a/src/gallium/drivers/nv10/nv10_state.c
+++ /dev/null
@@ -1,590 +0,0 @@
-#include draw/draw_context.h
-#include pipe/p_state.h
-#include pipe/p_defines.h
-#include pipe/p_shader_tokens.h
-#include pipe/p_inlines.h
-
-#include tgsi/tgsi_parse.h
-
-#include nv10_context.h
-#include nv10_state.h
-
-static void *
-nv10_blend_state_create(struct pipe_context *pipe,
-   const struct pipe_blend_state *cso)
-{
-   struct nv10_blend_state *cb;
-
-   cb = MALLOC(sizeof(struct nv10_blend_state));
-
-   cb-b_enable = cso-blend_enable ? 1 : 0;
-   cb-b_srcfunc = ((nvgl_blend_func(cso-alpha_src_factor)16) |
-(nvgl_blend_func(cso-rgb_src_factor)));
-   cb-b_dstfunc = ((nvgl_blend_func(cso-alpha_dst_factor)16) |
-(nvgl_blend_func(cso-rgb_dst_factor)));
-
-   cb-c_mask = (((cso-colormask  PIPE_MASK_A) ? (0x0124) : 0) |
- ((cso-colormask  PIPE_MASK_R) ? (0x0116) : 0) |
- ((cso-colormask  PIPE_MASK_G) ? (0x01 8) : 0) |
- ((cso-colormask  PIPE_MASK_B) ? (0x01 0) : 0));
-
-   cb-d_enable = cso-dither ? 1 : 0;
-
-   return (void *)cb;
-}
-
-static void
-nv10_blend_state_bind(struct pipe_context *pipe, void *blend)
-{
-   struct nv10_context *nv10 = nv10_context(pipe);
-
-   nv10-blend = (struct nv10_blend_state*)blend;
-
-   nv10-dirty |= NV10_NEW_BLEND;
-}
-
-static void
-nv10_blend_state_delete(struct pipe_context *pipe, void *hwcso)
-{
-   FREE(hwcso);
-}
-
-
-static INLINE unsigned
-wrap_mode(unsigned wrap) {
-   unsigned ret;
-
-   switch (wrap) {
-   case PIPE_TEX_WRAP_REPEAT:
-   ret = NV10TCL_TX_FORMAT_WRAP_S_REPEAT;
-   break;
-   case PIPE_TEX_WRAP_MIRROR_REPEAT:
-   ret = NV10TCL_TX_FORMAT_WRAP_S_MIRRORED_REPEAT;
-   break;
-   case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
-   ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE;
-   break;
-   case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
-   ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_BORDER;
-   break;
-   case PIPE_TEX_WRAP_CLAMP:
-   ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP;
-   break;
-   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
-   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
-   case PIPE_TEX_WRAP_MIRROR_CLAMP:
-   default:
-   NOUVEAU_ERR(unknown wrap mode: %d\n, wrap);
-   ret = NV10TCL_TX_FORMAT_WRAP_S_REPEAT;
-   break;
-   }
-
-   return ret  NV10TCL_TX_FORMAT_WRAP_S_SHIFT;
-}
-
-static void *
-nv10_sampler_state_create(struct pipe_context *pipe,
- const struct pipe_sampler_state *cso)
-{
-   struct nv10_sampler_state *ps;
-   uint32_t filter = 0;
-
-   ps = MALLOC(sizeof(struct nv10_sampler_state));
-
-   ps-wrap = ((wrap_mode(cso-wrap_s)  NV10TCL_TX_FORMAT_WRAP_S_SHIFT) |
-   (wrap_mode(cso-wrap_t)  NV10TCL_TX_FORMAT_WRAP_T_SHIFT));
-
-   ps-en = 0;
-   if (cso-max_anisotropy  1.0) {
-   /* no idea, binary driver sets it, works without it.. meh.. */
-   ps-wrap |= (1  5);
-
-/* if (cso-max_anisotropy = 16.0) {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_16X;
-   } else
-   if (cso-max_anisotropy = 12.0) {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_12X;
-   } else
-   if (cso-max_anisotropy = 10.0) {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_10X;
-   } else
-   if (cso-max_anisotropy = 8.0) {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_8X;
-   } else
-   if (cso-max_anisotropy = 6.0) {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_6X;
-   } else
-   if (cso-max_anisotropy = 4.0) {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_4X;
-   } else {
-   ps-en |= NV10TCL_TX_ENABLE_ANISO_2X;
-   }*/
-   }
-
-   switch (cso-mag_img_filter) {
-   case PIPE_TEX_FILTER_LINEAR:
-   filter |= NV10TCL_TX_FILTER_MAGNIFY_LINEAR;
-   break;
-   case

Mesa (master): nv40: Fix incorrect so_new() numbering.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 16 18:37:43 2010 +0100

nv40: Fix incorrect so_new() numbering.

---

 src/gallium/drivers/nv40/nv40_state.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nv40/nv40_state.c 
b/src/gallium/drivers/nv40/nv40_state.c
index 2073bf0..4f28675 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -310,7 +310,7 @@ nv40_rasterizer_state_create(struct pipe_context *pipe,
 {
struct nv40_context *nv40 = nv40_context(pipe);
struct nv40_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
-   struct nouveau_stateobj *so = so_new(8, 18, 0);
+   struct nouveau_stateobj *so = so_new(9, 19, 0);
struct nouveau_grobj *curie = nv40-screen-curie;
 
/*XXX: ignored:

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


Mesa (master): nv40: Implement PIPE_CAP_MAX_COMBINED_SAMPLERS.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 16 18:36:47 2010 +0100

nv40: Implement PIPE_CAP_MAX_COMBINED_SAMPLERS.

---

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

diff --git a/src/gallium/drivers/nv40/nv40_screen.c 
b/src/gallium/drivers/nv40/nv40_screen.c
index 001147e..edee4b9 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -62,6 +62,8 @@ nv40_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+   case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+   return 16;
default:
NOUVEAU_ERR(Unknown PIPE_CAP %d\n, param);
return 0;

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


Mesa (master): st/dri2: Flush FRAME instead of RENDER_CACHE on buffer invalidation.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 16 18:17:11 2010 +0100

st/dri2: Flush FRAME instead of RENDER_CACHE on buffer invalidation.

---

 src/gallium/state_trackers/dri/dri_drawable.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index 4d7596a..195ae7b 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -288,11 +288,11 @@ 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;
 
-   st_flush(ctx-st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
/* Ask the X server for new renderbuffers. */
dri_get_buffers(ctx-dPriv);
if (ctx-dPriv != ctx-rPriv)

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


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

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 16 17:21:10 2010 +0100

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

So far the frontbuffer was only being flushed on st_glFlush and
st_glFinish, however, a co-state tracker may need to make sure that
any frontbuffer changes are already on its way to the actual front.

The dri2 state tracker will need this for event-driven GL applications
to resize properly (It could also be done calling dri_flush_frontbuffer,
but that way we would flush unnecessarily in the double-buffered case).

Additionally this patch avoids flushing the mesa rendering cache if
PIPE_FLUSH_RENDER_CACHE wasn't specified.

---

 src/mesa/state_tracker/st_cb_flush.c |   15 ++-
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_flush.c 
b/src/mesa/state_tracker/st_cb_flush.c
index 1329f80..0ddfce4 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -91,7 +91,8 @@ display_front_buffer(struct st_context *st)
 void st_flush( struct st_context *st, uint pipeFlushFlags,
struct pipe_fence_handle **fence )
 {
-   FLUSH_CURRENT(st-ctx, 0);
+   if (pipeFlushFlags  PIPE_FLUSH_RENDER_CACHE)
+  FLUSH_CURRENT(st-ctx, 0);
 
/* Release any vertex buffers that might potentially be accessed in
 * successive frames:
@@ -102,6 +103,10 @@ 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);
 }
 
 
@@ -135,10 +140,6 @@ 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,10 +151,6 @@ 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 (master): dri/nouveau: Some multithreaded rendering fixes.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Feb 17 18:56:42 2010 +0100

dri/nouveau: Some multithreaded rendering fixes.

---

 src/mesa/drivers/dri/nouveau/Makefile  |3 -
 src/mesa/drivers/dri/nouveau/nouveau_context.c |   70 +++-
 src/mesa/drivers/dri/nouveau/nouveau_context.h |   24 ++-
 src/mesa/drivers/dri/nouveau/nouveau_driver.h  |2 -
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  |   42 +--
 src/mesa/drivers/dri/nouveau/nouveau_screen.h  |   16 -
 src/mesa/drivers/dri/nouveau/nv04_context.c|  202 +-
 src/mesa/drivers/dri/nouveau/nv04_context.h|7 +-
 src/mesa/drivers/dri/nouveau/nv04_driver.h |8 +-
 src/mesa/drivers/dri/nouveau/nv04_screen.c |  211 ---
 src/mesa/drivers/dri/nouveau/nv04_state_fb.c   |8 +-
 src/mesa/drivers/dri/nouveau/nv04_surface.c|  134 +++
 src/mesa/drivers/dri/nouveau/nv10_context.c|  343 -
 src/mesa/drivers/dri/nouveau/nv10_driver.h |   11 +-
 src/mesa/drivers/dri/nouveau/nv10_screen.c |  364 --
 src/mesa/drivers/dri/nouveau/nv20_context.c|  463 ++-
 src/mesa/drivers/dri/nouveau/nv20_driver.h |   11 +-
 src/mesa/drivers/dri/nouveau/nv20_screen.c |  483 
 18 files changed, 1124 insertions(+), 1278 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=56dcd011b5ec33190f268cf546a4c68f81f5ebd0
___
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 curroje...@riseup.net
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 (master): dri/nouveau: Fix stencil mask handling on glClear().

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Feb 21 14:28:17 2010 +0100

dri/nouveau: Fix stencil mask handling on glClear().

---

 src/mesa/drivers/dri/nouveau/nouveau_driver.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index bf0e20c..afaa8de 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -112,8 +112,8 @@ nouveau_clear(GLcontext *ctx, GLbitfield buffers)
mask = pack_zs_i(s-format,
 (buffers  BUFFER_BIT_DEPTH 
  ctx-Depth.Mask) ? ~0 : 0,
-(buffers  BUFFER_BIT_STENCIL 
- ctx-Stencil.WriteMask[0]) ? ~0 : 0);
+(buffers  BUFFER_BIT_STENCIL ?
+ ctx-Stencil.WriteMask[0] : 0));
value = pack_zs_f(s-format,
  ctx-Depth.Clear,
  ctx-Stencil.Clear);

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


Mesa (master): dri/nouveau: Use the hardware I8 format for intensity textures.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 23 16:39:26 2010 +0100

dri/nouveau: Use the hardware I8 format for intensity textures.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 +-
 src/mesa/drivers/dri/nouveau/nv04_state_tex.c  |1 +
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |1 +
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |1 +
 4 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index c1b0dda..0947a2a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -157,7 +157,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_INTENSITY8:
-   return MESA_FORMAT_ARGB;
+   return MESA_FORMAT_I8;
 
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 684a19e..facd41c 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -38,6 +38,7 @@ get_tex_format(struct gl_texture_image *ti)
switch (ti-TexFormat) {
case MESA_FORMAT_A8:
case MESA_FORMAT_L8:
+   case MESA_FORMAT_I8:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_Y8;
case MESA_FORMAT_ARGB1555:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A1R5G5B5;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index f45f6c9..7fe2731 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -54,6 +54,7 @@ get_tex_format_pot(struct gl_texture_image *ti)
return NV10TCL_TX_FORMAT_FORMAT_R5G6B5;
 
case MESA_FORMAT_A8:
+   case MESA_FORMAT_I8:
return NV10TCL_TX_FORMAT_FORMAT_A8;
 
case MESA_FORMAT_L8:
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 4627799..7a5914d 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -49,6 +49,7 @@ get_tex_format_pot(struct gl_texture_image *ti)
return NV20TCL_TX_FORMAT_FORMAT_R5G6B5;
 
case MESA_FORMAT_A8:
+   case MESA_FORMAT_I8:
return NV20TCL_TX_FORMAT_FORMAT_A8;
 
case MESA_FORMAT_L8:

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


Mesa (master): dri/nouveau: Avoid mask overflow on nv04_surface_fill.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Feb 21 14:35:56 2010 +0100

dri/nouveau: Avoid mask overflow on nv04_surface_fill.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c 
b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index 86fa1dc..a219779 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -369,7 +369,7 @@ nv04_surface_fill(GLcontext *ctx,
BEGIN_RING(chan, patt, NV04_IMAGE_PATTERN_COLOR_FORMAT, 1);
OUT_RING  (chan, rect_format(dst-format));
BEGIN_RING(chan, patt, NV04_IMAGE_PATTERN_MONOCHROME_COLOR1, 1);
-   OUT_RING  (chan, mask | ~0  (8 * dst-cpp));
+   OUT_RING  (chan, mask | ~0ll  (8 * dst-cpp));
 
BEGIN_RING(chan, rect, NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT, 1);
OUT_RING  (chan, rect_format(dst-format));

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


Mesa (master): dri/nouveau: Clean up the nv04 surface code a bit.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Feb 22 01:50:04 2010 +0100

dri/nouveau: Clean up the nv04 surface code a bit.

---

 src/mesa/drivers/dri/nouveau/nv04_surface.c |   36 +++---
 1 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c 
b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index a219779..e8a5409 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -216,8 +216,8 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
 
 /* If area is too large to copy in one shot we must copy it in
 * POT chunks to meet alignment requirements */
-   assert(sub_w == w || _mesa_is_pow_two(sub_w));
-   assert(sub_h == h || _mesa_is_pow_two(sub_h));
+   assert(sub_w == w || _mesa_is_pow_two(w));
+   assert(sub_h == h || _mesa_is_pow_two(h));
 
nouveau_bo_marko(bctx, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE,
 src-bo, bo_flags | NOUVEAU_BO_RD);
@@ -239,8 +239,6 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
 
for (x = 0; x  w; x += sub_w) {
sub_w = MIN2(sub_w, w - x);
-   /* Must be 64-byte aligned */
-   assert(!(dst-offset  63));
 
MARK_RING(chan, 15, 1);
 
@@ -277,10 +275,10 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
 
 static void
 nv04_surface_copy_m2mf(GLcontext *ctx,
- struct nouveau_surface *dst,
- struct nouveau_surface *src,
- int dx, int dy, int sx, int sy,
- int w, int h)
+  struct nouveau_surface *dst,
+  struct nouveau_surface *src,
+  int dx, int dy, int sx, int sy,
+  int w, int h)
 {
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = to_nouveau_context(ctx)-hw;
@@ -484,34 +482,20 @@ nv04_surface_init(GLcontext *ctx)
OUT_RING  (chan, NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE);
 
/* Swizzled surface. */
-   switch (context_chipset(ctx)  0xf0) {
-   case 0x00:
-   case 0x10:
+   if (context_chipset(ctx)  0x20)
class = NV04_SWIZZLED_SURFACE;
-   break;
-   case 0x20:
+   else
class = NV20_SWIZZLED_SURFACE;
-   break;
-   default:
-   /* Famous last words: this really can't happen.. */
-   assert(0);
-   break;
-   }
 
ret = nouveau_grobj_alloc(chan, handle++, class, hw-swzsurf);
if (ret)
goto fail;
 
/* Scaled image from memory. */
-   switch (context_chipset(ctx)  0xf0) {
-   case 0x00:
+   if  (context_chipset(ctx)  0x10)
class = NV04_SCALED_IMAGE_FROM_MEMORY;
-   break;
-   case 0x10:
-   case 0x20:
+   else
class = NV10_SCALED_IMAGE_FROM_MEMORY;
-   break;
-   }
 
ret = nouveau_grobj_alloc(chan, handle++, class, hw-sifm);
if (ret)

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


Mesa (master): dri/nouveau: Use the XRGB8888 hardware texture format.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Feb 25 01:55:13 2010 +0100

dri/nouveau: Use the XRGB hardware texture format.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   45 +---
 src/mesa/drivers/dri/nouveau/nv04_state_tex.c  |2 +
 src/mesa/drivers/dri/nouveau/nv10_state_frag.c |7 
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |4 ++
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |   18 ++---
 5 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 0947a2a..bf365bf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -108,40 +108,28 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
switch (internalFormat) {
case 4:
case GL_RGBA:
-   case GL_RGB10_A2:
+   case GL_RGBA2:
+   case GL_RGBA4:
+   case GL_RGBA8:
case GL_RGBA12:
case GL_RGBA16:
-   case GL_RGBA8:
+   case GL_RGB10_A2:
+   return MESA_FORMAT_ARGB;
+   case GL_RGB5_A1:
+   return MESA_FORMAT_ARGB1555;
+
case GL_RGB:
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
-   return MESA_FORMAT_ARGB;
-   case GL_RGB5_A1:
-   return MESA_FORMAT_ARGB1555;
-
+   return MESA_FORMAT_XRGB;
case 3:
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
return MESA_FORMAT_RGB565;
 
-   case GL_ALPHA:
-   case GL_ALPHA4:
-   case GL_ALPHA12:
-   case GL_ALPHA16:
-   case GL_ALPHA8:
-   return MESA_FORMAT_A8;
-
-   case 1:
-   case GL_LUMINANCE:
-   case GL_LUMINANCE4:
-   case GL_LUMINANCE12:
-   case GL_LUMINANCE16:
-   case GL_LUMINANCE8:
-   return MESA_FORMAT_L8;
-
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
@@ -152,6 +140,21 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
case GL_LUMINANCE8_ALPHA8:
return MESA_FORMAT_ARGB;
 
+   case 1:
+   case GL_LUMINANCE:
+   case GL_LUMINANCE4:
+   case GL_LUMINANCE12:
+   case GL_LUMINANCE16:
+   case GL_LUMINANCE8:
+   return MESA_FORMAT_L8;
+
+   case GL_ALPHA:
+   case GL_ALPHA4:
+   case GL_ALPHA12:
+   case GL_ALPHA16:
+   case GL_ALPHA8:
+   return MESA_FORMAT_A8;
+
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY12:
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index facd41c..6d8762b 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -48,6 +48,8 @@ get_tex_format(struct gl_texture_image *ti)
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_R5G6B5;
case MESA_FORMAT_ARGB:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8;
+   case MESA_FORMAT_XRGB:
+   return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X8R8G8B8;
default:
assert(0);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index b56b4ff..76b95fd 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -179,6 +179,13 @@ get_input_arg(struct combiner_state *rc, int arg, int 
flags)
return RC_IN_SOURCE(ZERO) |
get_input_mapping(rc, operand,
  flags ^ INVERT);
+
+   } else if (format == MESA_FORMAT_XRGB) {
+   /* Sometimes emulated using ARGB. */
+   if (!is_color_operand(operand))
+   return RC_IN_SOURCE(ZERO) |
+   get_input_mapping(rc, operand,
+ flags ^ INVERT);
}
}
 
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 7fe2731..02a5ca7 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -44,6 +44,9 @@ get_tex_format_pot(struct gl_texture_image *ti)
case MESA_FORMAT_ARGB:
return NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8;
 
+   case MESA_FORMAT_XRGB:
+   return NV10TCL_TX_FORMAT_FORMAT_X8R8G8B8;
+
case MESA_FORMAT_ARGB1555

Mesa (master): dri/nouveau: Support rectangle textures.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Feb 25 02:15:54 2010 +0100

dri/nouveau: Support rectangle textures.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   21 ++--
 src/mesa/drivers/dri/nouveau/nv10_context.c|7 
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |   37 -
 src/mesa/drivers/dri/nouveau/nv20_context.c|7 
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |   42 ++-
 5 files changed, 100 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 5b78804..840bd6f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -118,9 +118,6 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
return MESA_FORMAT_ARGB;
case GL_RGB5_A1:
return MESA_FORMAT_ARGB1555;
-   case GL_RGBA2:
-   case GL_RGBA4:
-   return MESA_FORMAT_ARGB;
 
case 3:
case GL_R3_G3_B2:
@@ -180,9 +177,10 @@ teximage_fits(struct gl_texture_object *t, int level,
 {
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
 
-   return s-bo  s-width == ti-Width 
-   s-height == ti-Height 
-   s-format == ti-TexFormat;
+   return t-Target == GL_TEXTURE_RECTANGLE ||
+   (s-bo  s-width == ti-Width 
+s-height == ti-Height 
+s-format == ti-TexFormat);
 }
 
 static GLboolean
@@ -196,9 +194,12 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
-   context_drv(ctx)-surface_copy(ctx, ss[level], s,
-  x, y, x, y,
-  width, height);
+   if (t-Target == GL_TEXTURE_RECTANGLE)
+   nouveau_surface_ref(s, ss[level]);
+   else
+   context_drv(ctx)-surface_copy(ctx, ss[level], s,
+  x, y, x, y,
+  width, height);
 
return GL_TRUE;
}
@@ -223,7 +224,7 @@ relayout_texture(GLcontext *ctx, struct gl_texture_object 
*t)
 {
struct gl_texture_image *base = t-Image[0][t-BaseLevel];
 
-   if (base) {
+   if (base  t-Target != GL_TEXTURE_RECTANGLE) {
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(base)-surface;
int i, ret, last = get_last_level(t);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index d80d99c..8e70c41 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -32,6 +32,11 @@
 #include nv04_driver.h
 #include nv10_driver.h
 
+static const struct dri_extension nv10_extensions[] = {
+   { GL_EXT_texture_rectangle,   NULL },
+   { NULL, NULL }
+};
+
 static void
 nv10_clear(GLcontext *ctx, GLbitfield buffers)
 {
@@ -301,6 +306,8 @@ nv10_context_create(struct nouveau_screen *screen, const 
GLvisual *visual,
if (!nouveau_context_init(ctx, screen, visual, share_ctx))
goto fail;
 
+   driInitExtensions(ctx, nv10_extensions, GL_FALSE);
+
/* GL constants. */
ctx-Const.MaxTextureLevels = 12;
ctx-Const.MaxTextureCoordUnits = NV10_TEXTURE_UNITS;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index d732a53..f45f6c9 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -38,7 +38,7 @@ nv10_emit_tex_gen(GLcontext *ctx, int emit)
 }
 
 static uint32_t
-get_tex_format(struct gl_texture_image *ti)
+get_tex_format_pot(struct gl_texture_image *ti)
 {
switch (ti-TexFormat) {
case MESA_FORMAT_ARGB:
@@ -67,6 +67,29 @@ get_tex_format(struct gl_texture_image *ti)
}
 }
 
+static uint32_t
+get_tex_format_rect(struct gl_texture_image *ti)
+{
+   switch (ti-TexFormat) {
+   case MESA_FORMAT_ARGB1555:
+   return NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT;
+
+   case MESA_FORMAT_RGB565:
+   return NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT;
+
+   case MESA_FORMAT_ARGB:
+   return NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT;
+
+   case MESA_FORMAT_A8:
+   case MESA_FORMAT_L8:
+   case MESA_FORMAT_I8

Mesa (master): dri/nouveau: Swizzle using the CPU when we hit a limitation of SIFM.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Feb 22 01:53:23 2010 +0100

dri/nouveau: Swizzle using the CPU when we hit a limitation of SIFM.

---

 src/mesa/drivers/dri/nouveau/nv04_surface.c |   96 +--
 1 files changed, 89 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c 
b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index e8a5409..e3febf7 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -321,6 +321,82 @@ nv04_surface_copy_m2mf(GLcontext *ctx,
FIRE_RING(chan);
 }
 
+typedef unsigned (*get_offset_t)(struct nouveau_surface *s,
+unsigned x, unsigned y);
+
+static unsigned
+get_linear_offset(struct nouveau_surface *s, unsigned x, unsigned y)
+{
+   return x * s-cpp + y * s-pitch;
+}
+
+static unsigned
+get_swizzled_offset(struct nouveau_surface *s, unsigned x, unsigned y)
+{
+   unsigned k = log2i(MIN2(s-width, s-height));
+
+   unsigned u = (x  0x001)  0 |
+   (x  0x002)  1 |
+   (x  0x004)  2 |
+   (x  0x008)  3 |
+   (x  0x010)  4 |
+   (x  0x020)  5 |
+   (x  0x040)  6 |
+   (x  0x080)  7 |
+   (x  0x100)  8 |
+   (x  0x200)  9 |
+   (x  0x400)  10 |
+   (x  0x800)  11;
+
+   unsigned v = (y  0x001)  1 |
+   (y  0x002)  2 |
+   (y  0x004)  3 |
+   (y  0x008)  4 |
+   (y  0x010)  5 |
+   (y  0x020)  6 |
+   (y  0x040)  7 |
+   (y  0x080)  8 |
+   (y  0x100)  9 |
+   (y  0x200)  10 |
+   (y  0x400)  11 |
+   (y  0x800)  12;
+
+   return s-cpp * (((u | v)  ~(~0  2*k)) |
+(x  (~0  k))  k |
+(y  (~0  k))  k);
+}
+
+static void
+nv04_surface_copy_cpu(GLcontext *ctx,
+ struct nouveau_surface *dst,
+ struct nouveau_surface *src,
+ int dx, int dy, int sx, int sy,
+ int w, int h)
+{
+   int x, y;
+   get_offset_t get_dst = (dst-layout == SWIZZLED ?
+   get_swizzled_offset : get_linear_offset);
+   get_offset_t get_src = (src-layout == SWIZZLED ?
+   get_swizzled_offset : get_linear_offset);
+   void *dp, *sp;
+
+   nouveau_bo_map(dst-bo, NOUVEAU_BO_WR);
+   nouveau_bo_map(src-bo, NOUVEAU_BO_RD);
+
+   dp = dst-bo-map + dst-offset;
+   sp = src-bo-map + src-offset;
+
+   for (y = 0; y  h; y++) {
+   for (x = 0; x  w; x++) {
+   memcpy(dp + get_dst(dst, dx + x, dy + y),
+  sp + get_src(src, sx + x, sy + y), dst-cpp);
+   }
+   }
+
+   nouveau_bo_unmap(src-bo);
+   nouveau_bo_unmap(dst-bo);
+}
+
 void
 nv04_surface_copy(GLcontext *ctx,
  struct nouveau_surface *dst,
@@ -328,16 +404,22 @@ nv04_surface_copy(GLcontext *ctx,
  int dx, int dy, int sx, int sy,
  int w, int h)
 {
-   /* Setup transfer to swizzle the texture to vram if needed */
-if (src-layout != SWIZZLED 
-   dst-layout == SWIZZLED 
-   dst-width  2  dst-height  1) {
-   nv04_surface_copy_swizzle(ctx, dst, src,
- dx, dy, sx, sy, w, h);
+   /* Linear texture copy. */
+   if ((src-layout == LINEAR  dst-layout == LINEAR) ||
+   dst-width = 2 || dst-height = 1) {
+   nv04_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
+   return;
+   }
+
+   /* Swizzle using sifm+swzsurf. */
+if (src-layout == LINEAR  dst-layout == SWIZZLED 
+   dst-cpp != 1  !(dst-offset  63)) {
+   nv04_surface_copy_swizzle(ctx, dst, src, dx, dy, sx, sy, w, h);
return;
}
 
-   nv04_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
+   /* Fallback to CPU copy. */
+   nv04_surface_copy_cpu(ctx, dst, src, dx, dy, sx, sy, w, h);
 }
 
 void

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


Mesa (master): dri/nouveau: Add some RGB888 span functions.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 23 16:30:48 2010 +0100

dri/nouveau: Add some RGB888 span functions.

---

 src/mesa/drivers/dri/nouveau/nouveau_span.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c 
b/src/mesa/drivers/dri/nouveau/nouveau_span.c
index dbbbf15..f1a56dd 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_span.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c
@@ -61,6 +61,15 @@
 
 #include spantmp2.h
 
+/* RGB888 span functions */
+#define SPANTMP_PIXEL_FMT GL_BGR
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
+#define TAG(x) nouveau_##x##_rgb888
+#define TAG2(x, y) nouveau_##x##_rgb888##y
+#define GET_PTR(x, y) (s-bo-map + (y)*s-pitch + (x)*s-cpp)
+
+#include spantmp2.h
+
 /* ARGB span functions */
 #define SPANTMP_PIXEL_FMT GL_BGRA
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
@@ -101,6 +110,8 @@ renderbuffer_map_unmap(struct gl_renderbuffer *rb, 
GLboolean map)
nouveau_InitPointers_rgb565(rb);
break;
case MESA_FORMAT_XRGB:
+   nouveau_InitPointers_rgb888(rb);
+   break;
case MESA_FORMAT_ARGB:
nouveau_InitPointers_argb(rb);
break;

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


Mesa (master): dri/nouveau: Set _BaseFormat correctly for z24s8 renderbuffers.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Feb 21 14:30:31 2010 +0100

dri/nouveau: Set _BaseFormat correctly for z24s8 renderbuffers.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 91eade8..c5fb015 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -70,7 +70,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum 
internalFormat)
case GL_DEPTH_COMPONENT24:
case GL_STENCIL_INDEX8_EXT:
case GL_DEPTH24_STENCIL8_EXT:
-   rb-_BaseFormat  = GL_DEPTH_COMPONENT;
+   rb-_BaseFormat  = GL_DEPTH_STENCIL;
rb-Format = MESA_FORMAT_Z24_S8;
rb-DataType = GL_UNSIGNED_INT;
s-cpp = 4;

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


Mesa (master): dri/nouveau: Fake A8 and L8 texture support on nv04.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 23 16:57:06 2010 +0100

dri/nouveau: Fake A8 and L8 texture support on nv04.

---

 src/mesa/drivers/dri/nouveau/nv04_state_frag.c |   76 ++-
 1 files changed, 46 insertions(+), 30 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index 34ee296..d7c86d4 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -41,6 +41,7 @@
NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0
 
 struct combiner_state {
+   GLcontext *ctx;
int unit;
GLboolean alpha;
 
@@ -59,11 +60,12 @@ struct combiner_state {
 
 /* Initialize a combiner_state struct from the texture unit
  * context. */
-#define INIT_COMBINER(chan, rc, i) do {\
+#define INIT_COMBINER(chan, ctx, rc, i) do {   \
struct gl_tex_env_combine_state *c =\
ctx-Texture.Unit[i]._CurrentCombine;   \
-   (rc)-alpha = __INIT_COMBINER_ALPHA_##chan; \
+   (rc)-ctx = ctx;\
(rc)-unit = i; \
+   (rc)-alpha = __INIT_COMBINER_ALPHA_##chan; \
(rc)-mode = c-Mode##chan; \
(rc)-source = c-Source##chan; \
(rc)-operand = c-Operand##chan;   \
@@ -72,11 +74,11 @@ struct combiner_state {
} while (0)
 
 /* Get the combiner source for the specified EXT_texture_env_combine
- * argument. */
+ * source. */
 static uint32_t
-get_arg_source(struct combiner_state *rc, int arg)
+get_input_source(struct combiner_state *rc, int source)
 {
-   switch (rc-source[arg]) {
+   switch (source) {
case GL_TEXTURE:
return rc-unit ? COMBINER_SOURCE(TEXTURE1) :
COMBINER_SOURCE(TEXTURE0);
@@ -103,38 +105,53 @@ get_arg_source(struct combiner_state *rc, int arg)
 }
 
 /* Get the (possibly inverted) combiner input mapping for the
- * specified argument. */
+ * specified EXT_texture_env_combine operand. */
 #define INVERT 0x1
 
 static uint32_t
-get_arg_mapping(struct combiner_state *rc, int arg, int flags)
+get_input_mapping(struct combiner_state *rc, int operand, int flags)
 {
int map = 0;
 
-   switch (rc-operand[arg]) {
-   case GL_SRC_COLOR:
-   case GL_ONE_MINUS_SRC_COLOR:
-   break;
+   if (!is_color_operand(operand)  !rc-alpha)
+   map |= COMBINER_ALPHA;
 
-   case GL_SRC_ALPHA:
-   case GL_ONE_MINUS_SRC_ALPHA:
-   map |= rc-alpha ? 0 : COMBINER_ALPHA;
-   break;
-   }
+   if (is_negative_operand(operand) == !(flags  INVERT))
+   map |= COMBINER_INVERT;
 
-   switch (rc-operand[arg]) {
-   case GL_SRC_COLOR:
-   case GL_SRC_ALPHA:
-   map |= flags  INVERT ? COMBINER_INVERT : 0;
-   break;
+   return map;
+}
 
-   case GL_ONE_MINUS_SRC_COLOR:
-   case GL_ONE_MINUS_SRC_ALPHA:
-   map |= flags  INVERT ? 0 : COMBINER_INVERT;
-   break;
+static uint32_t
+get_input_arg(struct combiner_state *rc, int arg, int flags)
+{
+   int source = rc-source[arg];
+   int operand = rc-operand[arg];
+
+   /* Fake several unsupported texture formats. */
+   if (is_texture_source(source)) {
+   int i = (source == GL_TEXTURE ?
+rc-unit : source - GL_TEXTURE0);
+   struct gl_texture_object *t = rc-ctx-Texture.Unit[i]._Current;
+   gl_format format = t-Image[0][t-BaseLevel]-TexFormat;
+
+   if (format == MESA_FORMAT_A8) {
+   /* Emulated using I8. */
+   if (is_color_operand(operand))
+   return COMBINER_SOURCE(ZERO) |
+   get_input_mapping(rc, operand, flags);
+
+   } else if (format == MESA_FORMAT_L8) {
+   /* Emulated using I8. */
+   if (!is_color_operand(operand))
+   return COMBINER_SOURCE(ZERO) |
+   get_input_mapping(rc, operand,
+ flags ^ INVERT);
+   }
}
 
-   return map;
+   return get_input_source(rc, source) |
+   get_input_mapping(rc, operand, flags);
 }
 
 /* Bind the combiner input in to the combiner source src,
@@ -146,8 +163,7 @@ get_arg_mapping(struct combiner_state *rc, int arg, int 
flags)
 /* Bind the combiner input in to the EXT_texture_env_combine
  * argument

Mesa (master): dri/nouveau: Don't try to map a non-existent teximage.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 23 16:31:42 2010 +0100

dri/nouveau: Don't try to map a non-existent teximage.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 32603ab..5b78804 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -81,10 +81,12 @@ nouveau_teximage_map(GLcontext *ctx, struct 
gl_texture_image *ti)
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
int ret;
 
-   ret = nouveau_bo_map(s-bo, NOUVEAU_BO_RDWR);
-   assert(!ret);
+   if (s-bo) {
+   ret = nouveau_bo_map(s-bo, NOUVEAU_BO_RDWR);
+   assert(!ret);
 
-   ti-Data = s-bo-map;
+   ti-Data = s-bo-map;
+   }
 }
 
 static void
@@ -92,7 +94,8 @@ nouveau_teximage_unmap(GLcontext *ctx, struct 
gl_texture_image *ti)
 {
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
-   nouveau_bo_unmap(s-bo);
+   if (s-bo)
+   nouveau_bo_unmap(s-bo);
ti-Data = NULL;
 }
 

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


Mesa (master): dri/nouveau: Try to validate textures earlier.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Feb 22 02:03:42 2010 +0100

dri/nouveau: Try to validate textures earlier.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c   |4 +-
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |  284 +++-
 src/mesa/drivers/dri/nouveau/nouveau_texture.h |5 +-
 src/mesa/drivers/dri/nouveau/nv04_state_tex.c  |4 +-
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |3 +-
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |3 +-
 6 files changed, 191 insertions(+), 112 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index d727822..5d593ed 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -396,7 +396,6 @@ nouveau_tex_parameter(GLcontext *ctx, GLenum target,
  const GLfloat *params)
 {
switch (pname) {
-   case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
@@ -408,9 +407,10 @@ nouveau_tex_parameter(GLcontext *ctx, GLenum target,
context_dirty_i(ctx, TEX_OBJ, ctx-Texture.CurrentUnit);
break;
 
+   case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_BASE_LEVEL:
case GL_TEXTURE_MAX_LEVEL:
-   texture_dirty(t);
+   nouveau_texture_reallocate(ctx, t);
context_dirty_i(ctx, TEX_OBJ, ctx-Texture.CurrentUnit);
break;
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index ab6e93c..32603ab 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -171,6 +171,148 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
}
 }
 
+static GLboolean
+teximage_fits(struct gl_texture_object *t, int level,
+ struct gl_texture_image *ti)
+{
+   struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
+
+   return s-bo  s-width == ti-Width 
+   s-height == ti-Height 
+   s-format == ti-TexFormat;
+}
+
+static GLboolean
+validate_teximage(GLcontext *ctx, struct gl_texture_object *t,
+ int level, int x, int y, int z,
+ int width, int height, int depth)
+{
+   struct gl_texture_image *ti = t-Image[0][level];
+
+   if (ti  teximage_fits(t, level, ti)) {
+   struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
+   struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
+
+   context_drv(ctx)-surface_copy(ctx, ss[level], s,
+  x, y, x, y,
+  width, height);
+
+   return GL_TRUE;
+   }
+
+   return GL_FALSE;
+}
+
+static int
+get_last_level(struct gl_texture_object *t)
+{
+   struct gl_texture_image *base = t-Image[0][t-BaseLevel];
+
+   if (t-MinFilter == GL_NEAREST ||
+   t-MinFilter == GL_LINEAR || !base)
+   return t-BaseLevel;
+   else
+   return MIN2(t-BaseLevel + base-MaxLog2, t-MaxLevel);
+}
+
+static void
+relayout_texture(GLcontext *ctx, struct gl_texture_object *t)
+{
+   struct gl_texture_image *base = t-Image[0][t-BaseLevel];
+
+   if (base) {
+   struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
+   struct nouveau_surface *s = to_nouveau_teximage(base)-surface;
+   int i, ret, last = get_last_level(t);
+   unsigned size, offset = 0,
+   width = s-width,
+   height = s-height;
+
+   /* Deallocate the old storage. */
+   for (i = 0; i  MAX_TEXTURE_LEVELS; i++)
+   nouveau_bo_ref(NULL, ss[i].bo);
+
+   /* Relayout the mipmap tree. */
+   for (i = t-BaseLevel; i = last; i++) {
+   size = width * height * s-cpp;
+
+   /* Images larger than 16B have to be aligned. */
+   if (size  16)
+   offset = align(offset, 64);
+
+   ss[i] = (struct nouveau_surface) {
+   .offset = offset,
+   .layout = SWIZZLED,
+   .format = s-format,
+   .width = width,
+   .height = height,
+   .cpp = s-cpp,
+   .pitch = width * s-cpp,
+   };
+
+   offset += size;
+   width = MAX2(1, width / 2

Mesa (master): dri/nouveau: Implement EXT_texture_from_pixmap.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Feb 21 14:23:40 2010 +0100

dri/nouveau: Implement EXT_texture_from_pixmap.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   91 
 src/mesa/drivers/dri/nouveau/nouveau_context.h |   13 +---
 src/mesa/drivers/dri/nouveau/nouveau_driver.c  |2 -
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |1 -
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  |8 ++
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   53 ++
 src/mesa/drivers/dri/nouveau/nouveau_texture.h |5 ++
 7 files changed, 116 insertions(+), 57 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b1b0e81..2629733 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -168,19 +168,19 @@ nouveau_context_destroy(__DRIcontext *dri_ctx)
context_drv(ctx)-context_destroy(ctx);
 }
 
-static void
-nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
-unsigned int *stamp)
+void
+nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
 {
-   struct nouveau_context *nctx = context-driverPrivate;
-   GLcontext *ctx = nctx-base;
-   __DRIscreen *screen = context-driScreenPriv;
-   struct gl_framebuffer *fb = drawable-driverPrivate;
+   GLcontext *ctx = dri_ctx-driverPrivate;
+   __DRIscreen *screen = dri_ctx-driScreenPriv;
+   struct gl_framebuffer *fb = draw-driverPrivate;
unsigned int attachments[10];
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
 
-   *stamp = *drawable-pStamp;
+   if (draw-lastStamp == *draw-pStamp)
+   return;
+   draw-lastStamp = *draw-pStamp;
 
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (fb-Visual.doubleBufferMode)
@@ -192,10 +192,9 @@ nouveau_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable,
else if (fb-Visual.haveStencilBuffer)
attachments[i++] = __DRI_BUFFER_STENCIL;
 
-   buffers = (*screen-dri2.loader-getBuffers)(drawable,
-drawable-w, drawable-h,
+   buffers = (*screen-dri2.loader-getBuffers)(draw, draw-w, draw-h,
 attachments, i, count,
-drawable-loaderPrivate);
+draw-loaderPrivate);
if (buffers == NULL)
return;
 
@@ -227,8 +226,8 @@ nouveau_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable,
rb = fb-Attachment[index].Renderbuffer;
s = to_nouveau_renderbuffer(rb)-surface;
 
-   s-width = drawable-w;
-   s-height = drawable-h;
+   s-width = draw-w;
+   s-height = draw-h;
s-pitch = buffers[i].pitch;
s-cpp = buffers[i].cpp;
 
@@ -244,12 +243,25 @@ nouveau_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable,
ret = nouveau_bo_handle_ref(context_dev(ctx),
buffers[i].name, s-bo);
assert(!ret);
-
-   context_dirty(ctx, FRAMEBUFFER);
}
}
 
-   _mesa_resize_framebuffer(ctx, fb, drawable-w, drawable-h);
+   _mesa_resize_framebuffer(NULL, fb, draw-w, draw-h);
+}
+
+static void
+update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
+  int *stamp)
+{
+   GLcontext *ctx = dri_ctx-driverPrivate;
+   struct gl_framebuffer *fb = draw-driverPrivate;
+
+   *stamp = *draw-pStamp;
+
+   nouveau_update_renderbuffers(dri_ctx, draw);
+   _mesa_resize_framebuffer(ctx, fb, draw-w, draw-h);
+
+   context_dirty(ctx, FRAMEBUFFER);
 }
 
 GLboolean
@@ -260,16 +272,15 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, 
__DRIdrawable *dri_draw,
struct nouveau_context *nctx = dri_ctx-driverPrivate;
GLcontext *ctx = nctx-base;
 
-   if (dri_draw-driverPrivate == ctx-WinSysDrawBuffer 
-   dri_read-driverPrivate == ctx-WinSysReadBuffer)
-   return GL_TRUE;
-
/* Ask the X server for new renderbuffers. */
-   nouveau_update_renderbuffers(dri_ctx, dri_draw,
-nctx-drawable.d_stamp);
-   if (dri_draw != dri_read)
-   nouveau_update_renderbuffers(dri_ctx, dri_read,
-nctx-drawable.r_stamp);
+   if (dri_draw

Mesa (master): dri/nouveau: Restructure the nv[12]0 regcombiner code, and fake A8/L8 support.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Feb 23 16:15:14 2010 +0100

dri/nouveau: Restructure the nv[12]0 regcombiner code, and fake A8/L8 support.

---

 src/mesa/drivers/dri/nouveau/Makefile  |1 +
 src/mesa/drivers/dri/nouveau/nouveau_util.h|   18 ++
 src/mesa/drivers/dri/nouveau/nv10_driver.h |8 +
 src/mesa/drivers/dri/nouveau/nv10_state_frag.c |  233 +++-
 src/mesa/drivers/dri/nouveau/nv20_context.c|   10 +-
 src/mesa/drivers/dri/nouveau/nv20_driver.h |7 +
 src/mesa/drivers/dri/nouveau/nv20_state_frag.c |   73 
 7 files changed, 221 insertions(+), 129 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/Makefile 
b/src/mesa/drivers/dri/nouveau/Makefile
index 43bc9f9..49e8933 100644
--- a/src/mesa/drivers/dri/nouveau/Makefile
+++ b/src/mesa/drivers/dri/nouveau/Makefile
@@ -42,6 +42,7 @@ DRIVER_SOURCES = \
nv20_state_polygon.c \
nv20_state_raster.c \
nv20_state_tex.c \
+   nv20_state_frag.c \
nv20_state_tnl.c
 
 C_SOURCES = \
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h 
b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 076f225..d6007ab 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -173,4 +173,22 @@ OUT_RINGm(struct nouveau_channel *chan, float m[16])
OUT_RINGf(chan, m[4*j + i]);
 }
 
+static inline GLboolean
+is_color_operand(int op)
+{
+   return op == GL_SRC_COLOR || op == GL_ONE_MINUS_SRC_COLOR;
+}
+
+static inline GLboolean
+is_negative_operand(int op)
+{
+   return op == GL_ONE_MINUS_SRC_COLOR || op == GL_ONE_MINUS_SRC_ALPHA;
+}
+
+static inline GLboolean
+is_texture_source(int s)
+{
+   return s == GL_TEXTURE || (s = GL_TEXTURE0  s = GL_TEXTURE31);
+}
+
 #endif
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h 
b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index 4c220b0..b5ab19b 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -119,6 +119,14 @@ nv10_emit_stencil_op(GLcontext *ctx, int emit);
 
 /* nv10_state_frag.c */
 void
+nv10_get_general_combiner(GLcontext *ctx, int i,
+ uint32_t *a_in, uint32_t *a_out,
+ uint32_t *c_in, uint32_t *c_out, uint32_t *k);
+
+void
+nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n);
+
+void
 nv10_emit_tex_env(GLcontext *ctx, int emit);
 
 void
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index c1df26e..b56b4ff 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Francisco Jerez.
+ * Copyright (C) 2009-2010 Francisco Jerez.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
@@ -90,11 +90,11 @@ struct combiner_state {
} while (0)
 
 /* Get the RC input source for the specified EXT_texture_env_combine
- * argument. */
+ * source. */
 static uint32_t
-get_input_source(struct combiner_state *rc, int arg)
+get_input_source(struct combiner_state *rc, int source)
 {
-   switch (rc-source[arg]) {
+   switch (source) {
case GL_TEXTURE:
return RC_IN_SOURCE(TEXTURE0) + rc-unit;
 
@@ -127,52 +127,69 @@ get_input_source(struct combiner_state *rc, int arg)
}
 }
 
-/* Get the RC input mapping for the specified argument, possibly
- * inverted or biased. */
+/* Get the RC input mapping for the specified texture_env_combine
+ * operand, possibly inverted or biased. */
 #define INVERT 0x1
 #define HALF_BIAS 0x2
 
 static uint32_t
-get_input_mapping(struct combiner_state *rc, int arg, int flags)
+get_input_mapping(struct combiner_state *rc, int operand, int flags)
 {
int map = 0;
 
-   switch (rc-operand[arg]) {
-   case GL_SRC_COLOR:
-   case GL_ONE_MINUS_SRC_COLOR:
+   if (is_color_operand(operand))
map |= RC_IN_USAGE(RGB);
-   break;
-
-   case GL_SRC_ALPHA:
-   case GL_ONE_MINUS_SRC_ALPHA:
+   else
map |= RC_IN_USAGE(ALPHA);
-   break;
-   }
 
-   switch (rc-operand[arg]) {
-   case GL_SRC_COLOR:
-   case GL_SRC_ALPHA:
-   map |= (flags  INVERT ? RC_IN_MAPPING(UNSIGNED_INVERT) :
-   flags  HALF_BIAS ? RC_IN_MAPPING(HALF_BIAS_NORMAL) :
-   RC_IN_MAPPING(UNSIGNED_IDENTITY));
-   break;
+   if (is_negative_operand(operand) == !(flags  INVERT))
+   map |= flags  HALF_BIAS ?
+   RC_IN_MAPPING(HALF_BIAS_NEGATE) :
+   RC_IN_MAPPING(UNSIGNED_INVERT);
+   else

Mesa (master): dri/nouveau: Add two stencil operation cases in nv04_state_raster.c.

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

Author: Andrew Randrianasulu randrianas...@gmail.com
Date:   Mon Mar  1 01:48:29 2010 +0100

dri/nouveau: Add two stencil operation cases in nv04_state_raster.c.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 5e3788d..6d0b262 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -61,6 +61,10 @@ get_stencil_op(unsigned op)
switch (op) {
case GL_KEEP:
return 0x1;
+   case GL_ZERO:
+   return 0x2;
+   case GL_REPLACE:
+   return 0x3;
case GL_INCR:
return 0x4;
case GL_DECR:

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


Mesa (master): dri/nouveau: Fix up the ADD texture environment on nv0x.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar  1 01:53:22 2010 +0100

dri/nouveau: Fix up the ADD texture environment on nv0x.

---

 src/mesa/drivers/dri/nouveau/nv04_context.c  |1 +
 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |2 --
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1056171..1acd41d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -40,6 +40,7 @@ nv04_context_engine(GLcontext *ctx)
 
if (ctx-Texture.Unit[0].EnvMode == GL_COMBINE ||
ctx-Texture.Unit[0].EnvMode == GL_BLEND ||
+   ctx-Texture.Unit[0].EnvMode == GL_ADD ||
ctx-Texture.Unit[1]._ReallyEnabled ||
ctx-Stencil.Enabled)
fahrenheit = hw-eng3dm;
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 6d0b262..b52922e 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -82,8 +82,6 @@ get_texenv_mode(unsigned mode)
switch (mode) {
case GL_REPLACE:
return 0x1;
-   case GL_ADD:
-   return 0x2;
case GL_DECAL:
return 0x3;
case GL_MODULATE:

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


Mesa (master): dri/nouveau: Combine the dummy texture more deterministically on nv0x.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar  1 01:56:38 2010 +0100

dri/nouveau: Combine the dummy texture more deterministically on nv0x.

---

 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index b52922e..89c6753 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -300,7 +300,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
blend |= NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_FLAT;
 
/* Texture environment. */
-   blend |= get_texenv_mode(ctx-Texture.Unit[0].EnvMode);
+   if (ctx-Texture._EnabledUnits)
+   blend |= get_texenv_mode(ctx-Texture.Unit[0].EnvMode);
+   else
+   blend |= get_texenv_mode(GL_MODULATE);
 
/* Fog. */
if (ctx-Fog.Enabled)

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


Mesa (master): dri/nouveau: Pack client arrays as they' re copied to the real BO.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 43c347c63ee10db95bd912fc39b1127fa35305a4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=43c347c63ee10db95bd912fc39b1127fa35305a4

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 21:27:11 2010 +0100

dri/nouveau: Pack client arrays as they're copied to the real BO.

---

 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |   44 +++---
 1 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 02c8580..8a2caff 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -24,8 +24,11 @@
  *
  */
 
-#include main/bufferobj.h
 #include nouveau_bufferobj.h
+#include nouveau_util.h
+
+#include main/bufferobj.h
+#include main/image.h
 
 /* Arbitrary pushbuf length we can assume we can get with a single
  * WAIT_RING. */
@@ -58,7 +61,11 @@ vbo_init_array(struct nouveau_array_state *a, int attr, int 
stride,
} else {
nouveau_bo_ref(NULL, a-bo);
a-offset = 0;
-   a-buf = ptr;
+
+   if (map)
+   a-buf = ptr;
+   else
+   a-buf = NULL;
}
 
if (a-buf)
@@ -94,11 +101,20 @@ vbo_init_arrays(GLcontext *ctx, const struct 
_mesa_index_buffer *ib,
 
if (attr = 0) {
const struct gl_client_array *array = arrays[attr];
+   int stride;
+
+   if (render-mode == VBO 
+   !_mesa_is_bufferobj(array-BufferObj))
+   /* Pack client buffers. */
+   stride = align(_mesa_sizeof_type(array-Type)
+  * array-Size, 4);
+   else
+   stride = array-StrideB;
 
vbo_init_array(render-attrs[attr], attr,
-  array-StrideB, array-Size,
-  array-Type, array-BufferObj,
-  array-Ptr, render-mode == IMM);
+  stride, array-Size, array-Type,
+  array-BufferObj, array-Ptr,
+  render-mode == IMM);
}
}
 }
@@ -276,17 +292,21 @@ vbo_bind_vertices(GLcontext *ctx, const struct 
gl_client_array **arrays,
if (attr = 0) {
const struct gl_client_array *array = arrays[attr];
struct nouveau_array_state *a = render-attrs[attr];
-   unsigned delta = (basevertex + min_index) * a-stride,
-   size = (max_index - min_index + 1) * a-stride;
+   unsigned delta = (basevertex + min_index)
+   * array-StrideB;
 
if (a-bo) {
a-offset = (intptr_t)array-Ptr + delta;
} else {
-   void *scratch = get_scratch_vbo(ctx, size,
-   a-bo,
-   a-offset);
-
-   memcpy(scratch, a-buf + delta, size);
+   int j, n = max_index - min_index + 1;
+   char *sp = (char *)array-Ptr + delta;
+   char *dp = get_scratch_vbo(ctx, n * a-stride,
+  a-bo, a-offset);
+
+   for (j = 0; j  n; j++)
+   memcpy(dp + j * a-stride,
+  sp + j * array-StrideB,
+  a-stride);
}
}
}

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


Mesa (master): dri/nouveau: Try to keep client buffers smaller than the scratch VBO length.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 80316cbefaa28454ab9d6da44ac93805608c3685
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=80316cbefaa28454ab9d6da44ac93805608c3685

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 21:32:07 2010 +0100

dri/nouveau: Try to keep client buffers smaller than the scratch VBO length.

---

 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 8a2caff..69a9b96 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -243,6 +243,23 @@ vbo_choose_attrs(GLcontext *ctx, const struct 
gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
 }
 
+static unsigned
+get_max_client_stride(GLcontext *ctx)
+{
+   struct nouveau_render_state *render = to_render_state(ctx);
+   int i, s = 0;
+
+   for (i = 0; i  render-attr_count; i++) {
+   int attr = render-map[i];
+   struct nouveau_array_state *a = render-attrs[attr];
+
+   if (attr = 0  !a-bo)
+   s = MAX2(a-stride, s);
+   }
+
+   return s;
+}
+
 static void
 TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
  const struct _mesa_prim *prims, GLuint nr_prims,
@@ -257,9 +274,18 @@ vbo_maybe_split(GLcontext *ctx, const struct 
gl_client_array **arrays,
GLuint min_index, GLuint max_index)
 {
struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct nouveau_render_state *render = to_render_state(ctx);
unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx-bo.count,
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
+   int stride;
+
+   /* Try to keep client buffers smaller than the scratch BOs. */
+   if (!ib  render-mode == VBO 
+   (stride = get_max_client_stride(ctx)))
+   vert_avail = MIN2(vert_avail,
+ RENDER_SCRATCH_SIZE / stride);
+
 
if ((ib  ib-count  idx_avail) ||
(!ib  max_index - min_index  vert_avail)) {

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


Mesa (master): dri/nouveau: Trivially add GL_ARB_texture_mirrored_repeat.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 9c4937524e15dc685eb0c83cbdab8b637803fd78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c4937524e15dc685eb0c83cbdab8b637803fd78

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Thu Mar  4 23:15:47 2010 +0100

dri/nouveau: Trivially add GL_ARB_texture_mirrored_repeat.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index ef26a19..52185a2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -53,6 +53,7 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_texture_env_add, NULL },
{ GL_EXT_texture_lod_bias,NULL },
{ GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_ARB_texture_mirrored_repeat, NULL },
{ GL_EXT_stencil_wrap,NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
{ GL_SGIS_generate_mipmap,NULL },

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


Mesa (master): dri/nouveau: Fix rb-DataType for z24s8 renderbuffers.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 9c21c1e865ad3008eb6f4d6d4e4a48c2ed94472d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c21c1e865ad3008eb6f4d6d4e4a48c2ed94472d

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 21:40:47 2010 +0100

dri/nouveau: Fix rb-DataType for z24s8 renderbuffers.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 8464786..2ec3dc9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -72,7 +72,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum 
internalFormat)
case GL_DEPTH24_STENCIL8_EXT:
rb-_BaseFormat  = GL_DEPTH_STENCIL;
rb-Format = MESA_FORMAT_Z24_S8;
-   rb-DataType = GL_UNSIGNED_INT;
+   rb-DataType = GL_UNSIGNED_INT_24_8_EXT;
s-cpp = 4;
break;
default:

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


Mesa (master): dri/nouveau: Add GL_EXT_stencil_wrap for nv04.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 210bcf6d156aba5994f25f1bd9c50586ebc3bada
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=210bcf6d156aba5994f25f1bd9c50586ebc3bada

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Mon Mar  1 23:58:17 2010 +

dri/nouveau: Add GL_EXT_stencil_wrap for nv04.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 89c6753..4314fc3 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -71,6 +71,10 @@ get_stencil_op(unsigned op)
return 0x5;
case GL_INVERT:
return 0x6;
+   case GL_INCR_WRAP:
+   return 0x7;
+   case GL_DECR_WRAP:
+   return 0x8;
default:
assert(0);
}

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


Mesa (master): dri/nouveau: Enable GL_EXT_stencil_wrap.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 44df3577a77818d6e87f1b728f0aa19698133981
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=44df3577a77818d6e87f1b728f0aa19698133981

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Mon Mar  1 23:45:50 2010 +

dri/nouveau: Enable GL_EXT_stencil_wrap.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 2629733..ef26a19 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -47,14 +47,15 @@
 #include main/remap_helper.h
 
 static const struct dri_extension nouveau_extensions[] = {
-   { GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
{ GL_ARB_multitexture,NULL },
-   { GL_EXT_texture_lod_bias,NULL },
-   { GL_SGIS_generate_mipmap,NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },
{ GL_ARB_texture_env_add, NULL },
+   { GL_EXT_texture_lod_bias,NULL },
+   { GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_EXT_stencil_wrap,NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
+   { GL_SGIS_generate_mipmap,NULL },
{ NULL, NULL }
 };
 

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


Mesa (master): dri/nouveau: Remove some CI remnants.

2010-03-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: a42fd95f43929c1e2c7acf2a6e49c473e1a2a178
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a42fd95f43929c1e2c7acf2a6e49c473e1a2a178

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar  4 23:19:49 2010 +0100

dri/nouveau: Remove some CI remnants.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.h |1 -
 src/mesa/drivers/dri/nouveau/nv04_context.c  |1 -
 src/mesa/drivers/dri/nouveau/nv10_context.c  |1 -
 src/mesa/drivers/dri/nouveau/nv10_driver.h   |3 ---
 src/mesa/drivers/dri/nouveau/nv10_state_raster.c |5 -
 src/mesa/drivers/dri/nouveau/nv20_context.c  |1 -
 6 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h 
b/src/mesa/drivers/dri/nouveau/nouveau_state.h
index d001fa2..d01d962 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h
@@ -47,7 +47,6 @@ enum {
NOUVEAU_STATE_FRAG,
NOUVEAU_STATE_FRAMEBUFFER,
NOUVEAU_STATE_FOG,
-   NOUVEAU_STATE_INDEX_MASK,
NOUVEAU_STATE_LIGHT_ENABLE,
NOUVEAU_STATE_LIGHT_MODEL,
NOUVEAU_STATE_LIGHT_SOURCE0,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1acd41d..a442425 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -265,7 +265,6 @@ const struct nouveau_driver nv04_driver = {
nouveau_emit_nothing,
nouveau_emit_nothing,
nouveau_emit_nothing,
-   nouveau_emit_nothing,
nv04_emit_scissor,
nv04_defer_blend,
nv04_defer_control,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 8e70c41..860d0ae 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -370,7 +370,6 @@ const struct nouveau_driver nv10_driver = {
nv10_emit_frag,
nv10_emit_framebuffer,
nv10_emit_fog,
-   nv10_emit_index_mask,
nv10_emit_light_enable,
nv10_emit_light_model,
nv10_emit_light_source,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h 
b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index b5ab19b..d662712 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -100,9 +100,6 @@ void
 nv10_emit_dither(GLcontext *ctx, int emit);
 
 void
-nv10_emit_index_mask(GLcontext *ctx, int emit);
-
-void
 nv10_emit_logic_opcode(GLcontext *ctx, int emit);
 
 void
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
index 68882ef..a62cd80 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
@@ -119,11 +119,6 @@ nv10_emit_dither(GLcontext *ctx, int emit)
 }
 
 void
-nv10_emit_index_mask(GLcontext *ctx, int emit)
-{
-}
-
-void
 nv10_emit_logic_opcode(GLcontext *ctx, int emit)
 {
struct nouveau_channel *chan = context_chan(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 635b5c0..db39ef7 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -459,7 +459,6 @@ const struct nouveau_driver nv20_driver = {
nv20_emit_frag,
nv20_emit_framebuffer,
nv20_emit_fog,
-   nv10_emit_index_mask,
nv10_emit_light_enable,
nv20_emit_light_model,
nv20_emit_light_source,

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


Mesa (master): dri/nouveau: Check _ColorDrawBuffers[0] before emitting fb state.

2010-03-07 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 5befb6f810fb88ed1e51ec26b79b647cd15b1433
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5befb6f810fb88ed1e51ec26b79b647cd15b1433

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Mar  7 14:20:31 2010 +0100

dri/nouveau: Check _ColorDrawBuffers[0] before emitting fb state.

---

 src/mesa/drivers/dri/nouveau/nv04_state_fb.c |2 +-
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c |2 +-
 src/mesa/drivers/dri/nouveau/nv20_state_fb.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
index aad1e49..5e5e0c5 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
@@ -63,7 +63,7 @@ nv04_emit_framebuffer(GLcontext *ctx, int emit)
return;
 
/* Render target */
-   if (fb-_NumColorDrawBuffers) {
+   if (fb-_ColorDrawBuffers[0]) {
s = to_nouveau_renderbuffer(
fb-_ColorDrawBuffers[0])-surface;
 
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 05c36b4..6bd383e 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -111,7 +111,7 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit)
}
 
/* Render target */
-   if (fb-_NumColorDrawBuffers) {
+   if (fb-_ColorDrawBuffers[0]) {
s = to_nouveau_renderbuffer(
fb-_ColorDrawBuffers[0])-surface;
 
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 869acd6..d638541 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -67,7 +67,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
return;
 
/* Render target */
-   if (fb-_NumColorDrawBuffers) {
+   if (fb-_ColorDrawBuffers[0]) {
s = to_nouveau_renderbuffer(
fb-_ColorDrawBuffers[0])-surface;
 

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


Mesa (master): dri/nv04: GL_EXT_secondary_color

2010-03-07 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 6a15edfed326a06f08ac63020dc9472e45d8a9e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a15edfed326a06f08ac63020dc9472e45d8a9e1

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Sun Mar  7 01:09:21 2010 +

dri/nv04: GL_EXT_secondary_color

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c   |   10 ++
 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |8 
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index e26ed36..502e012 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -43,19 +43,21 @@
 
 #define need_GL_EXT_framebuffer_object
 #define need_GL_EXT_fog_coord
+#define need_GL_EXT_secondary_color
 
 #include main/remap_helper.h
 
 static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_multitexture,NULL },
+   { GL_ARB_texture_env_add, NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },
-   { GL_ARB_texture_env_add, NULL },
-   { GL_EXT_texture_lod_bias,NULL },
-   { GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
{ GL_ARB_texture_mirrored_repeat, NULL },
-   { GL_EXT_stencil_wrap,NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
+   { GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_EXT_secondary_color, GL_EXT_secondary_color_functions },
+   { GL_EXT_stencil_wrap,NULL },
+   { GL_EXT_texture_lod_bias,NULL },
{ GL_NV_blend_square, NULL },
{ GL_SGIS_generate_mipmap,NULL },
{ NULL, NULL }
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 4314fc3..c191571 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -275,6 +275,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
else
blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT;
 
+   /* Secondary color */
+   if (NEED_SECONDARY_COLOR(ctx))
+   blend |= NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
/* Fog. */
if (ctx-Fog.Enabled)
blend |= NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE;
@@ -309,6 +313,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
else
blend |= get_texenv_mode(GL_MODULATE);
 
+   /* Secondary color */
+   if (NEED_SECONDARY_COLOR(ctx))
+   blend |= NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
/* Fog. */
if (ctx-Fog.Enabled)
blend |= NV04_TEXTURED_TRIANGLE_BLEND_FOG_ENABLE;

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


Mesa (master): dri/nouveau: Trivially add GL_NV_blend_square

2010-03-07 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: e64680bc1e36699096af5ade876b6cb0f5791ad0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e64680bc1e36699096af5ade876b6cb0f5791ad0

Author: Andrew Randrianasulu rand...@mail.ru
Date:   Tue Mar  2 01:29:14 2010 +

dri/nouveau: Trivially add GL_NV_blend_square

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 52185a2..e26ed36 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -56,6 +56,7 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_texture_mirrored_repeat, NULL },
{ GL_EXT_stencil_wrap,NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
+   { GL_NV_blend_square, NULL },
{ GL_SGIS_generate_mipmap,NULL },
{ NULL, NULL }
 };

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


Mesa (master): dri/nouveau: Fix nv[12]x color sum.

2010-03-07 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 75f52d1e5210944d7e92787c637285fd83533053
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=75f52d1e5210944d7e92787c637285fd83533053

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Mar  7 18:40:21 2010 +0100

dri/nouveau: Fix nv[12]x color sum.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c  |1 +
 src/mesa/drivers/dri/nouveau/nv10_state_tnl.c |6 --
 src/mesa/drivers/dri/nouveau/nv20_state_tnl.c |2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index e1871db..bc61045 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -150,6 +150,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
case GL_COLOR_SUM_EXT:
context_dirty(ctx, FRAG);
+   context_dirty(ctx, LIGHT_MODEL);
break;
case GL_CULL_FACE:
context_dirty(ctx, CULL_FACE);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
index 6db14d8..406e24c 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
@@ -201,8 +201,10 @@ nv10_emit_light_model(GLcontext *ctx, int emit)
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_MODEL, 1);
OUT_RING(chan, ((m-LocalViewer ?
 NV10TCL_LIGHT_MODEL_LOCAL_VIEWER : 0) |
-   (m-ColorControl == GL_SEPARATE_SPECULAR_COLOR ?
-NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR : 0)));
+   (NEED_SECONDARY_COLOR(ctx) ?
+NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR : 0) |
+   (!ctx-Light.Enabled  ctx-Fog.ColorSumEnabled ?
+NV10TCL_LIGHT_MODEL_VERTEX_SPECULAR : 0)));
 }
 
 static float
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
index 0d56606..43f8c72 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
@@ -158,7 +158,7 @@ nv20_emit_light_model(GLcontext *ctx, int emit)
OUT_RING(chan, ((m-LocalViewer ?
 NV20TCL_LIGHT_MODEL_VIEWER_LOCAL :
 NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL) |
-   (m-ColorControl == GL_SEPARATE_SPECULAR_COLOR ?
+   (NEED_SECONDARY_COLOR(ctx) ?
 NV20TCL_LIGHT_MODEL_SEPARATE_SPECULAR :
 0)));
 

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


Mesa (master): dri/nouveau: Split big client buffers in the indexed case too.

2010-03-07 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: ea027bda8e4a7cdd8f131e01ab4ff80d6c6a3ab7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea027bda8e4a7cdd8f131e01ab4ff80d6c6a3ab7

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Mar  7 19:12:27 2010 +0100

dri/nouveau: Split big client buffers in the indexed case too.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 69a9b96..a365b97 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -281,14 +281,13 @@ vbo_maybe_split(GLcontext *ctx, const struct 
gl_client_array **arrays,
int stride;
 
/* Try to keep client buffers smaller than the scratch BOs. */
-   if (!ib  render-mode == VBO 
+   if (render-mode == VBO 
(stride = get_max_client_stride(ctx)))
vert_avail = MIN2(vert_avail,
  RENDER_SCRATCH_SIZE / stride);
 
-
-   if ((ib  ib-count  idx_avail) ||
-   (!ib  max_index - min_index  vert_avail)) {
+   if (max_index - min_index  vert_avail ||
+   (ib  ib-count  idx_avail)) {
struct split_limits limits = {
.max_verts = vert_avail,
.max_indices = idx_avail,

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


Mesa (master): dri/nouveau: Just reemit the BO state on pushbuf flush.

2010-03-10 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 878eef8c40046f77cf1527fef06f1ea95bd1629a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=878eef8c40046f77cf1527fef06f1ea95bd1629a

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Mar 10 23:51:06 2010 +0100

dri/nouveau: Just reemit the BO state on pushbuf flush.

Reemitting dirty states on flush causes problems if the GL context
isn't fully consistent when we get to it. It didn't serve any specific
purpose, so, use nouveau_bo_state_emit instead.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |4 ++--
 src/mesa/drivers/dri/nouveau/nouveau_context.h |2 ++
 src/mesa/drivers/dri/nouveau/nv04_context.c|   22 ++
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 502e012..be57d48 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -69,8 +69,8 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan)
struct nouveau_context *nctx = chan-user_private;
GLcontext *ctx = nctx-base;
 
-   if (nctx-fallback  SWRAST  ctx-DrawBuffer)
-   nouveau_state_emit(nctx-base);
+   if (nctx-fallback  SWRAST)
+   nouveau_bo_state_emit(ctx);
 }
 
 GLboolean
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h 
b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 682f8a4..fe64fec 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -85,6 +85,8 @@ struct nouveau_context {
BITSET_SET(to_nouveau_context(ctx)-dirty, NOUVEAU_STATE_##s)
 #define context_dirty_i(ctx, s, i) \
BITSET_SET(to_nouveau_context(ctx)-dirty, NOUVEAU_STATE_##s##0 + i)
+#define context_emit(ctx, s) \
+   context_drv(ctx)-emit[NOUVEAU_STATE_##s](ctx, NOUVEAU_STATE_##s)
 
 GLboolean
 nouveau_context_create(const __GLcontextModes *visual, __DRIcontext *dri_ctx,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index a442425..3624b3a 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -75,18 +75,16 @@ nv04_channel_flush_notify(struct nouveau_channel *chan)
struct nouveau_context *nctx = chan-user_private;
GLcontext *ctx = nctx-base;
 
-   if (nctx-fallback  SWRAST  ctx-DrawBuffer) {
-   GLcontext *ctx = nctx-base;
-
+   if (nctx-fallback  SWRAST) {
/* Flushing seems to clobber the engine context. */
-   context_dirty_i(ctx, TEX_OBJ, 0);
-   context_dirty_i(ctx, TEX_OBJ, 1);
-   context_dirty_i(ctx, TEX_ENV, 0);
-   context_dirty_i(ctx, TEX_ENV, 1);
-   context_dirty(ctx, CONTROL);
-   context_dirty(ctx, BLEND);
-
-   nouveau_state_emit(ctx);
+   context_emit(ctx, TEX_OBJ0);
+   context_emit(ctx, TEX_OBJ1);
+   context_emit(ctx, TEX_ENV0);
+   context_emit(ctx, TEX_ENV1);
+   context_emit(ctx, CONTROL);
+   context_emit(ctx, BLEND);
+
+   nouveau_bo_state_emit(ctx);
}
 }
 
@@ -200,9 +198,9 @@ nv04_context_create(struct nouveau_screen *screen, const 
GLvisual *visual,
if (ret)
goto fail;
 
+   init_dummy_texture(ctx);
nv04_hwctx_init(ctx);
nv04_render_init(ctx);
-   init_dummy_texture(ctx);
 
return ctx;
 

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


Mesa (master): dri/nouveau: Some minor vertex submission fixes.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 11 21:48:51 2010 +0100

dri/nouveau: Some minor vertex submission fixes.

---

 src/mesa/drivers/dri/nouveau/nouveau_render_t.c |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c|   20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
index c050578..7ccd7e6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
@@ -254,7 +254,7 @@ get_scratch_vbo(GLcontext *ctx, unsigned size, struct 
nouveau_bo **bo,
  */
 static inline unsigned
 get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib,
-unsigned n)
+int n)
 {
struct nouveau_render_state *render = to_render_state(ctx);
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index a365b97..f20a7df 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -244,17 +244,20 @@ vbo_choose_attrs(GLcontext *ctx, const struct 
gl_client_array **arrays)
 }
 
 static unsigned
-get_max_client_stride(GLcontext *ctx)
+get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
int i, s = 0;
 
for (i = 0; i  render-attr_count; i++) {
int attr = render-map[i];
-   struct nouveau_array_state *a = render-attrs[attr];
 
-   if (attr = 0  !a-bo)
-   s = MAX2(a-stride, s);
+   if (attr = 0) {
+   const struct gl_client_array *a = arrays[attr];
+
+   if (!_mesa_is_bufferobj(a-BufferObj))
+   s = MAX2(a-StrideB, s);
+   }
}
 
return s;
@@ -275,14 +278,15 @@ vbo_maybe_split(GLcontext *ctx, const struct 
gl_client_array **arrays,
 {
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
-   unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx-bo.count,
+   unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * (nctx-bo.count +
+  render-attr_count),
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
int stride;
 
/* Try to keep client buffers smaller than the scratch BOs. */
if (render-mode == VBO 
-   (stride = get_max_client_stride(ctx)))
+   (stride = get_max_client_stride(ctx, arrays)))
vert_avail = MIN2(vert_avail,
  RENDER_SCRATCH_SIZE / stride);
 
@@ -371,8 +375,6 @@ vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array 
**arrays,
dispatch(ctx, start, delta, count);
BATCH_END();
}
-
-   FIRE_RING(chan);
 }
 
 /* Immediate rendering path. */
@@ -416,8 +418,6 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array 
**arrays,
 
BATCH_END();
}
-
-   FIRE_RING(chan);
 }
 
 /* draw_prims entry point when we're doing hw-tnl. */

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


Mesa (master): dri/nouveau: only reallocate texture when needed

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

Author: Xavier Chantry chantry.xav...@gmail.com
Date:   Sat Mar 13 19:28:07 2010 +0100

dri/nouveau: only reallocate texture when needed

nouveau reallocated the mipmap tree on every MIN_FILTER call to account
for mipmap change. We only need to do this if the texture does not fit
in the existing mipmap tree. This gives a big performance boost for a
game like bzflag which changes MIN_FILTER all the time for its font
rendering.

Signed-off-by: Xavier Chantry chantry.xav...@gmail.com
Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   25 +--
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index bf365bf..20bc0f6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -177,15 +177,15 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
 }
 
 static GLboolean
-teximage_fits(struct gl_texture_object *t, int level,
- struct gl_texture_image *ti)
+teximage_fits(struct gl_texture_object *t, int level)
 {
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
+   struct gl_texture_image *ti = t-Image[0][level];
 
-   return t-Target == GL_TEXTURE_RECTANGLE ||
-   (s-bo  s-width == ti-Width 
-s-height == ti-Height 
-s-format == ti-TexFormat);
+   return ti  (t-Target == GL_TEXTURE_RECTANGLE ||
+ (s-bo  s-width == ti-Width 
+  s-height == ti-Height 
+  s-format == ti-TexFormat));
 }
 
 static GLboolean
@@ -195,7 +195,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
 {
struct gl_texture_image *ti = t-Image[0][level];
 
-   if (ti  teximage_fits(t, level, ti)) {
+   if (teximage_fits(t, level)) {
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
@@ -304,9 +304,12 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
 void
 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
 {
-   texture_dirty(t);
-   relayout_texture(ctx, t);
-   nouveau_texture_validate(ctx, t);
+   if (!teximage_fits(t, t-BaseLevel) ||
+   !teximage_fits(t, get_last_level(t))) {
+   texture_dirty(t);
+   relayout_texture(ctx, t);
+   nouveau_texture_validate(ctx, t);
+   }
 }
 
 static unsigned
@@ -364,7 +367,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, 
GLint level,
}
 
if (level == t-BaseLevel) {
-   if (!teximage_fits(t, level, ti))
+   if (!teximage_fits(t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}

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


Mesa (master): dri/nouveau: Implement texture matrices.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 18 14:13:36 2010 +0100

dri/nouveau: Implement texture matrices.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c  |7 +++
 src/mesa/drivers/dri/nouveau/nouveau_state.h  |4 
 src/mesa/drivers/dri/nouveau/nv04_context.c   |4 
 src/mesa/drivers/dri/nouveau/nv10_context.c   |4 
 src/mesa/drivers/dri/nouveau/nv10_driver.h|3 +++
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c |   25 +
 src/mesa/drivers/dri/nouveau/nv20_context.c   |4 
 src/mesa/drivers/dri/nouveau/nv20_driver.h|3 +++
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c |   24 
 9 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index bc61045..603a46e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -454,12 +454,19 @@ nouveau_state_emit(GLcontext *ctx)
 static void
 nouveau_update_state(GLcontext *ctx, GLbitfield new_state)
 {
+   int i;
+
if (new_state  (_NEW_PROJECTION | _NEW_MODELVIEW))
context_dirty(ctx, PROJECTION);
 
if (new_state  _NEW_MODELVIEW)
context_dirty(ctx, MODELVIEW);
 
+   if (new_state  _NEW_TEXTURE_MATRIX) {
+   for (i = 0; i  ctx-Const.MaxTextureCoordUnits; i++)
+   context_dirty_i(ctx, TEX_MAT, i);
+   }
+
if (new_state  _NEW_CURRENT_ATTRIB 
new_state  _NEW_LIGHT) {
context_dirty(ctx, MATERIAL_FRONT_AMBIENT);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h 
b/src/mesa/drivers/dri/nouveau/nouveau_state.h
index d01d962..38ac975 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h
@@ -89,6 +89,10 @@ enum {
NOUVEAU_STATE_TEX_GEN1,
NOUVEAU_STATE_TEX_GEN2,
NOUVEAU_STATE_TEX_GEN3,
+   NOUVEAU_STATE_TEX_MAT0,
+   NOUVEAU_STATE_TEX_MAT1,
+   NOUVEAU_STATE_TEX_MAT2,
+   NOUVEAU_STATE_TEX_MAT3,
NOUVEAU_STATE_TEX_OBJ0,
NOUVEAU_STATE_TEX_OBJ1,
NOUVEAU_STATE_TEX_OBJ2,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 3624b3a..6834f7c 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -276,6 +276,10 @@ const struct nouveau_driver nv04_driver = {
nouveau_emit_nothing,
nouveau_emit_nothing,
nouveau_emit_nothing,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
nv04_emit_tex_obj,
nv04_emit_tex_obj,
nouveau_emit_nothing,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 860d0ae..d008063 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -412,6 +412,10 @@ const struct nouveau_driver nv10_driver = {
nv10_emit_tex_gen,
nouveau_emit_nothing,
nouveau_emit_nothing,
+   nv10_emit_tex_mat,
+   nv10_emit_tex_mat,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
nv10_emit_tex_obj,
nv10_emit_tex_obj,
nouveau_emit_nothing,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h 
b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index d662712..cefd6c6 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -134,6 +134,9 @@ void
 nv10_emit_tex_gen(GLcontext *ctx, int emit);
 
 void
+nv10_emit_tex_mat(GLcontext *ctx, int emit);
+
+void
 nv10_emit_tex_obj(GLcontext *ctx, int emit);
 
 /* nv10_state_tnl.c */
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 02a5ca7..9214872 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -32,11 +32,36 @@
 #include nouveau_util.h
 #include nv10_driver.h
 
+#define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i))
+
 void
 nv10_emit_tex_gen(GLcontext *ctx, int emit)
 {
 }
 
+void
+nv10_emit_tex_mat(GLcontext *ctx, int emit)
+{
+   const int i = emit - NOUVEAU_STATE_TEX_MAT0;
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct nouveau_channel *chan = context_chan(ctx);
+   struct nouveau_grobj *celsius = context_eng3d(ctx);
+
+   if (nctx-fallback == HWTNL 
+   ((ctx-Texture

Mesa (master): dri/nouveau: Avoid pushbuf flushes in the middle of LMA setup.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 18 14:19:10 2010 +0100

dri/nouveau: Avoid pushbuf flushes in the middle of LMA setup.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 6bd383e..f7c3d36 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -71,6 +71,7 @@ setup_lma_buffer(GLcontext *ctx)
nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET,
 nfb-lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
 
+   WAIT_RING(chan, 9);
BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4);
OUT_RINGf(chan, - 1792);
OUT_RINGf(chan, - 2304 + fb-Height);

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


Mesa (master): dri/nouveau: Flush after texture validation.

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

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 18 13:46:20 2010 +0100

dri/nouveau: Flush after texture validation.

Swizzling needs the destination surface in VRAM, but the subsequent
rendering operations making use of it are likely to not care. Fire the
ring after validation to leave the memory manager more room for
maneuvering.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 20bc0f6..e890186 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -296,6 +296,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
validate_teximage(ctx, t, i, 0, 0, 0,
  s-width, s-height, 1);
}
+
+   FIRE_RING(context_chan(ctx));
}
 
return GL_TRUE;

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


Mesa (master): dri/nouveau: Random cleanups.

2010-03-21 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 7f1f4c14eced51bf3f43764e2864693ba1c4a6d5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f1f4c14eced51bf3f43764e2864693ba1c4a6d5

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Mar 21 11:49:20 2010 +0100

dri/nouveau: Random cleanups.

---

 src/mesa/drivers/dri/nouveau/nouveau_render.h  |4 +-
 src/mesa/drivers/dri/nouveau/nouveau_texture.h |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c   |   31 +--
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c   |4 +-
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |5 +--
 src/mesa/drivers/dri/nouveau/nv10_state_tnl.c  |   51 +--
 src/mesa/drivers/dri/nouveau/nv20_state_fb.c   |4 +-
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |5 +--
 src/mesa/drivers/dri/nouveau/nv20_state_tnl.c  |   51 +--
 9 files changed, 48 insertions(+), 109 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h 
b/src/mesa/drivers/dri/nouveau/nouveau_render.h
index bff0ccf..923b79b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h
@@ -32,8 +32,8 @@
 struct nouveau_array_state;
 
 typedef void (*dispatch_t)(GLcontext *, unsigned int, int, unsigned int);
-typedef unsigned (*extract_u_t)(struct nouveau_array_state *a, int i, int j);
-typedef float (*extract_f_t)(struct nouveau_array_state *a, int i, int j);
+typedef unsigned (*extract_u_t)(struct nouveau_array_state *, int, int);
+typedef float (*extract_f_t)(struct nouveau_array_state *, int, int);
 
 struct nouveau_attr_info {
int vbo_index;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.h 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
index b91facb..251f537 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
@@ -41,7 +41,7 @@ struct nouveau_texture {
 #define to_nouveau_texture(x) ((struct nouveau_texture *)(x))
 
 #define texture_dirty(t) \
-   to_nouveau_texture(t)-dirty = GL_TRUE;
+   to_nouveau_texture(t)-dirty = GL_TRUE
 
 void
 nouveau_set_texbuffer(__DRIcontext *dri_ctx,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 0c29eec..e5858f8 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -85,6 +85,18 @@ vbo_deinit_array(struct nouveau_array_state *a)
a-fields = 0;
 }
 
+static int
+get_array_stride(GLcontext *ctx, const struct gl_client_array *a)
+{
+   struct nouveau_render_state *render = to_render_state(ctx);
+
+   if (render-mode == VBO  !_mesa_is_bufferobj(a-BufferObj))
+   /* Pack client buffers. */
+   return align(_mesa_sizeof_type(a-Type) * a-Size, 4);
+   else
+   return a-StrideB;
+}
+
 static void
 vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
const struct gl_client_array **arrays)
@@ -101,18 +113,10 @@ vbo_init_arrays(GLcontext *ctx, const struct 
_mesa_index_buffer *ib,
 
if (attr = 0) {
const struct gl_client_array *array = arrays[attr];
-   int stride;
-
-   if (render-mode == VBO 
-   !_mesa_is_bufferobj(array-BufferObj))
-   /* Pack client buffers. */
-   stride = align(_mesa_sizeof_type(array-Type)
-  * array-Size, 4);
-   else
-   stride = array-StrideB;
 
vbo_init_array(render-attrs[attr], attr,
-  stride, array-Size, array-Type,
+  get_array_stride(ctx, array),
+  array-Size, array-Type,
   array-BufferObj, array-Ptr,
   render-mode == IMM);
}
@@ -245,7 +249,7 @@ vbo_choose_attrs(GLcontext *ctx, const struct 
gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
 }
 
-static unsigned
+static int
 get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
@@ -258,7 +262,7 @@ get_max_client_stride(GLcontext *ctx, const struct 
gl_client_array **arrays)
const struct gl_client_array *a = arrays[attr];
 
if (!_mesa_is_bufferobj(a-BufferObj))
-   s = MAX2(a-StrideB, s);
+   s = MAX2(s, get_array_stride(ctx, a));
}
}
 
@@ -327,6 +331,7 @@ vbo_bind_vertices(GLcontext *ctx, const struct 
gl_client_array **arrays,
* array-StrideB;
 
if (a-bo

Mesa (master): dri/nouveau: Reemit the light model state when lighting goes on/off.

2010-03-21 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: c48226e81d6a070a4bbaf42e0a310a868bcbe935
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c48226e81d6a070a4bbaf42e0a310a868bcbe935

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Mar 21 11:49:46 2010 +0100

dri/nouveau: Reemit the light model state when lighting goes on/off.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index ef2cc78..7697090 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -189,6 +189,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_LIGHTING:
context_dirty(ctx, FRAG);
context_dirty(ctx, MODELVIEW);
+   context_dirty(ctx, LIGHT_MODEL);
context_dirty(ctx, LIGHT_ENABLE);
 
for (i = 0; i  MAX_LIGHTS; i++) {

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


Mesa (master): dri/nouveau: Emit dirty states on nouveau_validate_framebuffer.

2010-03-22 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: c695e80017373caf6e8d7139b8d3df2d945ccce5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c695e80017373caf6e8d7139b8d3df2d945ccce5

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar 22 14:15:52 2010 +0100

dri/nouveau: Emit dirty states on nouveau_validate_framebuffer.

Fixes broken intermediate frames when a window is being resized
(regression caused by 878eef8c4).

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index be57d48..deb7b5b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -337,6 +337,8 @@ nouveau_validate_framebuffer(GLcontext *ctx)
update_framebuffer(dri_ctx, dri_read,
   dri_ctx-dri2.read_stamp);
 
-   if (nouveau_next_dirty_state(ctx) = 0)
+   if (nouveau_next_dirty_state(ctx) = 0) {
+   nouveau_state_emit(ctx);
FIRE_RING(context_chan(ctx));
+   }
 }

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


Mesa (master): dri/nouveau: Expose EXT_framebuffer_blit.

2010-03-22 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: fe7d0e6dc81c493b9ff7163c640d75db25386675
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe7d0e6dc81c493b9ff7163c640d75db25386675

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar 22 18:21:13 2010 +0100

dri/nouveau: Expose EXT_framebuffer_blit.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |1 +
 src/mesa/drivers/dri/nouveau/nouveau_driver.c  |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index deb7b5b..42bec65 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -54,6 +54,7 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_texture_env_dot3,NULL },
{ GL_ARB_texture_mirrored_repeat, NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
+   { GL_EXT_framebuffer_blit,NULL },
{ GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
{ GL_EXT_secondary_color, GL_EXT_secondary_color_functions },
{ GL_EXT_stencil_wrap,NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 19daef1..4ec864c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -138,4 +138,5 @@ nouveau_driver_functions_init(struct dd_function_table 
*functions)
functions-DrawPixels = _mesa_meta_DrawPixels;
functions-CopyPixels = _mesa_meta_CopyPixels;
functions-Bitmap = _mesa_meta_Bitmap;
+   functions-BlitFramebuffer = _mesa_meta_BlitFramebuffer;
 }

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


Mesa (master): dri/nouveau: Fix swrast fallbacks when the read and draw buffers aren't the same.

2010-03-22 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 199fab25b7cb047c0d7ac26ee12df3b2e1369723
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=199fab25b7cb047c0d7ac26ee12df3b2e1369723

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar 22 18:25:30 2010 +0100

dri/nouveau: Fix swrast fallbacks when the read and draw buffers aren't the 
same.

---

 src/mesa/drivers/dri/nouveau/nouveau_span.c |   30 ++-
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c 
b/src/mesa/drivers/dri/nouveau/nouveau_span.c
index f1a56dd..1bfdecc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_span.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c
@@ -32,7 +32,6 @@
 #include swrast/swrast.h
 
 #define LOCAL_VARS \
-   struct gl_framebuffer *fb = ctx-DrawBuffer;\
struct nouveau_surface *s = to_nouveau_renderbuffer(rb)-surface; \
GLuint p;   \
(void)p;
@@ -45,12 +44,12 @@
 #define HW_CLIPLOOP() {
\
int minx = 0;   \
int miny = 0;   \
-   int maxx = fb-Width;   \
-   int maxy = fb-Height;
+   int maxx = rb-Width;   \
+   int maxy = rb-Height;
 
 #define HW_ENDCLIPLOOP() }
 
-#define Y_FLIP(y) (fb-Name ? (y) : rb-Height - 1 - (y))
+#define Y_FLIP(y) (rb-Name ? (y) : rb-Height - 1 - (y))
 
 /* RGB565 span functions */
 #define SPANTMP_PIXEL_FMT GL_RGB
@@ -144,17 +143,28 @@ texture_unit_map_unmap(GLcontext *ctx, struct 
gl_texture_unit *u, GLboolean map)
 }
 
 static void
-span_map_unmap(GLcontext *ctx, GLboolean map)
+framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map)
 {
int i;
 
-   for (i = 0; i  ctx-DrawBuffer-_NumColorDrawBuffers; i++)
-   renderbuffer_map_unmap(ctx-DrawBuffer-_ColorDrawBuffers[i], 
map);
+   for (i = 0; i  fb-_NumColorDrawBuffers; i++)
+   renderbuffer_map_unmap(fb-_ColorDrawBuffers[i], map);
+
+   renderbuffer_map_unmap(fb-_ColorReadBuffer, map);
+
+   if (fb-_DepthBuffer)
+   renderbuffer_map_unmap(fb-_DepthBuffer-Wrapped, map);
+}
+
+static void
+span_map_unmap(GLcontext *ctx, GLboolean map)
+{
+   int i;
 
-   renderbuffer_map_unmap(ctx-DrawBuffer-_ColorReadBuffer, map);
+   framebuffer_map_unmap(ctx-DrawBuffer, map);
 
-   if (ctx-DrawBuffer-_DepthBuffer)
-   renderbuffer_map_unmap(ctx-DrawBuffer-_DepthBuffer-Wrapped, 
map);
+   if (ctx-ReadBuffer != ctx-DrawBuffer)
+   framebuffer_map_unmap(ctx-ReadBuffer, map);
 
for (i = 0; i  ctx-Const.MaxTextureUnits; i++)
texture_unit_map_unmap(ctx, ctx-Texture.Unit[i], map);

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


Mesa (master): dri/nouveau: Plug in some mesa_meta functions instead of the swrast variants.

2010-03-22 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: fc7890dc6c1f70a4f1c4bffb0fca7ae0cde30a2e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc7890dc6c1f70a4f1c4bffb0fca7ae0cde30a2e

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar 22 14:23:40 2010 +0100

dri/nouveau: Plug in some mesa_meta functions instead of the swrast variants.

---

 src/mesa/drivers/dri/nouveau/nouveau_driver.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 1d12f43..19daef1 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -135,4 +135,7 @@ nouveau_driver_functions_init(struct dd_function_table 
*functions)
functions-Flush = nouveau_flush;
functions-Finish = nouveau_finish;
functions-Clear = nouveau_clear;
+   functions-DrawPixels = _mesa_meta_DrawPixels;
+   functions-CopyPixels = _mesa_meta_CopyPixels;
+   functions-Bitmap = _mesa_meta_Bitmap;
 }

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


Mesa (master): dri/nouveau: Rectangle texture fixes.

2010-03-22 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: fc14fb9d1a897dbcf750b8158d6cb08388a422c4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc14fb9d1a897dbcf750b8158d6cb08388a422c4

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar 22 18:10:25 2010 +0100

dri/nouveau: Rectangle texture fixes.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c   |1 +
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   73 +++-
 2 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 7697090..a57df2d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -232,6 +232,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
+   case GL_TEXTURE_RECTANGLE:
context_dirty_i(ctx, TEX_ENV, ctx-Texture.CurrentUnit);
context_dirty_i(ctx, TEX_OBJ, ctx-Texture.CurrentUnit);
break;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index e890186..dbf9a5c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -283,7 +283,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
 
-   if (!nt-surfaces[last].bo)
+   if (!teximage_fits(t, t-BaseLevel) ||
+   !teximage_fits(t, last))
return GL_FALSE;
 
if (nt-dirty) {
@@ -421,6 +422,40 @@ nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint 
level,
 }
 
 static void
+nouveau_texsubimage(GLcontext *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 *t,
+   struct gl_texture_image *ti)
+{
+   struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
+   int ret;
+
+   pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
+format, type, pixels, packing,
+glTexSubImage);
+   if (pixels) {
+   nouveau_teximage_map(ctx, ti);
+
+   ret = _mesa_texstore(ctx, 3, ti-_BaseFormat, ti-TexFormat,
+ti-Data, xoffset, yoffset, zoffset,
+s-pitch, ti-ImageOffsets,
+width, height, depth, format, type,
+pixels, packing);
+   assert(ret);
+
+   nouveau_teximage_unmap(ctx, ti);
+   _mesa_unmap_teximage_pbo(ctx, packing);
+   }
+
+   if (!to_nouveau_texture(t)-dirty)
+   validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
+ width, height, depth);
+}
+
+static void
 nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
   GLint xoffset, GLint yoffset, GLint zoffset,
   GLint width, GLint height, GLint depth,
@@ -429,15 +464,9 @@ nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, 
GLint level,
   struct gl_texture_object *t,
   struct gl_texture_image *ti)
 {
-   nouveau_teximage_map(ctx, ti);
-   _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, type, pixels,
- packing, t, ti);
-   nouveau_teximage_unmap(ctx, ti);
-
-   if (!to_nouveau_texture(t)-dirty)
-   validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
- width, height, depth);
+   nouveau_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
+   width, height, depth, format, type, pixels,
+   packing, t, ti);
 }
 
 static void
@@ -449,15 +478,9 @@ nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, 
GLint level,
   struct gl_texture_object *t,
   struct gl_texture_image *ti)
 {
-   nouveau_teximage_map(ctx, ti);
-   _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset,
- width, height, format, type, pixels,
- packing, t, ti);
-   nouveau_teximage_unmap(ctx, ti);
-
-   if (!to_nouveau_texture(t)-dirty)
-   validate_teximage(ctx, t, level, xoffset, yoffset, 0

Mesa (master): dri/nouveau: Some render to texture fixes.

2010-03-22 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bfdea90f251c1bc3cf4f8096f8c62a37b9ac78c1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfdea90f251c1bc3cf4f8096f8c62a37b9ac78c1

Author: Francisco Jerez curroje...@riseup.net
Date:   Mon Mar 22 18:28:51 2010 +0100

dri/nouveau: Some render to texture fixes.

---

 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 2ec3dc9..8be7edb 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -236,7 +236,7 @@ nouveau_render_texture(GLcontext *ctx, struct 
gl_framebuffer *fb,
/* Allocate a renderbuffer object for the texture if we
 * haven't already done so. */
if (!rb) {
-   rb = nouveau_renderbuffer_new(ctx, 0);
+   rb = nouveau_renderbuffer_new(ctx, ~0);
assert(rb);
 
rb-AllocStorage = NULL;
@@ -259,11 +259,7 @@ static void
 nouveau_finish_render_texture(GLcontext *ctx,
  struct gl_renderbuffer_attachment *att)
 {
-   struct nouveau_renderbuffer *nrb
-   = to_nouveau_renderbuffer(att-Renderbuffer);
-
texture_dirty(att-Texture);
-   nouveau_surface_ref(NULL, nrb-surface);
 }
 
 void

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


Mesa (master): dri/nouveau: Fix up software mipmap generation.

2010-08-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: e96a52e9933eea7264a42983db1428368bcb4962
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e96a52e9933eea7264a42983db1428368bcb4962

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Jul 28 18:37:24 2010 +0200

dri/nouveau: Fix up software mipmap generation.

---

 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |7 +--
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   49 
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 8be7edb..bd1273b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -220,7 +220,7 @@ get_tex_format(struct gl_texture_image *ti)
case MESA_FORMAT_RGB565:
return GL_RGB5;
default:
-   assert(0);
+   return GL_NONE;
}
 }
 
@@ -231,7 +231,6 @@ nouveau_render_texture(GLcontext *ctx, struct 
gl_framebuffer *fb,
struct gl_renderbuffer *rb = att-Renderbuffer;
struct gl_texture_image *ti =
att-Texture-Image[att-CubeMapFace][att-TextureLevel];
-   int ret;
 
/* Allocate a renderbuffer object for the texture if we
 * haven't already done so. */
@@ -244,9 +243,7 @@ nouveau_render_texture(GLcontext *ctx, struct 
gl_framebuffer *fb,
}
 
/* Update the renderbuffer fields from the texture. */
-   ret = set_renderbuffer_format(rb, get_tex_format(ti));
-   assert(ret);
-
+   set_renderbuffer_format(rb, get_tex_format(ti));
rb-Width = ti-Width;
rb-Height = ti-Height;
nouveau_surface_ref(to_nouveau_teximage(ti)-surface,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index dbf9a5c..79b6757 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -38,6 +38,7 @@
 #include main/mipmap.h
 #include main/texfetch.h
 #include main/teximage.h
+#include drivers/common/meta.h
 
 static struct gl_texture_object *
 nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target)
@@ -589,6 +590,53 @@ nouveau_texture_unmap(GLcontext *ctx, struct 
gl_texture_object *t)
}
 }
 
+static void
+store_mipmap(GLcontext *ctx, GLenum target, int first, int last,
+struct gl_texture_object *t)
+{
+   struct gl_pixelstore_attrib packing = {
+   .BufferObj = ctx-Shared-NullBufferObj,
+   .Alignment = 1
+   };
+   GLenum format = t-Image[0][first]-TexFormat;
+   unsigned base_format, type, comps;
+   int i;
+
+   base_format = _mesa_get_format_base_format(format);
+   _mesa_format_to_type_and_comps(format, type, comps);
+
+   for (i = first; i = last; i++) {
+   struct gl_texture_image *ti = t-Image[0][i];
+   void *data = ti-Data;
+
+   nouveau_teximage(ctx, 3, target, i, ti-InternalFormat,
+ti-Width, ti-Height, ti-Depth,
+ti-Border, base_format, type, data,
+packing, t, ti);
+
+   _mesa_free_texmemory(data);
+   }
+}
+
+static void
+nouveau_generate_mipmap(GLcontext *ctx, GLenum target,
+   struct gl_texture_object *t)
+{
+   if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) {
+   struct gl_texture_image *base = t-Image[0][t-BaseLevel];
+
+   nouveau_teximage_map(ctx, base);
+   _mesa_generate_mipmap(ctx, target, t);
+   nouveau_teximage_unmap(ctx, base);
+
+   store_mipmap(ctx, target, t-BaseLevel + 1,
+get_last_level(t), t);
+
+   } else {
+   _mesa_meta_GenerateMipmap(ctx, target, t);
+   }
+}
+
 void
 nouveau_texture_functions_init(struct dd_function_table *functions)
 {
@@ -607,4 +655,5 @@ nouveau_texture_functions_init(struct dd_function_table 
*functions)
functions-BindTexture = nouveau_bind_texture;
functions-MapTexture = nouveau_texture_map;
functions-UnmapTexture = nouveau_texture_unmap;
+   functions-GenerateMipmap = nouveau_generate_mipmap;
 }

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


Mesa (master): dri/nv20: Fix some PGRAPH_ERRORs seen with DATA_CHECK enabled.

2010-08-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: d03f04bfb57cb7b5537cb31f1dc798a6ba500f36
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d03f04bfb57cb7b5537cb31f1dc798a6ba500f36

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Jul 28 22:32:49 2010 +0200

dri/nv20: Fix some PGRAPH_ERRORs seen with DATA_CHECK enabled.

---

 src/mesa/drivers/dri/nouveau/nv20_state_fb.c  |5 -
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 21da4f7..95691ca 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -72,7 +72,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
fb-_ColorDrawBuffers[0])-surface;
 
rt_format |= get_rt_format(s-format);
-   zeta_pitch = rt_pitch = s-pitch;
+   rt_pitch = s-pitch;
 
nouveau_bo_markl(bctx, kelvin, NV20TCL_COLOR_OFFSET,
 s-bo, 0, bo_flags);
@@ -88,6 +88,9 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
 
nouveau_bo_markl(bctx, kelvin, NV20TCL_ZETA_OFFSET,
 s-bo, 0, bo_flags);
+   } else {
+   rt_format |= get_rt_format(MESA_FORMAT_Z24_S8);
+   zeta_pitch = rt_pitch;
}
 
BEGIN_RING(chan, kelvin, NV20TCL_RT_FORMAT, 2);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index e46118e..2d45513 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -194,7 +194,8 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit)
| nvgl_wrap_mode(t-WrapS)  0;
 
tx_filter = nvgl_filter_mode(t-MagFilter)  24
-   | nvgl_filter_mode(t-MinFilter)  16;
+   | nvgl_filter_mode(t-MinFilter)  16
+   | 2  12;
 
tx_enable = NV20TCL_TX_ENABLE_ENABLE
| log2i(t-MaxAnisotropy)  4;

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


Mesa (master): dri/nouveau: Don't try to validate uninitialized teximages.

2010-08-04 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bc578caefb29cb9d1720d51698e2cd23ee490c44
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc578caefb29cb9d1720d51698e2cd23ee490c44

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Aug  4 16:38:57 2010 +0200

dri/nouveau: Don't try to validate uninitialized teximages.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 79b6757..442f4e8 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -183,10 +183,10 @@ teximage_fits(struct gl_texture_object *t, int level)
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
struct gl_texture_image *ti = t-Image[0][level];
 
-   return ti  (t-Target == GL_TEXTURE_RECTANGLE ||
- (s-bo  s-width == ti-Width 
-  s-height == ti-Height 
-  s-format == ti-TexFormat));
+   return ti  to_nouveau_teximage(ti)-surface.bo 
+   (t-Target == GL_TEXTURE_RECTANGLE ||
+(s-bo  s-format == ti-TexFormat 
+ s-width == ti-Width  s-height == ti-Height));
 }
 
 static GLboolean

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


Mesa (master): nouveau: handle early initialization errors

2010-08-25 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: a49167c1c03dab9452165f503251e543dec2be9a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a49167c1c03dab9452165f503251e543dec2be9a

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Mon Aug 23 22:40:58 2010 +0200

nouveau: handle early initialization errors

handle very early errors in pipe_screen creation (failure of
nouveau_screen_init in nv50_screen_create)

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/gallium/drivers/nouveau/nouveau_screen.c   |3 ++-
 .../winsys/nouveau/drm/nouveau_drm_winsys.c|3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 513e5e0..ebb21a6 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -258,6 +258,7 @@ nouveau_screen_fini(struct nouveau_screen *screen)
 {
struct pipe_winsys *ws = screen-base.winsys;
nouveau_channel_free(screen-channel);
-   ws-destroy(ws);
+   if (ws)
+   ws-destroy(ws);
 }
 
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c 
b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 660dbd0..d4bf124 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -19,7 +19,8 @@ nouveau_drm_destroy_winsys(struct pipe_winsys *s)
 {
struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys-pscreen);
-   nouveau_device_close(nv_screen-device);
+   if (nv_screen)
+   nouveau_device_close(nv_screen-device);
FREE(nv_winsys);
 }
 

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


Mesa (master): dri/nv04: Add support for NV_texture_env_combine4.

2010-09-09 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 699749cfeeea7d0a17ed5f94fd5fdbbe52f4ab2b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=699749cfeeea7d0a17ed5f94fd5fdbbe52f4ab2b

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep  9 14:14:14 2010 +0200

dri/nv04: Add support for NV_texture_env_combine4.

---

 src/mesa/drivers/dri/nouveau/nv04_context.c|1 +
 src/mesa/drivers/dri/nouveau/nv04_state_frag.c |   36 +++
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 6834f7c..1d34c86 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -39,6 +39,7 @@ nv04_context_engine(GLcontext *ctx)
struct nouveau_grobj *fahrenheit;
 
if (ctx-Texture.Unit[0].EnvMode == GL_COMBINE ||
+   ctx-Texture.Unit[0].EnvMode == GL_COMBINE4_NV ||
ctx-Texture.Unit[0].EnvMode == GL_BLEND ||
ctx-Texture.Unit[0].EnvMode == GL_ADD ||
ctx-Texture.Unit[1]._ReallyEnabled ||
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index d7c86d4..bb5d7dc 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -44,6 +44,7 @@ struct combiner_state {
GLcontext *ctx;
int unit;
GLboolean alpha;
+   GLboolean premodulate;
 
/* GL state */
GLenum mode;
@@ -66,6 +67,7 @@ struct combiner_state {
(rc)-ctx = ctx;\
(rc)-unit = i; \
(rc)-alpha = __INIT_COMBINER_ALPHA_##chan; \
+   (rc)-premodulate = c-_NumArgs##chan == 4; \
(rc)-mode = c-Mode##chan; \
(rc)-source = c-Source##chan; \
(rc)-operand = c-Operand##chan;   \
@@ -79,6 +81,9 @@ static uint32_t
 get_input_source(struct combiner_state *rc, int source)
 {
switch (source) {
+   case GL_ZERO:
+   return COMBINER_SOURCE(ZERO);
+
case GL_TEXTURE:
return rc-unit ? COMBINER_SOURCE(TEXTURE1) :
COMBINER_SOURCE(TEXTURE0);
@@ -195,11 +200,24 @@ setup_combiner(struct combiner_state *rc)
break;
 
case GL_ADD:
-   INPUT_ARG(rc, 0, 0, 0);
-   INPUT_SRC(rc, 1, ZERO, INVERT);
-   INPUT_ARG(rc, 2, 1, 0);
-   INPUT_SRC(rc, 3, ZERO, INVERT);
-   UNSIGNED_OP(rc);
+   case GL_ADD_SIGNED:
+   if (rc-premodulate) {
+   INPUT_ARG(rc, 0, 0, 0);
+   INPUT_ARG(rc, 1, 1, 0);
+   INPUT_ARG(rc, 2, 2, 0);
+   INPUT_ARG(rc, 3, 3, 0);
+   } else {
+   INPUT_ARG(rc, 0, 0, 0);
+   INPUT_SRC(rc, 1, ZERO, INVERT);
+   INPUT_ARG(rc, 2, 1, 0);
+   INPUT_SRC(rc, 3, ZERO, INVERT);
+   }
+
+   if (rc-mode == GL_ADD_SIGNED)
+   SIGNED_OP(rc);
+   else
+   UNSIGNED_OP(rc);
+
break;
 
case GL_INTERPOLATE:
@@ -210,14 +228,6 @@ setup_combiner(struct combiner_state *rc)
UNSIGNED_OP(rc);
break;
 
-   case GL_ADD_SIGNED:
-   INPUT_ARG(rc, 0, 0, 0);
-   INPUT_SRC(rc, 1, ZERO, INVERT);
-   INPUT_ARG(rc, 2, 1, 0);
-   INPUT_SRC(rc, 3, ZERO, INVERT);
-   SIGNED_OP(rc);
-   break;
-
default:
assert(0);
}

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


Mesa (master): dri/nouveau: Minor cleanup.

2010-09-09 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: a76f6dc84952348261c32bcace56790e939a2902
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a76f6dc84952348261c32bcace56790e939a2902

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep  2 02:18:02 2010 +0200

dri/nouveau: Minor cleanup.

---

 src/mesa/drivers/dri/nouveau/nv20_state_tnl.c |   50 ++--
 1 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
index 62efe80..2daaae2 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
@@ -32,6 +32,28 @@
 #include nv10_driver.h
 #include nv20_driver.h
 
+#define LIGHT_MODEL_AMBIENT_R(side)\
+   ((side) ? NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R :  \
+NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R)
+#define LIGHT_AMBIENT_R(side, i)   \
+   ((side) ? NV20TCL_LIGHT_BACK_AMBIENT_R(i) : \
+NV20TCL_LIGHT_FRONT_AMBIENT_R(i))
+#define LIGHT_DIFFUSE_R(side, i)   \
+   ((side) ? NV20TCL_LIGHT_BACK_DIFFUSE_R(i) : \
+NV20TCL_LIGHT_FRONT_DIFFUSE_R(i))
+#define LIGHT_SPECULAR_R(side, i)  \
+   ((side) ? NV20TCL_LIGHT_BACK_SPECULAR_R(i) :\
+NV20TCL_LIGHT_FRONT_SPECULAR_R(i))
+#define MATERIAL_FACTOR_R(side)\
+   ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_R :  \
+NV20TCL_MATERIAL_FACTOR_FRONT_R)
+#define MATERIAL_FACTOR_A(side)\
+   ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_A :  \
+NV20TCL_MATERIAL_FACTOR_FRONT_A)
+#define MATERIAL_SHININESS(side)   \
+   ((side) ? NV20TCL_BACK_MATERIAL_SHININESS(0) :  \
+NV20TCL_FRONT_MATERIAL_SHININESS(0))
+
 void
 nv20_emit_clip_plane(GLcontext *ctx, int emit)
 {
@@ -210,10 +232,6 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
float (*mat)[4] = ctx-Light.Material.Attrib;
-   uint32_t m_scene[] = { NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R,
-  NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R };
-   uint32_t m_factor[] = { NV20TCL_MATERIAL_FACTOR_FRONT_R,
- NV20TCL_MATERIAL_FACTOR_BACK_R };
float c_scene[3], c_factor[3];
struct gl_light *l;
 
@@ -231,23 +249,21 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
ZERO_3V(c_factor);
}
 
-   BEGIN_RING(chan, kelvin, m_scene[side], 3);
+   BEGIN_RING(chan, kelvin, LIGHT_MODEL_AMBIENT_R(side), 3);
OUT_RINGp(chan, c_scene, 3);
 
if (ctx-Light.ColorMaterialEnabled) {
-   BEGIN_RING(chan, kelvin, m_factor[side], 3);
+   BEGIN_RING(chan, kelvin, MATERIAL_FACTOR_R(side), 3);
OUT_RINGp(chan, c_factor, 3);
}
 
foreach(l, ctx-Light.EnabledList) {
const int i = l - ctx-Light.Light;
-   uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_AMBIENT_R(i),
- NV20TCL_LIGHT_BACK_AMBIENT_R(i) };
float *c_light = (USE_COLOR_MATERIAL(AMBIENT, side) ?
  l-Ambient :
  l-_MatAmbient[side]);
 
-   BEGIN_RING(chan, kelvin, m_light[side], 3);
+   BEGIN_RING(chan, kelvin, LIGHT_AMBIENT_R(side, i), 3);
OUT_RINGp(chan, c_light, 3);
}
 }
@@ -259,22 +275,18 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit)
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
GLfloat (*mat)[4] = ctx-Light.Material.Attrib;
-   uint32_t m_factor[] = { NV20TCL_MATERIAL_FACTOR_FRONT_A,
-   NV20TCL_MATERIAL_FACTOR_BACK_A };
struct gl_light *l;
 
-   BEGIN_RING(chan, kelvin, m_factor[side], 1);
+   BEGIN_RING(chan, kelvin, MATERIAL_FACTOR_A(side), 1);
OUT_RINGf(chan, mat[MAT_ATTRIB_DIFFUSE(side)][3]);
 
foreach(l, ctx-Light.EnabledList) {
const int i = l - ctx-Light.Light;
-   uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_DIFFUSE_R(i),
-  NV20TCL_LIGHT_BACK_DIFFUSE_R(i) };
float *c_light = (USE_COLOR_MATERIAL(DIFFUSE, side) ?
  l-Diffuse :
  l-_MatDiffuse[side]);
 
-   BEGIN_RING(chan, kelvin, m_light[side], 3);
+   BEGIN_RING(chan, kelvin, LIGHT_DIFFUSE_R(side, i), 3);
OUT_RINGp(chan, c_light, 3);
}
 }
@@ -289,13 +301,11 @@ nv20_emit_material_specular(GLcontext *ctx, int emit)
 
foreach(l, ctx-Light.EnabledList) {
const int i = l - ctx-Light.Light

Mesa (master): dri/nouveau: Expose EXT_texture_env_combine.

2010-09-09 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: cdd5f21eacc93dfb242e59a6158d0e450a39a9b6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cdd5f21eacc93dfb242e59a6158d0e450a39a9b6

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep  9 14:07:38 2010 +0200

dri/nouveau: Expose EXT_texture_env_combine.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 287f77d..4a1534b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -58,6 +58,7 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
{ GL_EXT_secondary_color, GL_EXT_secondary_color_functions },
{ GL_EXT_stencil_wrap,NULL },
+   { GL_EXT_texture_env_combine, NULL },
{ GL_EXT_texture_lod_bias,NULL },
{ GL_NV_blend_square, NULL },
{ GL_NV_texture_env_combine4, NULL },

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


Mesa (master): dri/nv10-nv20: Add support for NV_texture_env_combine4.

2010-09-09 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 3bbad7f1084c3d6259dfa23fd60f654c949f7408
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bbad7f1084c3d6259dfa23fd60f654c949f7408

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep  9 14:14:48 2010 +0200

dri/nv10-nv20: Add support for NV_texture_env_combine4.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |1 +
 src/mesa/drivers/dri/nouveau/nv10_state_frag.c |   31 ++--
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b1d4152..287f77d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -60,6 +60,7 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_EXT_stencil_wrap,NULL },
{ GL_EXT_texture_lod_bias,NULL },
{ GL_NV_blend_square, NULL },
+   { GL_NV_texture_env_combine4, NULL },
{ GL_SGIS_generate_mipmap,NULL },
{ NULL, NULL }
 };
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index 76b95fd..ab713f9 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -63,6 +63,7 @@
 struct combiner_state {
GLcontext *ctx;
int unit;
+   GLboolean premodulate;
 
/* GL state */
GLenum mode;
@@ -82,6 +83,7 @@ struct combiner_state {
ctx-Texture.Unit[i]._CurrentCombine;   \
(rc)-ctx = ctx;\
(rc)-unit = i; \
+   (rc)-premodulate = c-_NumArgs##chan == 4; \
(rc)-mode = c-Mode##chan; \
(rc)-source = c-Source##chan; \
(rc)-operand = c-Operand##chan;   \
@@ -95,6 +97,9 @@ static uint32_t
 get_input_source(struct combiner_state *rc, int source)
 {
switch (source) {
+   case GL_ZERO:
+   return RC_IN_SOURCE(ZERO);
+
case GL_TEXTURE:
return RC_IN_SOURCE(TEXTURE0) + rc-unit;
 
@@ -228,21 +233,21 @@ setup_combiner(struct combiner_state *rc)
break;
 
case GL_ADD:
-   INPUT_ARG(rc, A, 0, 0);
-   INPUT_ONE(rc, B, 0);
-   INPUT_ARG(rc, C, 1, 0);
-   INPUT_ONE(rc, D, 0);
-
-   rc-out = RC_OUT_SUM;
-   break;
-
case GL_ADD_SIGNED:
-   INPUT_ARG(rc, A, 0, 0);
-   INPUT_ONE(rc, B, 0);
-   INPUT_ARG(rc, C, 1, 0);
-   INPUT_ONE(rc, D, 0);
+   if (rc-premodulate) {
+   INPUT_ARG(rc, A, 0, 0);
+   INPUT_ARG(rc, B, 1, 0);
+   INPUT_ARG(rc, C, 2, 0);
+   INPUT_ARG(rc, D, 3, 0);
+   } else {
+   INPUT_ARG(rc, A, 0, 0);
+   INPUT_ONE(rc, B, 0);
+   INPUT_ARG(rc, C, 1, 0);
+   INPUT_ONE(rc, D, 0);
+   }
 
-   rc-out = RC_OUT_SUM | RC_OUT_BIAS;
+   rc-out = RC_OUT_SUM |
+   (rc-mode == GL_ADD_SIGNED ? RC_OUT_BIAS : 0);
break;
 
case GL_INTERPOLATE:

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


Mesa (master): dri/nv04: Don't expose ARB_texture_env_combine/dot3.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: a27bfb991c7fa8995be4814425c0ad4992447a4b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a27bfb991c7fa8995be4814425c0ad4992447a4b

Author: Andrew Randrianasulu randrianas...@gmail.com
Date:   Tue Sep 14 20:59:44 2010 +0200

dri/nv04: Don't expose ARB_texture_env_combine/dot3.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |2 --
 src/mesa/drivers/dri/nouveau/nv10_context.c|2 ++
 src/mesa/drivers/dri/nouveau/nv20_context.c|2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 4a1534b..1e406a4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -50,8 +50,6 @@
 static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_multitexture,NULL },
{ GL_ARB_texture_env_add, NULL },
-   { GL_ARB_texture_env_combine, NULL },
-   { GL_ARB_texture_env_dot3,NULL },
{ GL_ARB_texture_mirrored_repeat, NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
{ GL_EXT_framebuffer_blit,NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index b6d1036..7f2 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -34,6 +34,8 @@
 
 static const struct dri_extension nv10_extensions[] = {
{ GL_EXT_texture_rectangle,   NULL },
+   { GL_ARB_texture_env_combine, NULL },
+   { GL_ARB_texture_env_dot3,NULL },
{ NULL, NULL }
 };
 
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 789dcaa..03cb14a 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -33,6 +33,8 @@
 
 static const struct dri_extension nv20_extensions[] = {
{ GL_EXT_texture_rectangle,   NULL },
+   { GL_ARB_texture_env_combine, NULL },
+   { GL_ARB_texture_env_dot3,NULL },
{ NULL, NULL }
 };
 

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


Mesa (master): dri/nv04: Enable eng3dm for A8/L8 textures.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: c344f27539a93e885ddcb8ceb066d481a6cd60cf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c344f27539a93e885ddcb8ceb066d481a6cd60cf

Author: Andrew Randrianasulu randrianas...@gmail.com
Date:   Tue Sep 14 04:29:52 2010 +0200

dri/nv04: Enable eng3dm for A8/L8 textures.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nv04_context.c |   20 
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1d34c86..9c32b48 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -31,6 +31,20 @@
 #include nouveau_class.h
 #include nv04_driver.h
 
+static GLboolean
+texunit_needs_combiners(struct gl_texture_unit *u)
+{
+   struct gl_texture_object *t = u-_Current;
+   struct gl_texture_image *ti = t-Image[0][t-BaseLevel];
+
+   return ti-TexFormat == MESA_FORMAT_A8 ||
+   ti-TexFormat == MESA_FORMAT_L8 ||
+   u-EnvMode == GL_COMBINE ||
+   u-EnvMode == GL_COMBINE4_NV ||
+   u-EnvMode == GL_BLEND ||
+   u-EnvMode == GL_ADD;
+}
+
 struct nouveau_grobj *
 nv04_context_engine(GLcontext *ctx)
 {
@@ -38,10 +52,8 @@ nv04_context_engine(GLcontext *ctx)
struct nouveau_hw_state *hw = to_nouveau_context(ctx)-hw;
struct nouveau_grobj *fahrenheit;
 
-   if (ctx-Texture.Unit[0].EnvMode == GL_COMBINE ||
-   ctx-Texture.Unit[0].EnvMode == GL_COMBINE4_NV ||
-   ctx-Texture.Unit[0].EnvMode == GL_BLEND ||
-   ctx-Texture.Unit[0].EnvMode == GL_ADD ||
+   if ((ctx-Texture.Unit[0]._ReallyEnabled 
+texunit_needs_combiners(ctx-Texture.Unit[0])) ||
ctx-Texture.Unit[1]._ReallyEnabled ||
ctx-Stencil.Enabled)
fahrenheit = hw-eng3dm;

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


Mesa (master): dri/nv04: Fix PGRAPH_ERRORs when running OA.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: aa317a40ced575024924ef5697fc0b96c76e3d90
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa317a40ced575024924ef5697fc0b96c76e3d90

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 00:38:58 2010 +0200

dri/nv04: Fix PGRAPH_ERRORs when running OA.

---

 src/mesa/drivers/dri/nouveau/nv04_state_fb.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
index 5e5e0c5..b9d232d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
@@ -110,7 +110,11 @@ nv04_emit_scissor(GLcontext *ctx, int emit)
OUT_RING(chan, w  16 | x);
OUT_RING(chan, h  16 | y);
 
-   /* Messing with surf3d invalidates some engine state. */
+   /* Messing with surf3d invalidates the engine state. */
+   context_dirty_i(ctx, TEX_ENV, 0);
+   context_dirty_i(ctx, TEX_ENV, 1);
+   context_dirty_i(ctx, TEX_OBJ, 0);
+   context_dirty_i(ctx, TEX_OBJ, 1);
context_dirty(ctx, CONTROL);
context_dirty(ctx, BLEND);
 }

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


Mesa (master): dri/nv04: Mipmapping fixes.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bec626ff63ad1d5c7c3e4b5b1d7a741e4f7d55ac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bec626ff63ad1d5c7c3e4b5b1d7a741e4f7d55ac

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 01:56:04 2010 +0200

dri/nv04: Mipmapping fixes.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   28 ++-
 src/mesa/drivers/dri/nouveau/nv04_state_tex.c  |8 +++---
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 442f4e8..d86f78b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -178,15 +178,21 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
 }
 
 static GLboolean
-teximage_fits(struct gl_texture_object *t, int level)
+teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level)
 {
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
struct gl_texture_image *ti = t-Image[0][level];
 
-   return ti  to_nouveau_teximage(ti)-surface.bo 
-   (t-Target == GL_TEXTURE_RECTANGLE ||
-(s-bo  s-format == ti-TexFormat 
- s-width == ti-Width  s-height == ti-Height));
+   if (!ti || !to_nouveau_teximage(ti)-surface.bo)
+   return GL_FALSE;
+
+   if (context_chipset(ctx)  0x10 
+   level == t-BaseLevel  (s-offset  0x7f))
+   return GL_FALSE;
+
+   return t-Target == GL_TEXTURE_RECTANGLE ||
+   (s-bo  s-format == ti-TexFormat 
+s-width == ti-Width  s-height == ti-Height);
 }
 
 static GLboolean
@@ -196,7 +202,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
 {
struct gl_texture_image *ti = t-Image[0][level];
 
-   if (teximage_fits(t, level)) {
+   if (teximage_fits(ctx, t, level)) {
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
@@ -284,8 +290,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
 
-   if (!teximage_fits(t, t-BaseLevel) ||
-   !teximage_fits(t, last))
+   if (!teximage_fits(ctx, t, t-BaseLevel) ||
+   !teximage_fits(ctx, t, last))
return GL_FALSE;
 
if (nt-dirty) {
@@ -308,8 +314,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
 void
 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
 {
-   if (!teximage_fits(t, t-BaseLevel) ||
-   !teximage_fits(t, get_last_level(t))) {
+   if (!teximage_fits(ctx, t, t-BaseLevel) ||
+   !teximage_fits(ctx, t, get_last_level(t))) {
texture_dirty(t);
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
@@ -371,7 +377,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, 
GLint level,
}
 
if (level == t-BaseLevel) {
-   if (!teximage_fits(t, level))
+   if (!teximage_fits(ctx, t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 6d8762b..4ac8327 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -103,7 +103,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
0, 15) + 1;
 
lod_bias = CLAMP(ctx-Texture.Unit[i].LodBias +
-t-LodBias, 0, 15);
+t-LodBias, -16, 15) * 8;
}
 
format |= get_wrap_mode(t-WrapT)  28 |
@@ -117,7 +117,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
nvgl_filter_mode(t-MagFilter)  28 |
log2i(t-MaxAnisotropy)  27 |
nvgl_filter_mode(t-MinFilter)  24 |
-   lod_bias  16;
+   (lod_bias  0xff)  16;
 
} else {
s = to_nv04_context(ctx)-dummy_texture;
@@ -134,7 +134,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
if (nv04_mtex_engine(fahrenheit)) {
nouveau_bo_markl(bctx, fahrenheit,
 NV04_MULTITEX_TRIANGLE_OFFSET(i),
-s-bo, 0, bo_flags);
+s-bo, s-offset, bo_flags);
 
nouveau_bo_mark(bctx, fahrenheit,
NV04_MULTITEX_TRIANGLE_FORMAT(i),
@@ -149,7 +149,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
} else

Mesa (master): dri/nv04: Align SIFM transfer dimensions.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 0a6cfa1668af7c5541c9d56436776514a6c493d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a6cfa1668af7c5541c9d56436776514a6c493d9

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 06:09:21 2010 +0200

dri/nv04: Align SIFM transfer dimensions.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c 
b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index e3febf7..9e7dcf0 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -255,7 +255,7 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
 
BEGIN_RING(chan, sifm,
   NV03_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
-   OUT_RING(chan, sub_h  16 | sub_w);
+   OUT_RING(chan, align(sub_h, 2)  16 | align(sub_w, 2));
OUT_RING(chan, src-pitch  |
 
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
 
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);

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


Mesa (master): dri/nv04: Fix up color mask.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 7b06fdbd3319aae394e66f3a87de9561295bb049
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b06fdbd3319aae394e66f3a87de9561295bb049

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:15:05 2010 +0200

dri/nv04: Fix up color mask.

---

 src/mesa/drivers/dri/nouveau/nv04_context.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 9c32b48..1003afb 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -55,7 +55,11 @@ nv04_context_engine(GLcontext *ctx)
if ((ctx-Texture.Unit[0]._ReallyEnabled 
 texunit_needs_combiners(ctx-Texture.Unit[0])) ||
ctx-Texture.Unit[1]._ReallyEnabled ||
-   ctx-Stencil.Enabled)
+   ctx-Stencil.Enabled ||
+   !(ctx-Color.ColorMask[0][RCOMP] 
+ ctx-Color.ColorMask[0][GCOMP] 
+ ctx-Color.ColorMask[0][BCOMP] 
+ ctx-Color.ColorMask[0][ACOMP]))
fahrenheit = hw-eng3dm;
else
fahrenheit = hw-eng3d;

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


Mesa (master): dri/nv04: Fix provoking vertex.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 8f1051dca2d2ea4a4d38f251a5f98fc2a9d097c9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f1051dca2d2ea4a4d38f251a5f98fc2a9d097c9

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:16:19 2010 +0200

dri/nv04: Fix provoking vertex.

---

 src/mesa/drivers/dri/nouveau/nv04_render.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c 
b/src/mesa/drivers/dri/nouveau/nv04_render.c
index b5943d9..56e396d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -162,7 +162,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint 
v3)
OUT_VERTEX(v1);
OUT_VERTEX(v2);
OUT_VERTEX(v3);
-   END_PRIMITIVE(0x210);
+   END_PRIMITIVE(0x102);
 }
 
 static void
@@ -173,7 +173,7 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, 
GLuint v4)
OUT_VERTEX(v2);
OUT_VERTEX(v3);
OUT_VERTEX(v4);
-   END_PRIMITIVE(0x320210);
+   END_PRIMITIVE(0x213103);
 }
 
 /* TnL initialization. */

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


Mesa (master): dri/nv04: Fix maximum texture size.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 286d8f2877f75d9ad82c55d1fa494f46a4a8f422
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=286d8f2877f75d9ad82c55d1fa494f46a4a8f422

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:15:38 2010 +0200

dri/nv04: Fix maximum texture size.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1003afb..78703b0 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -188,6 +188,7 @@ nv04_context_create(struct nouveau_screen *screen, const 
GLvisual *visual,
hw-chan-flush_notify = nv04_channel_flush_notify;
 
/* GL constants. */
+   ctx-Const.MaxTextureLevels = 11;
ctx-Const.MaxTextureCoordUnits = NV04_TEXTURE_UNITS;
ctx-Const.MaxTextureImageUnits = NV04_TEXTURE_UNITS;
ctx-Const.MaxTextureUnits = NV04_TEXTURE_UNITS;

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


Mesa (master): dri/nouveau: Update nouveau_class.h.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: aad06c852491d9a83e74625220923da1626896ed
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aad06c852491d9a83e74625220923da1626896ed

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Sep 14 21:22:45 2010 +0200

dri/nouveau: Update nouveau_class.h.

---

 src/mesa/drivers/dri/nouveau/nouveau_class.h |   40 +-
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h 
b/src/mesa/drivers/dri/nouveau/nouveau_class.h
index 32ee815..5cb13ac 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_class.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h
@@ -2340,12 +2340,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define   NV10TCL_RC_OUT_ALPHA_BIAS
(1  15)
 #defineNV10TCL_RC_OUT_ALPHA_BIAS_NONE  
0x
 #defineNV10TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 
0x8000
-#define   NV10TCL_RC_OUT_ALPHA_SCALE_SHIFT 
17
-#define   NV10TCL_RC_OUT_ALPHA_SCALE_MASK  
0x
+#define   NV10TCL_RC_OUT_ALPHA_SCALE_SHIFT 
16
+#define   NV10TCL_RC_OUT_ALPHA_SCALE_MASK  
0x0003
 #defineNV10TCL_RC_OUT_ALPHA_SCALE_NONE 
0x
-#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 
0x0002
-#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR
0x0004
-#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF
0x0006
+#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 
0x0001
+#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR
0x0002
+#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF
0x0003
 #define  NV10TCL_RC_OUT_RGB(x) 
(0x0280+((x)*4))
 #define  NV10TCL_RC_OUT_RGB__SIZE  
0x0002
 #define   NV10TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT   
0
@@ -2402,12 +2402,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define   NV10TCL_RC_OUT_RGB_BIAS  
(1  15)
 #defineNV10TCL_RC_OUT_RGB_BIAS_NONE
0x
 #defineNV10TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF   
0x8000
-#define   NV10TCL_RC_OUT_RGB_SCALE_SHIFT   
17
-#define   NV10TCL_RC_OUT_RGB_SCALE_MASK
0x
+#define   NV10TCL_RC_OUT_RGB_SCALE_SHIFT   
16
+#define   NV10TCL_RC_OUT_RGB_SCALE_MASK
0x0003
 #defineNV10TCL_RC_OUT_RGB_SCALE_NONE   
0x
-#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO   
0x0002
-#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR  
0x0004
-#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF  
0x0006
+#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO   
0x0001
+#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR  
0x0002
+#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF  
0x0003
 #define   NV10TCL_RC_OUT_RGB_OPERATION_SHIFT   
27
 #define   NV10TCL_RC_OUT_RGB_OPERATION_MASK
0x3800
 #define  NV10TCL_RC_FINAL0 
0x0288
@@ -4148,12 +4148,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define   NV20TCL_RC_OUT_ALPHA_BIAS
(1  15)
 #defineNV20TCL_RC_OUT_ALPHA_BIAS_NONE  
0x
 #defineNV20TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 
0x8000
-#define   NV20TCL_RC_OUT_ALPHA_SCALE_SHIFT 
17
-#define   NV20TCL_RC_OUT_ALPHA_SCALE_MASK  
0x
+#define   NV20TCL_RC_OUT_ALPHA_SCALE_SHIFT 
16
+#define   NV20TCL_RC_OUT_ALPHA_SCALE_MASK

Mesa (master): dri/nouveau: Add some more extensions.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: cbe0dd0f5a5468f821fe39b855e83ae19f28aa7f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cbe0dd0f5a5468f821fe39b855e83ae19f28aa7f

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:19:08 2010 +0200

dri/nouveau: Add some more extensions.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |2 ++
 src/mesa/drivers/dri/nouveau/nv10_context.c|1 +
 src/mesa/drivers/dri/nouveau/nv20_context.c|1 +
 3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 1e406a4..c7e5789 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -54,9 +54,11 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
{ GL_EXT_framebuffer_blit,NULL },
{ GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_EXT_packed_depth_stencil, NULL},
{ GL_EXT_secondary_color, GL_EXT_secondary_color_functions },
{ GL_EXT_stencil_wrap,NULL },
{ GL_EXT_texture_env_combine, NULL },
+   { GL_EXT_texture_filter_anisotropic, NULL },
{ GL_EXT_texture_lod_bias,NULL },
{ GL_NV_blend_square, NULL },
{ GL_NV_texture_env_combine4, NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 7f2..08be2a2 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -33,6 +33,7 @@
 #include nv10_driver.h
 
 static const struct dri_extension nv10_extensions[] = {
+   { GL_ARB_texture_env_crossbar, NULL },
{ GL_EXT_texture_rectangle,   NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 03cb14a..b9c221e 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -32,6 +32,7 @@
 #include nv20_driver.h
 
 static const struct dri_extension nv20_extensions[] = {
+   { GL_ARB_texture_env_crossbar, NULL },
{ GL_EXT_texture_rectangle,   NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },

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


Mesa (master): dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 39658f32eaf1acc9603a9a5a2242fba8fd49e08f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=39658f32eaf1acc9603a9a5a2242fba8fd49e08f

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 06:05:53 2010 +0200

dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 32d8f2d..a02a052 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -67,6 +67,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum 
internalFormat)
rb-DataType = GL_UNSIGNED_SHORT;
s-cpp = 2;
break;
+   case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24:
case GL_STENCIL_INDEX8_EXT:
case GL_DEPTH24_STENCIL8_EXT:

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


Mesa (master): dri/nouveau: Don't request a fake front unnecessarily.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bfc7518ab993b006dffaad5f605137e94ff9d7bc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfc7518ab993b006dffaad5f605137e94ff9d7bc

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Sep 14 21:29:44 2010 +0200

dri/nouveau: Don't request a fake front unnecessarily.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   37 ++--
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |1 +
 src/mesa/drivers/dri/nouveau/nouveau_fbo.h |1 +
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_state.c   |8 +
 5 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index c7e5789..244733e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -183,6 +183,7 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
GLcontext *ctx = dri_ctx-driverPrivate;
__DRIscreen *screen = dri_ctx-driScreenPriv;
struct gl_framebuffer *fb = draw-driverPrivate;
+   struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
unsigned int attachments[10];
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
@@ -191,7 +192,8 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
return;
draw-lastStamp = *draw-pStamp;
 
-   attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+   if (nfb-need_front)
+   attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (fb-Visual.doubleBufferMode)
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
if (fb-Visual.haveDepthBuffer  fb-Visual.haveStencilBuffer)
@@ -327,6 +329,25 @@ nouveau_fallback(GLcontext *ctx, enum nouveau_fallback 
mode)
FIRE_RING(context_chan(ctx));
 }
 
+static void
+validate_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
+int *stamp)
+{
+   struct gl_framebuffer *fb = draw-driverPrivate;
+   struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
+   GLboolean need_front =
+   (fb-_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT ||
+fb-_ColorReadBufferIndex == BUFFER_FRONT_LEFT);
+
+   if (nfb-need_front != need_front) {
+   nfb-need_front = need_front;
+   dri2InvalidateDrawable(draw);
+   }
+
+   if (*draw-pStamp != *stamp)
+   update_framebuffer(dri_ctx, draw, stamp);
+}
+
 void
 nouveau_validate_framebuffer(GLcontext *ctx)
 {
@@ -334,15 +355,13 @@ nouveau_validate_framebuffer(GLcontext *ctx)
__DRIdrawable *dri_draw = dri_ctx-driDrawablePriv;
__DRIdrawable *dri_read = dri_ctx-driReadablePriv;
 
-   if (ctx-DrawBuffer-Name == 0 
-   dri_ctx-dri2.draw_stamp != *dri_draw-pStamp)
-   update_framebuffer(dri_ctx, dri_draw,
-  dri_ctx-dri2.draw_stamp);
+   if (ctx-DrawBuffer-Name == 0)
+   validate_framebuffer(dri_ctx, dri_draw,
+dri_ctx-dri2.draw_stamp);
 
-   if (ctx-ReadBuffer-Name == 0  dri_draw != dri_read 
-   dri_ctx-dri2.read_stamp != *dri_read-pStamp)
-   update_framebuffer(dri_ctx, dri_read,
-  dri_ctx-dri2.read_stamp);
+   if (ctx-ReadBuffer-Name == 0)
+   validate_framebuffer(dri_ctx, dri_read,
+dri_ctx-dri2.read_stamp);
 
if (nouveau_next_dirty_state(ctx) = 0) {
nouveau_state_emit(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index a02a052..f0caf4c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -189,6 +189,7 @@ nouveau_framebuffer_dri_new(const GLvisual *visual)
return NULL;
 
_mesa_initialize_window_framebuffer(nfb-base, visual);
+   nfb-need_front = !visual-doubleBufferMode;
 
return nfb-base;
 }
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
index 5ae984b..0fe6c08 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
@@ -30,6 +30,7 @@
 struct nouveau_framebuffer {
struct gl_framebuffer base;
struct nouveau_bo *lma_bo;
+   GLboolean need_front;
 };
 #define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x))
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 78987f6..4330c8d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -156,7 +156,7 @@ nouveau_create_buffer(__DRIscreen *dri_screen,
  const __GLcontextModes

Mesa (master): dri/nouveau: Don't reemit the BO state in nouveau_state_emit ().

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: d4d81ed02e79ef39ab0e06ebc18e1f5b79e2c92d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4d81ed02e79ef39ab0e06ebc18e1f5b79e2c92d

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 16:44:06 2010 +0200

dri/nouveau: Don't reemit the BO state in nouveau_state_emit().

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c |2 --
 src/mesa/drivers/dri/nouveau/nv04_context.c  |6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 691e51e..01bcbc4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -459,8 +459,6 @@ nouveau_state_emit(GLcontext *ctx)
}
 
BITSET_ZERO(nctx-dirty);
-
-   nouveau_bo_state_emit(ctx);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 78703b0..94422f5 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -93,15 +93,15 @@ nv04_channel_flush_notify(struct nouveau_channel *chan)
GLcontext *ctx = nctx-base;
 
if (nctx-fallback  SWRAST) {
-   /* Flushing seems to clobber the engine context. */
+   nouveau_bo_state_emit(ctx);
+
+   /* Reemit the engine state. */
context_emit(ctx, TEX_OBJ0);
context_emit(ctx, TEX_OBJ1);
context_emit(ctx, TEX_ENV0);
context_emit(ctx, TEX_ENV1);
context_emit(ctx, CONTROL);
context_emit(ctx, BLEND);
-
-   nouveau_bo_state_emit(ctx);
}
 }
 

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


Mesa (master): dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: db94a2a5be8e9a8e4de088771874b14b79438299
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=db94a2a5be8e9a8e4de088771874b14b79438299

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 18:03:59 2010 +0200

dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   24 
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 244733e..eff1016 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -212,7 +212,6 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
for (i = 0; i  count; i++) {
struct gl_renderbuffer *rb;
struct nouveau_surface *s;
-   uint32_t old_handle;
int index;
 
switch (buffers[i].attachment) {
@@ -242,19 +241,10 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
s-pitch = buffers[i].pitch;
s-cpp = buffers[i].cpp;
 
-   /* Don't bother to reopen the bo if it happens to be
-* the same. */
-   if (s-bo) {
-   ret = nouveau_bo_handle_get(s-bo, old_handle);
-   assert(!ret);
-   }
-
-   if (!s-bo || old_handle != buffers[i].name) {
-   nouveau_bo_ref(NULL, s-bo);
-   ret = nouveau_bo_handle_ref(context_dev(ctx),
-   buffers[i].name, s-bo);
-   assert(!ret);
-   }
+   nouveau_bo_ref(NULL, s-bo);
+   ret = nouveau_bo_handle_ref(context_dev(ctx),
+   buffers[i].name, s-bo);
+   assert(!ret);
}
 
_mesa_resize_framebuffer(NULL, fb, draw-w, draw-h);
@@ -293,13 +283,15 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, 
__DRIdrawable *dri_draw,
update_framebuffer(dri_ctx, dri_read,
   dri_ctx-dri2.read_stamp);
 
+   /* Clean up references to the old framebuffer objects. */
+   context_bctx(ctx, FRAMEBUFFER);
+   FIRE_RING(context_chan(ctx));
+
/* Pass it down to mesa. */
_mesa_make_current(ctx, dri_draw-driverPrivate,
   dri_read-driverPrivate);
_mesa_update_state(ctx);
 
-   FIRE_RING(context_chan(ctx));
-
} else {
_mesa_make_current(NULL, NULL, NULL);
}

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


Mesa (master): dri/nv10: Fix the CLAMP texture wrap mode.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 82c4af33b0d860e27f4c2d3b3d2401c7549de355
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82c4af33b0d860e27f4c2d3b3d2401c7549de355

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 05:29:48 2010 +0200

dri/nv10: Fix the CLAMP texture wrap mode.

---

 src/mesa/drivers/dri/nouveau/nouveau_gldefs.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h 
b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
index fbeed3b..46ec14e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
@@ -228,12 +228,11 @@ nvgl_wrap_mode(unsigned wrap)
return 0x1;
case GL_MIRRORED_REPEAT:
return 0x2;
+   case GL_CLAMP:
case GL_CLAMP_TO_EDGE:
return 0x3;
case GL_CLAMP_TO_BORDER:
return 0x4;
-   case GL_CLAMP:
-   return 0x5;
default:
assert(0);
}

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


Mesa (master): dri/nv04: Use nvgl_wrap_mode().

2010-09-20 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 72e5fd5c02cb745d95f11573e7119ad1ba4bc1a8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72e5fd5c02cb745d95f11573e7119ad1ba4bc1a8

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 15:03:14 2010 +0200

dri/nv04: Use nvgl_wrap_mode().

---

 src/mesa/drivers/dri/nouveau/nv04_state_tex.c |   22 ++
 1 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 4ac8327..b720089 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -55,24 +55,6 @@ get_tex_format(struct gl_texture_image *ti)
}
 }
 
-static inline unsigned
-get_wrap_mode(unsigned wrap)
-{
-   switch (wrap) {
-   case GL_REPEAT:
-   return 0x1;
-   case GL_MIRRORED_REPEAT:
-   return 0x2;
-   case GL_CLAMP:
-   case GL_CLAMP_TO_EDGE:
-   return 0x3;
-   case GL_CLAMP_TO_BORDER:
-   return 0x4;
-   default:
-   assert(0);
-   }
-}
-
 void
 nv04_emit_tex_obj(GLcontext *ctx, int emit)
 {
@@ -106,8 +88,8 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
 t-LodBias, -16, 15) * 8;
}
 
-   format |= get_wrap_mode(t-WrapT)  28 |
-   get_wrap_mode(t-WrapS)  24 |
+   format |= nvgl_wrap_mode(t-WrapT)  28 |
+   nvgl_wrap_mode(t-WrapS)  24 |
ti-HeightLog2  20 |
ti-WidthLog2  16 |
lod_max  12 |

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


Mesa (master): dri/nouveau: Remove unnecessary assertion.

2010-09-20 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 13c246bceafd356959daff3d9872ffb0549c531a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=13c246bceafd356959daff3d9872ffb0549c531a

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 15:25:03 2010 +0200

dri/nouveau: Remove unnecessary assertion.

---

 src/mesa/drivers/dri/nouveau/nv04_surface.c |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c 
b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index 9e7dcf0..ce01036 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -214,11 +214,6 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
assert(_mesa_is_pow_two(dst-width) 
   _mesa_is_pow_two(dst-height));
 
-/* If area is too large to copy in one shot we must copy it in
-* POT chunks to meet alignment requirements */
-   assert(sub_w == w || _mesa_is_pow_two(w));
-   assert(sub_h == h || _mesa_is_pow_two(h));
-
nouveau_bo_marko(bctx, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE,
 src-bo, bo_flags | NOUVEAU_BO_RD);
nouveau_bo_marko(bctx, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE,

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


Mesa (master): dri/nouveau: Cleanup more references to old FBOs and VBOs.

2010-09-20 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 22c83ac47a50ed1fdab59476886a7e56910a653a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=22c83ac47a50ed1fdab59476886a7e56910a653a

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 16:35:49 2010 +0200

dri/nouveau: Cleanup more references to old FBOs and VBOs.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |7 +++
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c   |1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index eff1016..0fecdee 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -262,7 +262,10 @@ update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable 
*draw,
nouveau_update_renderbuffers(dri_ctx, draw);
_mesa_resize_framebuffer(ctx, fb, draw-w, draw-h);
 
+   /* Clean up references to the old framebuffer objects. */
context_dirty(ctx, FRAMEBUFFER);
+   context_bctx(ctx, FRAMEBUFFER);
+   FIRE_RING(context_chan(ctx));
 }
 
 GLboolean
@@ -283,10 +286,6 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, 
__DRIdrawable *dri_draw,
update_framebuffer(dri_ctx, dri_read,
   dri_ctx-dri2.read_stamp);
 
-   /* Clean up references to the old framebuffer objects. */
-   context_bctx(ctx, FRAMEBUFFER);
-   FIRE_RING(context_chan(ctx));
-
/* Pass it down to mesa. */
_mesa_make_current(ctx, dri_draw-driverPrivate,
   dri_read-driverPrivate);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index e5858f8..e4415cb 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -143,6 +143,7 @@ vbo_deinit_arrays(GLcontext *ctx, const struct 
_mesa_index_buffer *ib,
}
 
render-attr_count = 0;
+   context_bctx(ctx, VERTEX);
 }
 
 /* Make some rendering decisions from the GL context. */

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


Mesa (master): dri/nv10-nv20: Fix texturing in some cases after a base level change.

2010-09-20 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 98add55fffc29e0c40859fd5e9cec47fa1e352f5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98add55fffc29e0c40859fd5e9cec47fa1e352f5

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 20:56:48 2010 +0200

dri/nv10-nv20: Fix texturing in some cases after a base level change.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   17 -
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c  |2 +-
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c  |2 +-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index d86f78b..b2f6faf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -178,7 +178,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
 }
 
 static GLboolean
-teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level)
+teximage_fits(struct gl_texture_object *t, int level)
 {
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
struct gl_texture_image *ti = t-Image[0][level];
@@ -186,8 +186,7 @@ teximage_fits(GLcontext *ctx, struct gl_texture_object *t, 
int level)
if (!ti || !to_nouveau_teximage(ti)-surface.bo)
return GL_FALSE;
 
-   if (context_chipset(ctx)  0x10 
-   level == t-BaseLevel  (s-offset  0x7f))
+   if (level == t-BaseLevel  (s-offset  0x7f))
return GL_FALSE;
 
return t-Target == GL_TEXTURE_RECTANGLE ||
@@ -202,7 +201,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
 {
struct gl_texture_image *ti = t-Image[0][level];
 
-   if (teximage_fits(ctx, t, level)) {
+   if (teximage_fits(t, level)) {
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
@@ -290,8 +289,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
 
-   if (!teximage_fits(ctx, t, t-BaseLevel) ||
-   !teximage_fits(ctx, t, last))
+   if (!teximage_fits(t, t-BaseLevel) ||
+   !teximage_fits(t, last))
return GL_FALSE;
 
if (nt-dirty) {
@@ -314,8 +313,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
 void
 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
 {
-   if (!teximage_fits(ctx, t, t-BaseLevel) ||
-   !teximage_fits(ctx, t, get_last_level(t))) {
+   if (!teximage_fits(t, t-BaseLevel) ||
+   !teximage_fits(t, get_last_level(t))) {
texture_dirty(t);
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
@@ -377,7 +376,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, 
GLint level,
}
 
if (level == t-BaseLevel) {
-   if (!teximage_fits(ctx, t, level))
+   if (!teximage_fits(t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 6dedb18..6961ccb 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -225,7 +225,7 @@ nv10_emit_tex_obj(GLcontext *ctx, int emit)
bo_flags | NOUVEAU_BO_OR);
 
nouveau_bo_markl(bctx, celsius, NV10TCL_TX_OFFSET(i),
-s-bo, 0, bo_flags);
+s-bo, s-offset, bo_flags);
 
BEGIN_RING(chan, celsius, NV10TCL_TX_FILTER(i), 1);
OUT_RING(chan, tx_filter);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 2d45513..ea6b9b9 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -236,7 +236,7 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit)
bo_flags | NOUVEAU_BO_OR);
 
nouveau_bo_markl(bctx, kelvin, NV20TCL_TX_OFFSET(i),
-s-bo, 0, bo_flags);
+s-bo, s-offset, bo_flags);
 
BEGIN_RING(chan, kelvin, NV20TCL_TX_WRAP(i), 1);
OUT_RING(chan, tx_wrap);

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


Mesa (master): dri/nouveau: Fix software mipmap generation on 1x1 textures.

2010-09-20 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bf8f24c1c84ab39207301ae5d298850d72e11876
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf8f24c1c84ab39207301ae5d298850d72e11876

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 20:58:43 2010 +0200

dri/nouveau: Fix software mipmap generation on 1x1 textures.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index b2f6faf..14c7b5f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -603,7 +603,7 @@ store_mipmap(GLcontext *ctx, GLenum target, int first, int 
last,
.BufferObj = ctx-Shared-NullBufferObj,
.Alignment = 1
};
-   GLenum format = t-Image[0][first]-TexFormat;
+   GLenum format = t-Image[0][t-BaseLevel]-TexFormat;
unsigned base_format, type, comps;
int i;
 

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


Mesa (master): nv50: Dehexify and bring up to date with new method defines.

2009-12-28 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: c84cc09d41a83caa96eca84c73284024d8d63024
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c84cc09d41a83caa96eca84c73284024d8d63024

Author: Marcin Koƛcielnicki koria...@0x04.net
Date:   Mon Dec 28 16:23:40 2009 +

nv50: Dehexify and bring up to date with new method defines.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/gallium/drivers/nv50/nv50_program.c|4 +-
 src/gallium/drivers/nv50/nv50_query.c  |4 +-
 src/gallium/drivers/nv50/nv50_screen.c |   44 +++
 src/gallium/drivers/nv50/nv50_state.c  |   13 +++
 src/gallium/drivers/nv50/nv50_state_validate.c |   20 +-
 src/gallium/drivers/nv50/nv50_surface.c|6 ++--
 src/gallium/drivers/nv50/nv50_transfer.c   |   12 +++---
 src/gallium/drivers/nv50/nv50_vbo.c|   38 ++--
 8 files changed, 69 insertions(+), 72 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c 
b/src/gallium/drivers/nv50/nv50_program.c
index a101ac0..b9910b4 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -3498,7 +3498,7 @@ nv50_fragprog_validate(struct nv50_context *nv50)
so_data  (so, p-cfg.high_temp);
so_method(so, tesla, NV50TCL_FP_RESULT_COUNT, 1);
so_data  (so, p-cfg.high_result);
-   so_method(so, tesla, NV50TCL_FP_CTRL_UNK19A8, 1);
+   so_method(so, tesla, NV50TCL_FP_CONTROL, 1);
so_data  (so, p-cfg.regs[2]);
so_method(so, tesla, NV50TCL_FP_CTRL_UNK196C, 1);
so_data  (so, p-cfg.regs[3]);
@@ -3670,7 +3670,7 @@ nv50_linkage_validate(struct nv50_context *nv50)
so_method(so, tesla, NV50TCL_FP_INTERPOLANT_CTRL, 1);
so_data  (so, reg[4]);
 
-   so_method(so, tesla, 0x1540, 4);
+   so_method(so, tesla, NV50TCL_NOPERSPECTIVE_BITMAP(0), 4);
so_datap (so, lin, 4);
 
if (nv50-rasterizer-pipe.point_sprite) {
diff --git a/src/gallium/drivers/nv50/nv50_query.c 
b/src/gallium/drivers/nv50/nv50_query.c
index 268c982..5d9e182 100644
--- a/src/gallium/drivers/nv50/nv50_query.c
+++ b/src/gallium/drivers/nv50/nv50_query.c
@@ -77,9 +77,9 @@ nv50_query_begin(struct pipe_context *pipe, struct pipe_query 
*pq)
struct nouveau_grobj *tesla = nv50-screen-tesla;
struct nv50_query *q = nv50_query(pq);
 
-   BEGIN_RING(chan, tesla, 0x1530, 1);
+   BEGIN_RING(chan, tesla, NV50TCL_SAMPLECNT_RESET, 1);
OUT_RING  (chan, 1);
-   BEGIN_RING(chan, tesla, 0x1514, 1);
+   BEGIN_RING(chan, tesla, NV50TCL_SAMPLECNT_ENABLE, 1);
OUT_RING  (chan, 1);
 
q-ready = FALSE;
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 5a1efd3..15e4b6e 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -231,8 +231,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
break;
case 0x80:
case 0x90:
-   /* this stupid name should be corrected. */
-   tesla_class = NV54TCL;
+   tesla_class = NV84TCL;
break;
case 0xa0:
switch (chipset) {
@@ -242,7 +241,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
tesla_class = NVA0TCL;
break;
default:
-   tesla_class = 0x8597;
+   tesla_class = NVA8TCL;
break;
}
break;
@@ -287,7 +286,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
so_data  (so, chan-vram-handle);
so_method(so, screen-eng2d, NV50_2D_OPERATION, 1);
so_data  (so, NV50_2D_OPERATION_SRCCOPY);
-   so_method(so, screen-eng2d, 0x0290, 1);
+   so_method(so, screen-eng2d, NV50_2D_CLIP_ENABLE, 1);
so_data  (so, 0);
so_method(so, screen-eng2d, 0x0888, 1);
so_data  (so, 1);
@@ -297,34 +296,33 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
/* Static tesla init */
so = so_new(256, 20);
 
-   so_method(so, screen-tesla, 0x1558, 1);
-   so_data  (so, 1);
+   so_method(so, screen-tesla, NV50TCL_COND_MODE, 1);
+   so_data  (so, NV50TCL_COND_MODE_ALWAYS);
so_method(so, screen-tesla, NV50TCL_DMA_NOTIFY, 1);
so_data  (so, screen-sync-handle);
-   so_method(so, screen-tesla, NV50TCL_DMA_UNK0(0),
-NV50TCL_DMA_UNK0__SIZE);
-   for (i = 0; i  NV50TCL_DMA_UNK0__SIZE; i++)
+   so_method(so, screen-tesla, NV50TCL_DMA_ZETA, 11);
+   for (i = 0; i  11; i++)
so_data(so, chan-vram-handle);
-   so_method(so, screen-tesla, NV50TCL_DMA_UNK1(0),
-NV50TCL_DMA_UNK1__SIZE);
-   for (i = 0; i  NV50TCL_DMA_UNK1__SIZE

Mesa (master): nv04: Fix build after the latest nouveau_class.h changes.

2009-12-28 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 49a0f291aef5f601f172cf6f41fd83d6c342bb8a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=49a0f291aef5f601f172cf6f41fd83d6c342bb8a

Author: Francisco Jerez curroje...@riseup.net
Date:   Sat Dec 26 17:26:49 2009 +0100

nv04: Fix build after the latest nouveau_class.h changes.

---

 src/gallium/drivers/nv04/nv04_context.c|   18 
 src/gallium/drivers/nv04/nv04_fragtex.c|   16 
 src/gallium/drivers/nv04/nv04_prim_vbuf.c  |   16 
 src/gallium/drivers/nv04/nv04_screen.c |4 +-
 src/gallium/drivers/nv04/nv04_state.c  |   60 ++--
 src/gallium/drivers/nv04/nv04_state_emit.c |   10 ++--
 6 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/src/gallium/drivers/nv04/nv04_context.c 
b/src/gallium/drivers/nv04/nv04_context.c
index 4b33636..770733a 100644
--- a/src/gallium/drivers/nv04/nv04_context.c
+++ b/src/gallium/drivers/nv04/nv04_context.c
@@ -31,26 +31,26 @@ static boolean
 nv04_init_hwctx(struct nv04_context *nv04)
 {
// requires a valid handle
-// BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_NOTIFY, 1);
+// BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_NOTIFY, 1);
 // OUT_RING(0);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_NOP, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_NOP, 1);
OUT_RING(0);
 
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_CONTROL, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_CONTROL, 1);
OUT_RING(0x40182800);
 // OUT_RING(120/*no cull*/);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_BLEND, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_BLEND, 1);
 // OUT_RING(0x24|(16)|(18));
OUT_RING(0x120001a4);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_FORMAT, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_FORMAT, 1);
OUT_RING(0x332213a1);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_FILTER, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_FILTER, 1);
OUT_RING(0x11001010);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_COLORKEY, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_COLORKEY, 1);
OUT_RING(0x0);
-// BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_OFFSET, 1);
+// BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_OFFSET, 1);
 // OUT_RING(SCREEN_OFFSET);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_FOGCOLOR, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_FOGCOLOR, 1);
OUT_RING(0xff00);
 
 
diff --git a/src/gallium/drivers/nv04/nv04_fragtex.c 
b/src/gallium/drivers/nv04/nv04_fragtex.c
index 0cce71a..c152b52 100644
--- a/src/gallium/drivers/nv04/nv04_fragtex.c
+++ b/src/gallium/drivers/nv04/nv04_fragtex.c
@@ -4,7 +4,7 @@
 #define _(m,tf)
\
 {  
\
   PIPE_FORMAT_##m, 
\
-  NV04_DX5_TEXTURED_TRIANGLE_FORMAT_COLOR_##tf,
   \
+  NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_##tf,
   \
 }
 
 struct nv04_texture_format {
@@ -53,14 +53,14 @@ nv04_fragtex_build(struct nv04_context *nv04, int unit)
return;
}
 
-   nv04-fragtex.format = 
NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_CORNER 
-   | NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CORNER
+   nv04-fragtex.format = NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_CORNER
+   | NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CORNER
| nv04_fragtex_format(pt-format)
-   | ( (pt-last_level + 1)  
NV04_DX5_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT )
-   | ( log2i(pt-width0)  
NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT )
-   | ( log2i(pt-height0)  
NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT )
-   | NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_EDGE
-   | NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_EDGE
+   | ( (pt-last_level + 1)  
NV04_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT )
+   | ( log2i(pt-width0)  
NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT )
+   | ( log2i(pt-height0)  
NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT )
+   | NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_EDGE
+   | NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_EDGE
;
 }
 
diff --git a/src/gallium/drivers/nv04/nv04_prim_vbuf.c 
b/src/gallium/drivers/nv04/nv04_prim_vbuf.c
index f645823..25395ed 100644
--- a/src/gallium/drivers/nv04/nv04_prim_vbuf.c
+++ b/src/gallium/drivers/nv04/nv04_prim_vbuf.c
@@ -93,7 +93,7 @@ nv04_vbuf_render_set_primitive( struct vbuf_render *render,
 
 static INLINE

Mesa (master): nouveau: Fix glTexSubImage on swizzled surfaces on =NV40

2009-12-30 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 9656177bc0fac5785d01900a768c2855bdc04b5a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9656177bc0fac5785d01900a768c2855bdc04b5a

Author: Luca Barbieri l...@luca-barbieri.com
Date:   Wed Dec 30 02:54:39 2009 +0100

nouveau: Fix glTexSubImage on swizzled surfaces on =NV40

Currently in nvXX_transfer_new a temporary as large as the surface is created.
If the subrectangle is not the whole texture we would need to read
back the whole texture, but we aren't.
Thus, everything but the subrectangle specified is loaded as garbage.
This can be seen in progs/demos/ray.

This patch fixes the problem by creating a temporary that covers only
the desired subrectangle.

That makes us hit an alignment assert in nv04_surface_2d.c. Fix it
using the point registers instead of manipulating the swizzled surface
offset to account for the destination coordinates (which do not seem
to have a 1024 limit).

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/gallium/drivers/nv04/nv04_surface_2d.c |9 -
 src/gallium/drivers/nv04/nv04_transfer.c   |   24 ++--
 src/gallium/drivers/nv10/nv10_transfer.c   |   24 ++--
 src/gallium/drivers/nv20/nv20_transfer.c   |   24 ++--
 src/gallium/drivers/nv30/nv30_transfer.c   |   24 ++--
 src/gallium/drivers/nv40/nv40_transfer.c   |   24 ++--
 6 files changed, 74 insertions(+), 55 deletions(-)

diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c 
b/src/gallium/drivers/nv04/nv04_surface_2d.c
index 40b538f..b24a9ce 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.c
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.c
@@ -167,20 +167,19 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
  for (x = 0; x  w; x += sub_w) {
sub_w = MIN2(sub_w, w - x);
 
-   /* Must be 64-byte aligned */
-   assert(!((dst-offset + nv04_swizzle_bits(dx+x, dy+y, w, h) * 
util_format_get_blocksize(dst-texture-format))  63));
+   assert(!(dst-offset  63));
 
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1);
-   OUT_RELOCl(chan, dst_bo, dst-offset + nv04_swizzle_bits(dx+x, 
dy+y, w, h) * util_format_get_blocksize(dst-texture-format),
+   OUT_RELOCl(chan, dst_bo, dst-offset,
  NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | 
NOUVEAU_BO_WR);
 
BEGIN_RING(chan, sifm, 
NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
OUT_RING  (chan, 
NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE);
OUT_RING  (chan, nv04_scaled_image_format(src-format));
OUT_RING  (chan, NV04_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY);
-   OUT_RING  (chan, 0);
+   OUT_RING  (chan, (x + dx) | ((y + dy)  
NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT));
OUT_RING  (chan, sub_h  
NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w);
-   OUT_RING  (chan, 0);
+   OUT_RING  (chan, (x + dx) | ((y + dy)  
NV04_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT));
OUT_RING  (chan, sub_h  
NV04_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w);
OUT_RING  (chan, 1  20);
OUT_RING  (chan, 1  20);
diff --git a/src/gallium/drivers/nv04/nv04_transfer.c 
b/src/gallium/drivers/nv04/nv04_transfer.c
index 8446073..2dd2e14 100644
--- a/src/gallium/drivers/nv04/nv04_transfer.c
+++ b/src/gallium/drivers/nv04/nv04_transfer.c
@@ -16,14 +16,14 @@ struct nv04_transfer {
 };
 
 static void
-nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level,
+nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned 
height,
  struct pipe_texture *template)
 {
memset(template, 0, sizeof(struct pipe_texture));
template-target = pt-target;
template-format = pt-format;
-   template-width0 = u_minify(pt-width0, level);
-   template-height0 = u_minify(pt-height0, level);
+   template-width0 = width;
+   template-height0 = height;
template-depth0 = 1;
template-last_level = 0;
template-nr_samples = pt-nr_samples;
@@ -71,7 +71,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct 
pipe_texture *pt,
 
tx-direct = false;
 
-   nv04_compatible_transfer_tex(pt, level, tx_tex_template);
+   nv04_compatible_transfer_tex(pt, w, h, tx_tex_template);
 
tx_tex = pscreen-texture_create(pscreen, tx_tex_template);
if (!tx_tex)
@@ -80,6 +80,8 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct 
pipe_texture *pt,
return NULL;
}
 
+   tx-base.stride = ((struct nv04_miptree*)tx_tex)-level[0].pitch;
+
tx-surface = pscreen-get_tex_surface(pscreen, tx_tex,
   face, level, zslice,
   
pipe_transfer_buffer_flags(tx-base));
@@ -105,8

Mesa (master): nv20: Fix build for the latest nouveau_class.h changes.

2010-01-07 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 95f603a5f3d897c5a6cf12fb13ea035f2e0867d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=95f603a5f3d897c5a6cf12fb13ea035f2e0867d9

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Jan  8 04:42:28 2010 +0100

nv20: Fix build for the latest nouveau_class.h changes.

---

 src/gallium/drivers/nv20/nv20_context.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv20/nv20_context.c 
b/src/gallium/drivers/nv20/nv20_context.c
index 1dba724..5b80af2 100644
--- a/src/gallium/drivers/nv20/nv20_context.c
+++ b/src/gallium/drivers/nv20/nv20_context.c
@@ -323,8 +323,8 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
OUT_RINGf (chan, -0.090168);/* NV20TCL.FOG_EQUATION_LINEAR 
*/
OUT_RINGf (chan, 0.0);  /* NV20TCL.FOG_EQUATION_QUADRATIC */
BEGIN_RING(chan, kelvin, NV20TCL_FOG_MODE, 2);
-   OUT_RING  (chan, NV20TCL_FOG_MODE_EXP_2);
-   OUT_RING  (chan, NV20TCL_FOG_COORD_DIST_COORD_FOG);
+   OUT_RING  (chan, NV20TCL_FOG_MODE_EXP_SIGNED);
+   OUT_RING  (chan, NV20TCL_FOG_COORD_FOG);
BEGIN_RING(chan, kelvin, NV20TCL_FOG_ENABLE, 2);
OUT_RING  (chan, 0);
OUT_RING  (chan, 0);/* NV20TCL.FOG_COLOR */

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


Mesa (master): dri/nouveau: don't use nested functions

2012-03-06 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 4aa1ac5fe94b5696095229ee3568bf4fa7cfed95
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4aa1ac5fe94b5696095229ee3568bf4fa7cfed95

Author: nobled nob...@dreamwidth.org
Date:   Sun Mar  4 15:20:31 2012 -0500

dri/nouveau: don't use nested functions

It's a GNU extension that isn't supported by clang right now:
http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Nested-Functions.html
http://clang.llvm.org/docs/UsersManual.html#c_unimpl_gcc

With this, clang now compiles the nouveau classic driver.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44061

(Types changed from e.g. 'unsigned char' to 'GLubyte' so that the types can
be concatenated to form a unique function name without any whitespace
interfering.)

[ Francisco Jerez: give meaningful names to the dispatch functions. ]

---

 src/mesa/drivers/dri/nouveau/nouveau_array.c|   67 +
 src/mesa/drivers/dri/nouveau/nouveau_render_t.c |   75 +++
 2 files changed, 78 insertions(+), 64 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_array.c 
b/src/mesa/drivers/dri/nouveau/nouveau_array.c
index 17e6d16..d9253b0 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_array.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_array.c
@@ -29,54 +29,71 @@
 #include nouveau_array.h
 #include nouveau_bufferobj.h
 
+#define EXTRACT(in_t, out_t) extract_func_##in_t##_to_##out_t
+
+#define EXTRACT_FUNC(in_t, out_t, k)   \
+static out_t EXTRACT(in_t, out_t)  \
+(struct nouveau_array *a, int i, int j) {  \
+   in_t x = ((in_t *)(a-buf + i * a-stride))[j]; \
+   \
+   return (out_t)x / (k);  \
+}
+
+EXTRACT_FUNC(GLchar, unsigned, 1);
+EXTRACT_FUNC(GLchar, float, SCHAR_MAX);
+EXTRACT_FUNC(GLubyte, unsigned, 1);
+EXTRACT_FUNC(GLubyte, float, UCHAR_MAX);
+EXTRACT_FUNC(GLshort, unsigned, 1);
+EXTRACT_FUNC(GLshort, float, SHRT_MAX);
+EXTRACT_FUNC(GLushort, unsigned, 1);
+EXTRACT_FUNC(GLushort, float, USHRT_MAX);
+EXTRACT_FUNC(GLint, unsigned, 1);
+EXTRACT_FUNC(GLint, float, INT_MAX);
+EXTRACT_FUNC(GLuint, unsigned, 1);
+EXTRACT_FUNC(GLuint, float, UINT_MAX);
+EXTRACT_FUNC(GLfloat, unsigned, 1.0 / UINT_MAX);
+EXTRACT_FUNC(GLfloat, float, 1);
+
+#undef EXTRACT_FUNC
+
 static void
 get_array_extract(struct nouveau_array *a, extract_u_t *extract_u,
  extract_f_t *extract_f)
 {
-#define EXTRACT(in_t, out_t, k)
\
-   ({  \
-   auto out_t f(struct nouveau_array *, int, int); \
-   out_t f(struct nouveau_array *a, int i, int j) {\
-   in_t x = ((in_t *)(a-buf + i * a-stride))[j]; \
-   \
-   return (out_t)x / (k);  \
-   };  \
-   f;  \
-   });
-
switch (a-type) {
case GL_BYTE:
-   *extract_u = EXTRACT(char, unsigned, 1);
-   *extract_f = EXTRACT(char, float, SCHAR_MAX);
+   *extract_u = EXTRACT(GLchar, unsigned);
+   *extract_f = EXTRACT(GLchar, float);
break;
case GL_UNSIGNED_BYTE:
-   *extract_u = EXTRACT(unsigned char, unsigned, 1);
-   *extract_f = EXTRACT(unsigned char, float, UCHAR_MAX);
+   *extract_u = EXTRACT(GLubyte, unsigned);
+   *extract_f = EXTRACT(GLubyte, float);
break;
case GL_SHORT:
-   *extract_u = EXTRACT(short, unsigned, 1);
-   *extract_f = EXTRACT(short, float, SHRT_MAX);
+   *extract_u = EXTRACT(GLshort, unsigned);
+   *extract_f = EXTRACT(GLshort, float);
break;
case GL_UNSIGNED_SHORT:
-   *extract_u = EXTRACT(unsigned short, unsigned, 1);
-   *extract_f = EXTRACT(unsigned short, float, USHRT_MAX);
+   *extract_u = EXTRACT(GLushort, unsigned);
+   *extract_f = EXTRACT(GLushort, float);
break;
case GL_INT:
-   *extract_u = EXTRACT(int, unsigned, 1);
-   *extract_f = EXTRACT(int, float, INT_MAX);
+   *extract_u = EXTRACT(GLint, unsigned);
+   *extract_f = EXTRACT(GLint, float);
break;
case GL_UNSIGNED_INT:
-   *extract_u = EXTRACT(unsigned int, unsigned, 1);
-   *extract_f = EXTRACT(unsigned int, float, UINT_MAX);
+   *extract_u = EXTRACT(GLuint, unsigned);
+   *extract_f = EXTRACT(GLuint, float);
break;
case GL_FLOAT:
-   *extract_u = EXTRACT(float, unsigned, 1.0

Mesa (gallium-compute): clover: Assorted build fixes.

2012-03-22 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: ccd2055d7893cd48a8385f207a55f45ad62a8c1d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccd2055d7893cd48a8385f207a55f45ad62a8c1d

Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:32:06 2012 +0100

clover: Assorted build fixes.

Contains the following patches squashed in:

commit 9fff1dc0875f7c9591550fa3ebbe1ba7a18483fa
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:20:03 2012 +0100

configure.ac: Build gallium loader when OpenCL is enabled

commit 542111cb02957418c6a285cb6ef2924e49adc66e
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:30:29 2012 +0100

configure.ac: Add sw/null to GALLIUM_WINSYS_DIRS for gallium loader

commit 876f8de46062dde76b6075be3b6628f969b16648
Author: Tom Stellard thomas.stell...@amd.com
Date:   Thu Feb 9 11:26:05 2012 -0500

configure.ac: Require gcc  4.6.0 for clover

commit 99049d50fa3d9a23297ae658189c19c89dca1766
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:32:06 2012 +0100

configure.ac: Require Gallium drm loader when gallium loader is enabled

No longer silently exclude this when building OpenCL drivers
for nouveau and r600.

---

 configure.ac |   40 +++-
 1 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5d94339..b858044 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,11 +117,11 @@ if test x$GCC = xyes -a x$acv_mesa_CLANG = xno; then
 
 GCC_VERSION=`$CC -dumpversion`
 if test $? -eq 0; then
-major=`echo $GCC_VERSION | cut -d. -f1`
-minor=`echo $GCC_VERSION | cut -d. -f2`
+GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
+GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
 fi
 
-if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
+if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a 
$GCC_VERSION_MINOR -lt 3 ; then
 AC_MSG_RESULT([no])
 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
 else
@@ -1618,8 +1618,14 @@ if test x$enable_opencl = xyes; then
 if test x$with_gallium_drivers = x; then
 AC_MSG_ERROR([cannot enable OpenCL without Gallium])
 fi
+
+if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a 
$GCC_VERSION_MINOR -lt 6; then
+AC_MSG_ERROR([gcc = 4.6 is required to build clover])
+fi
+
 GALLIUM_STATE_TRACKERS_DIRS=$GALLIUM_STATE_TRACKERS_DIRS clover
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS opencl
+enable_gallium_loader=yes
 fi
 
 dnl
@@ -1829,6 +1835,14 @@ else
 MESA_LLVM=0
 fi
 
+dnl
+dnl Gallium Tests
+dnl
+if test x$enable_gallium_tests = xyes; then
+SRC_DIRS=$SRC_DIRS gallium/tests/trivial
+enable_gallium_loader=yes
+fi
+
 dnl Directory for VDPAU libs
 AC_ARG_WITH([vdpau-libdir],
 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
@@ -1896,6 +1910,17 @@ gallium_require_llvm() {
 fi
 }
 
+gallium_require_drm_loader() {
+if test x$enable_gallium_loader = xyes; then
+PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
+  AC_MSG_ERROR([Gallium drm loader requrires libudev]))
+if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([Gallium drm loader requires libdrm = 
$LIBDRM_REQUIRED])
+fi
+enable_gallium_drm_loader=yes
+fi
+}
+
 dnl Gallium drivers
 dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this 
block
 if test x$with_gallium_drivers != x; then
@@ -1923,11 +1948,13 @@ if test x$with_gallium_drivers != x; then
 ;;
 xr600)
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon = 
$LIBDRM_RADEON_REQUIRED])
+gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS r600
 gallium_check_st radeon/drm dri-r600 xorg-r600  
xvmc-r600 vdpau-r600 va-r600
 ;;
 xnouveau)
 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau = 
$LIBDRM_NOUVEAU_REQUIRED])
+gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0
 gallium_check_st nouveau/drm dri-nouveau xorg-nouveau  
xvmc-nouveau vdpau-nouveau
 ;;
@@ -1968,13 +1995,8 @@ if test x$NEED_G3DVL_DRI = xyes; then
 GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS g3dvl/dri
 fi
 
-if test x$enable_gallium_tests = xyes; then
-SRC_DIRS=$SRC_DIRS gallium/tests/trivial
-enable_gallium_loader=yes
-fi
-
 if test x$enable_gallium_loader = xyes; then
-GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS loader/
+GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS sw/null loader/
 fi
 
 dnl Tell Automake which drivers to build

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


Mesa (gallium-compute): 29 new commits

2012-03-24 Thread Francisco Jerez
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f8f40b98bd202bfc1c9d12c8743bf2c42c9e76f
Author: Tom Stellard thomas.stell...@amd.com
Date:   Sat Mar 24 12:51:27 2012 +0100

clover: Assorted build fixes.

Contains the following patches squashed in:

commit 9fff1dc0875f7c9591550fa3ebbe1ba7a18483fa
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:20:03 2012 +0100

configure.ac: Build gallium loader when OpenCL is enabled

commit 542111cb02957418c6a285cb6ef2924e49adc66e
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:30:29 2012 +0100

configure.ac: Add sw/null to GALLIUM_WINSYS_DIRS for gallium loader

commit 876f8de46062dde76b6075be3b6628f969b16648
Author: Tom Stellard thomas.stell...@amd.com
Date:   Thu Feb 9 11:26:05 2012 -0500

configure.ac: Require gcc  4.6.0 for clover

commit 99049d50fa3d9a23297ae658189c19c89dca1766
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:32:06 2012 +0100

configure.ac: Require Gallium drm loader when gallium loader is enabled

No longer silently exclude this when building OpenCL drivers
for nouveau and r600.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e06c8553046c0265411d39d3af41b117ca36eaf4
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 20 23:19:32 2012 +0100

clover: Import OpenCL state tracker.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=37c4200f196304815fc10a380e065f14b324ac53
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 20 23:41:09 2012 +0100

gallium/tests/trivial: Import compute unit tests.

Add a test program that tries to exercise some of the language
features commonly used by compute programs at the Gallium API level:

   - Correctness of the values returned by the grid parameters.
   - Proper functioning of resource LOADs and STOREs.
   - Subroutine calls.
   - Argument passing to the compute parameter through the INPUT
 memory space.
   - Mapping of buffer objects to the GLOBAL memory space.
   - Proper functioning of the PRIVATE and LOCAL memory spaces.
   - Texture sampling and constant buffers.
   - Support for multiple kernels in the same program.
   - Indirect resource indexing.
   - Formatted resource loads and stores (i.e. with channel conversion
 and scaling) using several different formats.
   - Proper functioning of work-group barriers.
   - Atomicity and semantics of the atomic opcodes.

As of now all of them seem to pass on my nvA8.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c00dd0809e59ccab13f95d4899291dd70f8a8f2b
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 6 20:29:43 2012 +0100

gallium/gbm: Switch to the winsys loader.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6012b6870646d77198cea5f8dc14f85ed2741b48
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 20 23:40:36 2012 +0100

gallium/tests/trivial: Switch to the winsys loader.

It simplifies things slightly, and besides, it makes possible to
execute the trivial tests on a hardware device instead of being
limited to software rendering.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7ae97b57378950ca69f5c86779243aa9498ab01
Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Nov 25 14:26:00 2011 +0100

gallium: Add pipe-loader target.

This target generates pipe driver modules intended to be consumed by
the winsys loader.  Most of it was taken from the gbm target -- the
duplicated code will be replaced with references to this target in a
future commit.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a85437c4882965fe2b3bddc319ddf89c9c673e47
Author: Francisco Jerez curroje...@riseup.net
Date:   Sat Mar 24 12:50:10 2012 +0100

gallium: Add winsys loader for device enumeration and driver multiplexing.

The goal is to have a uniform interface to create winsys and
pipe_screen instances for any driver, exposing the device enumeration
capabilities that might be supported by the operating system (for now
there's a drm back-end using udev and a sw back-end that always
returns the same built-in devices).

The typical use case of this library will be:

 struct ws_loader_device devs[n];
 struct pipe_screen *screen;

 ws_loader_probe(devs, n);
[pick some device from the array...]

 screen = ws_loader_create_screen(dev, library_search_path);
[do something with screen...]

 screen-destroy(screen);
 ws_loader_release(devs, N);


A part of the code was taken from targets/gbm/pipe_loader.c, which
will be removed and replaced with calls into this library by a future
commit.

URL:
http://cgit.freedesktop.org/mesa/mesa

Mesa (gallium-compute): 86 new commits

2012-04-01 Thread Francisco Jerez
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=861dd183514ae4f552028905d3cba9107a466eb2
Author: Tom Stellard thomas.stell...@amd.com
Date:   Sun Apr 1 13:14:29 2012 +0200

clover: Assorted build fixes.

Contains the following patches squashed in:

commit 9fff1dc0875f7c9591550fa3ebbe1ba7a18483fa
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:20:03 2012 +0100

configure.ac: Build gallium loader when OpenCL is enabled

commit 542111cb02957418c6a285cb6ef2924e49adc66e
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:30:29 2012 +0100

configure.ac: Add sw/null to GALLIUM_WINSYS_DIRS for gallium loader

commit 876f8de46062dde76b6075be3b6628f969b16648
Author: Tom Stellard thomas.stell...@amd.com
Date:   Thu Feb 9 11:26:05 2012 -0500

configure.ac: Require gcc  4.6.0 for clover

commit 99049d50fa3d9a23297ae658189c19c89dca1766
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:32:06 2012 +0100

configure.ac: Require Gallium drm loader when gallium loader is enabled

No longer silently exclude this when building OpenCL drivers
for nouveau and r600.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d0a165de334c50b43a7f4dd0ba7a30fdc71c825
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 27 01:35:37 2012 +0200

clover: Import OpenCL state tracker.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=690e6e7454fa0ab5a29f522ed6db0044120b65e9
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 20 23:41:09 2012 +0100

gallium/tests/trivial: Import compute unit tests.

Add a test program that tries to exercise some of the language
features commonly used by compute programs at the Gallium API level:

   - Correctness of the values returned by the grid parameters.
   - Proper functioning of resource LOADs and STOREs.
   - Subroutine calls.
   - Argument passing to the compute parameter through the INPUT
 memory space.
   - Mapping of buffer objects to the GLOBAL memory space.
   - Proper functioning of the PRIVATE and LOCAL memory spaces.
   - Texture sampling and constant buffers.
   - Support for multiple kernels in the same program.
   - Indirect resource indexing.
   - Formatted resource loads and stores (i.e. with channel conversion
 and scaling) using several different formats.
   - Proper functioning of work-group barriers.
   - Atomicity and semantics of the atomic opcodes.

As of now all of them seem to pass on my nvA8.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6126f1f8b705399ff532f8ff7d984e5c4f41b407
Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 6 20:29:43 2012 +0100

gallium/gbm: Switch to auxiliary/pipe-loader.

Reviewed-by: Jakob Bornecrantz ja...@vmware.com

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da478275abbf9595b1960053f8f78a38df2264e3
Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Apr 1 13:13:52 2012 +0200

gallium/tests/trivial: Switch to the pipe loader.

It simplifies things slightly, and besides, it makes possible to
execute the trivial tests on a hardware device instead of being
limited to software rendering.

Reviewed-by: Jakob Bornecrantz ja...@vmware.com

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d54ea1691c401d084f5bbacb90244dad1ffb3c1d
Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Nov 25 14:26:00 2011 +0100

gallium: Add pipe-loader target.

This target generates pipe driver modules intended to be consumed by
auxiliary/pipe-loader.  Most of it was taken from the gbm target --
the duplicated code will be replaced with references to this target in
a future commit.

Reviewed-by: Jakob Bornecrantz ja...@vmware.com

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6546d8e170064861638ca76147c94c73d64a1ce
Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Apr 1 13:13:05 2012 +0200

gallium: Add pipe loader for device enumeration and driver multiplexing.

The goal is to have a uniform interface to create winsys and
pipe_screen instances for any driver, exposing the device enumeration
capabilities that might be supported by the operating system (for now
there's a drm back-end using udev and a sw back-end that always
returns the same built-in devices).

The typical use case of this library will be:

 struct pipe_loader_device devs[n];
 struct pipe_screen *screen;

 pipe_loader_probe(devs, n);
[pick some device from the array...]

 screen = pipe_loader_create_screen(dev, library_search_path);
[do something with screen...]

 screen-destroy(screen);
 pipe_loader_release(devs, N);


A part of the code

Mesa (gallium-compute): gallium: Add pipe-loader target.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: 92dd8291f7b16c40bac57354463f43dc60a36cc9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=92dd8291f7b16c40bac57354463f43dc60a36cc9

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Nov 25 14:26:00 2011 +0100

gallium: Add pipe-loader target.

This target generates pipe driver modules intended to be consumed by
auxiliary/pipe-loader.  Most of it was taken from the gbm target --
the duplicated code will be replaced with references to this target in
a future commit.

Reviewed-by: Jakob Bornecrantz ja...@vmware.com

---

 src/gallium/targets/pipe-loader/Makefile   |  165 
 src/gallium/targets/pipe-loader/pipe_i915.c|   27 
 src/gallium/targets/pipe-loader/pipe_nouveau.c |   21 +++
 src/gallium/targets/pipe-loader/pipe_r300.c|   27 
 src/gallium/targets/pipe-loader/pipe_r600.c|   26 
 src/gallium/targets/pipe-loader/pipe_swrast.c  |   22 +++
 src/gallium/targets/pipe-loader/pipe_vmwgfx.c  |   27 
 7 files changed, 315 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/pipe-loader/Makefile 
b/src/gallium/targets/pipe-loader/Makefile
new file mode 100644
index 000..4b96fcf
--- /dev/null
+++ b/src/gallium/targets/pipe-loader/Makefile
@@ -0,0 +1,165 @@
+# Makefile for building pipe driver shared libraries.
+#
+# Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional)
+#
+TOP = ../../../..
+include $(TOP)/configs/current
+
+PIPE_PREFIX ?= pipe_
+
+PIPE_CPPFLAGS = \
+   -DGALLIUM_RBUG \
+   -DGALLIUM_TRACE \
+   -DGALLIUM_GALAHAD \
+   -I$(TOP)/include \
+   -I$(TOP)/src/gallium/auxiliary \
+   -I$(TOP)/src/gallium/drivers \
+   -I$(TOP)/src/gallium/include \
+   -I$(TOP)/src/gallium/winsys
+
+PIPE_LIBS = \
+   $(TOP)/src/gallium/drivers/identity/libidentity.a \
+   $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
+   $(TOP)/src/gallium/drivers/trace/libtrace.a \
+   $(TOP)/src/gallium/drivers/rbug/librbug.a \
+   $(GALLIUM_AUXILIARIES)
+
+PIPE_SYS = $(LIBDRM_LIBS) -lm -lpthread $(DLOPEN_LIBS)
+
+PIPE_CFLAGS = $(LIBDRM_CFLAGS)
+
+PIPE_LDFLAGS = -Wl,--no-undefined
+
+# i915 pipe driver
+i915_LIBS = \
+   $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
+   $(TOP)/src/gallium/drivers/i915/libi915.a
+i915_SYS = -ldrm_intel
+
+# nouveau pipe driver
+nouveau_LIBS = \
+   $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+   $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
+   $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+   $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
+   $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+nouveau_SYS = -ldrm_nouveau
+
+# r300 pipe driver
+r300_LIBS = \
+   $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
+   $(TOP)/src/gallium/drivers/r300/libr300.a
+r300_SYS += -ldrm_radeon
+
+# r600 pipe driver
+r600_LIBS = \
+   $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
+   $(TOP)/src/gallium/drivers/r600/libr600.a
+r600_SYS += -ldrm_radeon
+
+# vmwgfx pipe driver
+vmwgfx_LIBS = \
+   $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
+   $(TOP)/src/gallium/drivers/svga/libsvga.a
+
+ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
+   swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
+   PIPE_CFLAGS += -DGALLIUM_LLVMPIPE
+else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
+   swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
+   PIPE_CFLAGS += -DGALLIUM_SOFTPIPE
+endif
+
+# LLVM
+ifeq ($(MESA_LLVM),1)
+   PIPE_SYS += $(LLVM_LIBS)
+   PIPE_LDFLAGS += $(LLVM_LDFLAGS)
+endif
+
+# determine the targets/sources
+_PIPE_TARGETS_CC =
+_PIPE_TARGETS_CXX =
+PIPE_SOURCES =
+
+ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
+   _PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so
+   PIPE_SOURCES += pipe_i915.c
+endif
+
+ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
+   _PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
+   PIPE_SOURCES += pipe_nouveau.c
+endif
+
+ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
+ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
+   _PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so
+   PIPE_SOURCES += pipe_r300.c
+endif
+endif
+
+ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
+ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
+   _PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so
+   PIPE_SOURCES += pipe_r600.c
+endif
+endif
+
+ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
+   _PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
+   PIPE_SOURCES += pipe_vmwgfx.c
+endif
+
+ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),)
+   _PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so
+   PIPE_SOURCES += pipe_swrast.c
+endif
+
+PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o)
+
+ifeq ($(MESA_LLVM),1)
+   PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC)
+   PIPE_TARGETS_CC =
+else
+   PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX)
+   PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC)
+endif

Mesa (gallium-compute): gallium: Add pipe loader for device enumeration and driver multiplexing.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: 0f704090b4d617f26833855d5c2aab25342681a5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f704090b4d617f26833855d5c2aab25342681a5

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Apr  1 13:13:05 2012 +0200

gallium: Add pipe loader for device enumeration and driver multiplexing.

The goal is to have a uniform interface to create winsys and
pipe_screen instances for any driver, exposing the device enumeration
capabilities that might be supported by the operating system (for now
there's a drm back-end using udev and a sw back-end that always
returns the same built-in devices).

The typical use case of this library will be:

 struct pipe_loader_device devs[n];
 struct pipe_screen *screen;

 pipe_loader_probe(devs, n);
[pick some device from the array...]

 screen = pipe_loader_create_screen(dev, library_search_path);
[do something with screen...]

 screen-destroy(screen);
 pipe_loader_release(devs, N);


A part of the code was taken from targets/gbm/pipe_loader.c, which
will be removed and replaced with calls into this library by a future
commit.

---

 configs/autoconf.in|3 +
 configure.ac   |   22 ++
 src/gallium/auxiliary/Makefile |8 +
 src/gallium/auxiliary/Makefile.sources |2 +
 src/gallium/auxiliary/pipe-loader/Makefile.am  |   38 
 src/gallium/auxiliary/pipe-loader/pipe_loader.c|  102 +
 src/gallium/auxiliary/pipe-loader/pipe_loader.h|  144 +
 .../auxiliary/pipe-loader/pipe_loader_drm.c|  218 
 .../auxiliary/pipe-loader/pipe_loader_priv.h   |   47 +
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  107 ++
 10 files changed, 691 insertions(+), 0 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 296bf30..3a24f71 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -214,3 +214,6 @@ ifneq ($(LLVM_VERSION),)
 endif
 
 HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@
+
+GALLIUM_PIPE_LOADER_DEFINES = @GALLIUM_PIPE_LOADER_DEFINES@
+GALLIUM_PIPE_LOADER_LIBS = @GALLIUM_PIPE_LOADER_LIBS@
diff --git a/configure.ac b/configure.ac
index 135bacf..8f0d427 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1940,6 +1940,25 @@ if test x$with_gallium_drivers != x; then
 done
 fi
 
+if test x$enable_gallium_loader = xyes; then
+GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS sw/null
+GALLIUM_PIPE_LOADER_DEFINES=-DHAVE_PIPE_LOADER_SW
+
GALLIUM_PIPE_LOADER_LIBS=\$(TOP)/src/gallium/auxiliary/pipe-loader/libpipe_loader.a
+GALLIUM_PIPE_LOADER_LIBS=$GALLIUM_PIPE_LOADER_LIBS 
\$(TOP)/src/gallium/winsys/sw/null/libws_null.a
+
+if test x$HAVE_WINSYS_XLIB = xyes; then
+GALLIUM_PIPE_LOADER_DEFINES=$GALLIUM_PIPE_LOADER_DEFINES 
-DHAVE_PIPE_LOADER_XLIB
+GALLIUM_PIPE_LOADER_LIBS=$GALLIUM_PIPE_LOADER_LIBS 
\$(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
+fi
+
+if test x$enable_gallium_drm_loader = xyes; then
+GALLIUM_PIPE_LOADER_DEFINES=$GALLIUM_PIPE_LOADER_DEFINES 
-DHAVE_PIPE_LOADER_DRM
+fi
+
+AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
+AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
+fi
+
 dnl Tell Automake which drivers to build
 for driver in $GALLIUM_DRIVERS_DIRS; do
 case x$driver in
@@ -1961,6 +1980,8 @@ done
 AM_CONDITIONAL(HAVE_GALAHAD_GALLIUM, test x$HAVE_GALAHAD_GALLIUM = xyes)
 AM_CONDITIONAL(HAVE_IDENTITY_GALLIUM, test x$HAVE_IDENTITY_GALLIUM = xyes)
 AM_CONDITIONAL(HAVE_NOOP_GALLIUM, test x$HAVE_NOOP_GALLIUM = xyes)
+AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
+AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = 
xyes)
 AC_SUBST([GALLIUM_MAKE_DIRS])
 
 dnl prepend CORE_DIRS to SRC_DIRS
@@ -1976,6 +1997,7 @@ CXXFLAGS=$CXXFLAGS $USER_CXXFLAGS
 
 dnl Substitute the config
 AC_CONFIG_FILES([configs/autoconf
+   src/gallium/auxiliary/pipe-loader/Makefile
src/gallium/drivers/Makefile
src/gallium/drivers/r300/Makefile
src/gbm/Makefile
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 896c058..a70ae73 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -18,6 +18,14 @@ endif
 
 include ../Makefile.template
 
+default install clean: %: subdirs-%
+
+subdirs-%:
+   @for dir in $(SUBDIRS) ; do \
+   if [ -d $$dir ] ; then \
+   (cd $$dir  $(MAKE) $*) || exit 1; \
+   fi \
+   done
 
 indices/u_indices_gen.c: indices/u_indices_gen.py
$(PYTHON2) $  $@
diff --git a/src/gallium/auxiliary/Makefile.sources 
b/src/gallium/auxiliary/Makefile.sources
index 44cf2d3..277428b 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -1,3 +1,5 @@
+SUBDIRS := pipe-loader
+
 C_SOURCES := \
cso_cache/cso_cache.c \
cso_cache

Mesa (gallium-compute): gallium/gbm: Switch to auxiliary/pipe-loader.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: c2247201ce3e178732325c61b2e8907f86e62ec5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c2247201ce3e178732325c61b2e8907f86e62ec5

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar  6 20:29:43 2012 +0100

gallium/gbm: Switch to auxiliary/pipe-loader.

Reviewed-by: Jakob Bornecrantz ja...@vmware.com

---

 configure.ac   |1 +
 src/gallium/state_trackers/gbm/gbm_drm.c   |5 +-
 .../state_trackers/gbm/gbm_gallium_drmint.h|3 +
 src/gallium/targets/gbm/Makefile   |  170 ++
 src/gallium/targets/gbm/gbm.c  |   44 --
 src/gallium/targets/gbm/pipe_i915.c|   27 ---
 src/gallium/targets/gbm/pipe_loader.c  |  192 
 src/gallium/targets/gbm/pipe_loader.h  |   48 -
 src/gallium/targets/gbm/pipe_nouveau.c |   21 --
 src/gallium/targets/gbm/pipe_r300.c|   27 ---
 src/gallium/targets/gbm/pipe_r600.c|   26 ---
 src/gallium/targets/gbm/pipe_swrast.c  |   22 ---
 src/gallium/targets/gbm/pipe_vmwgfx.c  |   27 ---
 13 files changed, 52 insertions(+), 561 deletions(-)

diff --git a/configure.ac b/configure.ac
index f29d17f..a2e6935 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1485,6 +1485,7 @@ if test x$enable_gallium_gbm = xyes; then
 GALLIUM_STATE_TRACKERS_DIRS=gbm $GALLIUM_STATE_TRACKERS_DIRS
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS gbm
 HAVE_ST_GBM=yes
+enable_gallium_loader=yes
 fi
 
 dnl
diff --git a/src/gallium/state_trackers/gbm/gbm_drm.c 
b/src/gallium/state_trackers/gbm/gbm_drm.c
index d4baf87..a327fda 100644
--- a/src/gallium/state_trackers/gbm/gbm_drm.c
+++ b/src/gallium/state_trackers/gbm/gbm_drm.c
@@ -190,10 +190,7 @@ gbm_gallium_drm_destroy(struct gbm_device *gbm)
 {
struct gbm_gallium_drm_device *gdrm = gbm_gallium_drm_device(gbm);
 
-   gdrm-screen-destroy(gdrm-screen);
-
-   FREE(gdrm-base.driver_name);
-
+   gallium_screen_destroy(gdrm);
FREE(gdrm);
 }
 
diff --git a/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h 
b/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
index 6277b8d..a5d6d83 100644
--- a/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
+++ b/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
@@ -71,4 +71,7 @@ gbm_gallium_drm_device_create(int fd);
 int
 gallium_screen_create(struct gbm_gallium_drm_device *gdrm);
 
+void
+gallium_screen_destroy(struct gbm_gallium_drm_device *gdrm);
+
 #endif
diff --git a/src/gallium/targets/gbm/Makefile b/src/gallium/targets/gbm/Makefile
index 2737b79..423debf 100644
--- a/src/gallium/targets/gbm/Makefile
+++ b/src/gallium/targets/gbm/Makefile
@@ -3,179 +3,39 @@
 TOP = ../../../..
 include $(TOP)/configs/current
 
-PIPE_PREFIX := pipe_
-
 GBM_BACKEND = gbm_gallium_drm
-GBM_SOURCES = gbm.c pipe_loader.c
+GBM_SOURCES = gbm.c
 
 GBM_INCLUDES = \
   -I$(TOP)/include \
   -I$(TOP)/src/gallium/state_trackers/gbm \
   -I$(TOP)/src/gbm/main \
   -I$(TOP)/src/gallium/auxiliary \
-  -I$(TOP)/src/gallium/include \
+  -I$(TOP)/src/gallium/winsys \
+  -I$(TOP)/src/gallium/include
 
 GBM_LIBS = $(LIBUDEV_LIBS) $(LIBDRM_LIB) -lm \
   $(TOP)/src/gallium/state_trackers/gbm/libgbm.a \
-  $(TOP)/src/gallium/drivers/identity/libidentity.a \
-  $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
-  $(TOP)/src/gallium/drivers/trace/libtrace.a \
-  $(TOP)/src/gallium/drivers/rbug/librbug.a \
-  $(GALLIUM_AUXILIARIES)
-
+  $(GALLIUM_PIPE_LOADER_LIBS) $(GALLIUM_AUXILIARIES)
 
 GBM_CFLAGS = \
--DGBM_BACKEND_SEARCH_DIR=\$(INSTALL_LIB_DIR)/gbm\ \
--DPIPE_PREFIX=\$(PIPE_PREFIX)\ \
+-DPIPE_SEARCH_DIR=\$(PIPE_INSTALL_DIR)\ \
+ $(GALLIUM_PIPE_LOADER_DEFINES) \
 $(LIBUDEV_CFLAGS) \
-$(LIBDRM_CFLAGS)  
-
-
-pipe_INCLUDES = \
-   -I$(TOP)/include \
-   -I$(TOP)/src/gallium/auxiliary \
-   -I$(TOP)/src/gallium/drivers \
-   -I$(TOP)/src/gallium/include \
-   -I$(TOP)/src/gallium/winsys
-
-pipe_LIBS = \
-   $(TOP)/src/gallium/drivers/identity/libidentity.a \
-   $(TOP)/src/gallium/drivers/trace/libtrace.a \
-   $(TOP)/src/gallium/drivers/rbug/librbug.a \
-   $(GALLIUM_AUXILIARIES)
-
-# as if we are DRI modules
-pipe_SYS = $(DRI_LIB_DEPS)
-
-pipe_CLFLAGS = \
-   -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD \
-   $(LIBDRM_CFLAGS)
-
-pipe_LDFLAGS = -Wl,--no-undefined
-
-# i915 pipe driver
-i915_LIBS = \
-   $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
-   $(TOP)/src/gallium/drivers/i915/libi915.a
-i915_SYS = -ldrm_intel
-
-# nouveau pipe driver
-nouveau_LIBS = \
-   $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
-   $(TOP)/src/gallium/drivers/nvfx/libnvfx.a

Mesa (gallium-compute): gallium/tests/trivial: Switch to the pipe loader.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: 95c83f69c5af65ab27a657d3bad43ce592dfbd5c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=95c83f69c5af65ab27a657d3bad43ce592dfbd5c

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Apr  1 13:13:52 2012 +0200

gallium/tests/trivial: Switch to the pipe loader.

It simplifies things slightly, and besides, it makes possible to
execute the trivial tests on a hardware device instead of being
limited to software rendering.

Reviewed-by: Jakob Bornecrantz ja...@vmware.com

---

 configure.ac |   11 +++
 src/gallium/tests/trivial/Makefile   |   25 +++--
 src/gallium/tests/trivial/quad-tex.c |   24 +---
 src/gallium/tests/trivial/tri.c  |   24 +---
 4 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8f0d427..f29d17f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -645,6 +645,12 @@ AC_ARG_ENABLE([gallium_gbm],
 [enable_gallium_gbm=$enableval],
 [enable_gallium_gbm=auto])
 
+AC_ARG_ENABLE([gallium_tests],
+[AS_HELP_STRING([--enable-gallium-tests],
+[Enable optional Gallium tests) @:@default=disable@:@])],
+[enable_gallium_tests=$enableval],
+[enable_gallium_tests=no])
+
 # Option for Gallium drivers
 GALLIUM_DRIVERS_DEFAULT=r300,r600,svga,swrast
 
@@ -1940,6 +1946,11 @@ if test x$with_gallium_drivers != x; then
 done
 fi
 
+if test x$enable_gallium_tests = xyes; then
+SRC_DIRS=$SRC_DIRS gallium/tests/trivial
+enable_gallium_loader=yes
+fi
+
 if test x$enable_gallium_loader = xyes; then
 GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS sw/null
 GALLIUM_PIPE_LOADER_DEFINES=-DHAVE_PIPE_LOADER_SW
diff --git a/src/gallium/tests/trivial/Makefile 
b/src/gallium/tests/trivial/Makefile
index 4ddbb0b..f069d02 100644
--- a/src/gallium/tests/trivial/Makefile
+++ b/src/gallium/tests/trivial/Makefile
@@ -11,19 +11,10 @@ INCLUDES = \
-I$(TOP)/src/gallium/winsys \
$(PROG_INCLUDES)
 
-ifeq ($(MESA_LLVM),1)
-LINKS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
-LDFLAGS += $(LLVM_LDFLAGS)
-endif
-
 LINKS += \
-   $(TOP)/src/gallium/drivers/rbug/librbug.a \
-   $(TOP)/src/gallium/drivers/trace/libtrace.a \
-   $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
-   $(TOP)/src/gallium/winsys/sw/null/libws_null.a \
-   $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+   $(GALLIUM_PIPE_LOADER_LIBS) \
$(GALLIUM_AUXILIARIES) \
-   $(PROG_LINKS)
+   $(PROG_LINKS) $(LIBUDEV_LIBS)
 
 SOURCES = \
tri.c \
@@ -33,17 +24,23 @@ OBJECTS = $(SOURCES:.c=.o)
 
 PROGS = $(OBJECTS:.o=)
 
-PROG_DEFINES = \
-   -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD
+PROG_DEFINES = -DPIPE_SEARCH_DIR=\$(PIPE_SRC_DIR)\ \
+   $(GALLIUM_PIPE_LOADER_DEFINES)
+
+PIPE_SRC_DIR = $(TOP)/src/gallium/targets/pipe-loader
 
 # TARGETS #
 
-default: $(PROGS)
+default: $(PROGS) pipes
 
 clean:
-rm -f $(PROGS)
-rm -f *.o
-rm -f result.bmp
+   @$(MAKE) -C $(PIPE_SRC_DIR) clean
+
+pipes:
+   @$(MAKE) -C $(PIPE_SRC_DIR)
 
 # RULES #
 
diff --git a/src/gallium/tests/trivial/quad-tex.c 
b/src/gallium/tests/trivial/quad-tex.c
index cc19e8d..7caac29 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -57,16 +57,12 @@
 #include util/u_memory.h
 /* util_make_[fragment|vertex]_passthrough_shader */
 #include util/u_simple_shaders.h
-
-/* sw_screen_create: to get a software pipe driver */
-#include target-helpers/inline_sw_helper.h
-/* debug_screen_wrap: to wrap with debug pipe drivers */
-#include target-helpers/inline_debug_helper.h
-/* null software winsys */
-#include sw/null/null_sw_winsys.h
+/* to get a hardware pipe driver */
+#include pipe-loader/pipe_loader.h
 
 struct program
 {
+   struct pipe_loader_device *dev;
struct pipe_screen *screen;
struct pipe_context *pipe;
struct cso_context *cso;
@@ -93,10 +89,15 @@ struct program
 static void init_prog(struct program *p)
 {
struct pipe_surface surf_tmpl;
-   /* create the software rasterizer */
-   p-screen = sw_screen_create(null_sw_create());
-   /* wrap the screen with any debugger */
-   p-screen = debug_screen_wrap(p-screen);
+   int ret;
+
+   /* find a hardware device */
+   ret = pipe_loader_probe(p-dev, 1);
+   assert(ret);
+
+   /* init a pipe screen */
+   p-screen = pipe_loader_create_screen(p-dev, PIPE_SEARCH_DIR);
+   assert(p-screen);
 
/* create the pipe driver context and cso context */
p-pipe = p-screen-context_create(p-screen, NULL);
@@ -298,6 +299,7 @@ static void close_prog(struct program *p)
cso_destroy_context(p-cso);
p-pipe-destroy(p-pipe);
p-screen-destroy(p-screen);
+   pipe_loader_release(p-dev, 1);
 
FREE(p);
 }
diff --git a/src/gallium

Mesa (gallium-compute): gallium/tests/trivial: Import compute unit tests.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: 68e4ec963d66efe087b66d36f4222e91e721b7fb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=68e4ec963d66efe087b66d36f4222e91e721b7fb

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 20 23:41:09 2012 +0100

gallium/tests/trivial: Import compute unit tests.

Add a test program that tries to exercise some of the language
features commonly used by compute programs at the Gallium API level:

   - Correctness of the values returned by the grid parameters.
   - Proper functioning of resource LOADs and STOREs.
   - Subroutine calls.
   - Argument passing to the compute parameter through the INPUT
 memory space.
   - Mapping of buffer objects to the GLOBAL memory space.
   - Proper functioning of the PRIVATE and LOCAL memory spaces.
   - Texture sampling and constant buffers.
   - Support for multiple kernels in the same program.
   - Indirect resource indexing.
   - Formatted resource loads and stores (i.e. with channel conversion
 and scaling) using several different formats.
   - Proper functioning of work-group barriers.
   - Atomicity and semantics of the atomic opcodes.

As of now all of them seem to pass on my nvA8.

---

 src/gallium/tests/trivial/Makefile  |3 +-
 src/gallium/tests/trivial/compute.c | 1551 +++
 2 files changed, 1553 insertions(+), 1 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=68e4ec963d66efe087b66d36f4222e91e721b7fb
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (gallium-compute): clover: Import OpenCL state tracker.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: 4465cc1fcec720486f32c245fed415c63e275b4c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4465cc1fcec720486f32c245fed415c63e275b4c

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Mar 27 01:35:37 2012 +0200

clover: Import OpenCL state tracker.

---

 configure.ac   |   31 +-
 include/CL/cl.h|  998 +
 include/CL/cl.hpp  | 4011 
 include/CL/cl_ext.h|  213 ++
 include/CL/cl_gl.h |  155 +
 include/CL/cl_gl_ext.h |   69 +
 include/CL/cl_platform.h   | 1198 ++
 include/CL/opencl.h|   54 +
 src/gallium/state_trackers/Makefile|2 +-
 src/gallium/state_trackers/clover/Doxyfile | 1716 +
 src/gallium/state_trackers/clover/Makefile.am  |   71 +
 src/gallium/state_trackers/clover/api/context.cpp  |  120 +
 src/gallium/state_trackers/clover/api/device.cpp   |  262 ++
 src/gallium/state_trackers/clover/api/event.cpp|  239 ++
 src/gallium/state_trackers/clover/api/kernel.cpp   |  318 ++
 src/gallium/state_trackers/clover/api/memory.cpp   |  305 ++
 src/gallium/state_trackers/clover/api/platform.cpp |   68 +
 src/gallium/state_trackers/clover/api/program.cpp  |  241 ++
 src/gallium/state_trackers/clover/api/queue.cpp|  102 +
 src/gallium/state_trackers/clover/api/sampler.cpp  |   90 +
 src/gallium/state_trackers/clover/api/transfer.cpp |  506 +++
 src/gallium/state_trackers/clover/api/util.hpp |  166 +
 src/gallium/state_trackers/clover/core/base.hpp|  285 ++
 src/gallium/state_trackers/clover/core/compat.hpp  |  290 ++
 .../state_trackers/clover/core/compiler.hpp|   53 +
 src/gallium/state_trackers/clover/core/context.cpp |   37 +
 src/gallium/state_trackers/clover/core/context.hpp |   51 +
 src/gallium/state_trackers/clover/core/device.cpp  |  172 +
 src/gallium/state_trackers/clover/core/device.hpp  |  107 +
 src/gallium/state_trackers/clover/core/event.cpp   |  172 +
 src/gallium/state_trackers/clover/core/event.hpp   |  137 +
 src/gallium/state_trackers/clover/core/format.cpp  |  167 +
 src/gallium/state_trackers/clover/core/format.hpp  |   51 +
 .../state_trackers/clover/core/geometry.hpp|   72 +
 src/gallium/state_trackers/clover/core/kernel.cpp  |  358 ++
 src/gallium/state_trackers/clover/core/kernel.hpp  |  200 +
 src/gallium/state_trackers/clover/core/memory.cpp  |  193 +
 src/gallium/state_trackers/clover/core/memory.hpp  |  157 +
 src/gallium/state_trackers/clover/core/module.cpp  |  172 +
 src/gallium/state_trackers/clover/core/module.hpp  |   93 +
 src/gallium/state_trackers/clover/core/program.cpp |   85 +
 src/gallium/state_trackers/clover/core/program.hpp |   61 +
 src/gallium/state_trackers/clover/core/queue.cpp   |   69 +
 src/gallium/state_trackers/clover/core/queue.hpp   |   71 +
 .../state_trackers/clover/core/resource.cpp|  175 +
 .../state_trackers/clover/core/resource.hpp|  125 +
 src/gallium/state_trackers/clover/core/sampler.cpp |   73 +
 src/gallium/state_trackers/clover/core/sampler.hpp |   55 +
 .../state_trackers/clover/llvm/invocation.cpp  |   94 +
 .../state_trackers/clover/tgsi/compiler.cpp|  100 +
 src/gallium/targets/opencl/Makefile.am |   36 +
 51 files changed, 14643 insertions(+), 3 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=4465cc1fcec720486f32c245fed415c63e275b4c
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (gallium-compute): clover: Assorted build fixes.

2012-04-01 Thread Francisco Jerez
Module: Mesa
Branch: gallium-compute
Commit: f0941314c41a1cf1e9eba679bf994a46b963e71e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0941314c41a1cf1e9eba679bf994a46b963e71e

Author: Tom Stellard thomas.stell...@amd.com
Date:   Sun Apr  1 13:14:29 2012 +0200

clover: Assorted build fixes.

Contains the following patches squashed in:

commit 9fff1dc0875f7c9591550fa3ebbe1ba7a18483fa
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:20:03 2012 +0100

configure.ac: Build gallium loader when OpenCL is enabled

commit 542111cb02957418c6a285cb6ef2924e49adc66e
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:30:29 2012 +0100

configure.ac: Add sw/null to GALLIUM_WINSYS_DIRS for gallium loader

commit 876f8de46062dde76b6075be3b6628f969b16648
Author: Tom Stellard thomas.stell...@amd.com
Date:   Thu Feb 9 11:26:05 2012 -0500

configure.ac: Require gcc  4.6.0 for clover

commit 99049d50fa3d9a23297ae658189c19c89dca1766
Author: Tom Stellard thomas.stell...@amd.com
Date:   Tue Mar 20 23:32:06 2012 +0100

configure.ac: Require Gallium drm loader when gallium loader is enabled

No longer silently exclude this when building OpenCL drivers
for nouveau and r600.

---

 configure.ac |   38 ++
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8ee6a00..05447c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,11 +117,11 @@ if test x$GCC = xyes -a x$acv_mesa_CLANG = xno; then
 
 GCC_VERSION=`$CC -dumpversion`
 if test $? -eq 0; then
-major=`echo $GCC_VERSION | cut -d. -f1`
-minor=`echo $GCC_VERSION | cut -d. -f2`
+GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
+GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
 fi
 
-if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
+if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a 
$GCC_VERSION_MINOR -lt 3 ; then
 AC_MSG_RESULT([no])
 AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
 else
@@ -1618,8 +1618,14 @@ if test x$enable_opencl = xyes; then
 if test x$with_gallium_drivers = x; then
 AC_MSG_ERROR([cannot enable OpenCL without Gallium])
 fi
+
+if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a 
$GCC_VERSION_MINOR -lt 6; then
+AC_MSG_ERROR([gcc = 4.6 is required to build clover])
+fi
+
 GALLIUM_STATE_TRACKERS_DIRS=$GALLIUM_STATE_TRACKERS_DIRS clover
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS opencl
+enable_gallium_loader=yes
 fi
 
 dnl
@@ -1840,6 +1846,14 @@ else
 MESA_LLVM=0
 fi
 
+dnl
+dnl Gallium Tests
+dnl
+if test x$enable_gallium_tests = xyes; then
+SRC_DIRS=$SRC_DIRS gallium/tests/trivial
+enable_gallium_loader=yes
+fi
+
 dnl Directory for VDPAU libs
 AC_ARG_WITH([vdpau-libdir],
 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
@@ -1904,6 +1918,17 @@ gallium_require_llvm() {
 fi
 }
 
+gallium_require_drm_loader() {
+if test x$enable_gallium_loader = xyes; then
+PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
+  AC_MSG_ERROR([Gallium drm loader requrires libudev]))
+if test x$have_libdrm != xyes; then
+AC_MSG_ERROR([Gallium drm loader requires libdrm = 
$LIBDRM_REQUIRED])
+fi
+enable_gallium_drm_loader=yes
+fi
+}
+
 dnl Gallium drivers
 dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this 
block
 if test x$with_gallium_drivers != x; then
@@ -1931,11 +1956,13 @@ if test x$with_gallium_drivers != x; then
 ;;
 xr600)
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon = 
$LIBDRM_RADEON_REQUIRED])
+gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS r600
 gallium_check_st radeon/drm dri-r600 xorg-r600  
xvmc-r600 vdpau-r600 va-r600
 ;;
 xnouveau)
 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau = 
$LIBDRM_NOUVEAU_REQUIRED])
+gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0
 gallium_check_st nouveau/drm dri-nouveau xorg-nouveau  
xvmc-nouveau vdpau-nouveau
 ;;
@@ -1972,11 +1999,6 @@ if test x$with_gallium_drivers != x; then
 done
 fi
 
-if test x$enable_gallium_tests = xyes; then
-SRC_DIRS=$SRC_DIRS gallium/tests/trivial
-enable_gallium_loader=yes
-fi
-
 if test x$enable_gallium_loader = xyes; then
 GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS sw/null
 GALLIUM_PIPE_LOADER_DEFINES=-DHAVE_PIPE_LOADER_SW

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


Mesa (master): dri/nouveau: Remove unnecessary flush.

2010-09-30 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bdd19da2183c685056c4c2eee5cea8358d9935cb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdd19da2183c685056c4c2eee5cea8358d9935cb

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Sep 28 22:24:05 2010 +0200

dri/nouveau: Remove unnecessary flush.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index fbe4ede..1121d2d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -353,8 +353,6 @@ nouveau_validate_framebuffer(GLcontext *ctx)
validate_framebuffer(dri_ctx, dri_read,
 dri_ctx-dri2.read_stamp);
 
-   if (nouveau_next_dirty_state(ctx) = 0) {
+   if (nouveau_next_dirty_state(ctx) = 0)
nouveau_state_emit(ctx);
-   FIRE_RING(context_chan(ctx));
-   }
 }

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


Mesa (master): dri/nouveau: Have a smaller amount of larger scratch buffers .

2010-09-30 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 6f39280ba910e290fb3cda378057dc91e5811c95
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f39280ba910e290fb3cda378057dc91e5811c95

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Sep 28 22:20:12 2010 +0200

dri/nouveau: Have a smaller amount of larger scratch buffers.

Larger VBOs avoid many kernel trips to get them in sync with the GPU.

---

 src/mesa/drivers/dri/nouveau/nouveau_render.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h 
b/src/mesa/drivers/dri/nouveau/nouveau_render.h
index 923b79b..29d96ed 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h
@@ -55,8 +55,8 @@ struct nouveau_array_state {
extract_f_t extract_f;
 };
 
-#define RENDER_SCRATCH_COUNT 32
-#define RENDER_SCRATCH_SIZE 64*1024
+#define RENDER_SCRATCH_COUNT 2
+#define RENDER_SCRATCH_SIZE 2*1024*1024
 
 struct nouveau_scratch_state {
struct nouveau_bo *bo[RENDER_SCRATCH_COUNT];

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


Mesa (master): dri/nv10: Use fast Z clears.

2010-09-30 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 065163bcd2df12494ca523538736282fc847fa6b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=065163bcd2df12494ca523538736282fc847fa6b

Author: Francisco Jerez curroje...@riseup.net
Date:   Sat Sep 25 15:29:02 2010 +0200

dri/nv10: Use fast Z clears.

---

 src/mesa/drivers/dri/nouveau/nouveau_class.h   |6 +++
 src/mesa/drivers/dri/nouveau/nouveau_context.h |5 +++
 src/mesa/drivers/dri/nouveau/nouveau_fbo.h |6 +++-
 src/mesa/drivers/dri/nouveau/nv10_context.c|   45 +---
 src/mesa/drivers/dri/nouveau/nv10_driver.h |8 
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c   |   29 +---
 6 files changed, 88 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h 
b/src/mesa/drivers/dri/nouveau/nouveau_class.h
index 5cb13ac..d41d431 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_class.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h
@@ -3191,6 +3191,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define  NV17TCL_DMA_IN_MEMORY4
0x01ac
 #define  NV17TCL_DMA_IN_MEMORY5
0x01b0
 #define  NV17TCL_COLOR_MASK_ENABLE 
0x02bc
+#define  NV17TCL_ZCLEAR_ENABLE 
0x03f8
+#define  NV17TCL_ZCLEAR_VALUE  
0x03fc
+#define   NV17TCL_ZCLEAR_VALUE_DEPTH_SHIFT 
8
+#define   NV17TCL_ZCLEAR_VALUE_DEPTH_MASK  
0xff00
+#define   NV17TCL_ZCLEAR_VALUE_SEQUENCE_SHIFT  
0
+#define   NV17TCL_ZCLEAR_VALUE_SEQUENCE_MASK   
0x00ff
 #define  NV17TCL_LMA_DEPTH_BUFFER_PITCH
0x0d5c
 #define  NV17TCL_LMA_DEPTH_BUFFER_OFFSET   
0x0d60
 #define  NV17TCL_LMA_DEPTH_FILL_VALUE  
0x0d68
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h 
b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 3dbe729..5f00327 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -67,6 +67,11 @@ struct nouveau_context {
struct nouveau_hw_state hw;
struct nouveau_bo_state bo;
struct nouveau_render_state render;
+
+   struct {
+   GLboolean clear_blocked;
+   int clear_seq;
+   } hierz;
 };
 
 #define to_nouveau_context(ctx)((struct nouveau_context *)(ctx))
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
index 0fe6c08..05ea03a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
@@ -29,8 +29,12 @@
 
 struct nouveau_framebuffer {
struct gl_framebuffer base;
-   struct nouveau_bo *lma_bo;
GLboolean need_front;
+
+   struct {
+   struct nouveau_bo *bo;
+   uint32_t clear_value;
+   } hierz;
 };
 #define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x))
 
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 08be2a2..41723ff 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -40,9 +40,31 @@ static const struct dri_extension nv10_extensions[] = {
{ NULL, NULL }
 };
 
+static GLboolean
+use_fast_zclear(GLcontext *ctx, GLbitfield buffers)
+{
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct gl_framebuffer *fb = ctx-DrawBuffer;
+
+   if (buffers  BUFFER_BIT_STENCIL) {
+   /*
+* The stencil test is bypassed when fast Z clears are
+* enabled.
+*/
+   nctx-hierz.clear_blocked = GL_TRUE;
+   context_dirty(ctx, ZCLEAR);
+   return GL_FALSE;
+   }
+
+   return !nctx-hierz.clear_blocked 
+   fb-_Xmax == fb-Width  fb-_Xmin == 0 
+   fb-_Ymax == fb-Height  fb-_Ymin == 0;
+}
+
 static void
 nv10_clear(GLcontext *ctx, GLbitfield buffers)
 {
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(
@@ -50,16 +72,28 @@ nv10_clear(GLcontext *ctx, GLbitfield buffers)
 
nouveau_validate_framebuffer(ctx);
 
-   /* Clear the LMA depth buffer, if present. */
-   if ((buffers  BUFFER_BIT_DEPTH)  ctx

Mesa (master): dri/nouveau: Minor cleanup.

2010-10-09 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 35a1893fd1993932a428f5f83051383d51c8135e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=35a1893fd1993932a428f5f83051383d51c8135e

Author: Francisco Jerez curroje...@riseup.net
Date:   Sun Oct 10 01:45:23 2010 +0200

dri/nouveau: Minor cleanup.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |3 +--
 src/mesa/drivers/dri/nouveau/nv10_context.c|2 +-
 src/mesa/drivers/dri/nouveau/nv10_render.c |   20 ++--
 src/mesa/drivers/dri/nouveau/nv20_render.c |   20 ++--
 4 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 1121d2d..6369e8d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -353,6 +353,5 @@ nouveau_validate_framebuffer(GLcontext *ctx)
validate_framebuffer(dri_ctx, dri_read,
 dri_ctx-dri2.read_stamp);
 
-   if (nouveau_next_dirty_state(ctx) = 0)
-   nouveau_state_emit(ctx);
+   nouveau_state_emit(ctx);
 }
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 41723ff..f0e2744 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -305,7 +305,7 @@ nv10_hwctx_init(GLcontext *ctx)
OUT_RING(chan, 1);
 
BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2);
-   OUT_RING(chan, 0.0);
+   OUT_RINGf(chan, 0.0);
OUT_RINGf(chan, 16777216.0);
 
FIRE_RING(chan);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_render.c 
b/src/mesa/drivers/dri/nouveau/nv10_render.c
index 54245ea..e4c51f8 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_render.c
@@ -167,35 +167,35 @@ nv10_render_bind_vertices(GLcontext *ctx)
 
 #define BATCH_BEGIN(prim)  \
BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BUFFER_BEGIN_END, 1);  \
-   OUT_RING(chan, prim);
+   OUT_RING(chan, prim)
 #define BATCH_END()\
BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BUFFER_BEGIN_END, 1);  \
-   OUT_RING(chan, 0);
+   OUT_RING(chan, 0)
 
 #define MAX_PACKET 0x400
 
 #define MAX_OUT_L 0x100
 #define BATCH_PACKET_L(n)  \
-   BEGIN_RING_NI(chan, celsius, NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS, n);
+   BEGIN_RING_NI(chan, celsius, NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS, n)
 #define BATCH_OUT_L(i, n)  \
-   OUT_RING(chan, ((n) - 1)  24 | (i));
+   OUT_RING(chan, ((n) - 1)  24 | (i))
 
 #define MAX_OUT_I16 0x2
 #define BATCH_PACKET_I16(n)\
-   BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U16, n);
+   BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U16, n)
 #define BATCH_OUT_I16(i0, i1)  \
-   OUT_RING(chan, (i1)  16 | (i0));
+   OUT_RING(chan, (i1)  16 | (i0))
 
 #define MAX_OUT_I32 0x1
 #define BATCH_PACKET_I32(n)\
-   BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U32, n);
+   BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U32, n)
 #define BATCH_OUT_I32(i)   \
-   OUT_RING(chan, i);
+   OUT_RING(chan, i)
 
 #define IMM_PACKET(m, n)   \
-   BEGIN_RING(chan, celsius, m, n);
+   BEGIN_RING(chan, celsius, m, n)
 #define IMM_OUT(x) \
-   OUT_RINGf(chan, x);
+   OUT_RINGf(chan, x)
 
 #define TAG(x) nv10_##x
 #include nouveau_render_t.c
diff --git a/src/mesa/drivers/dri/nouveau/nv20_render.c 
b/src/mesa/drivers/dri/nouveau/nv20_render.c
index a696ac1..d7c3e74 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_render.c
@@ -191,35 +191,35 @@ nv20_render_bind_vertices(GLcontext *ctx)
 
 #define BATCH_BEGIN(prim)  \
BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1);  \
-   OUT_RING(chan, prim);
+   OUT_RING(chan, prim)
 #define BATCH_END()\
BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1);  \
-   OUT_RING(chan, 0);
+   OUT_RING(chan, 0)
 
 #define MAX_PACKET 0x400
 
 #define MAX_OUT_L 0x100
 #define BATCH_PACKET_L(n)  \
-   BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n);
+   BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n)
 #define BATCH_OUT_L(i, n)  \
-   OUT_RING(chan, ((n) - 1)  24 | (i));
+   OUT_RING(chan, ((n) - 1)  24 | (i))
 
 #define MAX_OUT_I16 0x2
 #define BATCH_PACKET_I16(n)\
-   BEGIN_RING_NI(chan, kelvin

  1   2   3   4   5   6   7   >