diff options
-rw-r--r-- | src/qxl_driver.c | 17 | ||||
-rw-r--r-- | src/qxl_image.c | 24 | ||||
-rw-r--r-- | src/qxl_surface.c | 35 | ||||
-rw-r--r-- | src/uxa/uxa-accel.c | 39 | ||||
-rw-r--r-- | src/uxa/uxa-unaccel.c | 21 | ||||
-rw-r--r-- | src/uxa/uxa.h | 2 |
6 files changed, 112 insertions, 26 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 84c206e..dcc207f 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -66,7 +66,7 @@ const OptionInfoRec DefaultOptions[] = { { OPTION_ENABLE_SURFACES, "EnableSurfaces", OPTV_BOOLEAN, { 0 }, TRUE }, { OPTION_ENABLE_IMAGE_STATS, - "EnableFallbackDebug", OPTV_BOOLEAN, { 0 }, TRUE }, + "EnableImageStats", OPTV_BOOLEAN, { 0 }, TRUE }, #ifdef XSPICE { OPTION_SPICE_PORT, @@ -875,12 +875,13 @@ qxl_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usage) qxl_surface_cache_sanity_check (qxl->surface_cache); -#if 0 - ErrorF ("Create pixmap: %d %d @ %d (usage: %d)\n", w, h, depth, usage); -#endif + /* ErrorF ("Create pixmap: %d %d @ %d (usage: %d)\n", w, h, depth, usage); */ if (uxa_swapped_out (screen)) + { + printf ("screen swapped out"); goto fallback; + } surface = qxl_surface_create (qxl->surface_cache, w, h, depth); @@ -904,18 +905,16 @@ qxl_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usage) } else { -#if 0 - ErrorF (" Couldn't allocate %d x %d @ %d surface in video memory\n", - w, h, depth); -#endif fallback: pixmap = fbCreatePixmap (screen, w, h, depth, usage); + if (qxl->enable_image_stats) + ErrorF (" - %p is not backed by surface\n", pixmap); #if 0 ErrorF ("Create pixmap %p without surface\n", pixmap); #endif } - + return pixmap; } diff --git a/src/qxl_image.c b/src/qxl_image.c index dba40e3..b954d63 100644 --- a/src/qxl_image.c +++ b/src/qxl_image.c @@ -128,6 +128,23 @@ remove_image_info (image_info_t *info) #define MAX(a,b) (((a) > (b))? (a) : (b)) #define MIN(a,b) (((a) < (b))? (a) : (b)) +static void +print_image_info (qxl_screen_t *qxl, Bool fallback, int width, int height, int Bpp, unsigned int hash) +{ + ErrorF ("IMAGE, %d, %d, %d, ", width, height, Bpp); + if (lookup_image_info (hash, width, height)) + ErrorF ("cache (%lx), ", hash); + else + ErrorF ("non-cache (%lx), ", hash); + + if (qxl->uxa->fallback_reason) + ErrorF ("%s \n", qxl->uxa->fallback_reason); + else if (fallback) + ErrorF ("-unknown fallback-\n"); + else + ErrorF ("PutImage, ShmPutImage\n"); +} + struct QXLImage * qxl_image_create (qxl_screen_t *qxl, const uint8_t *data, int x, int y, int width, int height, @@ -186,6 +203,9 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data, h -= n_lines; } + if (qxl->enable_image_stats) + print_image_info (qxl, fallback, width, height, Bpp, hash); + /* Image */ image = qxl_allocnf (qxl, sizeof *image); @@ -264,9 +284,9 @@ qxl_image_destroy (qxl_screen_t *qxl, return; #if 0 - ErrorF ("removed %p from hash table\n", info->image); + ErrorF ("removed %lx from hash table\n", image->descriptor.id); #endif - + remove_image_info (info); } diff --git a/src/qxl_surface.c b/src/qxl_surface.c index a8901f0..51aafdf 100644 --- a/src/qxl_surface.c +++ b/src/qxl_surface.c @@ -545,7 +545,6 @@ surface_send_create (surface_cache_t *cache, qxl_garbage_collect (cache->qxl); retry2: address = qxl_alloc (qxl->surf_mem, stride * height + stride); - if (!address) { ErrorF ("- %dth attempt\n", n_attempts++); @@ -563,19 +562,18 @@ retry2: goto retry2; } - ErrorF ("Out of video memory: Could not allocate %d bytes\n", - stride * height + stride); + ErrorF ("Out of video memory"); return NULL; - } - + } + retry: surface = surface_get_from_free_list (cache); if (!surface) { if (!qxl_handle_oom (cache->qxl)) { - ErrorF (" Out of surfaces\n"); + ErrorF ("Out of surfaces"); qxl_free (qxl->surf_mem, address); return NULL; } @@ -583,7 +581,7 @@ retry: goto retry; } - surface->address = address; + surface->address = address; surface->end = (char *)address + stride * height; cmd = make_surface_cmd (cache, surface->id, QXL_SURFACE_CMD_CREATE); @@ -622,11 +620,20 @@ qxl_surface_create (surface_cache_t * cache, qxl_surface_t *surface; if (!cache->qxl->enable_surfaces) + { + ErrorF ("surfaces disabled"); return NULL; + } if ((bpp & 3) != 0) { - ErrorF (" Bad bpp: %d (%d)\n", bpp, bpp & 7); + ErrorF ("Bad bpp %d", bpp); + return NULL; + } + + if (width == 0 || height == 0) + { + ErrorF ("Zero width or height"); return NULL; } @@ -638,13 +645,15 @@ qxl_surface_create (surface_cache_t * cache, warned = 1; ErrorF ("bpp == 8 triggers bugs in spice apparently\n"); } + + ErrorF ("Bpp is 8"); return NULL; } if (bpp != 8 && bpp != 16 && bpp != 32 && bpp != 24) { - ErrorF (" Unknown bpp\n"); + ErrorF ("Unknown bpp"); return NULL; } @@ -655,8 +664,12 @@ qxl_surface_create (surface_cache_t * cache, } if (!(surface = surface_get_from_cache (cache, width, height, bpp))) + { if (!(surface = surface_send_create (cache, width, height, bpp))) + { return NULL; + } + } surface->next = cache->live_surfaces; surface->prev = NULL; @@ -1066,6 +1079,8 @@ qxl_surface_cache_replace_all (surface_cache_t *cache, void *data) /* FIXME: report the error */ return; } + + cache->qxl->uxa->fallback_reason = "replacing cached surfaces (typically modesetting)"; ev = data; while (ev != NULL) @@ -1094,6 +1109,8 @@ qxl_surface_cache_replace_all (surface_cache_t *cache, void *data) ev = next; } + cache->qxl->uxa->fallback_reason = NULL; + qxl_surface_cache_sanity_check (cache); } diff --git a/src/uxa/uxa-accel.c b/src/uxa/uxa-accel.c index 62034c2..8600576 100644 --- a/src/uxa/uxa-accel.c +++ b/src/uxa/uxa-accel.c @@ -514,14 +514,18 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable, pSrcPixmap = uxa_get_drawable_pixmap(pSrcDrawable); pDstPixmap = uxa_get_drawable_pixmap(pDstDrawable); - if (!pSrcPixmap || !pDstPixmap) + if (!pSrcPixmap || !pDstPixmap) { + uxa_screen->info->fallback_reason = "n_to_n: no src or dst"; goto fallback; + } if (uxa_screen->info->check_copy && !uxa_screen->info->check_copy(pSrcPixmap, pDstPixmap, pGC ? pGC->alu : GXcopy, - pGC ? pGC->planemask : FB_ALLONES)) + pGC ? pGC->planemask : FB_ALLONES)) { + uxa_screen->info->fallback_reason = "n_to_n: check_copy failed"; goto fallback; + } uxa_get_drawable_deltas(pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y); @@ -534,11 +538,14 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable, if (uxa_copy_n_to_n_two_dir (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy)) return; + uxa_screen->info->fallback_reason = "n_to_n: two_dir failed"; goto fallback; } - if (!uxa_pixmap_is_offscreen(pDstPixmap)) - goto fallback; + if (!uxa_pixmap_is_offscreen(pDstPixmap)) { + uxa_screen->info->fallback_reason = "n_to_n: dst is not offscreen"; + goto fallback; + } if (uxa_pixmap_is_offscreen(pSrcPixmap)) { if (!(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap, @@ -546,8 +553,10 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable, upsidedown ? -1 : 1, pGC ? pGC->alu : GXcopy, pGC ? pGC-> - planemask : FB_ALLONES)) - goto fallback; + planemask : FB_ALLONES)) { + uxa_screen->info->fallback_reason = "n_to_n: prepare_copy failed"; + goto fallback; + } while (nbox--) { (*uxa_screen->info->copy) (pDstPixmap, @@ -564,6 +573,7 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable, } else { int stride, bpp; char *src; + static char reason [256]; if (!uxa_screen->info->put_image) goto fallback; @@ -577,6 +587,14 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable, if (pGC && (!UXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask) || pGC->alu != GXcopy)) goto fallback; + if (pSrcPixmap->drawable.depth == 8) + uxa_screen->info->fallback_reason = "Source-is-8bpp"; + else + { + sprintf (reason, "Pixmap %p is not in video memory", pSrcPixmap); + uxa_screen->info->fallback_reason = reason; + } + src = pSrcPixmap->devPrivate.ptr; stride = pSrcPixmap->devKind; bpp /= 8; @@ -590,15 +608,22 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable, (pbox->y1 + dy + src_off_y) * stride + (pbox->x1 + dx + src_off_x) * bpp, stride)) + { + uxa_screen->info->fallback_reason = NULL; goto fallback; + } pbox++; } + + uxa_screen->info->fallback_reason = NULL; } return; fallback: + if (!uxa_screen->info->fallback_reason) + uxa_screen->info->fallback_reason = "n_to_n: unknown reason"; #if 0 ErrorF ("falling back: %d boxes\n", nbox); #endif @@ -627,6 +652,8 @@ fallback: REGION_UNINIT (NULL, &src_region); REGION_UNINIT (NULL, &dst_region); + + uxa_screen->info->fallback_reason = NULL; } RegionPtr diff --git a/src/uxa/uxa-unaccel.c b/src/uxa/uxa-unaccel.c index f3539da..9826f56 100644 --- a/src/uxa/uxa-unaccel.c +++ b/src/uxa/uxa-unaccel.c @@ -411,6 +411,8 @@ uxa_check_get_spans(DrawablePtr pDrawable, } } +static char reason[128]; + void uxa_check_composite(CARD8 op, PicturePtr pSrc, @@ -423,6 +425,23 @@ uxa_check_composite(CARD8 op, { ScreenPtr screen = pDst->pDrawable->pScreen; RegionRec region; + uxa_screen_t *uxa_screen = uxa_get_screen (screen); + char *opstr; + + if (op == PictOpOver) + opstr = "Over"; + else if (op == PictOpSrc) + opstr = "Src"; + else if (op == PictOpAdd) + opstr = "Add"; + else if (op == PictOpIn) + opstr = "In"; + else + opstr = "Other-Op"; + + sprintf (reason, "Composite, %s, %s", opstr, pMask? "with-mask" : "without-mask"); + + uxa_screen->info->fallback_reason = reason; UXA_FALLBACK(("from picts %p/%p to pict %p\n", pSrc, pMask, pDst)); @@ -455,6 +474,8 @@ uxa_check_composite(CARD8 op, } uxa_finish_access(pDst->pDrawable); } + + uxa_screen->info->fallback_reason = NULL; } void diff --git a/src/uxa/uxa.h b/src/uxa/uxa.h index 2eb4041..a05ef85 100644 --- a/src/uxa/uxa.h +++ b/src/uxa/uxa.h @@ -530,6 +530,8 @@ typedef struct _UxaDriver { */ Bool(*pixmap_is_offscreen) (PixmapPtr pPix); + const char *fallback_reason; + /** @} */ } uxa_driver_t; |