pixman: app patches to fix scrolling glitches
authorGrazvydas Ignotas <notasas@gmail.com>
Sat, 1 Nov 2014 00:12:15 +0000 (02:12 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 1 Nov 2014 00:12:15 +0000 (02:12 +0200)
why do we need them at all?

recipes/xorg-lib/pixman/0001-Generic-C-implementation-of-pixman_blt-with-overlapp-0-32.patch [new file with mode: 0644]
recipes/xorg-lib/pixman/0004-Support-of-overlapping-src-dst-for-pixman_blt_neon-0-32.patch [new file with mode: 0644]
recipes/xorg-lib/pixman_0.32.6.bb

diff --git a/recipes/xorg-lib/pixman/0001-Generic-C-implementation-of-pixman_blt-with-overlapp-0-32.patch b/recipes/xorg-lib/pixman/0001-Generic-C-implementation-of-pixman_blt-with-overlapp-0-32.patch
new file mode 100644 (file)
index 0000000..0ad008f
--- /dev/null
@@ -0,0 +1,72 @@
+From 8ea1a333de202018a862a7b04b94479d3109274b Mon Sep 17 00:00:00 2001
+From: Siarhei Siamashka <siarhei.siamashka@nokia.com>
+Date: Tue, 16 Mar 2010 16:55:28 +0100
+Subject: [PATCH 1/5] Generic C implementation of pixman_blt with overlapping support
+
+Uses memcpy/memmove functions to copy pixels, can handle the
+case when both source and destination areas are in the same
+image (this is useful for scrolling).
+
+It is assumed that copying direction is only important when
+using the same image for both source and destination (and
+src_stride == dst_stride). Copying direction is undefined
+for the images with different source and destination stride
+which happen to be in the overlapped areas (but this is an
+unrealistic case anyway).
+
+[notasas@gmail.com: only ported part needed for NEON patch to 0.32]
+---
+
+diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
+index 6ca13b2..165c7e2 100644
+--- a/pixman/pixman-private.h
++++ b/pixman/pixman-private.h
+@@ -1148,6 +1148,48 @@ void pixman_timer_register (pixman_timer_t *timer);
+ #endif /* PIXMAN_TIMERS */
++/* a helper function, can blit 8-bit images with src/dst overlapping support */
++static inline void
++pixman_blt_helper (uint8_t *src_bytes,
++                   uint8_t *dst_bytes,
++                   int      src_stride,
++                   int      dst_stride,
++                   int      width,
++                   int      height)
++{
++    /*
++     * The second part of this check is not strictly needed, but it prevents
++     * unnecessary upside-down processing of areas which belong to different
++     * images. Upside-down processing can be slower with fixed-distance-ahead
++     * prefetch and perceived as having more tearing.
++     */
++    if (src_bytes < dst_bytes + width &&
++      src_bytes + src_stride * height > dst_bytes)
++    {
++      src_bytes += src_stride * height - src_stride;
++      dst_bytes += dst_stride * height - dst_stride;
++      dst_stride = -dst_stride;
++      src_stride = -src_stride;
++      /* Horizontal scrolling to the left needs memmove */
++      if (src_bytes + width > dst_bytes)
++      {
++          while (--height >= 0)
++          {
++              memmove (dst_bytes, src_bytes, width);
++              dst_bytes += dst_stride;
++              src_bytes += src_stride;
++          }
++          return;
++      }
++    }
++    while (--height >= 0)
++    {
++      memcpy (dst_bytes, src_bytes, width);
++      dst_bytes += dst_stride;
++      src_bytes += src_stride;
++    }
++}
++
+ #endif /* __ASSEMBLER__ */
+ #endif /* PIXMAN_PRIVATE_H */
diff --git a/recipes/xorg-lib/pixman/0004-Support-of-overlapping-src-dst-for-pixman_blt_neon-0-32.patch b/recipes/xorg-lib/pixman/0004-Support-of-overlapping-src-dst-for-pixman_blt_neon-0-32.patch
new file mode 100644 (file)
index 0000000..5d4a7f8
--- /dev/null
@@ -0,0 +1,91 @@
+From e0542866c466ad512d69292df098d4b880e35e52 Mon Sep 17 00:00:00 2001
+From: Siarhei Siamashka <siarhei.siamashka@nokia.com>
+Date: Wed, 18 Nov 2009 06:08:48 +0200
+Subject: [PATCH 4/5] Support of overlapping src/dst for pixman_blt_neon
+
+[notasas@gmail.com: ported to 0.32]
+---
+
+diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
+index 60e9c78..ea0828c 100644
+--- a/pixman/pixman-arm-neon.c
++++ b/pixman/pixman-arm-neon.c
+@@ -242,26 +242,66 @@ arm_neon_blt (pixman_implementation_t *imp,
+               int                      width,
+               int                      height)
+ {
+-    if (src_bpp != dst_bpp)
++    uint8_t *   src_bytes;
++    uint8_t *   dst_bytes;
++    int         bpp;
++
++    if (src_bpp != dst_bpp || src_bpp & 7)
+       return FALSE;
++    bpp = src_bpp >> 3;
++    width *= bpp;
++    src_stride *= 4;
++    dst_stride *= 4;
++    src_bytes = (uint8_t *)src_bits + src_y * src_stride + src_x * bpp;
++    dst_bytes = (uint8_t *)dst_bits + dest_y * dst_stride + dest_x * bpp;
++
++    if (src_bpp != 16 && src_bpp != 32)
++    {
++      pixman_blt_helper (src_bytes, dst_bytes, src_stride, dst_stride,
++                         width, height);
++      return TRUE;
++    }
++
++    if (src_bytes < dst_bytes && src_bytes + src_stride * height > dst_bytes)
++    {
++      src_bytes += src_stride * height - src_stride;
++      dst_bytes += dst_stride * height - dst_stride;
++      dst_stride = -dst_stride;
++      src_stride = -src_stride;
++
++      if (src_bytes + width > dst_bytes)
++      {
++          /* TODO: reverse scanline copy using NEON */
++          while (--height >= 0)
++          {
++              memmove (dst_bytes, src_bytes, width);
++              dst_bytes += dst_stride;
++              src_bytes += src_stride;
++          }
++          return TRUE;
++      }
++    }
++
+     switch (src_bpp)
+     {
+     case 16:
+       pixman_composite_src_0565_0565_asm_neon (
+-              width, height,
+-              (uint16_t *)(((char *) dst_bits) +
+-              dest_y * dst_stride * 4 + dest_x * 2), dst_stride * 2,
+-              (uint16_t *)(((char *) src_bits) +
+-              src_y * src_stride * 4 + src_x * 2), src_stride * 2);
++              width >> 1,
++              height,
++              (uint16_t *) dst_bytes,
++              dst_stride >> 1,
++              (uint16_t *) src_bytes,
++              src_stride >> 1);
+       return TRUE;
+     case 32:
+       pixman_composite_src_8888_8888_asm_neon (
+-              width, height,
+-              (uint32_t *)(((char *) dst_bits) +
+-              dest_y * dst_stride * 4 + dest_x * 4), dst_stride,
+-              (uint32_t *)(((char *) src_bits) +
+-              src_y * src_stride * 4 + src_x * 4), src_stride);
++              width >> 2,
++              height,
++              (uint32_t *) dst_bytes,
++              dst_stride >> 2,
++              (uint32_t *) src_bytes,
++              src_stride >> 2);
+       return TRUE;
+     default:
+       return FALSE;
+
index a2aa60a..5e602d3 100644 (file)
@@ -29,8 +29,9 @@ EXTRA_OECONF = "--disable-gtk ${IWMMXT} ${LOONGSON_MMI} ${NEON}"
 EXTRA_OECONF_virtclass-native = "--disable-gtk"
 
 SRC_URI += "\
-#            file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch;patch=1 \
-#            file://Generic-C-implementation-of-pixman_blt-with-overlapp.patch;patch=1 \
+#        file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti-0-32.patch;patch=1 \
+        file://0001-Generic-C-implementation-of-pixman_blt-with-overlapp-0-32.patch;patch=1 \
+        file://0004-Support-of-overlapping-src-dst-for-pixman_blt_neon-0-32.patch;patch=1 \
 "
 
 SRC_URI[archive.md5sum] = "8a9e8f14743a39cf303803f369c1f344"