summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-02 18:29:38 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-02 18:29:38 +0100
commit3b3a5ca603baa611b36f51b800f3969f519bcb3b (patch)
treef7f8f5f7e987058663856d6b64aa103cbde9c9d5 /src
parent79785920485d0327d5512db0ed6f81bf4d4eeb90 (diff)
intel: Query platform fd
Under a compositor, we wish to use the pre-authorized fd passed to us by the host, stashed away in the platform device. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/intel_device.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/intel_device.c b/src/intel_device.c
index 8ab7ad79..450e6f5f 100644
--- a/src/intel_device.c
+++ b/src/intel_device.c
@@ -221,16 +221,36 @@ static char *find_render_node(int fd)
}
#ifdef XSERVER_PLATFORM_BUS
+
+#define ODEV_ATTRIB_PATH 0
+#define ODEV_ATTRIB_FD 4
+
static char *get_path(struct xf86_platform_device *dev)
{
const char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
return path ? strdup(path) : NULL;
}
+
+static int get_fd(struct xf86_platform_device *dev)
+{
+ const char *str = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_FD);
+ if (str == NULL)
+ return -1;
+ return atoi(str);
+}
+
#else
+
static char *get_path(struct xf86_platform_device *dev)
{
return NULL;
}
+
+static int get_fd(struct xf86_platform_device *dev)
+{
+ return -1;
+}
+
#endif
int intel_open_device(int entity_num,
@@ -252,7 +272,9 @@ int intel_open_device(int entity_num,
local_path = get_path(platform);
- fd = __intel_open_device(pci, &local_path);
+ fd = get_fd(platform);
+ if (fd == -1)
+ fd = __intel_open_device(pci, &local_path);
if (fd == -1)
goto err_path;