From fa02fb5ccae8adf8602bba966ec8b269745512b6 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 10 Dec 2022 04:11:32 +0800 Subject: [PATCH] gallium/pp: typedef and use pp_st_invalidate_state_func to avoid cast Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Part-of: --- src/gallium/auxiliary/postprocess/postprocess.h | 8 ++++++-- src/gallium/auxiliary/postprocess/pp_init.c | 4 ++-- src/gallium/auxiliary/postprocess/pp_private.h | 8 ++++---- src/gallium/auxiliary/postprocess/pp_program.c | 4 ++-- src/gallium/frontends/dri/dri_context.c | 2 +- src/gallium/frontends/osmesa/osmesa.c | 2 +- src/gallium/targets/haiku-softpipe/GalliumContext.cpp | 4 ++-- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/postprocess/postprocess.h b/src/gallium/auxiliary/postprocess/postprocess.h index e6f3c82..c215b03 100644 --- a/src/gallium/auxiliary/postprocess/postprocess.h +++ b/src/gallium/auxiliary/postprocess/postprocess.h @@ -35,6 +35,7 @@ extern "C" { #endif struct cso_context; +struct st_context; struct pp_queue_t; /* Forward definition */ struct pp_program; @@ -43,6 +44,9 @@ struct pp_program; typedef void (*pp_func) (struct pp_queue_t *, struct pipe_resource *, struct pipe_resource *, unsigned int); +typedef void (*pp_st_invalidate_state_func)(struct st_context *st, + unsigned flags); + /* Main functions */ /** @@ -53,8 +57,8 @@ typedef void (*pp_func) (struct pp_queue_t *, struct pipe_resource *, struct pp_queue_t *pp_init(struct pipe_context *pipe, const unsigned int *enabled, struct cso_context *, - void *st, - void (*st_invalidate_state)(void *st, unsigned flags)); + struct st_context *st, + pp_st_invalidate_state_func st_invalidate_state); void pp_run(struct pp_queue_t *, struct pipe_resource *, struct pipe_resource *, struct pipe_resource *); diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c index 7733e25..4d551db 100644 --- a/src/gallium/auxiliary/postprocess/pp_init.c +++ b/src/gallium/auxiliary/postprocess/pp_init.c @@ -40,8 +40,8 @@ /** Initialize the post-processing queue. */ struct pp_queue_t * pp_init(struct pipe_context *pipe, const unsigned int *enabled, - struct cso_context *cso, void *st, - void (*st_invalidate_state)(void *st, unsigned flags)) + struct cso_context *cso, struct st_context *st, + pp_st_invalidate_state_func st_invalidate_state) { unsigned int num_filters = 0; unsigned int curpos = 0, i, tmp_req = 0; diff --git a/src/gallium/auxiliary/postprocess/pp_private.h b/src/gallium/auxiliary/postprocess/pp_private.h index 45fbe84..32e7c3a 100644 --- a/src/gallium/auxiliary/postprocess/pp_private.h +++ b/src/gallium/auxiliary/postprocess/pp_private.h @@ -43,8 +43,8 @@ struct pp_program 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; + pp_st_invalidate_state_func st_invalidate_state; struct pipe_blend_state blend; struct pipe_depth_stencil_alpha_state depthstencil; @@ -98,8 +98,8 @@ void pp_free_fbos(struct pp_queue_t *); void pp_debug(const char *, ...); struct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe, - struct cso_context *, void *st, - void (*st_invalidate_state)(void *st, unsigned flags)); + struct cso_context *, struct st_context *st, + pp_st_invalidate_state_func st_invalidate_state); void pp_blit(struct pipe_context *pipe, struct pipe_resource *src_tex, diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index c078678..3f36434 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -41,8 +41,8 @@ /** Initialize the internal details */ struct pp_program * pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe, - struct cso_context *cso, void *st, - void (*st_invalidate_state)(void *st, unsigned flags)) + struct cso_context *cso, struct st_context *st, + pp_st_invalidate_state_func st_invalidate_state) { struct pp_program *p; diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c index de21c78..7676f55 100644 --- a/src/gallium/frontends/dri/dri_context.c +++ b/src/gallium/frontends/dri/dri_context.c @@ -189,7 +189,7 @@ 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, (void*)st_context_invalidate_state); + ctx->st, st_context_invalidate_state); ctx->hud = hud_create(ctx->st->cso_context, share_ctx ? share_ctx->hud : NULL, ctx->st, st_context_invalidate_state); diff --git a/src/gallium/frontends/osmesa/osmesa.c b/src/gallium/frontends/osmesa/osmesa.c index 0fdf878..ce07c92 100644 --- a/src/gallium/frontends/osmesa/osmesa.c +++ b/src/gallium/frontends/osmesa/osmesa.c @@ -796,7 +796,7 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type, osmesa->pp_enabled, osmesa->st->cso_context, osmesa->st, - (void*)st_context_invalidate_state); + st_context_invalidate_state); pp_init_fbos(osmesa->pp, width, height); } diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp index 3f80275..6cef5ad 100644 --- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp +++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp @@ -204,13 +204,13 @@ GalliumContext::CreateContext(HGLWinsysContext *wsContext) assert(!context->st->frontend_context); context->st->frontend_context = (void*)context; - struct st_context *stContext = (struct st_context*)context->st; + struct st_context *stContext = context->st; // Init Gallium3D Post Processing // TODO: no pp filters are enabled yet through postProcessEnable context->postProcess = pp_init(stContext->pipe, context->postProcessEnable, stContext->cso_context, stContext, - (void*)st_context_invalidate_state); + st_context_invalidate_state); context_id contextNext = -1; Lock(); -- 2.7.4