From: Eric Anholt Subject: [PATCH 1/3] Submit any existing batchbuffer before potentially handing off a BO to TFP. Date: Tue, 20 Apr 2010 13:08:09 -0700 Message-ID: <1271794089-9152-1-git-send-email-eric@anholt.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org Otherwise, a GL compositing manager could get the results of rendering not synced with the X command stream as of the TFP call. --- This is untested for actually fixing any particular bugs, but I was wondering how things were supposed to work given the recent flurry of bug reports about compositing and damage. src/i830_dri.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/i830_dri.c b/src/i830_dri.c index 321faf6..f30142c 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -79,6 +79,21 @@ typedef struct { unsigned int attachment; } I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr; +/* If the drawable is one that might have GLX_texture_from_pixmap done + * to it, flush rendering before handing a reference to it back to + * GLX. + */ +static void +do_tfp_flush(DrawablePtr drawable) +{ + if (drawable->type == DRAWABLE_PIXMAP) { + ScreenPtr screen = drawable->pScreen; + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + + intel_batch_submit(scrn); + } +} + #ifndef USE_DRI2_1_1_0 static DRI2BufferPtr I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, @@ -105,6 +120,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, pDepthPixmap = NULL; for (i = 0; i < count; i++) { if (attachments[i] == DRI2BufferFrontLeft) { + do_tfp_flush(drawable); pixmap = get_drawable_pixmap(drawable); pixmap->refcnt++; } else if (attachments[i] == DRI2BufferStencil && pDepthPixmap) { @@ -184,6 +200,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, } if (attachment == DRI2BufferFrontLeft) { + do_tfp_flush(drawable); pixmap = get_drawable_pixmap(drawable); pixmap->refcnt++; } else { -- 1.7.0.4