diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-01-16 22:37:41 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-01-17 09:15:37 +0000 |
commit | cea442c0d0d7f1ef95d9d8048668eecbdcbc9a4e (patch) | |
tree | a6377b2d5d526871560f96f2ae80a5fc489a69de | |
parent | 6db99169a99393a8a669f89682bb8df13a7c5677 (diff) |
sna: Cull the DBG spew to stderr
Reduce the logging verbosity of DBG so that it only appears in the
logfile by default - makes debugging much more pleasant.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/fb/fb.h | 5 | ||||
-rw-r--r-- | src/sna/kgem.c | 34 | ||||
-rw-r--r-- | src/sna/kgem.h | 5 | ||||
-rw-r--r-- | src/sna/sna.h | 5 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 89 | ||||
-rw-r--r-- | src/sna/sna_composite.c | 11 | ||||
-rw-r--r-- | src/sna/sna_damage.c | 95 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 13 | ||||
-rw-r--r-- | src/sna/sna_glyphs.c | 11 | ||||
-rw-r--r-- | src/sna/sna_trapezoids.c | 6 | ||||
-rw-r--r-- | src/sna/sna_trapezoids_boxes.c | 17 | ||||
-rw-r--r-- | src/sna/sna_trapezoids_imprecise.c | 13 | ||||
-rw-r--r-- | src/sna/sna_trapezoids_mono.c | 14 | ||||
-rw-r--r-- | src/sna/sna_trapezoids_precise.c | 13 |
14 files changed, 167 insertions, 164 deletions
diff --git a/src/sna/fb/fb.h b/src/sna/fb/fb.h index d99453da..982b2c17 100644 --- a/src/sna/fb/fb.h +++ b/src/sna/fb/fb.h @@ -39,9 +39,12 @@ #include <pixman.h> #if HAS_DEBUG_FULL -#define DBG(x) ErrorF x +void LogF(const char *f, ...); +#define DBG(x) LogF x +#define ERR(x) ErrorF x #else #define DBG(x) +#define ERR(x) #endif #include "sfb.h" diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 5d34bbc7..455f4e23 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -347,8 +347,8 @@ retry_gtt: if (kgem_cleanup_cache(kgem)) goto retry_gtt; - ErrorF("%s: failed to retrieve GTT offset for handle=%d: %d\n", - __FUNCTION__, bo->handle, err); + ERR(("%s: failed to retrieve GTT offset for handle=%d: %d\n", + __FUNCTION__, bo->handle, err)); return NULL; } @@ -366,8 +366,8 @@ retry_mmap: if (kgem_cleanup_cache(kgem)) goto retry_mmap; - ErrorF("%s: failed to mmap handle=%d, %d bytes, into GTT domain: %d\n", - __FUNCTION__, bo->handle, bytes(bo), err); + ERR(("%s: failed to mmap handle=%d, %d bytes, into GTT domain: %d\n", + __FUNCTION__, bo->handle, bytes(bo), err)); ptr = NULL; } @@ -494,8 +494,8 @@ retry: if (kgem_cleanup_cache(kgem)) goto retry; - ErrorF("%s: failed to write %d bytes into BO handle=%d: %d\n", - __FUNCTION__, length, bo->handle, err); + ERR(("%s: failed to write %d bytes into BO handle=%d: %d\n", + __FUNCTION__, length, bo->handle, err)); return false; } @@ -2162,7 +2162,7 @@ static bool kgem_retire__flushing(struct kgem *kgem) int count = 0; list_for_each_entry(bo, &kgem->flushing, request) count++; - ErrorF("%s: %d bo on flushing list\n", __FUNCTION__, count); + DBG(("%s: %d bo on flushing list\n", __FUNCTION__, count)); } #endif @@ -2272,8 +2272,8 @@ static bool kgem_retire__requests_ring(struct kgem *kgem, int ring) struct kgem_request, list)->bo; - ErrorF("%s: ring=%d, %d outstanding requests, oldest=%d\n", - __FUNCTION__, ring, count, bo ? bo->handle : 0); + DBG(("%s: ring=%d, %d outstanding requests, oldest=%d\n", + __FUNCTION__, ring, count, bo ? bo->handle : 0)); } #endif @@ -2699,8 +2699,8 @@ expire: if (kgem_cleanup_cache(kgem)) goto retry; - ErrorF("%s: failed to write batch (handle=%d): %d\n", - __FUNCTION__, handle, ret); + ERR(("%s: failed to write batch (handle=%d): %d\n", + __FUNCTION__, handle, ret)); return ret; } @@ -3234,8 +3234,8 @@ bool kgem_expire_cache(struct kgem *kgem) int snoop_count = 0; list_for_each_entry(bo, &kgem->snoop, list) snoop_count++, snoop_size += bytes(bo); - ErrorF("%s: still allocated %d bo, %ld bytes, in snoop cache\n", - __FUNCTION__, snoop_count, snoop_size); + DBG(("%s: still allocated %d bo, %ld bytes, in snoop cache\n", + __FUNCTION__, snoop_count, snoop_size)); } #endif @@ -3310,8 +3310,8 @@ bool kgem_expire_cache(struct kgem *kgem) for (i = 0; i < ARRAY_SIZE(kgem->inactive); i++) list_for_each_entry(bo, &kgem->inactive[i], list) inactive_count++, inactive_size += bytes(bo); - ErrorF("%s: still allocated %d bo, %ld bytes, in inactive cache\n", - __FUNCTION__, inactive_count, inactive_size); + DBG(("%s: still allocated %d bo, %ld bytes, in inactive cache\n", + __FUNCTION__, inactive_count, inactive_size)); } #endif @@ -5452,8 +5452,8 @@ retry: if (kgem_cleanup_cache(kgem)) goto retry; - ErrorF("%s: failed to mmap handle=%d, %d bytes, into CPU domain: %d\n", - __FUNCTION__, bo->handle, bytes(bo), err); + ERR(("%s: failed to mmap handle=%d, %d bytes, into CPU domain: %d\n", + __FUNCTION__, bo->handle, bytes(bo), err)); return NULL; } diff --git a/src/sna/kgem.h b/src/sna/kgem.h index d67f73f8..f670b604 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -37,9 +37,12 @@ #include "compiler.h" #if HAS_DEBUG_FULL -#define DBG(x) ErrorF x +void LogF(const char *f, ...); +#define DBG(x) LogF x +#define ERR(x) ErrorF x #else #define DBG(x) +#define ERR(x) #endif struct kgem_bo { diff --git a/src/sna/sna.h b/src/sna/sna.h index 3ac0fad5..27f5708c 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -75,9 +75,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "compiler.h" #if HAS_DEBUG_FULL -#define DBG(x) ErrorF x +void LogF(const char *f, ...); +#define DBG(x) LogF x +#define ERR(x) ErrorF x #else #define DBG(x) +#define ERR(x) #endif #define DEBUG_NO_BLT 0 diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index fee58574..3c3b21f2 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -153,8 +153,8 @@ static void __sna_fallback_flush(DrawablePtr d) if (memcmp(src, dst, tmp->drawable.width * tmp->drawable.bitsPerPixel >> 3)) { for (j = 0; src[j] == dst[j]; j++) ; - ErrorF("mismatch at (%d, %d)\n", - 8*j / tmp->drawable.bitsPerPixel, i); + ERR(("mismatch at (%d, %d)\n", + 8*j / tmp->drawable.bitsPerPixel, i)); abort(); } src += pixmap->devKind; @@ -248,12 +248,11 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, const BoxRec *box, con box->x2 > pixmap->drawable.width || box->y2 > pixmap->drawable.height) { - ErrorF("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - pixmap->drawable.width, - pixmap->drawable.height); - assert(0); + FatalError("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + pixmap->drawable.width, + pixmap->drawable.height); } } @@ -324,12 +323,11 @@ static void _assert_drawable_contains_box(DrawablePtr drawable, const BoxRec *bo box->x2 > drawable->x + drawable->width || box->y2 > drawable->y + drawable->height) { - ErrorF("%s: damage box is beyond the drawable: box=(%d, %d), (%d, %d), drawable=(%d, %d)x(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - drawable->x, drawable->y, - drawable->width, drawable->height); - assert(0); + FatalError("%s: damage box is beyond the drawable: box=(%d, %d), (%d, %d), drawable=(%d, %d)x(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + drawable->x, drawable->y, + drawable->width, drawable->height); } } @@ -831,6 +829,26 @@ create_pixmap(struct sna *sna, ScreenPtr screen, } static PixmapPtr +create_pixmap_hdr(struct sna *sna, int usage) +{ + PixmapPtr pixmap; + + pixmap = sna->freed_pixmap; + sna->freed_pixmap = pixmap->devPrivate.ptr; + assert(pixmap->refcnt == 0); + + pixmap->usage_hint = usage; + pixmap->refcnt = 1; + pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + +#if DEBUG_MEMORY + sna->debug_memory.pixmap_allocs++; +#endif + + return pixmap; +} + +static PixmapPtr sna_pixmap_create_shm(ScreenPtr screen, int width, int height, int depth, char *addr) @@ -860,18 +878,12 @@ fallback: } if (sna->freed_pixmap) { - pixmap = sna->freed_pixmap; - sna->freed_pixmap = pixmap->devPrivate.ptr; - assert(pixmap->refcnt == 0); - - pixmap->usage_hint = 0; - pixmap->refcnt = 1; + pixmap = create_pixmap_hdr(sna, 0); pixmap->drawable.width = width; pixmap->drawable.height = height; pixmap->drawable.depth = depth; pixmap->drawable.bitsPerPixel = bpp; - pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; DBG(("%s: serial=%ld, %dx%d\n", __FUNCTION__, @@ -958,18 +970,12 @@ sna_pixmap_create_scratch(ScreenPtr screen, /* you promise never to access this via the cpu... */ if (sna->freed_pixmap) { - pixmap = sna->freed_pixmap; - sna->freed_pixmap = pixmap->devPrivate.ptr; - assert(pixmap->refcnt == 0); - - pixmap->usage_hint = CREATE_PIXMAP_USAGE_SCRATCH; - pixmap->refcnt = 1; + pixmap = create_pixmap_hdr(sna, CREATE_PIXMAP_USAGE_SCRATCH); pixmap->drawable.width = width; pixmap->drawable.height = height; pixmap->drawable.depth = depth; pixmap->drawable.bitsPerPixel = bpp; - pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; DBG(("%s: serial=%ld, usage=%d, %dx%d\n", __FUNCTION__, @@ -3679,12 +3685,7 @@ sna_pixmap_create_upload(ScreenPtr screen, CREATE_PIXMAP_USAGE_SCRATCH); if (sna->freed_pixmap) { - pixmap = sna->freed_pixmap; - sna->freed_pixmap = pixmap->devPrivate.ptr; - assert(pixmap->refcnt == 0); - - pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pixmap->refcnt = 1; + pixmap = create_pixmap_hdr(sna, CREATE_PIXMAP_USAGE_SCRATCH); } else { pixmap = create_pixmap(sna, screen, 0, 0, depth, CREATE_PIXMAP_USAGE_SCRATCH); @@ -16519,14 +16520,14 @@ static bool sna_accel_do_debug_memory(struct sna *sna) static void sna_accel_debug_memory(struct sna *sna) { - ErrorF("Allocated pixmaps: %d\n", - sna->debug_memory.pixmap_allocs); - ErrorF("Allocated bo: %d, %ld bytes\n", - sna->kgem.debug_memory.bo_allocs, - (long)sna->kgem.debug_memory.bo_bytes); - ErrorF("Allocated CPU bo: %d, %ld bytes\n", - sna->debug_memory.cpu_bo_allocs, - (long)sna->debug_memory.cpu_bo_bytes); + DBG(("Allocated pixmaps: %d\n", + sna->debug_memory.pixmap_allocs)); + DBG(("Allocated bo: %d, %ld bytes\n", + sna->kgem.debug_memory.bo_allocs, + (long)sna->kgem.debug_memory.bo_bytes)); + DBG(("Allocated CPU bo: %d, %ld bytes\n", + sna->debug_memory.cpu_bo_allocs, + (long)sna->debug_memory.cpu_bo_bytes)); #ifdef VALGRIND_DO_ADDED_LEAK_CHECK VG(VALGRIND_DO_ADDED_LEAK_CHECK); @@ -16997,8 +16998,8 @@ set_tv: sna->kgem.scanout_busy = false; if (FAULT_INJECTION && (rand() % FAULT_INJECTION) == 0) { - ErrorF("%s hardware acceleration\n", - sna->kgem.wedged ? "Re-enabling" : "Disabling"); + DBG(("%s hardware acceleration\n", + sna->kgem.wedged ? "Re-enabling" : "Disabling")); kgem_submit(&sna->kgem); sna->kgem.wedged = !sna->kgem.wedged; } diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index 56e34f3a..a36ffe08 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -389,12 +389,11 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, BoxPtr box, const char box->x2 > pixmap->drawable.width || box->y2 > pixmap->drawable.height) { - ErrorF("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - pixmap->drawable.width, - pixmap->drawable.height); - assert(0); + FatalError("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + pixmap->drawable.width, + pixmap->drawable.height); } } #define assert_pixmap_contains_box(p, b) _assert_pixmap_contains_box(p, b, __FUNCTION__) diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c index b634c0b2..51b15d34 100644 --- a/src/sna/sna_damage.c +++ b/src/sna/sna_damage.c @@ -660,8 +660,8 @@ fastcall struct sna_damage *_sna_damage_add(struct sna_damage *damage, damage = __sna_damage_add(damage, region); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); assert(RegionNumRects(&damage->region)); assert(damage->region.extents.x2 > damage->region.extents.x1); assert(damage->region.extents.y2 > damage->region.extents.y1); @@ -744,8 +744,8 @@ struct sna_damage *_sna_damage_add_boxes(struct sna_damage *damage, damage = __sna_damage_add_boxes(damage, b, n, dx, dy); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); if (RegionNumRects(&damage->region)) { assert(damage->region.extents.x2 > damage->region.extents.x1); assert(damage->region.extents.y2 > damage->region.extents.y1); @@ -833,8 +833,8 @@ struct sna_damage *_sna_damage_add_rectangles(struct sna_damage *damage, damage = __sna_damage_add_rectangles(damage, r, n, dx, dy); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); if (RegionNumRects(&damage->region)) { assert(damage->region.extents.x2 > damage->region.extents.x1); assert(damage->region.extents.y2 > damage->region.extents.y1); @@ -917,8 +917,8 @@ struct sna_damage *_sna_damage_add_points(struct sna_damage *damage, damage = __sna_damage_add_points(damage, p, n, dx, dy); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); if (RegionNumRects(&damage->region)) { assert(damage->region.extents.x2 > damage->region.extents.x1); assert(damage->region.extents.y2 > damage->region.extents.y1); @@ -947,8 +947,8 @@ fastcall struct sna_damage *_sna_damage_add_box(struct sna_damage *damage, damage = __sna_damage_add_box(damage, box); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); assert(RegionNumRects(&damage->region)); assert(damage->region.extents.x2 > damage->region.extents.x1); assert(damage->region.extents.y2 > damage->region.extents.y1); @@ -1101,14 +1101,14 @@ fastcall struct sna_damage *_sna_damage_subtract(struct sna_damage *damage, char damage_buf[1000]; char region_buf[120]; - ErrorF("%s(%s - %s)...\n", __FUNCTION__, + DBG(("%s(%s - %s)...\n", __FUNCTION__, _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), - _debug_describe_region(region_buf, sizeof(region_buf), region)); + _debug_describe_region(region_buf, sizeof(region_buf), region))); damage = __sna_damage_subtract(damage, region); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); return damage; } @@ -1171,14 +1171,14 @@ fastcall struct sna_damage *_sna_damage_subtract_box(struct sna_damage *damage, { char damage_buf[1000]; - ErrorF("%s(%s - (%d, %d), (%d, %d))...\n", __FUNCTION__, - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), - box->x1, box->y1, box->x2, box->y2); + DBG(("%s(%s - (%d, %d), (%d, %d))...\n", __FUNCTION__, + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), + box->x1, box->y1, box->x2, box->y2)); damage = __sna_damage_subtract_box(damage, box); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); return damage; } @@ -1253,16 +1253,16 @@ fastcall struct sna_damage *_sna_damage_subtract_boxes(struct sna_damage *damage { char damage_buf[1000]; - ErrorF("%s(%s - [(%d,%d), (%d,%d)...x%d])...\n", __FUNCTION__, - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), - box->x1 + dx, box->y1 + dy, - box->x2 + dx, box->y2 + dy, - n); + DBG(("%s(%s - [(%d,%d), (%d,%d)...x%d])...\n", __FUNCTION__, + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), + box->x1 + dx, box->y1 + dy, + box->x2 + dx, box->y2 + dy, + n)); damage = __sna_damage_subtract_boxes(damage, box, n, dx, dy); - ErrorF(" = %s\n", - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG((" = %s\n", + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); return damage; } @@ -1338,11 +1338,11 @@ int _sna_damage_contains_box(struct sna_damage *damage, box->x1, box->y1, box->x2, box->y2)); ret = __sna_damage_contains_box(damage, box); - ErrorF(" = %d", ret); + DBG((" = %d", ret)); if (ret) - ErrorF(" [(%d, %d), (%d, %d)...]", - box->x1, box->y1, box->x2, box->y2); - ErrorF("\n"); + DBG((" [(%d, %d), (%d, %d)...]", + box->x1, box->y1, box->x2, box->y2)); + DBG(("\n")); return ret; } @@ -1441,16 +1441,16 @@ bool _sna_damage_intersect(struct sna_damage *damage, char region_buf[120]; bool ret; - ErrorF("%s(%s, %s)...\n", __FUNCTION__, - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), - _debug_describe_region(region_buf, sizeof(region_buf), region)); + DBG(("%s(%s, %s)...\n", __FUNCTION__, + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage), + _debug_describe_region(region_buf, sizeof(region_buf), region))); ret = __sna_damage_intersect(damage, region, result); if (ret) - ErrorF(" = %s\n", - _debug_describe_region(region_buf, sizeof(region_buf), result)); + DBG((" = %s\n", + _debug_describe_region(region_buf, sizeof(region_buf), result))); else - ErrorF(" = none\n"); + DBG((" = none\n")); return ret; } @@ -1492,11 +1492,11 @@ int _sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes) char damage_buf[1000]; int count; - ErrorF("%s(%s)...\n", __FUNCTION__, - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + DBG(("%s(%s)...\n", __FUNCTION__, + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage))); count = __sna_damage_get_boxes(damage, boxes); - ErrorF(" = %d\n", count); + DBG((" = %d\n", count)); return count; } @@ -1660,14 +1660,14 @@ static bool st_check_equal(struct sna_damage_selftest *test, r_boxes = pixman_region_rectangles(region, &r_num); if (d_num != r_num) { - ErrorF("%s: damage and ref contain different number of rectangles\n", - __FUNCTION__); + ERR(("%s: damage and ref contain different number of rectangles\n", + __FUNCTION__)); return false; } if (memcmp(d_boxes, r_boxes, d_num*sizeof(BoxRec))) { - ErrorF("%s: damage and ref contain different rectangles\n", - __FUNCTION__); + ERR(("%s: damage and ref contain different rectangles\n", + __FUNCTION__)); return false; } @@ -1702,7 +1702,7 @@ void sna_damage_selftest(void) int iter, i; iter = 1 + rand() % (1 + (pass / 64)); - ErrorF("%s: pass %d, iters=%d\n", __FUNCTION__, pass, iter); + DBG(("%s: pass %d, iters=%d\n", __FUNCTION__, pass, iter)); test.width = 1 + rand() % 2048; test.height = 1 + rand() % 2048; @@ -1715,10 +1715,9 @@ void sna_damage_selftest(void) } if (!check[rand() % ARRAY_SIZE(check)](&test, &damage, &ref)) { - ErrorF("%s: failed - region = %s, damage = %s\n", __FUNCTION__, - _debug_describe_region(region_buf, sizeof(region_buf), &ref), - _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); - assert(0); + FatalError("%s: failed - region = %s, damage = %s\n", __FUNCTION__, + _debug_describe_region(region_buf, sizeof(region_buf), &ref), + _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); } pixman_region_fini(&ref); diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 3f7a9bf9..4472f255 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -1185,7 +1185,7 @@ static Bool sna_pm_event(SCRN_ARG_TYPE arg, pmEvent event, Bool undo) break; default: - ErrorF("sna_pm_event: received APM event %d\n", event); + ERR(("sna_pm_event: received APM event %d\n", event)); } return TRUE; } @@ -1250,3 +1250,14 @@ Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num) return TRUE; } + +#if HAS_DEBUG_FULL +_X_ATTRIBUTE_PRINTF(1, 0) void LogF(const char *f, ...) +{ + va_list ap; + + va_start(ap, f); + LogVWrite(1, f, ap); + va_end(ap); +} +#endif diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index caa4649f..d90dac8e 100644 --- a/src/sna/sna_glyphs.c +++ b/src/sna/sna_glyphs.c @@ -92,12 +92,11 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, BoxPtr box, const char box->x2 > pixmap->drawable.width || box->y2 > pixmap->drawable.height) { - ErrorF("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - pixmap->drawable.width, - pixmap->drawable.height); - assert(0); + FatalError("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + pixmap->drawable.width, + pixmap->drawable.height); } } #define assert_pixmap_contains_box(p, b) _assert_pixmap_contains_box(p, b, __FUNCTION__) diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 2dcb6d31..ac2f764d 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -39,12 +39,6 @@ #include <mipict.h> -#if 0 -#define __DBG(x) ErrorF x -#else -#define __DBG(x) -#endif - /* TODO: Emit unantialiased and MSAA triangles. */ #ifndef MAX diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c index 23a3b457..3bb895ad 100644 --- a/src/sna/sna_trapezoids_boxes.c +++ b/src/sna/sna_trapezoids_boxes.c @@ -39,12 +39,6 @@ #include <mipict.h> -#if 0 -#define __DBG(x) ErrorF x -#else -#define __DBG(x) -#endif - /* TODO: Emit unantialiased and MSAA triangles. */ #ifndef MAX @@ -65,12 +59,11 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, BoxPtr box, const char box->x2 > pixmap->drawable.width || box->y2 > pixmap->drawable.height) { - ErrorF("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - pixmap->drawable.width, - pixmap->drawable.height); - assert(0); + FatalError("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + pixmap->drawable.width, + pixmap->drawable.height); } } #define assert_pixmap_contains_box(p, b) _assert_pixmap_contains_box(p, b, __FUNCTION__) diff --git a/src/sna/sna_trapezoids_imprecise.c b/src/sna/sna_trapezoids_imprecise.c index 3624dd63..a354f280 100644 --- a/src/sna/sna_trapezoids_imprecise.c +++ b/src/sna/sna_trapezoids_imprecise.c @@ -43,7 +43,7 @@ #undef SAMPLES_Y #if 0 -#define __DBG(x) ErrorF x +#define __DBG(x) LogF x #else #define __DBG(x) #endif @@ -71,12 +71,11 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, BoxPtr box, const char box->x2 > pixmap->drawable.width || box->y2 > pixmap->drawable.height) { - ErrorF("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - pixmap->drawable.width, - pixmap->drawable.height); - assert(0); + FatalError("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + pixmap->drawable.width, + pixmap->drawable.height); } } #define assert_pixmap_contains_box(p, b) _assert_pixmap_contains_box(p, b, __FUNCTION__) diff --git a/src/sna/sna_trapezoids_mono.c b/src/sna/sna_trapezoids_mono.c index 641c6e36..be2e3a67 100644 --- a/src/sna/sna_trapezoids_mono.c +++ b/src/sna/sna_trapezoids_mono.c @@ -40,7 +40,7 @@ #include <mipict.h> #if 0 -#define __DBG(x) ErrorF x +#define __DBG(x) LogF x #else #define __DBG(x) #endif @@ -390,17 +390,17 @@ mono_merge_unsorted_edges(struct mono_edge *head, struct mono_edge *unsorted) static inline void __dbg_mono_edges(const char *function, struct mono_edge *edges) { - ErrorF("%s: ", function); + DBG(("%s: ", function)); while (edges) { if (edges->x.quo < INT16_MAX << 16) { - ErrorF("(%d.%06d)+(%d.%06d)x%d, ", - edges->x.quo, edges->x.rem, - edges->dxdy.quo, edges->dxdy.rem, - edges->dy*edges->dir); + DBG(("(%d.%06d)+(%d.%06d)x%d, ", + edges->x.quo, edges->x.rem, + edges->dxdy.quo, edges->dxdy.rem, + edges->dy*edges->dir)); } edges = edges->next; } - ErrorF("\n"); + DBG(("\n")); } #define DBG_MONO_EDGES(x) __dbg_mono_edges(__FUNCTION__, x) static inline void diff --git a/src/sna/sna_trapezoids_precise.c b/src/sna/sna_trapezoids_precise.c index 7e685471..de95dfdc 100644 --- a/src/sna/sna_trapezoids_precise.c +++ b/src/sna/sna_trapezoids_precise.c @@ -43,7 +43,7 @@ #undef FAST_SAMPLES_Y #if 0 -#define __DBG(x) ErrorF x +#define __DBG(x) LogF x #else #define __DBG(x) #endif @@ -92,12 +92,11 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, BoxPtr box, const char box->x2 > pixmap->drawable.width || box->y2 > pixmap->drawable.height) { - ErrorF("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", - __FUNCTION__, - box->x1, box->y1, box->x2, box->y2, - pixmap->drawable.width, - pixmap->drawable.height); - assert(0); + FatalError("%s: damage box is beyond the pixmap: box=(%d, %d), (%d, %d), pixmap=(%d, %d)\n", + function, + box->x1, box->y1, box->x2, box->y2, + pixmap->drawable.width, + pixmap->drawable.height); } } #define assert_pixmap_contains_box(p, b) _assert_pixmap_contains_box(p, b, __FUNCTION__) |