Mir

Merge lp:~kdub/mir/refix-1517205 into lp:mir

Proposed by Kevin DuBois
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3297
Proposed branch: lp:~kdub/mir/refix-1517205
Merge into: lp:mir
Diff against target: 2060 lines (+730/-149)
71 files modified
include/renderers/gl/mir/renderer/gl/texture_source.h (+10/-0)
src/gl/recently_used_cache.cpp (+8/-7)
src/include/platform/mir/graphics/egl_extensions.h (+0/-8)
src/platform/graphics/CMakeLists.txt (+0/-1)
src/platform/graphics/egl_extensions.cpp (+0/-12)
src/platforms/android/client/CMakeLists.txt (+1/-0)
src/platforms/android/client/gralloc_registrar.cpp (+4/-2)
src/platforms/android/common/CMakeLists.txt (+2/-0)
src/platforms/android/common/android_native_buffer.cpp (+18/-4)
src/platforms/android/common/egl_sync_extensions.cpp (+35/-0)
src/platforms/android/common/egl_sync_fence.cpp (+1/-1)
src/platforms/android/include/android/native_window.h (+21/-0)
src/platforms/android/include/android_native_buffer.h (+6/-0)
src/platforms/android/include/command_stream_sync.h (+51/-0)
src/platforms/android/include/egl_sync_extensions.h (+48/-0)
src/platforms/android/include/egl_sync_fence.h (+2/-21)
src/platforms/android/include/native_buffer.h (+3/-0)
src/platforms/android/server/CMakeLists.txt (+1/-0)
src/platforms/android/server/android_alloc_adaptor.cpp (+12/-5)
src/platforms/android/server/android_alloc_adaptor.h (+6/-2)
src/platforms/android/server/android_buffer_allocator.cpp (+10/-4)
src/platforms/android/server/android_graphic_buffer_allocator.h (+5/-1)
src/platforms/android/server/buffer.cpp (+23/-4)
src/platforms/android/server/buffer.h (+6/-0)
src/platforms/android/server/cmdstream_sync_factory.h (+48/-0)
src/platforms/android/server/device_quirks.cpp (+6/-0)
src/platforms/android/server/device_quirks.h (+1/-0)
src/platforms/android/server/display_buffer.cpp (+3/-0)
src/platforms/android/server/display_component_factory.h (+2/-0)
src/platforms/android/server/display_device.h (+2/-0)
src/platforms/android/server/egl_sync_factory.cpp (+35/-0)
src/platforms/android/server/fb_device.cpp (+5/-2)
src/platforms/android/server/fb_device.h (+1/-0)
src/platforms/android/server/hal_component_factory.cpp (+20/-1)
src/platforms/android/server/hal_component_factory.h (+4/-1)
src/platforms/android/server/hwc_device.cpp (+11/-6)
src/platforms/android/server/hwc_device.h (+1/-0)
src/platforms/android/server/hwc_fb_device.cpp (+5/-0)
src/platforms/android/server/hwc_fb_device.h (+1/-0)
src/platforms/android/server/ipc_operations.cpp (+1/-0)
src/platforms/android/server/platform.cpp (+10/-4)
src/platforms/android/server/platform.h (+3/-0)
src/platforms/mesa/server/common/gbm_buffer.cpp (+9/-0)
src/platforms/mesa/server/common/gbm_buffer.h (+2/-0)
src/platforms/mesa/server/common/shm_buffer.cpp (+9/-0)
src/platforms/mesa/server/common/shm_buffer.h (+2/-0)
tests/include/mir/test/doubles/mock_android_native_buffer.h (+2/-0)
tests/include/mir/test/doubles/mock_buffer.h (+1/-0)
tests/include/mir/test/doubles/mock_display_device.h (+3/-0)
tests/include/mir/test/doubles/mock_gl_buffer.h (+2/-0)
tests/include/mir/test/doubles/stub_android_native_buffer.h (+3/-0)
tests/include/mir/test/doubles/stub_cmdstream_sync_factory.h (+41/-0)
tests/include/mir/test/doubles/stub_display_builder.h (+5/-0)
tests/include/mir/test/doubles/stub_gl_buffer.h (+2/-0)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+3/-0)
tests/unit-tests/gl/test_gl_texture_cache.cpp (+3/-1)
tests/unit-tests/gl/test_program_factory.cpp (+1/-1)
tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp (+6/-3)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+6/-2)
tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+13/-1)
tests/unit-tests/graphics/android/test_display_buffer.cpp (+15/-0)
tests/unit-tests/graphics/android/test_display_hotplug.cpp (+5/-0)
tests/unit-tests/graphics/android/test_egl_sync_extensions.cpp (+75/-0)
tests/unit-tests/graphics/android/test_fb_device.cpp (+8/-0)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+9/-8)
tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+6/-0)
tests/unit-tests/graphics/android/test_native_buffer.cpp (+50/-7)
tests/unit-tests/graphics/android/test_platform.cpp (+15/-4)
tests/unit-tests/graphics/test_egl_extensions.cpp (+0/-35)
tests/unit-tests/graphics/test_egl_sync_fence.cpp (+1/-1)
To merge this branch: bzr merge lp:~kdub/mir/refix-1517205
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Mir CI Bot continuous-integration Approve
Alan Griffiths Approve
Review via email: mp+283861@code.launchpad.net

Commit message

repropose already landed branch introducing sync fences
(https://code.launchpad.net/~kdub/mir/egl-sync-fences/+merge/278181)
while avoiding the mx4/powervr regression that caused its reversion.

fixes: LP: #1517205

Description of the change

repropose already landed branch introducing sync fences
(https://code.launchpad.net/~kdub/mir/egl-sync-fences/+merge/278181)
while avoiding the mx4/powervr regression that caused its reversion.

fixes: LP: #1517205

Tested against regression with MX4 with full unity stack.
The fixme in line 532 has a trello card to track: https://trello.com/c/XzFGfwlE

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

FAILED: Continuous integration, rev:3273
https://mir-jenkins.ubuntu.com/job/mir-ci/161/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/160/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3274
https://mir-jenkins.ubuntu.com/job/mir-ci/162/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/162/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3276
https://mir-jenkins.ubuntu.com/job/mir-ci/164/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/164/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3276
http://jenkins.qa.ubuntu.com/job/mir-ci/6133/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5700
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4607
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5656
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/339
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/457
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/457/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/457
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/457/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5653
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5653/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/8085
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27061
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/335
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/335/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/191
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27064

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/6133/rebuild

review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

failure was intermittent, nonrelated lp: #1537798

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3277
https://mir-jenkins.ubuntu.com/job/mir-ci/169/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/169/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

=> class TextureSource

The changes break TextureSource ABI, which is used by QtMir and others. We haven't really thought through all the details about how we handle such a case, but I guess we should at least ensure the ABI numbers of the platforms supporting GL (i.e. everything at the moment) are bumped.

+ mirplatform

mirplatform was used up to now for the server side of Mir. Do we want to use the same library for the client?

Looks discussion/fixing

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3277
http://jenkins.qa.ubuntu.com/job/mir-ci/6142/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5712
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4619
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5668
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/345/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/466
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/466/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/466
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/466/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5665
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5665/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/8095
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27094
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/341
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/341/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/197/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27100

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/6142/rebuild

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> + mirplatform
>
> mirplatform was used up to now for the server side of Mir. Do we want to use
> the same library for the client?
>
> Looks discussion/fixing

IMO "mirplatform" is the wrong place for anything mirclient uses. Maybe the name is misleading, but it was intended to provide the types needed to specify the mirserver requirements on a platform module.

Types needed by both server and client should be in mircommon. (I am aware there are some currently in mirclient - because of some coupling in the implementation that no-one has spent time unpicking.)

[aside] With our thoughts about removing reliance on EGL, perhaps we need a new miregl library that client and server "platform" modules could use?

review: Needs Information
Revision history for this message
Kevin DuBois (kdub) wrote :

I'm wasn't too flummoxed by mirplatform being used by the client, but OTOH, may as well not link to it if we can help it.

I sidestepped the problem by pulling the new code from mirplatform to src/platforms/android/common. (a directory for common-to-client-and-server android code).

I also bumped server ABI for the 0.20 series, as we have indeed broken the server abi (but not api) for those using mg::Buffer's

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3280
https://mir-jenkins.ubuntu.com/job/mir-ci/180/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/180/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3281
https://mir-jenkins.ubuntu.com/job/mir-ci/188/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/189/console

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

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3283
https://mir-jenkins.ubuntu.com/job/mir-ci/210/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/210/console

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

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3283
http://jenkins.qa.ubuntu.com/job/mir-ci/6188/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5777
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4684
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5733
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/371
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/512
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/512/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/512
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/512/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5730
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5730/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/8142
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27255
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/367
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/367/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/223
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27260

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/6188/rebuild

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I'm not sure what's going on with the move of mir::graphics::Foo headers to src/platforms/android/include/

Are these types specific to android platforms? If so, do they belong in namespace mir::graphics?

review: Needs Information
Revision history for this message
Kevin DuBois (kdub) wrote :

They are only used by the android platform at the moment (so that mirplatform remains server-side only), but they are not android-specific, so graphics seems appropriate.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

*Note to reviewers:* the lp diff is wrong (stale?)

Otherwise seems OK

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

We also need to update the ABI of all our platforms (since they support TextureSource).

review: Needs Fixing
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3285
https://mir-jenkins.ubuntu.com/job/mir-ci/251/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build/39
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/45
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/41
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/41
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=amd64,compiler=gcc,platform=mesa,release=xenial/41
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=amd64,compiler=gcc,platform=mesa,release=xenial/41/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/41
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/41/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/41
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/41/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=i386,compiler=gcc,platform=mesa,release=xenial/41
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-advanced/arch=i386,compiler=gcc,platform=mesa,release=xenial/41/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

^failure downloading packages from overlay... retriggering.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> We also need to update the ABI of all our platforms (since they support TextureSource).

Turns out MIR_SERVER_GRAPHICS_PLATFORM_ABI has already been bumped after 0.19, so we should be fine.

I don't think we need to bump libmirplatform ABI.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3285
http://jenkins.qa.ubuntu.com/job/mir-ci/6230/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5830
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4737
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5786
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/403
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/554
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/554/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/554
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/554/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5783
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5783/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/8188
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27393
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/399
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/399/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/253
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27396

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/6230/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm excited to see this bug fixed. Haven't got to reviewing it myself but I'll top approve and see what happens.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/renderers/gl/mir/renderer/gl/texture_source.h'
2--- include/renderers/gl/mir/renderer/gl/texture_source.h 2016-01-29 08:18:22 +0000
3+++ include/renderers/gl/mir/renderer/gl/texture_source.h 2016-02-08 17:34:18 +0000
4@@ -26,12 +26,22 @@
5 namespace gl
6 {
7
8+//FIXME: (kdub) we're not hiding the differences in texture upload approaches between our platforms
9+// very well with this interface.
10 class TextureSource
11 {
12 public:
13 virtual ~TextureSource() = default;
14
15+ // \warning deprecated, provided for convenience and legacy transition.
16+ //will call bind() and then secure_for_render()
17 virtual void gl_bind_to_texture() = 0;
18+ //Uploads texture.
19+ virtual void bind() = 0;
20+ //add synchronization points to the command stream to ensure resources
21+ //are present during the draw. Will not upload texture.
22+ //should be called if an already uploaded texture is reused.
23+ virtual void secure_for_render() = 0;
24
25 protected:
26 TextureSource() = default;
27
28=== modified file 'src/gl/recently_used_cache.cpp'
29--- src/gl/recently_used_cache.cpp 2016-01-29 08:18:22 +0000
30+++ src/gl/recently_used_cache.cpp 2016-02-08 17:34:18 +0000
31@@ -27,6 +27,7 @@
32 namespace mg = mir::graphics;
33 namespace mgl = mir::gl;
34 namespace geom = mir::geometry;
35+namespace mrgl = mir::renderer::gl;
36
37 std::shared_ptr<mgl::Texture> mgl::RecentlyUsedCache::load(mg::Renderable const& renderable)
38 {
39@@ -35,18 +36,18 @@
40 auto& texture = textures[renderable.id()];
41 texture.texture->bind();
42
43+ auto const texture_source = dynamic_cast<mrgl::TextureSource*>(buffer->native_buffer_base());
44+ if (!texture_source)
45+ BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering"));
46+
47 if ((texture.last_bound_buffer != buffer_id) || (!texture.valid_binding))
48 {
49- auto const texture_source =
50- dynamic_cast<mir::renderer::gl::TextureSource*>(
51- buffer->native_buffer_base());
52- if (!texture_source)
53- BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering"));
54-
55- texture_source->gl_bind_to_texture();
56+ texture_source->bind();
57 texture.resource = buffer;
58 texture.last_bound_buffer = buffer_id;
59 }
60+ texture_source->secure_for_render();
61+
62 texture.valid_binding = true;
63 texture.used = true;
64
65
66=== modified file 'src/include/platform/mir/graphics/egl_extensions.h'
67--- src/include/platform/mir/graphics/egl_extensions.h 2016-01-29 08:18:22 +0000
68+++ src/include/platform/mir/graphics/egl_extensions.h 2016-02-08 17:34:18 +0000
69@@ -38,14 +38,6 @@
70 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC const glEGLImageTargetTexture2DOES;
71 };
72
73-struct EGLSyncExtensions
74-{
75- EGLSyncExtensions();
76- PFNEGLCREATESYNCKHRPROC const eglCreateSyncKHR;
77- PFNEGLDESTROYIMAGEKHRPROC const eglDestroySyncKHR;
78- PFNEGLCLIENTWAITSYNCKHRPROC const eglClientWaitSyncKHR;
79-};
80-
81 }
82 }
83
84
85=== modified file 'src/platform/graphics/CMakeLists.txt'
86--- src/platform/graphics/CMakeLists.txt 2016-01-29 08:18:22 +0000
87+++ src/platform/graphics/CMakeLists.txt 2016-02-08 17:34:18 +0000
88@@ -6,7 +6,6 @@
89 egl_extensions.cpp
90 egl_resources.cpp
91 egl_error.cpp
92- egl_sync_fence.cpp
93 display_configuration.cpp
94 buffer_basic.cpp
95 pixel_format_utils.cpp
96
97=== modified file 'src/platform/graphics/egl_extensions.cpp'
98--- src/platform/graphics/egl_extensions.cpp 2016-01-29 08:18:22 +0000
99+++ src/platform/graphics/egl_extensions.cpp 2016-02-08 17:34:18 +0000
100@@ -37,15 +37,3 @@
101 if (!glEGLImageTargetTexture2DOES)
102 BOOST_THROW_EXCEPTION(std::runtime_error("GLES2 implementation doesn't support updating a texture from an EGLImage"));
103 }
104-
105-mg::EGLSyncExtensions::EGLSyncExtensions() :
106- eglCreateSyncKHR{
107- reinterpret_cast<PFNEGLCREATESYNCKHRPROC>(eglGetProcAddress("eglCreateSyncKHR"))},
108- eglDestroySyncKHR{
109- reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroySyncKHR"))},
110- eglClientWaitSyncKHR{
111- reinterpret_cast<PFNEGLCLIENTWAITSYNCKHRPROC>(eglGetProcAddress("eglClientWaitSyncKHR"))}
112-{
113- if (!eglCreateSyncKHR || !eglDestroySyncKHR || !eglClientWaitSyncKHR)
114- BOOST_THROW_EXCEPTION(std::runtime_error("EGL doesn't support the KHR_reusable_sync extension"));
115-}
116
117=== modified file 'src/platforms/android/client/CMakeLists.txt'
118--- src/platforms/android/client/CMakeLists.txt 2016-01-29 08:18:22 +0000
119+++ src/platforms/android/client/CMakeLists.txt 2016-02-08 17:34:18 +0000
120@@ -36,6 +36,7 @@
121 client_platform_common
122 mirsharedandroid-static
123 ${LIBHARDWARE_LIBRARIES}
124+ ${EGL_LDFLAGS} ${EGL_LIBRARIES}
125 )
126
127 install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
128
129=== modified file 'src/platforms/android/client/gralloc_registrar.cpp'
130--- src/platforms/android/client/gralloc_registrar.cpp 2016-01-29 08:18:22 +0000
131+++ src/platforms/android/client/gralloc_registrar.cpp 2016-02-08 17:34:18 +0000
132@@ -13,9 +13,10 @@
133 * You should have received a copy of the GNU Lesser General Public License
134 * along with this program. If not, see <http://www.gnu.org/licenses/>.
135 *
136- * Authored by: Kevin DuBois<kevin.dubois@canonical.com>
137+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
138 */
139
140+#include "egl_sync_fence.h"
141 #include "android_native_buffer.h"
142 #include "sync_fence.h"
143 #include "gralloc_registrar.h"
144@@ -82,7 +83,8 @@
145 anwb->usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;
146 anwb->handle = handle.get();
147
148- return std::make_shared<mga::AndroidNativeBuffer>(anwb, fence, mga::BufferAccess::read);
149+ auto sync = std::make_shared<mg::NullCommandSync>(); //no need for eglsync client side
150+ return std::make_shared<mga::AndroidNativeBuffer>(anwb, sync, fence, mga::BufferAccess::read);
151 }
152 }
153 std::shared_ptr<mg::NativeBuffer> mcla::GrallocRegistrar::register_buffer(
154
155=== modified file 'src/platforms/android/common/CMakeLists.txt'
156--- src/platforms/android/common/CMakeLists.txt 2016-01-29 08:18:22 +0000
157+++ src/platforms/android/common/CMakeLists.txt 2016-02-08 17:34:18 +0000
158@@ -12,4 +12,6 @@
159 refcounted_buffer.cpp
160 android_native_buffer.cpp
161 syncfence.cpp
162+ egl_sync_fence.cpp
163+ egl_sync_extensions.cpp
164 )
165
166=== modified file 'src/platforms/android/common/android_native_buffer.cpp'
167--- src/platforms/android/common/android_native_buffer.cpp 2016-01-29 08:18:22 +0000
168+++ src/platforms/android/common/android_native_buffer.cpp 2016-02-08 17:34:18 +0000
169@@ -16,17 +16,20 @@
170 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
171 */
172
173+#include "command_stream_sync.h"
174 #include "android_native_buffer.h"
175
176 namespace mga=mir::graphics::android;
177
178 mga::AndroidNativeBuffer::AndroidNativeBuffer(
179 std::shared_ptr<ANativeWindowBuffer> const& anwb,
180+ std::shared_ptr<CommandStreamSync> const& cmdstream_sync,
181 std::shared_ptr<Fence> const& fence,
182- BufferAccess access)
183- : fence(fence),
184- access(access),
185- native_window_buffer(anwb)
186+ BufferAccess access) :
187+ cmdstream_sync(cmdstream_sync),
188+ fence(fence),
189+ access(access),
190+ native_window_buffer(anwb)
191 {
192 }
193
194@@ -58,3 +61,14 @@
195 {
196 return fence->copy_native_handle();
197 }
198+
199+void mga::AndroidNativeBuffer::lock_for_gpu()
200+{
201+ cmdstream_sync->raise();
202+}
203+
204+void mga::AndroidNativeBuffer::wait_for_unlock_by_gpu()
205+{
206+ using namespace std::chrono;
207+ cmdstream_sync->wait_for(duration_cast<nanoseconds>(seconds(2)));
208+}
209
210=== added file 'src/platforms/android/common/egl_sync_extensions.cpp'
211--- src/platforms/android/common/egl_sync_extensions.cpp 1970-01-01 00:00:00 +0000
212+++ src/platforms/android/common/egl_sync_extensions.cpp 2016-02-08 17:34:18 +0000
213@@ -0,0 +1,35 @@
214+/*
215+ * Copyright © 2016 Canonical Ltd.
216+ *
217+ * This program is free software: you can redistribute it and/or modify it
218+ * under the terms of the GNU Lesser General Public License version 3,
219+ * as published by the Free Software Foundation.
220+ *
221+ * This program is distributed in the hope that it will be useful,
222+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
223+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
224+ * GNU Lesser General Public License for more details.
225+ *
226+ * You should have received a copy of the GNU Lesser General Public License
227+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
228+ *
229+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
230+ */
231+
232+#include "egl_sync_extensions.h"
233+#include <boost/throw_exception.hpp>
234+#include <stdexcept>
235+
236+namespace mg=mir::graphics;
237+
238+mg::EGLSyncExtensions::EGLSyncExtensions() :
239+ eglCreateSyncKHR{
240+ reinterpret_cast<PFNEGLCREATESYNCKHRPROC>(eglGetProcAddress("eglCreateSyncKHR"))},
241+ eglDestroySyncKHR{
242+ reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroySyncKHR"))},
243+ eglClientWaitSyncKHR{
244+ reinterpret_cast<PFNEGLCLIENTWAITSYNCKHRPROC>(eglGetProcAddress("eglClientWaitSyncKHR"))}
245+{
246+ if (!eglCreateSyncKHR || !eglDestroySyncKHR || !eglClientWaitSyncKHR)
247+ BOOST_THROW_EXCEPTION(std::runtime_error("EGL doesn't support the KHR_reusable_sync extension"));
248+}
249
250=== renamed file 'src/platform/graphics/egl_sync_fence.cpp' => 'src/platforms/android/common/egl_sync_fence.cpp'
251--- src/platform/graphics/egl_sync_fence.cpp 2015-11-19 17:42:47 +0000
252+++ src/platforms/android/common/egl_sync_fence.cpp 2016-02-08 17:34:18 +0000
253@@ -16,7 +16,7 @@
254 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
255 */
256
257-#include "mir/graphics/egl_sync_fence.h"
258+#include "egl_sync_fence.h"
259 #include <boost/throw_exception.hpp>
260
261 namespace mg = mir::graphics;
262
263=== added directory 'src/platforms/android/include/android'
264=== added file 'src/platforms/android/include/android/native_window.h'
265--- src/platforms/android/include/android/native_window.h 1970-01-01 00:00:00 +0000
266+++ src/platforms/android/include/android/native_window.h 2016-02-08 17:34:18 +0000
267@@ -0,0 +1,21 @@
268+/*
269+ * Copyright © 2016 Canonical Ltd.
270+ *
271+ * This program is free software: you can redistribute it and/or modify it
272+ * under the terms of the GNU Lesser General Public License version 3,
273+ * as published by the Free Software Foundation.
274+ *
275+ * This program is distributed in the hope that it will be useful,
276+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
277+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
278+ * GNU Lesser General Public License for more details.
279+ *
280+ * You should have received a copy of the GNU Lesser General Public License
281+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
282+ *
283+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
284+ */
285+
286+//NOTE: this file exists to workaround a xenial packaging issue
287+//described in LP: #1539571
288+#include "system/window.h"
289
290=== modified file 'src/platforms/android/include/android_native_buffer.h'
291--- src/platforms/android/include/android_native_buffer.h 2016-01-29 08:18:22 +0000
292+++ src/platforms/android/include/android_native_buffer.h 2016-02-08 17:34:18 +0000
293@@ -27,6 +27,7 @@
294 {
295 namespace graphics
296 {
297+class CommandStreamSync;
298 namespace android
299 {
300 class Fence;
301@@ -35,6 +36,7 @@
302 {
303 AndroidNativeBuffer(
304 std::shared_ptr<ANativeWindowBuffer> const& handle,
305+ std::shared_ptr<CommandStreamSync> const& cmdstream_sync,
306 std::shared_ptr<Fence> const& fence,
307 BufferAccess fence_access);
308
309@@ -45,7 +47,11 @@
310 void ensure_available_for(BufferAccess);
311 void update_usage(NativeFence& merge_fd, BufferAccess);
312
313+ void lock_for_gpu();
314+ void wait_for_unlock_by_gpu();
315+
316 private:
317+ std::shared_ptr<CommandStreamSync> cmdstream_sync;
318 std::shared_ptr<Fence> fence;
319 BufferAccess access;
320 std::shared_ptr<ANativeWindowBuffer> native_window_buffer;
321
322=== added file 'src/platforms/android/include/command_stream_sync.h'
323--- src/platforms/android/include/command_stream_sync.h 1970-01-01 00:00:00 +0000
324+++ src/platforms/android/include/command_stream_sync.h 2016-02-08 17:34:18 +0000
325@@ -0,0 +1,51 @@
326+/*
327+ * Copyright © 2016 Canonical Ltd.
328+ *
329+ * This program is free software: you can redistribute it and/or modify it
330+ * under the terms of the GNU Lesser General Public License version 3,
331+ * as published by the Free Software Foundation.
332+ *
333+ * This program is distributed in the hope that it will be useful,
334+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
335+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
336+ * GNU Lesser General Public License for more details.
337+ *
338+ * You should have received a copy of the GNU Lesser General Public License
339+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
340+ *
341+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
342+ */
343+
344+#ifndef MIR_GRAPHICS_COMMAND_STREAM_SYNC_H_
345+#define MIR_GRAPHICS_COMMAND_STREAM_SYNC_H_
346+
347+#include <chrono>
348+
349+namespace mir
350+{
351+namespace graphics
352+{
353+class CommandStreamSync
354+{
355+public:
356+ //insert a sync object into the GL command stream of the current context.
357+ // \warning the calling thread should have a current egl context and display
358+ virtual void raise() = 0;
359+ // remove fence without waiting.
360+ virtual void reset() = 0;
361+ //wait for fence.
362+ // \ param [in] ns The amount of time to wait for the fence to become signalled
363+ // \ returns true if the fence was signalled, false if timeout
364+ virtual bool wait_for(std::chrono::nanoseconds ns) = 0;
365+
366+ virtual ~CommandStreamSync() = default;
367+ CommandStreamSync() = default;
368+ CommandStreamSync(CommandStreamSync const&) = delete;
369+ CommandStreamSync& operator=(CommandStreamSync const&) = delete;
370+};
371+
372+
373+}
374+}
375+
376+#endif /* MIR_GRAPHICS_COMMAND_STREAM_SYNC_H_ */
377
378=== added file 'src/platforms/android/include/egl_sync_extensions.h'
379--- src/platforms/android/include/egl_sync_extensions.h 1970-01-01 00:00:00 +0000
380+++ src/platforms/android/include/egl_sync_extensions.h 2016-02-08 17:34:18 +0000
381@@ -0,0 +1,48 @@
382+/*
383+ * Copyright © 2016 Canonical Ltd.
384+ *
385+ * This program is free software: you can redistribute it and/or modify it
386+ * under the terms of the GNU Lesser General Public License version 3,
387+ * as published by the Free Software Foundation.
388+ *
389+ * This program is distributed in the hope that it will be useful,
390+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
391+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
392+ * GNU Lesser General Public License for more details.
393+ *
394+ * You should have received a copy of the GNU Lesser General Public License
395+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
396+ *
397+ * authored by: Kevin DuBois <kevin.dubois@canonical.com>
398+ */
399+
400+#ifndef MIR_GRAPHICS_EGL_SYNC_EXTENSIONS_H_
401+#define MIR_GRAPHICS_EGL_SYNC_EXTENSIONS_H_
402+
403+#define GL_GLEXT_PROTOTYPES
404+#define EGL_EGLEXT_PROTOTYPES
405+
406+//Xenial egl has started needing a header (android/native_window.h)
407+//That we don't have in the android-headers package yet.
408+#include <EGL/egl.h>
409+#include <EGL/eglext.h>
410+#include <GLES2/gl2.h>
411+#include <GLES2/gl2ext.h>
412+
413+namespace mir
414+{
415+namespace graphics
416+{
417+
418+struct EGLSyncExtensions
419+{
420+ EGLSyncExtensions();
421+ PFNEGLCREATESYNCKHRPROC const eglCreateSyncKHR;
422+ PFNEGLDESTROYIMAGEKHRPROC const eglDestroySyncKHR;
423+ PFNEGLCLIENTWAITSYNCKHRPROC const eglClientWaitSyncKHR;
424+};
425+
426+}
427+}
428+
429+#endif /* MIR_GRAPHICS_EGL_SYNC_EXTENSIONS_H_ */
430
431=== renamed file 'src/include/platform/mir/graphics/egl_sync_fence.h' => 'src/platforms/android/include/egl_sync_fence.h'
432--- src/include/platform/mir/graphics/egl_sync_fence.h 2016-01-29 08:18:22 +0000
433+++ src/platforms/android/include/egl_sync_fence.h 2016-02-08 17:34:18 +0000
434@@ -19,34 +19,15 @@
435 #ifndef MIR_GRAPHICS_EGL_SYNC_FENCE_H_
436 #define MIR_GRAPHICS_EGL_SYNC_FENCE_H_
437
438-#include "egl_extensions.h"
439+#include "egl_sync_extensions.h"
440+#include "command_stream_sync.h"
441 #include <memory>
442-#include <chrono>
443 #include <mutex>
444
445 namespace mir
446 {
447 namespace graphics
448 {
449-class CommandStreamSync
450-{
451-public:
452- //insert a sync object into the GL command stream of the current context.
453- // \warning the calling thread should have a current egl context and display
454- virtual void raise() = 0;
455- // remove fence without waiting.
456- virtual void reset() = 0;
457- //wait for fence.
458- // \ param [in] ns The amount of time to wait for the fence to become signalled
459- // \ returns true if the fence was signalled, false if timeout
460- virtual bool wait_for(std::chrono::nanoseconds ns) = 0;
461-
462- virtual ~CommandStreamSync() = default;
463- CommandStreamSync() = default;
464- CommandStreamSync(CommandStreamSync const&) = delete;
465- CommandStreamSync& operator=(CommandStreamSync const&) = delete;
466-};
467-
468 class NullCommandSync : public CommandStreamSync
469 {
470 void raise() override;
471
472=== modified file 'src/platforms/android/include/native_buffer.h'
473--- src/platforms/android/include/native_buffer.h 2016-01-29 08:18:22 +0000
474+++ src/platforms/android/include/native_buffer.h 2016-02-08 17:34:18 +0000
475@@ -53,6 +53,9 @@
476 virtual void ensure_available_for(android::BufferAccess intent) = 0;
477 virtual void update_usage(android::NativeFence& fence, android::BufferAccess current_usage) = 0;
478
479+ virtual void lock_for_gpu() = 0;
480+ virtual void wait_for_unlock_by_gpu() = 0;
481+
482 protected:
483 NativeBuffer() = default;
484 NativeBuffer(NativeBuffer const&) = delete;
485
486=== modified file 'src/platforms/android/server/CMakeLists.txt'
487--- src/platforms/android/server/CMakeLists.txt 2016-02-01 22:53:06 +0000
488+++ src/platforms/android/server/CMakeLists.txt 2016-02-08 17:34:18 +0000
489@@ -37,6 +37,7 @@
490 hwc_fallback_gl_renderer.cpp
491 ipc_operations.cpp
492 hwc_blanking_control.cpp
493+ egl_sync_factory.cpp
494 virtual_output.cpp
495 )
496
497
498=== modified file 'src/platforms/android/server/android_alloc_adaptor.cpp'
499--- src/platforms/android/server/android_alloc_adaptor.cpp 2016-01-29 08:18:22 +0000
500+++ src/platforms/android/server/android_alloc_adaptor.cpp 2016-02-08 17:34:18 +0000
501@@ -17,11 +17,13 @@
502 * Kevin DuBois <kevin.dubois@canonical.com>
503 */
504
505+#include "egl_sync_fence.h"
506 #include "android_native_buffer.h"
507 #include "sync_fence.h"
508 #include "android_format_conversion-inl.h"
509 #include "android_alloc_adaptor.h"
510 #include "device_quirks.h"
511+#include "cmdstream_sync_factory.h"
512
513 #include <boost/throw_exception.hpp>
514 #include <boost/exception/errinfo_errno.hpp>
515@@ -48,10 +50,13 @@
516 };
517 }
518
519-mga::AndroidAllocAdaptor::AndroidAllocAdaptor(std::shared_ptr<struct alloc_device_t> const& alloc_device,
520- std::shared_ptr<DeviceQuirks> const& quirks)
521- : alloc_dev(alloc_device),
522- quirks(quirks)
523+mga::AndroidAllocAdaptor::AndroidAllocAdaptor(
524+ std::shared_ptr<struct alloc_device_t> const& alloc_device,
525+ std::shared_ptr<CommandStreamSyncFactory> const& sync_factory,
526+ std::shared_ptr<DeviceQuirks> const& quirks) :
527+ alloc_dev(alloc_device),
528+ sync_factory(sync_factory),
529+ quirks(quirks)
530 {
531 }
532
533@@ -94,7 +99,9 @@
534 anwb->format = format;
535 anwb->usage = usage_flag;
536
537- return std::make_shared<mga::AndroidNativeBuffer>(anwb, fence, mga::BufferAccess::read);
538+ return std::make_shared<mga::AndroidNativeBuffer>(anwb,
539+ sync_factory->create_command_stream_sync(),
540+ fence, mga::BufferAccess::read);
541 }
542
543 int mga::AndroidAllocAdaptor::convert_to_android_usage(BufferUsage usage)
544
545=== modified file 'src/platforms/android/server/android_alloc_adaptor.h'
546--- src/platforms/android/server/android_alloc_adaptor.h 2016-01-29 08:18:22 +0000
547+++ src/platforms/android/server/android_alloc_adaptor.h 2016-02-08 17:34:18 +0000
548@@ -31,12 +31,15 @@
549 namespace android
550 {
551 class DeviceQuirks;
552+class CommandStreamSyncFactory;
553
554 class AndroidAllocAdaptor : public GraphicAllocAdaptor
555 {
556 public:
557- explicit AndroidAllocAdaptor(std::shared_ptr<struct alloc_device_t> const& alloc_device,
558- std::shared_ptr<DeviceQuirks> const& quirks);
559+ explicit AndroidAllocAdaptor(
560+ std::shared_ptr<struct alloc_device_t> const& alloc_device,
561+ std::shared_ptr<CommandStreamSyncFactory> const& cmdstream_sync_factory,
562+ std::shared_ptr<DeviceQuirks> const& quirks);
563 std::shared_ptr<NativeBuffer> alloc_buffer(geometry::Size,
564 MirPixelFormat, BufferUsage usage);
565
566@@ -44,6 +47,7 @@
567
568 private:
569 std::shared_ptr<struct alloc_device_t> alloc_dev;
570+ std::shared_ptr<CommandStreamSyncFactory> const sync_factory;
571 std::shared_ptr<DeviceQuirks> const quirks;
572 int convert_to_android_usage(BufferUsage usage);
573 };
574
575=== modified file 'src/platforms/android/server/android_buffer_allocator.cpp'
576--- src/platforms/android/server/android_buffer_allocator.cpp 2016-01-29 08:18:22 +0000
577+++ src/platforms/android/server/android_buffer_allocator.cpp 2016-02-08 17:34:18 +0000
578@@ -20,12 +20,14 @@
579 #include "mir/graphics/platform.h"
580 #include "mir/graphics/egl_extensions.h"
581 #include "mir/graphics/buffer_properties.h"
582+#include "cmdstream_sync_factory.h"
583 #include "sync_fence.h"
584 #include "android_native_buffer.h"
585 #include "android_graphic_buffer_allocator.h"
586 #include "android_alloc_adaptor.h"
587 #include "buffer.h"
588 #include "device_quirks.h"
589+#include "egl_sync_fence.h"
590
591 #include <boost/throw_exception.hpp>
592
593@@ -50,8 +52,11 @@
594
595 }
596
597-mga::AndroidGraphicBufferAllocator::AndroidGraphicBufferAllocator(std::shared_ptr<DeviceQuirks> const& quirks)
598- : egl_extensions(std::make_shared<mg::EGLExtensions>())
599+mga::AndroidGraphicBufferAllocator::AndroidGraphicBufferAllocator(
600+ std::shared_ptr<CommandStreamSyncFactory> const& cmdstream_sync_factory,
601+ std::shared_ptr<DeviceQuirks> const& quirks)
602+ : egl_extensions(std::make_shared<mg::EGLExtensions>()),
603+ cmdstream_sync_factory(cmdstream_sync_factory)
604 {
605 int err;
606
607@@ -70,7 +75,7 @@
608 std::shared_ptr<struct alloc_device_t> alloc_dev_ptr(
609 alloc_dev,
610 quirks->gralloc_cannot_be_closed_safely() ? null_alloc_dev_deleter : alloc_dev_deleter);
611- alloc_device = std::shared_ptr<mga::GraphicAllocAdaptor>(new AndroidAllocAdaptor(alloc_dev_ptr, quirks));
612+ alloc_device = std::shared_ptr<mga::GraphicAllocAdaptor>(new AndroidAllocAdaptor(alloc_dev_ptr, cmdstream_sync_factory, quirks));
613 }
614
615 std::shared_ptr<mg::Buffer> mga::AndroidGraphicBufferAllocator::alloc_buffer(
616@@ -89,9 +94,10 @@
617 [](ANativeWindowBuffer* buffer){ buffer->common.decRef(&buffer->common); });
618 anwb->common.incRef(&anwb->common);
619
620+ //TODO: we should have an android platform function for accessing the fence.
621 auto native_handle = std::make_shared<mga::AndroidNativeBuffer>(
622 native_window_buffer,
623- //TODO: we should have an android platform function for accessing the fence.
624+ cmdstream_sync_factory->create_command_stream_sync(),
625 std::make_shared<mga::SyncFence>(std::make_shared<mga::RealSyncFileOps>(), mir::Fd()),
626 mga::BufferAccess::read);
627 return std::make_unique<Buffer>(
628
629=== modified file 'src/platforms/android/server/android_graphic_buffer_allocator.h'
630--- src/platforms/android/server/android_graphic_buffer_allocator.h 2016-01-29 08:18:22 +0000
631+++ src/platforms/android/server/android_graphic_buffer_allocator.h 2016-02-08 17:34:18 +0000
632@@ -39,11 +39,14 @@
633
634 class GraphicAllocAdaptor;
635 class DeviceQuirks;
636+class CommandStreamSyncFactory;
637
638 class AndroidGraphicBufferAllocator: public GraphicBufferAllocator, public graphics::GraphicBufferAllocator
639 {
640 public:
641- AndroidGraphicBufferAllocator(std::shared_ptr<DeviceQuirks> const& quirks);
642+ AndroidGraphicBufferAllocator(
643+ std::shared_ptr<CommandStreamSyncFactory> const& cmdstream_sync_factory,
644+ std::shared_ptr<DeviceQuirks> const& quirks);
645
646 std::shared_ptr<graphics::Buffer> alloc_buffer(
647 graphics::BufferProperties const& buffer_properties) override;
648@@ -61,6 +64,7 @@
649 const hw_module_t *hw_module;
650 std::shared_ptr<GraphicAllocAdaptor> alloc_device;
651 std::shared_ptr<EGLExtensions> const egl_extensions;
652+ std::shared_ptr<CommandStreamSyncFactory> const cmdstream_sync_factory;
653 };
654
655 }
656
657=== modified file 'src/platforms/android/server/buffer.cpp'
658--- src/platforms/android/server/buffer.cpp 2016-01-29 08:18:22 +0000
659+++ src/platforms/android/server/buffer.cpp 2016-02-08 17:34:18 +0000
660@@ -74,6 +74,18 @@
661 void mga::Buffer::gl_bind_to_texture()
662 {
663 std::unique_lock<std::mutex> lk(content_lock);
664+ bind(lk);
665+ secure_for_render(lk);
666+}
667+
668+void mga::Buffer::bind()
669+{
670+ std::unique_lock<std::mutex> lk(content_lock);
671+ bind(lk);
672+}
673+
674+void mga::Buffer::bind(std::unique_lock<std::mutex> const&)
675+{
676 native_buffer->ensure_available_for(mga::BufferAccess::read);
677
678 DispContextPair current
679@@ -113,10 +125,6 @@
680 }
681
682 egl_extensions->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
683-
684- //TODO: we should make use of the android egl fence extension here to update the fence.
685- // if the extension is not available, we should pass out a token that the user
686- // will have to keep until the completion of the gl draw
687 }
688
689 std::shared_ptr<mg::NativeBuffer> mga::Buffer::native_buffer_handle() const
690@@ -196,3 +204,14 @@
691 {
692 return this;
693 }
694+
695+void mga::Buffer::secure_for_render()
696+{
697+ std::unique_lock<std::mutex> lk(content_lock);
698+ secure_for_render(lk);
699+}
700+
701+void mga::Buffer::secure_for_render(std::unique_lock<std::mutex> const&)
702+{
703+ native_buffer->lock_for_gpu();
704+}
705
706=== modified file 'src/platforms/android/server/buffer.h'
707--- src/platforms/android/server/buffer.h 2016-01-29 08:18:22 +0000
708+++ src/platforms/android/server/buffer.h 2016-02-08 17:34:18 +0000
709@@ -56,6 +56,10 @@
710 geometry::Stride stride() const override;
711 MirPixelFormat pixel_format() const override;
712 void gl_bind_to_texture() override;
713+ void bind() override;
714+ void secure_for_render() override;
715+
716+
717 //note, you will get the native representation of an android buffer, including
718 //the fences associated with the buffer. You must close these fences
719 std::shared_ptr<NativeBuffer> native_buffer_handle() const override;
720@@ -66,6 +70,8 @@
721 NativeBufferBase* native_buffer_base() override;
722
723 private:
724+ void bind(std::unique_lock<std::mutex> const&);
725+ void secure_for_render(std::unique_lock<std::mutex> const&);
726 gralloc_module_t const* hw_module;
727
728 typedef std::pair<EGLDisplay, EGLContext> DispContextPair;
729
730=== added file 'src/platforms/android/server/cmdstream_sync_factory.h'
731--- src/platforms/android/server/cmdstream_sync_factory.h 1970-01-01 00:00:00 +0000
732+++ src/platforms/android/server/cmdstream_sync_factory.h 2016-02-08 17:34:18 +0000
733@@ -0,0 +1,48 @@
734+/*
735+ * Copyright © 2015 Canonical Ltd.
736+ *
737+ * This program is free software: you can redistribute it and/or modify it
738+ * under the terms of the GNU Lesser General Public License version 3,
739+ * as published by the Free Software Foundation.
740+ *
741+ * This program is distributed in the hope that it will be useful,
742+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
743+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
744+ * GNU Lesser General Public License for more details.
745+ *
746+ * You should have received a copy of the GNU Lesser General Public License
747+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
748+ *
749+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
750+ */
751+
752+#ifndef MIR_GRAPHICS_ANDROID_CMDSTREAM_SYNC_FACTORY_H_
753+#define MIR_GRAPHICS_ANDROID_CMDSTREAM_SYNC_FACTORY_H_
754+
755+#include <memory>
756+namespace mir
757+{
758+namespace graphics
759+{
760+class CommandStreamSync;
761+namespace android
762+{
763+class CommandStreamSyncFactory
764+{
765+public:
766+ virtual ~CommandStreamSyncFactory() = default;
767+ virtual std::unique_ptr<CommandStreamSync> create_command_stream_sync() = 0;
768+protected:
769+ CommandStreamSyncFactory() = default;
770+ CommandStreamSyncFactory(CommandStreamSyncFactory const&) = delete;
771+ CommandStreamSyncFactory& operator=(CommandStreamSyncFactory const&) = delete;
772+};
773+
774+class EGLSyncFactory : public CommandStreamSyncFactory
775+{
776+ std::unique_ptr<CommandStreamSync> create_command_stream_sync() override;
777+};
778+}
779+}
780+}
781+#endif /* MIR_GRAPHICS_ANDROID_CMDSTREAM_SYNC_FACTORY_H_ */
782
783=== modified file 'src/platforms/android/server/device_quirks.cpp'
784--- src/platforms/android/server/device_quirks.cpp 2016-01-29 08:18:22 +0000
785+++ src/platforms/android/server/device_quirks.cpp 2016-02-08 17:34:18 +0000
786@@ -123,6 +123,12 @@
787 return GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_TEXTURE;
788 }
789
790+bool mga::DeviceQuirks::working_egl_sync() const
791+{
792+ //FIXME: this really should be all powervr devices.
793+ return device_name != "mx4";
794+}
795+
796 void mga::DeviceQuirks::add_options(boost::program_options::options_description& config)
797 {
798 config.add_options()
799
800=== modified file 'src/platforms/android/server/device_quirks.h'
801--- src/platforms/android/server/device_quirks.h 2016-01-29 08:18:22 +0000
802+++ src/platforms/android/server/device_quirks.h 2016-02-08 17:34:18 +0000
803@@ -65,6 +65,7 @@
804 int aligned_width(int width) const;
805 bool clear_fb_context_fence() const;
806 int fb_gralloc_bits() const;
807+ bool working_egl_sync() const;
808
809 static void add_options(boost::program_options::options_description& config);
810
811
812=== modified file 'src/platforms/android/server/display_buffer.cpp'
813--- src/platforms/android/server/display_buffer.cpp 2016-01-29 08:18:22 +0000
814+++ src/platforms/android/server/display_buffer.cpp 2016-02-08 17:34:18 +0000
815@@ -98,6 +98,9 @@
816 void mga::DisplayBuffer::swap_buffers()
817 {
818 layer_list->update_list({}, offset_from_origin);
819+ //HWC 1.0 cannot call eglSwapBuffers() on the display context
820+ if (display_device->can_swap_buffers())
821+ gl_context.swap_buffers();
822 }
823
824 MirOrientation mga::DisplayBuffer::orientation() const
825
826=== modified file 'src/platforms/android/server/display_component_factory.h'
827--- src/platforms/android/server/display_component_factory.h 2016-01-29 08:18:22 +0000
828+++ src/platforms/android/server/display_component_factory.h 2016-02-08 17:34:18 +0000
829@@ -19,6 +19,7 @@
830 #ifndef MIR_GRAPHICS_ANDROID_DISPLAY_COMPONENT_FACTORY_H_
831 #define MIR_GRAPHICS_ANDROID_DISPLAY_COMPONENT_FACTORY_H_
832
833+#include "egl_sync_fence.h"
834 #include "display_device.h"
835 #include "framebuffer_bundle.h"
836 #include <memory>
837@@ -28,6 +29,7 @@
838 namespace graphics
839 {
840 class DisplayConfigurationOutput;
841+class CommandStreamSync;
842 namespace android
843 {
844 class HwcConfiguration;
845
846=== modified file 'src/platforms/android/server/display_device.h'
847--- src/platforms/android/server/display_device.h 2016-01-29 08:18:22 +0000
848+++ src/platforms/android/server/display_device.h 2016-02-08 17:34:18 +0000
849@@ -69,6 +69,8 @@
850
851 virtual std::chrono::milliseconds recommended_sleep() const = 0;
852
853+ virtual bool can_swap_buffers() const = 0;
854+
855 protected:
856 DisplayDevice() = default;
857 DisplayDevice& operator=(DisplayDevice const&) = delete;
858
859=== added file 'src/platforms/android/server/egl_sync_factory.cpp'
860--- src/platforms/android/server/egl_sync_factory.cpp 1970-01-01 00:00:00 +0000
861+++ src/platforms/android/server/egl_sync_factory.cpp 2016-02-08 17:34:18 +0000
862@@ -0,0 +1,35 @@
863+/*
864+ * Copyright © 2015 Canonical Ltd.
865+ *
866+ * This program is free software: you can redistribute it and/or modify it
867+ * under the terms of the GNU Lesser General Public License version 3,
868+ * as published by the Free Software Foundation.
869+ *
870+ * This program is distributed in the hope that it will be useful,
871+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
872+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
873+ * GNU Lesser General Public License for more details.
874+ *
875+ * You should have received a copy of the GNU Lesser General Public License
876+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
877+ *
878+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
879+ */
880+
881+#include "cmdstream_sync_factory.h"
882+#include "egl_sync_fence.h"
883+
884+namespace mg = mir::graphics;
885+namespace mga = mir::graphics::android;
886+
887+std::unique_ptr<mg::CommandStreamSync> mga::EGLSyncFactory::create_command_stream_sync()
888+{
889+ try
890+ {
891+ return std::make_unique<EGLSyncFence>(std::make_shared<mg::EGLSyncExtensions>());
892+ }
893+ catch (std::runtime_error&)
894+ {
895+ return std::make_unique<NullCommandSync>();
896+ }
897+}
898
899=== modified file 'src/platforms/android/server/fb_device.cpp'
900--- src/platforms/android/server/fb_device.cpp 2016-01-29 08:18:22 +0000
901+++ src/platforms/android/server/fb_device.cpp 2016-02-08 17:34:18 +0000
902@@ -99,8 +99,6 @@
903 });
904 if (primary_contents == contents.end()) return;
905 auto& context = primary_contents->context;
906-
907- context.swap_buffers();
908 auto const& buffer = context.last_rendered_buffer();
909 auto native_buffer = buffer->native_buffer_handle();
910 native_buffer->ensure_available_for(mga::BufferAccess::read);
911@@ -123,3 +121,8 @@
912 {
913 return std::chrono::milliseconds::zero();
914 }
915+
916+bool mga::FBDevice::can_swap_buffers() const
917+{
918+ return true;
919+}
920
921=== modified file 'src/platforms/android/server/fb_device.h'
922--- src/platforms/android/server/fb_device.h 2016-01-29 08:18:22 +0000
923+++ src/platforms/android/server/fb_device.h 2016-02-08 17:34:18 +0000
924@@ -52,6 +52,7 @@
925 bool compatible_renderlist(RenderableList const& renderlist) override;
926 void commit(std::list<DisplayContents> const& contents) override;
927 std::chrono::milliseconds recommended_sleep() const override;
928+ bool can_swap_buffers() const override;
929
930 private:
931 std::shared_ptr<framebuffer_device_t> const fb_device;
932
933=== modified file 'src/platforms/android/server/hal_component_factory.cpp'
934--- src/platforms/android/server/hal_component_factory.cpp 2016-01-29 08:18:22 +0000
935+++ src/platforms/android/server/hal_component_factory.cpp 2016-02-08 17:34:18 +0000
936@@ -46,7 +46,8 @@
937 res_factory(res_factory),
938 hwc_report(hwc_report),
939 force_backup_display(false),
940- num_framebuffers{quirks->num_framebuffers()}
941+ num_framebuffers{quirks->num_framebuffers()},
942+ working_egl_sync(quirks->working_egl_sync())
943 {
944 try
945 {
946@@ -65,6 +66,24 @@
947 }
948 }
949
950+std::unique_ptr<mg::CommandStreamSync> mga::HalComponentFactory::create_command_stream_sync()
951+{
952+ if (hwc_version == mga::HwcVersion::hwc10)
953+ return std::make_unique<NullCommandSync>();
954+
955+ if (!working_egl_sync)
956+ return std::make_unique<NullCommandSync>();
957+
958+ try
959+ {
960+ return std::make_unique<EGLSyncFence>(std::make_shared<mg::EGLSyncExtensions>());
961+ }
962+ catch (std::runtime_error&)
963+ {
964+ return std::make_unique<NullCommandSync>();
965+ }
966+}
967+
968 std::unique_ptr<mga::FramebufferBundle> mga::HalComponentFactory::create_framebuffers(mg::DisplayConfigurationOutput const& config)
969 {
970 return std::unique_ptr<mga::FramebufferBundle>(new mga::Framebuffers(
971
972=== modified file 'src/platforms/android/server/hal_component_factory.h'
973--- src/platforms/android/server/hal_component_factory.h 2016-01-29 08:18:22 +0000
974+++ src/platforms/android/server/hal_component_factory.h 2016-02-08 17:34:18 +0000
975@@ -19,6 +19,7 @@
976 #ifndef MIR_GRAPHICS_ANDROID_HAL_COMPONENT_FACTORY_H_
977 #define MIR_GRAPHICS_ANDROID_HAL_COMPONENT_FACTORY_H_
978
979+#include "cmdstream_sync_factory.h"
980 #include "display_component_factory.h"
981 #include "display_resource_factory.h"
982
983@@ -39,7 +40,7 @@
984
985 //NOTE: this should be the only class that inspects the HWC version and assembles
986 //the components accordingly
987-class HalComponentFactory : public DisplayComponentFactory
988+class HalComponentFactory : public DisplayComponentFactory, public CommandStreamSyncFactory
989 {
990 public:
991 HalComponentFactory(
992@@ -48,6 +49,7 @@
993 std::shared_ptr<HwcReport> const& hwc_report,
994 std::shared_ptr<DeviceQuirks> const& quirks);
995
996+ std::unique_ptr<CommandStreamSync> create_command_stream_sync() override;
997 std::unique_ptr<FramebufferBundle> create_framebuffers(DisplayConfigurationOutput const&) override;
998 std::unique_ptr<DisplayDevice> create_display_device() override;
999 std::unique_ptr<HwcConfiguration> create_hwc_configuration() override;
1000@@ -61,6 +63,7 @@
1001 std::shared_ptr<FramebufferBundle> framebuffers;
1002 bool force_backup_display;
1003 size_t num_framebuffers;
1004+ bool working_egl_sync;
1005
1006 std::shared_ptr<HwcWrapper> hwc_wrapper;
1007 std::shared_ptr<framebuffer_device_t> fb_native;
1008
1009=== modified file 'src/platforms/android/server/hwc_device.cpp'
1010--- src/platforms/android/server/hwc_device.cpp 2016-01-29 08:18:22 +0000
1011+++ src/platforms/android/server/hwc_device.cpp 2016-02-08 17:34:18 +0000
1012@@ -106,13 +106,13 @@
1013 if (content.list.needs_swapbuffers())
1014 {
1015 auto rejected_renderables = content.list.rejected_renderables();
1016- auto current_context = mir::raii::paired_calls(
1017- [&]{ content.context.make_current(); },
1018- [&]{ content.context.release_current(); });
1019- if (rejected_renderables.empty())
1020- content.context.swap_buffers();
1021- else
1022+ if (!rejected_renderables.empty())
1023+ {
1024+ auto current_context = mir::raii::paired_calls(
1025+ [&]{ content.context.make_current(); },
1026+ [&]{ content.context.release_current(); });
1027 content.compositor.render(std::move(rejected_renderables), content.list_offset, content.context);
1028+ }
1029 content.list.setup_fb(content.context.last_rendered_buffer());
1030 content.list.swap_occurred();
1031 purely_overlays = false;
1032@@ -161,3 +161,8 @@
1033 {
1034 onscreen_overlay_buffers.clear();
1035 }
1036+
1037+bool mga::HwcDevice::can_swap_buffers() const
1038+{
1039+ return true;
1040+}
1041
1042=== modified file 'src/platforms/android/server/hwc_device.h'
1043--- src/platforms/android/server/hwc_device.h 2016-01-29 08:18:22 +0000
1044+++ src/platforms/android/server/hwc_device.h 2016-02-08 17:34:18 +0000
1045@@ -47,6 +47,7 @@
1046 void commit(std::list<DisplayContents> const& contents) override;
1047 void content_cleared() override;
1048 std::chrono::milliseconds recommended_sleep() const override;
1049+ bool can_swap_buffers() const override;
1050
1051 private:
1052 bool buffer_is_onscreen(Buffer const&) const;
1053
1054=== modified file 'src/platforms/android/server/hwc_fb_device.cpp'
1055--- src/platforms/android/server/hwc_fb_device.cpp 2016-01-29 08:18:22 +0000
1056+++ src/platforms/android/server/hwc_fb_device.cpp 2016-02-08 17:34:18 +0000
1057@@ -118,3 +118,8 @@
1058 {
1059 return std::chrono::milliseconds::zero();
1060 }
1061+
1062+bool mga::HwcFbDevice::can_swap_buffers() const
1063+{
1064+ return false;
1065+}
1066
1067=== modified file 'src/platforms/android/server/hwc_fb_device.h'
1068--- src/platforms/android/server/hwc_fb_device.h 2016-01-29 08:18:22 +0000
1069+++ src/platforms/android/server/hwc_fb_device.h 2016-02-08 17:34:18 +0000
1070@@ -44,6 +44,7 @@
1071 bool compatible_renderlist(RenderableList const& renderlist) override;
1072 void commit(std::list<DisplayContents> const& contents) override;
1073 std::chrono::milliseconds recommended_sleep() const override;
1074+ bool can_swap_buffers() const override;
1075
1076 private:
1077 void content_cleared() override;
1078
1079=== modified file 'src/platforms/android/server/ipc_operations.cpp'
1080--- src/platforms/android/server/ipc_operations.cpp 2016-01-29 08:18:22 +0000
1081+++ src/platforms/android/server/ipc_operations.cpp 2016-02-08 17:34:18 +0000
1082@@ -36,6 +36,7 @@
1083 {
1084 auto native_buffer = buffer.native_buffer_handle();
1085
1086+ native_buffer->wait_for_unlock_by_gpu();
1087 mir::Fd fence_fd(native_buffer->copy_fence());
1088 if (fence_fd != mir::Fd::invalid)
1089 {
1090
1091=== modified file 'src/platforms/android/server/platform.cpp'
1092--- src/platforms/android/server/platform.cpp 2016-01-29 08:18:22 +0000
1093+++ src/platforms/android/server/platform.cpp 2016-02-08 17:34:18 +0000
1094@@ -86,11 +86,13 @@
1095 mga::Platform::Platform(
1096 std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator,
1097 std::shared_ptr<mga::DisplayComponentFactory> const& display_buffer_builder,
1098+ std::shared_ptr<CommandStreamSyncFactory> const& sync_factory,
1099 std::shared_ptr<mg::DisplayReport> const& display_report,
1100 mga::OverlayOptimization overlay_option,
1101 std::shared_ptr<mga::DeviceQuirks> const& quirks) :
1102 buffer_allocator(buffer_allocator),
1103 display_buffer_builder(display_buffer_builder),
1104+ sync_factory(sync_factory),
1105 display_report(display_report),
1106 quirks(quirks),
1107 overlay_option(overlay_option)
1108@@ -154,10 +156,13 @@
1109 auto overlay_option = should_use_overlay_optimization(*options);
1110 hwc_report->report_overlay_optimization(overlay_option);
1111 auto display_resource_factory = std::make_shared<mga::ResourceFactory>();
1112- auto buffer_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(quirks);
1113+ auto sync_factory = std::make_shared<mga::EGLSyncFactory>();
1114+ auto buffer_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(sync_factory, quirks);
1115 auto component_factory = std::make_shared<mga::HalComponentFactory>(
1116 buffer_allocator, display_resource_factory, hwc_report, quirks);
1117- return mir::make_module_ptr<mga::Platform>(buffer_allocator, component_factory, display_report, overlay_option, quirks);
1118+
1119+ return mir::make_module_ptr<mga::Platform>(
1120+ buffer_allocator, component_factory, component_factory, display_report, overlay_option, quirks);
1121 }
1122
1123 mir::UniqueModulePtr<mg::Platform> create_guest_platform(
1124@@ -167,10 +172,11 @@
1125 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
1126 //TODO: actually allow disabling quirks for guest platform
1127 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{});
1128+ auto sync_factory = std::make_shared<mga::EGLSyncFactory>();
1129 //TODO: remove nullptr parameter once platform classes are sorted.
1130 // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder
1131- auto const buffer_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(quirks);
1132- return mir::make_module_ptr<mga::Platform>(buffer_allocator, nullptr, display_report, mga::OverlayOptimization::disabled, quirks);
1133+ auto const buffer_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(sync_factory, quirks);
1134+ return mir::make_module_ptr<mga::Platform>(buffer_allocator, nullptr, sync_factory, display_report, mga::OverlayOptimization::disabled, quirks);
1135 }
1136
1137 void add_graphics_platform_options(
1138
1139=== modified file 'src/platforms/android/server/platform.h'
1140--- src/platforms/android/server/platform.h 2016-01-29 08:18:22 +0000
1141+++ src/platforms/android/server/platform.h 2016-02-08 17:34:18 +0000
1142@@ -33,6 +33,7 @@
1143 class GraphicBufferAllocator;
1144 class FramebufferFactory;
1145 class DisplayComponentFactory;
1146+class CommandStreamSyncFactory;
1147
1148 class Platform : public graphics::Platform
1149 {
1150@@ -40,6 +41,7 @@
1151 Platform(
1152 std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator,
1153 std::shared_ptr<DisplayComponentFactory> const& display_buffer_builder,
1154+ std::shared_ptr<CommandStreamSyncFactory> const& sync_factory,
1155 std::shared_ptr<DisplayReport> const& display_report,
1156 OverlayOptimization overlay_option,
1157 std::shared_ptr<DeviceQuirks> const& quirks);
1158@@ -55,6 +57,7 @@
1159 private:
1160 std::shared_ptr<graphics::GraphicBufferAllocator> const buffer_allocator;
1161 std::shared_ptr<DisplayComponentFactory> const display_buffer_builder;
1162+ std::shared_ptr<CommandStreamSyncFactory> const sync_factory;
1163 std::shared_ptr<DisplayReport> const display_report;
1164 std::shared_ptr<PlatformIpcOperations> const ipc_operations;
1165 std::shared_ptr<DeviceQuirks> const quirks;
1166
1167=== modified file 'src/platforms/mesa/server/common/gbm_buffer.cpp'
1168--- src/platforms/mesa/server/common/gbm_buffer.cpp 2016-01-29 08:18:22 +0000
1169+++ src/platforms/mesa/server/common/gbm_buffer.cpp 2016-02-08 17:34:18 +0000
1170@@ -197,3 +197,12 @@
1171 {
1172 return this;
1173 }
1174+
1175+void mgm::GBMBuffer::secure_for_render()
1176+{
1177+}
1178+
1179+void mgm::GBMBuffer::bind()
1180+{
1181+ gl_bind_to_texture();
1182+}
1183
1184=== modified file 'src/platforms/mesa/server/common/gbm_buffer.h'
1185--- src/platforms/mesa/server/common/gbm_buffer.h 2016-01-29 08:18:22 +0000
1186+++ src/platforms/mesa/server/common/gbm_buffer.h 2016-02-08 17:34:18 +0000
1187@@ -67,6 +67,8 @@
1188 virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const override;
1189
1190 virtual void gl_bind_to_texture() override;
1191+ virtual void bind() override;
1192+ virtual void secure_for_render() override;
1193
1194 void write(unsigned char const* pixels, size_t size) override;
1195 void read(std::function<void(unsigned char const*)> const& do_with_pixels) override;
1196
1197=== modified file 'src/platforms/mesa/server/common/shm_buffer.cpp'
1198--- src/platforms/mesa/server/common/shm_buffer.cpp 2016-01-29 08:18:22 +0000
1199+++ src/platforms/mesa/server/common/shm_buffer.cpp 2016-02-08 17:34:18 +0000
1200@@ -176,3 +176,12 @@
1201 {
1202 return this;
1203 }
1204+
1205+void mgm::ShmBuffer::bind()
1206+{
1207+ gl_bind_to_texture();
1208+}
1209+
1210+void mgm::ShmBuffer::secure_for_render()
1211+{
1212+}
1213
1214=== modified file 'src/platforms/mesa/server/common/shm_buffer.h'
1215--- src/platforms/mesa/server/common/shm_buffer.h 2016-01-29 08:18:22 +0000
1216+++ src/platforms/mesa/server/common/shm_buffer.h 2016-02-08 17:34:18 +0000
1217@@ -51,6 +51,8 @@
1218 MirPixelFormat pixel_format() const override;
1219 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const override;
1220 void gl_bind_to_texture() override;
1221+ void bind() override;
1222+ void secure_for_render() override;
1223 void write(unsigned char const* data, size_t size) override;
1224 void read(std::function<void(unsigned char const*)> const& do_with_pixels) override;
1225 NativeBufferBase* native_buffer_base() override;
1226
1227=== modified file 'tests/include/mir/test/doubles/mock_android_native_buffer.h'
1228--- tests/include/mir/test/doubles/mock_android_native_buffer.h 2016-01-29 08:18:22 +0000
1229+++ tests/include/mir/test/doubles/mock_android_native_buffer.h 2016-02-08 17:34:18 +0000
1230@@ -57,6 +57,8 @@
1231 MOCK_METHOD1(ensure_available_for, void(graphics::android::BufferAccess));
1232 MOCK_METHOD2(update_usage, void(graphics::android::NativeFence&, graphics::android::BufferAccess));
1233
1234+ MOCK_METHOD0(lock_for_gpu, void());
1235+ MOCK_METHOD0(wait_for_unlock_by_gpu, void());
1236 ANativeWindowBuffer stub_anwb;
1237 native_handle_t native_handle;
1238 };
1239
1240=== modified file 'tests/include/mir/test/doubles/mock_buffer.h'
1241--- tests/include/mir/test/doubles/mock_buffer.h 2016-01-29 08:18:22 +0000
1242+++ tests/include/mir/test/doubles/mock_buffer.h 2016-02-08 17:34:18 +0000
1243@@ -72,6 +72,7 @@
1244 MOCK_METHOD2(write, void(unsigned char const*, size_t));
1245 MOCK_METHOD1(read, void(std::function<void(unsigned char const*)> const&));
1246 MOCK_METHOD0(native_buffer_base, graphics::NativeBufferBase*());
1247+ MOCK_METHOD0(used_as_texture, void());
1248 };
1249
1250 }
1251
1252=== modified file 'tests/include/mir/test/doubles/mock_display_device.h'
1253--- tests/include/mir/test/doubles/mock_display_device.h 2016-01-29 08:18:22 +0000
1254+++ tests/include/mir/test/doubles/mock_display_device.h 2016-02-08 17:34:18 +0000
1255@@ -39,6 +39,8 @@
1256 {
1257 ON_CALL(*this, compatible_renderlist(testing::_))
1258 .WillByDefault(testing::Return(true));
1259+ ON_CALL(*this, can_swap_buffers())
1260+ .WillByDefault(testing::Return(true));
1261 }
1262 ~MockDisplayDevice() noexcept {}
1263 MOCK_METHOD0(content_cleared, void());
1264@@ -46,6 +48,7 @@
1265 MOCK_METHOD1(compatible_renderlist, bool(
1266 graphics::RenderableList const&));
1267 MOCK_CONST_METHOD0(recommended_sleep, std::chrono::milliseconds());
1268+ MOCK_CONST_METHOD0(can_swap_buffers, bool());
1269 };
1270 }
1271 }
1272
1273=== modified file 'tests/include/mir/test/doubles/mock_gl_buffer.h'
1274--- tests/include/mir/test/doubles/mock_gl_buffer.h 2016-01-29 08:18:22 +0000
1275+++ tests/include/mir/test/doubles/mock_gl_buffer.h 2016-02-08 17:34:18 +0000
1276@@ -36,6 +36,8 @@
1277 using MockBuffer::MockBuffer;
1278
1279 MOCK_METHOD0(gl_bind_to_texture, void());
1280+ MOCK_METHOD0(secure_for_render, void());
1281+ MOCK_METHOD0(bind, void());
1282 };
1283
1284 }
1285
1286=== modified file 'tests/include/mir/test/doubles/stub_android_native_buffer.h'
1287--- tests/include/mir/test/doubles/stub_android_native_buffer.h 2016-01-29 08:18:22 +0000
1288+++ tests/include/mir/test/doubles/stub_android_native_buffer.h 2016-02-08 17:34:18 +0000
1289@@ -47,6 +47,9 @@
1290 void ensure_available_for(graphics::android::BufferAccess) {}
1291 void update_usage(graphics::android::NativeFence&, graphics::android::BufferAccess) {}
1292
1293+ void lock_for_gpu() {};
1294+ void wait_for_unlock_by_gpu() {};
1295+
1296 ANativeWindowBuffer stub_anwb;
1297 native_handle_t native_handle;
1298 };
1299
1300=== added file 'tests/include/mir/test/doubles/stub_cmdstream_sync_factory.h'
1301--- tests/include/mir/test/doubles/stub_cmdstream_sync_factory.h 1970-01-01 00:00:00 +0000
1302+++ tests/include/mir/test/doubles/stub_cmdstream_sync_factory.h 2016-02-08 17:34:18 +0000
1303@@ -0,0 +1,41 @@
1304+/*
1305+ * Copyright © 2015 Canonical Ltd.
1306+ *
1307+ * This program is free software: you can redistribute it and/or modify it
1308+ * under the terms of the GNU General Public License version 3,
1309+ * as published by the Free Software Foundation.
1310+ *
1311+ * This program is distributed in the hope that it will be useful,
1312+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1314+ * GNU General Public License for more details.
1315+ *
1316+ * You should have received a copy of the GNU General Public License
1317+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1318+ *
1319+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1320+ */
1321+
1322+#ifndef MIR_TEST_DOUBLES_STUB_CMDSTREAM_SYNC_FACTORY_H_
1323+#define MIR_TEST_DOUBLES_STUB_CMDSTREAM_SYNC_FACTORY_H_
1324+
1325+#include "src/platforms/android/server/cmdstream_sync_factory.h"
1326+
1327+namespace mir
1328+{
1329+namespace test
1330+{
1331+namespace doubles
1332+{
1333+struct StubCmdStreamSyncFactory : graphics::android::CommandStreamSyncFactory
1334+{
1335+ std::unique_ptr<graphics::CommandStreamSync> create_command_stream_sync() override
1336+ {
1337+ return std::make_unique<graphics::NullCommandSync>();
1338+ }
1339+};
1340+}
1341+}
1342+}
1343+
1344+#endif /* MIR_TEST_DOUBLES_STUB_CMDSTREAM_SYNC_FACTORY_H_ */
1345
1346=== modified file 'tests/include/mir/test/doubles/stub_display_builder.h'
1347--- tests/include/mir/test/doubles/stub_display_builder.h 2016-01-29 08:18:22 +0000
1348+++ tests/include/mir/test/doubles/stub_display_builder.h 2016-02-08 17:34:18 +0000
1349@@ -126,6 +126,11 @@
1350 config = std::move(mock_config);
1351 }
1352
1353+ std::unique_ptr<graphics::CommandStreamSync> create_command_stream_sync()
1354+ {
1355+ return std::make_unique<graphics::NullCommandSync>();
1356+ }
1357+
1358 geometry::Size sz;
1359 std::unique_ptr<graphics::android::HwcConfiguration> config;
1360 };
1361
1362=== modified file 'tests/include/mir/test/doubles/stub_gl_buffer.h'
1363--- tests/include/mir/test/doubles/stub_gl_buffer.h 2016-01-29 08:18:22 +0000
1364+++ tests/include/mir/test/doubles/stub_gl_buffer.h 2016-02-08 17:34:18 +0000
1365@@ -36,6 +36,8 @@
1366 using StubBuffer::StubBuffer;
1367
1368 void gl_bind_to_texture() {}
1369+ void bind() {}
1370+ void secure_for_render() {}
1371 };
1372
1373 }
1374
1375=== modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp'
1376--- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2016-01-29 08:18:22 +0000
1377+++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2016-02-08 17:34:18 +0000
1378@@ -77,6 +77,9 @@
1379 }
1380 }
1381
1382+ void bind() override { gl_bind_to_texture(); }
1383+ void secure_for_render() override {}
1384+
1385 private:
1386 std::thread::id creation_thread_id;
1387 };
1388
1389=== modified file 'tests/unit-tests/gl/test_gl_texture_cache.cpp'
1390--- tests/unit-tests/gl/test_gl_texture_cache.cpp 2016-01-29 08:18:22 +0000
1391+++ tests/unit-tests/gl/test_gl_texture_cache.cpp 2016-02-08 17:34:18 +0000
1392@@ -17,7 +17,7 @@
1393 * Originally by: Daniel van Vugt <daniel.van.vugt@canonical.com>
1394 */
1395
1396-#include "mir/gl/recently_used_cache.h"
1397+#include "src/gl/recently_used_cache.h"
1398 #include "mir/test/doubles/mock_gl_buffer.h"
1399 #include "mir/test/doubles/mock_renderable.h"
1400 #include "mir/test/doubles/mock_gl.h"
1401@@ -75,6 +75,7 @@
1402 EXPECT_CALL(mock_gl, glBindTexture(GL_TEXTURE_2D, stub_texture));
1403 EXPECT_CALL(*mock_buffer,gl_bind_to_texture())
1404 .Times(0);
1405+ EXPECT_CALL(*mock_buffer, used_as_texture());
1406
1407 // Frame 3: Texture found in cache but refreshed with new buffer
1408 EXPECT_CALL(*mock_buffer, id())
1409@@ -92,6 +93,7 @@
1410 EXPECT_CALL(*mock_buffer, id())
1411 .WillOnce(Return(mg::BufferID(456)));
1412 EXPECT_CALL(mock_gl, glBindTexture(GL_TEXTURE_2D, stub_texture));
1413+ EXPECT_CALL(*mock_buffer, used_as_texture());
1414
1415 EXPECT_CALL(mock_gl, glDeleteTextures(1, Pointee(stub_texture)));
1416
1417
1418=== modified file 'tests/unit-tests/gl/test_program_factory.cpp'
1419--- tests/unit-tests/gl/test_program_factory.cpp 2016-01-29 08:18:22 +0000
1420+++ tests/unit-tests/gl/test_program_factory.cpp 2016-02-08 17:34:18 +0000
1421@@ -24,7 +24,7 @@
1422 #include <gtest/gtest.h>
1423 #include <gmock/gmock.h>
1424 #include <mir/geometry/rectangle.h>
1425-#include "src/gl/default_program_factory.h"
1426+#include "mir/gl/default_program_factory.h"
1427 #include <mir/test/fake_shared.h>
1428 #include <mir/test/doubles/mock_buffer.h>
1429 #include <mir/test/doubles/mock_renderable.h>
1430
1431=== modified file 'tests/unit-tests/graphics/android/CMakeLists.txt'
1432--- tests/unit-tests/graphics/android/CMakeLists.txt 2016-01-29 08:18:22 +0000
1433+++ tests/unit-tests/graphics/android/CMakeLists.txt 2016-02-08 17:34:18 +0000
1434@@ -31,6 +31,7 @@
1435 ${CMAKE_CURRENT_SOURCE_DIR}/test_hwc_fallback_gl_renderer.cpp
1436 ${CMAKE_CURRENT_SOURCE_DIR}/test_hwc_configuration.cpp
1437 ${CMAKE_CURRENT_SOURCE_DIR}/test_display_hotplug.cpp
1438+ ${CMAKE_CURRENT_SOURCE_DIR}/test_egl_sync_extensions.cpp
1439 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>
1440 )
1441
1442
1443=== modified file 'tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp'
1444--- tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp 2016-01-29 08:18:22 +0000
1445+++ tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp 2016-02-08 17:34:18 +0000
1446@@ -18,11 +18,13 @@
1447
1448 #include "src/platforms/android/server/android_alloc_adaptor.h"
1449 #include "src/platforms/android/server/device_quirks.h"
1450+#include "src/platforms/android/server/cmdstream_sync_factory.h"
1451 #include "mir/options/program_option.h"
1452 #include "native_buffer.h"
1453
1454 #include "mir/test/doubles/mock_android_alloc_device.h"
1455 #include "mir/test/doubles/mock_alloc_adaptor.h"
1456+#include "mir/test/doubles/mock_egl.h"
1457
1458 #include <gtest/gtest.h>
1459 #include <gmock/gmock.h>
1460@@ -33,7 +35,6 @@
1461 namespace geom = mir::geometry;
1462 namespace mtd = mir::test::doubles;
1463
1464-
1465 class AdaptorICSTest : public ::testing::Test
1466 {
1467 public:
1468@@ -47,13 +48,15 @@
1469 mock_alloc_device = std::make_shared<NiceMock<mtd::MockAllocDevice>>();
1470
1471 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{});
1472- alloc_adaptor = std::make_shared<mga::AndroidAllocAdaptor>(mock_alloc_device, quirks);
1473+ alloc_adaptor = std::make_shared<mga::AndroidAllocAdaptor>(mock_alloc_device, sync_factory, quirks);
1474
1475 pf = mir_pixel_format_abgr_8888;
1476 size = geom::Size{300, 200};
1477 usage = mga::BufferUsage::use_hardware;
1478 }
1479
1480+ mtd::MockEGL mock_egl;
1481+ std::shared_ptr<mga::CommandStreamSyncFactory> sync_factory{std::make_shared<mga::EGLSyncFactory>()};
1482 std::shared_ptr<mtd::MockAllocDevice> mock_alloc_device;
1483 std::shared_ptr<mga::AndroidAllocAdaptor> alloc_adaptor;
1484
1485@@ -198,7 +201,7 @@
1486 options.parse_arguments(description, args.size(), args.data());
1487 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}, options);
1488
1489- alloc_adaptor = std::make_shared<mga::AndroidAllocAdaptor>(mock_alloc_device, quirks);
1490+ alloc_adaptor = std::make_shared<mga::AndroidAllocAdaptor>(mock_alloc_device, sync_factory, quirks);
1491
1492 EXPECT_CALL(*mock_alloc_device, alloc_interface(_,_,_,_,fb_usage_flags_broken_device,_,_));
1493 EXPECT_CALL(*mock_alloc_device, free_interface(_,_));
1494
1495=== modified file 'tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp'
1496--- tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp 2016-01-29 08:18:22 +0000
1497+++ tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp 2016-02-08 17:34:18 +0000
1498@@ -23,6 +23,8 @@
1499 #include "mir/graphics/buffer.h"
1500 #include "native_buffer.h"
1501
1502+#include "mir/test/doubles/stub_display_builder.h"
1503+#include "mir/test/doubles/stub_cmdstream_sync_factory.h"
1504 #include "mir/test/doubles/mock_egl.h"
1505
1506 #include <hardware/gralloc.h>
1507@@ -43,7 +45,9 @@
1508
1509 testing::NiceMock<mtd::HardwareAccessMock> hw_access_mock;
1510 testing::NiceMock<mtd::MockEGL> mock_egl;
1511- mga::AndroidGraphicBufferAllocator allocator{std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{})};
1512+ mga::AndroidGraphicBufferAllocator allocator{
1513+ std::make_shared<mtd::StubCmdStreamSyncFactory>(),
1514+ std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{})};
1515 };
1516
1517 TEST_F(AndroidGraphicBufferAllocatorTest, allocator_accesses_gralloc_module)
1518@@ -54,7 +58,7 @@
1519 .Times(1);
1520
1521 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{});
1522- mga::AndroidGraphicBufferAllocator allocator{quirks};
1523+ mga::AndroidGraphicBufferAllocator allocator{std::make_shared<mtd::StubCmdStreamSyncFactory>(), quirks};
1524 }
1525
1526 TEST_F(AndroidGraphicBufferAllocatorTest, supported_pixel_formats_contain_common_formats)
1527
1528=== modified file 'tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp'
1529--- tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp 2016-01-29 08:18:22 +0000
1530+++ tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp 2016-02-08 17:34:18 +0000
1531@@ -289,7 +289,7 @@
1532
1533
1534 /* binding tests */
1535-TEST_F(AndroidBufferBinding, buffer_calls_binding_extension)
1536+TEST_F(AndroidBufferBinding, buffer_calls_binding_extension_and_notes_gpu_usage)
1537 {
1538 using namespace testing;
1539 EXPECT_CALL(mock_egl, glEGLImageTargetTexture2DOES(_, _))
1540@@ -298,11 +298,23 @@
1541 buffer.gl_bind_to_texture();
1542 }
1543
1544+TEST_F(AndroidBufferBinding, notes_gpu_usage_when_explicity_told)
1545+{
1546+ using namespace testing;
1547+ EXPECT_CALL(mock_egl, glEGLImageTargetTexture2DOES(_, _))
1548+ .Times(0);
1549+ EXPECT_CALL(*mock_native_buffer, lock_for_gpu());
1550+ mga::Buffer buffer(gralloc, mock_native_buffer, extensions);
1551+ buffer.secure_for_render();
1552+}
1553+
1554 TEST_F(AndroidBufferBinding, buffer_calls_binding_extension_every_time)
1555 {
1556 using namespace testing;
1557 EXPECT_CALL(mock_egl, glEGLImageTargetTexture2DOES(_, _))
1558 .Times(Exactly(3));
1559+ EXPECT_CALL(*mock_native_buffer, lock_for_gpu())
1560+ .Times(Exactly(3));
1561
1562 mga::Buffer buffer(gralloc, mock_native_buffer, extensions);
1563 buffer.gl_bind_to_texture();
1564
1565=== modified file 'tests/unit-tests/graphics/android/test_display_buffer.cpp'
1566--- tests/unit-tests/graphics/android/test_display_buffer.cpp 2016-01-29 08:18:22 +0000
1567+++ tests/unit-tests/graphics/android/test_display_buffer.cpp 2016-02-08 17:34:18 +0000
1568@@ -235,6 +235,21 @@
1569 db.release_current();
1570 }
1571
1572+//In HWC 1.0 notably we cannot eglSwapBuffers on the fb context.
1573+TEST_F(DisplayBuffer, swaps_when_allowed)
1574+{
1575+ using namespace testing;
1576+ EXPECT_CALL(*mock_display_device, can_swap_buffers())
1577+ .Times(2)
1578+ .WillOnce(Return(true))
1579+ .WillOnce(Return(false));
1580+ EXPECT_CALL(mock_egl, eglSwapBuffers(dummy_display, mock_egl.fake_egl_surface))
1581+ .Times(1);
1582+
1583+ db.swap_buffers();
1584+ db.swap_buffers();
1585+}
1586+
1587 TEST_F(DisplayBuffer, notifies_list_that_content_is_cleared)
1588 {
1589 EXPECT_CALL(*mock_display_device, content_cleared())
1590
1591=== modified file 'tests/unit-tests/graphics/android/test_display_hotplug.cpp'
1592--- tests/unit-tests/graphics/android/test_display_hotplug.cpp 2016-01-29 08:18:22 +0000
1593+++ tests/unit-tests/graphics/android/test_display_hotplug.cpp 2016-02-08 17:34:18 +0000
1594@@ -103,6 +103,11 @@
1595 new mga::LayerList(std::make_shared<mga::IntegerSourceCrop>(), {}, geom::Displacement{}));
1596 }
1597
1598+ std::unique_ptr<mg::CommandStreamSync> create_command_stream_sync()
1599+ {
1600+ return nullptr;
1601+ }
1602+
1603 StubHwcConfig stub_config;
1604 };
1605
1606
1607=== added file 'tests/unit-tests/graphics/android/test_egl_sync_extensions.cpp'
1608--- tests/unit-tests/graphics/android/test_egl_sync_extensions.cpp 1970-01-01 00:00:00 +0000
1609+++ tests/unit-tests/graphics/android/test_egl_sync_extensions.cpp 2016-02-08 17:34:18 +0000
1610@@ -0,0 +1,75 @@
1611+/*
1612+ * Copyright © 2013 Canonical Ltd.
1613+ *
1614+ * This program is free software: you can redistribute it and/or modify it
1615+ * under the terms of the GNU General Public License version 3,
1616+ * as published by the Free Software Foundation.
1617+ *
1618+ * This program is distributed in the hope that it will be useful,
1619+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1620+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1621+ * GNU General Public License for more details.
1622+ *
1623+ * You should have received a copy of the GNU General Public License
1624+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1625+ *
1626+ * Authored by:
1627+ * Kevin DuBois <kevin.dubois@canonical.com>
1628+ */
1629+
1630+#include "egl_sync_extensions.h"
1631+#include "mir/test/doubles/mock_egl.h"
1632+#include <stdexcept>
1633+
1634+#include <gtest/gtest.h>
1635+#include <gmock/gmock.h>
1636+
1637+namespace mg = mir::graphics;
1638+namespace mtd = mir::test::doubles;
1639+using namespace testing;
1640+
1641+typedef mtd::MockEGL::generic_function_pointer_t func_ptr_t;
1642+class EGLSyncExtensions : public ::testing::Test
1643+{
1644+protected:
1645+ virtual void SetUp()
1646+ {
1647+ }
1648+
1649+ testing::NiceMock<mtd::MockEGL> mock_egl;
1650+};
1651+
1652+TEST_F(EGLSyncExtensions, constructor_throws_if_egl_create_sync_not_supported)
1653+{
1654+ ON_CALL(mock_egl, eglGetProcAddress(StrEq("eglCreateSyncKHR")))
1655+ .WillByDefault(Return(reinterpret_cast<func_ptr_t>(0)));
1656+ EXPECT_THROW({
1657+ mg::EGLSyncExtensions extensions;
1658+ }, std::runtime_error);
1659+}
1660+
1661+TEST_F(EGLSyncExtensions, constructor_throws_if_egl_destroy_sync_not_supported)
1662+{
1663+ ON_CALL(mock_egl, eglGetProcAddress(StrEq("eglDestroySyncKHR")))
1664+ .WillByDefault(Return(reinterpret_cast<func_ptr_t>(0)));
1665+ EXPECT_THROW({
1666+ mg::EGLSyncExtensions extensions;
1667+ }, std::runtime_error);
1668+}
1669+
1670+TEST_F(EGLSyncExtensions, constructor_throws_if_egl_wait_sync_not_supported)
1671+{
1672+ ON_CALL(mock_egl, eglGetProcAddress(StrEq("eglClientWaitSyncKHR")))
1673+ .WillByDefault(Return(reinterpret_cast<func_ptr_t>(0)));
1674+ EXPECT_THROW({
1675+ mg::EGLSyncExtensions extensions;
1676+ }, std::runtime_error);
1677+}
1678+
1679+TEST_F(EGLSyncExtensions, sync_success_has_sane_function_hooks)
1680+{
1681+ mg::EGLSyncExtensions extensions;
1682+ EXPECT_NE(nullptr, extensions.eglCreateSyncKHR);
1683+ EXPECT_NE(nullptr, extensions.eglDestroySyncKHR);
1684+ EXPECT_NE(nullptr, extensions.eglClientWaitSyncKHR);
1685+}
1686
1687=== modified file 'tests/unit-tests/graphics/android/test_fb_device.cpp'
1688--- tests/unit-tests/graphics/android/test_fb_device.cpp 2016-01-29 08:18:22 +0000
1689+++ tests/unit-tests/graphics/android/test_fb_device.cpp 2016-02-08 17:34:18 +0000
1690@@ -72,6 +72,12 @@
1691 mga::DisplayName primary{mga::DisplayName::primary};
1692 };
1693
1694+TEST_F(FBDevice, reports_it_can_swap)
1695+{
1696+ mga::FBDevice fbdev(fb_hal_mock);
1697+ EXPECT_TRUE(fbdev.can_swap_buffers());
1698+}
1699+
1700 TEST_F(FBDevice, rejects_renderables)
1701 {
1702 mg::RenderableList renderlist
1703@@ -92,6 +98,8 @@
1704 .WillOnce(Return(-1))
1705 .WillOnce(Return(0));
1706
1707+ EXPECT_CALL(mock_context, swap_buffers())
1708+ .Times(0);
1709 mga::FBDevice fbdev(fb_hal_mock);
1710 mga::DisplayContents content{primary, list, geom::Displacement{}, mock_context, stub_compositor};
1711
1712
1713=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
1714--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2016-01-29 08:18:22 +0000
1715+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2016-02-08 17:34:18 +0000
1716@@ -120,6 +120,12 @@
1717 };
1718 }
1719
1720+TEST_F(HwcDevice, reports_it_can_swap)
1721+{
1722+ mga::HwcDevice device(mock_device);
1723+ EXPECT_TRUE(device.can_swap_buffers());
1724+}
1725+
1726 TEST_F(HwcDevice, prepares_a_skip_and_target_layer_by_default)
1727 {
1728 using namespace testing;
1729@@ -174,7 +180,7 @@
1730 device.commit({content});
1731 }
1732
1733-TEST_F(HwcDevice, swaps_buffers_directly_when_no_renderables)
1734+TEST_F(HwcDevice, does_not_swap_buffers_when_no_renderables)
1735 {
1736 using namespace testing;
1737 mtd::MockRenderableListCompositor mock_compositor;
1738@@ -184,7 +190,8 @@
1739
1740 EXPECT_CALL(mock_compositor, render(_,_,_))
1741 .Times(0);
1742- EXPECT_CALL(mock_context, swap_buffers());
1743+ EXPECT_CALL(mock_context, swap_buffers())
1744+ .Times(0);
1745
1746 mga::LayerList list(layer_adapter, {}, geom::Displacement{});
1747 mga::DisplayContents content{primary, list, offset, mock_context, mock_compositor};
1748@@ -465,8 +472,6 @@
1749 NiceMock<mtd::MockSwappingGLContext> mock_context;
1750 ON_CALL(mock_context, last_rendered_buffer())
1751 .WillByDefault(Return(stub_fb_buffer));
1752- EXPECT_CALL(mock_context, swap_buffers())
1753- .Times(AtLeast(5));
1754
1755 mga::LayerList list(layer_adapter, {}, geom::Displacement{});
1756 mtd::MockRenderableListCompositor mock_compositor;
1757@@ -844,10 +849,6 @@
1758
1759 InSequence seq;
1760 EXPECT_CALL(*mock_device, prepare(MatchesLists(expected_list, expected_list)));
1761- EXPECT_CALL(mock_context1, make_current());
1762- EXPECT_CALL(mock_context1, release_current());
1763- EXPECT_CALL(mock_context2, make_current());
1764- EXPECT_CALL(mock_context2, release_current());
1765 EXPECT_CALL(*mock_device, set(MatchesLists(expected_list, expected_list)));
1766
1767 mga::LayerList primary_list(layer_adapter, {}, geom::Displacement{});
1768
1769=== modified file 'tests/unit-tests/graphics/android/test_hwc_fb_device.cpp'
1770--- tests/unit-tests/graphics/android/test_hwc_fb_device.cpp 2016-01-29 08:18:22 +0000
1771+++ tests/unit-tests/graphics/android/test_hwc_fb_device.cpp 2016-02-08 17:34:18 +0000
1772@@ -104,6 +104,12 @@
1773 };
1774 }
1775
1776+TEST_F(HwcFbDevice, reports_it_cannot_swap)
1777+{
1778+ mga::HwcFbDevice device(mock_hwc_device_wrapper, mock_fb_device);
1779+ EXPECT_FALSE(device.can_swap_buffers());
1780+}
1781+
1782 TEST_F(HwcFbDevice, hwc10_subscribes_to_vsync_events)
1783 {
1784 using namespace testing;
1785
1786=== modified file 'tests/unit-tests/graphics/android/test_native_buffer.cpp'
1787--- tests/unit-tests/graphics/android/test_native_buffer.cpp 2016-01-29 08:18:22 +0000
1788+++ tests/unit-tests/graphics/android/test_native_buffer.cpp 2016-02-08 17:34:18 +0000
1789@@ -17,25 +17,41 @@
1790 */
1791
1792 #include "android_native_buffer.h"
1793+#include "egl_sync_fence.h"
1794 #include "mir/test/doubles/mock_fence.h"
1795 #include <memory>
1796 #include <gtest/gtest.h>
1797
1798 namespace mtd=mir::test::doubles;
1799 namespace mga=mir::graphics::android;
1800+using namespace testing;
1801+
1802+namespace
1803+{
1804+struct MockCommandStreamSync : public mir::graphics::CommandStreamSync
1805+{
1806+ MOCK_METHOD0(raise, void());
1807+ MOCK_METHOD0(reset, void());
1808+ MOCK_METHOD1(wait_for, bool(std::chrono::nanoseconds));
1809+};
1810+}
1811
1812 struct NativeBuffer : public testing::Test
1813 {
1814 NativeBuffer() :
1815 a_native_window_buffer(std::make_shared<ANativeWindowBuffer>()),
1816 mock_fence(std::make_shared<testing::NiceMock<mtd::MockFence>>()),
1817- fake_fd{48484}
1818+ fake_fd{48484},
1819+ timeout{std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::seconds(2))},
1820+ mock_cmdstream_sync{std::make_shared<MockCommandStreamSync>()}
1821 {
1822 }
1823
1824 std::shared_ptr<ANativeWindowBuffer> a_native_window_buffer;
1825 std::shared_ptr<mtd::MockFence> mock_fence;
1826 int fake_fd;
1827+ std::chrono::nanoseconds timeout;
1828+ std::shared_ptr<MockCommandStreamSync> mock_cmdstream_sync;
1829 };
1830
1831 TEST_F(NativeBuffer, extends_lifetime_when_driver_calls_external_refcount_hooks)
1832@@ -88,7 +104,7 @@
1833 {
1834 EXPECT_CALL(*mock_fence, wait())
1835 .Times(0);
1836- mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_fence, mga::BufferAccess::read);
1837+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1838 buffer.ensure_available_for(mga::BufferAccess::read);
1839 }
1840
1841@@ -96,7 +112,7 @@
1842 {
1843 EXPECT_CALL(*mock_fence, wait())
1844 .Times(1);
1845- mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_fence, mga::BufferAccess::write);
1846+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::write);
1847 buffer.ensure_available_for(mga::BufferAccess::read);
1848 }
1849
1850@@ -104,7 +120,7 @@
1851 {
1852 EXPECT_CALL(*mock_fence, wait())
1853 .Times(1);
1854- mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_fence, mga::BufferAccess::read);
1855+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1856 buffer.ensure_available_for(mga::BufferAccess::write);
1857 }
1858
1859@@ -112,7 +128,7 @@
1860 {
1861 EXPECT_CALL(*mock_fence, wait())
1862 .Times(1);
1863- mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_fence, mga::BufferAccess::write);
1864+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::write);
1865 buffer.ensure_available_for(mga::BufferAccess::write);
1866 }
1867
1868@@ -120,7 +136,7 @@
1869 {
1870 EXPECT_CALL(*mock_fence, merge_with(fake_fd))
1871 .Times(1);
1872- mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_fence, mga::BufferAccess::read);
1873+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1874 buffer.update_usage(fake_fd, mga::BufferAccess::write);
1875 }
1876
1877@@ -129,7 +145,7 @@
1878 EXPECT_CALL(*mock_fence, wait())
1879 .Times(3);
1880
1881- mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_fence, mga::BufferAccess::read);
1882+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1883 buffer.ensure_available_for(mga::BufferAccess::write);
1884 buffer.ensure_available_for(mga::BufferAccess::read);
1885
1886@@ -137,3 +153,30 @@
1887 buffer.ensure_available_for(mga::BufferAccess::write);
1888 buffer.ensure_available_for(mga::BufferAccess::read);
1889 }
1890+
1891+TEST_F(NativeBuffer, raises_egl_fence)
1892+{
1893+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1894+
1895+ EXPECT_CALL(*mock_cmdstream_sync, raise());
1896+ buffer.lock_for_gpu();
1897+}
1898+
1899+TEST_F(NativeBuffer, clears_egl_fence_successfully)
1900+{
1901+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1902+ EXPECT_CALL(*mock_cmdstream_sync, wait_for(timeout))
1903+ .Times(1)
1904+ .WillOnce(Return(true));
1905+ buffer.wait_for_unlock_by_gpu();
1906+}
1907+
1908+//not really helpful to throw if the timeout fails
1909+TEST_F(NativeBuffer, ignores_clears_egl_fence_failure)
1910+{
1911+ mga::AndroidNativeBuffer buffer(a_native_window_buffer, mock_cmdstream_sync, mock_fence, mga::BufferAccess::read);
1912+ EXPECT_CALL(*mock_cmdstream_sync, wait_for(timeout))
1913+ .Times(1)
1914+ .WillOnce(Return(false));
1915+ buffer.wait_for_unlock_by_gpu();
1916+}
1917
1918=== modified file 'tests/unit-tests/graphics/android/test_platform.cpp'
1919--- tests/unit-tests/graphics/android/test_platform.cpp 2016-01-29 08:18:22 +0000
1920+++ tests/unit-tests/graphics/android/test_platform.cpp 2016-02-08 17:34:18 +0000
1921@@ -26,6 +26,7 @@
1922 #include "mir/test/doubles/mock_display_report.h"
1923 #include "mir/test/doubles/mock_egl.h"
1924 #include "mir/test/doubles/stub_display_builder.h"
1925+#include "mir/test/doubles/stub_cmdstream_sync_factory.h"
1926 #include "mir/test/doubles/fd_matcher.h"
1927 #include "mir/test/fake_shared.h"
1928 #include "mir/test/doubles/mock_android_native_buffer.h"
1929@@ -54,6 +55,7 @@
1930 using namespace testing;
1931
1932 stub_display_builder = std::make_shared<mtd::StubDisplayBuilder>();
1933+ stub_sync_factory = std::make_shared<mtd::StubCmdStreamSyncFactory>();
1934 stub_display_report = mr::null_display_report();
1935 stride = geom::Stride(300*4);
1936
1937@@ -86,6 +88,7 @@
1938 std::shared_ptr<mtd::MockAndroidNativeBuffer> native_buffer;
1939 std::shared_ptr<mtd::StubBufferAllocator> stub_buffer_allocator;
1940 std::shared_ptr<mtd::StubDisplayBuilder> stub_display_builder;
1941+ std::shared_ptr<mtd::StubCmdStreamSyncFactory> stub_sync_factory;
1942 std::shared_ptr<mtd::MockBuffer> mock_buffer;
1943 std::shared_ptr<native_handle_t> native_buffer_handle;
1944 std::shared_ptr<mg::DisplayReport> stub_display_report;
1945@@ -99,10 +102,12 @@
1946 {
1947 using namespace ::testing;
1948 int fake_fence{333};
1949+ EXPECT_CALL(*native_buffer, wait_for_unlock_by_gpu());
1950 EXPECT_CALL(*native_buffer, copy_fence())
1951 .WillOnce(Return(fake_fence));
1952
1953- mga::Platform platform(stub_buffer_allocator, stub_display_builder, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1954+ mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1955+ stub_sync_factory, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1956
1957 mtd::MockBufferIpcMessage mock_ipc_msg;
1958 int offset = 0;
1959@@ -130,10 +135,12 @@
1960 TEST_F(PlatformBufferIPCPackaging, test_ipc_data_packed_correctly_for_full_ipc_without_fence)
1961 {
1962 using namespace ::testing;
1963+ EXPECT_CALL(*native_buffer, wait_for_unlock_by_gpu());
1964 EXPECT_CALL(*native_buffer, copy_fence())
1965 .WillOnce(Return(-1));
1966
1967- mga::Platform platform(stub_buffer_allocator, stub_display_builder, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1968+ mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1969+ stub_sync_factory, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1970
1971 mtd::MockBufferIpcMessage mock_ipc_msg;
1972 int offset = 0;
1973@@ -169,10 +176,12 @@
1974 TEST_F(PlatformBufferIPCPackaging, test_ipc_data_packed_correctly_for_nested)
1975 {
1976 using namespace ::testing;
1977+ EXPECT_CALL(*native_buffer, wait_for_unlock_by_gpu());
1978 EXPECT_CALL(*native_buffer, copy_fence())
1979 .WillOnce(Return(-1));
1980
1981- mga::Platform platform(stub_buffer_allocator, stub_display_builder, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1982+ mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1983+ stub_sync_factory, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1984
1985 mtd::MockBufferIpcMessage mock_ipc_msg;
1986 int offset = 0;
1987@@ -207,7 +216,8 @@
1988 using namespace ::testing;
1989
1990 int fake_fence{33};
1991- mga::Platform platform(stub_buffer_allocator, stub_display_builder, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1992+ mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1993+ stub_sync_factory, stub_display_report, mga::OverlayOptimization::enabled, quirks);
1994 auto ipc_ops = platform.make_ipc_operations();
1995
1996 mtd::MockBufferIpcMessage mock_ipc_msg;
1997@@ -234,6 +244,7 @@
1998 mga::Platform platform(
1999 std::make_shared<mtd::StubBufferAllocator>(),
2000 std::make_shared<mtd::StubDisplayBuilder>(),
2001+ std::make_shared<mtd::StubCmdStreamSyncFactory>(),
2002 mr::null_display_report(),
2003 mga::OverlayOptimization::enabled,
2004 std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}));
2005
2006=== modified file 'tests/unit-tests/graphics/test_egl_extensions.cpp'
2007--- tests/unit-tests/graphics/test_egl_extensions.cpp 2016-01-29 08:18:22 +0000
2008+++ tests/unit-tests/graphics/test_egl_extensions.cpp 2016-02-08 17:34:18 +0000
2009@@ -68,38 +68,3 @@
2010 EXPECT_NE(nullptr, extensions.eglDestroyImageKHR);
2011 EXPECT_NE(nullptr, extensions.glEGLImageTargetTexture2DOES);
2012 }
2013-
2014-TEST_F(EGLExtensions, constructor_throws_if_egl_create_sync_not_supported)
2015-{
2016- ON_CALL(mock_egl, eglGetProcAddress(StrEq("eglCreateSyncKHR")))
2017- .WillByDefault(Return(reinterpret_cast<func_ptr_t>(0)));
2018- EXPECT_THROW({
2019- mg::EGLSyncExtensions extensions;
2020- }, std::runtime_error);
2021-}
2022-
2023-TEST_F(EGLExtensions, constructor_throws_if_egl_destroy_sync_not_supported)
2024-{
2025- ON_CALL(mock_egl, eglGetProcAddress(StrEq("eglDestroySyncKHR")))
2026- .WillByDefault(Return(reinterpret_cast<func_ptr_t>(0)));
2027- EXPECT_THROW({
2028- mg::EGLSyncExtensions extensions;
2029- }, std::runtime_error);
2030-}
2031-
2032-TEST_F(EGLExtensions, constructor_throws_if_egl_wait_sync_not_supported)
2033-{
2034- ON_CALL(mock_egl, eglGetProcAddress(StrEq("eglClientWaitSyncKHR")))
2035- .WillByDefault(Return(reinterpret_cast<func_ptr_t>(0)));
2036- EXPECT_THROW({
2037- mg::EGLSyncExtensions extensions;
2038- }, std::runtime_error);
2039-}
2040-
2041-TEST_F(EGLExtensions, sync_success_has_sane_function_hooks)
2042-{
2043- mg::EGLSyncExtensions extensions;
2044- EXPECT_NE(nullptr, extensions.eglCreateSyncKHR);
2045- EXPECT_NE(nullptr, extensions.eglDestroySyncKHR);
2046- EXPECT_NE(nullptr, extensions.eglClientWaitSyncKHR);
2047-}
2048
2049=== modified file 'tests/unit-tests/graphics/test_egl_sync_fence.cpp'
2050--- tests/unit-tests/graphics/test_egl_sync_fence.cpp 2015-11-19 17:42:47 +0000
2051+++ tests/unit-tests/graphics/test_egl_sync_fence.cpp 2016-02-08 17:34:18 +0000
2052@@ -17,7 +17,7 @@
2053 */
2054
2055 #include <mir/test/doubles/mock_egl.h>
2056-#include "mir/graphics/egl_sync_fence.h"
2057+#include "egl_sync_fence.h"
2058 #include <gtest/gtest.h>
2059 #include <gmock/gmock.h>
2060 #include <array>

Subscribers

People subscribed via source and target branches