<div class="gmail_quote">On Mon, Mar 7, 2011 at 11:38 AM, Keith Whitwell <span dir="ltr"><<a href="mailto:keithw@vmware.com" target="_blank">keithw@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On Sun, 2011-03-06 at 18:42 +0100, Marek Olšák wrote:<br>
><br>
> Hi,<br>
><br>
> I have several questions about Gallium. Some of them are about<br>
> undocumented<br>
> stuff, others are just little things from the top of my head. Please<br>
> consider these as things I may do when time allows.<br>
><br>
><br>
> 1) Flush flags<br>
><br>
> Which PIPE_FLUSH_* flag is used to flush the command stream? There<br>
> doesn't<br>
> seem to be one and we need it for glFlush.<br>
><br>
> What is PIPE_FLUSH_FRAME for? To my knowledge, Gallium doesn't know<br>
> "frames". What a driver should do when it gets that flag? The same for<br>
> PIPE_FLUSH_SWAPBUFFERS.<br>
><br>
> I propose replacing the current flags with:<br>
> - PIPE_FLUSH_COMMANDS // flush the command stream<br>
> - PIPE_FLUSH_FRAMEBUFFER_CACHE // flush the write cache of the<br>
> currently-set<br>
> framebuffer<br>
> - PIPE_FLUSH_TEXTURE_CACHE // invalidate the read cache of the<br>
> currently-set<br>
> textures<br>
<br>
</div>I'm not sure if the flags add any value & have been the source of<br>
bugs/confusion in the past.<br>
<br>
How about just removing the parameter?<br></blockquote><div><br>I was thinking the flush cache flags could be used to implement GL_NV_texture_barrier (or we could add another entrypoint for it). I don't know of any other use, though.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><br>
><br>
> 2) is_resource_referenced<br>
><br>
> Now that the transfer functions are in pipe_context, is this hook<br>
> really<br>
> necessary?<br>
<br>
</div>Good question. I'd like to see those functions go away as they are<br>
round-trips baked into the interface which is a pain if you try and<br>
remote this stuff.<br>
<br>
I guess you'd still need to catch the write-after-read case within a<br>
single context and turn that into a flush.<br>
<br>
I think others (Jose in particular) should comment, but I suspect that<br>
individual drivers could now do this internally & not need to expose the<br>
interface in gallium.<br></blockquote><div><br>Yes, drivers can do it internally very easily (and st/mesa doesn't even use is_resource_referenced now).<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><br>
> 3) fence_signalled and fence_finish<br>
><br>
> Both of these functions take a driver-specific "flags" parameter<br>
> (according<br>
> to p_screen.h) and return an integer (probably driver-specific too),<br>
> where<br>
> zero means success. Could we either:<br>
> - specify a valid set of arguments for "flags" and the return values,<br>
> - or remove the "flags" parameters and change the return types to<br>
> boolean?<br>
<br>
</div>I'd prefer the latter.<br>
<div><br>
><br>
> 4) geom_flags in is_format_supported<br>
><br>
> Not only are these unused by any driver, they also are redundant.<br>
> - PIPE_TEXTURE_GEOM_NON_SQUARE was obsoleted by PIPE_TEXTURE_RECT,<br>
> which can<br>
> be directly passed to is_format_supported.<br>
> - PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO was obsoleted by<br>
> PIPE_CAP_NPOT_TEXTURES.<br>
><br>
> Could the geom flags be removed?<br>
<br>
</div>This is OK with me too.<br>
<div><div></div><div><br>
> 5) Block compression formats naming<br>
><br>
> Would anyone object to cleaning up the names of compression formats?<br>
><br>
> There are (or will be) these formats: DXTn, RGTCn, LATCn, BPTCx. They<br>
> have<br>
> many things in common:<br>
> - All of them have 4x4 pixel blocks.<br>
> - One block is either 64 bits of 128 bits large.<br>
> - RGTC and LATC are equal except for swizzling.<br>
> - RGTC and LATC are based on DXTn encoding.<br>
><br>
> I propose to copy the more consistent D3D11 naming and use the form<br>
> PIPE_FORMAT_encoding_swizzle_type for all of them:<br>
><br>
> PIPE_FORMAT_BC1_RGB_UNORM // DXT1 = BC1<br>
> PIPE_FORMAT_BC1_RGB_SRGB<br>
> PIPE_FORMAT_BC1_RGBA_UNORM<br>
> PIPE_FORMAT_BC1_RGBA_SRGB<br>
> PIPE_FORMAT_BC2_RGBA_UNORM // DXT3 = BC2<br>
> PIPE_FORMAT_BC2_RGBA_SRGB<br>
> PIPE_FORMAT_BC3_RGBA_UNORM // DXT5 = BC3<br>
> PIPE_FORMAT_BC3_RGBA_SRGB<br>
> PIPE_FORMAT_BC4_R_UNORM // RGTC1 = BC4<br>
> PIPE_FORMAT_BC4_R_SNORM<br>
> PIPE_FORMAT_BC4_L_UNORM // LATC1 = BC4<br>
> PIPE_FORMAT_BC4_L_SNORM<br>
> PIPE_FORMAT_BC5_RG_UNORM // RGTC2 = D3D/3DC = BC5<br>
> PIPE_FORMAT_BC5_RG_SNORM<br>
> PIPE_FORMAT_BC5_LA_UNORM // LATC2 = GL/3DC = BC5<br>
> PIPE_FORMAT_BC5_LA_SNORM<br>
> PIPE_FORMAT_BC6_RGB_FLOAT // BPTC (BC6H)<br>
> PIPE_FORMAT_BC6_RGB_UFLOAT<br>
> PIPE_FORMAT_BC7_RGBA_UNORM // BPTC<br>
> PIPE_FORMAT_BC7_RGBA_SRGB<br>
><br>
> The layout for all of them would be UTIL_FORMAT_LAYOUT_BC.<br>
><br>
> UFLOAT is a float without the sign bit. I guess UFLOAT should be used<br>
> for<br>
> R11G11B10_FLOAT and R9G9B9E5_FLOAT too.<br>
<br>
</div></div>Sounds good again, though this is more Jose's domain than mine.<br>
<div><br>
> 6) Pixel buffer objects<br>
><br>
> It woud be nice to have hardware-accelerated PBO copy in Gallium.<br>
> Would<br>
> resource_copy_region be a good candidate for this, where one of the<br>
> arguments would be PIPE_BUFFER and the other one would be<br>
> PIPE_TEXTURE_*, or<br>
> am I missing something?<br>
<br>
</div>Do you have a more concrete proposal?<br>
<br>
For me, it's always been a bit difficult to pin down what a PBO really<br>
should map to either in hardware or gallium's abstraction of hardware.<br>
Sometimes it's a long lived entity (eg. pipe_buffer), other times it's<br>
just a transient object used for uploads - dma memory from a pool or a<br>
pipe_transfer in gallium.<br>
<br>
But if there's a sensible addition to gallium that improves the<br>
situation, I'm all for it.<br></blockquote><div><br>A PBO to me is just a way to copy data between a buffer and a texture. Two cases may arise:<br>- The copy can be implemented using util_copy_rect (basically it's a memcpy with strides), in this case, resource_copy_region could be used to let drivers do the copy in hardware.<br>
- The copy cannot be implemented using util_copy_rect, in this case, the state tracker would use the current software implementation of PBOs.<br><br>Again, another two cases may arise inside resource_copy_region:<br>- If the strides are well aligned, the copy can done in hardware. (what is "well aligned" is hardware-specific)<br>
- If they are not, a util function similar to util_resource_copy_region could be used as a fallback.<br><br>But then resource_copy_region needs to know the stride for the buffer being copied. New entrypoint maybe?<br></div>
</div><br>Marek<br>