subpixel rendering in wayland?

Bill Spitzak spitzak at gmail.com
Tue Mar 1 10:37:18 PST 2011


A Wayland compositor *could* resample the source images knowing about 
the positions of the rgb subpixels on the output device. For instance 
the filtering could shift the source transform 1/3 pixel right for the 
red and 1/3 pixel to the left for the blue, to compensate for where the 
centers of these LCDs are. Further (and more complex) filtering will be 
needed to avoid color fringing in high-contrast areas.

It is also likely that the client wants to render an image to display at 
1:1 scale on a particular subpixel screen (i.e it uses freetype's 
subpixel rendering). In this case the filtering also has to try to 
invert the 1/3 shifts and color fringing filtering that the client did. 
Ideally these will cancel out if the scale is the same and the input and 
output subpixel arrangement is the same.

Each individual monitor may have a different subpixel arrangement 
(chiefly due to users wanting one in portrait while another is in 
landscape).

Though I think Wayland will ignore all this initially, it should provide 
an API so this can be done in the future. Something like this:

1. When a client provides an image, it also tells the compositor what 
subpixel arrangement it was rendered for (none, horizontal and vertical 
rgb or bgr, etc). The compositor can use this information to change how 
filtering is done in transforms.

2. The compositor informs the client about the arrangement of all the 
monitors, and part of this is the subpixel arrangement of each of them. 
The client can then render images with the correct subpixel for the 
monitor. It can assume that if the scale is 1:1 and the subpixels match, 
that the compositor will put those pixels unchanged on the monitor.

3. To allow "perfect" output when a window spans monitors with different 
subpixel arrangements, I think the easiest way would be for clients to 
be able to restrict an image to particular monitors. The client could 
then provide two source images, each drawn for a given monitor and 
restricted to it, and each with the same transform. The user would see 
the window spanning the two monitors, but as they moved the window, if 
they look really closely, would see the antialiasing switch between them.



More information about the wayland-devel mailing list