<table><tr><td style="">davidedmundson added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D29131">View Revision</a></tr></table><br /><div><div>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>Would it be possible to set up a unit test for subsurfaces?</p></blockquote>

<p>After implementing a similar autotest for shadow quads, I would rather prefer not do so because the integration test will become extremely difficult to work with and ugly. I think it's better for now to use test clients to verify that generated window quads are okay. However, it would be nice to have a test or two that verify rendered frames. Are there any projects or compositors that check pixel data in their test suites? I would really love to see how those projects organize their tests and how overall this approach looks in code.</p></blockquote>

<p>The simple approach is we have a test and simply confirm we don't crash without actually verifying anything.<br />
Or we can read the pixmap tree and check that has the right layout of nodes with the right sizes.</p>

<p>We don't necessarily need to check the final visuals in order to do something useful.</p>

<p>For high level tests openQA is pretty amazing and an area that can be explored, even if it means things are done at a distro level.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D29131#inline-167135">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scene_opengl.cpp:1343</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">        <span class="n">OpenGLWindowPixmap</span> <span style="color: #aa2211">*</span><span class="n">previous</span> <span style="color: #aa2211">=</span> <span class="n">previousWindowPixmap</span><span style="color: #aa2211"><</span><span class="n">OpenGLWindowPixmap</span><span style="color: #aa2211">></span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright"></span><span class="n"><span class="bright">nodes</span></span><span class="bright"></span><span class="p"><span class="bright">[</span></span><span class="bright"></span><span class="n"><span class="bright">PreviousContentLeaf</span></span><span class="bright"></span><span class="p"><span class="bright">].</span></span><span class="bright"></span><span class="n"><span class="bright">texture</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n">previous<span class="bright"></span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">?</span></span><span class="bright"> </span><span class="n"><span class="bright">previous</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">texture</span></span><span class="bright"></span><span class="p"><span class="bright">()</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">:</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">nullptr</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright"></span><span class="n"><span class="bright">nodes</span></span><span class="bright"></span><span class="p"><span class="bright">[</span></span><span class="bright"></span><span class="n"><span class="bright">P</span>revious<span class="bright">C</span>ontent<span class="bright">Leaf</span></span><span class="bright"></span><span class="p"><span class="bright">].</span></span><span class="bright"></span><span class="n"><span class="bright">hasAlpha</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">!</span></span><span class="bright"></span><span class="n"><span class="bright">isOpaque</span></span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="n">previous<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span><span class="bright"> </span><span style="color: #74777d"><span class="bright">// TODO(vlad): Should cross-fading be disabled on Wayland?</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright">    </span><span style="color: #aa4000"><span class="bright">const</span></span><span class="bright"> </span><span class="n"><span class="bright">QRect</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"></span><span class="n"><span class="bright">oldGeometry</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n"><span class="bright">p</span>revious<span class="bright"></span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">c</span>ontent<span class="bright">sRect</span></span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">IMHO no, i'tll be fine for the majority cases.</p>

<p style="padding: 0; margin: 8px;">Whilst we're doing the opacity blend we do have another option here.</p>

<p style="padding: 0; margin: 8px;">Instead of one tree with an old and new pixmap in each node we can reference an old and new tree where each node has one pixmap. <br />
Means some slight changes, but it seems relatively doable.</p>

<p style="padding: 0; margin: 8px;">In any case, that's a task for another day.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D29131#inline-167136">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scene.cpp:1180</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">                <span style="color: #aa4000">continue</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">            <span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">            <span style="color: #aa4000">auto</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="n">std</span><span style="color: #aa2211">::</span><span class="n">find_if</span><span class="p">(</span><span class="n">oldTree</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">oldTree</span><span class="p">.</span><span class="n">end</span><span class="p">(),</span> <span class="p">[</span><span class="n">subSurface</span><span class="p">]</span> <span class="p">(</span><span class="n">WindowPixmap</span> <span style="color: #aa2211">*</span><span class="n">p</span><span class="p">)</span> <span class="p">{</span> <span style="color: #aa4000">return</span> <span class="n">p</span><span style="color: #aa2211">-></span><span class="n">m_subSurface</span> <span style="color: #aa2211">==</span> <span class="n">subSurface</span><span class="p">;</span> <span class="p">});</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I know it's existing code, but we should be checking for a buffer here</p>

<p style="padding: 0; margin: 8px;">the docs say "A sub-surface is hidden if the parent becomes hidden, "</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D29131#inline-166468">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scene.cpp:411</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright">   </span> <span class="n">window<span class="bright">GeometryShapeChanged</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">c</span></span><span class="bright"></span><span class="p"><span class="bright">);</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span style="color: #74777d"><span class="bright">// TODO(vlad): Is there a more efficient way to manage</span> window<span class="bright"> pixmap trees?</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">connect</span><span class="p">(</span><span class="n">monitor</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">SubSurfaceMonitor</span><span style="color: #aa2211">::</span><span class="n">subSurfaceAdded</span><span class="p">,</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="n">discardPixmap</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">connect</span><span class="p">(</span><span class="n">monitor</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">SubSurfaceMonitor</span><span style="color: #aa2211">::</span><span class="n">subSurfaceRemoved</span><span class="p">,</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="n">discardPixmap</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I feel like the monitor should be responsible for abstracting added/removed/mapped/unmapped into just 2 signals when we gain a valid subsurface and when a subsurface loses validity (either from being removed or unmapped)</p>

<p style="padding: 0; margin: 8px;">If the subsurface changes and it has no buffer then we don't need to do anything at a tree level.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D29131#inline-167137">View Inline</a><span style="color: #4b4d51; font-weight: bold;">subsurfacemonitor.cpp:65</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">               <span style="color: #aa4000">this</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">SubSurfaceMonitor</span><span style="color: #aa2211">::</span><span class="n">subSurfaceResized</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #304a96">#if 0</span><span style="color: #74777d"> // TODO(vlad): Add SurfaceInterface::mapped()</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d">    disconnect(surface, &SurfaceInterface::mapped,</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I don't understand the problem here.</p>

<p style="padding: 0; margin: 8px;">We added the other signals in kwayland for this patch, we're clearly doing some buffer logic as we have an unmapped signal.</p>

<p style="padding: 0; margin: 8px;">Why can't we add this mapped signal in kwayland?</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29131">https://phabricator.kde.org/D29131</a></div></div><br /><div><strong>To: </strong>zzag, KWin<br /><strong>Cc: </strong>davidedmundson, meven, apol, ngraham, kwin, Orage, cacarry, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, ahiemstra, mart<br /></div>