[Mesa-dev] gallium endianness and hw drivers

Michel Dänzer michel at daenzer.net
Tue Jan 14 22:07:30 PST 2014


On Die, 2014-01-14 at 00:22 +0100, Marek Olšák wrote:
> I think the format conversion functions should look like:
> 
> #ifdef BIG_ENDIAN
>    case PIPE_FORMAT_A8B8G8R8_UNORM:
>       return hw_format_for_R8G8B8A8_UNORM;
> ...
> #else
>    case PIPE_FORMAT_R8G8B8A8_UNORM:
>       return hw_format_for_R8G8B8A8_UNORM;
> #endif
> 
> which can be simplified to:
> 
>    case PIPE_FORMAT_RGBA8888_UNORM:
>       return hw_format_for_R8G8B8A8_UNORM;
> 
> So that the GPU can see the same formats, but they are different for the CPU.
> 
> What do you think?

That might be an option, but PIPE_FORMAT_R8G8B8A8_UNORM is useful on big
endian hosts as well, e.g. it matches GL_RGBA / GL_UNSIGNED_BYTE
exactly.

I think one issue here is that we're trying to use a single format
attribute for several purposes (API visible representation, GPU/driver
internal representation).


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



More information about the mesa-dev mailing list