xf86-video-intel: 5 commits - src/sna/sna_display.c src/sna/sna_dri2.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jul 29 23:48:14 PDT 2014


 src/sna/sna_display.c |  135 +++++++++++++++++++++++++++++++-------------------
 src/sna/sna_dri2.c    |   23 +++++++-
 2 files changed, 105 insertions(+), 53 deletions(-)

New commits:
commit a6a60ec606e291323ee0b6e83679ff277a0bd84a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 30 07:42:04 2014 +0100

    sna: Silence a compiler warning
    
    sna_display.c: In function 'sna_crtc_redisplay':
    sna_display.c:6390:19: warning: unused variable 'sna_crtc' [-Wunused-variable]
      struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
    
    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 f24bc20..3f14af2 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -6387,7 +6387,6 @@ sna_crtc_redisplay(xf86CrtcPtr crtc, RegionPtr region, struct kgem_bo *bo)
 {
 	int16_t tx, ty, sx, sy;
 	struct sna *sna = to_sna(crtc->scrn);
-	struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
 	DrawablePtr draw = crtc_source(crtc, &sx, &sy);
 	struct sna_pixmap *priv = sna_pixmap((PixmapPtr)draw);
 
commit 33a0dd8f0b1e31e501825dc66f7ec2d85b55a7f4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 29 09:11:01 2014 +0100

    sna/dri2: Also check for stale buffers before exchanges
    
    Not impossible after all - usually after a client error.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 9388992..5d1c3da 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -144,6 +144,9 @@ sna_dri2_get_back(struct sna *sna,
 	uint32_t name;
 	bool reuse;
 
+	DBG(("%s: draw size=%dx%d, buffer size=%dx%d\n",
+	     __FUNCTION__, draw->width, draw->height,
+	     get_private(back)->size & 0xffff, get_private(back)->size >> 16));
 	reuse = (draw->height << 16 | draw->width) == get_private(back)->size;
 	if (reuse) {
 		bo = get_private(back)->bo;
@@ -461,11 +464,8 @@ sna_dri2_create_buffer(DrawablePtr draw,
 			assert(private->pixmap == pixmap);
 			assert(sna_pixmap(pixmap)->flush);
 			assert(sna_pixmap(pixmap)->pinned & PIN_DRI2);
-			assert(private->proxy != NULL || sna_pixmap(pixmap)->gpu_bo == private->bo);
 			assert(kgem_bo_flink(&sna->kgem, private->bo) == buffer->name);
 
-			buffer->attachment = DRI2BufferFrontLeft;
-
 			private->refcnt++;
 			return buffer;
 		}
@@ -1714,6 +1714,14 @@ can_xchg(struct sna * sna,
 	}
 
 	pixmap = get_window_pixmap(win);
+	if (sna_pixmap_get_buffer(pixmap) != front) {
+		DBG(("%s: no, stale buffer, front->handle=%d, pixmap->front->handle=%d\n",
+		     __FUNCTION__,
+		     get_private(front)->bo->handle,
+		     get_private(sna_pixmap_get_buffer(pixmap))->bo->handle));
+		return false;
+	}
+	assert(get_private(front)->pixmap == pixmap);
 
 	DBG(("%s: window size: %dx%d, clip=(%d, %d), (%d, %d) x %d, pixmap size=%dx%d\n",
 	     __FUNCTION__,
@@ -1827,6 +1835,15 @@ can_xchg_crtc(struct sna *sna,
 	}
 
 	pixmap = get_window_pixmap(win);
+	if (sna_pixmap_get_buffer(pixmap) != front) {
+		DBG(("%s: no, stale buffer, front->handle=%d, pixmap->front->handle=%d\n",
+		     __FUNCTION__,
+		     get_private(front)->bo->handle,
+		     get_private(sna_pixmap_get_buffer(pixmap))->bo->handle));
+		return false;
+	}
+	assert(get_private(front)->pixmap == pixmap);
+
 	if (pixmap != sna->front) {
 		DBG(("%s: no, not attached to front buffer\n", __FUNCTION__));
 		return false;
commit 376272be367c2712304a16da0f9362ffae5be0a7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 29 09:02:36 2014 +0100

    sna: Skip grabbing the main framebuffer id
    
    If we aren't using it, we can forgo obtaining the id.
    
    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 3304b95..f24bc20 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -6700,7 +6700,7 @@ disable1:
 		struct kgem_bo *new = __sna_pixmap_get_bo(sna->front);
 		struct kgem_bo *old = sna->mode.shadow;
 		struct drm_mode_crtc_page_flip arg;
-		uint32_t fb;
+		uint32_t fb = 0;
 
 		DBG(("%s: flipping tear-free outputs, current scanout handle=%d [active?=%d], new handle=%d [active=%d]\n",
 		     __FUNCTION__, old->handle, old->active_scanout, new->handle, new->active_scanout));
@@ -6708,28 +6708,6 @@ disable1:
 		assert(new != old);
 		assert(new->refcnt);
 
-		fb = get_fb(sna, new, sna->scrn->virtualX, sna->scrn->virtualY);
-		if (fb == 0) {
-fixup_shadow:
-			if (sna_pixmap_move_to_gpu(sna->front, MOVE_READ | MOVE_ASYNC_HINT)) {
-				BoxRec box;
-
-				box.x1 = 0;
-				box.y1 = 0;
-				box.x2 = sna->scrn->virtualX;
-				box.y2 = sna->scrn->virtualY;
-				if (sna->render.copy_boxes(sna, GXcopy,
-							   &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0,
-							   &sna->front->drawable, old, 0, 0,
-							   &box, 1, COPY_LAST)) {
-					kgem_submit(&sna->kgem);
-					RegionEmpty(region);
-				}
-			}
-
-			return;
-		}
-
 		arg.flags = DRM_MODE_PAGE_FLIP_EVENT;
 		arg.reserved = 0;
 
@@ -6759,9 +6737,33 @@ fixup_shadow:
 				arg.fb_id = get_fb(sna, crtc->shadow_bo,
 						   crtc->base->mode.HDisplay,
 						   crtc->base->mode.VDisplay);
+				assert(arg.fb_id != fb);
 				flip_bo = crtc->shadow_bo;
 				x = y = 0;
 			} else {
+				if (fb == 0)
+					fb = get_fb(sna, new, sna->scrn->virtualX, sna->scrn->virtualY);
+				if (fb == 0) {
+fixup_shadow:
+					if (sna_pixmap_move_to_gpu(sna->front, MOVE_READ | MOVE_ASYNC_HINT)) {
+						BoxRec box;
+
+						box.x1 = 0;
+						box.y1 = 0;
+						box.x2 = sna->scrn->virtualX;
+						box.y2 = sna->scrn->virtualY;
+						if (sna->render.copy_boxes(sna, GXcopy,
+									   &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0,
+									   &sna->front->drawable, old, 0, 0,
+									   &box, 1, COPY_LAST)) {
+							kgem_submit(&sna->kgem);
+							RegionEmpty(region);
+						}
+					}
+
+					return;
+				}
+
 				arg.fb_id = fb;
 				flip_bo = new;
 				x = crtc->base->x;
commit 4c66ee5e9793785585d37622b9419fd25c046d14
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 29 08:59:44 2014 +0100

    sna: Always clear CRTC overrides when adjusting the mode
    
    It is not necessary to resize before adjusting the CRTC, but if it
    moves the window may no longer be obscuring the CRTC.
    
    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 cddd2d2..3304b95 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1371,6 +1371,29 @@ static bool sna_crtc_enable_shadow(struct sna *sna, struct sna_crtc *crtc)
 	return true;
 }
 
+static void sna_crtc_disable_override(struct sna *sna, struct sna_crtc *crtc)
+{
+	if (crtc->shadow_bo == NULL)
+		return;
+
+	if (!crtc->transform) {
+		DrawableRec tmp;
+
+		tmp.width = crtc->base->mode.HDisplay;
+		tmp.height = crtc->base->mode.VDisplay;
+		tmp.depth = sna->front->drawable.depth;
+		tmp.bitsPerPixel = sna->front->drawable.bitsPerPixel;
+
+		sna->render.copy_boxes(sna, GXcopy,
+				       &tmp, crtc->shadow_bo, -crtc->base->bounds.x1, -crtc->base->bounds.y1,
+				       &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0,
+				       &crtc->base->bounds, 1, 0);
+		list_del(&crtc->shadow_link);
+	}
+	kgem_bo_destroy(&sna->kgem, crtc->shadow_bo);
+	crtc->shadow_bo = NULL;
+}
+
 static void sna_crtc_disable_shadow(struct sna *sna, struct sna_crtc *crtc)
 {
 	crtc->fallback_shadow = false;
@@ -1387,24 +1410,7 @@ static void sna_crtc_disable_shadow(struct sna *sna, struct sna_crtc *crtc)
 		crtc->slave_damage = NULL;
 	}
 
-	if (crtc->shadow_bo) {
-		if (!crtc->transform) {
-			DrawableRec tmp;
-
-			tmp.width = crtc->base->mode.HDisplay;
-			tmp.height = crtc->base->mode.VDisplay;
-			tmp.depth = sna->front->drawable.depth;
-			tmp.bitsPerPixel = sna->front->drawable.bitsPerPixel;
-
-			sna->render.copy_boxes(sna, GXcopy,
-					       &tmp, crtc->shadow_bo, -crtc->base->bounds.x1, -crtc->base->bounds.y1,
-					       &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0,
-					       &crtc->base->bounds, 1, 0);
-			list_del(&crtc->shadow_link);
-		}
-		kgem_bo_destroy(&sna->kgem, crtc->shadow_bo);
-		crtc->shadow_bo = NULL;
-	}
+	sna_crtc_disable_override(sna, crtc);
 
 	if (!--sna->mode.shadow_active)
 		sna_mode_disable_shadow(sna);
@@ -1853,6 +1859,8 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
 				sna->mode.shadow = shadow;
 				set_shadow(sna, &region);
 			}
+
+			sna_crtc_disable_override(sna, sna_crtc);
 		} else
 			sna_crtc_disable_shadow(sna, sna_crtc);
 
@@ -4404,7 +4412,7 @@ sna_show_cursors(ScrnInfoPtr scrn)
 	struct sna *sna = to_sna(scrn);
 	int sigio, c;
 
-	__DBG(("%s\n", __FUNCTION__));
+	DBG(("%s\n", __FUNCTION__));
 	if (sna->cursor.ref == NULL)
 		return;
 
@@ -4429,8 +4437,8 @@ sna_show_cursors(ScrnInfoPtr scrn)
 		if (cursor == NULL)
 			continue;
 
-		__DBG(("%s: CRTC:%d, handle->%d\n", __FUNCTION__,
-		       sna_crtc->id, cursor->handle));
+		DBG(("%s: CRTC:%d, handle->%d\n", __FUNCTION__,
+		     sna_crtc->id, cursor->handle));
 
 		VG_CLEAR(arg);
 		arg.flags = DRM_MODE_CURSOR_BO;
@@ -4506,7 +4514,7 @@ sna_hide_cursors(ScrnInfoPtr scrn)
 	struct sna_cursor *cursor, **prev;
 	int sigio, c;
 
-	__DBG(("%s\n", __FUNCTION__));
+	DBG(("%s\n", __FUNCTION__));
 
 	sigio = sigio_block();
 	for (c = 0; c < sna->mode.num_real_crtc; c++) {
@@ -4696,8 +4704,8 @@ sna_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
 {
 	struct sna *sna = to_sna_from_screen(screen);
 
-	__DBG(("%s (%dx%d)\n", __FUNCTION__,
-	       cursor->bits->width, cursor->bits->height));
+	DBG(("%s (%dx%d)?\n", __FUNCTION__,
+	     cursor->bits->width, cursor->bits->height));
 
 	/* cursors are invariant */
 	if (cursor == sna->cursor.ref)
@@ -4719,13 +4727,12 @@ sna_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
 	cursor->refcnt++;
 	sna->cursor.serial++;
 
-	__DBG(("%s(%dx%d): ARGB?=%d, serial->%d, size->%d\n", __FUNCTION__,
+	DBG(("%s(%dx%d): ARGB?=%d, serial->%d, size->%d\n", __FUNCTION__,
 	       cursor->bits->width,
 	       cursor->bits->height,
 	       get_cursor_argb(cursor) != NULL,
 	       sna->cursor.serial,
 	       sna->cursor.size));
-
 	return TRUE;
 }
 
commit 7ceb4028f4d69f4ab2e800d6b98809a998918154
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jul 27 17:50:29 2014 +0100

    sna: Select the panel native size of the unattached fb size
    
    When creating a framebuffer for an headless system, if there is a panel,
    use its native size rather than 1024x768.
    
    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 eed68d3..cddd2d2 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -5386,6 +5386,33 @@ static bool sna_probe_initial_configuration(struct sna *sna)
 			height = h;
 	}
 
+	/* Prefer the native panel size if any */
+	if (!width || !height) {
+		for (i = 0; i < sna->mode.num_real_output; i++) {
+			xf86OutputPtr output = config->output[i];
+			struct sna_output *sna_output = to_sna_output(output);
+
+			if (!sna_output->is_panel)
+				continue;
+
+			DBG(("%s: querying panel '%s' for preferred unattached size\n",
+			     __FUNCTION__, output->name));
+
+			if (sna_output_detect(output) != XF86OutputStatusConnected)
+				continue;
+
+			if (sna_output->num_modes == 0)
+				continue;
+
+			width = sna_output->modes[0].hdisplay;
+			height= sna_output->modes[0].vdisplay;
+
+			DBG(("%s: panel '%s' is %dx%d\n",
+			     __FUNCTION__, output->name, width, height));
+			break;
+		}
+	}
+
 	if (!width || !height) {
 		width = 1024;
 		height = 768;


More information about the xorg-commit mailing list