[Mesa-dev] [PATCH 07/11] gallium/hud: add hud_pane::hud pointer

Marek Olšák maraeo at gmail.com
Thu Jun 22 01:03:02 UTC 2017


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

for later use
---
 src/gallium/auxiliary/hud/hud_context.c | 8 +++++---
 src/gallium/auxiliary/hud/hud_private.h | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 551cea9..ae2e0fb 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -771,29 +771,31 @@ hud_pane_update_dyn_ceiling(struct hud_graph *gr, struct hud_pane *pane)
    }
 
    /*
     * Mark this adjustment run so we could avoid repeating a full update
     * again needlessly in case the pane has more than one graph.
     */
    pane->dyn_ceil_last_ran = gr->index;
 }
 
 static struct hud_pane *
-hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2,
+hud_pane_create(struct hud_context *hud,
+                unsigned x1, unsigned y1, unsigned x2, unsigned y2,
                 unsigned period, uint64_t max_value, uint64_t ceiling,
                 boolean dyn_ceiling, boolean sort_items)
 {
    struct hud_pane *pane = CALLOC_STRUCT(hud_pane);
 
    if (!pane)
       return NULL;
 
+   pane->hud = hud;
    pane->x1 = x1;
    pane->y1 = y1;
    pane->x2 = x2;
    pane->y2 = y2;
    pane->inner_x1 = x1 + 1;
    pane->inner_x2 = x2 - 1;
    pane->inner_y1 = y1 + 1;
    pane->inner_y2 = y2 - 1;
    pane->inner_width = pane->inner_x2 - pane->inner_x1;
    pane->inner_height = pane->inner_y2 - pane->inner_y1;
@@ -1116,22 +1118,22 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
                                 &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.
       */
      column_width = width > column_width ? width : column_width;
 
       if (!pane) {
-         pane = hud_pane_create(x, y, x + width, y + height, period, 10,
-                         ceiling, dyn_ceiling, sort_items);
+         pane = hud_pane_create(hud, x, y, x + width, y + height, period, 10,
+                                ceiling, dyn_ceiling, sort_items);
          if (!pane)
             return;
       }
 
       if (reset_colors) {
          pane->next_color = 0;
          reset_colors = false;
       }
 
       /* Add a graph. */
diff --git a/src/gallium/auxiliary/hud/hud_private.h b/src/gallium/auxiliary/hud/hud_private.h
index fba919e..580ceb3 100644
--- a/src/gallium/auxiliary/hud/hud_private.h
+++ b/src/gallium/auxiliary/hud/hud_private.h
@@ -97,20 +97,21 @@ struct hud_graph {
 
    /* mutable variables */
    unsigned num_vertices;
    unsigned index; /* vertex index being updated */
    uint64_t current_value;
    FILE *fd;
 };
 
 struct hud_pane {
    struct list_head head;
+   struct hud_context *hud;
    unsigned x1, y1, x2, y2;
    unsigned inner_x1;
    unsigned inner_y1;
    unsigned inner_x2;
    unsigned inner_y2;
    unsigned inner_width;
    unsigned inner_height;
    float yscale;
    unsigned max_num_vertices;
    unsigned last_line; /* index of the last describing line in the graph */
-- 
2.7.4



More information about the mesa-dev mailing list