xf86-video-intel: src/sna/sna_display.c src/sna/sna_driver.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Sep 10 02:57:20 PDT 2012


 src/sna/sna_display.c |   23 ++++++++++++++++++-----
 src/sna/sna_driver.c  |    6 ++++--
 2 files changed, 22 insertions(+), 7 deletions(-)

New commits:
commit cfa0c6162bbd2f6edab1301b6aed886af7e8ab38
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 10 10:50:03 2012 +0100

    sna: Fixup possible_crtcs for ZaphodHeads
    
    As the possible_crtcs is a bitmask of the available crtcs exposed to the
    Xserver, we need to adjust it for the limited view given by Zaphod mode.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index be5d983..a9c5440 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -804,8 +804,8 @@ static void update_flush_interval(struct sna *sna)
 			continue;
 		}
 
-		DBG(("%s: CRTC:%d (pipe %d) vrefresh=%d\n",
-		     __FUNCTION__,i, to_sna_crtc(crtc)->pipe,
+		DBG(("%s: CRTC:%d (pipe %d) vrefresh=%f\n",
+		     __FUNCTION__, i, to_sna_crtc(crtc)->pipe,
 		     xf86ModeVRefresh(&crtc->mode)));
 		max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(&crtc->mode));
 	}
@@ -2192,7 +2192,6 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
 	struct drm_mode_get_encoder enc;
 	struct sna_output *sna_output;
 	const char *output_name;
-	const char *s;
 	char name[32];
 
 	koutput = drmModeGetConnector(sna->kgem.fd,
@@ -2212,9 +2211,23 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
 	snprintf(name, 32, "%s%d", output_name, koutput->connector_type_id);
 
 	if (xf86IsEntityShared(scrn->entityList[0])) {
-		s = xf86GetOptValString(sna->Options, OPTION_ZAPHOD);
-		if (s && !sna_zaphod_match(s, name))
+		const char *str;
+
+		str = xf86GetOptValString(sna->Options, OPTION_ZAPHOD);
+		if (str && !sna_zaphod_match(str, name))
+			goto cleanup_connector;
+
+		if ((enc.possible_crtcs & (1 << scrn->confScreen->device->screen)) == 0) {
+			if (str) {
+				xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+					   "%s is an invalid output for screen (pipe) %d\n",
+					   name, scrn->confScreen->device->screen);
+			}
 			goto cleanup_connector;
+		}
+
+		enc.possible_crtcs = 1;
+		enc.possible_clones = 0;
 	}
 
 	output = xf86OutputCreate(scrn, &sna_output_funcs, name);
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index a5c106e..a29227b 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -256,12 +256,15 @@ static int sna_open_drm_master(ScrnInfoPtr scrn)
 	dev = sna_device(scrn);
 	if (dev) {
 		dev->open_count++;
+		DBG(("%s: reusing device, count=%d\n",
+		     __FUNCTION__, dev->open_count));
 		return dev->fd;
 	}
 
 	snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d",
 		 pci->domain, pci->bus, pci->dev, pci->func);
 
+	DBG(("%s: opening device '%s'\n",  __FUNCTION__, busid));
 	fd = drmOpen(NULL, busid);
 	if (fd == -1) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -1080,6 +1083,7 @@ static Bool sna_pm_event(SCRN_ARG_TYPE arg, pmEvent event, Bool undo)
 
 Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
 {
+	DBG(("%s: entity_num=%d\n", __FUNCTION__, entity_num));
 #if defined(USE_GIT_DESCRIBE)
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
 		   "SNA compiled from %s\n", git_version);
@@ -1099,8 +1103,6 @@ Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
 	xf86DrvMsg(scrn->scrnIndex, X_INFO,
 		   "SNA compiled with extra pixmap/damage validation\n");
 #endif
-
-	DBG(("%s\n", __FUNCTION__));
 	DBG(("pixman version: %s\n", pixman_version_string()));
 
 	if (sna_device_key == -1)


More information about the xorg-commit mailing list