summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-05-05 13:03:14 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-05-05 13:07:31 +0100
commita93d2d4f910dc66fe7114a4f44bf8098e3f7ae7a (patch)
tree6f10f3c1d191e92c03230a647a7a277febb9985d /tools
parent45892b3a63613af67e249e9ad006f2b2002570c0 (diff)
intel-virtual-output: Check for errors whilst creating ShmPixmaps
Creating a ShmPixmap may cause an asynchronous BadAccess error, so wrap the construction with XSync and check for an error before proceeding. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
Diffstat (limited to 'tools')
-rw-r--r--tools/virtual.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index b2f3069f..8803feab 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -827,6 +827,9 @@ static void output_init_xfer(struct clone *clone, struct output *output)
{
if (output->use_shm_pixmap) {
DBG(("%s-%s: creating shm pixmap\n", DisplayString(output->dpy), output->name));
+ XSync(output->dpy, False);
+ _x_error_occurred = 0;
+
if (output->pixmap)
XFreePixmap(output->dpy, output->pixmap);
output->pixmap = XShmCreatePixmap(output->dpy, output->window,
@@ -836,6 +839,13 @@ static void output_init_xfer(struct clone *clone, struct output *output)
XRenderFreePicture(output->dpy, output->pix_picture);
output->pix_picture = None;
}
+
+ XSync(output->dpy, False);
+ if (_x_error_occurred) {
+ XFreePixmap(output->dpy, output->pixmap);
+ output->pixmap = None;
+ output->use_shm_pixmap = 0;
+ }
}
if (output->use_render) {
DBG(("%s-%s: creating picture\n", DisplayString(output->dpy), output->name));