[Mesa-dev] [PATCH 06/12] gallium/hud: use cso_get_pipe_context

Marek Olšák maraeo at gmail.com
Tue Nov 21 17:46:06 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/hud/hud_context.c      | 5 +++--
 src/gallium/auxiliary/hud/hud_context.h      | 2 +-
 src/gallium/state_trackers/dri/dri_context.c | 2 +-
 src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +-
 src/gallium/state_trackers/nine/device9.c    | 2 +-
 src/gallium/state_trackers/wgl/stw_context.c | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index d54bd63..92d607f 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -1523,39 +1523,40 @@ print_help(struct pipe_screen *screen)
             skipping = false;
          }
       }
    }
 
    puts("");
    fflush(stdout);
 }
 
 struct hud_context *
-hud_create(struct pipe_context *pipe, struct cso_context *cso)
+hud_create(struct cso_context *cso)
 {
+   struct pipe_context *pipe = cso_get_pipe_context(cso);
    struct pipe_screen *screen = pipe->screen;
    struct hud_context *hud;
    struct pipe_sampler_view view_templ;
    unsigned i;
    const char *env = debug_get_option("GALLIUM_HUD", NULL);
 #ifdef PIPE_OS_UNIX
    unsigned signo = debug_get_num_option("GALLIUM_HUD_TOGGLE_SIGNAL", 0);
    static boolean sig_handled = FALSE;
    struct sigaction action = {};
 #endif
    huds_visible = debug_get_bool_option("GALLIUM_HUD_VISIBLE", TRUE);
 
    if (!env || !*env)
       return NULL;
 
    if (strcmp(env, "help") == 0) {
-      print_help(pipe->screen);
+      print_help(screen);
       return NULL;
    }
 
    hud = CALLOC_STRUCT(hud_context);
    if (!hud)
       return NULL;
 
    hud->pipe = pipe;
    hud->cso = cso;
 
diff --git a/src/gallium/auxiliary/hud/hud_context.h b/src/gallium/auxiliary/hud/hud_context.h
index deb60ef..97aa709 100644
--- a/src/gallium/auxiliary/hud/hud_context.h
+++ b/src/gallium/auxiliary/hud/hud_context.h
@@ -28,21 +28,21 @@
 #ifndef HUD_CONTEXT_H
 #define HUD_CONTEXT_H
 
 struct hud_context;
 struct cso_context;
 struct pipe_context;
 struct pipe_resource;
 struct util_queue_monitoring;
 
 struct hud_context *
-hud_create(struct pipe_context *pipe, struct cso_context *cso);
+hud_create(struct cso_context *cso);
 
 void
 hud_destroy(struct hud_context *hud);
 
 void
 hud_run(struct hud_context *hud, struct pipe_resource *tex);
 
 void
 hud_add_queue_for_monitoring(struct hud_context *hud,
                              struct util_queue_monitoring *queue_info);
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index d123f9c..2f69f25 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -161,21 +161,21 @@ dri_create_context(gl_api api, const struct gl_config * visual,
 	 *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
 	 break;
       }
       goto fail;
    }
    ctx->st->st_manager_private = (void *) ctx;
    ctx->stapi = stapi;
 
    if (ctx->st->cso_context) {
       ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context);
-      ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
+      ctx->hud = hud_create(ctx->st->cso_context);
    }
 
    /* Do this last. */
    if (ctx->st->start_thread &&
          driQueryOptionb(&screen->dev->option_cache, "mesa_glthread")) {
 
       if (backgroundCallable && backgroundCallable->base.version >= 2 &&
             backgroundCallable->isThreadSafe) {
 
          if (backgroundCallable->isThreadSafe(cPriv->loaderPrivate))
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 74b5975..79bf45d 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1028,21 +1028,21 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
       goto no_st;
    }
 
    c->st = stapi->create_context(stapi, xmdpy->smapi, &attribs,
          &ctx_err, (share_list) ? share_list->st : NULL);
    if (c->st == NULL)
       goto no_st;
 
    c->st->st_manager_private = (void *) c;
 
-   c->hud = hud_create(c->st->pipe, c->st->cso_context);
+   c->hud = hud_create(c->st->cso_context);
 
    return c;
 
 no_st:
    free(c);
 no_xmesa_context:
    return NULL;
 }
 
 
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 88df38c..f1c50d6 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -198,21 +198,21 @@ NineDevice9_ctor( struct NineDevice9 *This,
     if (!This->context.pipe || !This->pipe_secondary) { return E_OUTOFMEMORY; } /* guess */
     This->pipe_sw = This->screen_sw->context_create(This->screen_sw, NULL, 0);
     if (!This->pipe_sw) { return E_OUTOFMEMORY; }
 
     This->context.cso = cso_create_context(This->context.pipe, 0);
     if (!This->context.cso) { return E_OUTOFMEMORY; } /* also a guess */
     This->cso_sw = cso_create_context(This->pipe_sw, 0);
     if (!This->cso_sw) { return E_OUTOFMEMORY; }
 
     /* Create first, it messes up our state. */
-    This->hud = hud_create(This->context.pipe, This->context.cso); /* NULL result is fine */
+    This->hud = hud_create(This->context.cso); /* NULL result is fine */
 
     /* Available memory counter. Updated only for allocations with this device
      * instance. This is the Win 7 behavior.
      * Win XP shares this counter across multiple devices. */
     This->available_texture_mem = This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
     if (This->available_texture_mem < 4096)
         This->available_texture_mem <<= 20;
     else
         This->available_texture_mem = UINT_MAX;
     /* We cap texture memory usage to 80% of what is reported free initially
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index 939ffd5..2155fbf 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -271,21 +271,21 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
    }
 
    ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
          stw_dev->smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
    if (ctx->st == NULL)
       goto no_st_ctx;
 
    ctx->st->st_manager_private = (void *) ctx;
 
    if (ctx->st->cso_context) {
-      ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
+      ctx->hud = hud_create(ctx->st->cso_context);
    }
 
    stw_lock_contexts(stw_dev);
    if (handle) {
       /* We're replacing the context data for this handle. See the
        * wglCreateContextAttribsARB() function.
        */
       struct stw_context *old_ctx =
          stw_lookup_context_locked((unsigned) handle);
       if (old_ctx) {
-- 
2.7.4



More information about the mesa-dev mailing list