<div dir="ltr">The predominant feedback on this adventure has been to make the MESA_FORMATs match the PIPE, or gallium formats but every journey I've made down that path has been fraught with peril. There are some cases where PIPE_FORMATs are even more confusing then MESA_FORMATs*. Either there is something that I am missing, or there are things about the PIPE_FORMATS that people aren't aware of, so let me pull out some specific references.<div>
<br></div><div>The first problem is that in PIPE_FORMATS there is no distinction between array and packed formats, and this has proven to be a big cause for format ambiguity that some are wanting to see addressed. One proposed solution is to represent array formats like (hypothetically): R8G8B8A8; and packed formats as RGBA_8888 (or vice versa) in the MESA_FORMATs and subsequently modifying the PIPE_FORMATs to suit. But that makes RGBA_1010102 kinda messy (though it could be RGBA_aaa2). So then how to handle this:</div>
<div><div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial">So how about a poll! Isn't that the rage these days?</span><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">
Please vote on:</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">1) Should MESA_FORMAT names clearly distinguish between array and packed formats, yes or no?</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">2) What is your preference for array format naming convention:</pre><pre style="margin-top:0px;margin-bottom:0px"> a) RGBA8888_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"> b) R8G8B8A8_UNORM</pre><pre style="margin-top:0px;margin-bottom:0px"> c) RGBA_UNORM8</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">
3) What is your preference for packed format naming convention:</pre><pre style="margin-top:0px;margin-bottom:0px"> a) RGBA5551_UNORM</pre><pre style="margin-top:0px;margin-bottom:0px"> b) R5G5B5A1_UNORM</pre><pre style="margin-top:0px;margin-bottom:0px">
<br></pre><pre style="margin-top:0px;margin-bottom:0px">4) What is your preference for naming packed formats with 10 or more bits:</pre><pre style="margin-top:0px;margin-bottom:0px"> a) RGBA1010102_UNORM</pre><pre style="margin-top:0px;margin-bottom:0px">
b) R10G10B10A2_UNORM</pre><pre style="margin-top:0px;margin-bottom:0px"> c) RGBAaaa2_UNORM</pre><pre style="margin-top:0px;margin-bottom:0px"> d) Croque-monsieur</pre><pre style="margin-top:0px;margin-bottom:0px"><br>
</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Please vote just once!</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">
Thanks,</pre><pre style="margin-top:0px;margin-bottom:0px">Mark</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">* code snip-it from p_format.h</pre><pre style="margin-top:0px;margin-bottom:0px">
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#if</span><span style="color:rgb(192,192,192)"> </span>defined<span style="color:rgb(0,0,0)">(</span>PIPE_ARCH_LITTLE_ENDIAN<span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_RGBA8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_R8G8B8A8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_RGBX8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_R8G8B8X8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_BGRA8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_B8G8R8A8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_BGRX8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_B8G8R8X8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_ARGB8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_A8R8G8B8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_XRGB8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_X8R8G8B8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_ABGR8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_A8B8G8R8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">PIPE_FORMAT_XBGR8888_UNORM</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_X8B8G8R8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#elif</span><span style="color:rgb(192,192,192)"> </span>defined<span style="color:rgb(0,0,0)">(</span>PIPE_ARCH_BIG_ENDIAN<span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_ABGR8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_R8G8B8A8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_XBGR8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_R8G8B8X8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_XRGB8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_B8G8R8X8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_ARGB8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_B8G8R8A8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_XRGB8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_B8G8R8X8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_BGRA8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_A8R8G8B8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_BGRX8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_X8R8G8B8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_RGBA8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_A8B8G8R8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_RGBX8888_UNORM<span style="color:rgb(192,192,192)"> </span>PIPE_FORMAT_X8B8G8R8_UNORM</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#endif</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial">There is more below the surface here too because the above macros aren't employed consistently throughout the gallium drivers as best as I can tell.</span><br>
</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre></pre></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 26, 2013 at 7:48 PM, Mark Mueller <span dir="ltr"><<a href="mailto:markkmueller@gmail.com" target="_blank">markkmueller@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Dec 26, 2013 at 6:57 PM, Michel Dänzer <span dir="ltr"><<a href="mailto:michel@daenzer.net" target="_blank">michel@daenzer.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Mit, 2013-12-25 at 20:35 -0800, Mark Mueller wrote:<br>
<br>
> On Wed, Dec 25, 2013 at 7:25 PM, Michel Dänzer <<a href="mailto:michel@daenzer.net" target="_blank">michel@daenzer.net</a>><br>
> wrote:<br>
> On Mit, 2013-12-25 at 15:19 -0800, Mark Mueller wrote:<br>
> ><br>
> > ---------- Format Base Type P: Packed ----------<br>
> > MESA_FORMAT_[[component list,bit width][storage<br>
> type*][_]][_][storage<br>
> > type**]<br>
> > * when type differs between component<br>
> > ** when type applies to all components<br>
> ><br>
> ><br>
> > examples:<br>
> > MESA_FORMAT_R5G6B5_UNORM /* RRRR RGGG GGGB BBBB<br>
> */<br>
> ><br>
> > MESA_FORMAT_B4G4R4X4_UNORM /* BBBB GGGG RRRR XXXX<br>
> */<br>
><br>
> This is slightly confusing in that the PIPE_FORMATs use this<br>
> convention<br>
> for naming the components of 'array' formats, packed formats<br>
> use<br>
> BGRXnnnn (just like packed MESA_FORMATs do now). Beware that<br>
> not all<br>
> PIPE_FORMATs have been updated yet according to that<br>
> distinction.<br>
><br>
> Is this what you are suggesting then?<br>
><br>
><br>
> ---------- Format Base Type P: Packed ----------<br>
> MESA_FORMAT_[[component list][bit width per component]_[storage<br>
> type*]][_][storage type**]<br>
> * when type differs between component<br>
> ** when type applies to all components<br>
><br>
><br>
> examples:<br>
> MESA_FORMAT_RGB565_UNORM /* RRRR RGGG GGGB BBBB */<br>
> MESA_FORMAT_BGRX4444_UNORM /* BBBB GGGG RRRR XXXX */<br>
> MESA_FORMAT_Z32_FLOAT_SX824_UINT<br>
> MESA_FORMAT_RGBA1010102_UINT<br>
> MESA_FORMAT_RGBE9995_FLOAT<br>
<br>
</div></div>That would be more consistent with the current PIPE_FORMAT naming<br>
convention, but some of the component size sequences look a bit weird,<br>
your original proposal actually makes more sense for those...<br>
<div><br></div></blockquote></div></div><div>Sorry, I'm not sure which original proposal you are referring to, could you be more specific? My concern about this latest iteration is that the delimiter between bit widths per component isn't distinct, though it's generally intuitive, whereas a component followed by a bit width gives a clearer association. </div>
<div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<br>
> I'm afraid there also needs to be a way to encode endianness,<br>
> either<br>
> explicitly or via something like _REV to indicate the inverse<br>
> byte order<br>
> of the host byte order. This would apply to the packed values<br>
> as a whole<br>
> and to any multi-byte components of array formats.<br>
><br>
><br>
> I have seen the gallium discussion on this. Since my current focus is<br>
> i965, I'm safely immune from big endian problems and I'm not aware of<br>
> the details around the issue. Is it not sufficient to maintain a flag<br>
> within the individual texture object or image, or a global flag per<br>
> context to indicate host big endianess?<br>
<br>
</div>Maybe? Hard to be sure without actually trying it and working out all<br>
the issues.<br>
<div><div><br></div></div></blockquote><div> </div></div><div>Since the endianess issue is still in flux, and the format naming work doesn't offer a silver bullet, my recommendation is to solve the two problems independently. Thus I can produce a new set of patches based on the naming spec tomorrow for another round or review.</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Mark</div></font></span><div class="im"><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<br>
--<br>
Earthling Michel Dänzer | <a href="http://www.amd.com" target="_blank">http://www.amd.com</a><br>
Libre software enthusiast | Mesa and X developer<br>
<br>
</div></div></blockquote></div></div><br></div></div>
</blockquote></div><br></div>