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

---

 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 
Date:   Sun Jan 31 19:31:01 2010 +

nv04: Update to new nouveau_class.h

Signed-off-by: Francisco Jerez 

---

 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_FIL

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 
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) ? (0x01<<24) : 0) |
- ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 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_anis

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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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:
return

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 
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:
+   ret

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 
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 
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 
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 
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  to the combiner source ,
@@ -146,8 +163,7 @@ get_arg_mapping(struct combi

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

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 
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,
-   

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

Mesa (master): dri/nouveau: Allow to render to XRGB8888 textures.

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

Author: Andrew Randrianasulu 
Date:   Mon Mar  1 01:46:32 2010 +0100

dri/nouveau: Allow to render to XRGB textures.

Signed-off-by: Francisco Jerez 

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 1db8c5d..8464786 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -215,6 +215,8 @@ get_tex_format(struct gl_texture_image *ti)
switch (ti->TexFormat) {
case MESA_FORMAT_ARGB:
return GL_RGBA8;
+   case MESA_FORMAT_XRGB:
+   return GL_RGB8;
case MESA_FORMAT_RGB565:
return GL_RGB5;
default:

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


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

---

 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 
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 
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 
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 
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 
Date:   Thu Mar  4 23:15:47 2010 +0100

dri/nouveau: Trivially add GL_ARB_texture_mirrored_repeat.

Signed-off-by: Francisco Jerez 

---

 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 
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 
Date:   Mon Mar  1 23:58:17 2010 +

dri/nouveau: Add GL_EXT_stencil_wrap for nv04.

Signed-off-by: Francisco Jerez 

---

 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 
Date:   Mon Mar  1 23:45:50 2010 +

dri/nouveau: Enable GL_EXT_stencil_wrap.

Signed-off-by: Francisco Jerez 

---

 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 
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 
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 
Date:   Sun Mar  7 01:09:21 2010 +

dri/nv04: GL_EXT_secondary_color

Signed-off-by: Francisco Jerez 

---

 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 
Date:   Tue Mar  2 01:29:14 2010 +

dri/nouveau: Trivially add GL_NV_blend_square

Signed-off-by: Francisco Jerez 

---

 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 
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 
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 
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 
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 
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 
Signed-off-by: Francisco Jerez 

---

 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 texcoord generation.

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

Author: Francisco Jerez 
Date:   Thu Mar 18 14:18:55 2010 +0100

dri/nouveau: Implement texcoord generation.

---

 src/mesa/drivers/dri/nouveau/nouveau_gldefs.h |   19 +
 src/mesa/drivers/dri/nouveau/nouveau_state.c  |   17 +++-
 src/mesa/drivers/dri/nouveau/nouveau_util.h   |   18 +
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c  |4 ++-
 src/mesa/drivers/dri/nouveau/nv10_context.c   |2 +-
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c |   33 +++
 src/mesa/drivers/dri/nouveau/nv10_state_tnl.c |6 +++-
 src/mesa/drivers/dri/nouveau/nv20_context.c   |   14 +-
 src/mesa/drivers/dri/nouveau/nv20_driver.h|3 ++
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c |   35 +
 src/mesa/drivers/dri/nouveau/nv20_state_tnl.c |6 +++-
 11 files changed, 143 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h 
b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
index 7a9..fbeed3b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
@@ -260,4 +260,23 @@ nvgl_filter_mode(unsigned filter)
}
 }
 
+static inline unsigned
+nvgl_texgen_mode(unsigned mode)
+{
+   switch (mode) {
+   case GL_EYE_LINEAR:
+   return 0x2400;
+   case GL_OBJECT_LINEAR:
+   return 0x2401;
+   case GL_SPHERE_MAP:
+   return 0x2402;
+   case GL_NORMAL_MAP:
+   return 0x8511;
+   case GL_REFLECTION_MAP:
+   return 0x8512;
+   default:
+   assert(0);
+   }
+}
+
 #endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 603a46e..ef2cc78 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -234,6 +234,13 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
break;
+   case GL_TEXTURE_GEN_S:
+   case GL_TEXTURE_GEN_T:
+   case GL_TEXTURE_GEN_R:
+   case GL_TEXTURE_GEN_Q:
+   context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+   context_dirty(ctx, MODELVIEW);
+   break;
}
 }
 
@@ -368,7 +375,15 @@ static void
 nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname,
const GLfloat *params)
 {
-   context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+   switch (pname) {
+   case GL_TEXTURE_GEN_MODE:
+   context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+   context_dirty(ctx, MODELVIEW);
+   break;
+   default:
+   context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+   break;
+   }
 }
 
 static void
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h 
b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index d6007ab..584cb80 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -191,4 +191,22 @@ is_texture_source(int s)
return s == GL_TEXTURE || (s >= GL_TEXTURE0 && s <= GL_TEXTURE31);
 }
 
+static inline struct gl_texgen *
+get_texgen_coord(struct gl_texture_unit *u, int i)
+{
+   return ((struct gl_texgen *[])
+   { &u->GenS, &u->GenT, &u->GenR, &u->GenQ }) [i];
+}
+
+static inline float *
+get_texgen_coeff(struct gl_texgen *c)
+{
+   if (c->Mode == GL_OBJECT_LINEAR)
+   return c->ObjectPlane;
+   else if (c->Mode == GL_EYE_LINEAR)
+   return c->EyePlane;
+   else
+   return NULL;
+}
+
 #endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index f20a7df..0c29eec 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -224,9 +224,11 @@ vbo_choose_attrs(GLcontext *ctx, const struct 
gl_client_array **arrays)
if (ctx->Fog.Enabled && ctx->Fog.FogCoordinateSource == GL_FOG_COORD)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_FOG);
 
-   if (ctx->Light.Enabled) {
+   if (ctx->Light.Enabled ||
+   (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_NORMAL);
 
+   if (ctx->Light.Enabled) {
vbo_emit_attr(ctx, arrays, MAT(FRONT_AMBIENT));
vbo_emit_attr(ctx, arrays, MAT(FRONT_DIFFUSE));
vbo_emit_attr(ctx, arrays, MAT(FRONT_SPECULAR));
diff --git a/sr

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 
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->fallb

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 
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 
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 
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 **a

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 
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 
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 
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 
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 
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 
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)
-   

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 
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): 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 
Date:   Mon Dec 28 16:23:40 2009 +

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

Signed-off-by: Francisco Jerez 

---

 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),
- 

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 
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(1<<20/*no cull*/);
-   BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_BLEND, 1);
+   BEGIN_RING(fahrenheit, NV04_TEXTURED_TRIANGLE_BLEND, 1);
 // OUT_RING(0x24|(1<<6)|(1<<8));
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

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

---

 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

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 
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: 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 
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 
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 
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 
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 

---

 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 
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 
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->Lig

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 
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 
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 
Date:   Tue Sep 14 20:59:44 2010 +0200

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

Signed-off-by: Francisco Jerez 

---

 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 
Date:   Tue Sep 14 04:29:52 2010 +0200

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

Signed-off-by: Francisco Jerez 

---

 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 
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 
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),
-

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 
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 
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 
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 
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 
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_OU

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 
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 
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 
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 1

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 
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 
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 
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 
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 
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 
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 
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 
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): 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 
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 
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 
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,

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 
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)

Mesa (master): dri/nv10: Fake fast Z clears for pre-nv17 cards.

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

Author: Francisco Jerez 
Date:   Sun Oct 10 01:39:13 2010 +0200

dri/nv10: Fake fast Z clears for pre-nv17 cards.

---

 src/mesa/drivers/dri/nouveau/nv10_context.c   |  130 +
 src/mesa/drivers/dri/nouveau/nv10_driver.h|6 +
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c  |8 ++
 src/mesa/drivers/dri/nouveau/nv10_state_tnl.c |3 +
 4 files changed, 127 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index f0e2744..3d898fd 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -61,39 +61,129 @@ use_fast_zclear(GLcontext *ctx, GLbitfield buffers)
fb->_Ymax == fb->Height && fb->_Ymin == 0;
 }
 
+GLboolean
+nv10_use_viewport_zclear(GLcontext *ctx)
+{
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+   return context_chipset(ctx) < 0x17 &&
+   !nctx->hierz.clear_blocked && fb->_DepthBuffer &&
+   (_mesa_get_format_bits(fb->_DepthBuffer->Format,
+  GL_DEPTH_BITS) >= 24);
+}
+
+float
+nv10_transform_depth(GLcontext *ctx, float z)
+{
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
+
+   if (nv10_use_viewport_zclear(ctx))
+   return 2097152.0 * (z + (nctx->hierz.clear_seq & 7));
+   else
+   return ctx->DrawBuffer->_DepthMaxF * z;
+}
+
 static void
-nv10_clear(GLcontext *ctx, GLbitfield buffers)
+nv10_zclear(GLcontext *ctx, GLbitfield *buffers)
+{
+   /*
+* Pre-nv17 cards don't have native support for fast Z clears,
+* but in some cases we can still "clear" the Z buffer without
+* actually blitting to it if we're willing to sacrifice a few
+* bits of depth precision.
+*
+* Each time a clear is requested we modify the viewport
+* transform in such a way that the old contents of the depth
+* buffer are clamped to the requested clear value when
+* they're read by the GPU.
+*/
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
+   struct nouveau_surface *s = &to_nouveau_renderbuffer(
+   fb->_DepthBuffer->Wrapped)->surface;
+
+   if (nv10_use_viewport_zclear(ctx)) {
+   int x, y, w, h;
+   float z = ctx->Depth.Clear;
+   uint32_t value = pack_zs_f(s->format, z, 0);
+
+   get_scissors(fb, &x, &y, &w, &h);
+   *buffers &= ~BUFFER_BIT_DEPTH;
+
+   if (use_fast_zclear(ctx, *buffers)) {
+   if (nfb->hierz.clear_value != value) {
+   /* Don't fast clear if we're changing
+* the depth value. */
+   nfb->hierz.clear_value = value;
+
+   } else if (z == 0.0) {
+   nctx->hierz.clear_seq++;
+   context_dirty(ctx, ZCLEAR);
+
+   if ((nctx->hierz.clear_seq & 7) != 0 &&
+   nctx->hierz.clear_seq != 1)
+   /* We didn't wrap around -- no need to
+* clear the depth buffer for real. */
+   return;
+
+   } else if (z == 1.0) {
+   nctx->hierz.clear_seq--;
+   context_dirty(ctx, ZCLEAR);
+
+   if ((nctx->hierz.clear_seq & 7) != 7)
+   /* No wrap around */
+   return;
+   }
+   }
+
+   value = pack_zs_f(s->format,
+ (z + (nctx->hierz.clear_seq & 7)) / 8, 0);
+   context_drv(ctx)->surface_fill(ctx, s, ~0, value, x, y, w, h);
+   }
+}
+
+static void
+nv17_zclear(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(
ctx->DrawBuffer);
+   struct nouveau_surface *s = &to_nouveau_renderbuffer(
+   nfb->base.

Mesa (master): dri/nouveau: Initialize tile_flags when allocating a render target.

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

Author: Francisco Jerez 
Date:   Sat Oct  9 23:26:34 2010 +0200

dri/nouveau: Initialize tile_flags when allocating a render target.

---

 src/mesa/drivers/dri/nouveau/nouveau_surface.c |   16 
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c   |4 ++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.c 
b/src/mesa/drivers/dri/nouveau/nouveau_surface.c
index 3339397..b6b5c64 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.c
@@ -34,8 +34,8 @@ nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface 
*s,
  unsigned flags, unsigned format,
  unsigned width, unsigned height)
 {
-   unsigned tile_mode, cpp = _mesa_get_format_bytes(format);
-   int ret;
+   unsigned tile_mode = 0, tile_flags = 0;
+   int ret, cpp = _mesa_get_format_bytes(format);
 
nouveau_bo_ref(NULL, &s->bo);
 
@@ -51,13 +51,21 @@ nouveau_surface_alloc(GLcontext *ctx, struct 
nouveau_surface *s,
if (layout == TILED) {
s->pitch = align(s->pitch, 256);
tile_mode = s->pitch;
+
+   if (cpp == 4)
+   tile_flags = NOUVEAU_BO_TILE_32BPP;
+   else if (cpp == 2)
+   tile_flags = NOUVEAU_BO_TILE_16BPP;
+
+   if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+   tile_flags |= NOUVEAU_BO_TILE_ZETA;
+
} else {
s->pitch = align(s->pitch, 64);
-   tile_mode = 0;
}
 
ret = nouveau_bo_new_tile(context_dev(ctx), flags, 0, s->pitch * height,
- tile_mode, 0, &s->bo);
+ tile_mode, tile_flags, &s->bo);
assert(!ret);
 }
 
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index f9f3eba..81edbe8 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -64,8 +64,8 @@ setup_lma_buffer(GLcontext *ctx)
 
if (!nfb->hierz.bo || nfb->hierz.bo->size != size) {
nouveau_bo_ref(NULL, &nfb->hierz.bo);
-   nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
-  &nfb->hierz.bo);
+   nouveau_bo_new_tile(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
+   0, NOUVEAU_BO_TILE_ZETA, &nfb->hierz.bo);
}
 
nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET,

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


Mesa (master): nouveau: Get larger push buffers.

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

Author: Francisco Jerez 
Date:   Tue Sep 28 22:51:28 2010 +0200

nouveau: Get larger push buffers.

Useful to amortize the command submission/reloc overhead (e.g. etracer
goes from 72 to 109 FPS on nv4b).

---

 src/gallium/drivers/nouveau/nouveau_screen.c   |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_context.c |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index ebb21a6..a9426df 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -236,7 +236,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
int ret;
 
ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
-   &screen->channel);
+   512*1024, &screen->channel);
if (ret)
return ret;
screen->device = dev;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 6369e8d..1c7f600 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -128,7 +128,7 @@ nouveau_context_init(GLcontext *ctx, struct nouveau_screen 
*screen,
 
/* Allocate a hardware channel. */
ret = nouveau_channel_alloc(context_dev(ctx), 0xbeef0201, 0xbeef0202,
-   &nctx->hw.chan);
+   512*1024, &nctx->hw.chan);
if (ret) {
nouveau_error("Error initializing the FIFO.\n");
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index e4415cb..9373b93 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -32,7 +32,7 @@
 
 /* Arbitrary pushbuf length we can assume we can get with a single
  * WAIT_RING. */
-#define PUSHBUF_DWORDS 2048
+#define PUSHBUF_DWORDS 65536
 
 /* Functions to set up struct nouveau_array_state from something like
  * a GL array or index buffer. */

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


Mesa (master): dri/nouveau: Force a "slow" Z clear if we' re getting a new depth buffer.

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

Author: Francisco Jerez 
Date:   Fri Oct 22 13:43:57 2010 +0200

dri/nouveau: Force a "slow" Z clear if we're getting a new depth buffer.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index d3e2c0d..0ace139 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -180,6 +180,7 @@ void
 nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
 {
struct gl_context *ctx = dri_ctx->driverPrivate;
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
__DRIscreen *screen = dri_ctx->driScreenPriv;
struct gl_framebuffer *fb = draw->driverPrivate;
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
@@ -211,6 +212,7 @@ 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_name;
int index;
 
switch (buffers[i].attachment) {
@@ -240,6 +242,16 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
s->pitch = buffers[i].pitch;
s->cpp = buffers[i].cpp;
 
+   if (index == BUFFER_DEPTH && s->bo) {
+   ret = nouveau_bo_handle_get(s->bo, &old_name);
+   /*
+* Disable fast Z clears in the next frame, the
+* depth buffer contents are undefined.
+*/
+   if (!ret && old_name != buffers[i].name)
+   nctx->hierz.clear_seq = 0;
+   }
+
nouveau_bo_ref(NULL, &s->bo);
ret = nouveau_bo_handle_ref(context_dev(ctx),
buffers[i].name, &s->bo);

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


Mesa (master): dri/nouveau: Don't assert(0) on compressed internal formats.

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

Author: Francisco Jerez 
Date:   Fri Oct 29 21:44:54 2010 +0200

dri/nouveau: Don't assert(0) on compressed internal formats.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index cd06370..9254a9e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -115,6 +115,7 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLint 
internalFormat,
case GL_RGBA12:
case GL_RGBA16:
case GL_RGB10_A2:
+   case GL_COMPRESSED_RGBA:
return MESA_FORMAT_ARGB;
case GL_RGB5_A1:
return MESA_FORMAT_ARGB1555;
@@ -124,6 +125,7 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLint 
internalFormat,
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
+   case GL_COMPRESSED_RGB:
return MESA_FORMAT_XRGB;
case 3:
case GL_R3_G3_B2:
@@ -139,6 +141,7 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLint 
internalFormat,
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_LUMINANCE8_ALPHA8:
+   case GL_COMPRESSED_LUMINANCE_ALPHA:
return MESA_FORMAT_ARGB;
 
case 1:
@@ -147,6 +150,7 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLint 
internalFormat,
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_LUMINANCE8:
+   case GL_COMPRESSED_LUMINANCE:
return MESA_FORMAT_L8;
 
case GL_ALPHA:
@@ -154,6 +158,7 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLint 
internalFormat,
case GL_ALPHA12:
case GL_ALPHA16:
case GL_ALPHA8:
+   case GL_COMPRESSED_ALPHA:
return MESA_FORMAT_A8;
 
case GL_INTENSITY:

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


Mesa (master): dri/nv20: Clear with the 3D engine.

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

Author: Francisco Jerez 
Date:   Sat Oct 23 03:01:06 2010 +0200

dri/nv20: Clear with the 3D engine.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index c6111a2..4ca7cd6 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -26,6 +26,8 @@
 
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
+#include "nouveau_fbo.h"
+#include "nouveau_util.h"
 #include "nouveau_class.h"
 #include "nv04_driver.h"
 #include "nv10_driver.h"
@@ -40,6 +42,57 @@ static const struct dri_extension nv20_extensions[] = {
 };
 
 static void
+nv20_clear(struct gl_context *ctx, GLbitfield buffers)
+{
+   struct nouveau_channel *chan = context_chan(ctx);
+   struct nouveau_grobj *kelvin = context_eng3d(ctx);
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+   uint32_t clear = 0;
+
+   nouveau_validate_framebuffer(ctx);
+
+   if (buffers & BUFFER_BITS_COLOR) {
+   struct nouveau_surface *s = &to_nouveau_renderbuffer(
+   fb->_ColorDrawBuffers[0])->surface;
+
+   if (ctx->Color.ColorMask[0][RCOMP])
+   clear |= NV20TCL_CLEAR_BUFFERS_COLOR_R;
+   if (ctx->Color.ColorMask[0][GCOMP])
+   clear |= NV20TCL_CLEAR_BUFFERS_COLOR_G;
+   if (ctx->Color.ColorMask[0][BCOMP])
+   clear |= NV20TCL_CLEAR_BUFFERS_COLOR_B;
+   if (ctx->Color.ColorMask[0][ACOMP])
+   clear |= NV20TCL_CLEAR_BUFFERS_COLOR_A;
+
+   BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_VALUE, 1);
+   OUT_RING(chan, pack_rgba_f(s->format, ctx->Color.ClearColor));
+
+   buffers &= ~BUFFER_BITS_COLOR;
+   }
+
+   if (buffers & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) {
+   struct nouveau_surface *s = &to_nouveau_renderbuffer(
+   fb->_DepthBuffer->Wrapped)->surface;
+
+   if (buffers & BUFFER_BIT_DEPTH && ctx->Depth.Mask)
+   clear |= NV20TCL_CLEAR_BUFFERS_DEPTH;
+   if (buffers & BUFFER_BIT_STENCIL && ctx->Stencil.WriteMask[0])
+   clear |= NV20TCL_CLEAR_BUFFERS_STENCIL;
+
+   BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_DEPTH_VALUE, 1);
+   OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear,
+ctx->Stencil.Clear));
+
+   buffers &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
+   }
+
+   BEGIN_RING(chan, kelvin, NV20TCL_CLEAR_BUFFERS, 1);
+   OUT_RING(chan, clear);
+
+   nouveau_clear(ctx, buffers);
+}
+
+static void
 nv20_hwctx_init(struct gl_context *ctx)
 {
struct nouveau_channel *chan = context_chan(ctx);
@@ -410,6 +463,7 @@ nv20_context_create(struct nouveau_screen *screen, const 
struct gl_config *visua
ctx->Const.MaxTextureUnits = NV20_TEXTURE_UNITS;
ctx->Const.MaxTextureMaxAnisotropy = 8;
ctx->Const.MaxTextureLodBias = 15;
+   ctx->Driver.Clear = nv20_clear;
 
/* 2D engine. */
ret = nv04_surface_init(ctx);

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


Mesa (master): dri/nouveau: Call _mesa_update_state() after framebuffer invalidation.

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

Author: Francisco Jerez 
Date:   Mon Oct 25 21:35:54 2010 +0200

dri/nouveau: Call _mesa_update_state() after framebuffer invalidation.

Previously nouveau_state_emit() was being called directly, sometimes
that doesn't work because it doesn't update the derived GL context.

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 0ace139..c6cf781 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -365,5 +365,6 @@ nouveau_validate_framebuffer(struct gl_context *ctx)
validate_framebuffer(dri_ctx, dri_read,
 &dri_ctx->dri2.read_stamp);
 
-   nouveau_state_emit(ctx);
+   if (ctx->NewState & _NEW_BUFFERS)
+   _mesa_update_state(ctx);
 }
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index fdcb43b..78be401 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -24,6 +24,7 @@
  *
  */
 
+#include "main/state.h"
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
 #include "nouveau_fbo.h"
@@ -184,6 +185,9 @@ nv10_clear(struct gl_context *ctx, GLbitfield buffers)
nv17_zclear(ctx, &buffers);
else
nv10_zclear(ctx, &buffers);
+
+   /* Emit the zclear state if it's dirty */
+   _mesa_update_state(ctx);
}
 
nouveau_clear(ctx, buffers);

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


Mesa (master): dri/nv25: Bind a hierarchical depth buffer.

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

Author: Francisco Jerez 
Date:   Fri Oct 29 21:53:56 2010 +0200

dri/nv25: Bind a hierarchical depth buffer.

---

 src/mesa/drivers/dri/nouveau/nouveau_bo_state.h |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_class.h|2 +
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c|6 ++--
 src/mesa/drivers/dri/nouveau/nv20_context.c |4 ---
 src/mesa/drivers/dri/nouveau/nv20_state_fb.c|   28 +++
 5 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h 
b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h
index 6119a83..388a16a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h
@@ -29,7 +29,7 @@
 
 enum {
NOUVEAU_BO_CONTEXT_FRAMEBUFFER = 0,
-   NOUVEAU_BO_CONTEXT_LMA_DEPTH,
+   NOUVEAU_BO_CONTEXT_HIERZ,
NOUVEAU_BO_CONTEXT_SURFACE,
NOUVEAU_BO_CONTEXT_TEXTURE0,
NOUVEAU_BO_CONTEXT_TEXTURE1,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h 
b/src/mesa/drivers/dri/nouveau/nouveau_class.h
index d41d431..687b847 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_class.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h
@@ -4954,6 +4954,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define  NV25TCL_DMA_IN_MEMORY5
0x01a0
 #define  NV25TCL_DMA_IN_MEMORY8
0x01ac
 #define  NV25TCL_DMA_IN_MEMORY9
0x01b0
+#define  NV25TCL_HIERZ_PITCH   
0x022c
+#define  NV25TCL_HIERZ_OFFSET  
0x0230
 
 #endif /* NOUVEAU_REG_H */
 
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index d87fe96..0fda9fa 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -51,11 +51,11 @@ get_rt_format(gl_format format)
 }
 
 static void
-setup_lma_buffer(struct gl_context *ctx)
+setup_hierz_buffer(struct gl_context *ctx)
 {
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
-   struct nouveau_bo_context *bctx = context_bctx(ctx, LMA_DEPTH);
+   struct nouveau_bo_context *bctx = context_bctx(ctx, HIERZ);
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
unsigned pitch = align(fb->Width, 128),
@@ -135,7 +135,7 @@ nv10_emit_framebuffer(struct gl_context *ctx, int emit)
 s->bo, 0, bo_flags);
 
if (context_chipset(ctx) >= 0x17) {
-   setup_lma_buffer(ctx);
+   setup_hierz_buffer(ctx);
context_dirty(ctx, ZCLEAR);
}
}
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 4ca7cd6..c31fd39 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -187,10 +187,6 @@ nv20_hwctx_init(struct gl_context *ctx)
OUT_RING  (chan, 2);
 
if (context_chipset(ctx) >= 0x25) {
-   BEGIN_RING(chan, kelvin, 0x022c, 2);
-   OUT_RING  (chan, 0x280);
-   OUT_RING  (chan, 0x07d28000);
-
BEGIN_RING(chan, kelvin, 0x1da4, 1);
OUT_RING  (chan, 0);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 7822ca2..854392f 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -51,6 +51,31 @@ get_rt_format(gl_format format)
}
 }
 
+static void
+setup_hierz_buffer(struct gl_context *ctx)
+{
+   struct nouveau_channel *chan = context_chan(ctx);
+   struct nouveau_grobj *kelvin = context_eng3d(ctx);
+   struct nouveau_bo_context *bctx = context_bctx(ctx, HIERZ);
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
+   unsigned pitch = align(fb->Width, 128),
+   height = align(fb->Height, 2),
+   size = pitch * height;
+
+   if (!nfb->hierz.bo || nfb->hierz.bo->size != size) {
+   nouveau_bo_ref(NULL, &nfb->hierz.bo);
+   nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
+  &nfb->hierz.bo);
+   }
+
+   BEGIN_RING(chan, kelvin, NV25TC

Mesa (master): dri/nouveau: Honor the access flags in nouveau_bufferobj_map_range.

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

Author: Francisco Jerez 
Date:   Sun Oct 31 01:30:55 2010 +0200

dri/nouveau: Honor the access flags in nouveau_bufferobj_map_range.

---

 src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c |   72 --
 1 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c 
b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
index ad6e5bd..c145341 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
@@ -30,6 +30,21 @@
 
 #include "main/bufferobj.h"
 
+static inline char *
+get_bufferobj_map(struct gl_buffer_object *obj, unsigned flags)
+{
+   struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
+   void *map = NULL;
+
+   if (nbo->bo) {
+   nouveau_bo_map(nbo->bo, flags);
+   map = nbo->bo->map;
+   nouveau_bo_unmap(nbo->bo);
+   }
+
+   return map;
+}
+
 static struct gl_buffer_object *
 nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target)
 {
@@ -70,11 +85,8 @@ nouveau_bufferobj_data(struct gl_context *ctx, GLenum 
target, GLsizeiptrARB size
 size, &nbo->bo);
assert(!ret);
 
-   if (data) {
-   nouveau_bo_map(nbo->bo, NOUVEAU_BO_WR);
-   memcpy(nbo->bo->map, data, size);
-   nouveau_bo_unmap(nbo->bo);
-   }
+   if (data)
+   memcpy(get_bufferobj_map(obj, NOUVEAU_BO_WR), data, size);
 
return GL_TRUE;
 }
@@ -84,11 +96,7 @@ nouveau_bufferobj_subdata(struct gl_context *ctx, GLenum 
target, GLintptrARB off
  GLsizeiptrARB size, const GLvoid *data,
  struct gl_buffer_object *obj)
 {
-   struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
-
-   nouveau_bo_map(nbo->bo, NOUVEAU_BO_WR);
-   memcpy(nbo->bo->map + offset, data, size);
-   nouveau_bo_unmap(nbo->bo);
+   memcpy(get_bufferobj_map(obj, NOUVEAU_BO_WR) + offset, data, size);
 }
 
 static void
@@ -96,44 +104,48 @@ nouveau_bufferobj_get_subdata(struct gl_context *ctx, 
GLenum target, GLintptrARB
   GLsizeiptrARB size, GLvoid *data,
   struct gl_buffer_object *obj)
 {
-   struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
-
-   nouveau_bo_map(nbo->bo, NOUVEAU_BO_RD);
-   memcpy(data, nbo->bo->map + offset, size);
-   nouveau_bo_unmap(nbo->bo);
+   memcpy(data, get_bufferobj_map(obj, NOUVEAU_BO_RD) + offset, size);
 }
 
 static void *
 nouveau_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
   struct gl_buffer_object *obj)
 {
-   return ctx->Driver.MapBufferRange(ctx, target, 0, obj->Size, access,
+   unsigned flags = 0;
+
+   if (access == GL_READ_ONLY_ARB ||
+   access == GL_READ_WRITE_ARB)
+   flags |= GL_MAP_READ_BIT;
+   if (access == GL_WRITE_ONLY_ARB ||
+   access == GL_READ_WRITE_ARB)
+   flags |= GL_MAP_WRITE_BIT;
+
+   return ctx->Driver.MapBufferRange(ctx, target, 0, obj->Size, flags,
  obj);
 }
 
 static void *
 nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr 
offset,
-   GLsizeiptr length, GLenum access,
+   GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *obj)
 {
-   struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
-   uint32_t flags = 0;
+   unsigned flags = 0;
+   char *map;
 
assert(!obj->Pointer);
 
-   if (!nbo->bo)
-   return NULL;
-
-   if (access == GL_READ_ONLY_ARB ||
-   access == GL_READ_WRITE_ARB)
+   if (access & GL_MAP_READ_BIT)
flags |= NOUVEAU_BO_RD;
-   if (access == GL_WRITE_ONLY_ARB ||
-   access == GL_READ_WRITE_ARB)
+   if (access & GL_MAP_WRITE_BIT)
flags |= NOUVEAU_BO_WR;
+   if (access & GL_MAP_UNSYNCHRONIZED_BIT)
+   flags |= NOUVEAU_BO_NOSYNC;
 
-   nouveau_bo_map_range(nbo->bo, offset, length, flags);
+   map = get_bufferobj_map(obj, flags);
+   if (!map)
+   return NULL;
 
-   obj->Pointer = nbo->bo->map;
+   obj->Pointer = map + offset;
obj->Offset = offset;
obj->Length = length;
obj->AccessFlags = access;
@@ -144,12 +156,8 @@ nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum 
target, GLintptr offs
 static GLboolean
 nouveau_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct 
gl_buffer_object *obj)
 {
-   str

  1   2   3   4   5   6   7   >