From: Andres Rodriguez Date: Wed, 12 Jul 2017 22:45:23 +0000 (-0400) Subject: gallium: introduce device/driver UUID queries X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=95cb7760493f92410faaf2214d5abe4b5fdaf308;p=mesa.git gallium: introduce device/driver UUID queries v2: remove unnecessary returns v3 (Timothy Arceri): updated trace v4 (Timothy Arceri): actually dump the params in trace Signed-off-by: Andres Rodriguez Reviewed-by: Marek Olšák (v2) Reviewed-by: Samuel Pitoiset --- diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 51382da1d73..c518f5f9e9d 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -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 diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index c499aa69804..539b17e2702 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -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; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 321b677ade7..8609aefb986 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -1064,6 +1064,7 @@ enum pipe_debug_type PIPE_DEBUG_TYPE_CONFORMANCE, }; +#define PIPE_UUID_SIZE 16 #ifdef __cplusplus } diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 462b683cd75..8c6028a0fca 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -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); };