summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2014-08-14 20:11:32 +0100
committerEmil Velikov <[email protected]>2014-08-15 17:42:46 +0100
commit5b9cb1329557cc17e1533aed7c63e1252658d74b (patch)
tree9cd1f7f10cd523590b5baa58cd6fdb1427e493b1 /src/gallium/drivers/i915
parente9c43b1f01b10170f55acac66edc4e6d1b170260 (diff)
gallium/i915: handle query_renderer caps
Implementation based on the classic driver with the following changes: - Use auxiliarry function os_get_total_physical_memory to get the total amount of memory. - Move the libdrm_intel specific get_aperture_size to the winsys. Cc: Stephane Marchesin <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/drivers/i915')
-rw-r--r--src/gallium/drivers/i915/i915_screen.c23
-rw-r--r--src/gallium/drivers/i915/i915_winsys.h5
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 53d5e7580b5..3af0b151b5a 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -27,6 +27,7 @@
#include "draw/draw_context.h"
+#include "os/os_misc.h"
#include "util/u_format.h"
#include "util/u_format_s3tc.h"
#include "util/u_inlines.h"
@@ -283,6 +284,28 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
+ case PIPE_CAP_VENDOR_ID:
+ return 0x8086;
+ case PIPE_CAP_DEVICE_ID:
+ return is->iws->pci_id;
+ case PIPE_CAP_ACCELERATED:
+ return 1;
+ case PIPE_CAP_VIDEO_MEMORY: {
+ /* Once a batch uses more than 75% of the maximum mappable size, we
+ * assume that there's some fragmentation, and we start doing extra
+ * flushing, etc. That's the big cliff apps will care about.
+ */
+ const int gpu_mappable_megabytes = is->iws->aperture_size(is->iws) * 3 / 4;
+ uint64_t system_memory;
+
+ if (!os_get_total_physical_memory(&system_memory))
+ return 0;
+
+ return MIN2(gpu_mappable_megabytes, (int) (system_memory >> 20));
+ }
+ case PIPE_CAP_UMA:
+ return 1;
+
default:
debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);
return 0;
diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
index 8823c549a33..6cf802fe073 100644
--- a/src/gallium/drivers/i915/i915_winsys.h
+++ b/src/gallium/drivers/i915/i915_winsys.h
@@ -247,6 +247,11 @@ struct i915_winsys {
struct pipe_fence_handle *fence);
/*@}*/
+ /**
+ * Retrieve the aperture size (in MiB) of the device.
+ */
+ int (*aperture_size)(struct i915_winsys *iws);
+
/**
* Destroy the winsys.