xf86-video-intel: 4 commits - src/sna/sna_accel.c src/sna/sna_display.c src/sna/sna_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Thu May 1 01:44:26 PDT 2014


 src/sna/sna_accel.c   |   52 +++++++++++++++++---------------------------------
 src/sna/sna_display.c |    6 ++++-
 src/sna/sna_dri.c     |   48 ++++++++++++++++++----------------------------
 3 files changed, 42 insertions(+), 64 deletions(-)

New commits:
commit 150458c402f2a93e87924dacd3d0e99def512b85
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 1 09:42:07 2014 +0100

    sna: Refactor migration DBG code
    
    And add a new DBG option to disable partial-cpu migrations.
    
    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 7efaba8..ef7f842 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -78,6 +78,7 @@
 #define UNDO 1
 
 #define MIGRATE_ALL 0
+#define DBG_NO_PARTIAL_MOVE_TO_CPU 0
 #define DBG_NO_CPU_UPLOAD 0
 #define DBG_NO_CPU_DOWNLOAD 0
 
@@ -2394,6 +2395,12 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 	if (box_empty(&region->extents))
 		return true;
 
+	if (MIGRATE_ALL || DBG_NO_PARTIAL_MOVE_TO_CPU) {
+		if (!region_subsumes_pixmap(region, pixmap))
+			flags |= MOVE_READ;
+		return _sna_pixmap_move_to_cpu(pixmap, flags);
+	}
+
 	priv = sna_pixmap(pixmap);
 	if (priv == NULL) {
 		DBG(("%s: not attached to pixmap %ld (depth %d)\n",
@@ -2732,34 +2739,6 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		goto done;
 	}
 
-	if (MIGRATE_ALL && priv->gpu_damage) {
-		BoxPtr box;
-		int n = sna_damage_get_boxes(priv->gpu_damage, &box);
-		if (n) {
-			bool ok;
-
-			DBG(("%s: forced migration\n", __FUNCTION__));
-
-			assert(pixmap_contains_damage(pixmap, priv->gpu_damage));
-			assert(priv->gpu_bo);
-
-			ok = false;
-			if (use_cpu_bo_for_download(sna, priv, n, box)) {
-				DBG(("%s: using CPU bo for download from GPU\n", __FUNCTION__));
-				ok = sna->render.copy_boxes(sna, GXcopy,
-							    pixmap, priv->gpu_bo, 0, 0,
-							    pixmap, priv->cpu_bo, 0, 0,
-							    box, n, COPY_LAST);
-			}
-			if (!ok) {
-				assert(has_coherent_ptr(sna, sna_pixmap(pixmap), MOVE_READ));
-				sna_read_boxes(sna, pixmap, priv->gpu_bo,
-					       box, n);
-			}
-		}
-		sna_damage_destroy(&priv->gpu_damage);
-	}
-
 	if (priv->gpu_damage &&
 	    (DAMAGE_IS_ALL(priv->gpu_damage) ||
 	     sna_damage_overlaps_box(priv->gpu_damage, &region->extents))) {
commit ca57ee723497b07396646e567fd87dfce8d779fa
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 1 09:15:28 2014 +0100

    sna: Add some DBG for tracing vblanks across modeset/resume
    
    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 80a117c..624c579 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4764,6 +4764,8 @@ void sna_mode_update(struct sna *sna)
 	if (sna->flags & SNA_IS_HOSTED)
 		return;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	/* Validate CRTC attachments and force consistency upon the kernel */
 	sna->mode.front_active = 0;
 	for (i = 0; i < config->num_crtc; i++) {
@@ -4822,6 +4824,8 @@ void sna_mode_reset(struct sna *sna)
 	if (sna->flags & SNA_IS_HOSTED)
 		return;
 
+	DBG(("%s\n", __FUNCTION__));
+
 	sna_hide_cursors(sna->scrn);
 
 	for (i = 0; i < config->num_crtc; i++) {
@@ -5334,7 +5338,7 @@ disable1:
 				continue;
 
 			assert(config->crtc[i]->enabled);
-			assert(crtc->dpms_mode == DPMSModeOn);
+			assert(crtc->dpms_mode <= DPMSModeOn);
 
 			arg.crtc_id = crtc->id;
 			arg.fb_id = get_fb(sna, new,
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 5aa4e98..dc1ceaa 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -2345,6 +2345,7 @@ sna_dri_schedule_wait_msc(ClientPtr client, DrawablePtr draw, CARD64 target_msc,
 	if (sna_wait_vblank(sna, &vbl))
 		goto out_free_info;
 
+	DBG(("%s: waiting until MSC=%llu\n", __FUNCTION__, (long long)vbl.request.sequence));
 	DRI2BlockClient(client, draw);
 	return TRUE;
 
commit bcbb2f222c39ab8732bf1daa248c77ce22cc173e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Apr 30 14:43:01 2014 +0100

    sna/dri: Tidy call to vblank ioctl for MSC waiting
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index ba705ec..5aa4e98 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -2314,45 +2314,34 @@ sna_dri_schedule_wait_msc(ClientPtr client, DrawablePtr draw, CARD64 target_msc,
 	info->type = DRI2_WAITMSC;
 	sna_dri_add_frame_event(draw, info);
 
+	vbl.request.signal = (unsigned long)info;
+	vbl.request.type =
+		DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT | pipe_select(pipe);
 	/*
 	 * If divisor is zero, or current_msc is smaller than target_msc,
 	 * we just need to make sure target_msc passes before waking up the
 	 * client.
 	 */
 	if (divisor == 0 || current_msc < target_msc) {
-		vbl.request.type =
-			DRM_VBLANK_ABSOLUTE |
-			DRM_VBLANK_EVENT |
-			pipe_select(pipe);
 		vbl.request.sequence = target_msc;
-		vbl.request.signal = (unsigned long)info;
-		if (sna_wait_vblank(sna, &vbl))
-			goto out_free_info;
+	} else {
+		/*
+		 * If we get here, target_msc has already passed or we don't have one,
+		 * so we queue an event that will satisfy the divisor/remainder
+		 * equation.
+		 */
+		vbl.request.sequence = current_msc - current_msc % divisor + remainder;
 
-		DRI2BlockClient(client, draw);
-		return TRUE;
+		/*
+		 * If calculated remainder is larger than requested remainder,
+		 * it means we've passed the last point where
+		 * seq % divisor == remainder, so we need to wait for the next time
+		 * that will happen.
+		 */
+		if ((current_msc % divisor) >= remainder)
+			vbl.request.sequence += divisor;
 	}
 
-	/*
-	 * If we get here, target_msc has already passed or we don't have one,
-	 * so we queue an event that will satisfy the divisor/remainder
-	 * equation.
-	 */
-	vbl.request.type =
-		DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT | pipe_select(pipe);
-
-	vbl.request.sequence = current_msc - current_msc % divisor + remainder;
-
-	/*
-	 * If calculated remainder is larger than requested remainder,
-	 * it means we've passed the last point where
-	 * seq % divisor == remainder, so we need to wait for the next time
-	 * that will happen.
-	 */
-	if ((current_msc % divisor) >= remainder)
-		vbl.request.sequence += divisor;
-
-	vbl.request.signal = (unsigned long)info;
 	if (sna_wait_vblank(sna, &vbl))
 		goto out_free_info;
 
commit 4430703619dc6012407ab703f211dc1181ba6ec8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Apr 30 11:10:49 2014 +0100

    sna: Be more lenient and allow tiled uploads to replace CPU buffers
    
    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 00db82f..7efaba8 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4337,11 +4337,12 @@ static inline void box32_add_rect(Box32Rec *box, const xRectangle *r)
 static bool
 create_upload_tiled_x(struct kgem *kgem,
 		      PixmapPtr pixmap,
-		      struct sna_pixmap *priv)
+		      struct sna_pixmap *priv,
+		      bool replaces)
 {
 	unsigned create, tiling;
 
-	if (priv->shm || priv->cpu)
+	if (priv->shm || (priv->cpu && !replaces))
 		return false;
 
 	if ((priv->create & KGEM_CAN_CREATE_GPU) == 0)
@@ -4496,7 +4497,12 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 	     priv->gpu_bo ? kgem_bo_can_map__cpu(&sna->kgem, priv->gpu_bo, true) : 0,
 	     replaces));
 
-	if (priv->gpu_bo && (replaces || priv->gpu_bo->proxy)) {
+	if (priv->gpu_bo && priv->gpu_bo->proxy) {
+		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
+		priv->gpu_bo = NULL;
+	}
+
+	if (priv->gpu_bo && replaces) {
 		DBG(("%s: discarding cached upload proxy\n", __FUNCTION__));
 		sna_pixmap_free_gpu(sna, priv);
 		replaces = true; /* Mark it all GPU damaged afterwards */
@@ -4509,7 +4515,7 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 	}
 
 	if (priv->gpu_bo == NULL &&
-	    !create_upload_tiled_x(&sna->kgem, pixmap, priv))
+	    !create_upload_tiled_x(&sna->kgem, pixmap, priv, replaces))
 		return false;
 
 	DBG(("%s: tiling=%d\n", __FUNCTION__, priv->gpu_bo->tiling));
@@ -4672,8 +4678,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
 		return true;
 
 	hint = MOVE_WRITE;
-	if (region_is_unclipped(region, w, h) &&
-	    w == pixmap->drawable.width &&
+	if (region_is_unclipped(region, pixmap->drawable.width, h) &&
 	    (h+1)*stride > 65536) {
 		DBG(("%s: segmented, unclipped large upload (%d bytes), marking WHOLE_HINT\n",
 		     __FUNCTION__, h*stride));


More information about the xorg-commit mailing list