const union pipe_color_union *color, double depth, unsigned stencil)
{
struct etna_context *ctx = etna_context(pctx);
+ mtx_lock(&ctx->lock);
etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, 0x00000c23);
etna_set_state(ctx->stream, VIVS_TS_FLUSH_CACHE, VIVS_TS_FLUSH_CACHE_FLUSH);
etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, 0x00000c23);
else
etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, 0x00000002);
+ mtx_unlock(&ctx->lock);
}
-
static bool
etna_try_blt_blit(struct pipe_context *pctx,
const struct pipe_blit_info *blit_info)
return true;
}
+ mtx_lock(&ctx->lock);
/* Kick off BLT here */
if (src == dst && src_lev->ts_compress_fmt < 0) {
/* Resolve-in-place */
dst->seqno++;
dst_lev->ts_valid = false;
+ mtx_unlock(&ctx->lock);
return true;
}
struct etna_context *ctx = etna_context(pctx);
struct etna_screen *screen = ctx->screen;
- mtx_lock(&screen->lock);
+ mtx_lock(&ctx->lock);
if (ctx->used_resources_read) {
/*
_mesa_set_destroy(ctx->used_resources_write, NULL);
}
- mtx_unlock(&screen->lock);
+ mtx_unlock(&ctx->lock);
if (ctx->dummy_rt)
etna_bo_del(ctx->dummy_rt);
if (ctx->in_fence_fd != -1)
close(ctx->in_fence_fd);
+ mtx_destroy(&ctx->lock);
+
FREE(pctx);
}
if (!etna_state_update(ctx))
return;
+ mtx_lock(&ctx->lock);
+
/*
* Figure out the buffers/features we need:
*/
* draw op has caused the hang. */
etna_stall(ctx->stream, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
}
+ mtx_unlock(&ctx->lock);
if (DBG_ENABLED(ETNA_DBG_FLUSH_ALL))
pctx->flush(pctx, NULL, 0);
struct etna_screen *screen = ctx->screen;
int out_fence_fd = -1;
- mtx_lock(&screen->lock);
+ mtx_lock(&ctx->lock);
list_for_each_entry(struct etna_hw_query, hq, &ctx->active_hw_queries, node)
etna_hw_query_suspend(hq, ctx);
}
_mesa_set_clear(ctx->used_resources_write, NULL);
- mtx_unlock(&screen->lock);
-
etna_reset_gpu_state(ctx);
+ mtx_unlock(&ctx->lock);
}
static void
if (!ctx->used_resources_write)
goto fail;
+ mtx_init(&ctx->lock, mtx_recursive);
+
/* context ctxate setup */
ctx->specs = screen->specs;
ctx->screen = screen;
/* set of resources used by currently-unsubmitted renders */
struct set *used_resources_read;
struct set *used_resources_write;
+
+ mtx_t lock;
};
static inline struct etna_context *
if (!prsc)
return;
- mtx_lock(&screen->lock);
+ mtx_lock(&ctx->lock);
rsc = etna_resource(prsc);
_mesa_set_add(rsc->pending_ctx, ctx);
}
- mtx_unlock(&screen->lock);
+ mtx_unlock(&ctx->lock);
}
bool
const union pipe_color_union *color, double depth, unsigned stencil)
{
struct etna_context *ctx = etna_context(pctx);
+ mtx_lock(&ctx->lock);
/* Flush color and depth cache before clearing anything.
* This is especially important when coming from another surface, as
etna_blit_clear_zs_rs(pctx, ctx->framebuffer_s.zsbuf, buffers, depth, stencil);
etna_stall(ctx->stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
+ mtx_unlock(&ctx->lock);
}
static bool
width & (w_align - 1) || height & (h_align - 1))
goto manual;
+ mtx_lock(&ctx->lock);
+
/* Always flush color and depth cache together before resolving. This works
* around artifacts that appear in some cases when scanning out a texture
* directly after it has been rendered to, such as rendering an animated web
dst->seqno++;
dst_lev->ts_valid = false;
ctx->dirty |= ETNA_DIRTY_DERIVE_TS;
+ mtx_unlock(&ctx->lock);
return true;
{
struct etna_screen *screen = etna_screen(pscreen);
- mtx_destroy(&screen->lock);
-
if (screen->perfmon)
etna_perfmon_del(screen->perfmon);
if (screen->drm_version >= ETNA_DRM_VERSION_PERFMON)
etna_pm_query_setup(screen);
- mtx_init(&screen->lock, mtx_recursive);
-
return pscreen;
fail:
uint32_t drm_version;
- mtx_t lock;
-
nir_shader_compiler_options options;
};
struct etna_context *ctx = etna_context(pctx);
/* clear color and texture cache to make sure that texture unit reads
* what has been written */
+ mtx_lock(&ctx->lock);
etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_TEXTURE);
+ mtx_unlock(&ctx->lock);
}
uint32_t
* current GPU usage (reads must wait for GPU writes, writes must have
* exclusive access to the buffer).
*/
- mtx_lock(&screen->lock);
+ mtx_lock(&ctx->lock);
if ((trans->rsc && (etna_resource(trans->rsc)->status & ETNA_PENDING_WRITE)) ||
(!trans->rsc &&
}
}
- mtx_unlock(&screen->lock);
+ mtx_unlock(&ctx->lock);
if (usage & PIPE_TRANSFER_READ)
prep_flags |= DRM_ETNA_PREP_READ;