b=456467; revisit cairo xlib buggy repeat handling; r=roc
--- a/gfx/cairo/buggy-repeat.patch
+++ b/gfx/cairo/buggy-repeat.patch
@@ -1,30 +1,39 @@
diff --git a/gfx/cairo/cairo/src/cairo-xlib-display.c b/gfx/cairo/cairo/src/cairo-xlib-display.c
--- a/gfx/cairo/cairo/src/cairo-xlib-display.c
+++ b/gfx/cairo/cairo/src/cairo-xlib-display.c
-@@ -63,6 +63,8 @@ struct _cairo_xlib_job {
- };
+@@ -216,6 +216,8 @@ _cairo_xlib_display_get (Display *dpy)
+ XExtCodes *codes;
+ int major_unused, minor_unused;
- static cairo_xlib_display_t *_cairo_xlib_display_list;
++ static int buggy_repeat_force = -1;
+
-+static int buggy_repeat_force = -1;
-
- static void
- _cairo_xlib_call_close_display_hooks (cairo_xlib_display_t *display)
-@@ -302,6 +304,17 @@ _cairo_xlib_display_get (Display *dpy)
+ /* There is an apparent deadlock between this mutex and the
+ * mutex for the display, but it's actually safe. For the
+ * app to call XCloseDisplay() while any other thread is
+@@ -308,6 +310,26 @@ _cairo_xlib_display_get (Display *dpy)
+ if (VendorRelease (dpy) <= 40500000)
display->buggy_repeat = TRUE;
}
-
++
+ /* XXX workaround; see https://bugzilla.mozilla.org/show_bug.cgi?id=413583 */
++ /* If buggy_repeat_force == -1, then initialize.
++ * - set to -2, meaning "nothing was specified", and we trust the above detection.
++ * - if MOZ_CAIRO_BUGGY_REPEAT is '0' (exactly), then force buggy repeat off
++ * - if MOZ_CAIRO_BUGGY_REPEAT is '1' (exactly), then force buggy repeat on
++ */
+ if (buggy_repeat_force == -1) {
-+ if (getenv("MOZ_CAIRO_NO_BUGGY_REPEAT"))
++ const char *flag = getenv("MOZ_CAIRO_FORCE_BUGGY_REPEAT");
++
++ buggy_repeat_force = -2;
++
++ if (flag && flag[0] == '0')
+ buggy_repeat_force = 0;
-+ else
++ else if (flag && flag[0] == '1')
+ buggy_repeat_force = 1;
+ }
+
-+ if (buggy_repeat_force)
-+ display->buggy_repeat = TRUE;
-+
++ if (buggy_repeat_force != -2)
++ display->buggy_repeat = (buggy_repeat_force == 1);
+
display->next = _cairo_xlib_display_list;
_cairo_xlib_display_list = display;
-
--- a/gfx/cairo/cairo/src/cairo-xlib-display.c
+++ b/gfx/cairo/cairo/src/cairo-xlib-display.c
@@ -61,18 +61,16 @@ struct _cairo_xlib_job {
void *data;
void (*destroy) (void *);
} work;
} func;
};
static cairo_xlib_display_t *_cairo_xlib_display_list;
-static int buggy_repeat_force = -1;
-
static void
_cairo_xlib_remove_close_display_hook_internal (cairo_xlib_display_t *display,
cairo_xlib_hook_t *hook);
static void
_cairo_xlib_call_close_display_hooks (cairo_xlib_display_t *display)
{
cairo_xlib_screen_info_t *screen;
@@ -213,16 +211,18 @@ static int
cairo_xlib_display_t *
_cairo_xlib_display_get (Display *dpy)
{
cairo_xlib_display_t *display;
cairo_xlib_display_t **prev;
XExtCodes *codes;
int major_unused, minor_unused;
+ static int buggy_repeat_force = -1;
+
/* There is an apparent deadlock between this mutex and the
* mutex for the display, but it's actually safe. For the
* app to call XCloseDisplay() while any other thread is
* inside this function would be an error in the logic
* app, and the CloseDisplay hook is the only other place we
* acquire this mutex.
*/
CAIRO_MUTEX_LOCK (_cairo_xlib_display_mutex);
@@ -307,25 +307,34 @@ cairo_xlib_display_t *
if (VendorRelease (dpy) < 10400000)
display->buggy_repeat = TRUE;
} else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
if (VendorRelease (dpy) <= 40500000)
display->buggy_repeat = TRUE;
}
/* XXX workaround; see https://bugzilla.mozilla.org/show_bug.cgi?id=413583 */
+ /* If buggy_repeat_force == -1, then initialize.
+ * - set to -2, meaning "nothing was specified", and we trust the above detection.
+ * - if MOZ_CAIRO_BUGGY_REPEAT is '0' (exactly), then force buggy repeat off
+ * - if MOZ_CAIRO_BUGGY_REPEAT is '1' (exactly), then force buggy repeat on
+ */
if (buggy_repeat_force == -1) {
- if (getenv("MOZ_CAIRO_NO_BUGGY_REPEAT"))
+ const char *flag = getenv("MOZ_CAIRO_FORCE_BUGGY_REPEAT");
+
+ buggy_repeat_force = -2;
+
+ if (flag && flag[0] == '0')
buggy_repeat_force = 0;
- else
+ else if (flag && flag[0] == '1')
buggy_repeat_force = 1;
}
- if (buggy_repeat_force)
- display->buggy_repeat = TRUE;
+ if (buggy_repeat_force != -2)
+ display->buggy_repeat = (buggy_repeat_force == 1);
display->next = _cairo_xlib_display_list;
_cairo_xlib_display_list = display;
UNLOCK:
CAIRO_MUTEX_UNLOCK (_cairo_xlib_display_mutex);
return display;
}