xf86-video-intel: 2 commits - src/intel_display.c src/intel_driver.c src/sna/sna_display.c src/sna/sna_driver.c

Chris Wilson ickle at kemper.freedesktop.org
Thu May 24 04:06:19 PDT 2012


 src/intel_display.c   |   22 ++++++++++++++++++++++
 src/intel_driver.c    |   20 --------------------
 src/sna/sna_display.c |   40 +++++++++++++++++++++++++++++++---------
 src/sna/sna_driver.c  |    4 +++-
 4 files changed, 56 insertions(+), 30 deletions(-)

New commits:
commit 3f3bde4f0c72f6f31aae322bcdc20b95eade6631
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 24 11:58:46 2012 +0100

    uxa: Only consider an output valid if the kernel reports it attached
    
    Reported-by: Kyle Hill <kyle.hill at tacomafia.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50078
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_display.c b/src/intel_display.c
index abdc372..77a1cce 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1699,3 +1699,25 @@ int intel_crtc_to_pipe(xf86CrtcPtr crtc)
 	struct intel_crtc *intel_crtc = crtc->driver_private;
 	return intel_crtc->pipe;
 }
+
+Bool intel_crtc_on(xf86CrtcPtr crtc)
+{
+	ScrnInfoPtr scrn = crtc->scrn;
+	struct intel_crtc *intel_crtc = crtc->driver_private;
+	drmModeCrtcPtr drm_crtc;
+	Bool ret;
+
+	if (!crtc->enabled)
+		return FALSE;
+
+	/* Kernel manages CRTC status based on output config */
+	drm_crtc = drmModeGetCrtc(intel_crtc->mode->fd, crtc_id(intel_crtc));
+	if (drm_crtc == NULL)
+		return FALSE;
+
+	ret = (drm_crtc->mode_valid &&
+	       intel_crtc->mode->fb_id == drm_crtc->buffer_id);
+	free(drm_crtc);
+
+	return ret;
+}
diff --git a/src/intel_driver.c b/src/intel_driver.c
index d67d8c8..b055437 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -782,26 +782,6 @@ intel_init_initial_framebuffer(ScrnInfoPtr scrn)
 	return TRUE;
 }
 
-Bool intel_crtc_on(xf86CrtcPtr crtc)
-{
-	ScrnInfoPtr scrn = crtc->scrn;
-	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-	int i;
-
-	if (!crtc->enabled)
-		return FALSE;
-
-	/* Kernel manages CRTC status based out output config */
-	for (i = 0; i < xf86_config->num_output; i++) {
-		xf86OutputPtr output = xf86_config->output[i];
-		if (output->crtc == crtc &&
-		    intel_output_dpms_status(output) == DPMSModeOn)
-			return TRUE;
-	}
-
-	return FALSE;
-}
-
 static void
 intel_flush_callback(CallbackListPtr *list,
 		     pointer user_data, pointer call_data)
commit 11db66fedf96f158cbbac8011a8ba0b29a20ba3a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 24 11:07:19 2012 +0100

    sna: Add some more DBG tracepoints around modesetting
    
    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 990dd2e..c5b96f2 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -213,6 +213,8 @@ sna_output_backlight_set(xf86OutputPtr output, int level)
 	char path[BACKLIGHT_PATH_LEN], val[BACKLIGHT_VALUE_LEN];
 	int fd, len, ret;
 
+	DBG(("%s: level=%d\n", __FUNCTION__, level));
+
 	if (level > sna_output->backlight_max)
 		level = sna_output->backlight_max;
 	if (! sna_output->backlight_iface || level < 0)
@@ -262,9 +264,12 @@ sna_output_backlight_get(xf86OutputPtr output)
 	close(fd);
 
 	level = atoi(val);
+	DBG(("%s: level=%d (max=%d)\n",
+	     __FUNCTION__, level, sna_output->backlight_max));
+
 	if (level > sna_output->backlight_max)
 		level = sna_output->backlight_max;
-	if (level < 0)
+	else if (level < 0)
 		level = -1;
 	return level;
 }
@@ -394,6 +399,8 @@ sna_crtc_apply(xf86CrtcPtr crtc)
 	int fb_id, x, y;
 	int i, ret = FALSE;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	assert(xf86_config->num_output < ARRAY_SIZE(output_ids));
 
 	for (i = 0; i < xf86_config->num_output; i++) {
@@ -466,6 +473,9 @@ sna_crtc_restore(struct sna *sna)
 	struct kgem_bo *bo;
 	int i;
 
+	DBG(("%s (fb_pixmap=%d, front=%d)\n", __FUNCTION__,
+	     sna->mode.fb_pixmap, sna->front->drawable.serialNumber));
+
 	if (sna->mode.fb_pixmap == sna->front->drawable.serialNumber)
 		return;
 
@@ -492,12 +502,8 @@ sna_crtc_restore(struct sna *sna)
 
 	for (i = 0; i < xf86_config->num_crtc; i++) {
 		xf86CrtcPtr crtc = xf86_config->crtc[i];
-
-		if (!crtc->enabled)
-			continue;
-
-		if (!sna_crtc_apply(crtc))
-			return;
+		if (crtc->enabled)
+			sna_crtc_apply(crtc);
 	}
 
 	kgem_bo_retire(&sna->kgem, bo);
@@ -560,9 +566,11 @@ void sna_copy_fbcon(struct sna *sna)
 	int dx, dy;
 	int i;
 
-	if (sna->kgem.wedged)
+	if (wedged(sna))
 		return;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	/* Scan the connectors for a framebuffer and assume that is the fbcon */
 	fbcon = NULL;
 	for (i = 0; fbcon == NULL && i < xf86_config->num_crtc; i++) {
@@ -579,8 +587,10 @@ void sna_copy_fbcon(struct sna *sna)
 					     mode_crtc->buffer_id);
 		drmModeFreeCrtc(mode_crtc);
 	}
-	if (fbcon == NULL)
+	if (fbcon == NULL) {
+		DBG(("%s: no fbcon found\n", __FUNCTION__));
 		return;
+	}
 
 	/* Wrap the fbcon in a pixmap so that we select the right formats
 	 * in the render copy in case we need to preserve the fbcon
@@ -601,6 +611,8 @@ void sna_copy_fbcon(struct sna *sna)
 	if (bo == NULL)
 		goto cleanup_scratch;
 
+	DBG(("%s: fbcon handle=%d\n", __FUNCTION__, bo->handle));
+
 	priv = sna_pixmap(sna->front);
 	assert(priv && priv->gpu_bo);
 
@@ -756,6 +768,7 @@ sna_crtc_hide_cursor(xf86CrtcPtr crtc)
 	struct sna *sna = to_sna(crtc->scrn);
 	struct sna_crtc *sna_crtc = crtc->driver_private;
 
+	DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
 	drmModeSetCursor(sna->kgem.fd, crtc_id(sna_crtc), 0, 64, 64);
 }
 
@@ -765,6 +778,7 @@ sna_crtc_show_cursor(xf86CrtcPtr crtc)
 	struct sna *sna = to_sna(crtc->scrn);
 	struct sna_crtc *sna_crtc = crtc->driver_private;
 
+	DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
 	drmModeSetCursor(sna->kgem.fd, crtc_id(sna_crtc),
 			 sna_crtc->cursor, 64, 64);
 }
@@ -909,6 +923,8 @@ sna_crtc_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
 	struct sna_crtc *sna_crtc;
 	struct drm_i915_get_pipe_from_crtc_id get_pipe;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	sna_crtc = calloc(sizeof(struct sna_crtc), 1);
 	if (sna_crtc == NULL)
 		return;
@@ -967,6 +983,8 @@ sna_output_detect(xf86OutputPtr output)
 	struct sna_output *sna_output = output->driver_private;
 	xf86OutputStatus status;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	drmModeFreeConnector(sna_output->mode_output);
 	sna_output->mode_output =
 		drmModeGetConnector(sna->kgem.fd, sna_output->output_id);
@@ -1099,6 +1117,8 @@ sna_output_get_modes(xf86OutputPtr output)
 	DisplayModePtr Modes = NULL;
 	int i;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	sna_output_attach_edid(output);
 
 	/* modes should already be available */
@@ -1190,6 +1210,8 @@ sna_output_dpms(xf86OutputPtr output, int dpms)
 	drmModeConnectorPtr koutput = sna_output->mode_output;
 	int i;
 
+	DBG(("%s: dpms=%d\n", __FUNCTION__, dpms));
+
 	for (i = 0; i < koutput->count_props; i++) {
 		drmModePropertyPtr props;
 
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index d4b7eb0..cab6d03 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -633,8 +633,10 @@ sna_handle_uevents(int fd, void *closure)
 	hotplug = udev_device_get_property_value(dev, "HOTPLUG");
 
 	if (memcmp(&s.st_rdev, &udev_devnum, sizeof (dev_t)) == 0 &&
-			hotplug && atoi(hotplug) == 1)
+	    hotplug && atoi(hotplug) == 1) {
+		DBG(("%s: hotplug event\n", __FUNCTION__));
 		RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
+	}
 
 	udev_device_unref(dev);
 }


More information about the xorg-commit mailing list