summaryrefslogtreecommitdiff
path: root/src/intel_device.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-09 11:34:39 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-09 11:46:24 +0100
commitb6b5c3f009585151eb772dfc2526843c7cee82b3 (patch)
tree63ab8d9eb0a2eb4864db92bc5250d3909fe76238 /src/intel_device.c
parentab445c23079a76eaa2a7d499ec4755599012bd2f (diff)
intel: Disable incompatible features whilst hosted
Start adding the infrastructure to disable direct hardware access if X is being run under a system compositor (aka "hosted"). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/intel_device.c')
-rw-r--r--src/intel_device.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/intel_device.c b/src/intel_device.c
index c5f0a38d..d9ff8bcc 100644
--- a/src/intel_device.c
+++ b/src/intel_device.c
@@ -92,7 +92,7 @@ static int __intel_check_device(int fd)
if (drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp))
ret = FALSE;
}
- if (ret) {
+ if (ret && !hosted()) {
struct drm_mode_card_res res;
memset(&res, 0, sizeof(res));
@@ -199,6 +199,12 @@ int intel_open_device(int entity_num,
dev->open_count = 0;
dev->master_count = 0;
+ /* If hosted under a system compositor, just pretend to be master */
+ if (hosted()) {
+ dev->open_count++;
+ dev->master_count++;
+ }
+
xf86GetEntityPrivate(entity_num, intel_device_key)->ptr = dev;
return fd;
@@ -222,6 +228,8 @@ int intel_get_device(ScrnInfoPtr scrn)
drmSetVersion sv;
int retry = 2000;
+ assert(!hosted());
+
/* Check that what we opened was a master or a
* master-capable FD, by setting the version of the
* interface we'll use to talk to it.
@@ -267,6 +275,7 @@ int intel_get_master(ScrnInfoPtr scrn)
if (dev->master_count++ == 0) {
int retry = 2000;
+ assert(!hosted());
do {
ret = drmSetMaster(dev->fd);
if (ret == 0)
@@ -288,6 +297,7 @@ int intel_put_master(ScrnInfoPtr scrn)
ret = 0;
assert(dev->master_count);
if (--dev->master_count == 0) {
+ assert(!hosted());
assert(drmSetMaster(dev->fd) == 0);
ret = drmDropMaster(dev->fd);
}
@@ -317,6 +327,7 @@ void intel_put_device(ScrnInfoPtr scrn)
if (--dev->open_count)
return;
+ assert(!hosted());
intel_set_device(scrn, NULL);
drmClose(dev->fd);