xf86-video-intel: 3 commits - src/intel_device.c src/intel_driver.h src/intel_module.c src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Oct 3 00:32:34 PDT 2013


 src/intel_device.c  |   45 ++++++++++++++++++++++++++++++++++++++++++---
 src/intel_driver.h  |    6 +++++-
 src/intel_module.c  |    3 +--
 src/sna/sna_accel.c |    7 +++++--
 4 files changed, 53 insertions(+), 8 deletions(-)

New commits:
commit adbf01306a9f42efb26a485a80c3c7f3918a48ba
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Oct 3 08:29:08 2013 +0100

    sna: Restart timer evaluations if the BlockHandler takes too long
    
    Rather than passing a negative timeout to select, if we detect that we
    expired our timeout during the processing of the BlockHandler, restart.
    
    More worrying is that something in the BlockHandler took longer than 3ms
    to process.
    
    Reported-by: Felipe Contreras <felipe.contreras at gmail.com>
    Link: http://article.gmane.org/gmane.comp.freedesktop.xorg.devel/37388
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 4838371..21cd342 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -15946,6 +15946,7 @@ void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
 		_kgem_submit(&sna->kgem);
 	}
 
+restart:
 	if (sna_accel_do_flush(sna))
 		sna_accel_flush(sna);
 	assert(sna_accel_scanout(sna) == NULL ||
@@ -15977,9 +15978,11 @@ void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
 		DBG(("%s: evaluating timers, active=%x\n",
 		     __FUNCTION__, sna->timer_active));
 
-		timeout = sna->timer_expire[0] - TIME;
+		timeout = sna->timer_expire[FLUSH_TIMER] - TIME;
 		DBG(("%s: flush timer expires in %d [%d]\n",
-		     __FUNCTION__, timeout, sna->timer_expire[0]));
+		     __FUNCTION__, timeout, sna->timer_expire[FLUSH_TIMER]));
+		if (timeout < 3)
+			goto restart;
 
 		if (*tv == NULL) {
 			*tv = &sna->timer_tv;
commit 3b3a5ca603baa611b36f51b800f3969f519bcb3b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 2 18:29:38 2013 +0100

    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 at chris-wilson.co.uk>

diff --git a/src/intel_device.c b/src/intel_device.c
index 8ab7ad7..450e6f5 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;
 
commit 79785920485d0327d5512db0ed6f81bf4d4eeb90
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 2 18:19:44 2013 +0100

    intel: Pass the platform device along to the open routines
    
    This allows us to pass along more metadata along with the platform
    device in future. Currently we pass the device path, but in a hosted
    environment we should be passing along the authorized fd from the host.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_device.c b/src/intel_device.c
index 92472c5..8ab7ad7 100644
--- a/src/intel_device.c
+++ b/src/intel_device.c
@@ -48,6 +48,10 @@
 #include <xf86_OSproc.h>
 #include <i915_drm.h>
 
+#ifdef XSERVER_PLATFORM_BUS
+#include <xf86platformBus.h>
+#endif
+
 #include "intel_driver.h"
 
 struct intel_device {
@@ -216,9 +220,22 @@ static char *find_render_node(int fd)
 	return NULL;
 }
 
+#ifdef XSERVER_PLATFORM_BUS
+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;
+}
+#else
+static char *get_path(struct xf86_platform_device *dev)
+{
+	return NULL;
+}
+#endif
+
 int intel_open_device(int entity_num,
 		      const struct pci_device *pci,
-		      const char *path)
+		      struct xf86_platform_device *platform)
 {
 	struct intel_device *dev;
 	char *local_path;
@@ -233,7 +250,7 @@ int intel_open_device(int entity_num,
 	if (dev)
 		return dev->fd;
 
-	local_path = path ? strdup(path) : NULL;
+	local_path = get_path(platform);
 
 	fd = __intel_open_device(pci, &local_path);
 	if (fd == -1)
diff --git a/src/intel_driver.h b/src/intel_driver.h
index e54054f..9f4c4e5 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -1,6 +1,8 @@
 #ifndef INTEL_DRIVER_H
 #define INTEL_DRIVER_H
 
+struct xf86_platform_device;
+
 #define INTEL_VERSION 4000
 #define INTEL_NAME "intel"
 #define INTEL_DRIVER_NAME "intel"
@@ -120,7 +122,9 @@ void intel_detect_chipset(ScrnInfoPtr scrn,
 			  EntityInfoPtr ent,
 			  struct pci_device *pci);
 
-int intel_open_device(int entity_num, const struct pci_device *pci, const char *path);
+int intel_open_device(int entity_num,
+		      const struct pci_device *pci,
+		      struct xf86_platform_device *dev);
 int intel_get_device(ScrnInfoPtr scrn);
 const char *intel_get_client_name(ScrnInfoPtr scrn);
 int intel_get_master(ScrnInfoPtr scrn);
diff --git a/src/intel_module.c b/src/intel_module.c
index ca8eacd..6728d16 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -525,8 +525,7 @@ intel_platform_probe(DriverPtr driver,
 	if (!dev->pdev)
 		return FALSE;
 
-	if (intel_open_device(entity_num, dev->pdev,
-			      xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH)) == -1)
+	if (intel_open_device(entity_num, dev->pdev, dev))
 		return FALSE;
 
 	/* Allow ourselves to act as a slaved output if not primary */


More information about the xorg-commit mailing list