[Mesa-dev] [PATCH 03/13] gallium: Introduce 32-bit bytewise format names

Richard Sandiford rsandifo at linux.vnet.ibm.com
Thu Jun 6 05:56:06 PDT 2013

Christoph Bumiller <e0425955 at student.tuwien.ac.at> writes:
> On 06.06.2013 10:34, Richard Sandiford wrote:
>> Michel Dänzer <michel at daenzer.net> writes:
>>> On Die, 2013-06-04 at 10:47 +0100, Richard Sandiford wrote:
>>>> (2) it uses PIPE_FORMAT_INT_* names with the lsb first rather than the
>>>>     mesa-like ones with msb first.  (I'm happy to change the names to
>>>>     something else though.)
>>>> The patch isn't in a submittable state yet.  I just thought it was worth
>>>> posting because the lsb-first names do make the change look a bit more
>>>> obvious/less scary :-)
>>> I can see the appeal of that, but I also see some danger in that naming
>>> scheme: It'll be easy to miss the difference between the two kinds of
>>> formats, e.g. when grepping for B8G8R8A8. That's why I'd prefer making
>>> the difference more explicit in the naming scheme. Sticking to LSB
>>> first, BGRA8888 might already look a little less scary? :)
>> I realise this was probably more a question for Jose, but FWIW:
>> I liked the names you originally suggested for their consistency with
>> mesa and natural number ordering (as you said).  The PIPE_FORMAT_INT_*
> I don't like that _INT_, it could be confused with the SINT/UINT
> component type postfix, and it's redundant. The distinction provided by
> R8G8B8A8 vs RGBA8888 is already sufficient. Neither do I like REV, I
> always have to check what order that actually implies (but then I hardly
> ever deal with mesa format names).
> Why not just defined it as RxGyBzAw meaning "left to right = lowest
> address to highest address" and RGBAxyzw meaning "left to right =
> least/most (so that it matches the non-REV variant) to most/least
> significant bit-tuple in a word ? And you can do RG16[_]BG16 if you have
> 2 words, or R32_G32_B32_A32 for 4 words, but this ugly speciment is
> equivalent to R32G32B32A32 so it won't ever appear to hurt your eyes.

I think you're saying we should do what Michel suggested in the quote
above, is that right?  I.e. PIPE_FORMAT_BGRA8888_UNORM == blue in lsb,
alpha in msb.  (As opposed to the mesa equivalent MESA_FORMAT_ARGB8888.)

I can certainly do that if that's what you'd prefer.  As I say,
I was just worried that using the opposite order would cause confusion.
E.g. the MT_32BIT_????8888 defines in the gallium i915 driver seem to
follow the mesa msb-first ordering.  OpenVG does too from what I can tell.
The wayland ????8888 formats also seem to follow mesa ordering, as does
the GBM stuff.  If we want lsb->msb ordering than I thought a more
obviously-distinct convention might help.  I can see that INT_*
might not have been the best choice in that regard though :-)


More information about the mesa-dev mailing list