Instead of computing whether a workaround is needed on every call to
_pixman_run_fast_path(), just cache this information in the image.
Also, when workarounds are needed, clip against the source geometry to
prevent out of bound reads.
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.
The workaround added by this commit is to try and detect whether a
source drawable is actually a window without a client clip set. Such a
window will generally have a clip region that corresponds exactly to
the hierarchy clip in the server, whereas pixmaps will have a clip
region that is an exact match to the drawable.
When we detect such a window, we allow a fast path to run that would
normally be rejected due to the sources not completely subsuming the
composite region.
Fixed X servers should call the new function
pixman_disable_out_of_bounds_workaround() to disable the workaround.
This was reported in bug 22484.
This patch fixes the following build error caused
by commit a98b71eff4
(Convert CamelCase names to underscore_names.):
<-- snip -->
...
pixman-arm-neon.c: In function 'neon_composite_over_n_8_0565':
pixman-arm-neon.c:1784: error: 'x_dst' undeclared (first use in this function)
pixman-arm-neon.c:1784: error: (Each undeclared identifier is reported only once
pixman-arm-neon.c:1784: error: for each function it appears in.)
pixman-arm-neon.c:1785: error: 'p_dst' undeclared (first use in this function)
pixman-arm-neon.c: In function 'neon_composite_over_n_0565':
pixman-arm-neon.c:1937: error: 'x_dst' undeclared (first use in this function)
pixman-arm-neon.c:1938: error: 'p_dst' undeclared (first use in this function)
pixman-arm-neon.c: In function 'neon_composite_over_8888_0565':
pixman-arm-neon.c:2074: error: 'x_dst' undeclared (first use in this function)
pixman-arm-neon.c:2075: error: 'p_dst' undeclared (first use in this function)
make[3]: *** [libpixman_arm_neon_la-pixman-arm-neon.lo] Error 1
...
<-- snip -->
The changes in pixman behavior justifying this are:
- New clipping rules
- Bug fixes in region code. In particular, when
pixman_region_init_rects() is called on these two boxes:
{ 2, 6, 7, 6 }
{ 4, 1, 6, 7 }
it now ignores the first one, which is empty and produces
{ 4, 1, 6, 7 }
Previously, it would produce:
{ 2, 1, 7, 7 }
for some reason.