gallium: introduce device/driver UUID queries
authorAndres Rodriguez <andresx7@gmail.com>
Wed, 12 Jul 2017 22:45:23 +0000 (18:45 -0400)
committerTimothy Arceri <tarceri@itsqueeze.com>
Sun, 6 Aug 2017 02:42:06 +0000 (12:42 +1000)
v2: remove unnecessary returns
v3 (Timothy Arceri): updated trace
v4 (Timothy Arceri): actually dump the params in trace

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/ddebug/dd_screen.c
src/gallium/drivers/trace/tr_screen.c
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h

index 51382da1d7378e55d7faa7dbe71251294cce3c14..c518f5f9e9d224fe41ba8682bd535fdbb535ad50 100644 (file)
@@ -197,6 +197,22 @@ dd_screen_get_driver_query_group_info(struct pipe_screen *_screen,
 }
 
 
+static void
+dd_screen_get_driver_uuid(struct pipe_screen *_screen, char *uuid)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+   screen->get_driver_uuid(screen, uuid);
+}
+
+static void
+dd_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+   screen->get_device_uuid(screen, uuid);
+}
+
 /********************************************************************
  * resource
  */
@@ -462,6 +478,8 @@ ddebug_screen_create(struct pipe_screen *screen)
    SCR_INIT(get_driver_query_info);
    SCR_INIT(get_driver_query_group_info);
    SCR_INIT(get_compiler_options);
+   SCR_INIT(get_driver_uuid);
+   SCR_INIT(get_device_uuid);
 
 #undef SCR_INIT
 
index c499aa698041243d265b8f3ce7cef70c742255c7..539b17e2702ec4ec5745a925c8ea247a32db8cb9 100644 (file)
@@ -302,6 +302,35 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
 }
 
 
+static void
+trace_screen_get_driver_uuid(struct pipe_screen *_screen, char *uuid)
+{
+   struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+   trace_dump_call_begin("pipe_screen", "get_driver_uuid");
+   trace_dump_arg(ptr, screen);
+
+   screen->get_driver_uuid(screen, uuid);
+
+   trace_dump_ret(string, uuid);
+   trace_dump_call_end();
+}
+
+static void
+trace_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid)
+{
+   struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+   trace_dump_call_begin("pipe_screen", "get_device_uuid");
+   trace_dump_arg(ptr, screen);
+
+   screen->get_device_uuid(screen, uuid);
+
+   trace_dump_ret(string, uuid);
+   trace_dump_call_end();
+}
+
+
 /********************************************************************
  * texture
  */
@@ -617,6 +646,8 @@ trace_screen_create(struct pipe_screen *screen)
    SCR_INIT(memobj_destroy);
    tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
    tr_scr->base.get_timestamp = trace_screen_get_timestamp;
+   SCR_INIT(get_driver_uuid);
+   SCR_INIT(get_device_uuid);
 
    tr_scr->screen = screen;
 
index 321b677ade71105d653a7b78817d65a172c496d0..8609aefb986bb79bb82233da37dfb024b2df5b52 100644 (file)
@@ -1064,6 +1064,7 @@ enum pipe_debug_type
    PIPE_DEBUG_TYPE_CONFORMANCE,
 };
 
+#define PIPE_UUID_SIZE 16
 
 #ifdef __cplusplus
 }
index 462b683cd75cc6ecb8ad0c4796c4e6a474816c5c..8c6028a0fca42508b844c3defce94d4cc0cff489 100644 (file)
@@ -394,6 +394,19 @@ struct pipe_screen {
                                                   struct pipe_memory_object *memobj,
                                                   uint64_t offset);
 
+   /**
+    * Fill @uuid with a unique driver identifier
+    *
+    * \param uuid    pointer to a memory region of PIPE_UUID_SIZE bytes
+    */
+   void (*get_driver_uuid)(struct pipe_screen *screen, char *uuid);
+
+   /**
+    * Fill @uuid with a unique device identifier
+    *
+    * \param uuid    pointer to a memory region of PIPE_UUID_SIZE bytes
+    */
+   void (*get_device_uuid)(struct pipe_screen *screen, char *uuid);
 };