[PATCH xserver 3/4] glamor: Remove #if 0-ed picture dumping code.

Eric Anholt eric at anholt.net
Wed Sep 28 20:55:16 UTC 2016


I don't think anybody has run this code since it was pulled into the
server.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_render.c |   5 -
 glamor/glamor_utils.h  | 379 -------------------------------------------------
 2 files changed, 384 deletions(-)

diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 9aca75061639..e04dd2141f7c 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -1334,11 +1334,6 @@ glamor_convert_gradient_picture(ScreenPtr screen,
         }
 
         if (dst) {
-#if 0                           /* Debug to compare it to pixman, Enable it if needed. */
-            glamor_compare_pictures(screen, source,
-                                    dst, x_source, y_source, width, height,
-                                    0, 3);
-#endif
             return dst;
         }
     }
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index e6398692e3d6..6b88527e6a94 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -721,385 +721,6 @@ glamor_is_large_pixmap(PixmapPtr pixmap)
 }
 
 static inline void
-_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned char *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2d ", (p[j / 8] & (1 << (j % 8))) >> (j % 8));
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned char *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2x ", p[j]);
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned short *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind / 2;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2x ", p[j]);
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    int i, j;
-    unsigned int *p = (pixmap)->devPrivate.ptr;
-    int stride = (pixmap)->devKind / 4;
-
-    p = p + y * stride + x;
-
-    for (i = 0; i < h; i++) {
-        ErrorF("line %3d: ", i);
-        for (j = 0; j < w; j++)
-            ErrorF("%2x ", p[j]);
-        p += stride;
-        ErrorF("\n");
-    }
-}
-
-static inline void
-glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
-{
-    w = ((x + w) > (pixmap)->drawable.width) ? ((pixmap)->drawable.width - x) : w;
-    h = ((y + h) > (pixmap)->drawable.height) ? ((pixmap)->drawable.height - y) : h;
-
-    glamor_prepare_access(&(pixmap)->drawable, GLAMOR_ACCESS_RO);
-    switch ((pixmap)->drawable.depth) {
-    case 8:
-        _glamor_dump_pixmap_byte(pixmap, x, y, w, h);
-        break;
-    case 15:
-    case 16:
-        _glamor_dump_pixmap_sword(pixmap, x, y, w, h);
-        break;
-
-    case 24:
-    case 32:
-        _glamor_dump_pixmap_word(pixmap, x, y, w, h);
-        break;
-    case 1:
-        _glamor_dump_pixmap_bits(pixmap, x, y, w, h);
-        break;
-    default:
-        ErrorF("dump depth %d, not implemented.\n", (pixmap)->drawable.depth);
-    }
-    glamor_finish_access(&(pixmap)->drawable);
-}
-
-static inline void
-_glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
-                        int x, int y, int w, int h,
-                        PictFormatShort short_format, int all, int diffs)
-{
-    int i, j;
-    unsigned char *p1 = pixmap1->devPrivate.ptr;
-    unsigned char *p2 = pixmap2->devPrivate.ptr;
-    int line_need_printed = 0;
-    int test_code = 0xAABBCCDD;
-    int little_endian = 0;
-    unsigned char *p_test;
-    int bpp = pixmap1->drawable.depth == 8 ? 1 : 4;
-    int stride = pixmap1->devKind;
-
-    assert(pixmap1->devKind == pixmap2->devKind);
-
-    ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h);
-
-    p1 = p1 + y * stride + x;
-    p2 = p2 + y * stride + x;
-
-    if (all) {
-        for (i = 0; i < h; i++) {
-            ErrorF("line %3d: ", i);
-
-            for (j = 0; j < stride; j++) {
-                if (j % bpp == 0)
-                    ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
-                else
-                    ErrorF("%2x:%2x ", p1[j], p2[j]);
-            }
-
-            p1 += stride;
-            p2 += stride;
-            ErrorF("\n");
-        }
-    }
-    else {
-        if (short_format == PICT_a8r8g8b8) {
-            p_test = (unsigned char *) &test_code;
-            little_endian = (*p_test == 0xDD);
-            bpp = 4;
-
-            for (i = 0; i < h; i++) {
-                line_need_printed = 0;
-
-                for (j = 0; j < stride; j++) {
-                    if (p1[j] != p2[j] &&
-                        (p1[j] - p2[j] > diffs || p2[j] - p1[j] > diffs)) {
-                        if (line_need_printed) {
-                            if (little_endian) {
-                                switch (j % 4) {
-                                case 2:
-                                    ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 1:
-                                    ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 0:
-                                    ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 3:
-                                    ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                }
-                            }
-                            else {
-                                switch (j % 4) {
-                                case 1:
-                                    ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 2:
-                                    ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 3:
-                                    ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                case 0:
-                                    ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j],
-                                           p2[j]);
-                                    break;
-                                }
-                            }
-                        }
-                        else {
-                            line_need_printed = 1;
-                            j = -1;
-                            ErrorF("line %3d: ", i);
-                            continue;
-                        }
-                    }
-                }
-
-                p1 += stride;
-                p2 += stride;
-                ErrorF("\n");
-            }
-        }                       //more format can be added here.
-        else {                  // the default format, just print.
-            for (i = 0; i < h; i++) {
-                line_need_printed = 0;
-
-                for (j = 0; j < stride; j++) {
-                    if (p1[j] != p2[j]) {
-                        if (line_need_printed) {
-                            ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
-                        }
-                        else {
-                            line_need_printed = 1;
-                            j = -1;
-                            ErrorF("line %3d: ", i);
-                            continue;
-                        }
-                    }
-                }
-
-                p1 += stride;
-                p2 += stride;
-                ErrorF("\n");
-            }
-        }
-    }
-}
-
-static inline void
-glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
-                       int x, int y, int w, int h, int all, int diffs)
-{
-    assert(pixmap1->drawable.depth == pixmap2->drawable.depth);
-
-    if (glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO) &&
-        glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO)) {
-        _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs);
-    }
-    glamor_finish_access(&pixmap1->drawable);
-    glamor_finish_access(&pixmap2->drawable);
-}
-
-/* This function is used to compare two pictures.
-   If the picture has no drawable, we use fb functions to generate it. */
-static inline void
-glamor_compare_pictures(ScreenPtr screen,
-                        PicturePtr fst_picture,
-                        PicturePtr snd_picture,
-                        int x_source, int y_source,
-                        int width, int height, int all, int diffs)
-{
-    PixmapPtr fst_pixmap;
-    PixmapPtr snd_pixmap;
-    int fst_generated, snd_generated;
-    int error;
-    int fst_type = -1;
-    int snd_type = -1;          // -1 represent has drawable.
-
-    if (fst_picture->format != snd_picture->format) {
-        ErrorF("Different picture format can not compare!\n");
-        return;
-    }
-
-    if (!fst_picture->pDrawable) {
-        fst_type = fst_picture->pSourcePict->type;
-    }
-
-    if (!snd_picture->pDrawable) {
-        snd_type = snd_picture->pSourcePict->type;
-    }
-
-    if ((fst_type != -1) && (snd_type != -1) && (fst_type != snd_type)) {
-        ErrorF("Different picture type will never be same!\n");
-        return;
-    }
-
-    fst_generated = snd_generated = 0;
-
-    if (!fst_picture->pDrawable) {
-        PicturePtr pixman_pic;
-        PixmapPtr pixmap = NULL;
-        PictFormatShort format;
-
-        format = fst_picture->format;
-
-        pixmap = glamor_create_pixmap(screen,
-                                      width, height,
-                                      PIXMAN_FORMAT_DEPTH(format),
-                                      GLAMOR_CREATE_PIXMAP_CPU);
-
-        pixman_pic = CreatePicture(0,
-                                   &(pixmap)->drawable,
-                                   PictureMatchFormat(screen,
-                                                      PIXMAN_FORMAT_DEPTH
-                                                      (format), format), 0, 0,
-                                   serverClient, &error);
-
-        fbComposite(PictOpSrc, fst_picture, NULL, pixman_pic,
-                    x_source, y_source, 0, 0, 0, 0, width, height);
-
-        glamor_destroy_pixmap(pixmap);
-
-        fst_picture = pixman_pic;
-        fst_generated = 1;
-    }
-
-    if (!snd_picture->pDrawable) {
-        PicturePtr pixman_pic;
-        PixmapPtr pixmap = NULL;
-        PictFormatShort format;
-
-        format = snd_picture->format;
-
-        pixmap = glamor_create_pixmap(screen,
-                                      width, height,
-                                      PIXMAN_FORMAT_DEPTH(format),
-                                      GLAMOR_CREATE_PIXMAP_CPU);
-
-        pixman_pic = CreatePicture(0,
-                                   &(pixmap)->drawable,
-                                   PictureMatchFormat(screen,
-                                                      PIXMAN_FORMAT_DEPTH
-                                                      (format), format), 0, 0,
-                                   serverClient, &error);
-
-        fbComposite(PictOpSrc, snd_picture, NULL, pixman_pic,
-                    x_source, y_source, 0, 0, 0, 0, width, height);
-
-        glamor_destroy_pixmap(pixmap);
-
-        snd_picture = pixman_pic;
-        snd_generated = 1;
-    }
-
-    fst_pixmap = glamor_get_drawable_pixmap(fst_picture->pDrawable);
-    snd_pixmap = glamor_get_drawable_pixmap(snd_picture->pDrawable);
-
-    if (fst_pixmap->drawable.depth != snd_pixmap->drawable.depth) {
-        if (fst_generated)
-            miDestroyPicture(fst_picture);
-        if (snd_generated)
-            miDestroyPicture(snd_picture);
-
-        ErrorF("Different pixmap depth can not compare!\n");
-        return;
-    }
-
-    if ((fst_type == SourcePictTypeLinear) ||
-        (fst_type == SourcePictTypeRadial) ||
-        (fst_type == SourcePictTypeConical) ||
-        (snd_type == SourcePictTypeLinear) ||
-        (snd_type == SourcePictTypeRadial) ||
-        (snd_type == SourcePictTypeConical)) {
-        x_source = y_source = 0;
-    }
-
-    if (glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO) &&
-        glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO)) {
-        _glamor_compare_pixmaps(fst_pixmap, snd_pixmap,
-                                x_source, y_source,
-                                width, height, fst_picture->format,
-                                all, diffs);
-    }
-    glamor_finish_access(&fst_pixmap->drawable);
-    glamor_finish_access(&snd_pixmap->drawable);
-
-    if (fst_generated)
-        miDestroyPicture(fst_picture);
-    if (snd_generated)
-        miDestroyPicture(snd_picture);
-
-    return;
-}
-
-static inline void
 glamor_make_current(glamor_screen_private *glamor_priv)
 {
     if (lastGLContext != &glamor_priv->ctx) {
-- 
2.9.3



More information about the xorg-devel mailing list