gallium/hud: update the HUD interface for multiple contexts

This is the boring subset of the following commit.
All new parameters are optional.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák 2017-11-19 21:04:07 +01:00
parent 9c5b4eb6b4
commit 11e25eb7f4
9 changed files with 22 additions and 19 deletions

View File

@ -681,7 +681,8 @@ hud_stop_queries(struct hud_context *hud, struct pipe_context *pipe)
}
void
hud_run(struct hud_context *hud, struct pipe_resource *tex)
hud_run(struct hud_context *hud, struct cso_context *cso,
struct pipe_resource *tex)
{
hud_stop_queries(hud, hud->record_pipe);
hud_draw_results(hud, tex);
@ -1684,7 +1685,7 @@ hud_set_record_context(struct hud_context *hud, struct pipe_context *pipe)
}
struct hud_context *
hud_create(struct cso_context *cso)
hud_create(struct cso_context *cso, struct hud_context *share)
{
struct pipe_screen *screen = cso_get_pipe_context(cso)->screen;
struct hud_context *hud;
@ -1790,7 +1791,7 @@ hud_create(struct cso_context *cso)
}
void
hud_destroy(struct hud_context *hud)
hud_destroy(struct hud_context *hud, struct cso_context *cso)
{
hud_unset_record_context(hud);
hud_unset_draw_context(hud);

View File

@ -35,13 +35,14 @@ struct pipe_resource;
struct util_queue_monitoring;
struct hud_context *
hud_create(struct cso_context *cso);
hud_create(struct cso_context *cso, struct hud_context *share);
void
hud_destroy(struct hud_context *hud);
hud_destroy(struct hud_context *hud, struct cso_context *cso);
void
hud_run(struct hud_context *hud, struct pipe_resource *tex);
hud_run(struct hud_context *hud, struct cso_context *cso,
struct pipe_resource *tex);
void
hud_add_queue_for_monitoring(struct hud_context *hud,

View File

@ -168,7 +168,7 @@ 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);
ctx->hud = hud_create(ctx->st->cso_context, NULL);
}
/* Do this last. */
@ -206,7 +206,7 @@ dri_destroy_context(__DRIcontext * cPriv)
struct dri_context *ctx = dri_context(cPriv);
if (ctx->hud) {
hud_destroy(ctx->hud);
hud_destroy(ctx->hud, ctx->st->cso_context);
}
if (ctx->pp)

View File

@ -519,7 +519,8 @@ dri_flush(__DRIcontext *cPriv,
dri_postprocessing(ctx, drawable, ST_ATTACHMENT_BACK_LEFT);
if (ctx->hud) {
hud_run(ctx->hud, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
hud_run(ctx->hud, ctx->st->cso_context,
drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
}
pipe->flush_resource(pipe, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);

View File

@ -1035,7 +1035,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
c->st->st_manager_private = (void *) c;
c->hud = hud_create(c->st->cso_context);
c->hud = hud_create(c->st->cso_context, NULL);
return c;
@ -1051,7 +1051,7 @@ PUBLIC
void XMesaDestroyContext( XMesaContext c )
{
if (c->hud) {
hud_destroy(c->hud);
hud_destroy(c->hud, NULL);
}
c->st->destroy(c->st);
@ -1357,7 +1357,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
if (xmctx && xmctx->hud) {
struct pipe_resource *back =
xmesa_get_framebuffer_resource(b->stfb, ST_ATTACHMENT_BACK_LEFT);
hud_run(xmctx->hud, back);
hud_run(xmctx->hud, NULL, back);
}
if (xmctx && xmctx->xm_buffer == b) {

View File

@ -205,7 +205,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
if (!This->cso_sw) { return E_OUTOFMEMORY; }
/* Create first, it messes up our state. */
This->hud = hud_create(This->context.cso); /* NULL result is fine */
This->hud = hud_create(This->context.cso, NULL); /* NULL result is fine */
/* Available memory counter. Updated only for allocations with this device
* instance. This is the Win 7 behavior.

View File

@ -606,7 +606,7 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, struct pipe_resource *r
if (device->hud && resource) {
/* Implicit use of context pipe */
(void)NineDevice9_GetPipe(This->base.device);
hud_run(device->hud, resource); /* XXX: no offset */
hud_run(device->hud, NULL, resource); /* XXX: no offset */
/* HUD doesn't clobber stipple */
nine_state_restore_non_cso(device);
}

View File

@ -278,7 +278,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
ctx->st->st_manager_private = (void *) ctx;
if (ctx->st->cso_context) {
ctx->hud = hud_create(ctx->st->cso_context);
ctx->hud = hud_create(ctx->st->cso_context, NULL);
}
stw_lock_contexts(stw_dev);
@ -291,7 +291,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
if (old_ctx) {
/* free the old context data associated with this handle */
if (old_ctx->hud) {
hud_destroy(old_ctx->hud);
hud_destroy(old_ctx->hud, NULL);
}
ctx->st->destroy(old_ctx->st);
FREE(old_ctx);
@ -316,7 +316,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
no_hglrc:
if (ctx->hud) {
hud_destroy(ctx->hud);
hud_destroy(ctx->hud, NULL);
}
ctx->st->destroy(ctx->st);
no_st_ctx:
@ -348,7 +348,7 @@ DrvDeleteContext(DHGLRC dhglrc)
stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
if (ctx->hud) {
hud_destroy(ctx->hud);
hud_destroy(ctx->hud, NULL);
}
ctx->st->destroy(ctx->st);

View File

@ -641,7 +641,7 @@ DrvSwapBuffers(HDC hdc)
struct pipe_resource *back =
stw_get_framebuffer_resource(fb->stfb, ST_ATTACHMENT_BACK_LEFT);
if (back) {
hud_run(ctx->hud, back);
hud_run(ctx->hud, NULL, back);
}
}