From 53fbc9f1760ee481cba1f6dceb9e7c97282a2976 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 30 Dec 2010 15:32:40 +0000 Subject: Don't replace the scanout bo through PutImage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the bo may be pinned for either use by the scanout or through sharing with another application, under those circumstances we cannot replace the bo itself but must force the blit for PutImage. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31367 Reported-and-tested-by: Bjørn Mork Signed-off-by: Chris Wilson --- src/intel.h | 1 + src/intel_dri.c | 26 +++++++++++++++++++------- src/intel_uxa.c | 5 +++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/intel.h b/src/intel.h index 04c679fc..9063328d 100644 --- a/src/intel.h +++ b/src/intel.h @@ -184,6 +184,7 @@ struct intel_pixmap { int8_t busy :2; int8_t batch_write :1; int8_t offscreen :1; + int8_t pinned :1; }; #if HAS_DEVPRIVATEKEYREC diff --git a/src/intel_dri.c b/src/intel_dri.c index b7afffdb..dcd3a1ac 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -73,6 +73,22 @@ typedef struct { unsigned int attachment; } I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr; +static uint32_t pixmap_flink(PixmapPtr pixmap) +{ + struct intel_pixmap *priv = intel_get_pixmap_private(pixmap); + uint32_t name; + dri_bo *bo; + + if (priv->bo == NULL) + return 0; + + if (dri_bo_flink(bo, &name) != 0) + return 0; + + priv->pinned = 1; + return name; +} + static PixmapPtr get_front_buffer(DrawablePtr drawable) { ScreenPtr screen = drawable->pScreen; @@ -179,10 +195,9 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, ScrnInfoPtr scrn = xf86Screens[screen->myNum]; intel_screen_private *intel = intel_get_screen_private(scrn); DRI2BufferPtr buffers; - dri_bo *bo; - int i; I830DRI2BufferPrivatePtr privates; PixmapPtr pixmap, pDepthPixmap; + int i; buffers = calloc(count, sizeof *buffers); if (buffers == NULL) @@ -251,8 +266,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, privates[i].pixmap = pixmap; privates[i].attachment = attachments[i]; - bo = intel_get_pixmap_bo(pixmap); - if (bo == NULL || dri_bo_flink(bo, &buffers[i].name) != 0) { + if ((buffers[i].name = pixmap_flink(pixmap)) == 0) { /* failed to name buffer */ screen->DestroyPixmap(pixmap); goto unwind; @@ -297,7 +311,6 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, ScrnInfoPtr scrn = xf86Screens[screen->myNum]; intel_screen_private *intel = intel_get_screen_private(scrn); DRI2Buffer2Ptr buffer; - dri_bo *bo; I830DRI2BufferPrivatePtr privates; PixmapPtr pixmap; @@ -358,8 +371,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, privates->pixmap = pixmap; privates->attachment = attachment; - bo = intel_get_pixmap_bo(pixmap); - if (bo == NULL || dri_bo_flink(bo, &buffer->name) != 0) { + if ((buffer->name = pixmap_flink(pixmap)) == 0) { /* failed to name buffer */ screen->DestroyPixmap(pixmap); free(privates); diff --git a/src/intel_uxa.c b/src/intel_uxa.c index 3f231ad2..1a591f1d 100644 --- a/src/intel_uxa.c +++ b/src/intel_uxa.c @@ -770,7 +770,8 @@ static Bool intel_uxa_put_image(PixmapPtr pixmap, } else { ScreenPtr screen = pixmap->drawable.pScreen; - if (x == 0 && y == 0 && + if (!priv->pinned && + x == 0 && y == 0 && w == pixmap->drawable.width && h == pixmap->drawable.height) { @@ -1101,7 +1102,7 @@ void intel_uxa_create_screen_resources(ScreenPtr screen) } else { PixmapPtr pixmap = screen->GetScreenPixmap(screen); intel_set_pixmap_bo(pixmap, bo); - intel_get_pixmap_private(pixmap)->busy = 1; + intel_get_pixmap_private(pixmap)->pinned = 1; screen->ModifyPixmapHeader(pixmap, scrn->virtualX, scrn->virtualY, -- cgit v1.2.3