<div class="gmail_quote">On Tue, Mar 8, 2011 at 10:17 PM, Thomas Hellstrom <span dir="ltr">&lt;<a href="mailto:thellstrom@vmware.com">thellstrom@vmware.com</a>&gt;</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 class="im">On 03/08/2011 05:11 PM, José Fonseca wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Mon, 2011-03-07 at 02:38 -0800, Keith Whitwell wrote:<br>
   <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Sun, 2011-03-06 at 18:42 +0100, Marek Olšák wrote:<br>
     <br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
2) is_resource_referenced<br>
<br>
Now that the transfer functions are in pipe_context, is this hook<br>
really<br>
necessary?<br>
       <br>
</blockquote>
Good question.  I&#39;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&#39;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&amp;  not need to expose the<br>
interface in gallium.<br>
     <br>
</blockquote>
That&#39;s correct. State trackers no longer need this. This interface can<br>
be removed, and drivers that need it internally should be updated to use<br>
internal private interfaces.<br>
   <br>
</blockquote>
<br></div>
One should remember, though, that with the state tracker construct<br>
<br>
if (is_resource_referenced())<br>
  flush();<br>
<br>
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.<br>

</blockquote></div><br>Please note that, as mentioned before, st/mesa doesn&#39;t use is_resource_referenced anymore and it doesn&#39;t call flush either most of the time (or put better, it shouldn&#39;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&#39;t needed either (and most drivers don&#39;t use it anyway). I have also seen this usage:<br>

<br>{<br>    if (is_resource_referenced())<br>        flush();<br>    get_transfer();<br>}<br><br>This flush can&#39;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:<br>

<br>{<br>
   if (is_resource_referenced())<br>      flush();<br>   resource_copy_to_RAM();<br>   flush();<br>}<br><br>Yay, double flush.<br><br>Marek<br>