etnaviv: move sw get_driver_query_info(..)
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Tue, 19 Sep 2017 16:16:04 +0000 (18:16 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 20 Sep 2017 12:25:13 +0000 (14:25 +0200)
This change makes etna_get_driver_query_info(..) more generic
and puts the knowledge of supported queries directly besides
the implementation.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_query.c
src/gallium/drivers/etnaviv/etnaviv_query_sw.c
src/gallium/drivers/etnaviv/etnaviv_query_sw.h

index 617e47562d6c67b48dad81f465635d118ee15cd8..16adb8c21fcfdd04f5c668bf46e36026c33a984b 100644 (file)
@@ -81,21 +81,12 @@ static int
 etna_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
                            struct pipe_driver_query_info *info)
 {
-   struct pipe_driver_query_info list[] = {
-      {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, { 0 }},
-      {"draw-calls", ETNA_QUERY_DRAW_CALLS, { 0 }},
-      {"rs-operations", ETNA_QUERY_RS_OPERATIONS, { 0 }},
-   };
+   int nr_sw_queries = etna_sw_get_driver_query_info(pscreen, 0, NULL);
 
    if (!info)
-      return ARRAY_SIZE(list);
+      return nr_sw_queries;
 
-   if (index >= ARRAY_SIZE(list))
-      return 0;
-
-   *info = list[index];
-
-   return 1;
+   return etna_sw_get_driver_query_info(pscreen, index, info);
 }
 
 static void
index 213c61f38b309e316854b4e52c22bb3035472e1d..90f4a658261c3f9d3e20f381030cd00ca72775fc 100644 (file)
@@ -124,3 +124,24 @@ etna_sw_create_query(struct etna_context *ctx, unsigned query_type)
 
    return q;
 }
+
+int
+etna_sw_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
+                              struct pipe_driver_query_info *info)
+{
+   static const struct pipe_driver_query_info list[] = {
+      {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, { 0 }},
+      {"draw-calls", ETNA_QUERY_DRAW_CALLS, { 0 }},
+      {"rs-operations", ETNA_QUERY_RS_OPERATIONS, { 0 }},
+   };
+
+   if (!info)
+      return ARRAY_SIZE(list);
+
+   if (index >= ARRAY_SIZE(list))
+      return 0;
+
+   *info = list[index];
+
+   return 1;
+}
index 9de2bc60f9c69acbcbfd931af34445deca17c644..f07d0f5915de84e5d7014f6bb265ca40dc3e6c2d 100644 (file)
@@ -44,4 +44,8 @@ etna_sw_query(struct etna_query *q)
 struct etna_query *
 etna_sw_create_query(struct etna_context *ctx, unsigned query_type);
 
+int
+etna_sw_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
+                              struct pipe_driver_query_info *info);
+
 #endif