Mir

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

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alberto Aguirre
Approved revision: no longer in the source branch.
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) Approve
Mir CI Bot continuous-integration Approve
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.
Revision history for this message
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)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

OK.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2017-04-05 03:11:28 +0000
+++ examples/eglapp.c 2017-04-28 09:57:23 +0000
@@ -512,6 +512,25 @@
512 ok = eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglctx);512 ok = eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglctx);
513 CHECK(ok, "Can't eglMakeCurrent");513 CHECK(ok, "Can't eglMakeCurrent");
514514
515 EGLint buf_width, buf_height;
516 if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &buf_width) &&
517 eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &buf_height))
518 {
519 /*
520 * Mir reserves the right to ignore our initial window dimensions and
521 * resize to whatever it likes. Usually that resize callback has
522 * occurred by now (see r4150), but libmirclient does not provide a
523 * solid guarantee of it. Luckily, we don't care... by querying EGL
524 * buffer dimensions we can get the correct answer without being
525 * victim to the callback race that's going on in the background...
526 * If the server has given us dimensions other than what we requested
527 * then EGL will already know about it, possibly before the initial
528 * resize event (!).
529 */
530 *width = buf_width;
531 *height = buf_height;
532 }
533
515 signal(SIGINT, shutdown);534 signal(SIGINT, shutdown);
516 signal(SIGTERM, shutdown);535 signal(SIGTERM, shutdown);
517 signal(SIGHUP, shutdown);536 signal(SIGHUP, shutdown);

Subscribers

People subscribed via source and target branches