<html>
    <head>
      <base href="https://bugzilla.gnome.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - memory leak"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=761312#c30">Comment # 30</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - memory leak"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=761312">bug 761312</a>
              from <span class="vcard"><a href="page.cgi?id=describeuser.html&login=rstrode%40redhat.com" title="Ray Strode [halfline] <rstrode@redhat.com>"> <span class="fn">Ray Strode [halfline]</span></a>
</span></b>
        <pre><span class="quote">> But won't there be scenarios where we make a almost-full frame memcopy here
> every frame even though the buffer already contained the correct pixels? If
> we ensure we have a fully drawn buffer when creating the staging buffer
> on-demand (possibly in begin_frame), we'd never need to complement after
> painting.</span >
So my initial patch from <a href="show_bug.cgi?id=761312#c8">comment 8</a> did the copy up front, but because of
<a href="show_bug.cgi?id=761312#c9">comment 9</a> and discussion on IRC I changed it to do the copy afterward.

I don't quite follow what you're saying, though.  I think maybe when you say
"every frame" above you mean "every paint operation in a frame".  It's true we
do a read back at the end of each paint, when instead, we should only do it
once.

<span class="quote">> My point being, the regular case for shm buffers is (assuming the compositor
> copies the shm buffer to the gpu and releases it immediately):

> 1. draw
> 2. commit
> 3. release
> 4. frame
> 5. goto 1

> If this happens, we should never need to read back at all. If we make the
> default case handle this, and create the staging buffer on demand and doing
> a full read back when doing so, we would avoid most read backs except in
> rare cases.</span >
Right, but we could optimize the more rare case, too, which is the whole point
of doing a partial read back instead of the upfront copy I did in the first
patch. I guess, though, actually the partial read back shouldn't happen until
right before we commit the buffer, then the read back will only happen, at
most, once per frame.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>