[Mesa-dev] [PATCH 07/12] gallium/hud: don't use hud->pipe in hud_parse_env_var

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


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

---
 src/gallium/auxiliary/hud/hud_context.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 92d607f..810c2ea 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -1100,21 +1100,22 @@ has_streamout(struct pipe_screen *screen)
    return screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0;
 }
 
 static boolean
 has_pipeline_stats_query(struct pipe_screen *screen)
 {
    return screen->get_param(screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS) != 0;
 }
 
 static void
-hud_parse_env_var(struct hud_context *hud, const char *env)
+hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
+                  const char *env)
 {
    unsigned num, i;
    char name_a[256], s[256];
    char *name;
    struct hud_pane *pane = NULL;
    unsigned x = 10, y = 10;
    unsigned width = 251, height = 100;
    unsigned period = 500 * 1000;  /* default period (1/2 second) */
    uint64_t ceiling = UINT64_MAX;
    unsigned column_width = 251;
@@ -1244,42 +1245,42 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
                                         SENSORS_CURRENT_CURRENT);
          pane->type = PIPE_DRIVER_QUERY_TYPE_AMPS;
       }
       else if (sscanf(name, "sensors_pow_cu-%s", arg_name) == 1) {
          hud_sensors_temp_graph_install(pane, arg_name,
                                         SENSORS_POWER_CURRENT);
          pane->type = PIPE_DRIVER_QUERY_TYPE_WATTS;
       }
 #endif
       else if (strcmp(name, "samples-passed") == 0 &&
-               has_occlusion_query(hud->pipe->screen)) {
+               has_occlusion_query(screen)) {
          hud_pipe_query_install(&hud->batch_query, pane,
                                 "samples-passed",
                                 PIPE_QUERY_OCCLUSION_COUNTER, 0, 0,
                                 PIPE_DRIVER_QUERY_TYPE_UINT64,
                                 PIPE_DRIVER_QUERY_RESULT_TYPE_AVERAGE,
                                 0);
       }
       else if (strcmp(name, "primitives-generated") == 0 &&
-               has_streamout(hud->pipe->screen)) {
+               has_streamout(screen)) {
          hud_pipe_query_install(&hud->batch_query, pane,
                                 "primitives-generated",
                                 PIPE_QUERY_PRIMITIVES_GENERATED, 0, 0,
                                 PIPE_DRIVER_QUERY_TYPE_UINT64,
                                 PIPE_DRIVER_QUERY_RESULT_TYPE_AVERAGE,
                                 0);
       }
       else {
          boolean processed = FALSE;
 
          /* pipeline statistics queries */
-         if (has_pipeline_stats_query(hud->pipe->screen)) {
+         if (has_pipeline_stats_query(screen)) {
             static const char *pipeline_statistics_names[] =
             {
                "ia-vertices",
                "ia-primitives",
                "vs-invocations",
                "gs-invocations",
                "gs-primitives",
                "clipper-invocations",
                "clipper-primitives-generated",
                "ps-invocations",
@@ -1296,21 +1297,21 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
                                       0, PIPE_DRIVER_QUERY_TYPE_UINT64,
                                       PIPE_DRIVER_QUERY_RESULT_TYPE_AVERAGE,
                                       0);
                processed = TRUE;
             }
          }
 
          /* driver queries */
          if (!processed) {
             if (!hud_driver_query_install(&hud->batch_query, pane,
-                                          hud->pipe->screen, name)) {
+                                          screen, name)) {
                fprintf(stderr, "gallium_hud: unknown driver query '%s'\n", name);
                fflush(stderr);
             }
          }
       }
 
       if (*env == ':') {
          env++;
 
          if (!pane) {
@@ -1700,21 +1701,21 @@ hud_create(struct cso_context *cso)
       if (signo >= NSIG)
          fprintf(stderr, "gallium_hud: invalid signal %u\n", signo);
       else if (sigaction(signo, &action, NULL) < 0)
          fprintf(stderr, "gallium_hud: unable to set handler for signal %u\n", signo);
       fflush(stderr);
 
       sig_handled = TRUE;
    }
 #endif
 
-   hud_parse_env_var(hud, env);
+   hud_parse_env_var(hud, screen, env);
    return hud;
 }
 
 void
 hud_destroy(struct hud_context *hud)
 {
    struct pipe_context *pipe = hud->pipe;
    struct hud_pane *pane, *pane_tmp;
    struct hud_graph *graph, *graph_tmp;
 
-- 
2.7.4



More information about the mesa-dev mailing list