[Mesa-dev] [PATCH 20/22] nv50, nvc0: Support BGRX1010102 format for visuals.

Mario Kleiner mario.kleiner.de at gmail.com
Fri Dec 1 05:54:04 UTC 2017

On 11/29/2017 04:38 PM, Ilia Mirkin wrote:
> Why is this required? Can't you just use the BGR10_A2 format directly?

If i don't define this PIPE_FORMAT_B10G10R10X2_UNORM as "TD" = 
displayable, then it doesn't get exposed by the state tracker as a 
visual/fbconfig with RGBA = 10 10 10 0 under nouveau.

Wayland's Weston doesn't like that at all and gives a screen with pixel 
trash instead of a proper desktop, probably because it falls back to a 
BGRA1010102 format with alpha channel, that might indeed be zero.

On X11, all redirected/composited rendering only gives a black window 
client area, e.g., glxgears ends up as a black rectangle.

With the patch i get proper Weston display, and proper composited X11. 
"Proper" within the limitations imposed by my hacks + tbd work on the 
ddx and kms driver.

> The problem with exposing these sorts of formats is that blending with
> DST_ALPHA would be incorrect -- it should get read in as 1.0, but will
> end up with bogus values.

Hm. My own application uses DST_ALPHA and ONE_MINUS_DST_ALPHA blending 
on the window system backbuffer in some demos and it seems to work fine 
on nouveau in depth 30 from what i can see. Not sure if this is due to 
the way my demos handle this though and there might be other cases that 
misbehave like you describe.

Unfortunately nv50/g80_defs.xml.h doesn't define a BGR10 surface format 
without alpha channel.


> Cheers,
>    -ilia
> On Tue, Nov 28, 2017 at 11:21 PM, Mario Kleiner
> <mario.kleiner.de at gmail.com> wrote:
>> Add it as displayable/scanout capable, so it can be
>> exposed as valid visual/fbconfig.
>> Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
>> ---
>>   src/gallium/drivers/nouveau/nv50/nv50_formats.c | 1 +
>>   1 file changed, 1 insertion(+)
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_formats.c b/src/gallium/drivers/nouveau/nv50/nv50_formats.c
>> index 706c34f..f2f9a4f 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_formats.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_formats.c
>> @@ -154,6 +154,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
>>      C4(A, R10G10B10A2_UNORM, RGB10_A2_UNORM, R, G, B, A, UNORM, A2B10G10R10, IB),
>>      C4(A, B10G10R10A2_UNORM, BGR10_A2_UNORM, B, G, R, A, UNORM, A2B10G10R10, TD),
>> +   F3(A, B10G10R10X2_UNORM, BGR10_A2_UNORM, B, G, R, xx, UNORM, A2B10G10R10, TD),
>>      C4(A, R10G10B10A2_SNORM, NONE, R, G, B, A, SNORM, A2B10G10R10, T),
>>      C4(A, B10G10R10A2_SNORM, NONE, B, G, R, A, SNORM, A2B10G10R10, T),
>>      C4(A, R10G10B10A2_UINT, RGB10_A2_UINT, R, G, B, A, UINT, A2B10G10R10, TR),
>> --
>> 2.7.4
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

More information about the mesa-dev mailing list