summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-17 21:04:15 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-11 11:05:27 +0100
commit1217dbc88e0901e4a657ee51e2e3b7d00bb72b77 (patch)
tree29b0e1165494e6a0483699c9525c7e75763481d5 /src/sna
parentee7d2e0a8ef882c1d4e0e77a0148b54dcfbf4236 (diff)
sna: Support efficient cursor updates for old machines
Given a kernel patch to fix coherency of physical objects, we can use a more efficient method for updating cursors. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/sna_display.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 12f1e8d2..251d305b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4366,6 +4366,7 @@ sna_cursor_pre_init(struct sna *sna)
uint64_t name;
uint64_t value;
} cap;
+ int v;
if (sna->mode.num_real_crtc == 0)
return;
@@ -4374,6 +4375,8 @@ sna_cursor_pre_init(struct sna *sna)
#define DRM_CAP_CURSOR_WIDTH 8
#define DRM_CAP_CURSOR_HEIGHT 9
+#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
+
sna->cursor.max_size = 64;
cap.value = 0;
@@ -4387,7 +4390,17 @@ sna_cursor_pre_init(struct sna *sna)
assert(sna->cursor.max_size == cap.value);
#endif
- sna->cursor.use_gtt = sna->kgem.gen >= 033;
+ v = -1; /* No param uses the sign bit, reserve it for errors */
+ if (sna->kgem.gen >= 033) {
+ v = 1;
+ } else {
+ drm_i915_getparam_t gp = {
+ I915_PARAM_HAS_COHERENT_PHYS_GTT,
+ &v,
+ };
+ (void)drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GETPARAM, &gp);
+ }
+ sna->cursor.use_gtt = v > 0;
DBG(("%s: cursor updates use_gtt?=%d\n",
__FUNCTION__, sna->cursor.use_gtt));