xf86-video-intel: 2 commits - src/sna/sna_display.c src/sna/sna_dri.c src/sna/sna.h src/sna/sna_video_sprite.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Oct 23 07:24:41 PDT 2012


 src/sna/sna.h              |    1 
 src/sna/sna_display.c      |   50 +++++++++++++++++++--------------------------
 src/sna/sna_dri.c          |   21 ++++++++++++++++++
 src/sna/sna_video_sprite.c |   11 ++++++++-
 4 files changed, 53 insertions(+), 30 deletions(-)

New commits:
commit c7f48684cdebc24128a5fa5678614af3deb14b3b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 23 15:17:56 2012 +0100

    sna: Only disallow hw sprite scaling on Haswell
    
    Earlier chips (Ironlake, Sandybridge and Ivybridge) have integrated
    sprite scalers.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index e90c18c..ff3b4b3 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -114,8 +114,15 @@ static void sna_video_sprite_best_size(ScrnInfoPtr scrn, Bool motion,
 				       unsigned int *p_w, unsigned int *p_h,
 				       pointer data)
 {
-	*p_w = vid_w;
-	*p_h = vid_h;
+	struct sna *sna = to_sna(scrn);
+
+	if (sna->kgem.gen == 75) {
+		*p_w = vid_w;
+		*p_h = vid_h;
+	} else {
+		*p_w = drw_w;
+		*p_h = drw_h;
+	}
 }
 
 static void
commit 5c3ea9cf6900855502fcd56214a1b9e180265ff5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Oct 22 22:35:17 2012 +0100

    sna: Update DRI buffer if attached to the framebuffer for TearFree flips
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index dc18fee..d44dfeb 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -368,6 +368,7 @@ static inline void sna_dri_vblank_handler(struct sna *sna, struct drm_event_vbla
 static inline void sna_dri_destroy_window(WindowPtr win) { }
 static inline void sna_dri_close(struct sna *sna, ScreenPtr pScreen) { }
 #endif
+void sna_dri_pixmap_update_bo(struct sna *sna, PixmapPtr pixmap);
 
 extern int sna_crtc_to_pipe(xf86CrtcPtr crtc);
 extern int sna_crtc_to_plane(xf86CrtcPtr crtc);
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c8497fc..10a7095 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3223,6 +3223,7 @@ void sna_mode_redisplay(struct sna *sna)
 
 		for (i = 0; i < config->num_crtc; i++) {
 			struct sna_crtc *crtc = config->crtc[i]->driver_private;
+			struct drm_mode_crtc_page_flip arg;
 
 			DBG(("%s: crtc %d [%d, pipe=%d] active? %d\n",
 			     __FUNCTION__, i, crtc->id, crtc->pipe, crtc->bo != NULL));
@@ -3230,41 +3231,33 @@ void sna_mode_redisplay(struct sna *sna)
 				continue;
 
 			assert(config->crtc[i]->enabled);
-
-			if (crtc->dpms_mode == DPMSModeOn) {
-				struct drm_mode_crtc_page_flip arg;
-				arg.crtc_id = crtc->id;
-				arg.fb_id = get_fb(sna, new,
-						   sna->scrn->virtualX,
-						   sna->scrn->virtualY);
-				if (arg.fb_id == 0)
-					goto disable;
-
-				/* Only the reference crtc will finally deliver its page flip
-				 * completion event. All other crtc's events will be discarded.
-				 */
-				arg.user_data = 0;
-				arg.flags = DRM_MODE_PAGE_FLIP_EVENT;
-				arg.reserved = 0;
-
-				if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_PAGE_FLIP, &arg)) {
-					DBG(("%s: flip [fb=%d] on crtc %d [%d, pipe=%d] failed - %d\n",
-					     __FUNCTION__, arg.fb_id, i, crtc->id, crtc->pipe, errno));
+			assert(crtc->dpms_mode == DPMSModeOn);
+
+			arg.crtc_id = crtc->id;
+			arg.fb_id = get_fb(sna, new,
+					   sna->scrn->virtualX,
+					   sna->scrn->virtualY);
+			if (arg.fb_id == 0)
+				goto disable;
+
+			arg.user_data = 0;
+			arg.flags = DRM_MODE_PAGE_FLIP_EVENT;
+			arg.reserved = 0;
+
+			if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_PAGE_FLIP, &arg)) {
+				DBG(("%s: flip [fb=%d] on crtc %d [%d, pipe=%d] failed - %d\n",
+				     __FUNCTION__, arg.fb_id, i, crtc->id, crtc->pipe, errno));
 disable:
-					sna_crtc_disable(config->crtc[i]);
-					continue;
-				}
-				sna->mode.shadow_flip++;
+				sna_crtc_disable(config->crtc[i]);
+				continue;
 			}
+			sna->mode.shadow_flip++;
 
 			kgem_bo_destroy(&sna->kgem, old);
 			crtc->bo = kgem_bo_reference(new);
 		}
 
 		if (sna->mode.shadow) {
-			/* XXX only works if the kernel stalls fwrites to the current
-			 * scanout whilst the flip is pending
-			 */
 			while (sna->mode.shadow_flip)
 				sna_mode_wakeup(sna);
 			(void)sna->render.copy_boxes(sna, GXcopy,
@@ -3276,8 +3269,9 @@ disable:
 			kgem_submit(&sna->kgem);
 
 			sna_pixmap(sna->front)->gpu_bo = old;
-			sna->mode.shadow = new;
+			sna_dri_pixmap_update_bo(sna, sna->front);
 
+			sna->mode.shadow = new;
 			new->flush = old->flush;
 		}
 
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 09ecd29..3abcbc2 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -207,6 +207,27 @@ static inline void sna_pixmap_set_buffer(PixmapPtr pixmap, void *ptr)
 	((void **)dixGetPrivateAddr(&pixmap->devPrivates, &sna_pixmap_key))[2] = ptr;
 }
 
+void
+sna_dri_pixmap_update_bo(struct sna *sna, PixmapPtr pixmap)
+{
+	DRI2Buffer2Ptr buffer;
+	struct sna_dri_private *private;
+	struct kgem_bo *bo;
+
+	buffer = sna_pixmap_get_buffer(pixmap);
+	if (buffer == NULL)
+		return;
+
+	private = get_private(buffer);
+	assert(private->pixmap == pixmap);
+
+	bo = sna_pixmap(pixmap)->gpu_bo;
+	buffer->name = kgem_bo_flink(&sna->kgem, bo);
+	private->bo = bo;
+
+	/* XXX DRI2InvalidateDrawable(&pixmap->drawable); */
+}
+
 static DRI2Buffer2Ptr
 sna_dri_create_buffer(DrawablePtr draw,
 		      unsigned int attachment,


More information about the xorg-commit mailing list