<div dir="ltr"><div><div><div>Some further planning notes (also a repeat of what I chatted about in the us/euro standup about <a href="https://trello.com/c/I8s7W2f9">https://trello.com/c/I8s7W2f9</a>)<br><br>I proposed these 3 branches today:<br><a href="https://code.launchpad.net/~kdub/mir/multimonitor-arbiter/+merge/265301">https://code.launchpad.net/~kdub/mir/multimonitor-arbiter/+merge/265301</a><br><a href="https://code.launchpad.net/~kdub/mir/dropping-schedule/+merge/265303">https://code.launchpad.net/~kdub/mir/dropping-schedule/+merge/265303</a><br><a href="https://code.launchpad.net/~kdub/mir/queueing-schedule/+merge/265304">https://code.launchpad.net/~kdub/mir/queueing-schedule/+merge/265304</a><br><br></div><div>Hopefully its not too much of a stretch to see how these 3 classes can be integrated. The code isn't used yet, apart from the tests. Not all the features in the spreadsheet have been implemented yet; but it seemed better for the purposes of ongoing feedback on the code to keep the reviews small. Once all the serverside and client side features have been covered, then it can be switched to default (which <a href="https://trello.com/c/w8qfQ59p">https://trello.com/c/w8qfQ59p</a> is a placeholder for)<br></div><br></div>Thanks,<br></div>Kevin<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 29, 2015 at 10:34 AM, Kevin DuBois <span dir="ltr"><<a href="mailto:kevin.dubois@canonical.com" target="_blank">kevin.dubois@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>So, as far as planning goes....<br><br>I think that the spreadsheet (with a few nuances, perhaps) plus the BufferQueue.* tests give us a good capture of the requirements. <br><br></div><div>So, seems sensible to link the translation of the BufferQueue tests and the capture of the requirements into the new integration-level test somehow. I'll see if I can track the translations in a spreadsheet somehow, so people can see more easily that the new test suite maps to the old one and the listed requirements.<br><br><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 26, 2015 at 3:22 AM, Daniel van Vugt <span dir="ltr"><<a href="mailto:daniel.van.vugt@canonical.com" target="_blank">daniel.van.vugt@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">TL;DR email is messy<br>
<br>
See this instead: <a href="https://docs.google.com/spreadsheets/d/1qf3IssN_sujygMPK2sTX2AUhGiDUBF3TMYYcSRSaSy0/pubhtml" rel="noreferrer" target="_blank">https://docs.google.com/spreadsheets/d/1qf3IssN_sujygMPK2sTX2AUhGiDUBF3TMYYcSRSaSy0/pubhtml</a><div><div><br>
<br>
<br>
On 26/06/15 12:24, Daniel van Vugt wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That's why it's a hard problem to replace BufferQueue -- you have to<br>
figure out whether 2, 3 or 4 buffers for any given surface is correct at<br>
the time. Never over-allocate and never under-allocate (which causes<br>
freezing/deadlocks).<br>
<br>
What I was suggesting is that a frame callback (for non-idle surfaces<br>
anyway) would allow us to solve most of the hard problems in a<br>
distributed manner between the client and server processes fairly<br>
elegantly. And we don't need heuristics; this is all based on certainty<br>
and logical reasoning.<br>
<br>
<br>
On 26/06/15 12:16, Christopher James Halse Rogers wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Fri, Jun 26, 2015 at 2:04 PM, Daniel van Vugt<br>
<<a href="mailto:daniel.van.vugt@canonical.com" target="_blank">daniel.van.vugt@canonical.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hmm, maybe not. If we assume the server is only communicating with the<br>
client at 60Hz then the client could just do all the dropping itself and<br>
send one frame (the newest completed one) every 16.6ms when the server<br>
asks.<br>
</blockquote>
<br>
I don't think the server is ever going to ask for a frame.<br>
<br>
All the client sees when the server is done with a buffer is that one of<br>
their previously submitted buffers changes state from read-only to<br>
exclusive-write access. It could possibly use a “has my last submitted<br>
buffer become writeable yet” heuristic to guess when the server will<br>
actually use a new buffer, but we don't guarantee that (nor can we, as<br>
you note with bypass).<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 26/06/15 12:01, Daniel van Vugt wrote:<br>
> bypass/overlays: If you look at the current logic you will see that<br>
the<br>
> DisplayBuffer holds the previous bypass/overlay buffer until _after_<br>
the<br>
> client has provided the next one. And it must, to avoid scan-out<br>
> artefacts. So the server holds two of them very briefly. But only<br>
one is<br>
> held most of the time. Without "predictive bypass" as I'm working on<br>
> right now, that buffer is held for almost two frames. With "predictive<br>
> bypass" it's closer to (but greater than still) one frame held. On<br>
> startup, absolutely you're right that only one buffer is required to<br>
get<br>
> bypass/overlays going. So my wording was wrong.<br>
</blockquote>
<br>
Right, but that's fine. If the client has submitted one buffer, and is a<br>
candidate for overlay, then it's clear that the old scanout buffer<br>
*wasn't* from the client. We hold onto the old scanout buffer and start<br>
scanning out of the (single) buffer the client has submitted.<br>
<br>
When the client submits a second buffer, the first isn't released until<br>
we know it's no longer being scanned out of, but we don't need to have<br>
the client's second buffer before scanning out of the first.<br>
<br>
We don't need to have two buffers around all the time for overlay; we<br>
need to have two buffers around to *switch* overlay buffers. But the<br>
fact that we're switching buffers already means that we've got at least<br>
two buffers.<br>
<br>
This is sort of client-visible behaviour because the client can *see*<br>
that the server is holding more than one buffer, but it's the same logic<br>
for the client - “Do I have write ownership of a buffer? Yes: render to<br>
it. No: wait¹ for one of my buffers to become writeable, or allocate a<br>
new one”.<br>
<br>
¹: Potentially “wait” by adding the fence to the GL command stream and<br>
submit rendering commands anyway.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
><br>
> client wake-up: I may have worded that poorly too. The point is in the<br>
> new world (tm) frame dropping mostly happens in the client (as opposed<br>
> to all in the server like it is today). But some of it still needs to<br>
> happen in the server because you don't want a compositor that tries to<br>
> keep up with a 1000 FPS client by scheduling all of those frames on a<br>
> 60Hz display. It has to drop some.<br>
><br>
><br>
> On 26/06/15 11:39, Christopher James Halse Rogers wrote:<br>
>> On Fri, Jun 26, 2015 at 12:39 PM, Daniel van Vugt<br>
>> <<a href="mailto:daniel.van.vugt@canonical.com" target="_blank">daniel.van.vugt@canonical.com</a>> wrote:<br>
>>> I'm curious (but not yet concerned) about how the new plan will deal<br>
>>> with the transitions we have between 2-3-4 buffers which is neatly<br>
>>> self-contained in the single BufferQueue class right now.<br>
Although as<br>
>>> some responsibilities clearly live on one side and not the other,<br>
>>> maybe things could become conceptually simpler if we manage them<br>
>>> carefully:<br>
>>><br>
>>>   framedropping: Always implemented in the client process as a<br>
>>> non-blocking acquire. The server just receives new buffers quicker<br>
>>> than usual and needs the smarts to deal with (skip) a high rate of<br>
>>> incoming buffers [1].<br>
>><br>
>> Clients will need to tell the server at submit_buffer time whether or<br>
>> not this buffer should replace the other buffers in the queue.<br>
Different<br>
>> clients will need different behaviour here - the obvious case being a<br>
>> video player that wants to dump a whole bunch of time-stamped<br>
buffers on<br>
>> the compositor at once and then go to sleep for a while.<br>
>><br>
>> But in general, yes. The client acquires a bunch of buffers and<br>
cycles<br>
>> through them.<br>
>><br>
>>>   bypass/overlays: Always implemented in the server process,<br>
invisible<br>
>>> to the client. The server just can't enable those code paths<br>
until at<br>
>>> least two buffers have been received for a surface.<br>
>><br>
>> I don't think that's the case? Why does the server need two<br>
buffers in<br>
>> order to overlay? Even with a single buffer the server always has a<br>
>> buffer available¹.<br>
>><br>
>> It won't be entirely invisible to the client; we'll probably need<br>
to ask<br>
>> the client to reallocate buffers when overlay state changes, at least<br>
>> sometimes.<br>
>><br>
>>>   client wake-up: Regardless of the model/mode in place the client<br>
>>> would get woken up at the physical display rate by the server if<br>
it's<br>
>>> had a buffer consumed (but not woken otherwise). More frequent<br>
>>> wake-ups for framedropping are the responsibility of libmirclient<br>
>>> itself and need not involve the server to do anything different.<br>
>><br>
>> By and large, clients will be woken up by EGL when the relevant<br>
fence is<br>
>> triggered.<br>
>><br>
>> I don't think libmirclient will have any role in waking the client.<br>
>> Unless maybe we want to mess around with<br>
>><br>
>>> [1] Idea: If the server skipped/dropped _all_ but the newest<br>
buffer it<br>
>>> has for each surface on every composite() then that would eliminate<br>
>>> buffer lag and solve the problem of how to replace dynamic double<br>
>>> buffering. Client processes would still only be woken up at the<br>
>>> display rate so vsync-locked animations would not speed up<br>
>>> unnecessarily. Everyone wins -- minimal lag and maximal smoothness.<br>
>><br>
>> ¹: The assumption here is that a buffer can be simultaneously scanned<br>
>> out from and textured from. I *think* that's a reasonable assumption,<br>
>> and in the cases where I know it doesn't apply having multiple<br>
buffers<br>
>> doesn't help, because it's the buffer *format* that can only be<br>
scanned<br>
>> out from, not textured from.<br>
>><br>
><br>
<br>
--<br>
Mir-devel mailing list<br>
<a href="mailto:Mir-devel@lists.ubuntu.com" target="_blank">Mir-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at:<br>
<a href="https://lists.ubuntu.com/mailman/listinfo/mir-devel" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/mir-devel</a><br>
</blockquote>
<br>
</blockquote></blockquote>
<br>
-- <br>
Mir-devel mailing list<br>
<a href="mailto:Mir-devel@lists.ubuntu.com" target="_blank">Mir-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/mir-devel" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/mir-devel</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>