[Mesa-dev] [PATCH] st/dri: Use packed RGB formats

Michel Dänzer michel at daenzer.net
Mon Sep 28 01:40:02 PDT 2015


On 02.09.2015 01:49, Ilia Mirkin wrote:
> On Mon, Aug 10, 2015 at 5:44 AM, Michel Dänzer <michel at daenzer.net> wrote:
>>
>> diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
>> index 0d2929a..f0cc4a2 100644
>> --- a/src/gallium/state_trackers/dri/dri_drawable.c
>> +++ b/src/gallium/state_trackers/dri/dri_drawable.c
>> @@ -231,11 +231,11 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
>>        if (format == __DRI_TEXTURE_FORMAT_RGB)  {
>>           /* only need to cover the formats recognized by dri_fill_st_visual */
>>           switch (internal_format) {
>> -         case PIPE_FORMAT_B8G8R8A8_UNORM:
>> -            internal_format = PIPE_FORMAT_B8G8R8X8_UNORM;
>> +         case PIPE_FORMAT_BGRA8888_UNORM:
>> +            internal_format = PIPE_FORMAT_BGRX8888_UNORM;
>>              break;
>> -         case PIPE_FORMAT_A8R8G8B8_UNORM:
>> -            internal_format = PIPE_FORMAT_X8R8G8B8_UNORM;
>> +         case PIPE_FORMAT_ARGB8888_UNORM:
>> +            internal_format = PIPE_FORMAT_XRGB8888_UNORM;
>>              break;
>>           default:
>>              break;
> 
> This dri_drawable.c hunk is unnecessary.

I guess you're right, thanks.


> I wrote the same patch for dri2.c though. Any reason it didn't get
> pushed?

The immediate reason was that I remembered that this patch alone doesn't
help for the r300g driver at least.

Since then, it has occurred to me that this patch is actually wrong for
r300g: The Xorg driver uses the same hardware formats on big and little
endian hosts, it just swaps bytes on the CPU as necessary. This would
correspond to using the same basic Gallium formats regardless of host
byte order.

OTOH with hardware supported by the r600g driver, the kernel and Xorg
set up the hardware to always access data in host byte order, which
corresponds to the approach in this patch.

So, I'm afraid there's no simple solution in st/dri which works for both
r300g and r600g. :(


Which way do the nouveau kernel / Xorg drivers handle this?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer



More information about the mesa-dev mailing list