Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /**************************************************************************
  2.  *
  3.  * Copyright 2013 Marek Olšák <maraeo@gmail.com>
  4.  * All Rights Reserved.
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person obtaining a
  7.  * copy of this software and associated documentation files (the
  8.  * "Software"), to deal in the Software without restriction, including
  9.  * without limitation the rights to use, copy, modify, merge, publish,
  10.  * distribute, sub license, and/or sell copies of the Software, and to
  11.  * permit persons to whom the Software is furnished to do so, subject to
  12.  * the following conditions:
  13.  *
  14.  * The above copyright notice and this permission notice (including the
  15.  * next paragraph) shall be included in all copies or substantial portions
  16.  * of the Software.
  17.  *
  18.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21.  * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
  22.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  *
  26.  **************************************************************************/
  27.  
  28. #ifndef HUD_PRIVATE_H
  29. #define HUD_PRIVATE_H
  30.  
  31. #include "pipe/p_context.h"
  32. #include "util/u_double_list.h"
  33.  
  34. struct hud_graph {
  35.    /* initialized by common code */
  36.    struct list_head head;
  37.    struct hud_pane *pane;
  38.    float color[3];
  39.    float *vertices; /* ring buffer of vertices */
  40.  
  41.    /* name and query */
  42.    char name[128];
  43.    void *query_data;
  44.    void (*query_new_value)(struct hud_graph *gr);
  45.    void (*free_query_data)(void *ptr); /**< do not use ordinary free() */
  46.  
  47.    /* mutable variables */
  48.    unsigned num_vertices;
  49.    unsigned index; /* vertex index being updated */
  50.    uint64_t current_value;
  51. };
  52.  
  53. struct hud_pane {
  54.    struct list_head head;
  55.    unsigned x1, y1, x2, y2;
  56.    unsigned inner_x1;
  57.    unsigned inner_y1;
  58.    unsigned inner_x2;
  59.    unsigned inner_y2;
  60.    unsigned inner_width;
  61.    unsigned inner_height;
  62.    float yscale;
  63.    unsigned max_num_vertices;
  64.    uint64_t max_value;
  65.    boolean uses_byte_units;
  66.    uint64_t period; /* in microseconds */
  67.  
  68.    struct list_head graph_list;
  69.    unsigned num_graphs;
  70. };
  71.  
  72.  
  73. /* core */
  74. void hud_pane_add_graph(struct hud_pane *pane, struct hud_graph *gr);
  75. void hud_pane_set_max_value(struct hud_pane *pane, uint64_t value);
  76. void hud_graph_add_value(struct hud_graph *gr, uint64_t value);
  77.  
  78. /* graphs/queries */
  79. #define ALL_CPUS ~0 /* optionally set as cpu_index */
  80.  
  81. int hud_get_num_cpus(void);
  82.  
  83. void hud_fps_graph_install(struct hud_pane *pane);
  84. void hud_cpu_graph_install(struct hud_pane *pane, unsigned cpu_index);
  85. void hud_pipe_query_install(struct hud_pane *pane, struct pipe_context *pipe,
  86.                             const char *name, unsigned query_type,
  87.                             unsigned result_index,
  88.                             uint64_t max_value, boolean uses_byte_units);
  89. boolean hud_driver_query_install(struct hud_pane *pane,
  90.                                  struct pipe_context *pipe, const char *name);
  91.  
  92. #endif
  93.