Created attachment 139390 [details]
OS Version: Ubuntu 16.04-xenial #146-Ubuntu 4.4.0-122-generic
Xorg Version: 1.18.3
Fontconfig fonts rendering via Xft/Xrender on the client and
through render/glamor on the server do not produce result when
the destination drawable is a 1-bit pixmap.
Please find the demonstration C program attached, that on my
laptop produces these results:
| ** *
Where a 8x4 bitmap is produced in two versions, 1-bit and 24-bit, both are cleared
with color 0, then a single white pixel and a letter "r" is written on it. The 24-bit
produces (low-res, antialiased, but just for the sake of experiment) both glyph and
pixel, and 1-bit produces pixel only.
I managed to produce good results after applying this fix:
--- /home/dk/src/xorg-server-1.18.3/glamor/glamor_utils.h 2016-04-04 20:33:37.000000000 +0200
+++ ./glamor_utils.h 2018-05-06 14:33:43.281740484 +0200
@@ -707,7 +707,8 @@
/* For 1bpp pixmap, we don't store it as texture. */
#define glamor_check_pixmap_fbo_depth(_depth_) ( \
- _depth_ == 8 \
+ _depth_ == 1 \
+ || _depth_ == 8 \
|| _depth_ == 15 \
|| _depth_ == 16 \
|| _depth_ == 24 \
where the output of the program is this:
| ** *
However the comment shows that 1-bit pixmaps are treated specially with regards
to the FBO allocation, and I'm fairly sure that if this change is not the best
fix, then the correct 1-bit rendering should be done elsewhere.
After digging in the source it seems that change came somewhere before
355334fcd99e4dce62e2be1e27290c9a74ea944f in 2012, which means that there might
be more unknowns in the setup that I have on my Ubuntu, if this bug was not
discovered in 6 years.
Unfortunately I couldn't build the latest xserver from github because it
requires many new libraries that I cannot install on the laptop without
breaking the existing installation. However if you need me to test patches, you
may backport them to 1.18.3 , as I can only experiment on this version. If
successfull, patches can also be sent to ubuntu/debian package maintainers.
Created attachment 139391 [details]
gcc -I/usr/include/freetype2 test.c -o test -lX11 -lfontconfig -lXft
UPDATE: Just tried on a fresh Ubuntu 18.04 that features Xorg v1.19.6. The issue is the same and the fix is the same.
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/87.