aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/swrast/swrast.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-08-22 21:55:11 +0200
committermarha <marha@users.sourceforge.net>2014-08-22 21:55:11 +0200
commit6c0c95d6045d2d2b4e6a3a2f11457850031c57bc (patch)
tree32dfc45d688fa198bf0d41597e82589890012cf1 /mesalib/src/mesa/drivers/dri/swrast/swrast.c
parentfdbedba4d50e1b28b0249c83ba11c029f096e400 (diff)
downloadvcxsrv-6c0c95d6045d2d2b4e6a3a2f11457850031c57bc.tar.gz
vcxsrv-6c0c95d6045d2d2b4e6a3a2f11457850031c57bc.tar.bz2
vcxsrv-6c0c95d6045d2d2b4e6a3a2f11457850031c57bc.zip
fontconfig libxcb/xcb-proto mesa xkeyboard-config git update 22 Aug 2014
libxcb/xcb-proto commit 8e3db42d67a0035bb16d16da28bd5eea7a269178 xkeyboard-config commit 10fce2c2baae471795d069f3a5f1307eedb9ff0a fontconfig commit 286cdc9c10b0453c25950103b6a1f7170d15bfdc mesa commit 97d03b9366bfa55b27feb92aa5afacd9c5f6f421
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/swrast/swrast.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c73
1 files changed, 71 insertions, 2 deletions
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 888138115..e28991b0c 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -61,6 +61,9 @@
const __DRIextension **__driDriverGetExtensions_swrast(void);
+const char const *swrast_vendor_string = "Mesa Project";
+const char const *swrast_renderer_string = "Software Rasterizer";
+
/**
* Screen and config-related functions
*/
@@ -117,8 +120,74 @@ static const __DRItexBufferExtension swrastTexBufferExtension = {
.releaseTexBuffer = NULL,
};
+
+static int
+swrast_query_renderer_integer(__DRIscreen *psp, int param,
+ unsigned int *value)
+{
+ switch (param) {
+ case __DRI2_RENDERER_VENDOR_ID:
+ case __DRI2_RENDERER_DEVICE_ID:
+ /* Return 0xffffffff for both vendor and device id */
+ value[0] = 0xffffffff;
+ return 0;
+ case __DRI2_RENDERER_ACCELERATED:
+ value[0] = 0;
+ return 0;
+ case __DRI2_RENDERER_VIDEO_MEMORY: {
+ /* XXX: Do we want to return the full amount of system memory ? */
+ const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
+ const long system_page_size = sysconf(_SC_PAGE_SIZE);
+
+ if (system_memory_pages <= 0 || system_page_size <= 0)
+ return -1;
+
+ const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
+ * (uint64_t) system_page_size;
+
+ const unsigned system_memory_megabytes =
+ (unsigned) (system_memory_bytes / (1024 * 1024));
+
+ value[0] = system_memory_megabytes;
+ return 0;
+ }
+ case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
+ /**
+ * XXX: Perhaps we should return 1 ?
+ * See issue #7 from the spec, currently UNRESOLVED.
+ */
+ value[0] = 0;
+ return 0;
+ default:
+ return driQueryRendererIntegerCommon(psp, param, value);
+ }
+}
+
+static int
+swrast_query_renderer_string(__DRIscreen *psp, int param, const char **value)
+{
+ switch (param) {
+ case __DRI2_RENDERER_VENDOR_ID:
+ value[0] = swrast_vendor_string;
+ return 0;
+ case __DRI2_RENDERER_DEVICE_ID:
+ value[0] = swrast_renderer_string;
+ return 0;
+ default:
+ return -1;
+ }
+}
+
+static const __DRI2rendererQueryExtension swrast_query_renderer_extension = {
+ .base = { __DRI2_RENDERER_QUERY, 1 },
+
+ .queryInteger = swrast_query_renderer_integer,
+ .queryString = swrast_query_renderer_string
+};
+
static const __DRIextension *dri_screen_extensions[] = {
&swrastTexBufferExtension.base,
+ &swrast_query_renderer_extension.base,
NULL
};
@@ -599,9 +668,9 @@ get_string(struct gl_context *ctx, GLenum pname)
(void) ctx;
switch (pname) {
case GL_VENDOR:
- return (const GLubyte *) "Mesa Project";
+ return (const GLubyte *) swrast_vendor_string;
case GL_RENDERER:
- return (const GLubyte *) "Software Rasterizer";
+ return (const GLubyte *) swrast_renderer_string;
default:
return NULL;
}