[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: Review Request: DamageNotify handling
From: Thomas_Lübking <thomas.luebking () web ! de>
Date: 2011-08-28 12:31:12
Message-ID: 20110828123112.1999.22176 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On Aug. 27, 2011, 4:45 p.m., Philipp Knechtges wrote:
> > kwin/composite.cpp, lines 714-715
> > <http://git.reviewboard.kde.org/r/101861/diff/1/?file=26125#file26125line714>
> >
> > Sry for the late comment, but shouldnt we at least drop the damage events from \
> > the event queue.
>
> Thomas Lübking wrote:
> "Why"? afaik the queue is wiped with the next cycle anyway and testing didn't show \
> any difference in the XPending() count whether i remove the damage events or not \
> (Surprisingly the performance doesn't improve either - at least not significantly)
> Do you spot any leaks or other issues?
>
> Philipp Knechtges wrote:
> My concern was just of theoretical interest. I just wasn't aware that these events \
> are wiped out at the end of the cycle and believed therefore that the damage events \
> would be scheduled as unnecessary repaints in the next frame. But I'm still curious \
> where exactly kwin tells the X Server to clean the event queue because we never \
> call XSync(display(), true) directly?
Nowhere. I frankly thought Q/KApplication would. However *another* test (different \
debug code) simply blocked compositing completely w/o dropping the events, so a) good \
catch - thanks alot b) check \
http://commits.kde.org/kde-workspace/562cabc9e76c8af356a68e91147934e80ae4e78b c) I'm \
gonna inspect the Qt event management to know for sure ;-)
- Thomas
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/101861/#review6068
-----------------------------------------------------------
On July 5, 2011, 10:32 p.m., Thomas Lübking wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/101861/
> -----------------------------------------------------------
>
> (Updated July 5, 2011, 10:32 p.m.)
>
>
> Review request for kwin.
>
>
> Summary
> -------
>
> Client updates are expensiv to the compositor.
> While KWin limits the framerate (vsync or not) the client still can send a \
> bazillion damage notifications between two frames w/o any gain on screen.
> So far the handling is pretty expensive.
> a) KWin would handle the damage notification even though the window is still tagged \
> completely damaged. b) It uses QRegion operations, though we know that the rects in \
> the damage notification won't overlap (and the region is added rectwise, causing \
> more QRegion ops anyway) c) it allows up to 200 rects but doesn't care about the \
> damage ratio before the window is "just completely damaged"
> The patch changes this.
>
> Target are high frequently updating clients, possibly using XShape.
> @Martin: do you recall that Java IDE you confirmed to perform horribly under \
> composition? Can you test it against this patch? Are there still known clients \
> using XShape for text DnD?
> I tried (and actually figured the problem) phoronixing KWin against Mutter (wanted \
> to know about all that FUD) and figured that Mutter did actually "better" until i \
> turned off the resize handle (Bespin, but Oxygen has a comparable thing) which \
> causes glxgears to damage in 12 rects. ("only")
> In consequence of the patch the kwin CPU usage dropped from constant overall 25% to \
> constant 15% (and the 10% being distributed to glxgears and X11) - ie. a 40% \
> improvement (and higher framerates!!)
> Yes, i know that glxgears is special, no i'm not optimizing towards phoronix \
> results, yes Martin, i've read the article - not that it was new to me ;-)
>
> Diffs
> -----
>
> kwin/composite.cpp 8c87984
> kwin/toplevel.h 35f1bb5
>
> Diff: http://git.reviewboard.kde.org/r/101861/diff
>
>
> Testing
> -------
>
> Yes, phoronixing.
>
>
> Thanks,
>
> Thomas
>
>
[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/101861/">http://git.reviewboard.kde.org/r/101861/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On August 27th, 2011, 4:45 p.m., <b>Philipp \
Knechtges</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/101861/diff/1/?file=26125#file26125line714" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/composite.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">Pixmap \
Toplevel::createWindowPixmap()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">712</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">QRegion</span> <span class="n">damage</span><span class="p">(</span><span \
class="n">e</span><span class="o">-></span><span class="n">area</span><span \
class="p">.</span><span class="n">x</span><span class="p">,</span> <span \
class="n">e</span><span class="o">-></span><span class="n">area</span><span \
class="p">.</span><span class="n">y</span><span class="p">,</span> <span \
class="n">e</span><span class="o">-></span><span class="n">area</span><span \
class="p">.</span><span class="n">width</span><span class="p">,</span> <span \
class="n">e</span><span class="o">-></span><span class="n">area</span><span \
class="p">.</span><span class="n">height</span><span class="p">);</span></pre></td> \
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">714</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="n">damageRatio</span> <span \
class="o">==</span> <span class="mf">1.0</span><span class="p">)</span> <span \
class="c1">// we know that we're completely damaged, no need to tell us \
again</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">715</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">return</span><span class="p">;</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Sry for the late \
comment, but shouldnt we at least drop the damage events from the event queue.</pre> \
</blockquote>
<p>On August 27th, 2011, 9:34 p.m., <b>Thomas Lübking</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;">"Why"? afaik \
the queue is wiped with the next cycle anyway and testing didn't show any \
difference in the XPending() count whether i remove the damage events or not \
(Surprisingly the performance doesn't improve either - at least not \
significantly)
Do you spot any leaks or other issues?</pre>
</blockquote>
<p>On August 27th, 2011, 11:37 p.m., <b>Philipp Knechtges</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;">My concern was just of \
theoretical interest. I just wasn't aware that these events are wiped out at the \
end of the cycle and believed therefore that the damage events would be scheduled as \
unnecessary repaints in the next frame. But I'm still curious where exactly kwin \
tells the X Server to clean the event queue because we never call XSync(display(), \
true) directly?</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Nowhere. I \
frankly thought Q/KApplication would. However *another* test (different debug code) \
simply blocked compositing completely w/o dropping the events, so a) good catch - \
thanks alot b) check \
http://commits.kde.org/kde-workspace/562cabc9e76c8af356a68e91147934e80ae4e78b c) \
I'm gonna inspect the Qt event management to know for sure ;-)</pre> <br />
<p>- Thomas</p>
<br />
<p>On July 5th, 2011, 10:32 p.m., Thomas Lübking wrote:</p>
<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.</div>
<div>By Thomas Lübking.</div>
<p style="color: grey;"><i>Updated July 5, 2011, 10:32 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;">Client updates are expensiv to the compositor. While KWin limits the \
framerate (vsync or not) the client still can send a bazillion damage notifications \
between two frames w/o any gain on screen.
So far the handling is pretty expensive.
a) KWin would handle the damage notification even though the window is still tagged \
completely damaged. b) It uses QRegion operations, though we know that the rects in \
the damage notification won't overlap (and the region is added rectwise, causing \
more QRegion ops anyway) c) it allows up to 200 rects but doesn't care about the \
damage ratio before the window is "just completely damaged"
The patch changes this.
Target are high frequently updating clients, possibly using XShape.
@Martin: do you recall that Java IDE you confirmed to perform horribly under \
composition? Can you test it against this patch? Are there still known clients using \
XShape for text DnD?
I tried (and actually figured the problem) phoronixing KWin against Mutter (wanted to \
know about all that FUD) and figured that Mutter did actually "better" \
until i turned off the resize handle (Bespin, but Oxygen has a comparable thing) \
which causes glxgears to damage in 12 rects. ("only")
In consequence of the patch the kwin CPU usage dropped from constant overall 25% to \
constant 15% (and the 10% being distributed to glxgears and X11) - ie. a 40% \
improvement (and higher framerates!!)
Yes, i know that glxgears is special, no i'm not optimizing towards phoronix \
results, yes Martin, i've read the article - not that it was new to me ;-)</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;">Yes, phoronixing.</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/composite.cpp <span style="color: grey">(8c87984)</span></li>
<li>kwin/toplevel.h <span style="color: grey">(35f1bb5)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/101861/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