[Mesa-dev] pb: add void for flush ctx for mapping functions

José Fonseca jfonseca at vmware.com
Mon Aug 30 04:08:05 PDT 2010

On Sat, 2010-08-28 at 02:12 -0700, Dave Airlie wrote:
> Mostly we need this to remove a possible race on r300g, but I think
> it'll make implementing buffers on r600g easier as well.
> More explains in the patch.
> Dave.

Yes, an outcome of making transfers in-order context operations is that
the contexts need to flush themselves between overlapping transfers.

The pipebuffer library is currently ill-equipped to help the driver on
that task. svga pipe driver gets it easy because the transfers are
serialized into the command buffer, but for typical drivers DMAs happen

Your patch provides a callback mechanism for the contexts to flush. I'm
not actively developing pipebuffer ATM so I have no objection.  

Callbacks can be prone to infinite recursion however, as drivers
sometimes need to maintain and update internal buffers. Another way of
doing this would be to provide an "is_buffer_referred" query mechanism
that takes a (buffer, context's validation list) pair, so that the
context could flush itself even before attempting to map.

But regardless, my main worry looking forward is how to handle
sub-allocation efficiently: what's gets referred in a context command
buffer is the base buffer and not the sub-allocations, which means that
contexts will flush even when different sub-allocations are being

Thomas looked at the pipebuffer library once and he suggested using two
validation lists. I didn't fully understood the need at the time, but
thinking back this may be the reason.


PS: pipebuffer should be renamed -- it is meant to be used as a
winsys'buffer rather than a pipe buffer 

More information about the mesa-dev mailing list