[Xorg] Composite and ABI stability

Kevin E Martin kem at freedesktop.org
Fri Aug 6 12:48:30 PDT 2004

On Fri, Aug 06, 2004 at 08:33:19PM +0200, Soeren Sandmann wrote:
> In bug 990, Eric Anholt reports that X server compiled with COMPOSITE
              Kevin Martin
> produce wrong colors and suspects that this is cause alphaMask and
> alphaOffset in Visuals are not initialized.
> This is correct;

Thank you for confirming this issue.

>                  modfiying the i830 driver to initialize those fields
> does make the problem go away. However, there is a bigger problem than
> that:
> typedef struct _Visual {
>     VisualID		vid;
>     short		class;
>     short		bitsPerRGBValue;
>     short		ColormapEntries;
>     short		nplanes;/* = log2 (ColormapEntries). This does not
> 				 * imply that the screen has this many planes.
> 				 * it may have more or fewer */
>     unsigned long	redMask, greenMask, blueMask;
>     int			offsetRed, offsetGreen, offsetBlue;
> #ifdef COMPOSITE
>     unsigned long	alphaMask;
>     int			offsetAlpha;
> #endif
>   } VisualRec;
> The two added fields break binary compatibility because drivers are
> passed arrays of Visuals though screens and are expected to initialize
> them. There is a similar problem with Pixmaps which also get two
> additional fields. 
> If we are guaranteeing binary compatibility with existing drivers,
> this has to be done in a different way.
> Some possible solutions:
>         1. In compinit.c simply initialzie all the existing alpha
>            masks to 0. This will break compatibility and prevent
>            hardware from advertising its own alpha visuals
>         2. Fix all drivers to initialize the fields properly. This
>            will break compatibility in the Composite case. 
>         3. Rework the way composite has been integrated to now change
>            the size of Visuals and Pixmaps and make composite 
>            responsible for initializing the new fields.
> To me, 3 seems the right solution, but I could be wrong.

I agree with your assessment and recently added a comment to bug #991
along similar lines -- i.e., create an "extended" visual structure that
only Composite would export.  A similar approach could be taken with
pixmaps.  This should solve both the ABI issue as well as the exposing
visuals problem (bug #991).

Another solution, if it is not possible to fix the ABI issues, is to
simply disable compiling Composite by default for the release.

More information about the xorg mailing list