[Mesa-dev] [PATCH] gallium/hud: = should rename the last added data source

Marek Olšák maraeo at gmail.com
Sat Jun 9 03:17:16 UTC 2018


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

---
 src/gallium/auxiliary/hud/hud_context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 61db98b4b03..233202453ee 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -1207,20 +1207,22 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
     */
    period_env = getenv("GALLIUM_HUD_PERIOD");
    if (period_env) {
       float p = (float) atof(period_env);
       if (p >= 0.0f) {
          period = (unsigned) (p * 1000 * 1000);
       }
    }
 
    while ((num = parse_string(env, name_a)) != 0) {
+      bool added = true;
+
       env += num;
 
       /* check for explicit location, size and etc. settings */
       name = read_pane_settings(name_a, &x, &y, &width, &height, &ceiling,
                                 &dyn_ceiling, &reset_colors, &sort_items);
 
      /*
       * Keep track of overall column width to avoid pane overlapping in case
       * later we create a new column while the bottom pane in the current
       * column is less wide than the rest of the panes in it.
@@ -1379,20 +1381,21 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
                processed = TRUE;
             }
          }
 
          /* driver queries */
          if (!processed) {
             if (!hud_driver_query_install(&hud->batch_query, pane,
                                           screen, name)) {
                fprintf(stderr, "gallium_hud: unknown driver query '%s'\n", name);
                fflush(stderr);
+               added = false;
             }
          }
       }
 
       if (*env == ':') {
          env++;
 
          if (!pane) {
             fprintf(stderr, "gallium_hud: syntax error: unexpected ':', "
                     "expected a name\n");
@@ -1421,21 +1424,21 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
             fprintf(stderr, "gallium_hud: syntax error: unexpected '=', "
                     "expected a name\n");
             fflush(stderr);
             break;
          }
 
          num = parse_string(env, s);
          env += num;
 
          strip_hyphens(s);
-         if (!LIST_IS_EMPTY(&pane->graph_list)) {
+         if (added && !LIST_IS_EMPTY(&pane->graph_list)) {
             struct hud_graph *graph;
             graph = LIST_ENTRY(struct hud_graph, pane->graph_list.prev, head);
             strncpy(graph->name, s, sizeof(graph->name)-1);
             graph->name[sizeof(graph->name)-1] = 0;
          }
       }
 
       if (*env == 0)
          break;
 
-- 
2.17.1



More information about the mesa-dev mailing list