Mir

Merge lp:~vanvugt/mir/fix-1686620 into lp:mir

Proposed by Daniel van Vugt on 2017-04-28
Status: Merged
Approved by: Alberto Aguirre on 2017-04-29
Approved revision: 4162
Merged at revision: 4158
Proposed branch: lp:~vanvugt/mir/fix-1686620
Merge into: lp:mir
Diff against target: 29 lines (+19/-0)
1 file modified
examples/eglapp.c (+19/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1686620
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) 2017-04-28 Approve on 2017-04-29
Mir CI Bot continuous-integration Approve on 2017-04-28
Review via email: mp+323378@code.launchpad.net

Commit message

Ensure fullscreen eglapps that request initial state 'fullscreen'
know their actual buffer dimensions in time to set up glViewport
and render their first frame (LP: #1686620)

Since r4134 they were getting 0x0 from mir_eglapp_init and using
that to set a 0x0 viewport. So the window would remain black until
resized.

Description of the change

Providing resize events asynchronously is fine, but apps also need to know a sane size before that first resize callback, when they're already rendering their first frame.

Sadly that first resize callback is not guaranteed to occur before mir_create_window_sync returns. Even if you move the location of the call introduced in r4150 then it's still racy because we don't have the nice ordering of real wait handles any more. The initial resize event can _still_ occur in a background thread after mir_create_window_sync has returned and the app is setting up its first frame.

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4162
https://mir-jenkins.ubuntu.com/job/mir-ci/3382/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4577
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4704
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4693
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4693
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4609
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4609/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4609
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4609/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4609
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4609/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4609
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4609/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4609
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4609/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3382/rebuild

review: Approve (continuous-integration)
Alberto Aguirre (albaguirre) wrote :

OK.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/eglapp.c'
2--- examples/eglapp.c 2017-04-05 03:11:28 +0000
3+++ examples/eglapp.c 2017-04-28 09:57:23 +0000
4@@ -512,6 +512,25 @@
5 ok = eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglctx);
6 CHECK(ok, "Can't eglMakeCurrent");
7
8+ EGLint buf_width, buf_height;
9+ if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &buf_width) &&
10+ eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &buf_height))
11+ {
12+ /*
13+ * Mir reserves the right to ignore our initial window dimensions and
14+ * resize to whatever it likes. Usually that resize callback has
15+ * occurred by now (see r4150), but libmirclient does not provide a
16+ * solid guarantee of it. Luckily, we don't care... by querying EGL
17+ * buffer dimensions we can get the correct answer without being
18+ * victim to the callback race that's going on in the background...
19+ * If the server has given us dimensions other than what we requested
20+ * then EGL will already know about it, possibly before the initial
21+ * resize event (!).
22+ */
23+ *width = buf_width;
24+ *height = buf_height;
25+ }
26+
27 signal(SIGINT, shutdown);
28 signal(SIGTERM, shutdown);
29 signal(SIGHUP, shutdown);

Subscribers

People subscribed via source and target branches