device-offset test randomly fails because XCreatePixmap bits are undefined
Submitted by Massimo
Assigned to Chris Wilson @ickle
Description
Created attachment 106221 proposed patch
while running
DISPLAY=:2 make test TARGETS=image,xlib
with Xvfb on display :2, to check a fix for bug #74779, occasionally device-offset.xlib-render-0_0.rgb24 was reported PASS, even if the code modified was not executed at all by that test.
The problem is that in that test (and few others) a temporary Pixmap is created on the server and because render-0_0 does not have FillRectangles an image surface is used to clear the Pixmap, but because the image surface is already 'clear' it is left untouched and in _cairo_surface_unmap the 'clear' image is not unmapped because untouched (image->base.serial == 0)
http://cgit.freedesktop.org/cairo/tree/src/cairo-surface.c#n688
this means X's Pixmap is left in its original undefined state and only occasionally it is clear.
I suggest to increment the serial member of the image_surface when the 'is_clear' state of the image_surface does not correspond to a clear content of the corresponding xlib_surface, as in the attached patch.
Attachment 106221, "proposed patch":
0001-fix-device-offset.xlib-render-0_0.rgb24.patch