[Mesa-dev] [PATCH 24/25] gallium/softpipe/llvmpipe: handle query_renderer caps

Emil Velikov emil.l.velikov at gmail.com
Fri Feb 21 19:04:14 PST 2014


Both drivers report 0xffffffff as vendor/device id, and the maximum
amount of system memory as video memory. We might want to reconsider
the latter.

Cc: Brian Paul <brianp at vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/drivers/llvmpipe/lp_screen.c | 25 +++++++++++++++++++++++++
 src/gallium/drivers/softpipe/sp_screen.c | 25 +++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 604f853..c28f9a7 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -245,6 +245,31 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 11;
    case PIPE_CAP_MAX_GL_ES2_VERSION:
       return 20;
+
+   case PIPE_CAP_VENDOR_ID:
+      return 0xFFFFFFFF;
+   case PIPE_CAP_DEVICE_ID:
+      return 0xFFFFFFFF;
+   case PIPE_CAP_ACCELERATED:
+      return 0;
+   case PIPE_CAP_VIDEO_MEMORY: {
+      /* XXX: Do we want to return the full amount fo 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 0;
+
+      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));
+
+      return system_memory_megabytes;
+   }
+   case PIPE_CAP_UMA:
+      return 0;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 3a6d31a..bf91274 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -195,6 +195,31 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 11;
    case PIPE_CAP_MAX_GL_ES2_VERSION:
       return 20;
+
+   case PIPE_CAP_VENDOR_ID:
+      return 0xFFFFFFFF;
+   case PIPE_CAP_DEVICE_ID:
+      return 0xFFFFFFFF;
+   case PIPE_CAP_ACCELERATED:
+      return 0;
+   case PIPE_CAP_VIDEO_MEMORY: {
+      /* XXX: Do we want to return the full amount fo 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 0;
+
+      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));
+
+      return system_memory_megabytes;
+   }
+   case PIPE_CAP_UMA:
+      return 0;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
-- 
1.9.0



More information about the mesa-dev mailing list