Mesa (master): r300g: fix texture transfers

Marek Olšák mareko at kemper.freedesktop.org
Thu May 13 19:11:41 UTC 2010


Module: Mesa
Branch: master
Commit: 60a053510155c119a6927bf7114e597066f8c50a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=60a053510155c119a6927bf7114e597066f8c50a

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu May 13 20:32:08 2010 +0200

r300g: fix texture transfers

The regression has first shown up after this state tracker change:
b0427bedde80e3189524651a327235bdfddbc613.

FDO bug #28082.

---

 src/gallium/drivers/r300/r300_texture.c     |    2 +-
 src/gallium/drivers/r300/r300_transfer.c    |    6 ++++++
 src/gallium/winsys/radeon/drm/radeon_r300.c |    2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index c0911ae..4a5c932 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -960,7 +960,7 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
                util_format_short_name(base->format));
 
     tex->buffer = rws->buffer_create(rws, 2048,
-				     PIPE_BIND_SAMPLER_VIEW, /* XXX */
+                                     base->bind,
 				     tex->size);
     rws->buffer_set_tiling(rws, tex->buffer,
 			   tex->pitch[0],
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
index 0dae9ef..14a9bfd 100644
--- a/src/gallium/drivers/r300/r300_transfer.c
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -127,6 +127,12 @@ r300_texture_get_transfer(struct pipe_context *ctx,
     struct r300_transfer *trans;
     struct pipe_resource base;
 
+    /* XXX Why aren't flushes taken care of by winsys automatically?
+     * Winsys seems to sometimes return a cached buffer instead of
+     * a mapped hardware buffer if this flush is commented out. */
+    if (ctx->is_resource_referenced(ctx, texture, sr.face, sr.level))
+        ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
+
     trans = CALLOC_STRUCT(r300_transfer);
     if (trans) {
         /* Initialize the transfer object. */
diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c
index fb779e4..94cd528 100644
--- a/src/gallium/winsys/radeon/drm/radeon_r300.c
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.c
@@ -86,7 +86,7 @@ static void *radeon_r300_winsys_buffer_map(struct r300_winsys_screen *ws,
 					   unsigned usage)
 {
     struct pb_buffer *_buf = radeon_pb_buffer(buf);
-    
+
     return pb_map(_buf, usage);
 }
 




More information about the mesa-commit mailing list