gallium/pp: don't use st_context_iface, use an explicit callback
authorMarek Olšák <marek.olsak@amd.com>
Sun, 27 Nov 2022 18:15:16 +0000 (13:15 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 9 Dec 2022 13:14:03 +0000 (13:14 +0000)
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>

src/gallium/auxiliary/postprocess/postprocess.h
src/gallium/auxiliary/postprocess/pp_init.c
src/gallium/auxiliary/postprocess/pp_private.h
src/gallium/auxiliary/postprocess/pp_program.c
src/gallium/auxiliary/postprocess/pp_run.c
src/gallium/frontends/dri/dri_context.c
src/gallium/frontends/osmesa/osmesa.c
src/gallium/targets/haiku-softpipe/GalliumContext.cpp

index 293bd5a..d19bcd0 100644 (file)
@@ -54,7 +54,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 *,
-                           struct st_context_iface *st);
+                           void *st,
+                           void (*st_invalidate_state)(void *st, unsigned flags));
 
 void pp_run(struct pp_queue_t *, struct pipe_resource *,
             struct pipe_resource *, struct pipe_resource *);
index bbab41b..7733e25 100644 (file)
@@ -40,7 +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, struct st_context_iface *st)
+        struct cso_context *cso, void *st,
+        void (*st_invalidate_state)(void *st, unsigned flags))
 {
    unsigned int num_filters = 0;
    unsigned int curpos = 0, i, tmp_req = 0;
@@ -78,7 +79,7 @@ pp_init(struct pipe_context *pipe, const unsigned int *enabled,
       goto error;
    }
 
-   ppq->p = pp_init_prog(ppq, pipe, cso, st);
+   ppq->p = pp_init_prog(ppq, pipe, cso, st, st_invalidate_state);
    if (ppq->p == NULL) {
       pp_debug("pp_init_prog returned NULL.\n");
       goto error;
index 922b93c..45fbe84 100644 (file)
@@ -41,7 +41,10 @@ struct pp_program
    struct pipe_screen *screen;
    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 pipe_blend_state blend;
    struct pipe_depth_stencil_alpha_state depthstencil;
@@ -95,7 +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 *, struct st_context_iface *st);
+                                struct cso_context *, void *st,
+                                void (*st_invalidate_state)(void *st, unsigned flags));
 
 void pp_blit(struct pipe_context *pipe,
              struct pipe_resource *src_tex,
index cf367f5..c078678 100644 (file)
@@ -41,7 +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, struct st_context_iface *st)
+             struct cso_context *cso, void *st,
+             void (*st_invalidate_state)(void *st, unsigned flags))
 {
    struct pp_program *p;
 
@@ -57,6 +58,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
    p->pipe = pipe;
    p->cso = cso;
    p->st = st;
+   p->st_invalidate_state = st_invalidate_state;
 
    {
       static const float verts[4][2][4] = {
index 93e0fa7..320f3c5 100644 (file)
@@ -192,11 +192,11 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
 
    /* restore states not restored by cso */
    if (ppq->p->st) {
-      ppq->p->st->invalidate_state(ppq->p->st,
-                                   ST_INVALIDATE_FS_SAMPLER_VIEWS |
-                                   ST_INVALIDATE_FS_CONSTBUF0 |
-                                   ST_INVALIDATE_VS_CONSTBUF0 |
-                                   ST_INVALIDATE_VERTEX_BUFFERS);
+      ppq->p->st_invalidate_state(ppq->p->st,
+                                  ST_INVALIDATE_FS_SAMPLER_VIEWS |
+                                  ST_INVALIDATE_FS_CONSTBUF0 |
+                                  ST_INVALIDATE_VS_CONSTBUF0 |
+                                  ST_INVALIDATE_VERTEX_BUFFERS);
    }
 
    pipe_resource_reference(&ppq->depth, NULL);
index a42e8a7..fdc6624 100644 (file)
@@ -201,7 +201,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);
+                        ctx->st, (void*)ctx->st->invalidate_state);
       ctx->hud = hud_create(ctx->st->cso_context,
                             share_ctx ? share_ctx->hud : NULL,
                             ctx->st, (void*)ctx->st->invalidate_state);
index aa342c2..4f12c94 100644 (file)
@@ -805,7 +805,8 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
          osmesa->pp = pp_init(osmesa->stctx->pipe,
                               osmesa->pp_enabled,
                               osmesa->stctx->cso_context,
-                              osmesa->stctx);
+                              osmesa->stctx,
+                              (void*)osmesa->stctx->invalidate_state);
 
          pp_init_fbos(osmesa->pp, width, height);
       }
index c156e6e..39cee47 100644 (file)
@@ -221,7 +221,8 @@ GalliumContext::CreateContext(HGLWinsysContext *wsContext)
        // 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->iface);
+               stContext->cso_context, &stContext->iface,
+                (void*)stContext->iface.invalidate_state);
 
        context_id contextNext = -1;
        Lock();