etnaviv: Use reentrant screen lock around flush
[mesa.git] / src / gallium / drivers / softpipe / sp_flush.c
index 59b8ad696ecc18faacad1167576df0503dc4859a..ef9d787ca7a555ef78468fc8dfc5edd369cf673b 100644 (file)
@@ -56,7 +56,7 @@ softpipe_flush( struct pipe_context *pipe,
    if (flags & SP_FLUSH_TEXTURE_CACHE) {
       unsigned sh;
 
-      for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
+      for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
          for (i = 0; i < softpipe->num_sampler_views[sh]; i++) {
             sp_flush_tex_tile_cache(softpipe->tex_cache[sh][i]);
          }
@@ -82,9 +82,9 @@ softpipe_flush( struct pipe_context *pipe,
    if (flags & PIPE_FLUSH_END_OF_FRAME) {
       static unsigned frame_no = 1;
       static char filename[256];
-      util_snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no);
+      snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no);
       debug_dump_surface_bmp(pipe, filename, softpipe->framebuffer.cbufs[0]);
-      util_snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no);
+      snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no);
       debug_dump_surface_bmp(pipe, filename, softpipe->framebuffer.zsbuf);
       ++frame_no;
    }
@@ -153,7 +153,7 @@ softpipe_flush_resource(struct pipe_context *pipe,
              * This is for illustrative purposes only, as softpipe does not
              * have fences.
              */
-            pipe->screen->fence_finish(pipe->screen, fence,
+            pipe->screen->fence_finish(pipe->screen, NULL, fence,
                                        PIPE_TIMEOUT_INFINITE);
             pipe->screen->fence_reference(pipe->screen, &fence, NULL);
          }
@@ -169,12 +169,12 @@ softpipe_flush_resource(struct pipe_context *pipe,
    return TRUE;
 }
 
-void softpipe_texture_barrier(struct pipe_context *pipe)
+void softpipe_texture_barrier(struct pipe_context *pipe, unsigned flags)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
    uint i, sh;
 
-   for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) {
+   for (sh = 0; sh < ARRAY_SIZE(softpipe->tex_cache); sh++) {
       for (i = 0; i < softpipe->num_sampler_views[sh]; i++) {
          sp_flush_tex_tile_cache(softpipe->tex_cache[sh][i]);
       }
@@ -192,5 +192,8 @@ void softpipe_texture_barrier(struct pipe_context *pipe)
 
 void softpipe_memory_barrier(struct pipe_context *pipe, unsigned flags)
 {
-   softpipe_texture_barrier(pipe);
+   if (!(flags & ~PIPE_BARRIER_UPDATE))
+      return;
+
+   softpipe_texture_barrier(pipe, 0);
 }