[Mesa-dev] [PATCH 17/24] gallium: introduce device/driver UUID queries

Timothy Arceri tarceri at itsqueeze.com
Thu Jul 27 13:08:42 UTC 2017


From: Andres Rodriguez <andresx7 at gmail.com>

v2: remove unnecessary returns
v3 (Timothy Arceri): updated trace

Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com> (v2)
---
 src/gallium/drivers/ddebug/dd_screen.c | 18 ++++++++++++++++++
 src/gallium/drivers/trace/tr_screen.c  | 19 +++++++++++++++++++
 src/gallium/include/pipe/p_defines.h   |  1 +
 src/gallium/include/pipe/p_screen.h    | 13 +++++++++++++
 4 files changed, 51 insertions(+)

diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c
index 51382da1d7..c518f5f9e9 100644
--- a/src/gallium/drivers/ddebug/dd_screen.c
+++ b/src/gallium/drivers/ddebug/dd_screen.c
@@ -190,20 +190,36 @@ static int
 dd_screen_get_driver_query_group_info(struct pipe_screen *_screen,
                                       unsigned index,
                                       struct pipe_driver_query_group_info *info)
 {
    struct pipe_screen *screen = dd_screen(_screen)->screen;
 
    return screen->get_driver_query_group_info(screen, index, info);
 }
 
 
+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
  */
 
 static struct pipe_resource *
 dd_screen_resource_create(struct pipe_screen *_screen,
                           const struct pipe_resource *templat)
 {
    struct pipe_screen *screen = dd_screen(_screen)->screen;
    struct pipe_resource *res = screen->resource_create(screen, templat);
@@ -455,20 +471,22 @@ ddebug_screen_create(struct pipe_screen *screen)
    SCR_INIT(resource_changed);
    dscreen->base.resource_destroy = dd_screen_resource_destroy;
    SCR_INIT(flush_frontbuffer);
    SCR_INIT(fence_reference);
    SCR_INIT(fence_finish);
    SCR_INIT(memobj_create_from_handle);
    SCR_INIT(memobj_destroy);
    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
 
    dscreen->screen = screen;
    dscreen->timeout_ms = timeout;
    dscreen->mode = mode;
    dscreen->no_flush = no_flush;
    dscreen->verbose = strstr(option, "verbose") != NULL;
    dscreen->apitrace_dump_call = apitrace_dump_call;
 
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 572d455105..75dab60810 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -295,20 +295,37 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
    /* XXX: hide, as there is nothing we can do with this
    trace_dump_arg(ptr, context_private);
    */
 
    screen->flush_frontbuffer(screen, resource, level, layer, context_private, sub_box);
 
    trace_dump_call_end();
 }
 
 
+static void
+trace_screen_get_driver_uuid(struct pipe_screen *_screen, char *uuid)
+{
+   struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+   screen->get_driver_uuid(screen, uuid);
+}
+
+static void
+trace_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid)
+{
+   struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+   screen->get_device_uuid(screen, uuid);
+}
+
+
 /********************************************************************
  * texture
  */
 
 
 static struct pipe_resource *
 trace_screen_resource_create(struct pipe_screen *_screen,
                             const struct pipe_resource *templat)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
@@ -584,20 +601,22 @@ trace_screen_create(struct pipe_screen *screen)
    tr_scr->base.resource_get_handle = trace_screen_resource_get_handle;
    SCR_INIT(resource_from_memobj);
    SCR_INIT(resource_changed);
    tr_scr->base.resource_destroy = trace_screen_resource_destroy;
    tr_scr->base.fence_reference = trace_screen_fence_reference;
    tr_scr->base.fence_finish = trace_screen_fence_finish;
    SCR_INIT(memobj_create_from_handle);
    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;
 
    trace_dump_ret(ptr, screen);
    trace_dump_call_end();
 
    return &tr_scr->base;
 
 error2:
    trace_dump_ret(ptr, screen);
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 91efa6522f..22d60d39b7 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -1059,16 +1059,17 @@ enum pipe_debug_type
 {
    PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1,
    PIPE_DEBUG_TYPE_ERROR,
    PIPE_DEBUG_TYPE_SHADER_INFO,
    PIPE_DEBUG_TYPE_PERF_INFO,
    PIPE_DEBUG_TYPE_INFO,
    PIPE_DEBUG_TYPE_FALLBACK,
    PIPE_DEBUG_TYPE_CONFORMANCE,
 };
 
+#define PIPE_UUID_SIZE 16
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index d81625c91f..acfbd03065 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -386,18 +386,31 @@ struct pipe_screen {
     * Create a texture from a memory object
     *
     * \param t       texture template
     * \param memobj  The memory object used to back the texture
     */
    struct pipe_resource * (*resource_from_memobj)(struct pipe_screen *screen,
                                                   const struct pipe_resource *t,
                                                   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);
 };
 
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* P_SCREEN_H */
-- 
2.13.3



More information about the mesa-dev mailing list