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
=== modified file 'src/server/graphics/nested/host_connection.h'
--- src/server/graphics/nested/host_connection.h 2017-02-01 22:30:52 +0000
+++ src/server/graphics/nested/host_connection.h 2017-02-10 13:00:53 +0000
@@ -78,7 +78,7 @@
78 virtual std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) = 0;78 virtual std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) = 0;
79 virtual std::shared_ptr<NativeBuffer> create_buffer(mir::geometry::Size, MirPixelFormat format) = 0;79 virtual std::shared_ptr<NativeBuffer> create_buffer(mir::geometry::Size, MirPixelFormat format) = 0;
80 virtual std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) = 0;80 virtual std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) = 0;
81 virtual bool supports_passthrough() = 0;81 virtual bool supports_passthrough(graphics::BufferUsage) = 0;
82 virtual void apply_input_configuration(MirInputConfig const* config) = 0;82 virtual void apply_input_configuration(MirInputConfig const* config) = 0;
8383
84protected:84protected:
8585
=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
--- src/server/graphics/nested/mir_client_host_connection.cpp 2017-02-09 06:56:31 +0000
+++ src/server/graphics/nested/mir_client_host_connection.cpp 2017-02-10 13:00:53 +0000
@@ -854,13 +854,13 @@
854 return std::make_unique<SurfaceSpec>(mir_connection);854 return std::make_unique<SurfaceSpec>(mir_connection);
855}855}
856856
857bool mgn::MirClientHostConnection::supports_passthrough()857bool mgn::MirClientHostConnection::supports_passthrough(mg::BufferUsage usage)
858{858{
859 auto buffer = create_buffer(geom::Size{1, 1} , mir_pixel_format_abgr_8888);859 //FIXME: ShmBuffers currently don't upload properly. The logic here uses
860 auto hints = buffer->egl_image_creation_hints();860 // passthrough where supported (ANativeWindowBuffer and gbm_bo)
861 if (std::get<1>(hints) == nullptr && std::get<2>(hints) == nullptr)861 // (LP: #1663062 for more details)
862 return false;862 return (mir_extension_android_buffer_v1(mir_connection) ||
863 return true;863 ((mir_extension_gbm_buffer_v1(mir_connection) && usage == mg::BufferUsage::hardware)));
864}864}
865865
866void mgn::MirClientHostConnection::apply_input_configuration(MirInputConfig const* config)866void mgn::MirClientHostConnection::apply_input_configuration(MirInputConfig const* config)
867867
=== modified file 'src/server/graphics/nested/mir_client_host_connection.h'
--- src/server/graphics/nested/mir_client_host_connection.h 2017-01-31 19:36:45 +0000
+++ src/server/graphics/nested/mir_client_host_connection.h 2017-02-10 13:00:53 +0000
@@ -87,7 +87,7 @@
87 std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) override;87 std::shared_ptr<NativeBuffer> create_buffer(graphics::BufferProperties const&) override;
88 std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, MirPixelFormat) override;88 std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, MirPixelFormat) override;
89 std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) override;89 std::shared_ptr<NativeBuffer> create_buffer(geometry::Size, uint32_t format, uint32_t flags) override;
90 bool supports_passthrough() override;90 bool supports_passthrough(BufferUsage usage) override;
91 void apply_input_configuration(MirInputConfig const* config) override;91 void apply_input_configuration(MirInputConfig const* config) override;
9292
93 optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() override;93 optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() override;
9494
=== modified file 'src/server/graphics/nested/platform.cpp'
--- src/server/graphics/nested/platform.cpp 2017-01-30 08:13:20 +0000
+++ src/server/graphics/nested/platform.cpp 2017-02-10 13:00:53 +0000
@@ -75,7 +75,7 @@
7575
76 std::shared_ptr<mg::Buffer> alloc_buffer(mg::BufferProperties const& properties) override76 std::shared_ptr<mg::Buffer> alloc_buffer(mg::BufferProperties const& properties) override
77 {77 {
78 if (passthrough_candidate(properties.size))78 if (passthrough_candidate(properties.size, properties.usage))
79 return std::make_shared<mgn::Buffer>(connection, properties);79 return std::make_shared<mgn::Buffer>(connection, properties);
80 else80 else
81 return guest_allocator->alloc_buffer(properties);81 return guest_allocator->alloc_buffer(properties);
@@ -84,7 +84,7 @@
84 std::shared_ptr<mg::Buffer> alloc_buffer(84 std::shared_ptr<mg::Buffer> alloc_buffer(
85 mir::geometry::Size size, uint32_t native_format, uint32_t native_flags) override85 mir::geometry::Size size, uint32_t native_format, uint32_t native_flags) override
86 {86 {
87 if (passthrough_candidate(size))87 if (passthrough_candidate(size, mg::BufferUsage::hardware))
88 return std::make_shared<mgn::Buffer>(connection, size, native_format, native_flags);88 return std::make_shared<mgn::Buffer>(connection, size, native_format, native_flags);
89 else89 else
90 return guest_allocator->alloc_buffer(size, native_format, native_flags);90 return guest_allocator->alloc_buffer(size, native_format, native_flags);
@@ -92,7 +92,7 @@
9292
93 std::shared_ptr<mg::Buffer> alloc_software_buffer(mir::geometry::Size size, MirPixelFormat format) override93 std::shared_ptr<mg::Buffer> alloc_software_buffer(mir::geometry::Size size, MirPixelFormat format) override
94 {94 {
95 if (passthrough_candidate(size))95 if (passthrough_candidate(size, mg::BufferUsage::software))
96 return std::make_shared<mgn::Buffer>(connection, size, format);96 return std::make_shared<mgn::Buffer>(connection, size, format);
97 else97 else
98 return guest_allocator->alloc_software_buffer(size, format);98 return guest_allocator->alloc_software_buffer(size, format);
@@ -104,9 +104,10 @@
104 }104 }
105105
106private:106private:
107 bool passthrough_candidate(mir::geometry::Size size)107 bool passthrough_candidate(mir::geometry::Size size, mg::BufferUsage usage)
108 {108 {
109 return (size.width >= mir::geometry::Width{480}) && (size.height >= mir::geometry::Height{480});109 return connection->supports_passthrough(usage) &&
110 (size.width >= mir::geometry::Width{480}) && (size.height >= mir::geometry::Height{480});
110 }111 }
111 std::shared_ptr<mgn::HostConnection> const connection;112 std::shared_ptr<mgn::HostConnection> const connection;
112 std::shared_ptr<mg::GraphicBufferAllocator> const guest_allocator;113 std::shared_ptr<mg::GraphicBufferAllocator> const guest_allocator;
@@ -115,7 +116,8 @@
115116
116mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgn::Platform::create_buffer_allocator()117mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgn::Platform::create_buffer_allocator()
117{118{
118 if (connection->supports_passthrough())119 if (connection->supports_passthrough(mg::BufferUsage::software) ||
120 connection->supports_passthrough(mg::BufferUsage::hardware))
119 {121 {
120 return mir::make_module_ptr<BufferAllocator>(connection, guest_platform->create_buffer_allocator());122 return mir::make_module_ptr<BufferAllocator>(connection, guest_platform->create_buffer_allocator());
121 }123 }
122124
=== modified file 'tests/include/mir/test/doubles/stub_host_connection.h'
--- tests/include/mir/test/doubles/stub_host_connection.h 2017-02-01 22:30:52 +0000
+++ tests/include/mir/test/doubles/stub_host_connection.h 2017-02-10 13:00:53 +0000
@@ -177,7 +177,7 @@
177 }; 177 };
178 return std::make_unique<NullSpec>();178 return std::make_unique<NullSpec>();
179 }179 }
180 bool supports_passthrough()180 bool supports_passthrough(graphics::BufferUsage)
181 {181 {
182 return true;182 return true;
183 }183 }

Subscribers

People subscribed via source and target branches