r300g: fix texture transfers
authorMarek Olšák <maraeo@gmail.com>
Thu, 13 May 2010 18:32:08 +0000 (20:32 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 13 May 2010 19:11:20 +0000 (21:11 +0200)
The regression has first shown up after this state tracker change:
b0427bedde80e3189524651a327235bdfddbc613.

FDO bug #28082.

src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/winsys/radeon/drm/radeon_r300.c

index c0911aef385736e20698a106e2b96fffd509d090..4a5c932b7e864ca8984912598c48240854773815 100644 (file)
@@ -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],
index 0dae9ef98b739473185edaa6034ae8dae17be9a5..14a9bfd86501f0e52abb4023fa8e64cf55fa38f2 100644 (file)
@@ -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. */
index fb779e4033b37c8e93b865738973cc39f2a40f3d..94cd5281e268c29aaee77cb255e2a9e8218bc3f1 100644 (file)
@@ -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);
 }