r300g: take advantage of KEEP_TILING_FLAGS flush flag
authorMarek Olšák <maraeo@gmail.com>
Tue, 13 Dec 2011 19:27:48 +0000 (20:27 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 13 Dec 2011 20:34:18 +0000 (21:34 +0100)
This fixes at least two multi-context-related races.

src/gallium/drivers/r300/r300_flush.c
src/gallium/drivers/r300/r300_state.c

index 8b710c1a5eea6988ec005c007d54be2e8cb805c6..9459a95cd731631df4cace609b22d97c95e7886e 100644 (file)
@@ -72,6 +72,10 @@ void r300_flush(struct pipe_context *pipe,
     if (r300->draw && !r300->draw_vbo_locked)
        r300_draw_flush_vbuf(r300);
 
+    if (r300->screen->info.drm_minor >= 12) {
+        flags |= RADEON_FLUSH_KEEP_TILING_FLAGS;
+    }
+
     if (rfence) {
         /* Create a fence, which is a dummy BO. */
         *rfence = r300->rws->buffer_create(r300->rws, 1, 1,
index b0aae534a6d17e09072784cdb4426f51a91a9dba..d704057e4667e1487bb68e566088eb05694bf70d 100644 (file)
@@ -872,8 +872,12 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
         r300_mark_atom_dirty(r300, &r300->dsa_state);
     }
 
-    /* The tiling flags are dependent on the surface miplevel, unfortunately. */
-    r300_fb_set_tiling_flags(r300, state);
+    if (r300->screen->info.drm_minor < 12) {
+       /* The tiling flags are dependent on the surface miplevel, unfortunately.
+        * This workarounds a bad design decision in old kernels which were
+        * rewriting tile fields in registers. */
+        r300_fb_set_tiling_flags(r300, state);
+    }
 
     util_copy_framebuffer_state(r300->fb_state.state, state);