Merge lp:~alan-griffiths/mir/BufferStreamArrangement.can_be_specified_when_creating_surface into lp:mir
- BufferStreamArrangement.can_be_specified_when_creating_surface
- Merge into development-branch
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 |
Related bugs: |
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 BufferStreamArr
Description of the change
In looking to fix lp:1580555 I found the code I wanted to change ins SessionMediator
Mir CI Bot (mir-ci-bot) wrote : | # |
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Difficult to review right now as mir_connection.cpp changes are conflicting with those in https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3507
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
> Difficult to review right now as mir_connection.cpp changes are conflicting
> with those in https:/
The mir_connection.cpp changes here are not needed with that branch. So you can try:
$ bzr resolve --take-this src/client/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3507
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3507
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
lgtm, more-or-less a subset of what is needed by fix-1577967 (which tacks on some further clarifications)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3509
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
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 | 381 | std::string name{spec.surface_name.is_set() ? | 381 | std::string name{spec.surface_name.is_set() ? |
6 | 382 | spec.surface_name.value() : ""}; | 382 | spec.surface_name.value() : ""}; |
7 | 383 | 383 | ||
12 | 384 | stream = std::make_shared<mcl::BufferStream>( | 384 | if (surface_proto->has_buffer_stream()) |
13 | 385 | this, request->wh, server, platform, surface_map, buffer_factory, | 385 | { |
14 | 386 | surface_proto->buffer_stream(), make_perf_report(logger), name, | 386 | stream = std::make_shared<mcl::BufferStream>( |
15 | 387 | mir::geometry::Size{surface_proto->width(), surface_proto->height()}, nbuffers); | 387 | this, request->wh, server, platform, surface_map, buffer_factory, |
16 | 388 | surface_proto->buffer_stream(), make_perf_report(logger), name, | ||
17 | 389 | mir::geometry::Size{surface_proto->width(), surface_proto->height()}, nbuffers); | ||
18 | 390 | } | ||
19 | 388 | } | 391 | } |
20 | 389 | catch (std::exception const& error) | 392 | catch (std::exception const& error) |
21 | 390 | { | 393 | { |
22 | @@ -417,7 +420,9 @@ | |||
23 | 417 | this, server, &debug, stream, input_platform, spec, *surface_proto, request->wh); | 420 | this, server, &debug, stream, input_platform, spec, *surface_proto, request->wh); |
24 | 418 | 421 | ||
25 | 419 | surface_map->insert(mf::SurfaceId{surface_proto->id().value()}, surf); | 422 | surface_map->insert(mf::SurfaceId{surface_proto->id().value()}, surf); |
27 | 420 | surface_map->insert(mf::BufferStreamId{surface_proto->buffer_stream().id().value()}, stream); | 423 | |
28 | 424 | if (stream) | ||
29 | 425 | surface_map->insert(mf::BufferStreamId{surface_proto->buffer_stream().id().value()}, stream); | ||
30 | 421 | } | 426 | } |
31 | 422 | 427 | ||
32 | 423 | callback(surf.get(), context); | 428 | callback(surf.get(), context); |
33 | 424 | 429 | ||
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 | 335 | auto const surf_id = shell->create_surface(session, params, sink); | 335 | auto const surf_id = shell->create_surface(session, params, sink); |
39 | 336 | 336 | ||
40 | 337 | auto surface = session->get_surface(surf_id); | 337 | auto surface = session->get_surface(surf_id); |
41 | 338 | auto stream = session->get_buffer_stream(buffer_stream_id); | ||
42 | 339 | auto const& client_size = surface->client_size(); | 338 | auto const& client_size = surface->client_size(); |
43 | 340 | response->mutable_id()->set_value(surf_id.as_value()); | 339 | response->mutable_id()->set_value(surf_id.as_value()); |
44 | 341 | response->set_width(client_size.width.as_uint32_t()); | 340 | response->set_width(client_size.width.as_uint32_t()); |
45 | 342 | response->set_height(client_size.height.as_uint32_t()); | 341 | response->set_height(client_size.height.as_uint32_t()); |
46 | 343 | 342 | ||
47 | 344 | // TODO: Deprecate | 343 | // TODO: Deprecate |
49 | 345 | response->set_pixel_format(stream->pixel_format()); | 344 | response->set_pixel_format(request->pixel_format()); |
50 | 346 | response->set_buffer_usage(request->buffer_usage()); | 345 | response->set_buffer_usage(request->buffer_usage()); |
51 | 347 | 346 | ||
52 | 348 | response->mutable_buffer_stream()->set_pixel_format(stream->pixel_format()); | ||
53 | 349 | response->mutable_buffer_stream()->set_buffer_usage(request->buffer_usage()); | ||
54 | 350 | |||
55 | 351 | if (surface->supports_input()) | 347 | if (surface->supports_input()) |
56 | 352 | response->add_fd(surface->client_input_fd()); | 348 | response->add_fd(surface->client_input_fd()); |
57 | 353 | 349 | ||
58 | @@ -364,6 +360,9 @@ | |||
59 | 364 | { | 360 | { |
60 | 365 | buffer_stream_tracker.set_default_stream(surf_id, buffer_stream_id); | 361 | buffer_stream_tracker.set_default_stream(surf_id, buffer_stream_id); |
61 | 366 | response->mutable_buffer_stream()->mutable_id()->set_value(buffer_stream_id.as_value()); | 362 | response->mutable_buffer_stream()->mutable_id()->set_value(buffer_stream_id.as_value()); |
62 | 363 | response->mutable_buffer_stream()->set_pixel_format(legacy_stream->pixel_format()); | ||
63 | 364 | response->mutable_buffer_stream()->set_buffer_usage(request->buffer_usage()); | ||
64 | 365 | |||
65 | 367 | advance_buffer(buffer_stream_id, *legacy_stream, buffer_stream_tracker.last_buffer(buffer_stream_id), | 366 | advance_buffer(buffer_stream_id, *legacy_stream, buffer_stream_tracker.last_buffer(buffer_stream_id), |
66 | 368 | [this, buffering_sender, response, done, session] | 367 | [this, buffering_sender, response, done, session] |
67 | 369 | (graphics::Buffer* client_buffer, graphics::BufferIpcMsgType msg_type) | 368 | (graphics::Buffer* client_buffer, graphics::BufferIpcMsgType msg_type) |
68 | 370 | 369 | ||
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 | 66 | 66 | ||
74 | 67 | struct Stream | 67 | struct Stream |
75 | 68 | { | 68 | { |
76 | 69 | Stream(MirBufferStream* stream, geom::Point pt, geom::Size sz) : | ||
77 | 70 | stream(stream), | ||
78 | 71 | pos{pt}, | ||
79 | 72 | stream_size{sz}, | ||
80 | 73 | needs_release{false} | ||
81 | 74 | { | ||
82 | 75 | mir_buffer_stream_swap_buffers_sync(stream); | ||
83 | 76 | } | ||
84 | 77 | |||
85 | 78 | Stream(MirConnection* connection, geom::Rectangle rect) : | 69 | Stream(MirConnection* connection, geom::Rectangle rect) : |
86 | 79 | stream(mir_connection_create_buffer_stream_sync( | 70 | stream(mir_connection_create_buffer_stream_sync( |
87 | 80 | connection, | 71 | connection, |
88 | @@ -212,8 +203,7 @@ | |||
89 | 212 | ConnectedClientWithASurface::SetUp(); | 203 | ConnectedClientWithASurface::SetUp(); |
90 | 213 | server.the_cursor()->hide(); | 204 | server.the_cursor()->hide(); |
91 | 214 | 205 | ||
94 | 215 | streams.emplace_back( | 206 | streams.emplace_back(std::make_unique<Stream>(connection, geom::Rectangle{geom::Point{0,0}, surface_size})); |
93 | 216 | std::make_unique<Stream>(mir_surface_get_buffer_stream(surface), geom::Point{0,0}, surface_size)); | ||
95 | 217 | int const additional_streams{3}; | 207 | int const additional_streams{3}; |
96 | 218 | for (auto i = 0; i < additional_streams; i++) | 208 | for (auto i = 0; i < additional_streams; i++) |
97 | 219 | { | 209 | { |
98 | @@ -235,6 +225,32 @@ | |||
99 | 235 | }; | 225 | }; |
100 | 236 | } | 226 | } |
101 | 237 | 227 | ||
102 | 228 | TEST_F(BufferStreamArrangement, can_be_specified_when_creating_surface) | ||
103 | 229 | { | ||
104 | 230 | using namespace testing; | ||
105 | 231 | std::vector<MirBufferStreamInfo> infos(streams.size()); | ||
106 | 232 | auto i = 0u; | ||
107 | 233 | for (auto const& stream : streams) | ||
108 | 234 | { | ||
109 | 235 | infos[i++] = MirBufferStreamInfo{ | ||
110 | 236 | stream->handle(), | ||
111 | 237 | stream->position().x.as_int(), | ||
112 | 238 | stream->position().y.as_int()}; | ||
113 | 239 | } | ||
114 | 240 | |||
115 | 241 | mir_surface_release_sync(surface); | ||
116 | 242 | |||
117 | 243 | auto const spec = mir_connection_create_spec_for_normal_surface( | ||
118 | 244 | connection, surface_size.width.as_int(), surface_size.height.as_int(), mir_pixel_format_abgr_8888); | ||
119 | 245 | mir_surface_spec_set_name(spec, "BufferStreamArrangement.can_be_specified_when_creating_surface"); | ||
120 | 246 | mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_hardware); | ||
121 | 247 | mir_surface_spec_set_streams(spec, infos.data(), infos.size()); | ||
122 | 248 | |||
123 | 249 | surface = mir_surface_create_sync(spec); | ||
124 | 250 | mir_surface_spec_release(spec); | ||
125 | 251 | EXPECT_TRUE(mir_surface_is_valid(surface)) << mir_surface_get_error_message(surface); | ||
126 | 252 | } | ||
127 | 253 | |||
128 | 238 | TEST_F(BufferStreamArrangement, arrangements_are_applied) | 254 | TEST_F(BufferStreamArrangement, arrangements_are_applied) |
129 | 239 | { | 255 | { |
130 | 240 | using namespace testing; | 256 | using namespace testing; |
FAILED: Continuous integration, rev:3507 /mir-jenkins. ubuntu. com/job/ mir-ci/ 976/ /mir-jenkins. ubuntu. com/job/ build-mir/ 1057/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/1104 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1095 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 1095 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1067 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1067/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 1067 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial/ 1067/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1067 /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 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1067 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1067/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial/ 1067/console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 976/rebuild
https:/