Mir

Merge lp:~kdub/mir/fix-1663062 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: 4025
Proposed branch: lp:~kdub/mir/fix-1663062
Merge into: lp:mir
Diff against target: 116 lines (+17/-15)
5 files modified
src/server/graphics/nested/host_connection.h (+1/-1)
src/server/graphics/nested/mir_client_host_connection.cpp (+6/-6)
src/server/graphics/nested/mir_client_host_connection.h (+1/-1)
src/server/graphics/nested/platform.cpp (+8/-6)
tests/include/mir/test/doubles/stub_host_connection.h (+1/-1)
To merge this branch: bzr merge lp:~kdub/mir/fix-1663062
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Cemil Azizoglu (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+316894@code.launchpad.net

Commit message

nested: disable passthrough on MirBuffers backed by ShmBuffer. Attempts to upload ShmBuffer via EGLImageTargetTexture2D doesn't work which was causing LP: #1663062. The ShmBuffer needs to be uploaded via TexImage2D, but more plumbing is needed in the nested platform to do that quickly. As a bonus, don't allocate a buffer to try to infer passthrough capabilities in the nested server.

Description of the change

nested: disable passthrough on MirBuffers backed by ShmBuffer. Attempts to upload ShmBuffer via EGLImageTargetTexture2D doesn't work which was causing LP: #1663062. The ShmBuffer needs to be uploaded via TexImage2D, but more plumbing is needed in the nested platform to do that quickly. As a bonus, don't allocate a buffer to try to infer passthrough capabilities in the nested server.

Ported from the 0.26.1 branch, will work on properly uploading the texture and re-enabling.

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

FAILED: Continuous integration, rev:4021
https://mir-jenkins.ubuntu.com/job/mir-ci/2971/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3947/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4033
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4023
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4023
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4023
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3974
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3974/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3974
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3974/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3974/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3974
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3974/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3974
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3974/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3974
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3974/artifact/output/*zip*/output.zip

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

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

Works well, but it's printing debug messages:

+ printf("CANDIDTA %i\n", a);

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

ah yeah, removing

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

> ah yeah, removing
and wasn't in the 0.26.1 patch, just a porting between branches oversight.

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

FAILED: Continuous integration, rev:4022
https://mir-jenkins.ubuntu.com/job/mir-ci/2976/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3954/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4040
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4030
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4030
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4030
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3981/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3981
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3981/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3981
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3981/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3981
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3981/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3981
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3981/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3981/console

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

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

13:05:38 clang: error: invalid argument '/build/mir' to -fdebug-prefix-map

and

TestClientInput

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

PASSED: Continuous integration, rev:4022
https://mir-jenkins.ubuntu.com/job/mir-ci/2977/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3955
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4041
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4031
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3982
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3982/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3982
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3982/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3982
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3982/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3982
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3982/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3982
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3982/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3982
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3982/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

LGTM

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

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/nested/host_connection.h'
2--- src/server/graphics/nested/host_connection.h 2017-02-01 22:30:52 +0000
3+++ src/server/graphics/nested/host_connection.h 2017-02-10 13:00:53 +0000
4@@ -78,7 +78,7 @@
5 virtual std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) = 0;
6 virtual std::shared_ptr<NativeBuffer> create_buffer(mir::geometry::Size, MirPixelFormat format) = 0;
7 virtual std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) = 0;
8- virtual bool supports_passthrough() = 0;
9+ virtual bool supports_passthrough(graphics::BufferUsage) = 0;
10 virtual void apply_input_configuration(MirInputConfig const* config) = 0;
11
12 protected:
13
14=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
15--- src/server/graphics/nested/mir_client_host_connection.cpp 2017-02-09 06:56:31 +0000
16+++ src/server/graphics/nested/mir_client_host_connection.cpp 2017-02-10 13:00:53 +0000
17@@ -854,13 +854,13 @@
18 return std::make_unique<SurfaceSpec>(mir_connection);
19 }
20
21-bool mgn::MirClientHostConnection::supports_passthrough()
22+bool mgn::MirClientHostConnection::supports_passthrough(mg::BufferUsage usage)
23 {
24- auto buffer = create_buffer(geom::Size{1, 1} , mir_pixel_format_abgr_8888);
25- auto hints = buffer->egl_image_creation_hints();
26- if (std::get<1>(hints) == nullptr && std::get<2>(hints) == nullptr)
27- return false;
28- return true;
29+ //FIXME: ShmBuffers currently don't upload properly. The logic here uses
30+ // passthrough where supported (ANativeWindowBuffer and gbm_bo)
31+ // (LP: #1663062 for more details)
32+ return (mir_extension_android_buffer_v1(mir_connection) ||
33+ ((mir_extension_gbm_buffer_v1(mir_connection) && usage == mg::BufferUsage::hardware)));
34 }
35
36 void mgn::MirClientHostConnection::apply_input_configuration(MirInputConfig const* config)
37
38=== modified file 'src/server/graphics/nested/mir_client_host_connection.h'
39--- src/server/graphics/nested/mir_client_host_connection.h 2017-01-31 19:36:45 +0000
40+++ src/server/graphics/nested/mir_client_host_connection.h 2017-02-10 13:00:53 +0000
41@@ -87,7 +87,7 @@
42 std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) override;
43 std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, MirPixelFormat) override;
44 std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) override;
45- bool supports_passthrough() override;
46+ bool supports_passthrough(BufferUsage usage) override;
47 void apply_input_configuration(MirInputConfig const* config) override;
48
49 optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() override;
50
51=== modified file 'src/server/graphics/nested/platform.cpp'
52--- src/server/graphics/nested/platform.cpp 2017-01-30 08:13:20 +0000
53+++ src/server/graphics/nested/platform.cpp 2017-02-10 13:00:53 +0000
54@@ -75,7 +75,7 @@
55
56 std::shared_ptr<mg::Buffer> alloc_buffer(mg::BufferProperties const& properties) override
57 {
58- if (passthrough_candidate(properties.size))
59+ if (passthrough_candidate(properties.size, properties.usage))
60 return std::make_shared<mgn::Buffer>(connection, properties);
61 else
62 return guest_allocator->alloc_buffer(properties);
63@@ -84,7 +84,7 @@
64 std::shared_ptr<mg::Buffer> alloc_buffer(
65 mir::geometry::Size size, uint32_t native_format, uint32_t native_flags) override
66 {
67- if (passthrough_candidate(size))
68+ if (passthrough_candidate(size, mg::BufferUsage::hardware))
69 return std::make_shared<mgn::Buffer>(connection, size, native_format, native_flags);
70 else
71 return guest_allocator->alloc_buffer(size, native_format, native_flags);
72@@ -92,7 +92,7 @@
73
74 std::shared_ptr<mg::Buffer> alloc_software_buffer(mir::geometry::Size size, MirPixelFormat format) override
75 {
76- if (passthrough_candidate(size))
77+ if (passthrough_candidate(size, mg::BufferUsage::software))
78 return std::make_shared<mgn::Buffer>(connection, size, format);
79 else
80 return guest_allocator->alloc_software_buffer(size, format);
81@@ -104,9 +104,10 @@
82 }
83
84 private:
85- bool passthrough_candidate(mir::geometry::Size size)
86+ bool passthrough_candidate(mir::geometry::Size size, mg::BufferUsage usage)
87 {
88- return (size.width >= mir::geometry::Width{480}) && (size.height >= mir::geometry::Height{480});
89+ return connection->supports_passthrough(usage) &&
90+ (size.width >= mir::geometry::Width{480}) && (size.height >= mir::geometry::Height{480});
91 }
92 std::shared_ptr<mgn::HostConnection> const connection;
93 std::shared_ptr<mg::GraphicBufferAllocator> const guest_allocator;
94@@ -115,7 +116,8 @@
95
96 mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgn::Platform::create_buffer_allocator()
97 {
98- if (connection->supports_passthrough())
99+ if (connection->supports_passthrough(mg::BufferUsage::software) ||
100+ connection->supports_passthrough(mg::BufferUsage::hardware))
101 {
102 return mir::make_module_ptr<BufferAllocator>(connection, guest_platform->create_buffer_allocator());
103 }
104
105=== modified file 'tests/include/mir/test/doubles/stub_host_connection.h'
106--- tests/include/mir/test/doubles/stub_host_connection.h 2017-02-01 22:30:52 +0000
107+++ tests/include/mir/test/doubles/stub_host_connection.h 2017-02-10 13:00:53 +0000
108@@ -177,7 +177,7 @@
109 };
110 return std::make_unique<NullSpec>();
111 }
112- bool supports_passthrough()
113+ bool supports_passthrough(graphics::BufferUsage)
114 {
115 return true;
116 }

Subscribers

People subscribed via source and target branches