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

List:       kwin
Subject:    Re: Review Request: Swap vsync order, trade in 1frame lag, try harder to detect nvidia framerate (re
From:       Thomas_Lübking <thomas.luebking () web ! de>
Date:       2012-03-04 1:01:08
Message-ID: 20120304010108.4978.34728 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

(Updated March 4, 2012, 1:01 a.m.)


Review request for kwin and Martin Gräßlin.


Changes
-------

Update ensures to paint the next frame in fullscreen mode and attempts* to disable \
glXSwapInterval for partial repaints. Performance with glXSwapBuffers is best, not \
using waitSync() causes flicker in the copySubBuffer case. I could not cause visible \
tearing (i fetched a *really* old screen to test this) with glXSwapBuffers but w/o \
waitSync so i'd just skip that here. => In general we should attempt to enter the \
swapbuffer call, eg. when having full repaints or -ideally- by copying the front \
buffer into the backbuffer right after the swap (so the backbuffer is always \
up-to-date and we can just swapBuffers all the time?)

Very interesting thing i could notice here: every now and then glXWaitVideoSync \
blocks for more than one, sometime even more than two frames. This is esp. notable \
when running mplayer, but not so much when running glxgears. I suspect the client \
(mplayer) performs a waitvideosync itself, but running "mplayer -nodouble" causes \
flicker in the video window. It happens regardless of the GPU and the display (tested \
on 60Hz TFT and 85Hz CRT)

*intel/mesa throw an gl error for invalid range for a 0 interval - *shrug*


Description
-------

This performs a paint & glFlush immediately after the buffer swapping and defers the \
next swapping to the next anticipated frame (or idling) The behavior is still not as \
deterministic as we hoped to be since we cannot measure the time for the actual vsync \
:\ I set a fuzzyness of 6ms what leads to a majority of 2-3ms times in waitsync but \
single wait times up to 8 or 9ms occur (what ultimately can be part of the syncing \
itself)

There's some debug code to print lagging.

TODO:
- attempt egl support
- probably lie to the effects about the time


Diffs (updated)
-----

  kwin/CMakeLists.txt 215e69f 
  kwin/composite.cpp 55a7144 
  kwin/libkwineffects/kwinglutils_funcs.h 97a7a6c 
  kwin/libkwineffects/kwinglutils_funcs.cpp 6d79507 
  kwin/options.cpp d496569 
  kwin/scene.h d8bcf48 
  kwin/scene.cpp 0541198 
  kwin/scene_basic.h a087eb5 
  kwin/scene_basic.cpp cc8dbdd 
  kwin/scene_opengl.h 9c0b057 
  kwin/scene_opengl.cpp bd3e79b 
  kwin/scene_opengl_egl.cpp dbda781 
  kwin/scene_opengl_glx.cpp ddebcd0 
  kwin/scene_xrender.h 23ff2ad 
  kwin/scene_xrender.cpp e7dd355 
  kwin/workspace.h d5942dc 
  kwin/workspace.cpp b4fd277 

Diff: http://git.reviewboard.kde.org/r/103058/diff/


Testing
-------

I've used a CRT for testing which can sync every 11ms ie. 85Hz and lowered the maxFPS \
down to 10fps with pretty constant results for the time lost waiting for the sync.


Thanks,

Thomas Lübking


[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/103058/">http://git.reviewboard.kde.org/r/103058/</a>
  </td>
    </tr>
   </table>
   <br />


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

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


<p style="color: grey;"><i>Updated March 4, 2012, 1:01 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Update ensures to paint the next frame in fullscreen mode and attempts* \
to disable glXSwapInterval for partial repaints. Performance with glXSwapBuffers is \
best, not using waitSync() causes flicker in the copySubBuffer case. I could not \
cause visible tearing (i fetched a *really* old screen to test this) with \
glXSwapBuffers but w/o waitSync so i&#39;d just skip that here. =&gt; In general we \
should attempt to enter the swapbuffer call, eg. when having full repaints or \
-ideally- by copying the front buffer into the backbuffer right after the swap (so \
the backbuffer is always up-to-date and we can just swapBuffers all the time?)

Very interesting thing i could notice here: every now and then glXWaitVideoSync \
blocks for more than one, sometime even more than two frames. This is esp. notable \
when running mplayer, but not so much when running glxgears. I suspect the client \
(mplayer) performs a waitvideosync itself, but running &quot;mplayer -nodouble&quot; \
causes flicker in the video window. It happens regardless of the GPU and the display \
(tested on 60Hz TFT and 85Hz CRT)

*intel/mesa throw an gl error for invalid range for a 0 interval - *shrug*</pre>
  </td>
 </tr>
</table>




<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 performs a paint &amp; glFlush immediately after the buffer \
swapping and defers the next swapping to the next anticipated frame (or idling) The \
behavior is still not as deterministic as we hoped to be since we cannot measure the \
time for the actual vsync :\ I set a fuzzyness of 6ms what leads to a majority of \
2-3ms times in waitsync but single wait times up to 8 or 9ms occur (what ultimately \
can be part of the syncing itself)

There&#39;s some debug code to print lagging.

TODO:
- attempt egl support
- probably lie to the effects about the time</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;">I&#39;ve used a CRT for testing which can sync every 11ms ie. 85Hz and \
lowered the maxFPS down to 10fps with pretty constant results for the time lost \
waiting for the sync.</pre>  </td>
 </tr>
</table>




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

 <li>kwin/CMakeLists.txt <span style="color: grey">(215e69f)</span></li>

 <li>kwin/composite.cpp <span style="color: grey">(55a7144)</span></li>

 <li>kwin/libkwineffects/kwinglutils_funcs.h <span style="color: \
grey">(97a7a6c)</span></li>

 <li>kwin/libkwineffects/kwinglutils_funcs.cpp <span style="color: \
grey">(6d79507)</span></li>

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

 <li>kwin/scene.h <span style="color: grey">(d8bcf48)</span></li>

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

 <li>kwin/scene_basic.h <span style="color: grey">(a087eb5)</span></li>

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

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

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

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

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

 <li>kwin/scene_xrender.h <span style="color: grey">(23ff2ad)</span></li>

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

 <li>kwin/workspace.h <span style="color: grey">(d5942dc)</span></li>

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

</ul>

<p><a href="http://git.reviewboard.kde.org/r/103058/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