sna: Cull the DBG spew to stderr
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 16 Jan 2014 22:37:41 +0000 (22:37 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Jan 2014 09:15:37 +0000 (09:15 +0000)
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>
14 files changed:
src/sna/fb/fb.h
src/sna/kgem.c
src/sna/kgem.h
src/sna/sna.h
src/sna/sna_accel.c
src/sna/sna_composite.c
src/sna/sna_damage.c
src/sna/sna_driver.c
src/sna/sna_glyphs.c
src/sna/sna_trapezoids.c
src/sna/sna_trapezoids_boxes.c
src/sna/sna_trapezoids_imprecise.c
src/sna/sna_trapezoids_mono.c
src/sna/sna_trapezoids_precise.c

index d99453d..982b2c1 100644 (file)
 #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"
index 5d34bbc..455f4e2 100644 (file)
@@ -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;
        }
 
index d67f73f..f670b60 100644 (file)
 #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 {
index 3ac0fad..27f5708 100644 (file)
@@ -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
index fee5857..3c3b21f 100644 (file)
@@ -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;
        }
index 56e34f3..a36ffe0 100644 (file)
@@ -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__)
index b634c0b..51b15d3 100644 (file)
@@ -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);
index 3f7a9bf..4472f25 100644 (file)
@@ -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
index caa4649..d90dac8 100644 (file)
@@ -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__)
index 2dcb6d3..ac2f764 100644 (file)
 
 #include <mipict.h>
 
-#if 0
-#define __DBG(x) ErrorF x
-#else
-#define __DBG(x)
-#endif
-
 /* TODO: Emit unantialiased and MSAA triangles. */
 
 #ifndef MAX
index 23a3b45..3bb895a 100644 (file)
 
 #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__)
index 3624dd6..a354f28 100644 (file)
@@ -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__)
index 641c6e3..be2e3a6 100644 (file)
@@ -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
index 7e68547..de95dfd 100644 (file)
@@ -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__)