[PATCH] Add support for RENDER BGRA formats.

Mark Kettenis mark.kettenis at xs4all.nl
Fri Oct 9 02:26:25 PDT 2009


>  On Thu, 2009-10-08 at 19:11 -0700, Aaron Plattner wrote:
> > On Sun, Aug 02, 2009 at 08:00:01AM -0700,  wrote:
> > >
> > > diff --git a/composite/compinit.c b/composite/compinit.c
> > > index dfc3929..6159e4e 100644
> > > --- a/composite/compinit.c
> > > +++ b/composite/compinit.c
> > > @@ -238,6 +238,7 @@ static CompAlternateVisual  altVisuals[] = {
> > >      {	24,	PICT_r8g8b8 },
> > >  #endif
> > >      {	32,	PICT_a8r8g8b8 },
> > > +    {	32,	PICT_b8g8r8a8 },
> > >  };
> > >
> > >  static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
> > > @@ -272,7 +273,8 @@ compAddAlternateVisual(ScreenPtr pScreen,
> > CompScreenPtr cs,
> > >  	return TRUE;
> > >
> > >      pPictFormat = PictureMatchFormat (pScreen, alt->depth,
> > alt->format);
> > > -    if (!pPictFormat)
> > > +    if (!pPictFormat ||
> > > +	pPictFormat->direct.red != pScreen->visuals[0].offsetRed)
> > >  	return FALSE;
> > >
> > >      vid = xalloc(sizeof(VisualID));
> >
> > This breaks Composite at depth 16:
> >
> > [formatted for clarity]
> >
> > (gdb) p pPictFormat->direct
> > $7 = {red = 16, redMask = 255, green = 8, greenMask = 255, blue = 0,
> >       blueMask = 255, alpha = 24, alphaMask = 255}
> > (gdb) p *pPictFormat
> > $8 = {id = 180, format = 166024, type = 1 '\001', depth = 32 ' ',
> >       direct = {red = 16, redMask = 255, green = 8, greenMask = 255,
> >                 blue = 0, blueMask = 255, alpha = 24,
> >                 alphaMask = 255},
> >       index = {vid = 0, pColormap = 0x0, nvalues = 0, pValues = 0x0,
> >                devPrivate = 0x0}}
> > (gdb) p pScreen->visuals[0]
> > $9 = {vid = 33, class = 4, bitsPerRGBValue = 8, ColormapEntries = 64,
> >       nplanes = 16, redMask = 63488, greenMask = 2016, blueMask = 31,
> >       offsetRed = 11, offsetGreen = 5, offsetBlue = 0}
> >
> > Since pPictFormat->direct.red is 16 and pScreen->visuals[0].offsetRed is
> > 11, it
> > returns FALSE and compScreenInit bails out.
>
>  Hmm, right. The two hunks above were aimed towards my first approach for
>  fixing radeon KMS on big endian machines, by making the root window
>  visual BGRA. I've since abandoned that approach for a different one, so
>  those hunks are not needed anymore and obviously even harmful. I'll
>  submit a patch to revert them.

Well, it would be nice if a solution to support BGRA properly would be
found.  I have an i128-based card designed for Sun UltraSPARC workstations
that can't do the byteswaps in hardware like the radeons can.




More information about the xorg-devel mailing list