From fb038eb37906eba9a88e0cb6622a59f06dcc2a68 Mon Sep 17 00:00:00 2001 From: Søren Sandmann Date: Wed, 12 Sep 2012 12:54:06 -0400 Subject: Don't issue composite commands or create a8 surfaces when not available When the device or the client are not capable of composite commands or a8 surfaces, don't issue these commands. --- src/qxl_driver.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/qxl_driver.c b/src/qxl_driver.c index c7b8486..04a9aa8 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -47,6 +47,7 @@ #include "qxl.h" #include "assert.h" #include "qxl_option_helpers.h" +#include #ifdef XSPICE #include "spiceqxl_driver.h" @@ -1378,6 +1379,25 @@ can_accelerate_picture (PicturePtr pict) return TRUE; } +#define QXL_HAS_CAP(qxl, cap) \ + (((qxl)->rom->client_capabilities[(cap) / 8]) & (1 << ((cap) % 8))) + +static Bool +qxl_has_composite (qxl_screen_t *qxl) +{ + return + qxl->pci->revision >= 4 && + QXL_HAS_CAP (qxl, SPICE_DISPLAY_CAP_COMPOSITE); +} + +static Bool +qxl_has_a8_surfaces (qxl_screen_t *qxl) +{ + return + qxl->pci->revision >= 4 && + QXL_HAS_CAP (qxl, SPICE_DISPLAY_CAP_A8_SURFACE); +} + static Bool qxl_check_composite (int op, PicturePtr pSrcPicture, @@ -1386,7 +1406,10 @@ qxl_check_composite (int op, int width, int height) { int i; - + ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; + ScrnInfoPtr pScrn = xf86ScreenToScrn (pScreen); + qxl_screen_t *qxl = pScrn->driverPrivate; + static const int accelerated_ops[] = { PictOpClear, PictOpSrc, PictOpDst, PictOpOver, PictOpOverReverse, @@ -1397,6 +1420,9 @@ qxl_check_composite (int op, PictOpHardLight, PictOpSoftLight, PictOpDifference, PictOpExclusion, PictOpHSLHue, PictOpHSLSaturation, PictOpHSLColor, PictOpHSLLuminosity, }; + + if (!qxl_has_composite (qxl)) + return FALSE; if (!can_accelerate_picture (pSrcPicture) || !can_accelerate_picture (pMaskPicture) || @@ -1502,6 +1528,15 @@ qxl_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usage) if (uxa_swapped_out (screen)) goto fallback; + + if (depth == 8 && !qxl_has_a8_surfaces (qxl)) + { + /* FIXME: When we detect a _change_ in the property of having a8 + * surfaces, we should copy all existing a8 surface to host memory + * and then destroy the ones on the device. + */ + goto fallback; + } surface = qxl_surface_create (qxl->surface_cache, w, h, depth); -- cgit v1.2.3