[Mesa-dev] [PATCH 16/23] gallium: introduce device/driver UUID queries
Samuel Pitoiset
samuel.pitoiset at gmail.com
Fri Aug 4 08:50:56 UTC 2017
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
On 08/04/2017 03:54 AM, Timothy Arceri wrote:
> From: Andres Rodriguez <andresx7 at gmail.com>
>
> v2: remove unnecessary returns
> v3 (Timothy Arceri): updated trace
> v4 (Timothy Arceri): actually dump the params in 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 | 31 +++++++++++++++++++++++++++++++
> src/gallium/include/pipe/p_defines.h | 1 +
> src/gallium/include/pipe/p_screen.h | 13 +++++++++++++
> 4 files changed, 63 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 7c4c05b4c3..8802f3a737 100644
> --- a/src/gallium/drivers/trace/tr_screen.c
> +++ b/src/gallium/drivers/trace/tr_screen.c
> @@ -295,20 +295,49 @@ 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;
> +
> + 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
> */
>
>
> 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);
> @@ -613,20 +642,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 2b315e99c2..738892d4b6 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -1063,16 +1063,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 65aa163f5f..021f9df5c0 100644
> --- a/src/gallium/include/pipe/p_screen.h
> +++ b/src/gallium/include/pipe/p_screen.h
> @@ -387,20 +387,33 @@ 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);
> };
>
>
> /**
> * Global configuration options for screen creation.
> */
> struct pipe_screen_config {
> unsigned flags;
> const struct driOptionCache *options;
> };
>
More information about the mesa-dev
mailing list