summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2017-02-18 01:26:52 -0800
committerCharmaine Lee <[email protected]>2017-02-18 09:36:42 -0800
commit043883647acaee0b2c67c1c6b496404ebb4e8d67 (patch)
treeeba737224c47e8a75f985b70518736659e3a3ac6 /src/gallium/state_trackers
parentd793b54c4e921a8560a6aac6b9949f2784a5dc73 (diff)
st/wgl: flush with ST_FLUSH_WAIT before releasing shared contexts
Before releasing a shared context, flush the context with ST_FLUSH_WAIT to make sure all commands are executed. This ensures that rendering to any shared resources is completed before they will be referenced by another context. Fixes an intermittent flickering with Photoshop. (VMware bug# 1779340) Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c16
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index b1e5f5e20fb..85cffa63529 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -104,8 +104,11 @@ DrvShareLists(DHGLRC dhglrc1, DHGLRC dhglrc2)
ctx1 = stw_lookup_context_locked( dhglrc1 );
ctx2 = stw_lookup_context_locked( dhglrc2 );
- if (ctx1 && ctx2 && ctx2->st->share)
+ if (ctx1 && ctx2 && ctx2->st->share) {
ret = ctx2->st->share(ctx2->st, ctx1->st);
+ ctx1->shared = TRUE;
+ ctx2->shared = TRUE;
+ }
stw_unlock_contexts(stw_dev);
@@ -175,6 +178,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
if (hShareContext != 0) {
stw_lock_contexts(stw_dev);
shareCtx = stw_lookup_context_locked( hShareContext );
+ shareCtx->shared = TRUE;
stw_unlock_contexts(stw_dev);
}
@@ -184,6 +188,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
ctx->hdc = hdc;
ctx->iPixelFormat = iPixelFormat;
+ ctx->shared = shareCtx != NULL;
memset(&attribs, 0, sizeof(attribs));
attribs.visual = pfi->stvis;
@@ -403,7 +408,14 @@ stw_make_current(HDC hdc, DHGLRC dhglrc)
return TRUE;
}
} else {
- old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL);
+ if (old_ctx->shared) {
+ struct pipe_fence_handle *fence = NULL;
+ old_ctx->st->flush(old_ctx->st,
+ ST_FLUSH_FRONT | ST_FLUSH_WAIT, &fence);
+ }
+ else {
+ old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL);
+ }
}
}
diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h
index 6bfa7150d6f..0f180c8e2ec 100644
--- a/src/gallium/state_trackers/wgl/stw_context.h
+++ b/src/gallium/state_trackers/wgl/stw_context.h
@@ -40,6 +40,7 @@ struct stw_context
DHGLRC dhglrc;
int iPixelFormat;
HDC hdc;
+ BOOL shared;
struct stw_framebuffer *current_framebuffer;