xf86-video-intel: src/sna/sna_dri2.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jan 27 04:02:09 PST 2015


 src/sna/sna_dri2.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 4bbd1023675f4724bd17de50dd750514626104bf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 27 08:49:41 2015 +0000

    sna/dri2: Check for comparable back/front pitches more carefully
    
    Suppose for a moment that we don't have a DRI2Buffer associated with the
    Drawable just yet... This could happen after a Composite redirect as the
    front buffer may created (and so associated with the new Pixmap) after
    the back buffer is recreated.
    
    Reported-by: Tomas Pruzina <pruzinat at gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88814
    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 fd3edcc..bfe84ad 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -139,6 +139,12 @@ struct sna_dri2_event {
 
 static void sna_dri2_flip_event(struct sna_dri2_event *flip);
 
+static int front_pitch(DrawablePtr draw)
+{
+	DRI2BufferPtr buffer = sna_pixmap_get_buffer(get_drawable_pixmap(draw));
+	return buffer ? buffer->pitch : 0;
+}
+
 static void
 sna_dri2_get_back(struct sna *sna,
 		  DrawablePtr draw,
@@ -154,10 +160,10 @@ sna_dri2_get_back(struct sna *sna,
 	     __FUNCTION__, draw->width, draw->height,
 	     get_private(back)->size & 0xffff, get_private(back)->size >> 16,
 	     get_private(back)->bo->scanout,
-	     back->pitch, sna_pixmap_get_buffer(get_drawable_pixmap(draw))->pitch ));
+	     back->pitch, front_pitch(draw)));
 	reuse = (draw->height << 16 | draw->width) == get_private(back)->size;
 	if (reuse && get_private(back)->bo->scanout)
-		reuse = sna_pixmap_get_buffer(get_drawable_pixmap(draw))->pitch == back->pitch;
+		reuse = front_pitch(draw) == back->pitch;
 	if (reuse) {
 		bo = get_private(back)->bo;
 		assert(bo->refcnt);
@@ -504,6 +510,7 @@ sna_dri2_create_buffer(DrawablePtr draw,
 			assert(sna_pixmap(pixmap)->flush);
 			assert(sna_pixmap(pixmap)->pinned & PIN_DRI2);
 			assert(kgem_bo_flink(&sna->kgem, private->bo) == buffer->name);
+			assert(private->bo->pitch == buffer->pitch);
 
 			private->refcnt++;
 			return buffer;


More information about the xorg-commit mailing list