View Issue Details

IDProjectCategoryView StatusLast Update
0010185ardourdocumentationpublic2026-02-18 05:16
Reporteru1f992 Assigned Topaul  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformUbuntuOSLinuxOS Version(any)
Product Version9.0 
Summary0010185: Cairo patch not linked from documentation
DescriptionCurrent Build-time Ardour Dependencies (https://ardour.org/current_dependencies.html) lists cairo under "Libraries Requiring Modified Versions", but I could not find the actual patch. The nightly build dependencies page (https://nightly.ardour.org/list.php#build_deps) links to the unmodified upstream cairo (`http://cairographics.org/releases/cairo-1.16.0.tar.xz`), and neither page links to a patch or patched tarball for cairo.

The freetype section of `current_dependencies.html` links directly to its patch at `https://raw.github.com/Ardour/ardour/2.0-ongoing/tools/misc-patches/freetype-bytecode.patch`. I found a file `tools/misc-patches/cairo-gradients.patch` on the same branch (commit `990fd441d9`) and it seems to produce a matching `libcairo.so.2`, but since it is not referenced from any documentation I am not sure this is the right one.

Could a link to the cairo patch be added to `current_dependencies.html` (similar to the freetype patch), or could a patched tarball be hosted on the nightly page?
Steps To Reproduce1. Visit https://ardour.org/current_dependencies.html. Cairo is listed under "Libraries Requiring Modified Versions" but has no link to a patch (compare with the Freetype section which links directly to its patch).
2. Visit https://nightly.ardour.org/list.php#build_deps. The cairo entry links to unmodified upstream source.
3. Extract `libcairo.so.2` from the Ardour 9.0 Linux x86_64 installer and compare with one built from the upstream source. The installer version contains `FORCE_BUGGY_GRADIENTS` in `.rodata` and a `getenv("ARDOUR_FORCE_BUGGY_GRADIENTS")` call in `.text` that are absent from the upstream build.
Additional InformationThe patch appears to add a `FORCE_BUGGY_GRADIENTS` environment variable check to `src/cairo-xlib-display.c` and define `CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE` in `src/cairo.h`. These are referenced by Ardour's `gtk2_ardour/ui_config.cc` and `gtk2_ardour/rc_option_editor.cc` via `#ifdef` guards.

Cairo is licensed under LGPL 2.1.
TagsNo tags attached.

Relationships

related to 0010184 resolvedpaul Modified taglib source not found 

Activities

u1f992

2026-02-16 16:14

reporter   ~0029886

I did some additional investigation and found that the patch on the 2.0-ongoing branch (tools/misc-patches/cairo-gradients.patch, commit 990fd441d9) is outdated and insufficient for the current cairo (1.16.0), unlike the freetype patch which still applies cleanly.

Two issues:

1. The original patch targets cairo 1.10.2 code that has been significantly rewritten in 1.16.0. That said, the specific `#if RENDER_MAJOR` / `display->buggy_gradients = FALSE;` block still exists at line 266, so this hunk does apply. The surrounding vendor-detection code (lines 318-343) is new in 1.16.0 but does not conflict.

2. The repository patch only modifies cairo-xlib-display.c. It does not add `#define CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE` to cairo.h. Without this define, Ardour's #ifdef guards in gtk2_ardour/ui_config.cc:232 and gtk2_ardour/rc_option_editor.cc:3186 compile out the entire feature. The "Possibly improve slow graphical performance" preference option never appears, and the FORCE_BUGGY_GRADIENTS environment variable is never set.

The attached patch addresses both points and produces a libcairo.so.2 binary-identical to the one shipped in the official Ardour 9.0 Linux installer.
cairo-force-buggy-gradients.patch (1,155 bytes)   
Ardour-specific patch for cairo 1.16.0: FORCE_BUGGY_GRADIENTS environment variable.

Allows users to force software gradient rendering on Linux systems with buggy
GPU drivers (notably older NVIDIA) by setting FORCE_BUGGY_GRADIENTS=1.

Origin: Ardour git commit 990fd441d9 (2.0-ongoing branch, 2012-05-22)
        plus header macro addition for Ardour's #ifdef guard.
Reference: https://ardour.org/current_dependencies.html
           "patched to allow users to disable h/w gradient rendering
            on buggy Linux video drivers"

--- a/src/cairo-xlib-display.c
+++ b/src/cairo-xlib-display.c
@@ -266,7 +266,12 @@
 #if RENDER_MAJOR == 0 && RENDER_MINOR < 10
     display->buggy_gradients = TRUE;
 #else
-    display->buggy_gradients = FALSE;
+    if (getenv ("FORCE_BUGGY_GRADIENTS")) {
+        display->buggy_gradients = TRUE;
+    }
+    else {
+        display->buggy_gradients = FALSE;
+    }
 #endif
     display->buggy_pad_reflect = FALSE;
     display->buggy_repeat = FALSE;
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -3179,4 +3179,6 @@

 CAIRO_END_DECLS

+#define CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE
+
 #endif /* CAIRO_H */

paul

2026-02-16 19:03

administrator   ~0029887

There are numerous other patches that are applied as part of our dependency stack building. They are currently in a repository that does not have public access. We will consider how best to make them available.

u1f992

2026-02-17 00:15

reporter   ~0029888

Thank you for considering making the patches publicly available. That would be very helpful.

u1f992

2026-02-17 06:56

reporter   ~0029891

Does the patch set also cover GNU termcap (statically linked into `ardour9-lua` via `libreadline.a`)?
I found two differences from upstream, and reproducing both produces a byte-identical stripped binary (excluding `.note.gnu.build-id`). The build-id still differs, so the actual patches may include additional changes that are only visible before stripping:

1. `#include <unistd.h>` in `tparam.c`. Upstream calls `write()` without a prototype, causing GCC to emit `mov $0x0,%eax` before the call. The official binary lacks this instruction. The code compiles without it, so the intent is unclear, but something makes the `write()` prototype visible in your build.
2. Upstream `Makefile.in` hardcodes `CFLAGS = -g`. The official `tputs` shows a GOT relaxation pattern for non-static globals, requiring `-fPIC`. This may be a build option rather than a source patch.

paul

2026-02-17 14:19

administrator   ~0029893

OK, yoiu can now visit https://ardour.org/files/patch-info.html which lists all the changes we make when building our dependency stack. As the page notes, this is automatically generated from the scripts we use to build that stack.

We're not likely to answer further questions about this unless there is an actual error in the information presented.

u1f992

2026-02-17 14:58

reporter   ~0029894

Thank you for publishing the patch info page. I believe this is what I was looking for.

Issue History

Date Modified Username Field Change
2026-02-14 13:49 u1f992 New Issue
2026-02-16 16:14 u1f992 Note Added: 0029886
2026-02-16 16:14 u1f992 File Added: cairo-force-buggy-gradients.patch
2026-02-16 19:03 paul Note Added: 0029887
2026-02-17 00:15 u1f992 Note Added: 0029888
2026-02-17 06:56 u1f992 Note Added: 0029891
2026-02-17 14:19 paul Note Added: 0029893
2026-02-17 14:20 paul Relationship added related to 0010184
2026-02-17 14:58 u1f992 Note Added: 0029894
2026-02-18 05:16 paul Assigned To => paul
2026-02-18 05:16 paul Status new => resolved
2026-02-18 05:16 paul Resolution open => fixed