radeonsi: enable GL_EXT_shader_image_load_formatted
[mesa.git] / src / gallium / drivers / etnaviv / etnaviv_resource.c
index 4437eedfcaba628242911592d97d95fc2b6401c8..83179d3cd0880bf2da6486287aae9fbc958c02a3 100644 (file)
@@ -238,7 +238,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
    if (!screen->specs.use_blt && templat->target != PIPE_BUFFER)
       etna_adjust_rs_align(screen->specs.pixel_pipes, NULL, &paddingY);
 
-   if (templat->bind & PIPE_BIND_SCANOUT) {
+   if (templat->bind & PIPE_BIND_SCANOUT && screen->ro->kms_fd >= 0) {
       struct pipe_resource scanout_templat = *templat;
       struct renderonly_scanout *scanout;
       struct winsys_handle handle;
@@ -646,7 +646,6 @@ etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc,
                    enum etna_resource_status status)
 {
    struct etna_screen *screen = ctx->screen;
-   struct set_entry *entry;
    struct etna_resource *rsc;
 
    if (!prsc)
@@ -667,9 +666,18 @@ etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc,
          struct etna_context *extctx = (struct etna_context *)entry->key;
          struct pipe_context *pctx = &extctx->base;
 
+         if (extctx == ctx)
+            continue;
+
          pctx->flush(pctx, NULL, 0);
+         /* It's safe to clear the status here. If we need to flush it means
+          * either another context had the resource in exclusive (write) use,
+          * or we transition the resource to exclusive use in our context.
+          * In both cases the new status accurately reflects the resource use
+          * after the flush.
+          */
+         rsc->status = 0;
       }
-      rsc->status = 0;
    }
 
    rsc->status |= status;