summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_context.cpp
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2017-09-13 21:06:44 -0500
committerGeorge Kyriazis <[email protected]>2017-09-26 18:09:15 -0500
commitb9aa0fa7d646f9ebb0a2e08d262c2eebfd875610 (patch)
treeb0a1dff425b91d5aef6657ef65d6f0fbe0e02fa6 /src/gallium/drivers/swr/swr_context.cpp
parent016de7e15597c232fb9c300f41629a2d88841905 (diff)
swr: Handle resource across context changes
Swr caches fb contents in tiles. Those tiles are stored on a per-context basis. When switching contexts that share resources we need to make sure that the tiles of the old context are being stored and the tiles of the new context are being invalidated (marked as invalid, hence contents need to be reloaded). The context does not get any dirty bits to identify this case. This has to be, then, coordinated by the resources that are being shared between the contexts. Add a "curr_pipe" hook in swr_resource that will allow us to identify a MakeCurrent of the above form during swr_update_derived(). At that time, we invalidate the tiles of the new context. The old context, will need to have already store its tiles by that time, which happens during glFlush(). glFlush() is being called at the beginning of MakeCurrent. So, the sequence of operations is: - At the beginning of glXMakeCurrent(), glFlush() will store the tiles of all bound surfaces of the old context. - After the store, a fence will guarantee that the all tile store make it to the surface - During swr_update_derived(), when we validate the new context, we check all resources to see what changed, and if so, we invalidate the current tiles. Fixes rendering problems with CEI/Ensight. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_context.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_context.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
index e95bd3bcaa4..34d9a259fee 100644
--- a/src/gallium/drivers/swr/swr_context.cpp
+++ b/src/gallium/drivers/swr/swr_context.cpp
@@ -365,10 +365,20 @@ swr_destroy(struct pipe_context *pipe)
util_blitter_destroy(ctx->blitter);
for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
- pipe_surface_reference(&ctx->framebuffer.cbufs[i], NULL);
+ if (ctx->framebuffer.cbufs[i]) {
+ struct swr_resource *res = swr_resource(ctx->framebuffer.cbufs[i]->texture);
+ /* NULL curr_pipe, so we don't have a reference to a deleted pipe */
+ res->curr_pipe = NULL;
+ pipe_surface_reference(&ctx->framebuffer.cbufs[i], NULL);
+ }
}
- pipe_surface_reference(&ctx->framebuffer.zsbuf, NULL);
+ if (ctx->framebuffer.zsbuf) {
+ struct swr_resource *res = swr_resource(ctx->framebuffer.zsbuf->texture);
+ /* NULL curr_pipe, so we don't have a reference to a deleted pipe */
+ res->curr_pipe = NULL;
+ pipe_surface_reference(&ctx->framebuffer.zsbuf, NULL);
+ }
for (unsigned i = 0; i < ARRAY_SIZE(ctx->sampler_views[0]); i++) {
pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL);