gallium/hud: typedef and use hud_st_invalidate_state_func to avoid cast

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20042>
This commit is contained in:
Yonggang Luo
2022-12-10 04:10:36 +08:00
committed by Marge Bot
parent e4e4ba2304
commit a23488d63e
6 changed files with 16 additions and 9 deletions
+4 -3
View File
@@ -1673,8 +1673,8 @@ hud_unset_draw_context(struct hud_context *hud)
static bool
hud_set_draw_context(struct hud_context *hud, struct cso_context *cso,
void *st,
void (*st_invalidate_state)(void *st, unsigned flags))
struct st_context *st,
hud_st_invalidate_state_func st_invalidate_state)
{
struct pipe_context *pipe = cso_get_pipe_context(cso);
@@ -1857,7 +1857,8 @@ hud_set_record_context(struct hud_context *hud, struct pipe_context *pipe)
*/
struct hud_context *
hud_create(struct cso_context *cso, struct hud_context *share,
void *st, void (*st_invalidate_state)(void *st, unsigned flags))
struct st_context *st,
hud_st_invalidate_state_func st_invalidate_state)
{
const char *share_env = debug_get_option("GALLIUM_HUD_SHARE", NULL);
unsigned record_ctx = 0, draw_ctx = 0;
+6 -1
View File
@@ -33,10 +33,15 @@ struct cso_context;
struct pipe_context;
struct pipe_resource;
struct util_queue_monitoring;
struct st_context;
typedef void (*hud_st_invalidate_state_func)(struct st_context *st,
unsigned flags);
struct hud_context *
hud_create(struct cso_context *cso, struct hud_context *share,
void *st, void (*st_invalidate_state)(void *st, unsigned flags));
struct st_context *st,
hud_st_invalidate_state_func st_invalidate_state);
void
hud_destroy(struct hud_context *hud, struct cso_context *cso);
+3 -2
View File
@@ -32,6 +32,7 @@
#include "pipe/p_state.h"
#include "util/list.h"
#include "hud/font.h"
#include "hud/hud_context.h"
#include "cso_cache/cso_context.h"
enum hud_counter {
@@ -53,8 +54,8 @@ struct hud_context {
struct cso_context *cso;
/* For notifying st_context to rebind states that we clobbered. */
void *st;
void (*st_invalidate_state)(void *st, unsigned flags);
struct st_context *st;
hud_st_invalidate_state_func st_invalidate_state;
struct hud_batch_query_context *batch_query;
struct list_head pane_list;
+1 -1
View File
@@ -192,7 +192,7 @@ dri_create_context(struct dri_screen *screen,
ctx->st, (void*)st_context_invalidate_state);
ctx->hud = hud_create(ctx->st->cso_context,
share_ctx ? share_ctx->hud : NULL,
ctx->st, (void*)st_context_invalidate_state);
ctx->st, st_context_invalidate_state);
}
/* Do this last. */
+1 -1
View File
@@ -1014,7 +1014,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
c->st->frontend_context = (void *) c;
c->hud = hud_create(c->st->cso_context, NULL, c->st,
(void*)st_context_invalidate_state);
st_context_invalidate_state);
return c;
+1 -1
View File
@@ -253,7 +253,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCt
if (ctx->st->cso_context) {
ctx->hud = hud_create(ctx->st->cso_context, NULL, ctx->st,
(void*)st_context_invalidate_state);
st_context_invalidate_state);
}
return ctx;