<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - screen corruption using SNA and TearFree on Intel GeminiLake"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=105720#c34">Comment # 34</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - screen corruption using SNA and TearFree on Intel GeminiLake"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=105720">bug 105720</a>
              from <span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span></b>
        <pre>Created <span class=""><a href="attachment.cgi?id=138556" name="attach_138556" title="Reorder vblank/flip event handler">attachment 138556</a> <a href="attachment.cgi?id=138556&action=edit" title="Reorder vblank/flip event handler">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=105720&attachment=138556'>[review]</a>
Reorder vblank/flip event handler

I do wonder if "sna: Defer submission of the next shadow frame until halfway
through" wasn't that far off the truth. Please try the attached diff (3 patches
rolled into one), surmised by

    sna: Reorder vblank/flip event handling to avoid TearFree recursion

    TearFree wants to grab the most recently used scanout for rendering the
    next frame into. If the flip event was still pending, we would then
    query the drm event buffer for any pending completions, but this would
    proceed to execute all the other events before the flip events as well.
    Since we they were out of sequence, we pushed them into a buffer to
    execute afterwards, however we forgot the side effects of the flip
    handlers, for example see commit af36a4ab78cc ("sna: Defer submission
    of the next shadow frame until halfway through") and that there may have
    been events read from drm into a local buffer inside sna_mode_wakeup()
    that haven't been processed yet.

    Eliminate the need for calling sna_mode_wakeup() by ensuring that all
    flip events have been completed first before handing the vblank
    callbacks and potential drawing, ensuring the correct ordering.

    References: <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - screen corruption using SNA and TearFree on Intel GeminiLake"
   href="show_bug.cgi?id=105720">https://bugs.freedesktop.org/show_bug.cgi?id=105720</a>
    Signed-off-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>