summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-12-30 15:32:40 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2010-12-30 16:48:52 +0000
commit53fbc9f1760ee481cba1f6dceb9e7c97282a2976 (patch)
tree77ab04daca51090b0ac3e81e33932df5d6b596f2
parent7667ad8432c032aec3a2aa004fc4dfc1877971b3 (diff)
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 Reported-and-tested-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel.h1
-rw-r--r--src/intel_dri.c26
-rw-r--r--src/intel_uxa.c5
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,