From e930dbcbc3c543e7f7299001a245c254a45d4653 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 30 Dec 2010 15:32:40 +0000 Subject: [PATCH] Don't replace the scanout bo through PutImage 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 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 04c679f..9063328 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 b7afffd..dcd3a1a 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 3f231ad..1a591f1 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, -- 1.7.2.3