[PATCH] Add support for RENDER BGRA formats.

Aaron Plattner aplattner at nvidia.com
Thu Oct 8 19:11:14 PDT 2009


On Sun, Aug 02, 2009 at 08:00:01AM -0700,  wrote:
> From: Michel Dänzer <daenzer at vmware.com>
> 
> ---
>  composite/compinit.c     |    4 +++-
>  exa/exa_render.c         |   30 +++++++++++++++++++++++++-----
>  fb/fbpict.h              |    2 ++
>  hw/xfree86/xaa/xaaPict.c |   20 ++++++++++++++++----
>  render/picture.c         |   36 +++++++++++++++++++++++++++++++++++-
>  render/picture.h         |    3 +++
>  6 files changed, 84 insertions(+), 11 deletions(-)
> 
> 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.

-- Aaron


More information about the xorg-devel mailing list