Module: Mesa
Branch: main
Commit: 4f766426b20a17311804dbdf556d633ed1e096d2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f766426b20a17311804dbdf556d633ed1e096d2

Author: Marek Olšák <[email protected]>
Date:   Thu Dec  7 16:12:37 2023 -0500

cso: inline cso_get_pipe_context

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>

---

 src/gallium/auxiliary/cso_cache/cso_context.h |  6 ------
 src/gallium/auxiliary/hud/hud_context.c       | 15 +++++++--------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h 
b/src/gallium/auxiliary/cso_cache/cso_context.h
index 1a150ff9fd4..142cddf9b51 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -225,12 +225,6 @@ cso_draw_arrays(struct cso_context *cso, unsigned mode, 
unsigned start, unsigned
 
 /* Inline functions. */
 
-static inline struct pipe_context *
-cso_get_pipe_context(struct cso_context *cso)
-{
-   return cso->pipe;
-}
-
 static ALWAYS_INLINE void
 cso_draw_vbo(struct cso_context *cso,
              struct pipe_draw_info *info,
diff --git a/src/gallium/auxiliary/hud/hud_context.c 
b/src/gallium/auxiliary/hud/hud_context.c
index 58a217d3ecb..9d3e4e79221 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -762,7 +762,7 @@ void
 hud_run(struct hud_context *hud, struct cso_context *cso,
         struct pipe_resource *tex)
 {
-   struct pipe_context *pipe = cso ? cso_get_pipe_context(cso) : NULL;
+   struct pipe_context *pipe = cso ? cso->pipe : NULL;
 
    /* If "cso" is the recording or drawing context or NULL, execute
     * the operation. Otherwise, don't do anything.
@@ -1703,7 +1703,7 @@ hud_set_draw_context(struct hud_context *hud, struct 
cso_context *cso,
                      struct st_context *st,
                      hud_st_invalidate_state_func st_invalidate_state)
 {
-   struct pipe_context *pipe = cso_get_pipe_context(cso);
+   struct pipe_context *pipe = cso->pipe;
 
    assert(!hud->pipe);
    hud->pipe = pipe;
@@ -1916,7 +1916,7 @@ hud_create(struct cso_context *cso, struct hud_context 
*share,
 
       if (context_id == record_ctx) {
          assert(!share->record_pipe);
-         hud_set_record_context(share, cso_get_pipe_context(cso));
+         hud_set_record_context(share, cso->pipe);
       }
 
       if (context_id == draw_ctx) {
@@ -1927,7 +1927,7 @@ hud_create(struct cso_context *cso, struct hud_context 
*share,
       return share;
    }
 
-   struct pipe_screen *screen = cso_get_pipe_context(cso)->screen;
+   struct pipe_screen *screen = cso->pipe->screen;
    struct hud_context *hud;
    unsigned i;
    unsigned default_period_ms = 500;/* default period (1/2 second) */
@@ -1974,8 +1974,7 @@ hud_create(struct cso_context *cso, struct hud_context 
*share,
       return NULL;
 
    /* font (the context is only used for the texture upload) */
-   if (!util_font_create(cso_get_pipe_context(cso),
-                         UTIL_FONT_FIXED_8X13, &hud->font)) {
+   if (!util_font_create(cso->pipe, UTIL_FONT_FIXED_8X13, &hud->font)) {
       FREE(hud);
       return NULL;
    }
@@ -2050,7 +2049,7 @@ hud_create(struct cso_context *cso, struct hud_context 
*share,
 #endif
 
    if (record_ctx == 0)
-      hud_set_record_context(hud, cso_get_pipe_context(cso));
+      hud_set_record_context(hud, cso->pipe);
    if (draw_ctx == 0)
       hud_set_draw_context(hud, cso, st, st_invalidate_state);
 
@@ -2065,7 +2064,7 @@ hud_create(struct cso_context *cso, struct hud_context 
*share,
 void
 hud_destroy(struct hud_context *hud, struct cso_context *cso)
 {
-   if (!cso || hud->record_pipe == cso_get_pipe_context(cso))
+   if (!cso || hud->record_pipe == cso->pipe)
       hud_unset_record_context(hud);
 
    if (!cso || hud->cso == cso)

Reply via email to