aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-11-19 21:29:46 +0100
committerMarek Olšák <[email protected]>2017-11-25 17:16:56 +0100
commitbd57f45168188caabce3aebed287a9d32bc00537 (patch)
tree935da2ae073a1890e39dcc554e7e096a33c1562b /src/gallium/state_trackers
parent11e25eb7f4538ab7f1ca5d06e8e1ae09be10ad45 (diff)
gallium/hud: add HUD sharing within a context share group
This is needed for profiling multi-context applications like Chrome. One context can record queries and another context can draw the HUD. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/dri_context.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index d4ac8adee1b..6e28553146f 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -116,8 +116,10 @@ dri_create_context(gl_api api, const struct gl_config * visual,
&& (ctx_config->release_behavior == __DRI_CTX_RELEASE_BEHAVIOR_NONE))
attribs.flags |= ST_CONTEXT_FLAG_RELEASE_NONE;
+ struct dri_context *share_ctx = NULL;
if (sharedContextPrivate) {
- st_share = ((struct dri_context *)sharedContextPrivate)->st;
+ share_ctx = (struct dri_context *)sharedContextPrivate;
+ st_share = share_ctx->st;
}
ctx = CALLOC_STRUCT(dri_context);
@@ -168,7 +170,8 @@ dri_create_context(gl_api api, const struct gl_config * visual,
if (ctx->st->cso_context) {
ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context);
- ctx->hud = hud_create(ctx->st->cso_context, NULL);
+ ctx->hud = hud_create(ctx->st->cso_context,
+ share_ctx ? share_ctx->hud : NULL);
}
/* Do this last. */
@@ -222,6 +225,7 @@ dri_destroy_context(__DRIcontext * cPriv)
free(ctx);
}
+/* This is called inside MakeCurrent to unbind the context. */
GLboolean
dri_unbind_context(__DRIcontext * cPriv)
{
@@ -236,6 +240,10 @@ dri_unbind_context(__DRIcontext * cPriv)
if (st->thread_finish)
st->thread_finish(st);
+ /* Record HUD queries for the duration the context was "current". */
+ if (ctx->hud)
+ hud_record_only(ctx->hud, st->pipe);
+
stapi->make_current(stapi, NULL, NULL, NULL);
}
}