[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Review Request 109452: Fix v-sync in EGL backend
From:       "Ralf Jung" <post+kde () ralfj ! de>
Date:       2013-03-26 20:20:45
Message-ID: 20130326202045.10391.777 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On March 26, 2013, 8:15 a.m., Martin Gräßlin wrote:
> > Looking forward to try that change on the pandaboard as that hardware doesn't \
> > support buffer preservation. So if it neither does buffer preservation nor \
> > eglPostSubBufferNV (haven't checked that one yet, didn't get that far with \
> > testing), it'll be interesting ;-)

Indeed, an interesting testcase. Note that there is no regression here, the previous \
code couldn't work at all without buffer preservation, even if eglPostSubBufferNV was \
present. The only possible solution for such systems is to always re-draw the entire \
frame ('c' or 'p' swap strategy).


- Ralf


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109452/#review29894
-----------------------------------------------------------


On March 26, 2013, 9:20 p.m., Ralf Jung wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/109452/
> -----------------------------------------------------------
> 
> (Updated March 26, 2013, 9:20 p.m.)
> 
> 
> Review request for kwin, Martin Gräßlin and Thomas Lübking.
> 
> 
> Description
> -------
> 
> This fixes v-sync in the EGL backend. The backend used to always enable \
> EGL_BUFFER_PRESERVED, which means that eglSwapBuffer() will do a copy instead of a \
> page flip - not only is this unnecessarily expensive, it also breaks v-sync. \
> Instead, defer the decision whether to enable EGL_BUFFER_PRESERVED till we know \
> which EGL extensions are available, and enable it only if we do not have \
> eglPostSubBufferNV - that function is needed to do a partial screen update, since \
> the glCopyPixels path we use in the GLX backend does not work. 
> I also refactored the copy pixels code into its own function since I planned for \
> the EGL backend to use it - and even though that's not possible, it still avoids \
> code duplication between SceneOpenGL and the GLX backend. 
> I added eglWaitNative in prepareRenderingFrame mostly because the GLX backend does \
> that, too, and it is better tested. Is any of these sync functions (eglWaitGL, \
> eglWaitNative, XFlush) really needed? 
> 
> Diffs
> -----
> 
> kwin/eglonxbackend.cpp a0cba91 
> kwin/glxbackend.cpp 407c014 
> kwin/scene_opengl.h 44e8d15 
> kwin/scene_opengl.cpp 43b326c 
> 
> Diff: http://git.reviewboard.kde.org/r/109452/diff/
> 
> 
> Testing
> -------
> 
> Tested a few settings for glPreferBuffer Swap (e, p, c), they all seem to behave as \
> expected: No tearing at all for p and c, tearing only for small updates when using \
> e. 
> 
> Thanks,
> 
> Ralf Jung
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/109452/">http://git.reviewboard.kde.org/r/109452/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On March 26th, 2013, 8:15 a.m. CET, <b>Martin \
Gräßlin</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Looking forward to try that change on the pandaboard as that hardware \
doesn&#39;t support buffer preservation. So if it neither does buffer preservation \
nor eglPostSubBufferNV (haven&#39;t checked that one yet, didn&#39;t get that far \
with testing), it&#39;ll be interesting ;-)</pre>  </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Indeed, an interesting \
testcase. Note that there is no regression here, the previous code couldn&#39;t work \
at all without buffer preservation, even if eglPostSubBufferNV was present. The only \
possible solution for such systems is to always re-draw the entire frame (&#39;c&#39; \
or &#39;p&#39; swap strategy).</pre> <br />










<p>- Ralf</p>


<br />
<p>On March 26th, 2013, 9:20 p.m. CET, Ralf Jung wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kwin, Martin Gräßlin and Thomas Lübking.</div>
<div>By Ralf Jung.</div>


<p style="color: grey;"><i>Updated March 26, 2013, 9:20 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">This fixes v-sync in the EGL backend. The backend used to always enable \
EGL_BUFFER_PRESERVED, which means that eglSwapBuffer() will do a copy instead of a \
page flip - not only is this unnecessarily expensive, it also breaks v-sync. Instead, \
defer the decision whether to enable EGL_BUFFER_PRESERVED till we know which EGL \
extensions are available, and enable it only if we do not have eglPostSubBufferNV - \
that function is needed to do a partial screen update, since the glCopyPixels path we \
use in the GLX backend does not work.

I also refactored the copy pixels code into its own function since I planned for the \
EGL backend to use it - and even though that&#39;s not possible, it still avoids code \
duplication between SceneOpenGL and the GLX backend.

I added eglWaitNative in prepareRenderingFrame mostly because the GLX backend does \
that, too, and it is better tested. Is any of these sync functions (eglWaitGL, \
eglWaitNative, XFlush) really needed?</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Tested a few settings for glPreferBuffer Swap (e, p, c), they all seem \
to behave as expected: No tearing at all for p and c, tearing only for small updates \
when using e.</pre>  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/eglonxbackend.cpp <span style="color: grey">(a0cba91)</span></li>

 <li>kwin/glxbackend.cpp <span style="color: grey">(407c014)</span></li>

 <li>kwin/scene_opengl.h <span style="color: grey">(44e8d15)</span></li>

 <li>kwin/scene_opengl.cpp <span style="color: grey">(43b326c)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/109452/diff/" style="margin-left: \
3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic