[Mesa-dev] 7 questions and proposals about changes in the Gallium interface

Marek Olšák maraeo at gmail.com
Tue Mar 8 14:22:28 PST 2011


On Tue, Mar 8, 2011 at 10:17 PM, Thomas Hellstrom <thellstrom at vmware.com>wrote:

> On 03/08/2011 05:11 PM, José Fonseca wrote:
>
>> On Mon, 2011-03-07 at 02:38 -0800, Keith Whitwell wrote:
>>
>>
>>> On Sun, 2011-03-06 at 18:42 +0100, Marek Olšák wrote:
>>>
>>>
>>>> 2) is_resource_referenced
>>>>
>>>> Now that the transfer functions are in pipe_context, is this hook
>>>> really
>>>> necessary?
>>>>
>>>>
>>> Good question.  I'd like to see those functions go away as they are
>>> round-trips baked into the interface which is a pain if you try and
>>> remote this stuff.
>>>
>>> I guess you'd still need to catch the write-after-read case within a
>>> single context and turn that into a flush.
>>>
>>> I think others (Jose in particular) should comment, but I suspect that
>>> individual drivers could now do this internally&  not need to expose the
>>> interface in gallium.
>>>
>>>
>> That's correct. State trackers no longer need this. This interface can
>> be removed, and drivers that need it internally should be updated to use
>> internal private interfaces.
>>
>>
>
> One should remember, though, that with the state tracker construct
>
> if (is_resource_referenced())
>  flush();
>
> this must not be replaced with an unconditional flush, since that may be
> very wasteful on some hardware. This means that drivers need to be converted
> to do the necessary flushing themselves if this interface is removed.
> Otherwise they will misrender.
>

Please note that, as mentioned before, st/mesa doesn't use
is_resource_referenced anymore and it doesn't call flush either most of the
time (or put better, it shouldn't at all). If there was any misrendering,
people would notice. So the drivers are most probably already converted to
cope with that. As for PIPE_FLUSH_RENDER_CACHE, the functions
set_framebuffer_state, resource_copy_region, and get_transfer should flush
the framebuffer cache if needed, thus that flag isn't needed either (and
most drivers don't use it anyway). I have also seen this usage:

{
    if (is_resource_referenced())
        flush();
    get_transfer();
}

This flush can't be more pointless. Note that drivers can internally use the
3D engine to copy the resource to RAM for the mapped memory to be cached. So
it would end up doing this:

{
   if (is_resource_referenced())
      flush();
   resource_copy_to_RAM();
   flush();
}

Yay, double flush.

Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110308/11810dd6/attachment.html>


More information about the mesa-dev mailing list