[Mesa-dev] [PATCH 19/27] mesa: hook up UUID queries for driver and device v3
Andres Rodriguez
andresx7 at gmail.com
Wed Jul 12 22:45:24 UTC 2017
v2: respective changes for new gallium interface
v3: fix UUID size asserts
Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
---
src/mesa/main/dd.h | 15 +++++++++++++++
src/mesa/main/get.c | 17 +++++++++++++++++
src/mesa/main/version.c | 13 +++++++++++++
src/mesa/main/version.h | 6 ++++++
src/mesa/state_tracker/st_context.c | 22 ++++++++++++++++++++++
5 files changed, 73 insertions(+)
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 27c6efc..f7fe217 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1108,6 +1108,21 @@ struct dd_function_table {
GLenum usage,
struct gl_buffer_object *bufObj);
+ /**
+ * Fill uuid with an unique identifier for this driver
+ *
+ * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
+ */
+ void (*GetDriverUuid)(struct gl_context *ctx, char *uuid);
+
+ /**
+ * Fill uuid with an unique identifier for the device associated
+ * to this driver
+ *
+ * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
+ */
+ void (*GetDeviceUuid)(struct gl_context *ctx, char *uuid);
+
/*@}*/
/**
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9f26ad1..bcbec1a 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -40,6 +40,7 @@
#include "framebuffer.h"
#include "samplerobj.h"
#include "stencil.h"
+#include "version.h"
/* This is a table driven implemetation of the glGet*v() functions.
* The basic idea is that most getters just look up an int somewhere
@@ -832,6 +833,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name;
break;
+ /* GL_EXT_external_objects */
+ case GL_DRIVER_UUID_EXT:
+ _mesa_get_driver_uuid(ctx, v->value_int_4);
+ break;
+ case GL_DEVICE_UUID_EXT:
+ _mesa_get_device_uuid(ctx, v->value_int_4);
+ break;
+
/* GL_EXT_packed_float */
case GL_RGBA_SIGNED_COMPONENTS_EXT:
{
@@ -2491,6 +2500,14 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
goto invalid_value;
v->value_int = ctx->Const.MaxComputeVariableGroupSize[index];
return TYPE_INT;
+
+ /* GL_EXT_external_objects */
+ case GL_DRIVER_UUID_EXT:
+ _mesa_get_driver_uuid(ctx, v->value_int_4);
+ return TYPE_INT_4;
+ case GL_DEVICE_UUID_EXT:
+ _mesa_get_device_uuid(ctx, v->value_int_4);
+ return TYPE_INT_4;
}
invalid_enum:
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 34f8bbb..c8aa3ca 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -635,3 +635,16 @@ _mesa_compute_version(struct gl_context *ctx)
break;
}
}
+
+
+void
+_mesa_get_driver_uuid(struct gl_context *ctx, GLint *uuid)
+{
+ ctx->Driver.GetDriverUuid(ctx, (char*) uuid);
+}
+
+void
+_mesa_get_device_uuid(struct gl_context *ctx, GLint *uuid)
+{
+ ctx->Driver.GetDeviceUuid(ctx, (char*) uuid);
+}
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index ee7cb75..4cb5e5f 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -47,4 +47,10 @@ _mesa_override_gl_version(struct gl_context *ctx);
extern void
_mesa_override_glsl_version(struct gl_constants *consts);
+extern void
+_mesa_get_driver_uuid(struct gl_context *ctx, GLint *uuid);
+
+extern void
+_mesa_get_device_uuid(struct gl_context *ctx, GLint *uuid);
+
#endif /* VERSION_H */
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index a846be3..965cc8c 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -641,6 +641,26 @@ st_set_background_context(struct gl_context *ctx,
smapi->set_background_context(&st->iface, queue_info);
}
+static void
+st_get_device_uuid(struct gl_context *ctx, char *uuid)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+
+ assert(GL_UUID_SIZE_EXT >= PIPE_UUID_SIZE);
+ memset(uuid, 0, GL_UUID_SIZE_EXT);
+ screen->get_device_uuid(screen, uuid);
+}
+
+static void
+st_get_driver_uuid(struct gl_context *ctx, char *uuid)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+
+ assert(GL_UUID_SIZE_EXT >= PIPE_UUID_SIZE);
+ memset(uuid, 0, GL_UUID_SIZE_EXT);
+ screen->get_driver_uuid(screen, uuid);
+}
+
void st_init_driver_functions(struct pipe_screen *screen,
struct dd_function_table *functions)
{
@@ -687,4 +707,6 @@ void st_init_driver_functions(struct pipe_screen *screen,
functions->UpdateState = st_invalidate_state;
functions->QueryMemoryInfo = st_query_memory_info;
functions->SetBackgroundContext = st_set_background_context;
+ functions->GetDriverUuid = st_get_device_uuid;
+ functions->GetDeviceUuid = st_get_driver_uuid;
}
--
2.9.3
More information about the mesa-dev
mailing list