re-add a workaround for a clipping related bug in Xorg<=1.6.

This was removed upstream but is still needed for pkgsrc's
modular-xorg.
Fixes PR pkg/45509 by Francois Tigeot.
Thankd for Francois for providing a pointer to the
offending change.
bump PKGREV
This commit is contained in:
drochner 2011-10-27 16:52:51 +00:00
parent aec72be034
commit 5ac74e7d14
6 changed files with 246 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.44 2011/07/13 19:25:42 tron Exp $
# $NetBSD: Makefile,v 1.45 2011/10/27 16:52:51 drochner Exp $
DISTNAME= pixman-0.22.2
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= x11
MASTER_SITES= ${MASTER_SITE_XORG:=lib/}
EXTRACT_SUFX= .tar.bz2

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.42 2011/07/11 10:50:58 drochner Exp $
$NetBSD: distinfo,v 1.43 2011/10/27 16:52:51 drochner Exp $
SHA1 (pixman-0.22.2.tar.bz2) = ad2b828ce4280472f5933d8bb5f0f4d583aed7f3
RMD160 (pixman-0.22.2.tar.bz2) = 13dbab02962cf45995aaebde4ec9a952ca8e6e76
@ -8,3 +8,7 @@ SHA1 (patch-ab) = dd31ac6ff6dffb5a29b9d2ac372be55900e773f6
SHA1 (patch-ad) = 2841fb543df1a180a263a770d1934924a4648d8d
SHA1 (patch-ae) = 3bec7a866692b06fd2d9a1376d36277b2d618e14
SHA1 (patch-af) = 53b87f118c8f287449a1a99cad1eb90d9cee1b42
SHA1 (patch-ba) = 9bd8a7fd0cfbd280df06d69838d3d10ab1b51e23
SHA1 (patch-bb) = 5017e070676b9e4613e02fe4b9d129c08abe6c7a
SHA1 (patch-bc) = 6a95770dca37d1ed0379a0b0313589a44ae0b4b0
SHA1 (patch-bd) = cd2feeedffd78dbcc16b327d346afc0b14c78136

View file

@ -0,0 +1,82 @@
$NetBSD: patch-ba,v 1.1 2011/10/27 16:52:51 drochner Exp $
--- pixman/pixman-image.c.orig 2011-06-09 19:19:44.000000000 +0000
+++ pixman/pixman-image.c
@@ -160,27 +160,54 @@ _pixman_image_reset_clip_region (pixman_
image->common.have_clip_region = FALSE;
}
-/* Executive Summary: This function is a no-op that only exists
- * for historical reasons.
- *
- * There used to be a bug in the X server where it would rely on
- * out-of-bounds accesses when it was asked to composite with a
- * window as the source. It would create a pixman image pointing
- * to some bogus position in memory, but then set a clip region
- * to the position where the actual bits were.
+static pixman_bool_t out_of_bounds_workaround = TRUE;
+
+/* Old X servers rely on out-of-bounds accesses when they are asked
+ * to composite with a window as the source. They create a pixman image
+ * pointing to some bogus position in memory, but then they set a clip
+ * region to the position where the actual bits are.
*
* Due to a bug in old versions of pixman, where it would not clip
* against the image bounds when a clip region was set, this would
- * actually work. So when the pixman bug was fixed, a workaround was
- * added to allow certain out-of-bound accesses. This function disabled
- * those workarounds.
+ * actually work. So by default we allow certain out-of-bound access
+ * to happen unless explicitly disabled.
*
- * Since 0.21.2, pixman doesn't do these workarounds anymore, so now
- * this function is a no-op.
+ * Fixed X servers should call this function to disable the workaround.
*/
PIXMAN_EXPORT void
pixman_disable_out_of_bounds_workaround (void)
{
+ out_of_bounds_workaround = FALSE;
+}
+
+static pixman_bool_t
+source_image_needs_out_of_bounds_workaround (bits_image_t *image)
+{
+ if (image->common.clip_sources &&
+ image->common.repeat == PIXMAN_REPEAT_NONE &&
+ image->common.have_clip_region &&
+ out_of_bounds_workaround)
+ {
+ if (!image->common.client_clip)
+ {
+ /* There is no client clip, so if the clip region extends beyond the
+ * drawable geometry, it must be because the X server generated the
+ * bogus clip region.
+ */
+ const pixman_box32_t *extents =
+ pixman_region32_extents (&image->common.clip_region);
+
+ if (extents->x1 >= 0 && extents->x2 <= image->width &&
+ extents->y1 >= 0 && extents->y2 <= image->height)
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
}
static void
@@ -332,6 +359,9 @@ compute_image_info (pixman_image_t *imag
flags |= FAST_PATH_IS_OPAQUE;
}
+ if (source_image_needs_out_of_bounds_workaround (&image->bits))
+ flags |= FAST_PATH_NEEDS_WORKAROUND;
+
if (image->bits.read_func || image->bits.write_func)
flags &= ~FAST_PATH_NO_ACCESSORS;

View file

@ -0,0 +1,12 @@
$NetBSD: patch-bb,v 1.1 2011/10/27 16:52:51 drochner Exp $
--- pixman/pixman-private.h.orig 2011-07-04 20:22:40.000000000 +0000
+++ pixman/pixman-private.h
@@ -595,6 +595,7 @@ _pixman_iter_get_scanline_noop (pixman_i
#define FAST_PATH_ROTATE_90_TRANSFORM (1 << 21)
#define FAST_PATH_ROTATE_180_TRANSFORM (1 << 22)
#define FAST_PATH_ROTATE_270_TRANSFORM (1 << 23)
+#define FAST_PATH_NEEDS_WORKAROUND (1 << 24)
#define FAST_PATH_PAD_REPEAT \
(FAST_PATH_NO_NONE_REPEAT | \

107
x11/pixman/patches/patch-bc Normal file
View file

@ -0,0 +1,107 @@
$NetBSD: patch-bc,v 1.1 2011/10/27 16:52:51 drochner Exp $
--- pixman/pixman.c.orig 2011-07-04 20:22:40.000000000 +0000
+++ pixman/pixman.c
@@ -162,6 +162,57 @@ optimize_operator (pixman_op_t op,
return operator_table[op].opaque_info[is_dest_opaque | is_source_opaque];
}
+static void
+apply_workaround (pixman_image_t *image,
+ int32_t * x,
+ int32_t * y,
+ uint32_t ** save_bits,
+ int * save_dx,
+ int * save_dy)
+{
+ if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
+ {
+ /* Some X servers generate images that point to the
+ * wrong place in memory, but then set the clip region
+ * to point to the right place. Because of an old bug
+ * in pixman, this would actually work.
+ *
+ * Here we try and undo the damage
+ */
+ int bpp = PIXMAN_FORMAT_BPP (image->bits.format) / 8;
+ pixman_box32_t *extents;
+ uint8_t *t;
+ int dx, dy;
+
+ extents = pixman_region32_extents (&(image->common.clip_region));
+ dx = extents->x1;
+ dy = extents->y1;
+
+ *save_bits = image->bits.bits;
+
+ *x -= dx;
+ *y -= dy;
+ pixman_region32_translate (&(image->common.clip_region), -dx, -dy);
+
+ t = (uint8_t *)image->bits.bits;
+ t += dy * image->bits.rowstride * 4 + dx * bpp;
+ image->bits.bits = (uint32_t *)t;
+
+ *save_dx = dx;
+ *save_dy = dy;
+ }
+}
+
+static void
+unapply_workaround (pixman_image_t *image, uint32_t *bits, int dx, int dy)
+{
+ if (image && (image->common.flags & FAST_PATH_NEEDS_WORKAROUND))
+ {
+ image->bits.bits = bits;
+ pixman_region32_translate (&image->common.clip_region, dx, dy);
+ }
+}
+
/*
* Computing composite region
*/
@@ -690,6 +741,13 @@ pixman_image_composite32 (pixman_op_t
uint32_t src_flags, mask_flags, dest_flags;
pixman_region32_t region;
pixman_box32_t *extents;
+ uint32_t *src_bits;
+ int src_dx, src_dy;
+ uint32_t *mask_bits;
+ int mask_dx, mask_dy;
+ uint32_t *dest_bits;
+ int dest_dx, dest_dy;
+ pixman_bool_t need_workaround;
pixman_implementation_t *imp;
pixman_composite_func_t func;
@@ -727,6 +785,16 @@ pixman_image_composite32 (pixman_op_t
src_format = mask_format = PIXMAN_rpixbuf;
}
+ /* Check for workaround */
+ need_workaround = (src_flags | mask_flags | dest_flags) & FAST_PATH_NEEDS_WORKAROUND;
+
+ if (need_workaround)
+ {
+ apply_workaround (src, &src_x, &src_y, &src_bits, &src_dx, &src_dy);
+ apply_workaround (mask, &mask_x, &mask_y, &mask_bits, &mask_dx, &mask_dy);
+ apply_workaround (dest, &dest_x, &dest_y, &dest_bits, &dest_dx, &dest_dy);
+ }
+
pixman_region32_init (&region);
if (!pixman_compute_composite_region32 (
@@ -793,6 +861,13 @@ pixman_image_composite32 (pixman_op_t
}
out:
+ if (need_workaround)
+ {
+ unapply_workaround (src, src_bits, src_dx, src_dy);
+ unapply_workaround (mask, mask_bits, mask_dx, mask_dy);
+ unapply_workaround (dest, dest_bits, dest_dx, dest_dy);
+ }
+
pixman_region32_fini (&region);
}

View file

@ -0,0 +1,38 @@
$NetBSD: patch-bd,v 1.1 2011/10/27 16:52:51 drochner Exp $
--- pixman/pixman.h.orig 2011-07-04 20:22:40.000000000 +0000
+++ pixman/pixman.h
@@ -845,25 +845,19 @@ void pixman_image_composite32
int32_t width,
int32_t height);
-/* Executive Summary: This function is a no-op that only exists
- * for historical reasons.
- *
- * There used to be a bug in the X server where it would rely on
- * out-of-bounds accesses when it was asked to composite with a
- * window as the source. It would create a pixman image pointing
- * to some bogus position in memory, but then set a clip region
- * to the position where the actual bits were.
+/* Old X servers rely on out-of-bounds accesses when they are asked
+ * to composite with a window as the source. They create a pixman image
+ * pointing to some bogus position in memory, but then they set a clip
+ * region to the position where the actual bits are.
*
* Due to a bug in old versions of pixman, where it would not clip
* against the image bounds when a clip region was set, this would
- * actually work. So when the pixman bug was fixed, a workaround was
- * added to allow certain out-of-bound accesses. This function disabled
- * those workarounds.
+ * actually work. So by default we allow certain out-of-bound access
+ * to happen unless explicitly disabled.
*
- * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this
- * function is a no-op.
+ * Fixed X servers should call this function to disable the workaround.
*/
-void pixman_disable_out_of_bounds_workaround (void);
+void pixman_disable_out_of_bounds_workaround (void);
/*
* Trapezoids