<table><tr><td style="">aacid 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/D8379" rel="noreferrer">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D8379#164630" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">D8379#164630</a>, <a href="https://phabricator.kde.org/p/rkflx/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@rkflx</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D8379#157777" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">D8379#157777</a>, <a href="https://phabricator.kde.org/p/ngraham/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@ngraham</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>Can we add "BUG: 344081" to the Summary?</p></div>
</blockquote>
<p>It's still not showing up for me in the summary on Phab. Note you'll have to use something like <tt style="background: #ebebeb; font-size: 13px;">arc diff --edit --verbatim</tt> if you are not using Phab's web interface (with <tt style="background: #ebebeb; font-size: 13px;">arc amend</tt> being the counterpart for bringing changes from Phab's summary to the local repo). Also, it would be great to mention the "incremental rendering" in the commit message, so we have a chance to git log grep it without knowing <tt style="background: #ebebeb; font-size: 13px;">renderToImage</tt> and its meaning.</p></div>
</blockquote>
<p>It's on my local commit so it should be fine when i push it.</p>
<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 #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D8379#162464" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">D8379#162464</a>, <a href="https://phabricator.kde.org/p/aacid/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@aacid</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ul class="remarkup-list">
<li class="remarkup-list-item">With <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Fit Page</span></span></span>, first the main view renders and after finishing the thumbnail should be the only thing left to render. However, the thumbnail takes a much longer time to show an initial frame with the CPU being busy throughout doing something else (after this, the incremental rendering seems to need about the same time as the main view). It is likely this has been there all the time and the patch just makes this phenomenon more visible, nevertheless may be a candidate for huge CPU time savings in a later patch (freeing resources for subsequent pages).</li>
</ul></blockquote>
<p>That's probably the text page being generated (also takes a long time), don't understand the mention to Fit Page, does it only happen in that case for you?</p></div>
</blockquote>
<p>Are you saying text page generation is fast for the main view and slow for the thumbnail? Does not sound plausible to me. I gave <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Fit Page</span></span></span> as a method to reproduce, because this way both main view and thumbnail view would show the complete page, but it also happens with other zoom levels, e.g. <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">100%</span></span></span>.</p></blockquote>
<p>There's no text generation for main view and one for thumbnail, there is no reason to generate text twice</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>I expect that in both cases incremental rendering kicks in at the same 500ms after Okular starts the respective rendering job (I'm not talking about both jobs starting in parallel…), but currently the thumbnail lags badly. Have a look:</p>
<p><a href="https://phabricator.kde.org/F5477430" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">F5477430: okular-thumbnail-delay.webm</a></p>
<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;"><ul class="remarkup-list">
<li class="remarkup-list-item">When zooming, the initial timeout to start showing the incremental rendering seems much longer than 500ms and also much longer compared to when reloading the document at the same zoom level afterwards. Okular seems busy doing something else. Maybe the rendering of intermediate zoom levels is not cancelled correctly? This is also seen when closing Okular with rendering still in progress, where the shell prompt returns only much later while the window closes immediately.</li>
</ul></blockquote>
<p>Again take into account the text page generation, do you have <a href="https://phabricator.kde.org/D8378" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: line-through;" rel="noreferrer">D8378</a>? Otherwise what you think is "initial timeout" is just the text page being created.</p></blockquote>
<p>I did test with <a href="https://phabricator.kde.org/D8378" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: line-through;" rel="noreferrer">D8378</a>. But as you said, cancelling is not supported currently. Do you prefer a bugzilla issue or a task on Okular's workboard to track this?</p></blockquote>
<p>I don't really mind :)</p>
<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;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ul class="remarkup-list">
<li class="remarkup-list-item">In some situations, incremental rendering happens twice in a row, i.e. the first pass is thrown away when finished and a second pass starts. (Occurs now and then, unfortunately I cannot give you instructions on how to reproduce yet. Try moving around with the scroll wheel when zoomed in.)</li>
</ul></blockquote>
<p>We do not support canceling of rendering once rendering has started, so that is easily reproducible by zooming in/out at the right time if you are already in the tiled mode rendering. There's nothing we can really do about it other than implementing rendering cancellation in the future.</p></blockquote>
<p>Your comment fits more to the previous issue, but not this one? I can now reproduce, no zooming involved:</p>
<p><a href="https://phabricator.kde.org/F5477455" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">F5477455: okular-double-rendering.webm</a></p>
<p>This double rendering (which I see no reason for why this would be useful) could also explain the first issue, although there the second pass (if indeed the same) does not cause a redraw.</p></blockquote>
<p>Right, i can reproduce now, this is an existing problem with the code, since if i add debug to PDFGenerator::image i will get</p>
<p>PDFGenerator::image PixmapRequest(#94085861557552, async, 13307x11330, page 0, prio 1)<br />
PDFGenerator::image PixmapRequest(#94085861557552, async, 13307x11330, page 0, prio 1)<br />
PDFGenerator::image PixmapRequest(#94085860859632, async, 249x212, page 0, prio 2)</p>
<p>So there's an existing problem with the tile manager somewhere that doesn't detect that the thing has already been rendered and asks for it to be rendered again. i will try to have a look at it but since it is an existing bug i'd prefer if we didn't block on this.</p>
<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;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ul class="remarkup-list">
<li class="remarkup-list-item">Extensive flickering of some screen areas (switching between white and content rapidly for several seconds) when redrawing after panning a rotated page in some cases, even a segfault occasionally.</li>
</ul></blockquote>
<p>I've got a crash, will investigate, next time please post the backtraces of those segfaults somewhere. Otherwise i'll never know if what i fix is the same you had or not.</p></blockquote>
<p>In general I try to, but note here "in some cases" in combination with "occasionally" meant "too seldom to reproduce again with gdb" in the time budget I had available for the review. Now I played around some more and the crashing seems to be gone, but this was not crashing very predictably in the first place.</p>
<p>I did notice some cases of bad flickering, though. The flickering is very camera shy, so the recording is not the best. The movement you see is just an initial flick (several ticks) of the scroll wheel:</p>
<p><a href="https://phabricator.kde.org/F5477670" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">F5477670: okular-weird-flickering.webm</a></p>
<p>Note that sometimes the viewport would change to white completely as soon as Okular lost focus.</p></blockquote>
<p>Weird, i can't really reproduce this :/<br />
Maybe it has to do with the previous issue about things being asked to be rendered twice?</p>
<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;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>I tried to get a feeling for the difference between updating immediately (which I presume would be more pleasant) and updating after a delay of much more than the typical 30ms human perception normally does not notice (which you claim to be preferable). However, there are so many timeouts/delays and intermediate images like the scaled up thumbnails happening, that to even compare both approaches a substantial code rework would be needed. Let's just keep it as proposed, then.</p></blockquote>
<p>I don't understand this sentence :(</p></blockquote>
<p>When I set the timeout to 0, (incremental) rendering still would not start immediately. That's probably because Okular first tries to show a scaled version of tiles from the same region if those have been rendered before (e.g. for the thumbnails or for a different zoom level), or there are other (intentional?) delays.</p></blockquote>
<p>Yes, we still favour showing the scaled version if it is there, which i think it makes sense, because even if it's of a bit worse quality it actually represents the full content.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>Nothing for this patch, but it would be worth reworking this (low priority, though) to show as much content as early as possible. Maybe show the scaled version in the background, do the incremental rendering on top of that instead of on top of a white background, and finally fade out the scaled version?</p></blockquote>
<p>That looks hard to do, but sure would be nice to have if possible.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;">
<hr class="remarkup-hr" />
<p>There is another problem I just found: With <tt style="background: #ebebeb; font-size: 13px;">QT_SCALE_FACTOR=1.1</tt>, pressing <kbd style="display: inline-block; min-width: 1em; padding: 4px 5px 5px; font-weight: normal; font-size: 0.8rem; text-align: center; text-decoration: none; line-height: 0.6rem; border-radius: 3px; box-shadow: inset 0 -1px 0 rgba(71, 87, 120, 0.08); user-select: none; background: #f7f7f7; border: 1px solid #C7CCD9;">PgUp</kbd> and <kbd style="display: inline-block; min-width: 1em; padding: 4px 5px 5px; font-weight: normal; font-size: 0.8rem; text-align: center; text-decoration: none; line-height: 0.6rem; border-radius: 3px; box-shadow: inset 0 -1px 0 rgba(71, 87, 120, 0.08); user-select: none; background: #f7f7f7; border: 1px solid #C7CCD9;">PgDn</kbd> repeatedly does not cache the tiles but re-renders them everytime. I believe this regression was introduced in <a href="https://phabricator.kde.org/R223:ecc1141e0293e1a30e0f8787d86dcc6309ffb0c0" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">ecc1141e0293</a>, but without the incremental rendering this only results in wasted CPU time (compared to e.g. 17.08), while with incremental rendering it is practically unusable:</p>
<p><a href="https://phabricator.kde.org/F5477598" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">F5477598: okular-hidpi-cache-fail.webm</a></p></blockquote>
<p>Yes, this is a problem that already exists and not something this patch introduces, again i would prefer if we didn't block on this</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;">
<hr class="remarkup-hr" />
<p>To summarize my behavioural testing, all crashers I found are gone and incremental rendering happens everywhere I expect it to. Thanks for fixing all those problems.</p>
<p>In general the patch is now in a state we could ship it, the only thing I do not feel comfortable about is the HiDPI regression (but this one should be fixed separately anyway). I think the rest concerns mostly minor issues also affecting current master, where the render timing suggests the same is happening and we just don't see that explicitly in the UI.</p>
<p>Trusting Milian the code is fine, I'm accepting the Diff for now and leave it to your judgment whether the HiDPI regression is fixable before Poppler 0.62 actually ships.</p>
<p><a href="https://phabricator.kde.org/p/mlaurent/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@mlaurent</a> As you "requested changes", are those solved now?</p></blockquote>
<p>Unless there's a disagreement i'll commit this later today since the KDE Applications 17.12 dependency freeze is tonight and i'd like to have this in for that release</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8379" rel="noreferrer">https://phabricator.kde.org/D8379</a></div></div><br /><div><strong>To: </strong>aacid, Okular, mlaurent, mwolff, rkflx<br /><strong>Cc: </strong>mwolff, rkflx, ngraham, michaelweghorn, mlaurent, Okular, aacid<br /></div>