summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/dri/Makefile.sources2
-rw-r--r--src/gallium/state_trackers/dri/dri2.c2
-rw-r--r--src/gallium/state_trackers/dri/dri_query_renderer.c73
-rw-r--r--src/gallium/state_trackers/dri/dri_query_renderer.h9
-rw-r--r--src/gallium/state_trackers/dri/drisw.c2
5 files changed, 88 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/Makefile.sources b/src/gallium/state_trackers/dri/Makefile.sources
index 59677962c9e..52d60ac9285 100644
--- a/src/gallium/state_trackers/dri/Makefile.sources
+++ b/src/gallium/state_trackers/dri/Makefile.sources
@@ -3,6 +3,8 @@ common_SOURCES := \
dri_context.h \
dri_drawable.c \
dri_drawable.h \
+ dri_query_renderer.c \
+ dri_query_renderer.h \
dri_screen.c \
dri_screen.h
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 4bca2389f2a..1d79dfcd1aa 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -42,6 +42,7 @@
#include "dri_screen.h"
#include "dri_context.h"
#include "dri_drawable.h"
+#include "dri_query_renderer.h"
#include "dri2_buffer.h"
static int convert_fourcc(int format, int *dri_components_p)
@@ -1228,6 +1229,7 @@ static const __DRIextension *dri_screen_extensions[] = {
&driTexBufferExtension.base,
&dri2FlushExtension.base,
&dri2ImageExtension.base,
+ &dri2RendererQueryExtension.base,
&dri2ConfigQueryExtension.base,
&dri2ThrottleExtension.base,
NULL
diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c b/src/gallium/state_trackers/dri/dri_query_renderer.c
new file mode 100644
index 00000000000..4a28ac37b70
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_query_renderer.c
@@ -0,0 +1,73 @@
+#include "dri_query_renderer.h"
+
+#include "util/u_inlines.h"
+#include "state_tracker/drm_driver.h"
+
+#include "utils.h"
+#include "dri_screen.h"
+#include "dri_query_renderer.h"
+
+static int
+dri2_query_renderer_integer(__DRIscreen *_screen, int param,
+ unsigned int *value)
+{
+ struct dri_screen *screen = dri_screen(_screen);
+
+ switch (param) {
+ case __DRI2_RENDERER_VENDOR_ID:
+ value[0] =
+ (unsigned int)screen->base.screen->get_param(screen->base.screen,
+ PIPE_CAP_VENDOR_ID);
+ return 0;
+ case __DRI2_RENDERER_DEVICE_ID:
+ value[0] =
+ (unsigned int)screen->base.screen->get_param(screen->base.screen,
+ PIPE_CAP_DEVICE_ID);
+ return 0;
+ case __DRI2_RENDERER_ACCELERATED:
+ value[0] =
+ (unsigned int)screen->base.screen->get_param(screen->base.screen,
+ PIPE_CAP_ACCELERATED);
+ return 0;
+
+ case __DRI2_RENDERER_VIDEO_MEMORY:
+ value[0] =
+ (unsigned int)screen->base.screen->get_param(screen->base.screen,
+ PIPE_CAP_VIDEO_MEMORY);
+ return 0;
+
+ case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
+ value[0] =
+ (unsigned int)screen->base.screen->get_param(screen->base.screen,
+ PIPE_CAP_UMA);
+ return 0;
+
+ default:
+ return driQueryRendererIntegerCommon(_screen, param, value);
+ }
+}
+
+static int
+dri2_query_renderer_string(__DRIscreen *_screen, int param,
+ const char **value)
+{
+ struct dri_screen *screen = dri_screen(_screen);
+
+ switch (param) {
+ case __DRI2_RENDERER_VENDOR_ID:
+ value[0] = screen->base.screen->get_vendor(screen->base.screen);
+ return 0;
+ case __DRI2_RENDERER_DEVICE_ID:
+ value[0] = screen->base.screen->get_name(screen->base.screen);
+ return 0;
+ default:
+ return -1;
+ }
+}
+
+const __DRI2rendererQueryExtension dri2RendererQueryExtension = {
+ .base = { __DRI2_RENDERER_QUERY, 1 },
+
+ .queryInteger = dri2_query_renderer_integer,
+ .queryString = dri2_query_renderer_string
+};
diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.h b/src/gallium/state_trackers/dri/dri_query_renderer.h
new file mode 100644
index 00000000000..59b3ff8e5b3
--- /dev/null
+++ b/src/gallium/state_trackers/dri/dri_query_renderer.h
@@ -0,0 +1,9 @@
+#ifndef DRI_QUERY_RENDERER_H
+#define DRI_QUERY_RENDERER_H
+
+#include "dri_util.h"
+
+extern const
+__DRI2rendererQueryExtension dri2RendererQueryExtension;
+
+#endif
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index 607d22297fe..8d9acd6af51 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -45,6 +45,7 @@
#include "dri_screen.h"
#include "dri_context.h"
#include "dri_drawable.h"
+#include "dri_query_renderer.h"
DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", FALSE);
static boolean swrast_no_present = FALSE;
@@ -331,6 +332,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
static const __DRIextension *drisw_screen_extensions[] = {
&driTexBufferExtension.base,
+ &dri2RendererQueryExtension.base,
NULL
};