gallium/hud: don't use st_context_iface, use an explicit callback

st_context_iface will be removed.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20027>
This commit is contained in:
Marek Olšák 2022-11-27 13:08:53 -05:00 committed by Marge Bot
parent 64ee8d2430
commit fdec352903
7 changed files with 25 additions and 18 deletions

View file

@ -640,10 +640,10 @@ done:
/* restore states not restored by cso */
if (hud->st) {
hud->st->invalidate_state(hud->st,
ST_INVALIDATE_FS_SAMPLER_VIEWS |
ST_INVALIDATE_VS_CONSTBUF0 |
ST_INVALIDATE_VERTEX_BUFFERS);
hud->st_invalidate_state(hud->st,
ST_INVALIDATE_FS_SAMPLER_VIEWS |
ST_INVALIDATE_VS_CONSTBUF0 |
ST_INVALIDATE_VERTEX_BUFFERS);
}
pipe_surface_reference(&surf, NULL);
@ -1673,7 +1673,8 @@ hud_unset_draw_context(struct hud_context *hud)
static bool
hud_set_draw_context(struct hud_context *hud, struct cso_context *cso,
struct st_context_iface *st)
void *st,
void (*st_invalidate_state)(void *st, unsigned flags))
{
struct pipe_context *pipe = cso_get_pipe_context(cso);
@ -1681,6 +1682,7 @@ hud_set_draw_context(struct hud_context *hud, struct cso_context *cso,
hud->pipe = pipe;
hud->cso = cso;
hud->st = st;
hud->st_invalidate_state = st_invalidate_state;
struct pipe_sampler_view view_templ;
u_sampler_view_default_template(
@ -1854,8 +1856,8 @@ hud_set_record_context(struct hud_context *hud, struct pipe_context *pipe)
* record queries in one context and draw them in another.
*/
struct hud_context *
hud_create(struct cso_context *cso, struct st_context_iface *st,
struct hud_context *share)
hud_create(struct cso_context *cso, struct hud_context *share,
void *st, void (*st_invalidate_state)(void *st, unsigned flags))
{
const char *share_env = debug_get_option("GALLIUM_HUD_SHARE", NULL);
unsigned record_ctx = 0, draw_ctx = 0;
@ -1879,7 +1881,7 @@ hud_create(struct cso_context *cso, struct st_context_iface *st,
if (context_id == draw_ctx) {
assert(!share->pipe);
hud_set_draw_context(share, cso, st);
hud_set_draw_context(share, cso, st, st_invalidate_state);
}
return share;
@ -2002,7 +2004,7 @@ hud_create(struct cso_context *cso, struct st_context_iface *st,
if (record_ctx == 0)
hud_set_record_context(hud, cso_get_pipe_context(cso));
if (draw_ctx == 0)
hud_set_draw_context(hud, cso, st);
hud_set_draw_context(hud, cso, st, st_invalidate_state);
hud_parse_env_var(hud, screen, env);
return hud;

View file

@ -33,11 +33,10 @@ struct cso_context;
struct pipe_context;
struct pipe_resource;
struct util_queue_monitoring;
struct st_context_iface;
struct hud_context *
hud_create(struct cso_context *cso, struct st_context_iface *st,
struct hud_context *share);
hud_create(struct cso_context *cso, struct hud_context *share,
void *st, void (*st_invalidate_state)(void *st, unsigned flags));
void
hud_destroy(struct hud_context *hud, struct cso_context *cso);

View file

@ -51,7 +51,10 @@ struct hud_context {
/* Context where the HUD is drawn: */
struct pipe_context *pipe;
struct cso_context *cso;
struct st_context_iface *st;
/* For notifying st_context to rebind states that we clobbered. */
void *st;
void (*st_invalidate_state)(void *st, unsigned flags);
struct hud_batch_query_context *batch_query;
struct list_head pane_list;

View file

@ -202,8 +202,9 @@ dri_create_context(struct dri_screen *screen,
if (ctx->st->cso_context) {
ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context,
ctx->st);
ctx->hud = hud_create(ctx->st->cso_context, ctx->st,
share_ctx ? share_ctx->hud : NULL);
ctx->hud = hud_create(ctx->st->cso_context,
share_ctx ? share_ctx->hud : NULL,
ctx->st, (void*)ctx->st->invalidate_state);
}
/* Do this last. */

View file

@ -1011,7 +1011,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
c->st->frontend_context = (void *) c;
c->hud = hud_create(c->st->cso_context, c->st, NULL);
c->hud = hud_create(c->st->cso_context, NULL, c->st,
(void*)c->st->invalidate_state);
return c;

View file

@ -269,7 +269,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, NULL); /* NULL result is fine */
This->hud = hud_create(This->context.cso, NULL, NULL, NULL); /* NULL result is fine */
This->allocator = nine_allocator_create(This, pCTX->memfd_virtualsizelimit);

View file

@ -249,7 +249,8 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCt
ctx->st->frontend_context = (void *) ctx;
if (ctx->st->cso_context) {
ctx->hud = hud_create(ctx->st->cso_context, ctx->st, NULL);
ctx->hud = hud_create(ctx->st->cso_context, NULL, ctx->st,
(void*)ctx->st->invalidate_state);
}
return ctx;