summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@l3000.localdomain>2012-02-03 15:20:31 -0500
committerSøren Sandmann <ssp@redhat.com>2012-04-26 05:28:09 -0400
commit39fffeecc5e208a4af015c759e90a567264333a2 (patch)
tree1918f448b83da7baf0032d766c7e5e0dd4098a9e
parentb3caf8621d798ea3c5140b8adc193121c4c13c4a (diff)
Add option to track fallbacks
-rw-r--r--src/qxl.h1
-rw-r--r--src/qxl_driver.c10
-rw-r--r--src/uxa/uxa.c21
3 files changed, 32 insertions, 0 deletions
diff --git a/src/qxl.h b/src/qxl.h
index ed12680..387ee05 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -99,6 +99,7 @@ enum {
OPTION_ENABLE_IMAGE_CACHE = 0,
OPTION_ENABLE_FALLBACK_CACHE,
OPTION_ENABLE_SURFACES,
+ OPTION_ENABLE_FALLBACK_DEBUG,
#ifdef XSPICE
OPTION_SPICE_PORT,
OPTION_SPICE_TLS_PORT,
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 6e06174..740e954 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -65,6 +65,9 @@ const OptionInfoRec DefaultOptions[] = {
"EnableFallbackCache", OPTV_BOOLEAN, { 0 }, TRUE },
{ OPTION_ENABLE_SURFACES,
"EnableSurfaces", OPTV_BOOLEAN, { 0 }, TRUE },
+ { OPTION_ENABLE_FALLBACK_DEBUG,
+ "EnableFallbackDebug", OPTV_BOOLEAN, { 0 }, TRUE },
+
#ifdef XSPICE
{ OPTION_SPICE_PORT,
"SpicePort", OPTV_INTEGER, {5900}, FALSE },
@@ -951,6 +954,8 @@ static Bool
setup_uxa (qxl_screen_t *qxl, ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ Bool enable_fallback_debug;
+
#if HAS_DIXREGISTERPRIVATEKEY
if (!dixRegisterPrivateKey(&uxa_pixmap_index, PRIVATE_PIXMAP, 0))
return FALSE;
@@ -1018,6 +1023,11 @@ setup_uxa (qxl_screen_t *qxl, ScreenPtr screen)
return FALSE;
#endif
+ enable_fallback_debug =
+ xf86ReturnOptValBool (qxl->options, OPTION_ENABLE_FALLBACK_DEBUG, FALSE);
+
+ uxa_screen_set_fallback_debug (screen, enable_fallback_debug);
+
return TRUE;
}
diff --git a/src/uxa/uxa.c b/src/uxa/uxa.c
index dc973ef..4d98e89 100644
--- a/src/uxa/uxa.c
+++ b/src/uxa/uxa.c
@@ -133,6 +133,24 @@ PixmapPtr uxa_get_offscreen_pixmap(DrawablePtr drawable, int *xp, int *yp)
return NULL;
}
+static int
+compute_area (RegionPtr region)
+{
+ pixman_box16_t *boxes;
+ int n_rects;
+ int result = 0;
+
+ boxes = pixman_region_rectangles (region, &n_rects);
+ while (n_rects--)
+ {
+ result += (boxes->x2 - boxes->x1) * (boxes->y2 - boxes->y1);
+
+ boxes++;
+ }
+
+ return result;
+}
+
/**
* uxa_prepare_access() is UXA's wrapper for the driver's PrepareAccess() handler.
*
@@ -170,6 +188,9 @@ Bool uxa_prepare_access(DrawablePtr pDrawable, RegionPtr region, uxa_access_t ac
result = TRUE;
+ if (uxa_get_screen(pScreen)->fallback_debug)
+ ErrorF ("Fallback area: %d\n", compute_area (region));
+
if (uxa_screen->info->prepare_access)
result = (*uxa_screen->info->prepare_access) (pPixmap, region, access);