Mir

Merge lp:~alan-griffiths/mir/BufferStreamArrangement.can_be_specified_when_creating_surface into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 3508
Proposed branch: lp:~alan-griffiths/mir/BufferStreamArrangement.can_be_specified_when_creating_surface
Merge into: lp:mir
Diff against target: 130 lines (+41/-21)
3 files modified
src/client/mir_connection.cpp (+10/-5)
src/server/frontend/session_mediator.cpp (+4/-5)
tests/acceptance-tests/test_buffer_stream_arrangement.cpp (+27/-11)
To merge this branch: bzr merge lp:~alan-griffiths/mir/BufferStreamArrangement.can_be_specified_when_creating_surface
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Kevin DuBois (community) Approve
Review via email: mp+294407@code.launchpad.net

Commit message

Add BufferStreamArrangement.can_be_specified_when_creating_surface test and fix implementation to pass.

Description of the change

In looking to fix lp:1580555 I found the code I wanted to change ins SessionMediator::create_surface() wasn't under test. Here is the missing test.

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

FAILED: Continuous integration, rev:3507
https://mir-jenkins.ubuntu.com/job/mir-ci/976/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1057/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1104
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1095
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1095
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1067
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1067/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1067
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1067/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/1067
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1067/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/1067
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1067/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1067/console

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

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

Difficult to review right now as mir_connection.cpp changes are conflicting with those in https://code.launchpad.net/~kdub/mir/fix-1577967/+merge/294283.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Difficult to review right now as mir_connection.cpp changes are conflicting
> with those in https://code.launchpad.net/~kdub/mir/fix-1577967/+merge/294283.

The mir_connection.cpp changes here are not needed with that branch. So you can try:

$ bzr resolve --take-this src/client/mir_connection.cpp

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

PASSED: Continuous integration, rev:3507
https://mir-jenkins.ubuntu.com/job/mir-ci/979/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1061
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1108
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1099
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1099
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1071
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1071/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1071
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1071/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/1071
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1071/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/1071
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1071/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1071
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1071/artifact/output/*zip*/output.zip

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

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

lgtm, more-or-less a subset of what is needed by fix-1577967 (which tacks on some further clarifications)

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

PASSED: Continuous integration, rev:3509
https://mir-jenkins.ubuntu.com/job/mir-ci/986/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1068
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1115
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1106
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1106
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1078
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1078/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1078
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1078/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/1078
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1078/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/1078
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1078/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1078
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1078/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/mir_connection.cpp'
2--- src/client/mir_connection.cpp 2016-05-09 14:27:58 +0000
3+++ src/client/mir_connection.cpp 2016-05-13 08:57:27 +0000
4@@ -381,10 +381,13 @@
5 std::string name{spec.surface_name.is_set() ?
6 spec.surface_name.value() : ""};
7
8- stream = std::make_shared<mcl::BufferStream>(
9- this, request->wh, server, platform, surface_map, buffer_factory,
10- surface_proto->buffer_stream(), make_perf_report(logger), name,
11- mir::geometry::Size{surface_proto->width(), surface_proto->height()}, nbuffers);
12+ if (surface_proto->has_buffer_stream())
13+ {
14+ stream = std::make_shared<mcl::BufferStream>(
15+ this, request->wh, server, platform, surface_map, buffer_factory,
16+ surface_proto->buffer_stream(), make_perf_report(logger), name,
17+ mir::geometry::Size{surface_proto->width(), surface_proto->height()}, nbuffers);
18+ }
19 }
20 catch (std::exception const& error)
21 {
22@@ -417,7 +420,9 @@
23 this, server, &debug, stream, input_platform, spec, *surface_proto, request->wh);
24
25 surface_map->insert(mf::SurfaceId{surface_proto->id().value()}, surf);
26- surface_map->insert(mf::BufferStreamId{surface_proto->buffer_stream().id().value()}, stream);
27+
28+ if (stream)
29+ surface_map->insert(mf::BufferStreamId{surface_proto->buffer_stream().id().value()}, stream);
30 }
31
32 callback(surf.get(), context);
33
34=== modified file 'src/server/frontend/session_mediator.cpp'
35--- src/server/frontend/session_mediator.cpp 2016-05-10 10:48:28 +0000
36+++ src/server/frontend/session_mediator.cpp 2016-05-13 08:57:27 +0000
37@@ -335,19 +335,15 @@
38 auto const surf_id = shell->create_surface(session, params, sink);
39
40 auto surface = session->get_surface(surf_id);
41- auto stream = session->get_buffer_stream(buffer_stream_id);
42 auto const& client_size = surface->client_size();
43 response->mutable_id()->set_value(surf_id.as_value());
44 response->set_width(client_size.width.as_uint32_t());
45 response->set_height(client_size.height.as_uint32_t());
46
47 // TODO: Deprecate
48- response->set_pixel_format(stream->pixel_format());
49+ response->set_pixel_format(request->pixel_format());
50 response->set_buffer_usage(request->buffer_usage());
51
52- response->mutable_buffer_stream()->set_pixel_format(stream->pixel_format());
53- response->mutable_buffer_stream()->set_buffer_usage(request->buffer_usage());
54-
55 if (surface->supports_input())
56 response->add_fd(surface->client_input_fd());
57
58@@ -364,6 +360,9 @@
59 {
60 buffer_stream_tracker.set_default_stream(surf_id, buffer_stream_id);
61 response->mutable_buffer_stream()->mutable_id()->set_value(buffer_stream_id.as_value());
62+ response->mutable_buffer_stream()->set_pixel_format(legacy_stream->pixel_format());
63+ response->mutable_buffer_stream()->set_buffer_usage(request->buffer_usage());
64+
65 advance_buffer(buffer_stream_id, *legacy_stream, buffer_stream_tracker.last_buffer(buffer_stream_id),
66 [this, buffering_sender, response, done, session]
67 (graphics::Buffer* client_buffer, graphics::BufferIpcMsgType msg_type)
68
69=== modified file 'tests/acceptance-tests/test_buffer_stream_arrangement.cpp'
70--- tests/acceptance-tests/test_buffer_stream_arrangement.cpp 2016-01-29 08:18:22 +0000
71+++ tests/acceptance-tests/test_buffer_stream_arrangement.cpp 2016-05-13 08:57:27 +0000
72@@ -66,15 +66,6 @@
73
74 struct Stream
75 {
76- Stream(MirBufferStream* stream, geom::Point pt, geom::Size sz) :
77- stream(stream),
78- pos{pt},
79- stream_size{sz},
80- needs_release{false}
81- {
82- mir_buffer_stream_swap_buffers_sync(stream);
83- }
84-
85 Stream(MirConnection* connection, geom::Rectangle rect) :
86 stream(mir_connection_create_buffer_stream_sync(
87 connection,
88@@ -212,8 +203,7 @@
89 ConnectedClientWithASurface::SetUp();
90 server.the_cursor()->hide();
91
92- streams.emplace_back(
93- std::make_unique<Stream>(mir_surface_get_buffer_stream(surface), geom::Point{0,0}, surface_size));
94+ streams.emplace_back(std::make_unique<Stream>(connection, geom::Rectangle{geom::Point{0,0}, surface_size}));
95 int const additional_streams{3};
96 for (auto i = 0; i < additional_streams; i++)
97 {
98@@ -235,6 +225,32 @@
99 };
100 }
101
102+TEST_F(BufferStreamArrangement, can_be_specified_when_creating_surface)
103+{
104+ using namespace testing;
105+ std::vector<MirBufferStreamInfo> infos(streams.size());
106+ auto i = 0u;
107+ for (auto const& stream : streams)
108+ {
109+ infos[i++] = MirBufferStreamInfo{
110+ stream->handle(),
111+ stream->position().x.as_int(),
112+ stream->position().y.as_int()};
113+ }
114+
115+ mir_surface_release_sync(surface);
116+
117+ auto const spec = mir_connection_create_spec_for_normal_surface(
118+ connection, surface_size.width.as_int(), surface_size.height.as_int(), mir_pixel_format_abgr_8888);
119+ mir_surface_spec_set_name(spec, "BufferStreamArrangement.can_be_specified_when_creating_surface");
120+ mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_hardware);
121+ mir_surface_spec_set_streams(spec, infos.data(), infos.size());
122+
123+ surface = mir_surface_create_sync(spec);
124+ mir_surface_spec_release(spec);
125+ EXPECT_TRUE(mir_surface_is_valid(surface)) << mir_surface_get_error_message(surface);
126+}
127+
128 TEST_F(BufferStreamArrangement, arrangements_are_applied)
129 {
130 using namespace testing;

Subscribers

People subscribed via source and target branches