Mir

Merge lp:~mir-team/mir/trunk-0.1.6 into lp:mir/0.1

Proposed by kevin gunn
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 1177
Proposed branch: lp:~mir-team/mir/trunk-0.1.6
Merge into: lp:mir/0.1
Diff against target: 19399 lines (+8125/-3470)
329 files modified
CMakeLists.txt (+23/-15)
cmake/FindXKBCOMMON.cmake (+1/-6)
cmake/MirCommon.cmake (+7/-10)
cmake/src/mir/mir_discover_gtest_tests.cpp (+24/-10)
cross-compile-chroot.sh (+64/-22)
debian/changelog (+68/-0)
debian/control (+72/-8)
debian/create_postinst_prerm_scripts.sh (+30/-0)
debian/install_ld_so_conf.sh (+18/-0)
debian/libmirclientplatform-android.install (+1/-0)
debian/libmirclientplatform-mesa.install (+1/-0)
debian/libmirplatform.install (+0/-1)
debian/libmirplatformgraphics-android.install (+1/-0)
debian/libmirplatformgraphics-mesa.install (+1/-0)
debian/libmirserver16.install (+1/-1)
debian/rules (+20/-10)
debian/update-alternatives.postinst.in (+18/-0)
debian/update-alternatives.prerm.in (+16/-0)
doc/component_reports.md (+5/-5)
examples/CMakeLists.txt (+14/-3)
examples/basic_server_configuration.cpp (+13/-7)
examples/demo-shell/demo_shell.cpp (+14/-7)
examples/render_overlays.cpp (+135/-0)
examples/render_surfaces.cpp (+34/-14)
examples/render_to_fb.cpp (+0/-1)
examples/scroll.cpp (+1/-1)
examples/server_configuration.cpp (+10/-4)
examples/server_configuration.h (+7/-1)
guides/cppguide.xml (+7/-6)
include/platform/mir/abnormal_exit.h (+3/-3)
include/platform/mir/graphics/drm_authenticator.h (+1/-3)
include/platform/mir/options/configuration.h (+74/-0)
include/platform/mir/options/default_configuration.h (+40/-75)
include/platform/mir/udev/wrapper.h (+2/-1)
include/server/mir/compositor/compositor_report.h (+0/-11)
include/server/mir/default_server_configuration.h (+18/-7)
include/server/mir/frontend/connector_report.h (+0/-15)
include/server/mir/frontend/session_mediator_report.h (+0/-24)
include/server/mir/input/surface.h (+1/-1)
include/server/mir/report/legacy_input_report.h (+39/-0)
include/server/mir/scene/scene_report.h (+7/-18)
include/shared/mir/report/lttng/mir_tracepoint.h (+1/-2)
include/shared/mir/report/lttng/tracepoint_provider.h (+6/-3)
include/shared/mir/shared_library.h (+3/-3)
include/test/mir_test/draw/graphics_region_factory.h (+18/-27)
include/test/mir_test/draw/patterns.h (+1/-1)
include/test/mir_test_doubles/mock_display_device.h (+1/-0)
include/test/mir_test_doubles/mock_drm.h (+1/-0)
include/test/mir_test_doubles/mock_gl.h (+2/-0)
include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+2/-0)
include/test/mir_test_doubles/mock_input_surface.h (+2/-2)
include/test/mir_test_doubles/mock_renderer.h (+8/-6)
include/test/mir_test_doubles/stub_display_builder.h (+41/-27)
include/test/mir_test_doubles/stub_display_configuration.h (+2/-2)
include/test/mir_test_doubles/stub_renderer.h (+65/-0)
include/test/mir_test_doubles/stub_surface_builder.h (+7/-6)
include/test/mir_test_framework/udev_environment.h (+12/-2)
src/client/CMakeLists.txt (+9/-33)
src/client/android/CMakeLists.txt (+38/-0)
src/client/android/android_client_platform.cpp (+0/-7)
src/client/android/client_platform_factory.cpp (+34/-0)
src/client/android/client_platform_factory.h (+41/-0)
src/client/client_platform_factory.h (+8/-3)
src/client/default_connection_configuration.cpp (+31/-2)
src/client/lttng/CMakeLists.txt (+4/-7)
src/client/lttng/client_tracepoint_provider.h (+2/-2)
src/client/lttng/input_receiver_report.cpp (+65/-0)
src/client/lttng/input_receiver_report.h (+46/-0)
src/client/lttng/input_receiver_report_tp.h (+96/-0)
src/client/lttng/rpc_report.cpp (+1/-1)
src/client/lttng/rpc_report_tp.c (+0/-4)
src/client/lttng/tracepoints.c (+5/-0)
src/client/mesa/CMakeLists.txt (+40/-0)
src/client/mesa/client_platform.cpp (+1/-39)
src/client/mesa/client_platform_factory.cpp (+71/-0)
src/client/mesa/client_platform_factory.h (+41/-0)
src/client/mesa/native_surface.cpp (+12/-2)
src/client/mesa/native_surface.h (+1/-0)
src/client/mir_client_library.cpp (+1/-2)
src/client/mir_connection.cpp (+3/-2)
src/client/mir_screencast_api.cpp (+1/-1)
src/client/native_client_platform_factory.h (+0/-49)
src/platform/CMakeLists.txt (+1/-0)
src/platform/graphics/CMakeLists.txt (+2/-3)
src/platform/graphics/android/CMakeLists.txt (+21/-3)
src/platform/graphics/android/android_display.cpp (+4/-23)
src/platform/graphics/android/android_display.h (+3/-7)
src/platform/graphics/android/android_display_configuration.cpp (+3/-19)
src/platform/graphics/android/android_display_configuration.h (+1/-1)
src/platform/graphics/android/android_platform.cpp (+1/-1)
src/platform/graphics/android/configurable_display_buffer.h (+43/-0)
src/platform/graphics/android/display_buffer.cpp (+65/-8)
src/platform/graphics/android/display_buffer.h (+8/-3)
src/platform/graphics/android/display_builder.h (+2/-5)
src/platform/graphics/android/display_device.h (+1/-0)
src/platform/graphics/android/fb_device.cpp (+5/-0)
src/platform/graphics/android/fb_device.h (+1/-0)
src/platform/graphics/android/hwc_common_device.cpp (+6/-3)
src/platform/graphics/android/hwc_common_device.h (+1/-0)
src/platform/graphics/android/hwc_device.cpp (+28/-16)
src/platform/graphics/android/hwc_device.h (+2/-1)
src/platform/graphics/android/hwc_fb_device.cpp (+24/-12)
src/platform/graphics/android/hwc_fb_device.h (+1/-0)
src/platform/graphics/android/hwc_layerlist.cpp (+117/-43)
src/platform/graphics/android/hwc_layerlist.h (+33/-8)
src/platform/graphics/android/hwc_layers.cpp (+96/-94)
src/platform/graphics/android/hwc_layers.h (+32/-38)
src/platform/graphics/android/output_builder.cpp (+4/-10)
src/platform/graphics/android/output_builder.h (+2/-3)
src/platform/graphics/mesa/CMakeLists.txt (+19/-3)
src/platform/graphics/mesa/display.cpp (+11/-0)
src/platform/graphics/mesa/display_buffer.cpp (+72/-31)
src/platform/graphics/mesa/display_buffer.h (+4/-1)
src/platform/graphics/mesa/display_helpers.cpp (+8/-1)
src/platform/graphics/mesa/platform.cpp (+1/-1)
src/platform/graphics/mesa/platform.h (+1/-1)
src/platform/options/CMakeLists.txt (+1/-0)
src/platform/options/default_configuration.cpp (+105/-100)
src/platform/options/program_option.cpp (+3/-3)
src/platform/udev_wrapper.cpp (+16/-0)
src/server/CMakeLists.txt (+5/-5)
src/server/compositor/CMakeLists.txt (+2/-1)
src/server/compositor/compositing_screencast.cpp (+176/-0)
src/server/compositor/compositing_screencast.h (+74/-0)
src/server/compositor/default_configuration.cpp (+9/-21)
src/server/compositor/default_display_buffer_compositor.cpp (+2/-1)
src/server/compositor/gl_renderer.cpp (+56/-23)
src/server/compositor/gl_renderer.h (+6/-1)
src/server/compositor/gl_renderer_factory.cpp (+0/-8)
src/server/compositor/gl_renderer_factory.h (+0/-5)
src/server/compositor/multi_threaded_compositor.cpp (+1/-1)
src/server/compositor/renderer.h (+5/-1)
src/server/compositor/screencast_display_buffer.cpp (+110/-0)
src/server/compositor/screencast_display_buffer.h (+85/-0)
src/server/compositor/switching_bundle.cpp (+33/-7)
src/server/compositor/switching_bundle.h (+5/-1)
src/server/default_server_configuration.cpp (+15/-79)
src/server/frontend/CMakeLists.txt (+0/-9)
src/server/frontend/default_configuration.cpp (+4/-7)
src/server/frontend/published_socket_connector.cpp (+1/-41)
src/server/frontend/published_socket_connector.h (+0/-3)
src/server/frontend/session_mediator.cpp (+43/-2)
src/server/frontend/session_mediator_android.cpp (+0/-44)
src/server/frontend/session_mediator_mesa.cpp (+0/-68)
src/server/graphics/default_configuration.cpp (+23/-13)
src/server/graphics/nested/nested_display.cpp (+2/-1)
src/server/input/CMakeLists.txt (+0/-1)
src/server/input/android/android_input_window_handle.cpp (+1/-1)
src/server/input/default_configuration.cpp (+11/-7)
src/server/logging/CMakeLists.txt (+23/-0)
src/server/logging/default_configuration.cpp (+0/-108)
src/server/lttng/input_report_tp.c (+0/-4)
src/server/lttng/message_processor_report_tp.c (+0/-4)
src/server/report/CMakeLists.txt (+10/-0)
src/server/report/default_server_configuration.cpp (+119/-0)
src/server/report/logging/CMakeLists.txt (+2/-2)
src/server/report/logging/compositor_report.cpp (+18/-21)
src/server/report/logging/compositor_report.h (+18/-13)
src/server/report/logging/connector_report.cpp (+17/-16)
src/server/report/logging/connector_report.h (+11/-5)
src/server/report/logging/display_report.cpp (+57/-56)
src/server/report/logging/display_report.h (+11/-5)
src/server/report/logging/input_report.cpp (+16/-13)
src/server/report/logging/input_report.h (+12/-11)
src/server/report/logging/logging_report_factory.cpp (+75/-0)
src/server/report/logging/message_processor_report.cpp (+17/-16)
src/server/report/logging/message_processor_report.h (+12/-7)
src/server/report/logging/scene_report.cpp (+75/-82)
src/server/report/logging/scene_report.h (+17/-13)
src/server/report/logging/session_mediator_report.cpp (+45/-45)
src/server/report/logging/session_mediator_report.h (+14/-7)
src/server/report/logging_report_factory.h (+59/-0)
src/server/report/lttng/CMakeLists.txt (+9/-14)
src/server/report/lttng/compositor_report.cpp (+49/-0)
src/server/report/lttng/compositor_report.h (+52/-0)
src/server/report/lttng/compositor_report_tp.h (+76/-0)
src/server/report/lttng/connector_report.cpp (+65/-0)
src/server/report/lttng/connector_report.h (+58/-0)
src/server/report/lttng/connector_report_tp.h (+68/-0)
src/server/report/lttng/display_report.cpp (+57/-0)
src/server/report/lttng/display_report.h (+60/-0)
src/server/report/lttng/display_report_tp.h (+69/-0)
src/server/report/lttng/input_report.cpp (+7/-6)
src/server/report/lttng/input_report.h (+16/-12)
src/server/report/lttng/input_report_tp.h (+3/-16)
src/server/report/lttng/lttng_report_factory.cpp (+64/-0)
src/server/report/lttng/lttng_utils.h (+47/-0)
src/server/report/lttng/lttng_utils_pop.h (+22/-0)
src/server/report/lttng/message_processor_report.cpp (+27/-23)
src/server/report/lttng/message_processor_report.h (+8/-4)
src/server/report/lttng/message_processor_report_tp.h (+58/-22)
src/server/report/lttng/scene_report.cpp (+44/-0)
src/server/report/lttng/scene_report.h (+48/-0)
src/server/report/lttng/scene_report_tp.h (+59/-0)
src/server/report/lttng/server_tracepoint_provider.cpp (+2/-2)
src/server/report/lttng/server_tracepoint_provider.h (+5/-2)
src/server/report/lttng/session_mediator_report.cpp (+46/-0)
src/server/report/lttng/session_mediator_report.h (+53/-0)
src/server/report/lttng/session_mediator_report_tp.h (+68/-0)
src/server/report/lttng/tracepoints.c (+10/-0)
src/server/report/lttng_report_factory.h (+43/-0)
src/server/report/null/CMakeLists.txt (+12/-0)
src/server/report/null/compositor_report.cpp (+25/-25)
src/server/report/null/compositor_report.h (+46/-0)
src/server/report/null/connector_report.cpp (+31/-0)
src/server/report/null/connector_report.h (+50/-0)
src/server/report/null/display_report.cpp (+18/-18)
src/server/report/null/display_report.h (+25/-22)
src/server/report/null/input_report.cpp (+17/-17)
src/server/report/null/input_report.h (+11/-8)
src/server/report/null/message_processor_report.cpp (+26/-26)
src/server/report/null/message_processor_report.h (+10/-7)
src/server/report/null/null_report_factory.cpp (+92/-0)
src/server/report/null/scene_report.cpp (+36/-0)
src/server/report/null/scene_report.h (+51/-0)
src/server/report/null/session_mediator_report.cpp (+35/-35)
src/server/report/null/session_mediator_report.h (+64/-0)
src/server/report/null_report_factory.h (+51/-0)
src/server/report/report_factory.h (+72/-0)
src/server/scene/CMakeLists.txt (+0/-2)
src/server/scene/application_session.cpp (+4/-1)
src/server/scene/basic_surface.cpp (+155/-40)
src/server/scene/basic_surface.h (+62/-40)
src/server/scene/default_configuration.cpp (+1/-38)
src/server/scene/mutable_surface_state.h (+5/-5)
src/server/scene/session_manager.cpp (+2/-0)
src/server/scene/surface_allocator.cpp (+9/-7)
src/server/scene/surface_data.cpp (+0/-194)
src/server/scene/surface_data.h (+0/-82)
src/server/scene/surface_impl.cpp (+1/-1)
src/server/scene/surface_stack.cpp (+6/-6)
src/shared/CMakeLists.txt (+3/-2)
src/shared/graphics/android/CMakeLists.txt (+2/-0)
src/shared/report/lttng/tracepoint_provider.cpp (+3/-3)
src/shared/sharedlibrary/CMakeLists.txt (+19/-0)
src/shared/sharedlibrary/shared_library.cpp (+3/-3)
src/utils/screencast.cpp (+59/-43)
tests/CMakeLists.txt (+3/-2)
tests/acceptance-tests/test_client_authorization.cpp (+2/-0)
tests/acceptance-tests/test_client_input.cpp (+0/-5)
tests/acceptance-tests/test_nested_mir.cpp (+6/-1)
tests/acceptance-tests/test_server_shutdown.cpp (+4/-28)
tests/draw/CMakeLists.txt (+9/-7)
tests/draw/android_graphics_region_factory.cpp (+53/-47)
tests/draw/mesa_graphics_region_factory.cpp (+42/-0)
tests/integration-tests/CMakeLists.txt (+3/-2)
tests/integration-tests/client/CMakeLists.txt (+1/-1)
tests/integration-tests/client/test_client_render.cpp (+9/-10)
tests/integration-tests/compositor/test_swapping_swappers.cpp (+38/-36)
tests/integration-tests/frontend/test_application_mediator_report.cpp (+7/-1)
tests/integration-tests/graphics/android/test_buffer_integration.cpp (+6/-4)
tests/integration-tests/graphics/android/test_display_integration.cpp (+0/-1)
tests/integration-tests/graphics/android/test_internal_client.cpp (+5/-3)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+5/-2)
tests/integration-tests/input/CMakeLists.txt (+1/-1)
tests/integration-tests/input/android/test_android_cursor_listener.cpp (+4/-2)
tests/integration-tests/input/android/test_android_input_manager.cpp (+4/-3)
tests/integration-tests/test_session.cpp (+3/-18)
tests/integration-tests/test_surface_first_frame_sync.cpp (+2/-13)
tests/mir_test_doubles/CMakeLists.txt (+2/-2)
tests/mir_test_doubles/mock_drm.cpp (+7/-4)
tests/mir_test_doubles/mock_gl.cpp (+13/-0)
tests/mir_test_doubles/test_protobuf_socket_server.cpp (+5/-4)
tests/mir_test_framework/stubbed_server_configuration.cpp (+17/-28)
tests/mir_test_framework/testing_client_options.cpp (+2/-2)
tests/mir_test_framework/udev_environment.cpp (+28/-14)
tests/unit-tests/CMakeLists.txt (+3/-0)
tests/unit-tests/android_input/input_reader.cpp (+7/-7)
tests/unit-tests/client/CMakeLists.txt (+2/-2)
tests/unit-tests/client/android/test_android_client_platform.cpp (+3/-3)
tests/unit-tests/client/mesa/test_client_platform.cpp (+5/-5)
tests/unit-tests/client/mesa/test_native_surface.cpp (+20/-0)
tests/unit-tests/client/test_client_platform.cpp (+8/-11)
tests/unit-tests/client/test_mir_connection.cpp (+8/-0)
tests/unit-tests/compositor/CMakeLists.txt (+2/-0)
tests/unit-tests/compositor/test_compositing_screencast.cpp (+281/-0)
tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+28/-15)
tests/unit-tests/compositor/test_gl_renderer.cpp (+4/-5)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+3/-2)
tests/unit-tests/compositor/test_rendering_operator.cpp (+2/-2)
tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+169/-0)
tests/unit-tests/frontend/CMakeLists.txt (+2/-2)
tests/unit-tests/frontend/test_published_socket_connector.cpp (+6/-27)
tests/unit-tests/frontend/test_session_mediator.cpp (+3/-2)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+3/-1)
tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+7/-4)
tests/unit-tests/graphics/CMakeLists.txt (+2/-2)
tests/unit-tests/graphics/android/test_android_fb.cpp (+23/-52)
tests/unit-tests/graphics/android/test_android_platform.cpp (+4/-3)
tests/unit-tests/graphics/android/test_fb_device.cpp (+11/-5)
tests/unit-tests/graphics/android/test_hwc_common_device.cpp (+14/-34)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+2/-0)
tests/unit-tests/graphics/android/test_hwc_display.cpp (+146/-26)
tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+173/-54)
tests/unit-tests/graphics/android/test_hwc_layers.cpp (+161/-127)
tests/unit-tests/graphics/android/test_output_builder.cpp (+29/-37)
tests/unit-tests/graphics/mesa/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/mesa/mock_kms_output.h (+52/-0)
tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp (+4/-3)
tests/unit-tests/graphics/mesa/test_cursor.cpp (+2/-19)
tests/unit-tests/graphics/mesa/test_display.cpp (+24/-24)
tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+74/-11)
tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+4/-3)
tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+14/-5)
tests/unit-tests/graphics/mesa/test_drm_helper.cpp (+65/-0)
tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp (+4/-3)
tests/unit-tests/graphics/mesa/test_internal_client.cpp (+1/-1)
tests/unit-tests/graphics/mesa/test_kms_page_flipper.cpp (+1/-1)
tests/unit-tests/graphics/mesa/test_linux_virtual_terminal.cpp (+10/-9)
tests/unit-tests/graphics/mesa/test_platform.cpp (+12/-9)
tests/unit-tests/graphics/offscreen/test_offscreen_display.cpp (+8/-6)
tests/unit-tests/graphics/test_display.cpp (+4/-3)
tests/unit-tests/graphics/test_graphics_platform.cpp (+5/-13)
tests/unit-tests/input/android/test_android_input_registrar.cpp (+1/-1)
tests/unit-tests/input/android/test_android_input_window_handle.cpp (+1/-1)
tests/unit-tests/logging/message_processor_report.cpp (+2/-2)
tests/unit-tests/logging/test_compositor_report.cpp (+4/-4)
tests/unit-tests/logging/test_display_report.cpp (+3/-2)
tests/unit-tests/logging/test_legacy_input_report.cpp (+4/-4)
tests/unit-tests/scene/CMakeLists.txt (+1/-1)
tests/unit-tests/scene/test_application_session.cpp (+67/-18)
tests/unit-tests/scene/test_basic_surface.cpp (+146/-37)
tests/unit-tests/scene/test_surface.cpp (+155/-35)
tests/unit-tests/scene/test_surface_impl.cpp (+8/-8)
tests/unit-tests/scene/test_surface_stack.cpp (+54/-34)
tests/unit-tests/test_udev_wrapper.cpp (+70/-0)
tools/install_on_android.sh (+1/-0)
tools/setup-partial-armhf-chroot.sh (+42/-72)
tools/valgrind_suppressions_armhf (+111/-0)
To merge this branch: bzr merge lp:~mir-team/mir/trunk-0.1.6
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Mir development team Pending
Review via email: mp+208717@code.launchpad.net

Commit message

Latest upstream release of Mir 0.1.6 (lp:~mir-team/mir/development-branch r1433)

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The diff to tagged release 0.1.6 is good. Only changelog differs.

Only mentions of last minute bugs are missing from changelog:
  bug 1285955
  bug 1207312

I would also recommend not cluttering the changelog with details of internal changes that users of Mir won't ever need to understand. e.g. All but one of these are meaningless to the public Mir SDK so should not be mentioned;

396 + - config, frontend: remove force_threads_to_unblock_callback()
397 + - Protect input region member of surface data, hold mutex to access
398 + hidden member.
399 + - config: ConfigurationOptions::default_ipc_threads can be a constant.
400 + - debian: Provide platform packages managed with dpkg alternatives.
401 + - Add the ability to load device traces, both udev and ioctls, in the
402 + UdevEnvironment test helper.
403 + - test_client_input.cpp: Remove unused global "mir_test_socket".
404 + - Sundry improvements to mir::udev.

That's not all. I just picked it as an example. Only line 400 would qualify as meaningful to anyone else, so release notable.

review: Needs Fixing
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
kevin gunn (kgunn72) wrote :

wasn't sure to include bug 1285955 as fixed, as the mp is more of a temp workaround - but i'll include that.

I'm torn about condensing the changelog - i prefer the detail. But, happy to conform to convention.
I'll take one more scrub, but then let's move on getting this in.

> The diff to tagged release 0.1.6 is good. Only changelog differs.
>
> Only mentions of last minute bugs are missing from changelog:
> bug 1285955
> bug 1207312
>
> I would also recommend not cluttering the changelog with details of internal
> changes that users of Mir won't ever need to understand. e.g. All but one of
> these are meaningless to the public Mir SDK so should not be mentioned;
>
> 396 + - config, frontend: remove force_threads_to_unblock_callback()
> 397 + - Protect input region member of surface data, hold mutex to
> access
> 398 + hidden member.
> 399 + - config: ConfigurationOptions::default_ipc_threads can be a
> constant.
> 400 + - debian: Provide platform packages managed with dpkg
> alternatives.
> 401 + - Add the ability to load device traces, both udev and ioctls, in
> the
> 402 + UdevEnvironment test helper.
> 403 + - test_client_input.cpp: Remove unused global "mir_test_socket".
> 404 + - Sundry improvements to mir::udev.
>
> That's not all. I just picked it as an example. Only line 400 would qualify as
> meaningful to anyone else, so release notable.

Revision history for this message
kevin gunn (kgunn72) wrote :

Did you test your feature/code change/bug fix ? what device(s) ?
dev branch ci testing across i386, amd64 & arm/nexus4

Did you break mir server API or ABI and have the relevant bumps to .so and debian docs been made ?
yes - libmirserver, updates have been made

Did you break mir client API or ABI and have you followed up with the known clients & announced on mir-devel mailing list ?
yes

Don't forget to check on Xorg in the case of client API break
does not break Xorg/xmir

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
Daniel van Vugt (vanvugt) wrote :

For bug 1285955 the "workaround" is the closest thing to a fix the Mir project will ever need. So that's definitely Fix Released for Mir in 0.1.6.

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

I think the last commit should be reverted ("updated snapshot from mir-devel r1441"). Mir 0.1.6 is r1433. Nothing newer than that should be included until it's cooled down a bit as part of the 0.1.7 cycle.

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

The post-0.1.6 changes I intentionally kept out of 0.1.6 because they're large and still carry some risk. So I'll keep those back to the 0.1.7 release.

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

I don't quite understand how CI approved the same code (repeatedly) in development-branch but it doesn't pass here. I can only imagine it's CI that changed.

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

The first Jenkins failure is bug 1287600. A fix has now been proposed for that :P

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
Daniel van Vugt (vanvugt) wrote :

Cleaned up. Now the branch contains exactly what the changelog says:

Mir 0.1.6
+ Two cherry picks from Mir 0.1.7 (one enhancement + one bug fix)
+ changelog additions.

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

We should stop adding bits of Mir 0.1.7. There are large changes post-0.1.6 (that I wrote even) and it's safest if we let them cool down and mature some more over the weeks before entering distro.

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

you should not be landing anything on devel you would not instantly want in archive.
devel has been treated as sacred, devel was only created as a barrier for server changes. if you need to mature items, keep a feature branch and ask for testing help.

> We should stop adding bits of Mir 0.1.7. There are large changes post-0.1.6
> (that I wrote even) and it's safest if we let them cool down and mature some
> more over the weeks before entering distro.

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

Feature branches are the opposite of maturing code. In a feature branch, no one other than the author is using it on a daily basis. So the maturation (testing by multiple people) never even begins.

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

The diff still looks correct, and accurately reflected in debian/changelog.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-02-06 17:55:08 +0000
3+++ CMakeLists.txt 2014-03-06 14:19:43 +0000
4@@ -28,9 +28,14 @@
5
6 set(MIR_VERSION_MAJOR 0)
7 set(MIR_VERSION_MINOR 1)
8-set(MIR_VERSION_PATCH 5)
9+set(MIR_VERSION_PATCH 6)
10
11 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
12+execute_process(
13+ COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
14+ OUTPUT_VARIABLE TARGET_ARCH
15+ OUTPUT_STRIP_TRAILING_WHITESPACE
16+)
17
18 option(use_debflags "Use build flags from dpkg-buildflags." OFF)
19 if(use_debflags)
20@@ -87,15 +92,28 @@
21 )
22 endif(MIR_DISABLE_EPOLL_REACTOR)
23
24+add_definitions(-DMESA_EGL_NO_X11_HEADERS)
25+
26 # Default to mesa backend
27 set(
28 MIR_PLATFORM
29 mesa
30 CACHE
31 STRING
32- "graphics backend to build (options are 'mesa' or 'android')"
33+ "a list of graphics backends to build (options are 'mesa' or 'android')"
34 )
35
36+list(GET MIR_PLATFORM 0 MIR_TEST_PLATFORM)
37+
38+foreach(platform IN LISTS MIR_PLATFORM)
39+ if (platform STREQUAL "mesa")
40+ set(MIR_BUILD_PLATFORM_MESA TRUE)
41+ endif()
42+ if (platform STREQUAL "android")
43+ set(MIR_BUILD_PLATFORM_ANDROID TRUE)
44+ endif()
45+endforeach(platform)
46+
47 find_package(EGL REQUIRED)
48 find_package(GLESv2 REQUIRED)
49 find_package(GLM REQUIRED)
50@@ -110,24 +128,14 @@
51 include_directories (${EGL_INCLUDE_DIRS})
52 include_directories (${GLM_INCLUDE_DIRS})
53
54-if (MIR_PLATFORM STREQUAL "android")
55-
56- #android headers use 'int foo[0]' as struct members
57- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
58-
59- add_definitions( -DANDROID )
60-
61+if (MIR_BUILD_PLATFORM_ANDROID)
62 find_package(LibHardware REQUIRED)
63+endif()
64
65- #ctest does not work for android, so turn test discovery off
66- set(DISABLE_GTEST_TEST_DISCOVERY ON)
67-elseif (MIR_PLATFORM STREQUAL "mesa")
68+if (MIR_BUILD_PLATFORM_MESA)
69 find_package( PkgConfig )
70 pkg_check_modules( GBM REQUIRED gbm>=9.0.0)
71 pkg_check_modules( DRM REQUIRED libdrm )
72- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GBM__")
73-else ()
74- message (FATAL_ERROR "MIR_BACKEND must be either 'android' or 'mesa'")
75 endif()
76
77 set(MIR_ANDROID_INCLUDE_DIRECTORIES) # to be filled by android-input
78
79=== modified file 'cmake/FindXKBCOMMON.cmake'
80--- cmake/FindXKBCOMMON.cmake 2013-04-10 18:09:31 +0000
81+++ cmake/FindXKBCOMMON.cmake 2014-03-06 14:19:43 +0000
82@@ -3,13 +3,8 @@
83 find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h
84 HINTS ${PC_XKBCOMMON_INCLUDEDIR} ${PC_XKBCOMMON_INCLUDE_DIRS})
85
86-if (MIR_PLATFORM STREQUAL "android")
87-find_library(XKBCOMMON_LIBRARY libxkbcommon.so
88- HINTS /usr/lib/arm-linux-gnueabihf/)
89-else()
90 find_library(XKBCOMMON_LIBRARY xkbcommon
91 HINTS ${PC_XKBCOMMON_LIBDIR} ${PC_XKBCOMMON_LIBRARY_DIRS})
92-endif()
93
94 set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
95 set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
96@@ -20,4 +15,4 @@
97 find_package_handle_standard_args(XKBCOMMON DEFAULT_MSG
98 XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR)
99
100-mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY)
101\ No newline at end of file
102+mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY)
103
104=== modified file 'cmake/MirCommon.cmake'
105--- cmake/MirCommon.cmake 2014-01-16 04:00:01 +0000
106+++ cmake/MirCommon.cmake 2014-03-06 14:19:43 +0000
107@@ -22,15 +22,12 @@
108 valgrind)
109
110 if(VALGRIND_EXECUTABLE)
111- if(MIR_PLATFORM STREQUAL "android")
112- # don't exit with an error when valgrind find errors
113- #set(VALGRIND_ARGS "--error-exitcode=1")
114- else()
115- set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes")
116+ set(VALGRIND_ARGS "--error-exitcode=1" "--trace-children=yes")
117+ set(DISCOVER_FLAGS "--enable-memcheck")
118+ if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf")
119+ set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
120+ set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
121 endif()
122-
123- set(ENABLE_MEMCHECK_FLAG "--enable-memcheck")
124-
125 else(VALGRIND_EXECUTABLE)
126 message("Not enabling memcheck as valgrind is missing on your system")
127 endif(VALGRIND_EXECUTABLE)
128@@ -63,7 +60,7 @@
129
130 add_custom_target(
131 ${TEST_DISCOVERY_TARGET_NAME} ALL
132- ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --gtest_list_tests | ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} ${ENABLE_MEMCHECK_FLAG}
133+ ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --gtest_list_tests | ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} ${DISCOVER_FLAGS}
134 ${EXTRA_ENV_FLAGS}
135 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
136 COMMENT "Discovering Tests in ${EXECUTABLE}" VERBATIM)
137@@ -89,7 +86,7 @@
138 else()
139 add_custom_target(
140 memcheck_test ALL
141- ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error --memcheck-test
142+ ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error --memcheck-test ${DISCOVER_FLAGS}
143 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
144 COMMENT "Adding memcheck test" VERBATIM)
145
146
147=== modified file 'cmake/src/mir/mir_discover_gtest_tests.cpp'
148--- cmake/src/mir/mir_discover_gtest_tests.cpp 2013-07-01 06:29:43 +0000
149+++ cmake/src/mir/mir_discover_gtest_tests.cpp 2014-03-06 14:19:43 +0000
150@@ -58,26 +58,34 @@
151 return pattern;
152 }
153
154-vector<string> valgrind_cmd_patterns()
155+vector<string> valgrind_cmd_patterns(vector<string> const& suppressions)
156 {
157 vector<string> patterns{
158 "valgrind",
159 "--error-exitcode=1",
160- "--trace-children=yes",
161+ "--trace-children=yes"
162+ };
163+
164+ for (auto const& sup : suppressions)
165+ patterns.push_back(std::string("--suppressions=") + sup);
166+
167+ vector<string> gtest_patterns{
168 "%s",
169 "--gtest_death_test_use_fork",
170 "--gtest_filter=%s"
171 };
172
173+ patterns.insert(patterns.end(), gtest_patterns.begin(), gtest_patterns.end());
174+
175 return patterns;
176 }
177
178-string memcheck_cmd_line_pattern()
179+string memcheck_cmd_line_pattern(vector<string> const& suppressions)
180 {
181 stringstream ss;
182
183 ss << "ADD_TEST(\"memcheck(%s.%s)\"";
184- for (auto& s : valgrind_cmd_patterns())
185+ for (auto& s : valgrind_cmd_patterns(suppressions))
186 ss << " \"" << s << "\"";
187 ss << ")" << endl;
188
189@@ -112,6 +120,7 @@
190 bool enable_memcheck;
191 bool memcheck_test;
192 std::vector<std::pair<std::string, std::string>> extra_environment;
193+ std::vector<std::string> suppressions;
194 };
195
196 bool parse_configuration_from_cmd_line(int argc, char** argv, Configuration& config)
197@@ -121,6 +130,7 @@
198 {"enable-memcheck", no_argument, 0, 0},
199 {"memcheck-test", no_argument, 0, 0},
200 {"add-environment", required_argument, 0, 0},
201+ {"suppressions", required_argument, 0, 0},
202 {0, 0, 0, 0}
203 };
204
205@@ -161,17 +171,21 @@
206 return false;
207 config.extra_environment.push_back(std::make_pair(std::string(optarg, equal_pos - optarg), std::string(equal_pos + 1)));
208 }
209+ else if (!strcmp(optname, "suppressions"))
210+ {
211+ config.suppressions.push_back(std::string(optarg));
212+ }
213 }
214
215 return true;
216 }
217
218-string prepareMemcheckTestLine(string const& exe)
219+string prepareMemcheckTestLine(string const& exe, vector<string> const& suppressions)
220 {
221 stringstream ss;
222
223 ss << "ADD_TEST(\"memcheck-test\" \"sh\" \"-c\" \"";
224- for (auto& s : valgrind_cmd_patterns())
225+ for (auto& s : valgrind_cmd_patterns(suppressions))
226 ss << s << " ";
227 ss << "; if [ $? != 0 ]; then exit 0; else exit 1; fi\")";
228
229@@ -186,13 +200,13 @@
230 return cmd_line;
231 }
232
233-void emitMemcheckTest(string const& exe)
234+void emitMemcheckTest(string const& exe, vector<string> const& suppressions)
235 {
236 ifstream CTestTestfile("CTestTestfile.cmake", ifstream::in);
237 bool need_memcheck_test = true;
238 string line;
239
240- string memcheckTestLine = prepareMemcheckTestLine(exe);
241+ string memcheckTestLine = prepareMemcheckTestLine(exe, suppressions);
242
243 if (CTestTestfile.is_open())
244 {
245@@ -238,7 +252,7 @@
246
247 if (config.memcheck_test)
248 {
249- emitMemcheckTest(config.executable);
250+ emitMemcheckTest(config.executable, config.suppressions);
251 return 0;
252 }
253
254@@ -277,7 +291,7 @@
255 snprintf(
256 cmd_line,
257 sizeof(cmd_line),
258- config.enable_memcheck ? memcheck_cmd_line_pattern().c_str() :
259+ config.enable_memcheck ? memcheck_cmd_line_pattern(config.suppressions).c_str() :
260 ordinary_cmd_line_pattern().c_str(),
261 test_suite.c_str(),
262 elide_string_left(*test, output_width/2).c_str(),
263
264=== modified file 'cross-compile-chroot.sh'
265--- cross-compile-chroot.sh 2014-01-22 08:32:55 +0000
266+++ cross-compile-chroot.sh 2014-03-06 14:19:43 +0000
267@@ -1,27 +1,69 @@
268 #!/bin/bash
269-# build script for Mir on android arm devices
270+# build script to compile Mir for armhf devices
271 #
272 set -e
273
274+usage() {
275+ echo "usage: $(basename $0) [-c] [-u]"
276+ echo "-c clean before building"
277+ echo "-u update partial chroot directory"
278+ echo "-h this message"
279+}
280+
281+clean_build_dir() {
282+ rm -rf ${1}
283+ mkdir ${1}
284+}
285+
286 BUILD_DIR=build-android-arm
287-NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
288-
289-if [ "$MIR_NDK_PATH" = "" ]; then
290- export MIR_NDK_PATH=`pwd`/partial-armhf-chroot
291- if [ ! -d ${MIR_NDK_PATH} ]; then
292- echo "no partial root specified or detected. attempting to create one"
293- fi
294-fi
295-
296-pushd tools > /dev/null
297- ./setup-partial-armhf-chroot.sh ${MIR_NDK_PATH}
298-popd > /dev/null
299-
300-echo "Using MIR_NDK_PATH: $MIR_NDK_PATH"
301-
302-#start with a clean build every time
303-rm -rf ${BUILD_DIR}
304-mkdir ${BUILD_DIR}
305+NUM_JOBS=$(( $(grep -c ^processor /proc/cpuinfo) + 1 ))
306+_do_update_chroot=0
307+
308+while getopts "cuh" OPTNAME
309+do
310+ case $OPTNAME in
311+ c )
312+ clean_build_dir ${BUILD_DIR}
313+ ;;
314+ u )
315+ _do_update_chroot=1
316+ ;;
317+ h )
318+ usage
319+ exit 0
320+ ;;
321+ * )
322+ echo "invalid option specified"
323+ usage
324+ exit 1
325+ ;;
326+ esac
327+done
328+
329+
330+if [ "${MIR_NDK_PATH}" = "" ]; then
331+ export MIR_NDK_PATH=$(pwd)/partial-armhf-chroot
332+fi
333+
334+if [ ! -d ${MIR_NDK_PATH} ]; then
335+ echo "no partial chroot dir detected. attempting to create one"
336+ _do_update_chroot=1
337+fi
338+
339+if [ ! -d ${BUILD_DIR} ]; then
340+ mkdir ${BUILD_DIR}
341+fi
342+
343+if [ ${_do_update_chroot} -eq 1 ] ; then
344+ pushd tools > /dev/null
345+ ./setup-partial-armhf-chroot.sh ${MIR_NDK_PATH}
346+ popd > /dev/null
347+ # force a clean build after an update, since CMake cache maybe out of date
348+ clean_build_dir ${BUILD_DIR}
349+fi
350+
351+echo "Using MIR_NDK_PATH: ${MIR_NDK_PATH}"
352+
353 pushd ${BUILD_DIR} > /dev/null
354
355 export PKG_CONFIG_PATH="${MIR_NDK_PATH}/usr/lib/pkgconfig:${MIR_NDK_PATH}/usr/lib/arm-linux-gnueabihf/pkgconfig"
356@@ -33,9 +75,9 @@
357 echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE"
358 cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \
359 -DBoost_COMPILER=-gcc \
360- -DMIR_PLATFORM=android \
361+ -DMIR_PLATFORM=android\;mesa \
362 ..
363
364- cmake --build . -- -j${NUM_JOBS}
365+ make -j${NUM_JOBS}
366
367-popd ${BUILD_DIR} > /dev/null
368+popd > /dev/null
369
370=== modified file 'debian/changelog'
371--- debian/changelog 2014-02-12 18:29:30 +0000
372+++ debian/changelog 2014-03-06 14:19:43 +0000
373@@ -1,3 +1,71 @@
374+mir (0.1.6-0ubuntu1) UNRELEASED; urgency=medium
375+
376+ * Cherry-picked from future release 0.1.7:
377+ - Enhancement: options: Make it easier to customize DefaultConfiguration
378+ - Bug fix: Don't pass a parameter to bash's popd command. It doesn't expect
379+ one and will return an error from cross-compile-chroot.sh. (LP: #1287600)
380+ * New upstream release 0.1.6 (https://launchpad.net/mir/+milestone/0.1.6)
381+ - mirserver ABI bumped to 16.
382+ - Server API changes:
383+ . Report classes have moved to new namespaces/components. Please
384+ consult the server headers.
385+ . General clean-ups and virtual function changes affecting the ABI
386+ (a rebuild is required for all shells).
387+ - mirclient ABI unchanged, still at 7. Clients do not need rebuilding.
388+ - Add new feature: Screen recording ("screencasting") as demonstrated by
389+ the new mir-util "mirscreencast".
390+ - debian: Provide platform packages managed with dpkg alternatives.
391+ - Add new valgrind suppressions (mostly for armhf right now)
392+ - tools: Add new libmirclientplatform.so to install_on_android.sh.
393+ - Add "mir_demo_standalone_render_overlays", which is a free-standing
394+ example of overlay support.
395+ - Proper DisplayConfiguration for the AndroidDisplay to be better
396+ prepared for multi-monitor Android.
397+ - Commenced/continued simplifying the surface class hierarchy: BasicSurface
398+ has now absorbed SurfaceData.
399+ - Dynamically load the client platform library.
400+ - Bugs fixed:
401+ . Exceptions thrown from within compositing threads were untraceable,
402+ resulting in a bunch of undebuggable crash reports (LP: #1237332)
403+ . Ensure we close drm device file descriptors on exec. (LP: #1284081)
404+ . nested render_surfaces fails on N4 [std::exception::what: Failed to
405+ compile vertex shader:] (LP: #1284597)
406+ . examples: correct "fullscreen-surfaces" option. (LP: #1284554)
407+ . Fix mutex data race reported by helgrind in integration test:
408+ SwapperSwappingStress (LP: #1282886)
409+ . scene: Return null snapshots for sessions without surfaces
410+ (LP: #1281728)
411+ . tests: Address some raciness in
412+ MesaDisplayTest.drm_device_change_event_triggers_handler.
413+ (LP: #1283085)
414+ . tests: Suppress spurious memory errors occuring when running the
415+ unit tests on armhf with valgrind. (LP: #1279438)
416+ . Mir shows an old frame on client startup (for Mesa GL clients)
417+ (LP: #1281938)
418+ . tests: Add expectation to validate second SessionAuthorizer method
419+ is called wit correct parameter. (LP: #1218436)
420+ . Set field "current_format" when sending a display config to the
421+ server. (LP: #1277343)
422+ . Fix crash in android devices by working around a subtle threading
423+ bug, use a dummy thead_local array to push the gl/egl context TLS
424+ into a region where the future wait code does not overwrite it.
425+ (LP: #1280086)
426+ . compositor: calling SwitchingBundle::force_requests_to_complete()
427+ can be a no-op when there are no requests. (LP: #1281145)
428+ . tests: Don't emit an "add" uevent manually when adding a device
429+ (LP: #1281146)
430+ . config: reduce size of default RPC thread pool. (LP: #1233001)
431+ . Clients freeze on startup if 10 or more are already running
432+ (LP: #1267323)
433+ . Fix Nexus 10 leaking FDs in the hwc prepare/set loop. (LP: #1278658)
434+ . Parallelize page flipping with rendering of the next frame, fixing
435+ stuttering observed in multi-monitor clone mode (LP: #1213801)
436+ . Ubuntu trusty update "glm 0.9.5.1-1" broke Mir builds. Work around the
437+ change. (LP: #1285955)
438+ . Screencast feature by compositing to offscreen buffer (LP: #1207312)
439+
440+ -- Kevin Gunn <kevin.gunn@canonical.com> Thu, 27 Feb 2014 19:37:47 -0600
441+
442 mir (0.1.5+14.04.20140212-0ubuntu1) trusty; urgency=medium
443
444 [ Kevin Gunn ]
445
446=== modified file 'debian/control'
447--- debian/control 2014-02-06 17:55:08 +0000
448+++ debian/control 2014-03-06 14:19:43 +0000
449@@ -19,20 +19,20 @@
450 libboost-regex-dev,
451 libboost-filesystem-dev,
452 protobuf-compiler,
453- libdrm-dev [!armhf],
454+ libdrm-dev,
455 libegl1-mesa-dev,
456 libgles2-mesa-dev,
457- libgbm-dev [!armhf],
458+ libgbm-dev,
459 libglm-dev,
460 libprotobuf-dev,
461 pkg-config,
462- android-headers (>=4.2.2) [armhf],
463- libhardware-dev [armhf],
464+ android-headers (>=4.2.2) [i386 amd64 armhf],
465+ libhardware-dev [i386 amd64 armhf],
466 libgoogle-glog-dev,
467 liblttng-ust-dev,
468 libxkbcommon-dev,
469- libumockdev-dev [!armhf],
470- umockdev [!armhf],
471+ libumockdev-dev,
472+ umockdev,
473 libudev-dev,
474 google-mock (>= 1.6.0+svn437),
475 valgrind [!arm64],
476@@ -70,7 +70,7 @@
477 .
478 Contains the protocol's definition files.
479
480-Package: libmirserver15
481+Package: libmirserver16
482 Section: libs
483 Architecture: i386 amd64 armhf arm64
484 Multi-Arch: same
485@@ -78,6 +78,8 @@
486 Depends: ${misc:Depends},
487 ${shlibs:Depends},
488 libmirplatform (= ${binary:Version}),
489+ libmirplatformgraphics-mesa (= ${binary:Version}) |
490+ libmirplatformgraphics-android (= ${binary:Version}),
491 Description: Display server for Ubuntu - server library
492 Mir is a display server running on linux systems, with a focus on efficiency,
493 robust operation and a well-defined driver model.
494@@ -99,6 +101,36 @@
495 Contains the shared libraries required for the Mir server to interact with
496 the underlying hardware platform.
497
498+Package: libmirplatformgraphics-mesa
499+Section: libs
500+Architecture: i386 amd64 armhf arm64
501+Multi-Arch: same
502+Pre-Depends: ${misc:Pre-Depends}
503+Depends: ${misc:Depends},
504+ ${shlibs:Depends},
505+ libmirplatform (= ${binary:Version}),
506+Description: Display server for Ubuntu - platform library for Mesa
507+ Mir is a display server running on linux systems, with a focus on efficiency,
508+ robust operation and a well-defined driver model.
509+ .
510+ Contains the shared libraries required for the Mir server to interact with
511+ the hardware platform using the Mesa drivers.
512+
513+Package: libmirplatformgraphics-android
514+Section: libs
515+Architecture: i386 amd64 armhf
516+Multi-Arch: same
517+Pre-Depends: ${misc:Pre-Depends}
518+Depends: ${misc:Depends},
519+ ${shlibs:Depends},
520+ libmirplatform (= ${binary:Version}),
521+Description: Display server for Ubuntu - platform library for Android
522+ Mir is a display server running on linux systems, with a focus on efficiency,
523+ robust operation and a well-defined driver model.
524+ .
525+ Contains the shared libraries required for the Mir server to interact with
526+ the hardware platform using the Android drivers.
527+
528 Package: mircommon-dev
529 Section: libdevel
530 Architecture: i386 amd64 armhf arm64
531@@ -116,7 +148,7 @@
532 Architecture: i386 amd64 armhf arm64
533 Multi-Arch: same
534 Pre-Depends: ${misc:Pre-Depends}
535-Depends: libmirserver15 (= ${binary:Version}),
536+Depends: libmirserver16 (= ${binary:Version}),
537 libmirprotobuf-dev (= ${binary:Version}),
538 mircommon-dev (= ${binary:Version}),
539 libglm-dev,
540@@ -135,6 +167,8 @@
541 Pre-Depends: ${misc:Pre-Depends}
542 Depends: ${misc:Depends},
543 ${shlibs:Depends},
544+ libmirclientplatform-mesa (= ${binary:Version}) |
545+ libmirclientplatform-android (= ${binary:Version}),
546 Description: Display server for Ubuntu - client library
547 Mir is a display server running on linux systems, with a focus on efficiency,
548 robust operation and a well-defined driver model.
549@@ -156,6 +190,36 @@
550 .
551 Contains header files required to develop against Mir.
552
553+Package: libmirclientplatform-mesa
554+Section: libs
555+Architecture: i386 amd64 armhf arm64
556+Multi-Arch: same
557+Pre-Depends: ${misc:Pre-Depends}
558+Depends: ${misc:Depends},
559+ ${shlibs:Depends}
560+Replaces: libmirclientplatform
561+Description: Display server for Ubuntu - client platform library for Mesa
562+ Mir is a display server running on linux systems, with a focus on efficiency,
563+ robust operation and a well-defined driver model.
564+ .
565+ Contains the shared libraries required for the Mir clients to interact with
566+ the underlying hardware platform using the Mesa drivers.
567+
568+Package: libmirclientplatform-android
569+Section: libs
570+Architecture: i386 amd64 armhf
571+Multi-Arch: same
572+Pre-Depends: ${misc:Pre-Depends}
573+Depends: ${misc:Depends},
574+ ${shlibs:Depends}
575+Replaces: libmirclientplatform
576+Description: Display server for Ubuntu - client platform library for Android
577+ Mir is a display server running on linux systems, with a focus on efficiency,
578+ robust operation and a well-defined driver model.
579+ .
580+ Contains the shared libraries required for the Mir clients to interact with
581+ the underlying hardware platform using the Android drivers.
582+
583 Package: mir-demos
584 Architecture: i386 amd64 armhf arm64
585 Depends: ${misc:Depends},
586
587=== added file 'debian/create_postinst_prerm_scripts.sh'
588--- debian/create_postinst_prerm_scripts.sh 1970-01-01 00:00:00 +0000
589+++ debian/create_postinst_prerm_scripts.sh 2014-03-06 14:19:43 +0000
590@@ -0,0 +1,30 @@
591+#!/bin/sh
592+
593+set -e
594+
595+mir_platform_types="platformgraphics clientplatform"
596+mir_platforms="android mesa"
597+dpkg_alternatives_priority=500
598+deb_host_multiarch=$1
599+
600+create_script()
601+{
602+ local script=$1
603+ local platform_type=$2
604+ local platform=$3
605+
606+ sed -e "s/@DEB_HOST_MULTIARCH@/$deb_host_multiarch/" \
607+ -e "s/@MIR_PLATFORM_TYPE@/$platform_type/" \
608+ -e "s/@MIR_PLATFORM@/$platform/" \
609+ -e "s/@DPKG_ALTERNATIVES_PRIORITY@/$dpkg_alternatives_priority/" \
610+ debian/update-alternatives.${script}.in > debian/libmir$platform_type-$platform.${script}
611+}
612+
613+for platform_type in $mir_platform_types;
614+do
615+ for platform in $mir_platforms;
616+ do
617+ create_script postinst $platform_type $platform
618+ create_script prerm $platform_type $platform
619+ done
620+done
621
622=== added file 'debian/install_ld_so_conf.sh'
623--- debian/install_ld_so_conf.sh 1970-01-01 00:00:00 +0000
624+++ debian/install_ld_so_conf.sh 2014-03-06 14:19:43 +0000
625@@ -0,0 +1,18 @@
626+#!/bin/sh
627+
628+set -e
629+
630+mir_platform_types="platformgraphics clientplatform"
631+mir_platforms="android mesa"
632+
633+DEB_HOST_MULTIARCH=$1
634+
635+for platform_type in $mir_platform_types;
636+do
637+ for platform in $mir_platforms;
638+ do
639+ platform_dir="/usr/lib/$DEB_HOST_MULTIARCH/mir/$platform_type/$platform"
640+ package_dir="debian/libmir$platform_type-$platform/$platform_dir"
641+ echo "$platform_dir" > $package_dir/ld.so.conf
642+ done
643+done
644
645=== added file 'debian/libmirclientplatform-android.install'
646--- debian/libmirclientplatform-android.install 1970-01-01 00:00:00 +0000
647+++ debian/libmirclientplatform-android.install 2014-03-06 14:19:43 +0000
648@@ -0,0 +1,1 @@
649+usr/lib/*/mir/clientplatform/android/*
650
651=== added file 'debian/libmirclientplatform-mesa.install'
652--- debian/libmirclientplatform-mesa.install 1970-01-01 00:00:00 +0000
653+++ debian/libmirclientplatform-mesa.install 2014-03-06 14:19:43 +0000
654@@ -0,0 +1,1 @@
655+usr/lib/*/mir/clientplatform/mesa/*
656
657=== modified file 'debian/libmirplatform.install'
658--- debian/libmirplatform.install 2013-08-09 03:54:38 +0000
659+++ debian/libmirplatform.install 2014-03-06 14:19:43 +0000
660@@ -1,2 +1,1 @@
661 usr/lib/*/libmirplatform.so
662-usr/lib/*/libmirplatformgraphics.so
663
664=== added file 'debian/libmirplatformgraphics-android.install'
665--- debian/libmirplatformgraphics-android.install 1970-01-01 00:00:00 +0000
666+++ debian/libmirplatformgraphics-android.install 2014-03-06 14:19:43 +0000
667@@ -0,0 +1,1 @@
668+usr/lib/*/mir/platformgraphics/android/*
669
670=== added file 'debian/libmirplatformgraphics-mesa.install'
671--- debian/libmirplatformgraphics-mesa.install 1970-01-01 00:00:00 +0000
672+++ debian/libmirplatformgraphics-mesa.install 2014-03-06 14:19:43 +0000
673@@ -0,0 +1,1 @@
674+usr/lib/*/mir/platformgraphics/mesa/*
675
676=== renamed file 'debian/libmirserver15.install' => 'debian/libmirserver16.install'
677--- debian/libmirserver15.install 2014-02-06 17:55:08 +0000
678+++ debian/libmirserver16.install 2014-03-06 14:19:43 +0000
679@@ -1,1 +1,1 @@
680-usr/lib/*/libmirserver.so.15
681+usr/lib/*/libmirserver.so.16
682
683=== modified file 'debian/rules'
684--- debian/rules 2014-02-04 09:23:51 +0000
685+++ debian/rules 2014-03-06 14:19:43 +0000
686@@ -21,19 +21,29 @@
687 ifeq ($(DEB_HOST_ARCH),armhf)
688 dh_auto_configure -- \
689 $(COMMON_CONFIGURE_OPTIONS) \
690- -DMIR_RUN_ACCEPTANCE_TESTS=OFF -DMIR_RUN_INTEGRATION_TESTS=OFF \
691- -DMIR_PLATFORM=android
692-else
693-ifeq ($(DEB_HOST_ARCH),powerpc)
694- dh_auto_configure -- \
695- $(COMMON_CONFIGURE_OPTIONS) \
696- -DMIR_ENABLE_TESTS=NO
697-else
698- dh_auto_configure -- \
699- $(COMMON_CONFIGURE_OPTIONS)
700+ -DMIR_RUN_ACCEPTANCE_TESTS=OFF \
701+ -DMIR_RUN_INTEGRATION_TESTS=OFF \
702+ -DMIR_PLATFORM=android\;mesa
703+else
704+ifeq ($(DEB_HOST_ARCH),arm64)
705+ dh_auto_configure -- \
706+ $(COMMON_CONFIGURE_OPTIONS) \
707+ -DMIR_PLATFORM=mesa
708+else
709+ dh_auto_configure -- \
710+ $(COMMON_CONFIGURE_OPTIONS) \
711+ -DMIR_PLATFORM=mesa\;android
712 endif
713 endif
714
715 # TODO: we'll use a symbol file once mir is abi stable
716 override_dh_makeshlibs:
717 dh_makeshlibs -V
718+
719+override_dh_install:
720+ dh_install --fail-missing
721+ sh debian/install_ld_so_conf.sh $(DEB_HOST_MULTIARCH)
722+
723+override_dh_installdeb:
724+ sh debian/create_postinst_prerm_scripts.sh $(DEB_HOST_MULTIARCH)
725+ dh_installdeb
726
727=== added file 'debian/update-alternatives.postinst.in'
728--- debian/update-alternatives.postinst.in 1970-01-01 00:00:00 +0000
729+++ debian/update-alternatives.postinst.in 2014-03-06 14:19:43 +0000
730@@ -0,0 +1,18 @@
731+#!/bin/sh
732+
733+set -e
734+
735+if [ "$1" = "configure" ];
736+then
737+ update-alternatives --force --install \
738+ /etc/ld.so.conf.d/@DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@.conf \
739+ @DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@_conf \
740+ /usr/lib/@DEB_HOST_MULTIARCH@/mir/@MIR_PLATFORM_TYPE@/@MIR_PLATFORM@/ld.so.conf \
741+ @DPKG_ALTERNATIVES_PRIORITY@
742+
743+ LDCONFIG_NOTRIGGER=y ldconfig
744+fi
745+
746+#DEBHELPER#
747+
748+exit 0
749
750=== added file 'debian/update-alternatives.prerm.in'
751--- debian/update-alternatives.prerm.in 1970-01-01 00:00:00 +0000
752+++ debian/update-alternatives.prerm.in 2014-03-06 14:19:43 +0000
753@@ -0,0 +1,16 @@
754+#!/bin/sh
755+
756+set -e
757+
758+if [ "$1" = "remove" ];
759+then
760+ update-alternatives --remove \
761+ @DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@_conf \
762+ /usr/lib/@DEB_HOST_MULTIARCH@/mir/@MIR_PLATFORM_TYPE@/@MIR_PLATFORM@/ld.so.conf
763+
764+ ldconfig
765+fi
766+
767+#DEBHELPER#
768+
769+exit 0
770
771=== modified file 'doc/component_reports.md'
772--- doc/component_reports.md 2014-01-13 06:12:33 +0000
773+++ doc/component_reports.md 2014-03-06 14:19:43 +0000
774@@ -18,13 +18,13 @@
775
776 Report | Handlers
777 ----------------------- | --------
778-connector-report | log
779-display-report | log
780+connector-report | log,lttng
781+display-report | log,lttng
782 input-report | log,lttng
783 legacy-input-report | log
784 msg-processor-report | log,lttng
785-session-mediator-report | log
786-scene-report | log
787+session-mediator-report | log,lttng
788+scene-report | log,lttng
789
790 For example, to enable the LTTng input report, one could either use the
791 `--input-report=lttng` command-line option to the server, or set the
792@@ -40,7 +40,7 @@
793 Report | Handlers
794 ------------------- | --------
795 rpc-report | log,lttng
796-input-receiver | log
797+input-receiver | log,lttng
798
799 For example, to enable the logging RPC report, one should set the
800 `MIR_CLIENT_RPC_REPORT=log` environment variable.
801
802=== modified file 'examples/CMakeLists.txt'
803--- examples/CMakeLists.txt 2014-01-15 03:41:11 +0000
804+++ examples/CMakeLists.txt 2014-03-06 14:19:43 +0000
805@@ -93,12 +93,12 @@
806 ${PROJECT_SOURCE_DIR}/include/server
807 ${PROJECT_SOURCE_DIR}/include/client
808 ${PROJECT_SOURCE_DIR}/include/platform
809+ ${PROJECT_SOURCE_DIR}/include/test/mir_test/draw
810 ${GLESv2_INCLUDE_DIRS}
811 )
812
813-set(RENDER_TO_FB_SOURCES render_to_fb.cpp)
814-add_executable(mir_demo_standalone_render_to_fb
815- ${RENDER_TO_FB_SOURCES}
816+add_executable(mir_demo_standalone_render_to_fb
817+ render_to_fb.cpp
818 )
819
820 target_link_libraries(mir_demo_standalone_render_to_fb
821@@ -108,6 +108,17 @@
822 ${Boost_LIBRARIES}
823 )
824
825+add_executable(mir_demo_standalone_render_overlays
826+ render_overlays.cpp
827+)
828+
829+target_link_libraries(mir_demo_standalone_render_overlays
830+ mirserver
831+ mirlogging
832+ mirdraw
833+ mirtestdraw
834+)
835+
836 set(RENDER_SURFACES_SOURCES
837 render_surfaces.cpp
838 buffer_render_target.cpp
839
840=== modified file 'examples/basic_server_configuration.cpp'
841--- examples/basic_server_configuration.cpp 2014-01-29 15:20:07 +0000
842+++ examples/basic_server_configuration.cpp 2014-03-06 14:19:43 +0000
843@@ -17,6 +17,7 @@
844 */
845
846 #include "basic_server_configuration.h"
847+#include "mir/options/default_configuration.h"
848
849 #include "mir/abnormal_exit.h"
850 #include "mir/frontend/connector.h"
851@@ -34,14 +35,19 @@
852 namespace examples
853 {
854
855-BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv)
856- : ServerConfiguration(argc, argv)
857+BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv) :
858+ ServerConfiguration([argc, argv]
859+ {
860+ auto result = std::make_shared<options::DefaultConfiguration>(argc, argv);
861+
862+ namespace po = boost::program_options;
863+
864+ result->add_options()
865+ (launch_child_opt, po::value<std::string>(), "system() command to launch client");
866+
867+ return result;
868+ }())
869 {
870- namespace po = boost::program_options;
871-
872- add_options()
873- (launch_child_opt, po::value<std::string>(), "system() command to launch client");
874-;
875 }
876
877 void BasicServerConfiguration::launch_client()
878
879=== modified file 'examples/demo-shell/demo_shell.cpp'
880--- examples/demo-shell/demo_shell.cpp 2014-01-13 06:12:33 +0000
881+++ examples/demo-shell/demo_shell.cpp 2014-03-06 14:19:43 +0000
882@@ -1,5 +1,5 @@
883 /*
884- * Copyright © 2013 Canonical Ltd.
885+ * Copyright © 2013-2014 Canonical Ltd.
886 *
887 * This program is free software: you can redistribute it and/or modify
888 * it under the terms of the GNU General Public License version 3 as
889@@ -22,6 +22,7 @@
890 #include "fullscreen_placement_strategy.h"
891 #include "../server_configuration.h"
892
893+#include "mir/options/default_configuration.h"
894 #include "mir/run_mir.h"
895 #include "mir/report_exception.h"
896 #include "mir/graphics/display.h"
897@@ -34,6 +35,7 @@
898 namespace mg = mir::graphics;
899 namespace mf = mir::frontend;
900 namespace mi = mir::input;
901+namespace mo = mir::options;
902
903 namespace mir
904 {
905@@ -44,14 +46,19 @@
906 {
907 DemoServerConfiguration(int argc, char const* argv[],
908 std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)
909- : ServerConfiguration(argc, argv),
910+ : ServerConfiguration([argc, argv]
911+ {
912+ auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
913+
914+ namespace po = boost::program_options;
915+
916+ result->add_options()
917+ ("fullscreen-surfaces", "Make all surfaces fullscreen");
918+
919+ return result;
920+ }()),
921 filter_list(filter_list)
922 {
923- namespace po = boost::program_options;
924-
925- add_options()
926- ("fullscreen-surfaces", po::value<bool>(),
927- "Make all surfaces fullscreen [bool:default=false]");
928 }
929
930 std::shared_ptr<msh::PlacementStrategy> the_shell_placement_strategy() override
931
932=== added file 'examples/render_overlays.cpp'
933--- examples/render_overlays.cpp 1970-01-01 00:00:00 +0000
934+++ examples/render_overlays.cpp 2014-03-06 14:19:43 +0000
935@@ -0,0 +1,135 @@
936+/*
937+ * Copyright © 2012, 2014 Canonical Ltd.
938+ *
939+ * This program is free software: you can redistribute it and/or modify
940+ * it under the terms of the GNU General Public License version 3 as
941+ * published by the Free Software Foundation.
942+ *
943+ * This program is distributed in the hope that it will be useful,
944+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
945+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
946+ * GNU General Public License for more details.
947+ *
948+ * You should have received a copy of the GNU General Public License
949+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
950+ *
951+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
952+ */
953+
954+#include "mir/default_server_configuration.h"
955+#include "mir/graphics/display.h"
956+#include "mir/graphics/renderable.h"
957+#include "mir/graphics/display_buffer.h"
958+#include "mir/graphics/platform.h"
959+#include "mir/graphics/graphic_buffer_allocator.h"
960+#include "mir/graphics/buffer_properties.h"
961+#include "mir/report_exception.h"
962+
963+#include "graphics_region_factory.h"
964+#include "patterns.h"
965+
966+#include <csignal>
967+#include <iostream>
968+
969+namespace mg=mir::graphics;
970+namespace ml=mir::logging;
971+namespace mo=mir::options;
972+namespace geom=mir::geometry;
973+
974+namespace
975+{
976+volatile std::sig_atomic_t running = true;
977+
978+void signal_handler(int /*signum*/)
979+{
980+ running = false;
981+}
982+}
983+
984+class DemoRenderable : public mg::Renderable
985+{
986+public:
987+ DemoRenderable(std::shared_ptr<mg::Buffer> const& buffer, geom::Rectangle rect)
988+ : renderable_buffer(buffer),
989+ position(rect)
990+ {
991+ }
992+
993+ std::shared_ptr<mg::Buffer> buffer() const
994+ {
995+ return renderable_buffer;
996+ }
997+
998+ bool alpha_enabled() const
999+ {
1000+ return false;
1001+ }
1002+
1003+ geom::Rectangle screen_position() const
1004+ {
1005+ return position;
1006+ }
1007+
1008+private:
1009+ std::shared_ptr<mg::Buffer> const renderable_buffer;
1010+ geom::Rectangle const position;
1011+};
1012+
1013+int main(int argc, char const** argv)
1014+try
1015+{
1016+ mir::test::draw::DrawPatternSolid fill_with_green(0x00FF00FF);
1017+ mir::test::draw::DrawPatternSolid fill_with_blue(0x0000FFFF);
1018+
1019+ /* Set up graceful exit on SIGINT and SIGTERM */
1020+ struct sigaction sa;
1021+ sa.sa_handler = signal_handler;
1022+ sa.sa_flags = 0;
1023+ sigemptyset(&sa.sa_mask);
1024+
1025+ sigaction(SIGINT, &sa, NULL);
1026+ sigaction(SIGTERM, &sa, NULL);
1027+
1028+ mir::DefaultServerConfiguration conf{argc, argv};
1029+
1030+ auto platform = conf.the_graphics_platform();
1031+ auto display = platform->create_display(conf.the_display_configuration_policy());
1032+ auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());
1033+ auto region_factory = mir::test::draw::create_graphics_region_factory();
1034+
1035+ mg::BufferProperties buffer_properties{
1036+ geom::Size{512, 512},
1037+ mir_pixel_format_abgr_8888,
1038+ mg::BufferUsage::hardware
1039+ };
1040+
1041+ auto buffer1 = buffer_allocator->alloc_buffer(buffer_properties);
1042+ auto buffer2 = buffer_allocator->alloc_buffer(buffer_properties);
1043+
1044+ fill_with_green.draw(*region_factory->graphic_region_from_handle(*buffer1->native_buffer_handle()));
1045+ fill_with_blue.draw(*region_factory->graphic_region_from_handle(*buffer2->native_buffer_handle()));
1046+
1047+ geom::Rectangle screen_pos1{{0,0} , {512, 512}};
1048+ geom::Rectangle screen_pos2{{80,80} , {592,592}};
1049+ std::list<std::shared_ptr<mg::Renderable>> renderlist
1050+ {
1051+ std::make_shared<DemoRenderable>(buffer2, screen_pos2),
1052+ std::make_shared<DemoRenderable>(buffer1, screen_pos1)
1053+ };
1054+
1055+ while (running)
1056+ {
1057+ display->for_each_display_buffer([&](mg::DisplayBuffer& buffer)
1058+ {
1059+ buffer.make_current();
1060+ auto render_fn = [](mg::Renderable const&) {};
1061+ buffer.render_and_post_update(renderlist, render_fn);
1062+ });
1063+ }
1064+ return 0;
1065+}
1066+catch (...)
1067+{
1068+ mir::report_exception(std::cerr);
1069+ return 1;
1070+}
1071
1072=== modified file 'examples/render_surfaces.cpp'
1073--- examples/render_surfaces.cpp 2014-02-04 14:48:29 +0000
1074+++ examples/render_surfaces.cpp 2014-03-06 14:19:43 +0000
1075@@ -1,5 +1,5 @@
1076 /*
1077- * Copyright © 2012 Canonical Ltd.
1078+ * Copyright © 2012-2014 Canonical Ltd.
1079 *
1080 * This program is free software: you can redistribute it and/or modify
1081 * it under the terms of the GNU General Public License version 3 as
1082@@ -18,6 +18,7 @@
1083
1084 #include "mir/compositor/display_buffer_compositor_factory.h"
1085 #include "mir/compositor/display_buffer_compositor.h"
1086+#include "mir/options/default_configuration.h"
1087 #include "mir/graphics/graphic_buffer_allocator.h"
1088 #include "mir/frontend/connector.h"
1089 #include "mir/shell/surface_creation_parameters.h"
1090@@ -27,10 +28,12 @@
1091 #include "mir/graphics/cursor.h"
1092 #include "mir/graphics/display.h"
1093 #include "mir/graphics/display_buffer.h"
1094+#include "mir/graphics/gl_context.h"
1095 #include "mir/shell/surface_factory.h"
1096 #include "mir/shell/surface.h"
1097 #include "mir/run_mir.h"
1098 #include "mir/report_exception.h"
1099+#include "mir/raii.h"
1100
1101 #include "mir_image.h"
1102 #include "buffer_render_target.h"
1103@@ -51,12 +54,14 @@
1104 namespace mc = mir::compositor;
1105 namespace ms = mir::scene;
1106 namespace mf = mir::frontend;
1107+namespace mo = mir::options;
1108 namespace msh = mir::shell;
1109 namespace mi = mir::input;
1110 namespace geom = mir::geometry;
1111 namespace mt = mir::tools;
1112 namespace me = mir::examples;
1113
1114+
1115 ///\page render_surfaces-example render_surfaces.cpp: A simple program using the mir library.
1116 ///\tableofcontents
1117 ///render_surfaces shows the use of mir to render some moving surfaces
1118@@ -194,7 +199,7 @@
1119 h{static_cast<float>(s->size().height.as_uint32_t())},
1120 dx{dx},
1121 dy{dy},
1122- rotation_axis{rotation_axis},
1123+ rotation_axis(rotation_axis),
1124 alpha_offset{alpha_offset}
1125 {
1126 }
1127@@ -252,16 +257,22 @@
1128 class RenderSurfacesServerConfiguration : public me::ServerConfiguration
1129 {
1130 public:
1131- RenderSurfacesServerConfiguration(int argc, char const** argv)
1132- : ServerConfiguration(argc, argv)
1133+ RenderSurfacesServerConfiguration(int argc, char const** argv) :
1134+ ServerConfiguration([argc, argv]
1135+ {
1136+ auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
1137+
1138+ namespace po = boost::program_options;
1139+
1140+ result->add_options()
1141+ (surfaces_to_render, po::value<int>()->default_value(5),
1142+ "Number of surfaces to render")
1143+ (display_cursor, po::value<bool>()->default_value(false),
1144+ "Display test cursor. (If input is disabled it gets animated.)");
1145+
1146+ return result;
1147+ }())
1148 {
1149- namespace po = boost::program_options;
1150-
1151- add_options()
1152- (surfaces_to_render, po::value<int>()->default_value(5),
1153- "Number of surfaces to render")
1154- (display_cursor, po::value<bool>()->default_value(false),
1155- "Display test cursor. (If input is disabled it gets animated.)");
1156 }
1157
1158 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
1159@@ -287,12 +298,17 @@
1160 class RenderResourcesBufferInitializer : public mg::BufferInitializer
1161 {
1162 public:
1163- RenderResourcesBufferInitializer()
1164+ RenderResourcesBufferInitializer(std::unique_ptr<mg::GLContext> gl_context)
1165+ : gl_context{std::move(gl_context)}
1166 {
1167 }
1168
1169 void operator()(mg::Buffer& buffer)
1170 {
1171+ auto using_gl_context = mir::raii::paired_calls(
1172+ [this] { gl_context->make_current(); },
1173+ [this] { gl_context->release_current(); });
1174+
1175 mt::ImageRenderer img_renderer{mir_image.pixel_data,
1176 geom::Size{mir_image.width, mir_image.height},
1177 mir_image.bytes_per_pixel};
1178@@ -300,9 +316,13 @@
1179 brt.make_current();
1180 img_renderer.render();
1181 }
1182+
1183+ private:
1184+ std::unique_ptr<mg::GLContext> const gl_context;
1185+
1186 };
1187
1188- return std::make_shared<RenderResourcesBufferInitializer>();
1189+ return std::make_shared<RenderResourcesBufferInitializer>(the_display()->create_gl_context());
1190 }
1191 ///\internal [RenderResourcesBufferInitializer_tag]
1192
1193@@ -443,7 +463,7 @@
1194
1195 bool input_is_on()
1196 {
1197- return the_options()->get<bool>(enable_input_opt);
1198+ return the_options()->get<bool>(mo::enable_input_opt);
1199 }
1200
1201 std::weak_ptr<mg::Cursor> the_cursor()
1202
1203=== modified file 'examples/render_to_fb.cpp'
1204--- examples/render_to_fb.cpp 2014-01-13 06:12:33 +0000
1205+++ examples/render_to_fb.cpp 2014-03-06 14:19:43 +0000
1206@@ -27,7 +27,6 @@
1207 #include <iostream>
1208
1209 namespace mg=mir::graphics;
1210-namespace ml=mir::logging;
1211 namespace mo=mir::options;
1212
1213 namespace
1214
1215=== modified file 'examples/scroll.cpp'
1216--- examples/scroll.cpp 2014-01-24 11:15:31 +0000
1217+++ examples/scroll.cpp 2014-03-06 14:19:43 +0000
1218@@ -95,7 +95,7 @@
1219
1220 EGLNativeDisplayType native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(connection);
1221 EGLNativeWindowType native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(surface);
1222- assert(native_window != NULL);
1223+ assert(native_window != (EGLNativeWindowType)NULL);
1224
1225 disp = eglGetDisplay(native_display);
1226 assert(disp != EGL_NO_DISPLAY);
1227
1228=== modified file 'examples/server_configuration.cpp'
1229--- examples/server_configuration.cpp 2014-01-29 15:20:07 +0000
1230+++ examples/server_configuration.cpp 2014-03-06 14:19:43 +0000
1231@@ -1,5 +1,5 @@
1232 /*
1233- * Copyright © 2013 Canonical Ltd.
1234+ * Copyright © 2013-2014 Canonical Ltd.
1235 *
1236 * This program is free software: you can redistribute it and/or modify
1237 * it under the terms of the GNU General Public License version 3 as
1238@@ -17,6 +17,7 @@
1239 */
1240
1241 #include "server_configuration.h"
1242+#include "mir/options/default_configuration.h"
1243 #include "mir/graphics/display_configuration_policy.h"
1244 #include "mir/graphics/display_configuration.h"
1245 #include "mir/input/composite_event_filter.h"
1246@@ -145,16 +146,21 @@
1247
1248 }
1249
1250-me::ServerConfiguration::ServerConfiguration(int argc, char const** argv)
1251- : DefaultServerConfiguration(argc, argv)
1252+me::ServerConfiguration::ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options) :
1253+ DefaultServerConfiguration(configuration_options)
1254 {
1255 namespace po = boost::program_options;
1256
1257- add_options()
1258+ configuration_options->add_options()
1259 (display_config_opt, po::value<std::string>()->default_value(clone_opt_val),
1260 "Display configuration [{clone,sidebyside,single}]");
1261 }
1262
1263+me::ServerConfiguration::ServerConfiguration(int argc, char const** argv) :
1264+ ServerConfiguration(std::make_shared<options::DefaultConfiguration>(argc, argv))
1265+{
1266+}
1267+
1268 std::shared_ptr<mg::DisplayConfigurationPolicy>
1269 me::ServerConfiguration::the_display_configuration_policy()
1270 {
1271
1272=== modified file 'examples/server_configuration.h'
1273--- examples/server_configuration.h 2013-08-28 03:41:48 +0000
1274+++ examples/server_configuration.h 2014-03-06 14:19:43 +0000
1275@@ -1,5 +1,5 @@
1276 /*
1277- * Copyright © 2013 Canonical Ltd.
1278+ * Copyright © 2013-2014 Canonical Ltd.
1279 *
1280 * This program is free software: you can redistribute it and/or modify
1281 * it under the terms of the GNU General Public License version 3 as
1282@@ -23,6 +23,11 @@
1283
1284 namespace mir
1285 {
1286+namespace options
1287+{
1288+class DefaultConfiguration;
1289+}
1290+
1291 namespace examples
1292 {
1293
1294@@ -30,6 +35,7 @@
1295 {
1296 public:
1297 ServerConfiguration(int argc, char const** argv);
1298+ explicit ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options);
1299
1300 std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy() override;
1301 std::shared_ptr<input::CompositeEventFilter> the_composite_event_filter() override;
1302
1303=== modified file 'guides/cppguide.xml'
1304--- guides/cppguide.xml 2014-01-13 04:16:45 +0000
1305+++ guides/cppguide.xml 2014-03-06 14:19:43 +0000
1306@@ -1060,12 +1060,13 @@
1307 be private</a>.
1308 </p>
1309 <p>
1310- When redefining an inherited virtual function, explicitly
1311- declare it <code>virtual</code> in the declaration of the
1312- derived class. Rationale: If <code>virtual</code> is
1313- omitted, the reader has to check all ancestors of the
1314- class in question to determine if the function is virtual
1315- or not.
1316+ When redefining an inherited virtual method (both pure
1317+ and non-pure), explicitly declare it <code>override</code>
1318+ in the declaration of the derived class. Rationale: using
1319+ <code>override</code> allows the compiler to consistently
1320+ detect attempts to override methods that have been changed
1321+ or completely removed. It also makes it straightforward for
1322+ a reader to determine if a method is virtual or not.
1323 </p>
1324 </DECISION>
1325 </BODY>
1326
1327=== renamed file 'include/server/mir/abnormal_exit.h' => 'include/platform/mir/abnormal_exit.h'
1328--- include/server/mir/abnormal_exit.h 2013-04-24 05:22:20 +0000
1329+++ include/platform/mir/abnormal_exit.h 2014-03-06 14:19:43 +0000
1330@@ -2,15 +2,15 @@
1331 * Copyright © 2013 Canonical Ltd.
1332 *
1333 * This program is free software: you can redistribute it and/or modify it
1334- * under the terms of the GNU General Public License version 3,
1335+ * under the terms of the GNU Lesser General Public License version 3,
1336 * as published by the Free Software Foundation.
1337 *
1338 * This program is distributed in the hope that it will be useful,
1339 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1340 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1341- * GNU General Public License for more details.
1342+ * GNU Lesser General Public License for more details.
1343 *
1344- * You should have received a copy of the GNU General Public License
1345+ * You should have received a copy of the GNU Lesser General Public License
1346 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1347 *
1348 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1349
1350=== modified file 'include/platform/mir/graphics/drm_authenticator.h'
1351--- include/platform/mir/graphics/drm_authenticator.h 2013-08-28 03:41:48 +0000
1352+++ include/platform/mir/graphics/drm_authenticator.h 2014-03-06 14:19:43 +0000
1353@@ -19,8 +19,6 @@
1354 #ifndef MIR_GRAPHICS_DRM_AUTHENTICATOR_H_
1355 #define MIR_GRAPHICS_DRM_AUTHENTICATOR_H_
1356
1357-#include <xf86drm.h>
1358-
1359 namespace mir
1360 {
1361 namespace graphics
1362@@ -31,7 +29,7 @@
1363 public:
1364 virtual ~DRMAuthenticator() {}
1365
1366- virtual void drm_auth_magic(drm_magic_t magic) = 0;
1367+ virtual void drm_auth_magic(unsigned int magic) = 0;
1368
1369 protected:
1370 DRMAuthenticator() = default;
1371
1372=== added file 'include/platform/mir/options/configuration.h'
1373--- include/platform/mir/options/configuration.h 1970-01-01 00:00:00 +0000
1374+++ include/platform/mir/options/configuration.h 2014-03-06 14:19:43 +0000
1375@@ -0,0 +1,74 @@
1376+/*
1377+ * Copyright © 2014 Canonical Ltd.
1378+ *
1379+ * This program is free software: you can redistribute it and/or modify it
1380+ * under the terms of the GNU Lesser General Public License version 3,
1381+ * as published by the Free Software Foundation.
1382+ *
1383+ * This program is distributed in the hope that it will be useful,
1384+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1385+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1386+ * GNU Lesser General Public License for more details.
1387+ *
1388+ * You should have received a copy of the GNU Lesser General Public License
1389+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1390+ *
1391+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
1392+ */
1393+
1394+#ifndef MIR_OPTIONS_CONFIGURATION_H_
1395+#define MIR_OPTIONS_CONFIGURATION_H_
1396+
1397+#include "mir/options/program_option.h"
1398+
1399+#include <memory>
1400+
1401+namespace mir
1402+{
1403+namespace options
1404+{
1405+extern char const* const server_socket_opt;
1406+extern char const* const no_server_socket_opt;
1407+extern char const* const enable_input_opt;
1408+extern char const* const session_mediator_report_opt;
1409+extern char const* const msg_processor_report_opt;
1410+extern char const* const compositor_report_opt;
1411+extern char const* const display_report_opt;
1412+extern char const* const legacy_input_report_opt;
1413+extern char const* const connector_report_opt;
1414+extern char const* const scene_report_opt;
1415+extern char const* const input_report_opt;
1416+extern char const* const host_socket_opt;
1417+extern char const* const standalone_opt;
1418+extern char const* const frontend_threads_opt;
1419+
1420+extern char const* const name_opt;
1421+extern char const* const offscreen_opt;
1422+
1423+extern char const* const glog;
1424+extern char const* const glog_stderrthreshold;
1425+extern char const* const glog_minloglevel;
1426+extern char const* const glog_log_dir;
1427+
1428+extern char const* const off_opt_value;
1429+extern char const* const log_opt_value;
1430+extern char const* const lttng_opt_value;
1431+
1432+extern char const* const platform_graphics_lib;
1433+
1434+class Configuration
1435+{
1436+public:
1437+ virtual std::shared_ptr<options::Option> the_options() const = 0;
1438+
1439+protected:
1440+
1441+ Configuration() = default;
1442+ virtual ~Configuration() = default;
1443+ Configuration(Configuration const&) = delete;
1444+ Configuration& operator=(Configuration const&) = delete;
1445+};
1446+}
1447+}
1448+
1449+#endif /* MIR_OPTIONS_CONFIGURATION_H_ */
1450
1451=== renamed file 'include/server/mir/default_configuration_options.h' => 'include/platform/mir/options/default_configuration.h'
1452--- include/server/mir/default_configuration_options.h 2014-01-27 17:47:06 +0000
1453+++ include/platform/mir/options/default_configuration.h 2014-03-06 14:19:43 +0000
1454@@ -1,100 +1,65 @@
1455 /*
1456- * Copyright © 2013 Canonical Ltd.
1457+ * Copyright © 2013-2014 Canonical Ltd.
1458 *
1459 * This program is free software: you can redistribute it and/or modify it
1460- * under the terms of the GNU General Public License version 3,
1461+ * under the terms of the GNU Lesser General Public License version 3,
1462 * as published by the Free Software Foundation.
1463 *
1464 * This program is distributed in the hope that it will be useful,
1465 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1466 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1467- * GNU General Public License for more details.
1468+ * GNU Lesser General Public License for more details.
1469 *
1470- * You should have received a copy of the GNU General Public License
1471+ * You should have received a copy of the GNU Lesser General Public License
1472 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1473 *
1474 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1475 */
1476
1477-#ifndef MIR_DEFAULT_CONFIGURATION_OPTIONS_H_
1478-#define MIR_DEFAULT_CONFIGURATION_OPTIONS_H_
1479-
1480-#include "mir/options/program_option.h"
1481-
1482-#include <memory>
1483+#ifndef MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
1484+#define MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
1485+
1486+#include "mir/options/configuration.h"
1487+
1488
1489 namespace mir
1490 {
1491-class ConfigurationOptions
1492-{
1493-public:
1494- static char const* const server_socket_opt;
1495- static char const* const no_server_socket_opt;
1496- static char const* const enable_input_opt;
1497- static char const* const session_mediator_report_opt;
1498- static char const* const msg_processor_report_opt;
1499- static char const* const compositor_report_opt;
1500- static char const* const display_report_opt;
1501- static char const* const legacy_input_report_opt;
1502- static char const* const connector_report_opt;
1503- static char const* const scene_report_opt;
1504- static char const* const input_report_opt;
1505- static char const* const host_socket_opt;
1506- static char const* const standalone_opt;
1507- static char const* const frontend_threads_opt;
1508- static char const* const name_opt;
1509- static char const* const offscreen_opt;
1510-
1511- static char const* const glog;
1512- static char const* const glog_stderrthreshold;
1513- static char const* const glog_minloglevel;
1514- static char const* const glog_log_dir;
1515- static char const* const glog_log_dir_default;
1516- static int const glog_stderrthreshold_default;
1517- static int const glog_minloglevel_default;
1518-
1519- static bool const enable_input_default;
1520-
1521- static char const* const off_opt_value;
1522- static char const* const log_opt_value;
1523- static char const* const lttng_opt_value;
1524-
1525- static char const* const platform_graphics_lib;
1526- static char const* const default_platform_graphics_lib;
1527-
1528- virtual std::shared_ptr<options::Option> the_options() const = 0;
1529-
1530-protected:
1531-
1532- int default_ipc_threads = 10;
1533-
1534- ConfigurationOptions() = default;
1535- virtual ~ConfigurationOptions() = default;
1536- ConfigurationOptions(ConfigurationOptions const&) = delete;
1537- ConfigurationOptions& operator=(ConfigurationOptions const&) = delete;
1538-};
1539-
1540-class DefaultConfigurationOptions : public ConfigurationOptions
1541-{
1542-public:
1543- DefaultConfigurationOptions(int argc, char const* argv[]);
1544- virtual ~DefaultConfigurationOptions() = default;
1545-
1546-protected:
1547- // add_options() allows configuration specializations to add their
1548- // own options. This MUST be called before the first invocation of
1549- // the_options() - typically during construction.
1550+namespace options
1551+{
1552+class DefaultConfiguration : public Configuration
1553+{
1554+public:
1555+ DefaultConfiguration(int argc, char const* argv[]);
1556+ virtual ~DefaultConfiguration() = default;
1557+
1558+ // add_options() allows users to add their own options. This MUST be called
1559+ // before the first invocation of the_options() - typically during initialization.
1560 boost::program_options::options_description_easy_init add_options();
1561- virtual void parse_options(boost::program_options::options_description& options_description, options::ProgramOption& options) const;
1562- virtual std::shared_ptr<options::Option> the_options() const;
1563
1564 private:
1565+ // accessed via the base interface, when access to add_options() has been "lost"
1566+ std::shared_ptr<options::Option> the_options() const override;
1567+
1568+ virtual void parse_arguments(
1569+ boost::program_options::options_description desc,
1570+ ProgramOption& options,
1571+ int argc,
1572+ char const* argv[]) const;
1573+
1574+ virtual void parse_environment(
1575+ boost::program_options::options_description& desc,
1576+ ProgramOption& options) const;
1577+
1578+ virtual void parse_config_file(
1579+ boost::program_options::options_description& desc,
1580+ ProgramOption& options) const;
1581+
1582 int const argc;
1583 char const** const argv;
1584 std::shared_ptr<boost::program_options::options_description> const program_options;
1585- std::shared_ptr<options::Option> mutable options;
1586+ std::shared_ptr<Option> mutable options;
1587 };
1588 }
1589-
1590-
1591-#endif /* MIR_DEFAULT_CONFIGURATION_OPTIONS_H_ */
1592+}
1593+
1594+#endif /* MIR_OPTIONS_DEFAULT_CONFIGURATION_H_ */
1595
1596=== modified file 'include/platform/mir/udev/wrapper.h'
1597--- include/platform/mir/udev/wrapper.h 2014-01-22 08:32:55 +0000
1598+++ include/platform/mir/udev/wrapper.h 2014-03-06 14:19:43 +0000
1599@@ -93,7 +93,7 @@
1600 bool operator!=(iterator const& rhs) const;
1601
1602 Device const& operator*() const;
1603-
1604+ Device const* operator->() const;
1605 private:
1606 friend class Enumerator;
1607
1608@@ -135,6 +135,7 @@
1609 void enable(void);
1610 int fd(void) const;
1611
1612+ void filter_by_subsystem(std::string const& subsystem);
1613 void filter_by_subsystem_and_type(std::string const& subsystem, std::string const& devtype);
1614
1615 void process_events(std::function<void(EventType, Device const&)> const& handler) const;
1616
1617=== modified file 'include/server/mir/compositor/compositor_report.h'
1618--- include/server/mir/compositor/compositor_report.h 2014-01-10 05:48:41 +0000
1619+++ include/server/mir/compositor/compositor_report.h 2014-03-06 14:19:43 +0000
1620@@ -41,17 +41,6 @@
1621 CompositorReport& operator=(CompositorReport const&) = delete;
1622 };
1623
1624-class NullCompositorReport : public CompositorReport
1625-{
1626-public:
1627- void added_display(int width, int height, int x, int y, SubCompositorId id);
1628- void began_frame(SubCompositorId id);
1629- void finished_frame(bool bypassed, SubCompositorId id);
1630- void started();
1631- void stopped();
1632- void scheduled();
1633-};
1634-
1635 } // namespace compositor
1636 } // namespace mir
1637
1638
1639=== modified file 'include/server/mir/default_server_configuration.h'
1640--- include/server/mir/default_server_configuration.h 2014-01-29 18:02:33 +0000
1641+++ include/server/mir/default_server_configuration.h 2014-03-06 14:19:43 +0000
1642@@ -1,5 +1,5 @@
1643 /*
1644- * Copyright © 2012 Canonical Ltd.
1645+ * Copyright © 2012-2014 Canonical Ltd.
1646 *
1647 * This program is free software: you can redistribute it and/or modify it
1648 * under the terms of the GNU General Public License version 3,
1649@@ -20,7 +20,6 @@
1650
1651 #include "mir/cached_ptr.h"
1652 #include "mir/server_configuration.h"
1653-#include "mir/default_configuration_options.h"
1654
1655 #include <memory>
1656 #include <string>
1657@@ -114,10 +113,22 @@
1658 class Logger;
1659 }
1660
1661-class DefaultServerConfiguration : public virtual ServerConfiguration, protected DefaultConfigurationOptions
1662+namespace options
1663+{
1664+class Option;
1665+class Configuration;
1666+}
1667+
1668+namespace report
1669+{
1670+class ReportFactory;
1671+}
1672+
1673+class DefaultServerConfiguration : public virtual ServerConfiguration
1674 {
1675 public:
1676 DefaultServerConfiguration(int argc, char const* argv[]);
1677+ explicit DefaultServerConfiguration(std::shared_ptr<options::Configuration> const& configuration_options);
1678
1679 /** @name DisplayServer dependencies
1680 * dependencies of DisplayServer on the rest of the Mir
1681@@ -235,9 +246,7 @@
1682 virtual std::shared_ptr<time::Clock> the_clock();
1683
1684 protected:
1685- using DefaultConfigurationOptions::the_options;
1686- using DefaultConfigurationOptions::add_options;
1687- using DefaultConfigurationOptions::parse_options;
1688+ std::shared_ptr<options::Option> the_options() const;
1689
1690 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();
1691 virtual std::shared_ptr<scene::MediatingDisplayChanger> the_mediating_display_changer();
1692@@ -297,6 +306,7 @@
1693 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;
1694
1695 private:
1696+ std::shared_ptr<options::Configuration> const configuration_options;
1697 std::shared_ptr<input::EventFilter> const default_filter;
1698
1699 virtual std::string the_socket_file() const;
1700@@ -313,7 +323,8 @@
1701 std::shared_ptr<scene::SessionManager> the_session_manager();
1702 std::shared_ptr<scene::SurfaceBuilder> the_surface_builder();
1703 std::shared_ptr<scene::SurfaceController> the_surface_controller();
1704- std::function<void()> force_threads_to_unblock_callback();
1705+
1706+ auto report_factory(char const* report_opt) -> std::unique_ptr<report::ReportFactory>;
1707 };
1708 }
1709
1710
1711=== modified file 'include/server/mir/frontend/connector_report.h'
1712--- include/server/mir/frontend/connector_report.h 2013-09-27 16:07:00 +0000
1713+++ include/server/mir/frontend/connector_report.h 2014-03-06 14:19:43 +0000
1714@@ -50,21 +50,6 @@
1715 ConnectorReport& operator=(const ConnectorReport&) = delete;
1716 };
1717
1718-class NullConnectorReport : public ConnectorReport
1719-{
1720-public:
1721- void thread_start() override;
1722- void thread_end() override;
1723- void starting_threads(int count) override;
1724- void stopping_threads(int count) override;
1725-
1726- void creating_session_for(int socket_handle) override;
1727- void creating_socket_pair(int server_handle, int client_handle) override;
1728-
1729- void listening_on(std::string const& endpoint) override;
1730-
1731- void error(std::exception const& error) override;
1732-};
1733 }
1734 }
1735
1736
1737=== modified file 'include/server/mir/frontend/session_mediator_report.h'
1738--- include/server/mir/frontend/session_mediator_report.h 2013-09-24 07:02:12 +0000
1739+++ include/server/mir/frontend/session_mediator_report.h 2014-03-06 14:19:43 +0000
1740@@ -54,30 +54,6 @@
1741 std::string const& what) = 0;
1742 };
1743
1744-// Do-nothing implementation to satisfy dependencies
1745-class NullSessionMediatorReport : public SessionMediatorReport
1746-{
1747- virtual void session_connect_called(std::string const& app_name);
1748-
1749- virtual void session_create_surface_called(std::string const& app_name);
1750-
1751- virtual void session_next_buffer_called(std::string const& app_name);
1752-
1753- virtual void session_release_surface_called(std::string const& app_name);
1754-
1755- virtual void session_disconnect_called(std::string const& app_name);
1756-
1757- virtual void session_drm_auth_magic_called(std::string const& app_name);
1758-
1759- virtual void session_configure_surface_called(std::string const& app_name);
1760-
1761- virtual void session_configure_display_called(std::string const& app_name);
1762-
1763- virtual void session_error(
1764- std::string const& app_name,
1765- char const* method,
1766- std::string const& what);
1767-};
1768 }
1769 }
1770
1771
1772=== modified file 'include/server/mir/input/surface.h'
1773--- include/server/mir/input/surface.h 2014-01-13 06:12:33 +0000
1774+++ include/server/mir/input/surface.h 2014-03-06 14:19:43 +0000
1775@@ -31,7 +31,7 @@
1776 {
1777 public:
1778 virtual std::string const& name() const = 0;
1779- virtual geometry::Point position() const = 0;
1780+ virtual geometry::Point top_left() const = 0;
1781 virtual geometry::Size size() const = 0;
1782 virtual bool contains(geometry::Point const& point) const = 0;
1783
1784
1785=== added directory 'include/server/mir/logging'
1786=== renamed file 'include/server/mir/logging/glog_logger.h' => 'include/server/mir/logging/glog_logger.h'
1787=== removed directory 'include/server/mir/lttng'
1788=== added directory 'include/server/mir/report'
1789=== added file 'include/server/mir/report/legacy_input_report.h'
1790--- include/server/mir/report/legacy_input_report.h 1970-01-01 00:00:00 +0000
1791+++ include/server/mir/report/legacy_input_report.h 2014-03-06 14:19:43 +0000
1792@@ -0,0 +1,39 @@
1793+/*
1794+ * Copyright © 2014 Canonical Ltd.
1795+ *
1796+ * This program is free software: you can redistribute it and/or modify it
1797+ * under the terms of the GNU General Public License version 3,
1798+ * as published by the Free Software Foundation.
1799+ *
1800+ * This program is distributed in the hope that it will be useful,
1801+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1802+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1803+ * GNU General Public License for more details.
1804+ *
1805+ * You should have received a copy of the GNU General Public License
1806+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1807+ *
1808+ * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
1809+ */
1810+
1811+#ifndef MIR_REPORT_LEGACY_INPUT_REPORT_H_
1812+#define MIR_REPORT_LEGACY_INPUT_REPORT_H_
1813+
1814+#include <memory>
1815+
1816+namespace mir
1817+{
1818+namespace logging
1819+{
1820+class Logger;
1821+}
1822+namespace report
1823+{
1824+namespace legacy_input
1825+{
1826+void initialize(std::shared_ptr<mir::logging::Logger> const& logger);
1827+}
1828+}
1829+}
1830+
1831+#endif // MIR_REPORT_LEGACY_INPUT_REPORT_H_
1832
1833=== renamed directory 'include/server/mir/logging' => 'include/server/mir/report/logging'
1834=== modified file 'include/server/mir/scene/scene_report.h'
1835--- include/server/mir/scene/scene_report.h 2014-01-13 06:12:33 +0000
1836+++ include/server/mir/scene/scene_report.h 2014-03-06 14:19:43 +0000
1837@@ -26,16 +26,15 @@
1838 {
1839 namespace scene
1840 {
1841-class BasicSurface;
1842-
1843 class SceneReport
1844 {
1845 public:
1846- virtual void surface_created(BasicSurface* const surface) = 0;
1847- virtual void surface_added(BasicSurface* const surface) = 0;
1848+ typedef void* BasicSurfaceId;
1849+ virtual void surface_created(BasicSurfaceId id, std::string const& name) = 0;
1850+ virtual void surface_added(BasicSurfaceId id, std::string const& name) = 0;
1851
1852- virtual void surface_removed(BasicSurface* const surface) = 0;
1853- virtual void surface_deleted(BasicSurface* const surface) = 0;
1854+ virtual void surface_removed(BasicSurfaceId id, std::string const& name) = 0;
1855+ virtual void surface_deleted(BasicSurfaceId id, std::string const& name) = 0;
1856
1857 protected:
1858 SceneReport() = default;
1859@@ -44,17 +43,7 @@
1860 SceneReport& operator=(SceneReport const&) = delete;
1861 };
1862
1863-class NullSceneReport : public SceneReport
1864-{
1865-public:
1866- virtual void surface_created(BasicSurface* const /*surface*/) override;
1867- virtual void surface_added(BasicSurface* const /*surface*/) override;
1868-
1869- virtual void surface_removed(BasicSurface* const /*surface*/) override;
1870- virtual void surface_deleted(BasicSurface* const /*surface*/) override;
1871-};
1872-}
1873-}
1874-
1875+}
1876+}
1877
1878 #endif /* MIR_SCENE_SCENE_REPORT_H_ */
1879
1880=== added directory 'include/shared/mir/logging'
1881=== removed directory 'include/shared/mir/logging'
1882=== renamed file 'include/shared/mir/logging/dumb_console_logger.h' => 'include/shared/mir/logging/dumb_console_logger.h'
1883=== renamed file 'include/shared/mir/logging/input_timestamp.h' => 'include/shared/mir/logging/input_timestamp.h'
1884=== renamed file 'include/shared/mir/logging/logger.h' => 'include/shared/mir/logging/logger.h'
1885=== added directory 'include/shared/mir/report'
1886=== renamed directory 'include/shared/mir/lttng' => 'include/shared/mir/report/lttng'
1887=== modified file 'include/shared/mir/report/lttng/mir_tracepoint.h'
1888--- include/shared/mir/lttng/mir_tracepoint.h 2013-06-03 12:15:44 +0000
1889+++ include/shared/mir/report/lttng/mir_tracepoint.h 2014-03-06 14:19:43 +0000
1890@@ -27,7 +27,6 @@
1891 *
1892 * See: http://sourceware.org/bugzilla/show_bug.cgi?id=13974
1893 */
1894-
1895 #ifdef __clang__
1896 namespace mir_systemtap_bug_13974
1897 {
1898@@ -36,7 +35,7 @@
1899 #define mir_tracepoint(c, e, ...) ::mir_systemtap_bug_13974::mir_tracepoint_consume_args(0, __VA_ARGS__)
1900 #pragma message "Building with clang: Disabling LTTng tracepoints."
1901 #else
1902-#define mir_tracepoint(c, e, ...) tracepoint(c, e, __VA_ARGS__)
1903+#define mir_tracepoint(c, ...) tracepoint(c, __VA_ARGS__)
1904 #endif
1905
1906 #endif /* MIR_LTTNG_MIR_TRACEPOINT_H_ */
1907
1908=== modified file 'include/shared/mir/report/lttng/tracepoint_provider.h'
1909--- include/shared/mir/lttng/tracepoint_provider.h 2013-06-04 10:47:05 +0000
1910+++ include/shared/mir/report/lttng/tracepoint_provider.h 2014-03-06 14:19:43 +0000
1911@@ -16,13 +16,15 @@
1912 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1913 */
1914
1915-#ifndef MIR_LTTNG_TRACEPOINT_PROVIDER_H_
1916-#define MIR_LTTNG_TRACEPOINT_PROVIDER_H_
1917+#ifndef MIR_REPORT_LTTNG_TRACEPOINT_PROVIDER_H_
1918+#define MIR_REPORT_LTTNG_TRACEPOINT_PROVIDER_H_
1919
1920 #include <string>
1921
1922 namespace mir
1923 {
1924+namespace report
1925+{
1926 namespace lttng
1927 {
1928
1929@@ -41,5 +43,6 @@
1930
1931 }
1932 }
1933+}
1934
1935-#endif /* MIR_LTTNG_TRACEPOINT_PROVIDER_H_ */
1936+#endif /* MIR_REPORT_LTTNG_TRACEPOINT_PROVIDER_H_ */
1937
1938=== renamed file 'include/server/mir/shared_library.h' => 'include/shared/mir/shared_library.h'
1939--- include/server/mir/shared_library.h 2013-06-21 10:07:40 +0000
1940+++ include/shared/mir/shared_library.h 2014-03-06 14:19:43 +0000
1941@@ -2,15 +2,15 @@
1942 * Copyright © 2013 Canonical Ltd.
1943 *
1944 * This program is free software: you can redistribute it and/or modify it
1945- * under the terms of the GNU General Public License version 3,
1946+ * under the terms of the GNU Lesser General Public License version 3,
1947 * as published by the Free Software Foundation.
1948 *
1949 * This program is distributed in the hope that it will be useful,
1950 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1951 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1952- * GNU General Public License for more details.
1953+ * GNU Lesser General Public License for more details.
1954 *
1955- * You should have received a copy of the GNU General Public License
1956+ * You should have received a copy of the GNU Lesser General Public License
1957 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1958 *
1959 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1960
1961=== renamed file 'include/test/mir_test/draw/android_graphics.h' => 'include/test/mir_test/draw/graphics_region_factory.h'
1962--- include/test/mir_test/draw/android_graphics.h 2014-01-13 06:12:33 +0000
1963+++ include/test/mir_test/draw/graphics_region_factory.h 2014-03-06 14:19:43 +0000
1964@@ -15,45 +15,36 @@
1965 *
1966 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1967 */
1968-#ifndef MIR_TEST_DRAW_ANDROID_GRAPHICS
1969-#define MIR_TEST_DRAW_ANDROID_GRAPHICS
1970+#ifndef MIR_TEST_DRAW_GRAPHICS_REGION_FACTORY
1971+#define MIR_TEST_DRAW_GRAPHICS_REGION_FACTORY
1972
1973+#include "mir/graphics/native_buffer.h"
1974 #include "mir_toolkit/mir_client_library.h"
1975-#include "mir/compositor/buffer_stream.h"
1976-#include "mir/geometry/size.h"
1977-
1978-#include <hardware/gralloc.h>
1979 #include <memory>
1980
1981 namespace mir
1982 {
1983-namespace compositor
1984-{
1985- class BufferIPCPackage;
1986-}
1987 namespace test
1988 {
1989 namespace draw
1990 {
1991
1992-class TestGrallocMapper
1993+class GraphicsRegionFactory
1994 {
1995 public:
1996- TestGrallocMapper();
1997- TestGrallocMapper(const hw_module_t *hw_module, alloc_device_t* alloc_dev);
1998- ~TestGrallocMapper();
1999- std::shared_ptr<MirGraphicsRegion> graphic_region_from_handle(ANativeWindowBuffer* package);
2000-
2001-private:
2002- TestGrallocMapper(TestGrallocMapper const&) = delete;
2003- TestGrallocMapper& operator=(TestGrallocMapper const&) = delete;
2004-
2005- const bool gralloc_ownership;
2006- gralloc_module_t* module;
2007- alloc_device_t* alloc_dev;
2008+ virtual ~GraphicsRegionFactory() {}
2009+ virtual std::shared_ptr<MirGraphicsRegion> graphic_region_from_handle(
2010+ graphics::NativeBuffer const& native_buffer) = 0;
2011+
2012+protected:
2013+ GraphicsRegionFactory() = default;
2014+ GraphicsRegionFactory(GraphicsRegionFactory const&) = delete;
2015+ GraphicsRegionFactory& operator=(GraphicsRegionFactory const&) = delete;
2016 };
2017
2018-}
2019-}
2020-}
2021-#endif /* MIR_TEST_DRAW_ANDROID_GRAPHICS */
2022+std::shared_ptr<GraphicsRegionFactory> create_graphics_region_factory();
2023+
2024+}
2025+}
2026+}
2027+#endif /* MIR_TEST_DRAW_GRAPHICS_REGION_FACTORY */
2028
2029=== modified file 'include/test/mir_test/draw/patterns.h'
2030--- include/test/mir_test/draw/patterns.h 2013-10-14 20:35:46 +0000
2031+++ include/test/mir_test/draw/patterns.h 2014-03-06 14:19:43 +0000
2032@@ -72,7 +72,7 @@
2033 private:
2034 uint32_t color_pattern [Rows][Cols];
2035 };
2036-#include "mir_test/draw/draw_pattern_checkered-inl.h"
2037+#include "draw_pattern_checkered-inl.h"
2038
2039 }
2040 }
2041
2042=== modified file 'include/test/mir_test_doubles/mock_display_device.h'
2043--- include/test/mir_test_doubles/mock_display_device.h 2014-01-23 17:26:51 +0000
2044+++ include/test/mir_test_doubles/mock_display_device.h 2014-03-06 14:19:43 +0000
2045@@ -38,6 +38,7 @@
2046 MOCK_METHOD1(prepare_gl_and_overlays, void(std::list<std::shared_ptr<graphics::Renderable>> const&));
2047 MOCK_METHOD2(gpu_render, void(EGLDisplay, EGLSurface));
2048 MOCK_METHOD1(post, void(graphics::Buffer const&));
2049+ MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation));
2050 };
2051 }
2052 }
2053
2054=== modified file 'include/test/mir_test_doubles/mock_drm.h'
2055--- include/test/mir_test_doubles/mock_drm.h 2013-08-28 03:41:48 +0000
2056+++ include/test/mir_test_doubles/mock_drm.h 2014-03-06 14:19:43 +0000
2057@@ -88,6 +88,7 @@
2058 MockDRM();
2059 ~MockDRM() noexcept;
2060
2061+ MOCK_METHOD3(open, int(char const* path, int flags, mode_t mode));
2062 MOCK_METHOD2(drmOpen, int(const char *name, const char *busid));
2063 MOCK_METHOD1(drmClose, int(int fd));
2064 MOCK_METHOD3(drmIoctl, int(int fd, unsigned long request, void *arg));
2065
2066=== modified file 'include/test/mir_test_doubles/mock_gl.h'
2067--- include/test/mir_test_doubles/mock_gl.h 2014-01-13 06:12:33 +0000
2068+++ include/test/mir_test_doubles/mock_gl.h 2014-03-06 14:19:43 +0000
2069@@ -52,6 +52,7 @@
2070 MOCK_METHOD1(glCreateShader, GLuint(GLenum));
2071 MOCK_METHOD2(glDeleteBuffers, void(GLsizei, const GLuint *));
2072 MOCK_METHOD2(glDeleteFramebuffers, void(GLsizei, const GLuint *));
2073+ MOCK_METHOD2(glDeleteRenderbuffers, void(GLsizei, const GLuint *));
2074 MOCK_METHOD1(glDeleteProgram, void(GLuint));
2075 MOCK_METHOD1(glDeleteShader, void(GLuint));
2076 MOCK_METHOD2(glDeleteTextures, void(GLsizei, const GLuint *));
2077@@ -100,6 +101,7 @@
2078 void(GLuint, GLint, GLenum, GLboolean, GLsizei,
2079 const GLvoid *));
2080 MOCK_METHOD4(glViewport, void(GLint, GLint, GLsizei, GLsizei));
2081+ MOCK_METHOD0(glFinish, void());
2082 };
2083
2084 }
2085
2086=== modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h'
2087--- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-01-29 18:54:06 +0000
2088+++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-03-06 14:19:43 +0000
2089@@ -44,6 +44,8 @@
2090 external_set = false;
2091 virtual_prepare = false;
2092 virtual_set = false;
2093+ fb_fence = -1;
2094+ retire_fence = -1;
2095
2096 common.version = HWC_DEVICE_API_VERSION_1_1;
2097
2098
2099=== modified file 'include/test/mir_test_doubles/mock_input_surface.h'
2100--- include/test/mir_test_doubles/mock_input_surface.h 2014-01-13 06:12:33 +0000
2101+++ include/test/mir_test_doubles/mock_input_surface.h 2014-03-06 14:19:43 +0000
2102@@ -35,7 +35,7 @@
2103 MockInputSurface()
2104 {
2105 using namespace testing;
2106- ON_CALL(*this, position())
2107+ ON_CALL(*this, top_left())
2108 .WillByDefault(
2109 Return(geometry::Point{}));
2110 ON_CALL(*this, size())
2111@@ -46,7 +46,7 @@
2112 .WillByDefault(testing::ReturnRef(n));
2113 }
2114 ~MockInputSurface() noexcept {}
2115- MOCK_CONST_METHOD0(position, geometry::Point());
2116+ MOCK_CONST_METHOD0(top_left, geometry::Point());
2117 MOCK_CONST_METHOD0(size, geometry::Size());
2118 MOCK_CONST_METHOD0(name, std::string const&());
2119 MOCK_CONST_METHOD1(contains, bool(geometry::Point const&));
2120
2121=== renamed file 'include/test/mir_test_doubles/mock_surface_renderer.h' => 'include/test/mir_test_doubles/mock_renderer.h'
2122--- include/test/mir_test_doubles/mock_surface_renderer.h 2014-01-14 07:02:27 +0000
2123+++ include/test/mir_test_doubles/mock_renderer.h 2014-03-06 14:19:43 +0000
2124@@ -15,8 +15,8 @@
2125 *
2126 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
2127 */
2128-#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_
2129-#define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_
2130+#ifndef MIR_TEST_DOUBLES_MOCK_RENDERER_H_
2131+#define MIR_TEST_DOUBLES_MOCK_RENDERER_H_
2132
2133 #include "src/server/compositor/renderer.h"
2134
2135@@ -29,17 +29,19 @@
2136 namespace doubles
2137 {
2138
2139-struct MockSurfaceRenderer : public compositor::Renderer
2140+struct MockRenderer : public compositor::Renderer
2141 {
2142- MOCK_CONST_METHOD1(begin, void(float));
2143+ MOCK_METHOD1(set_viewport, void(geometry::Rectangle const&));
2144+ MOCK_METHOD1(set_rotation, void(float));
2145+ MOCK_CONST_METHOD0(begin, void());
2146 MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&));
2147 MOCK_CONST_METHOD0(end, void());
2148 MOCK_METHOD0(suspend, void());
2149
2150- ~MockSurfaceRenderer() noexcept {}
2151+ ~MockRenderer() noexcept {}
2152 };
2153
2154 }
2155 }
2156 }
2157-#endif /* MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ */
2158+#endif /* MIR_TEST_DOUBLES_MOCK_RENDERER_H_ */
2159
2160=== modified file 'include/test/mir_test_doubles/stub_display_builder.h'
2161--- include/test/mir_test_doubles/stub_display_builder.h 2014-01-13 06:12:33 +0000
2162+++ include/test/mir_test_doubles/stub_display_builder.h 2014-03-06 14:19:43 +0000
2163@@ -20,8 +20,7 @@
2164 #define MIR_TEST_DOUBLES_STUB_DISPLAY_BUILDER_H_
2165
2166 #include "src/platform/graphics/android/display_builder.h"
2167-#include "stub_display_buffer.h"
2168-#include "stub_display_device.h"
2169+#include "src/platform/graphics/android/configurable_display_buffer.h"
2170 #include <gmock/gmock.h>
2171
2172 namespace mir
2173@@ -30,25 +29,47 @@
2174 {
2175 namespace doubles
2176 {
2177+
2178+struct StubConfigurableDisplayBuffer : public graphics::android::ConfigurableDisplayBuffer
2179+{
2180+ StubConfigurableDisplayBuffer(geometry::Rectangle rect)
2181+ : rect(rect)
2182+ {
2183+ }
2184+
2185+ geometry::Rectangle view_area() const { return rect; }
2186+ void make_current() {}
2187+ void release_current() {}
2188+ void post_update() {}
2189+ bool can_bypass() const override { return false; }
2190+ void render_and_post_update(
2191+ std::list<std::shared_ptr<graphics::Renderable>> const&,
2192+ std::function<void(graphics::Renderable const&)> const&) {}
2193+ MirOrientation orientation() const override { return mir_orientation_normal; }
2194+ void configure(graphics::DisplayConfigurationOutput const&) {}
2195+ graphics::DisplayConfigurationOutput configuration() const
2196+ {
2197+ return graphics::DisplayConfigurationOutput{
2198+ graphics::DisplayConfigurationOutputId{1},
2199+ graphics::DisplayConfigurationCardId{0},
2200+ graphics::DisplayConfigurationOutputType::vga,
2201+ {}, {}, 0, {}, false, false, {}, 0, mir_pixel_format_abgr_8888,
2202+ mir_power_mode_off,
2203+ mir_orientation_normal};
2204+ }
2205+private:
2206+ geometry::Rectangle rect;
2207+};
2208+
2209 struct StubDisplayBuilder : public graphics::android::DisplayBuilder
2210 {
2211- StubDisplayBuilder(std::shared_ptr<graphics::android::DisplayDevice> const& stub_dev, geometry::Size sz)
2212- : stub_dev(stub_dev), sz(sz)
2213+ StubDisplayBuilder(geometry::Size sz)
2214+ : sz(sz)
2215 {
2216 }
2217
2218 StubDisplayBuilder()
2219- : StubDisplayBuilder(std::make_shared<StubDisplayDevice>(), geometry::Size{0,0})
2220- {
2221- }
2222-
2223- StubDisplayBuilder(geometry::Size sz)
2224- : StubDisplayBuilder(std::make_shared<StubDisplayDevice>(), sz)
2225- {
2226- }
2227-
2228- StubDisplayBuilder(std::shared_ptr<graphics::android::DisplayDevice> const& stub_dev)
2229- : stub_dev(stub_dev), sz(geometry::Size{0,0})
2230+ : StubDisplayBuilder(geometry::Size{0,0})
2231 {
2232 }
2233
2234@@ -57,20 +78,13 @@
2235 return mir_pixel_format_abgr_8888;
2236 }
2237
2238- std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(
2239- std::shared_ptr<graphics::android::DisplayDevice> const&,
2240+ std::unique_ptr<graphics::android::ConfigurableDisplayBuffer> create_display_buffer(
2241 graphics::android::GLContext const&)
2242 {
2243- return std::unique_ptr<graphics::DisplayBuffer>(
2244- new StubDisplayBuffer(geometry::Rectangle{{0,0},sz}));
2245- }
2246-
2247- std::shared_ptr<graphics::android::DisplayDevice> create_display_device()
2248- {
2249- return stub_dev;
2250- }
2251-
2252- std::shared_ptr<graphics::android::DisplayDevice> const stub_dev;
2253+ return std::unique_ptr<graphics::android::ConfigurableDisplayBuffer>(
2254+ new StubConfigurableDisplayBuffer(geometry::Rectangle{{0,0},sz}));
2255+ }
2256+
2257 geometry::Size sz;
2258 };
2259 }
2260
2261=== modified file 'include/test/mir_test_doubles/stub_display_configuration.h'
2262--- include/test/mir_test_doubles/stub_display_configuration.h 2014-01-31 07:35:54 +0000
2263+++ include/test/mir_test_doubles/stub_display_configuration.h 2014-03-06 14:19:43 +0000
2264@@ -93,8 +93,8 @@
2265 graphics::DisplayConfigurationOutputType::vga,
2266 pfs, modes, i,
2267 physical_size,
2268- ((i % 2) == 0),
2269- ((i % 2) == 1),
2270+ ((i % 2) == 0), // even numbers have connected==true
2271+ ((i % 4) == 0), // only every second even has used==true
2272 top_left,
2273 mode_index, pfs[0],
2274 mir_power_mode_off,
2275
2276=== added file 'include/test/mir_test_doubles/stub_renderer.h'
2277--- include/test/mir_test_doubles/stub_renderer.h 1970-01-01 00:00:00 +0000
2278+++ include/test/mir_test_doubles/stub_renderer.h 2014-03-06 14:19:43 +0000
2279@@ -0,0 +1,65 @@
2280+/*
2281+ * Copyright © 2014 Canonical Ltd.
2282+ *
2283+ * This program is free software: you can redistribute it and/or modify it
2284+ * under the terms of the GNU General Public License version 3,
2285+ * as published by the Free Software Foundation.
2286+ *
2287+ * This program is distributed in the hope that it will be useful,
2288+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2289+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2290+ * GNU General Public License for more details.
2291+ *
2292+ * You should have received a copy of the GNU General Public License
2293+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2294+ *
2295+ * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
2296+ */
2297+
2298+#ifndef MIR_TEST_DOUBLES_STUB_RENDERER_H_
2299+#define MIR_TEST_DOUBLES_STUB_RENDERER_H_
2300+
2301+#include "src/server/compositor/renderer.h"
2302+
2303+namespace mir
2304+{
2305+namespace test
2306+{
2307+namespace doubles
2308+{
2309+
2310+class StubRenderer : public compositor::Renderer
2311+{
2312+public:
2313+ void set_viewport(geometry::Rectangle const&) override
2314+ {
2315+ }
2316+
2317+ void set_rotation(float) override
2318+ {
2319+ }
2320+
2321+ void begin() const override
2322+ {
2323+ }
2324+
2325+ void render(compositor::CompositingCriteria const&,
2326+ graphics::Buffer&) const override
2327+ {
2328+ }
2329+
2330+ void end() const override
2331+ {
2332+ }
2333+
2334+ void suspend() override
2335+ {
2336+ }
2337+};
2338+
2339+
2340+} // namespace doubles
2341+} // namespace test
2342+} // namespace mir
2343+
2344+#endif // MIR_TEST_DOUBLES_STUB_RENDERER_H_
2345
2346=== modified file 'include/test/mir_test_doubles/stub_surface_builder.h'
2347--- include/test/mir_test_doubles/stub_surface_builder.h 2014-01-13 06:12:33 +0000
2348+++ include/test/mir_test_doubles/stub_surface_builder.h 2014-03-06 14:19:43 +0000
2349@@ -1,5 +1,5 @@
2350 /*
2351- * Copyright © 2013 Canonical Ltd.
2352+ * Copyright © 2013-2014 Canonical Ltd.
2353 *
2354 * This program is free software: you can redistribute it and/or modify it
2355 * under the terms of the GNU General Public License version 3,
2356@@ -22,8 +22,7 @@
2357
2358 #include "src/server/scene/surface_builder.h"
2359 #include "src/server/scene/basic_surface.h"
2360-#include "src/server/scene/surface_data.h"
2361-#include "mir/scene/scene_report.h"
2362+#include "src/server/report/null_report_factory.h"
2363 #include "mir/shell/surface_creation_parameters.h"
2364
2365 #include "mir_test_doubles/stub_buffer_stream.h"
2366@@ -40,11 +39,13 @@
2367 public:
2368 StubSurfaceBuilder() :
2369 dummy_surface(std::make_shared<scene::BasicSurface>(
2370- std::make_shared<scene::SurfaceData>(
2371- std::string("stub"), geometry::Rectangle{{},{}}, [](){}, false),
2372+ std::string("stub"),
2373+ geometry::Rectangle{{},{}},
2374+ [](){},
2375+ false,
2376 std::make_shared<StubBufferStream>(),
2377 std::shared_ptr<input::InputChannel>(),
2378- std::make_shared<scene::NullSceneReport>()))
2379+ mir::report::null_scene_report()))
2380 {
2381 }
2382
2383
2384=== modified file 'include/test/mir_test_framework/udev_environment.h'
2385--- include/test/mir_test_framework/udev_environment.h 2014-01-13 06:12:33 +0000
2386+++ include/test/mir_test_framework/udev_environment.h 2014-03-06 14:19:43 +0000
2387@@ -35,8 +35,6 @@
2388 UdevEnvironment();
2389 ~UdevEnvironment() noexcept;
2390
2391- void add_standard_drm_devices();
2392-
2393 std::string add_device(char const* subsystem,
2394 char const* name,
2395 char const* parent,
2396@@ -45,6 +43,18 @@
2397 void remove_device(std::string const& device_path);
2398 void emit_device_changed(std::string const& device_path);
2399
2400+ /**
2401+ * Add a device from the set of standard device traces
2402+ *
2403+ * Looks for a <tt>name</tt>.umockdev file, and adds a UMockDev device
2404+ * from that description.
2405+ *
2406+ * If <tt>name</tt>.ioctl exists, it loads that ioctl script for the device
2407+ *
2408+ * @param name The unadorned filename of the device traces to add.
2409+ */
2410+ void add_standard_device(std::string const& name);
2411+
2412 UMockdevTestbed *testbed;
2413 };
2414
2415
2416=== modified file 'src/client/CMakeLists.txt'
2417--- src/client/CMakeLists.txt 2014-02-06 22:37:53 +0000
2418+++ src/client/CMakeLists.txt 2014-03-06 14:19:43 +0000
2419@@ -18,6 +18,14 @@
2420 add_subdirectory(rpc/)
2421 add_subdirectory(lttng/)
2422
2423+if(MIR_BUILD_PLATFORM_ANDROID)
2424+add_subdirectory(android/)
2425+endif()
2426+
2427+if(MIR_BUILD_PLATFORM_MESA)
2428+add_subdirectory(mesa/)
2429+endif()
2430+
2431 set(
2432 CLIENT_SOURCES
2433
2434@@ -38,34 +46,6 @@
2435 mir_screencast_api.cpp
2436 )
2437
2438-if( MIR_PLATFORM STREQUAL "android")
2439-include_directories(SYSTEM ${LIBHARDWARE_INCLUDE_DIRS})
2440-set(
2441- CLIENT_SOURCES
2442-
2443- android/android_client_buffer.cpp
2444- android/android_client_buffer_factory.cpp
2445- android/android_registrar.cpp
2446- android/android_client_platform.cpp
2447- android/client_surface_interpreter.cpp
2448- android/android_native_display_container.cpp
2449- ${CLIENT_SOURCES}
2450-)
2451-endif()
2452-
2453-if( MIR_PLATFORM STREQUAL "mesa")
2454-set(
2455- CLIENT_SOURCES
2456-
2457- mesa/client_platform.cpp
2458- mesa/client_buffer_factory.cpp
2459- mesa/client_buffer.cpp
2460- mesa/mesa_native_display_container.cpp
2461- mesa/native_surface.cpp
2462- ${CLIENT_SOURCES}
2463-)
2464-endif()
2465-
2466 add_library(
2467 mirclient SHARED
2468
2469@@ -81,14 +61,10 @@
2470 SOVERSION ${MIRCLIENT_ABI}
2471 )
2472
2473-# Ensure mirclient_compat_links exist before any dependents of mirclient
2474-add_dependencies(mirclient mirclient_compat_links)
2475-
2476 set(
2477 MIR_CLIENT_LIBRARIES
2478 ${Boost_LIBRARIES}
2479 ${CMAKE_THREAD_LIBS_INIT}
2480- ${LIBHARDWARE_LIBRARIES}
2481 ${PROTOBUF_LIBRARIES}
2482 ${XKBCOMMON_LIBRARIES}
2483
2484@@ -96,10 +72,10 @@
2485 mirsharedinput
2486 mirsharedlogging
2487 mirsharedenv
2488+ mirsharedsharedlibrary
2489 mirclientrpc
2490 mirclientlttngstatic
2491
2492- ${DRM_LIBRARIES}
2493 ${MIR_COMMON_PLATFORM_LIBRARIES}
2494
2495 3rd_party
2496
2497=== added file 'src/client/android/CMakeLists.txt'
2498--- src/client/android/CMakeLists.txt 1970-01-01 00:00:00 +0000
2499+++ src/client/android/CMakeLists.txt 2014-03-06 14:19:43 +0000
2500@@ -0,0 +1,38 @@
2501+include_directories(SYSTEM ${LIBHARDWARE_INCLUDE_DIRS})
2502+add_definitions(-DANDROID)
2503+
2504+add_library(
2505+ mirclientplatformandroid SHARED
2506+
2507+ android_client_buffer.cpp
2508+ android_client_buffer_factory.cpp
2509+ android_registrar.cpp
2510+ android_client_platform.cpp
2511+ client_platform_factory.cpp
2512+ client_surface_interpreter.cpp
2513+ android_native_display_container.cpp
2514+)
2515+
2516+set_target_properties(
2517+ mirclientplatformandroid PROPERTIES
2518+ OUTPUT_NAME mirclientplatform
2519+ LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
2520+)
2521+
2522+target_link_libraries(
2523+ mirclientplatformandroid
2524+ mirclient
2525+
2526+ ${LIBHARDWARE_LIBRARIES}
2527+)
2528+
2529+if (MIR_TEST_PLATFORM STREQUAL "android")
2530+ add_custom_command(TARGET mirclientplatformandroid
2531+ POST_BUILD
2532+ COMMAND ${CMAKE_COMMAND} -E remove libmirclientplatform.so
2533+ COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirclientplatformandroid> libmirclientplatform.so
2534+ WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
2535+ )
2536+endif()
2537+
2538+install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/android)
2539
2540=== modified file 'src/client/android/android_client_platform.cpp'
2541--- src/client/android/android_client_platform.cpp 2014-01-13 06:12:33 +0000
2542+++ src/client/android/android_client_platform.cpp 2014-03-06 14:19:43 +0000
2543@@ -22,7 +22,6 @@
2544 #include "android_client_buffer_factory.h"
2545 #include "client_surface_interpreter.h"
2546 #include "../mir_connection.h"
2547-#include "../native_client_platform_factory.h"
2548
2549 #include <EGL/egl.h>
2550
2551@@ -44,12 +43,6 @@
2552
2553 }
2554
2555-std::shared_ptr<mcl::ClientPlatform>
2556-mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* /*context*/)
2557-{
2558- return std::make_shared<mcla::AndroidClientPlatform>();
2559-}
2560-
2561 std::shared_ptr<mcl::ClientBufferFactory> mcla::AndroidClientPlatform::create_buffer_factory()
2562 {
2563 const hw_module_t *hw_module;
2564
2565=== added file 'src/client/android/client_platform_factory.cpp'
2566--- src/client/android/client_platform_factory.cpp 1970-01-01 00:00:00 +0000
2567+++ src/client/android/client_platform_factory.cpp 2014-03-06 14:19:43 +0000
2568@@ -0,0 +1,34 @@
2569+/*
2570+ * Copyright © 2014 Canonical Ltd.
2571+ *
2572+ * This program is free software: you can redistribute it and/or modify it
2573+ * under the terms of the GNU Lesser General Public License version 3,
2574+ * as published by the Free Software Foundation.
2575+ *
2576+ * This program is distributed in the hope that it will be useful,
2577+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2578+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2579+ * GNU Lesser General Public License for more details.
2580+ *
2581+ * You should have received a copy of the GNU Lesser General Public License
2582+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2583+ *
2584+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
2585+ */
2586+
2587+#include "client_platform_factory.h"
2588+#include "android_client_platform.h"
2589+
2590+namespace mcl = mir::client;
2591+namespace mcla = mcl::android;
2592+
2593+std::shared_ptr<mcl::ClientPlatform>
2594+mcla::ClientPlatformFactory::create_client_platform(mcl::ClientContext* /*context*/)
2595+{
2596+ return std::make_shared<mcla::AndroidClientPlatform>();
2597+}
2598+
2599+extern "C" std::shared_ptr<mcl::ClientPlatformFactory> mcl::create_client_platform_factory()
2600+{
2601+ return std::make_shared<mcla::ClientPlatformFactory>();
2602+}
2603
2604=== added file 'src/client/android/client_platform_factory.h'
2605--- src/client/android/client_platform_factory.h 1970-01-01 00:00:00 +0000
2606+++ src/client/android/client_platform_factory.h 2014-03-06 14:19:43 +0000
2607@@ -0,0 +1,41 @@
2608+/*
2609+ * Copyright © 2014 Canonical Ltd.
2610+ *
2611+ * This program is free software: you can redistribute it and/or modify it
2612+ * under the terms of the GNU Lesser General Public License version 3,
2613+ * as published by the Free Software Foundation.
2614+ *
2615+ * This program is distributed in the hope that it will be useful,
2616+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2617+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2618+ * GNU Lesser General Public License for more details.
2619+ *
2620+ * You should have received a copy of the GNU Lesser General Public License
2621+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2622+ *
2623+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
2624+ */
2625+
2626+#ifndef MIR_CLIENT_ANDROID_CLIENT_PLATFORM_FACTORY_H_
2627+#define MIR_CLIENT_ANDROID_CLIENT_PLATFORM_FACTORY_H_
2628+
2629+#include "../client_platform_factory.h"
2630+
2631+namespace mir
2632+{
2633+namespace client
2634+{
2635+namespace android
2636+{
2637+
2638+class ClientPlatformFactory : public client::ClientPlatformFactory
2639+{
2640+public:
2641+ std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) override;
2642+};
2643+
2644+}
2645+}
2646+}
2647+
2648+#endif /* MIR_CLIENT_ANDROID_CLIENT_PLATFORM_FACTORY_H_ */
2649
2650=== modified file 'src/client/client_platform_factory.h'
2651--- src/client/client_platform_factory.h 2013-04-24 05:22:20 +0000
2652+++ src/client/client_platform_factory.h 2014-03-06 14:19:43 +0000
2653@@ -18,6 +18,8 @@
2654 #ifndef MIR_CLIENT_CLIENT_PLATFORM_FACTORY_H_
2655 #define MIR_CLIENT_CLIENT_PLATFORM_FACTORY_H_
2656
2657+#include <memory>
2658+
2659 namespace mir
2660 {
2661 namespace client
2662@@ -29,16 +31,19 @@
2663 class ClientPlatformFactory
2664 {
2665 public:
2666- virtual ~ClientPlatformFactory() {}
2667+ virtual ~ClientPlatformFactory() = default;
2668
2669 virtual std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) = 0;
2670
2671 protected:
2672 ClientPlatformFactory() = default;
2673- ClientPlatformFactory(const ClientPlatformFactory& p) = delete;
2674- ClientPlatformFactory& operator=(const ClientPlatformFactory& p) = delete;
2675+ ClientPlatformFactory(ClientPlatformFactory const& p) = delete;
2676+ ClientPlatformFactory& operator=(ClientPlatformFactory const& p) = delete;
2677 };
2678
2679+extern "C" typedef std::shared_ptr<ClientPlatformFactory>(*CreateClientPlatformFactory)();
2680+extern "C" std::shared_ptr<ClientPlatformFactory> create_client_platform_factory();
2681+
2682 }
2683 }
2684
2685
2686=== modified file 'src/client/default_connection_configuration.cpp'
2687--- src/client/default_connection_configuration.cpp 2014-01-14 04:10:15 +0000
2688+++ src/client/default_connection_configuration.cpp 2014-03-06 14:19:43 +0000
2689@@ -22,14 +22,16 @@
2690 #include "rpc/make_rpc_channel.h"
2691 #include "rpc/null_rpc_report.h"
2692 #include "mir/logging/dumb_console_logger.h"
2693-#include "native_client_platform_factory.h"
2694 #include "mir/input/input_platform.h"
2695 #include "mir/input/null_input_receiver_report.h"
2696 #include "logging/rpc_report.h"
2697 #include "logging/input_receiver_report.h"
2698 #include "lttng/rpc_report.h"
2699+#include "lttng/input_receiver_report.h"
2700 #include "connection_surface_map.h"
2701 #include "lifecycle_control.h"
2702+#include "mir/shared_library.h"
2703+#include "client_platform_factory.h"
2704
2705 namespace mcl = mir::client;
2706
2707@@ -38,6 +40,23 @@
2708 std::string const off_opt_val{"off"};
2709 std::string const log_opt_val{"log"};
2710 std::string const lttng_opt_val{"lttng"};
2711+std::string const default_platform_lib{"libmirclientplatform.so"};
2712+
2713+mir::SharedLibrary const* load_library(std::string const& libname)
2714+{
2715+ // There's no point in loading twice, and it isn't safe to unload...
2716+ static std::map<std::string, std::shared_ptr<mir::SharedLibrary>> libraries_cache;
2717+
2718+ if (auto& ptr = libraries_cache[libname])
2719+ {
2720+ return ptr.get();
2721+ }
2722+ else
2723+ {
2724+ ptr = std::make_shared<mir::SharedLibrary>(libname);
2725+ return ptr.get();
2726+ }
2727+}
2728 }
2729
2730 mcl::DefaultConnectionConfiguration::DefaultConnectionConfiguration(
2731@@ -82,7 +101,15 @@
2732 return client_platform_factory(
2733 []
2734 {
2735- return std::make_shared<mcl::NativeClientPlatformFactory>();
2736+ auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB");
2737+ std::string const val{val_raw ? val_raw : default_platform_lib};
2738+ auto const platform_lib = load_library(val);
2739+
2740+ auto const create_client_platform_factory =
2741+ platform_lib->load_function<mcl::CreateClientPlatformFactory>(
2742+ "create_client_platform_factory");
2743+
2744+ return create_client_platform_factory();
2745 });
2746 }
2747
2748@@ -131,6 +158,8 @@
2749
2750 if (val == log_opt_val)
2751 return std::make_shared<mcl::logging::InputReceiverReport>(the_logger());
2752+ else if (val == lttng_opt_val)
2753+ return std::make_shared<mcl::lttng::InputReceiverReport>();
2754 else
2755 return std::make_shared<mir::input::receiver::NullInputReceiverReport>();
2756 });
2757
2758=== modified file 'src/client/lttng/CMakeLists.txt'
2759--- src/client/lttng/CMakeLists.txt 2014-01-13 06:12:33 +0000
2760+++ src/client/lttng/CMakeLists.txt 2014-03-06 14:19:43 +0000
2761@@ -5,13 +5,10 @@
2762
2763 client_tracepoint_provider.cpp
2764 rpc_report.cpp
2765-)
2766-
2767-add_library(
2768- mirclientlttng SHARED
2769-
2770- rpc_report_tp.c
2771-)
2772+ input_receiver_report.cpp
2773+)
2774+
2775+add_library(mirclientlttng SHARED tracepoints.c)
2776
2777 # Don't treat missing-field-initializers as an error, since
2778 # the LTTng macros contain code that triggers this (but it's
2779
2780=== modified file 'src/client/lttng/client_tracepoint_provider.h'
2781--- src/client/lttng/client_tracepoint_provider.h 2013-06-03 12:15:45 +0000
2782+++ src/client/lttng/client_tracepoint_provider.h 2014-03-06 14:19:43 +0000
2783@@ -19,7 +19,7 @@
2784 #ifndef MIR_CLIENT_LTTNG_CLIENT_TRACEPOINT_PROVIDER_H_
2785 #define MIR_CLIENT_LTTNG_CLIENT_TRACEPOINT_PROVIDER_H_
2786
2787-#include "mir/lttng/tracepoint_provider.h"
2788+#include "mir/report/lttng/tracepoint_provider.h"
2789
2790 namespace mir
2791 {
2792@@ -28,7 +28,7 @@
2793 namespace lttng
2794 {
2795
2796-class ClientTracepointProvider : public mir::lttng::TracepointProvider
2797+class ClientTracepointProvider : public mir::report::lttng::TracepointProvider
2798 {
2799 public:
2800 ClientTracepointProvider();
2801
2802=== added file 'src/client/lttng/input_receiver_report.cpp'
2803--- src/client/lttng/input_receiver_report.cpp 1970-01-01 00:00:00 +0000
2804+++ src/client/lttng/input_receiver_report.cpp 2014-03-06 14:19:43 +0000
2805@@ -0,0 +1,65 @@
2806+/*
2807+ * Copyright © 2014 Canonical Ltd.
2808+ *
2809+ * This program is free software: you can redistribute it and/or modify
2810+ * it under the terms of the GNU Lesser General Public License version 3 as
2811+ * published by the Free Software Foundation.
2812+ *
2813+ * This program is distributed in the hope that it will be useful,
2814+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2815+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2816+ * GNU Lesser General Public License for more details.
2817+ *
2818+ * You should have received a copy of the GNU Lesser General Public License
2819+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2820+ *
2821+ * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
2822+ */
2823+
2824+#include "input_receiver_report.h"
2825+#include "mir/report/lttng/mir_tracepoint.h"
2826+
2827+#include <stdexcept>
2828+#include <boost/throw_exception.hpp>
2829+
2830+#define TRACEPOINT_DEFINE
2831+#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
2832+#include "input_receiver_report_tp.h"
2833+
2834+void mir::client::lttng::InputReceiverReport::received_event(MirEvent const& event)
2835+{
2836+ switch (event.type)
2837+ {
2838+ case mir_event_type_key:
2839+ report(event.key);
2840+ break;
2841+ case mir_event_type_motion:
2842+ report(event.motion);
2843+ break;
2844+ default:
2845+ BOOST_THROW_EXCEPTION(std::runtime_error("Unexpected event type"));
2846+ }
2847+}
2848+
2849+void mir::client::lttng::InputReceiverReport::report(MirKeyEvent const& event) const
2850+{
2851+ mir_tracepoint(mir_client_input_receiver, key_event, event.device_id, event.source_id,
2852+ static_cast<int>(event.action), static_cast<int>(event.flags), event.modifiers, event.key_code,
2853+ event.scan_code, event.down_time, event.event_time);
2854+}
2855+
2856+void mir::client::lttng::InputReceiverReport::report(MirMotionEvent const& event) const
2857+{
2858+ mir_tracepoint(mir_client_input_receiver, motion_event, event.device_id, event.source_id, event.action,
2859+ static_cast<int>(event.flags), event.modifiers, event.edge_flags,
2860+ static_cast<int>(event.button_state), event.down_time, event.event_time);
2861+ for (unsigned int i = 0; i < event.pointer_count; i++)
2862+ {
2863+ mir_tracepoint(mir_client_input_receiver, motion_event_coordinate,
2864+ event.pointer_coordinates[i].id, event.pointer_coordinates[i].x, event.pointer_coordinates[i].y,
2865+ event.pointer_coordinates[i].touch_major, event.pointer_coordinates[i].touch_minor,
2866+ event.pointer_coordinates[i].size, event.pointer_coordinates[i].pressure,
2867+ event.pointer_coordinates[i].orientation);
2868+ }
2869+}
2870+
2871
2872=== added file 'src/client/lttng/input_receiver_report.h'
2873--- src/client/lttng/input_receiver_report.h 1970-01-01 00:00:00 +0000
2874+++ src/client/lttng/input_receiver_report.h 2014-03-06 14:19:43 +0000
2875@@ -0,0 +1,46 @@
2876+/*
2877+ * Copyright © 2014 Canonical Ltd.
2878+ *
2879+ * This program is free software: you can redistribute it and/or modify
2880+ * it under the terms of the GNU Lesser General Public License version 3 as
2881+ * published by the Free Software Foundation.
2882+ *
2883+ * This program is distributed in the hope that it will be useful,
2884+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2885+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2886+ * GNU Lesser General Public License for more details.
2887+ *
2888+ * You should have received a copy of the GNU Lesser General Public License
2889+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2890+ *
2891+ * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
2892+ */
2893+
2894+#ifndef MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_H_
2895+#define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_H_
2896+
2897+#include "mir/input/input_receiver_report.h"
2898+#include "client_tracepoint_provider.h"
2899+
2900+namespace mir
2901+{
2902+namespace client
2903+{
2904+namespace lttng
2905+{
2906+
2907+class InputReceiverReport : public input::receiver::InputReceiverReport
2908+{
2909+public:
2910+ void received_event(MirEvent const& event) override;
2911+private:
2912+ void report(MirKeyEvent const& event) const;
2913+ void report(MirMotionEvent const& event) const;
2914+ ClientTracepointProvider tp_provider;
2915+};
2916+
2917+}
2918+}
2919+}
2920+
2921+#endif /* MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_H_ */
2922
2923=== added file 'src/client/lttng/input_receiver_report_tp.h'
2924--- src/client/lttng/input_receiver_report_tp.h 1970-01-01 00:00:00 +0000
2925+++ src/client/lttng/input_receiver_report_tp.h 2014-03-06 14:19:43 +0000
2926@@ -0,0 +1,96 @@
2927+/*
2928+ * Copyright © 2014 Canonical Ltd.
2929+ *
2930+ * This program is free software: you can redistribute it and/or modify
2931+ * it under the terms of the GNU Lesser General Public License version 3 as
2932+ * published by the Free Software Foundation.
2933+ *
2934+ * This program is distributed in the hope that it will be useful,
2935+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2936+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2937+ * GNU Lesser General Public License for more details.
2938+ *
2939+ * You should have received a copy of the GNU Lesser General Public License
2940+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2941+ *
2942+ * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
2943+ */
2944+
2945+#undef TRACEPOINT_PROVIDER
2946+#define TRACEPOINT_PROVIDER mir_client_input_receiver
2947+
2948+#undef TRACEPOINT_INCLUDE
2949+#define TRACEPOINT_INCLUDE "./input_receiver_report_tp.h"
2950+
2951+#if !defined(MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ)
2952+#define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_
2953+
2954+#include <lttng/tracepoint.h>
2955+
2956+#ifdef __clang__
2957+/*
2958+ * TRACEPOINT_EVENT defines functions; since we disable tracepoints under clang
2959+ * these functions are unused and so generate fatal warnings.
2960+ * (see mir_tracepoint.h and http://sourceware.org/bugzilla/show_bug.cgi?id=13974)
2961+ */
2962+#pragma clang diagnostic push
2963+#pragma clang diagnostic warning "-Wunused-function"
2964+#endif
2965+
2966+TRACEPOINT_EVENT(
2967+ mir_client_input_receiver,
2968+ key_event,
2969+ TP_ARGS(int32_t, device_id, int32_t, source_id, int, action, int, flags, unsigned int, modifiers, int32_t, key_code, int32_t, scan_code, int64_t, down_time, int64_t, event_time),
2970+ TP_FIELDS(
2971+ ctf_integer(int32_t, device_id, device_id)
2972+ ctf_integer(int32_t, source_id, source_id)
2973+ ctf_integer(int, action, action)
2974+ ctf_integer(int, flags, flags)
2975+ ctf_integer(unsigned int, modifiers, modifiers)
2976+ ctf_integer(int32_t, key_code, key_code)
2977+ ctf_integer(int32_t, scan_code, scan_code)
2978+ ctf_integer(int64_t, down_time, down_time)
2979+ ctf_integer(int64_t, event_time, event_time)
2980+ )
2981+)
2982+
2983+TRACEPOINT_EVENT(
2984+ mir_client_input_receiver,
2985+ motion_event,
2986+ TP_ARGS(int32_t, device_id, int32_t, source_id, int, action, int, flags, unsigned int, modifiers, int32_t, edge_flags, int, button_state, int64_t, down_time, int64_t, event_time),
2987+ TP_FIELDS(
2988+ ctf_integer(int32_t, device_id, device_id)
2989+ ctf_integer(int32_t, source_id, source_id)
2990+ ctf_integer(int, action, action)
2991+ ctf_integer(int, flags, flags)
2992+ ctf_integer(unsigned int, modifiers, modifiers)
2993+ ctf_integer(int32_t, edge_flags, edge_flags)
2994+ ctf_integer(int, button_state, button_state)
2995+ ctf_integer(int64_t, down_time, down_time)
2996+ ctf_integer(int64_t, event_time, event_time)
2997+ )
2998+)
2999+
3000+TRACEPOINT_EVENT(
3001+ mir_client_input_receiver,
3002+ motion_event_coordinate,
3003+ TP_ARGS(int, id, float, x, float, y, float, touch_major, float, touch_minor, float, size, float, pressure, float, orientation),
3004+ TP_FIELDS(
3005+ ctf_integer(int, id, id)
3006+ ctf_float(float, x, x)
3007+ ctf_float(float, y, y)
3008+ ctf_float(float, touch_major, touch_major)
3009+ ctf_float(float, touch_minor, touch_minor)
3010+ ctf_float(float, size, size)
3011+ ctf_float(float, pressure, pressure)
3012+ ctf_float(float, orientation, orientation)
3013+ )
3014+)
3015+
3016+#ifdef __clang__
3017+#pragma clang diagnostic pop
3018+#endif
3019+
3020+#endif /* MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_ */
3021+
3022+#include <lttng/tracepoint-event.h>
3023
3024=== modified file 'src/client/lttng/rpc_report.cpp'
3025--- src/client/lttng/rpc_report.cpp 2013-09-26 13:50:11 +0000
3026+++ src/client/lttng/rpc_report.cpp 2014-03-06 14:19:43 +0000
3027@@ -17,7 +17,7 @@
3028 */
3029
3030 #include "rpc_report.h"
3031-#include "mir/lttng/mir_tracepoint.h"
3032+#include "mir/report/lttng/mir_tracepoint.h"
3033
3034 #include "mir_protobuf_wire.pb.h"
3035
3036
3037=== removed file 'src/client/lttng/rpc_report_tp.c'
3038--- src/client/lttng/rpc_report_tp.c 2013-06-03 12:15:45 +0000
3039+++ src/client/lttng/rpc_report_tp.c 1970-01-01 00:00:00 +0000
3040@@ -1,4 +0,0 @@
3041-/* The probes need to be compiled in a C file (not C++) */
3042-#define TRACEPOINT_CREATE_PROBES
3043-
3044-#include "rpc_report_tp.h"
3045
3046=== added file 'src/client/lttng/tracepoints.c'
3047--- src/client/lttng/tracepoints.c 1970-01-01 00:00:00 +0000
3048+++ src/client/lttng/tracepoints.c 2014-03-06 14:19:43 +0000
3049@@ -0,0 +1,5 @@
3050+/* The probes need to be compiled in a C file (not C++) */
3051+#define TRACEPOINT_CREATE_PROBES
3052+
3053+#include "rpc_report_tp.h"
3054+#include "input_receiver_report_tp.h"
3055
3056=== added file 'src/client/mesa/CMakeLists.txt'
3057--- src/client/mesa/CMakeLists.txt 1970-01-01 00:00:00 +0000
3058+++ src/client/mesa/CMakeLists.txt 2014-03-06 14:19:43 +0000
3059@@ -0,0 +1,40 @@
3060+include_directories(
3061+ ${DRM_INCLUDE_DIRS}
3062+ ${EGL_INCLUDE_DIRS}
3063+)
3064+
3065+add_library(
3066+ mirclientplatformmesa SHARED
3067+
3068+ client_platform_factory.cpp
3069+ client_platform.cpp
3070+ client_buffer_factory.cpp
3071+ client_buffer.cpp
3072+ mesa_native_display_container.cpp
3073+ native_surface.cpp
3074+)
3075+
3076+set_target_properties(
3077+ mirclientplatformmesa PROPERTIES
3078+ OUTPUT_NAME mirclientplatform
3079+ LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
3080+)
3081+
3082+target_link_libraries(
3083+ mirclientplatformmesa
3084+ mirclient
3085+
3086+ ${DRM_LDFLAGS} ${DRM_LIBRARIES}
3087+)
3088+
3089+if (MIR_TEST_PLATFORM STREQUAL "mesa")
3090+ add_custom_command(TARGET mirclientplatformmesa
3091+ POST_BUILD
3092+ COMMAND ${CMAKE_COMMAND} -E remove libmirclientplatform.so
3093+ COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirclientplatformmesa> libmirclientplatform.so
3094+ WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
3095+ )
3096+endif()
3097+
3098+install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/mesa)
3099+
3100
3101=== modified file 'src/client/mesa/client_platform.cpp'
3102--- src/client/mesa/client_platform.cpp 2014-01-13 06:12:33 +0000
3103+++ src/client/mesa/client_platform.cpp 2014-03-06 14:19:43 +0000
3104@@ -20,14 +20,9 @@
3105 #include "client_platform.h"
3106 #include "client_buffer_factory.h"
3107 #include "mesa_native_display_container.h"
3108-#include "buffer_file_ops.h"
3109 #include "native_surface.h"
3110 #include "../mir_connection.h"
3111 #include "../client_buffer_factory.h"
3112-#include "../native_client_platform_factory.h"
3113-
3114-#include <sys/mman.h>
3115-#include <unistd.h>
3116
3117 namespace mcl=mir::client;
3118 namespace mclm=mir::client::mesa;
3119@@ -36,31 +31,6 @@
3120 namespace
3121 {
3122
3123-struct RealBufferFileOps : public mclm::BufferFileOps
3124-{
3125- int close(int fd) const
3126- {
3127- while (::close(fd) == -1)
3128- {
3129- // Retry on EINTR, return error on anything else
3130- if (errno != EINTR)
3131- return errno;
3132- }
3133- return 0;
3134- }
3135-
3136- void* map(int fd, off_t offset, size_t size) const
3137- {
3138- return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,
3139- fd, offset);
3140- }
3141-
3142- void unmap(void* addr, size_t size) const
3143- {
3144- munmap(addr, size);
3145- }
3146-};
3147-
3148 struct NativeDisplayDeleter
3149 {
3150 NativeDisplayDeleter(mcl::EGLNativeDisplayContainer& container)
3151@@ -79,14 +49,6 @@
3152
3153 }
3154
3155-std::shared_ptr<mcl::ClientPlatform>
3156-mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
3157-{
3158- auto buffer_file_ops = std::make_shared<RealBufferFileOps>();
3159- return std::make_shared<mclm::ClientPlatform>(
3160- context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());
3161-}
3162-
3163 mclm::ClientPlatform::ClientPlatform(
3164 ClientContext* const context,
3165 std::shared_ptr<BufferFileOps> const& buffer_file_ops,
3166@@ -125,7 +87,7 @@
3167 //TODO: this is awkward on both android and gbm...
3168 auto native_window = new NativeSurface(*client_surface);
3169 auto egl_native_window = new EGLNativeWindowType;
3170- *egl_native_window = native_window;
3171+ *egl_native_window = reinterpret_cast<EGLNativeWindowType>(native_window);
3172 NativeWindowDeleter deleter(native_window);
3173 return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);
3174 }
3175
3176=== added file 'src/client/mesa/client_platform_factory.cpp'
3177--- src/client/mesa/client_platform_factory.cpp 1970-01-01 00:00:00 +0000
3178+++ src/client/mesa/client_platform_factory.cpp 2014-03-06 14:19:43 +0000
3179@@ -0,0 +1,71 @@
3180+/*
3181+ * Copyright © 2014 Canonical Ltd.
3182+ *
3183+ * This program is free software: you can redistribute it and/or modify it
3184+ * under the terms of the GNU Lesser General Public License version 3,
3185+ * as published by the Free Software Foundation.
3186+ *
3187+ * This program is distributed in the hope that it will be useful,
3188+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3189+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3190+ * GNU Lesser General Public License for more details.
3191+ *
3192+ * You should have received a copy of the GNU Lesser General Public License
3193+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3194+ *
3195+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3196+ */
3197+
3198+#include "client_platform_factory.h"
3199+#include "client_platform.h"
3200+#include "buffer_file_ops.h"
3201+#include "../egl_native_display_container.h"
3202+
3203+#include <sys/mman.h>
3204+#include <unistd.h>
3205+
3206+namespace mcl = mir::client;
3207+namespace mclm = mcl::mesa;
3208+
3209+namespace
3210+{
3211+
3212+struct RealBufferFileOps : public mclm::BufferFileOps
3213+{
3214+ int close(int fd) const
3215+ {
3216+ while (::close(fd) == -1)
3217+ {
3218+ // Retry on EINTR, return error on anything else
3219+ if (errno != EINTR)
3220+ return errno;
3221+ }
3222+ return 0;
3223+ }
3224+
3225+ void* map(int fd, off_t offset, size_t size) const
3226+ {
3227+ return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,
3228+ fd, offset);
3229+ }
3230+
3231+ void unmap(void* addr, size_t size) const
3232+ {
3233+ munmap(addr, size);
3234+ }
3235+};
3236+
3237+}
3238+
3239+std::shared_ptr<mcl::ClientPlatform>
3240+mclm::ClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
3241+{
3242+ auto buffer_file_ops = std::make_shared<RealBufferFileOps>();
3243+ return std::make_shared<mclm::ClientPlatform>(
3244+ context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());
3245+}
3246+
3247+extern "C" std::shared_ptr<mcl::ClientPlatformFactory> mcl::create_client_platform_factory()
3248+{
3249+ return std::make_shared<mclm::ClientPlatformFactory>();
3250+}
3251
3252=== added file 'src/client/mesa/client_platform_factory.h'
3253--- src/client/mesa/client_platform_factory.h 1970-01-01 00:00:00 +0000
3254+++ src/client/mesa/client_platform_factory.h 2014-03-06 14:19:43 +0000
3255@@ -0,0 +1,41 @@
3256+/*
3257+ * Copyright © 2014 Canonical Ltd.
3258+ *
3259+ * This program is free software: you can redistribute it and/or modify it
3260+ * under the terms of the GNU Lesser General Public License version 3,
3261+ * as published by the Free Software Foundation.
3262+ *
3263+ * This program is distributed in the hope that it will be useful,
3264+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3265+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3266+ * GNU Lesser General Public License for more details.
3267+ *
3268+ * You should have received a copy of the GNU Lesser General Public License
3269+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3270+ *
3271+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3272+ */
3273+
3274+#ifndef MIR_CLIENT_MESA_CLIENT_PLATFORM_FACTORY_H_
3275+#define MIR_CLIENT_MESA_CLIENT_PLATFORM_FACTORY_H_
3276+
3277+#include "../client_platform_factory.h"
3278+
3279+namespace mir
3280+{
3281+namespace client
3282+{
3283+namespace mesa
3284+{
3285+
3286+class ClientPlatformFactory : public client::ClientPlatformFactory
3287+{
3288+public:
3289+ std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) override;
3290+};
3291+
3292+}
3293+}
3294+}
3295+
3296+#endif /* MIR_CLIENT_MESA_CLIENT_PLATFORM_FACTORY_H_ */
3297
3298=== modified file 'src/client/mesa/native_surface.cpp'
3299--- src/client/mesa/native_surface.cpp 2014-01-27 16:59:40 +0000
3300+++ src/client/mesa/native_surface.cpp 2014-03-06 14:19:43 +0000
3301@@ -46,7 +46,7 @@
3302 }
3303
3304 mclm::NativeSurface::NativeSurface(ClientSurface& surface)
3305- : surface(surface)
3306+ : starting(true), surface(surface)
3307 {
3308 surface_advance_buffer = advance_buffer_static;
3309 surface_get_parameters = get_parameters_static;
3310@@ -55,7 +55,17 @@
3311
3312 int mclm::NativeSurface::advance_buffer(MirBufferPackage* buffer_package)
3313 {
3314- surface.request_and_wait_for_next_buffer();
3315+ /*
3316+ * At present dri2_create_mir_window_surface will trigger
3317+ * mir_advance_colour_buffer which will land here. Since we're still
3318+ * creating the window, we don't have any buffers we want the server to
3319+ * composite, so avoid sending a request to the server on startup:
3320+ */
3321+ if (starting)
3322+ starting = false;
3323+ else
3324+ surface.request_and_wait_for_next_buffer();
3325+
3326 auto buffer = surface.get_current_buffer();
3327
3328 auto buffer_to_driver = buffer->native_buffer_handle();
3329
3330=== modified file 'src/client/mesa/native_surface.h'
3331--- src/client/mesa/native_surface.h 2014-01-13 06:12:33 +0000
3332+++ src/client/mesa/native_surface.h 2014-03-06 14:19:43 +0000
3333@@ -39,6 +39,7 @@
3334 int set_swapinterval(int interval);
3335
3336 private:
3337+ bool starting;
3338 ClientSurface& surface;
3339 };
3340
3341
3342=== modified file 'src/client/mir_client_library.cpp'
3343--- src/client/mir_client_library.cpp 2014-01-28 18:21:14 +0000
3344+++ src/client/mir_client_library.cpp 2014-03-06 14:19:43 +0000
3345@@ -25,7 +25,6 @@
3346 #include "mir_connection.h"
3347 #include "display_configuration.h"
3348 #include "mir_surface.h"
3349-#include "native_client_platform_factory.h"
3350 #include "egl_native_display_container.h"
3351 #include "default_connection_configuration.h"
3352 #include "lifecycle_control.h"
3353@@ -397,7 +396,7 @@
3354
3355 MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface)
3356 {
3357- return surface->generate_native_window();
3358+ return reinterpret_cast<MirEGLNativeWindowType>(surface->generate_native_window());
3359 }
3360
3361 MirWaitHandle* mir_surface_set_type(MirSurface *surf,
3362
3363=== modified file 'src/client/mir_connection.cpp'
3364--- src/client/mir_connection.cpp 2014-01-24 18:11:19 +0000
3365+++ src/client/mir_connection.cpp 2014-03-06 14:19:43 +0000
3366@@ -16,8 +16,6 @@
3367 * Authored by: Thomas Guest <thomas.guest@canonical.com>
3368 */
3369
3370-#include "mir/logging/logger.h"
3371-
3372 #include "mir_connection.h"
3373 #include "mir_surface.h"
3374 #include "client_platform.h"
3375@@ -28,6 +26,8 @@
3376 #include "connection_surface_map.h"
3377 #include "lifecycle_control.h"
3378
3379+#include "mir/logging/logger.h"
3380+
3381 #include <algorithm>
3382 #include <cstddef>
3383 #include <unistd.h>
3384@@ -458,6 +458,7 @@
3385 display_request->set_output_id(output.output_id);
3386 display_request->set_used(output.used);
3387 display_request->set_current_mode(output.current_mode);
3388+ display_request->set_current_format(output.current_format);
3389 display_request->set_position_x(output.position_x);
3390 display_request->set_position_y(output.position_y);
3391 display_request->set_power_mode(output.power_mode);
3392
3393=== modified file 'src/client/mir_screencast_api.cpp'
3394--- src/client/mir_screencast_api.cpp 2014-01-29 18:02:33 +0000
3395+++ src/client/mir_screencast_api.cpp 2014-03-06 14:19:43 +0000
3396@@ -96,5 +96,5 @@
3397
3398 MirEGLNativeWindowType mir_screencast_egl_native_window(MirScreencast* screencast)
3399 {
3400- return screencast->egl_native_window();
3401+ return reinterpret_cast<MirEGLNativeWindowType>(screencast->egl_native_window());
3402 }
3403
3404=== removed file 'src/client/native_client_platform_factory.h'
3405--- src/client/native_client_platform_factory.h 2013-06-17 09:51:42 +0000
3406+++ src/client/native_client_platform_factory.h 1970-01-01 00:00:00 +0000
3407@@ -1,49 +0,0 @@
3408-/*
3409- * Copyright © 2012 Canonical Ltd.
3410- *
3411- * This program is free software: you can redistribute it and/or modify it
3412- * under the terms of the GNU Lesser General Public License version 3,
3413- * as published by the Free Software Foundation.
3414- *
3415- * This program is distributed in the hope that it will be useful,
3416- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3417- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3418- * GNU Lesser General Public License for more details.
3419- *
3420- * You should have received a copy of the GNU Lesser General Public License
3421- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3422- *
3423- * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3424- */
3425-
3426-#ifndef MIR_CLIENT_NATIVE_CLIENT_PLATFORM_FACTORY_
3427-#define MIR_CLIENT_NATIVE_CLIENT_PLATFORM_FACTORY_
3428-
3429-#include "client_platform_factory.h"
3430-
3431-namespace mir
3432-{
3433-namespace client
3434-{
3435-
3436-/**
3437- * Factory for creating the native client platform.
3438- * \ingroup platform_enablement
3439- */
3440-class NativeClientPlatformFactory : public ClientPlatformFactory
3441-{
3442-public:
3443- /**
3444- * Creates a client platform.
3445- *
3446- * This method needs to be implemented by each platform.
3447- *
3448- * \param [in] context information about the client
3449- */
3450- std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context);
3451-};
3452-
3453-}
3454-}
3455-
3456-#endif /* MIR_CLIENT_NATIVE_CLIENT_PLATFORM_FACTORY_ */
3457
3458=== modified file 'src/platform/CMakeLists.txt'
3459--- src/platform/CMakeLists.txt 2014-01-22 08:32:55 +0000
3460+++ src/platform/CMakeLists.txt 2014-03-06 14:19:43 +0000
3461@@ -17,3 +17,4 @@
3462 install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
3463
3464 add_subdirectory(graphics/)
3465+add_subdirectory(options)
3466
3467=== modified file 'src/platform/graphics/CMakeLists.txt'
3468--- src/platform/graphics/CMakeLists.txt 2014-01-22 08:32:55 +0000
3469+++ src/platform/graphics/CMakeLists.txt 2014-03-06 14:19:43 +0000
3470@@ -8,7 +8,6 @@
3471 egl_extensions.cpp
3472 egl_resources.cpp
3473 display_configuration.cpp
3474- null_display_report.cpp
3475 buffer_basic.cpp
3476 pixel_format_utils.cpp
3477 )
3478@@ -26,11 +25,11 @@
3479 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
3480 )
3481
3482-if (MIR_PLATFORM STREQUAL "android")
3483+if (MIR_BUILD_PLATFORM_ANDROID)
3484 add_subdirectory(android/)
3485 endif()
3486
3487-if (MIR_PLATFORM STREQUAL "mesa")
3488+if (MIR_BUILD_PLATFORM_MESA)
3489 add_subdirectory(mesa/)
3490 endif()
3491
3492
3493=== modified file 'src/platform/graphics/android/CMakeLists.txt'
3494--- src/platform/graphics/android/CMakeLists.txt 2014-01-21 18:09:35 +0000
3495+++ src/platform/graphics/android/CMakeLists.txt 2014-03-06 14:19:43 +0000
3496@@ -4,8 +4,11 @@
3497 ${GLESv2_INCLUDE_DIRS}
3498 )
3499
3500+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
3501+add_definitions( -DANDROID )
3502+
3503 add_library(
3504- mirplatformgraphics SHARED
3505+ mirplatformgraphicsandroid SHARED
3506
3507 android_platform.cpp
3508 android_buffer_allocator.cpp
3509@@ -31,8 +34,14 @@
3510 gl_context.cpp
3511 )
3512
3513+set_target_properties(
3514+ mirplatformgraphicsandroid PROPERTIES
3515+ OUTPUT_NAME mirplatformgraphics
3516+ LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
3517+)
3518+
3519 target_link_libraries(
3520- mirplatformgraphics
3521+ mirplatformgraphicsandroid
3522
3523 mirplatform
3524 mirsharedandroid
3525@@ -42,4 +51,13 @@
3526 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
3527 )
3528
3529-install(TARGETS mirplatformgraphics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
3530+if (MIR_TEST_PLATFORM STREQUAL "android")
3531+ add_custom_command(TARGET mirplatformgraphicsandroid
3532+ POST_BUILD
3533+ COMMAND ${CMAKE_COMMAND} -E remove libmirplatformgraphics.so
3534+ COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> libmirplatformgraphics.so
3535+ WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
3536+ )
3537+endif()
3538+
3539+install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/android)
3540
3541=== modified file 'src/platform/graphics/android/android_display.cpp'
3542--- src/platform/graphics/android/android_display.cpp 2014-01-31 07:48:24 +0000
3543+++ src/platform/graphics/android/android_display.cpp 2014-03-06 14:19:43 +0000
3544@@ -17,14 +17,13 @@
3545 */
3546
3547 #include "mir/graphics/platform.h"
3548-#include "mir/graphics/display_configuration.h"
3549+#include "android_display_configuration.h"
3550 #include "mir/graphics/display_report.h"
3551 #include "mir/graphics/display_buffer.h"
3552 #include "mir/graphics/gl_context.h"
3553 #include "mir/graphics/egl_resources.h"
3554 #include "android_display.h"
3555 #include "display_builder.h"
3556-#include "display_device.h"
3557 #include "mir/geometry/rectangle.h"
3558
3559 namespace mga=mir::graphics::android;
3560@@ -35,9 +34,7 @@
3561 std::shared_ptr<DisplayReport> const& display_report)
3562 : display_builder{display_builder},
3563 gl_context{display_builder->display_format(), *display_report},
3564- display_device(display_builder->create_display_device()),
3565- display_buffer{display_builder->create_display_buffer(display_device, gl_context)},
3566- current_configuration{display_buffer->view_area().size}
3567+ display_buffer{display_builder->create_display_buffer(gl_context)}
3568 {
3569 display_report->report_successful_setup_of_native_resources();
3570
3571@@ -55,31 +52,15 @@
3572 std::unique_ptr<mg::DisplayConfiguration> mga::AndroidDisplay::configuration() const
3573 {
3574 return std::unique_ptr<mg::DisplayConfiguration>(
3575- new mga::AndroidDisplayConfiguration(current_configuration)
3576- );
3577+ new mga::AndroidDisplayConfiguration(display_buffer->configuration()));
3578 }
3579
3580 void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration)
3581 {
3582- MirOrientation orientation = mir_orientation_normal;
3583-
3584 configuration.for_each_output([&](mg::DisplayConfigurationOutput const& output)
3585 {
3586- // TODO: Properly support multiple outputs
3587- display_device->mode(output.power_mode);
3588- orientation = output.orientation;
3589+ display_buffer->configure(output);
3590 });
3591- current_configuration = dynamic_cast<mga::AndroidDisplayConfiguration const&>(configuration);
3592-
3593- /*
3594- * It's tempting to put orient() into the base class and so avoid this
3595- * cast, but we only need it in the Android implementation right now.
3596- */
3597- if (android::DisplayBuffer* db =
3598- dynamic_cast<mga::DisplayBuffer*>(display_buffer.get()))
3599- {
3600- db->orient(orientation);
3601- }
3602 }
3603
3604 void mga::AndroidDisplay::register_configuration_change_handler(
3605
3606=== modified file 'src/platform/graphics/android/android_display.h'
3607--- src/platform/graphics/android/android_display.h 2014-01-31 07:48:24 +0000
3608+++ src/platform/graphics/android/android_display.h 2014-03-06 14:19:43 +0000
3609@@ -19,9 +19,7 @@
3610 #ifndef MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_H_
3611 #define MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_H_
3612
3613-#include "display_buffer.h"
3614 #include "mir/graphics/display.h"
3615-#include "android_display_configuration.h"
3616 #include "gl_context.h"
3617
3618 #include <memory>
3619@@ -35,10 +33,9 @@
3620
3621 namespace android
3622 {
3623-class DisplayDevice;
3624-
3625 class DisplayBuilder;
3626 class DisplaySupportProvider;
3627+class ConfigurableDisplayBuffer;
3628
3629 class AndroidDisplay : public Display
3630 {
3631@@ -69,10 +66,9 @@
3632 private:
3633 std::shared_ptr<DisplayBuilder> const display_builder;
3634 GLContext gl_context;
3635- std::shared_ptr<DisplayDevice> const display_device;
3636+
3637 //we only have a primary display at the moment
3638- std::unique_ptr<graphics::DisplayBuffer> const display_buffer;
3639- AndroidDisplayConfiguration current_configuration;
3640+ std::unique_ptr<ConfigurableDisplayBuffer> const display_buffer;
3641 };
3642
3643 }
3644
3645=== modified file 'src/platform/graphics/android/android_display_configuration.cpp'
3646--- src/platform/graphics/android/android_display_configuration.cpp 2014-01-23 22:03:09 +0000
3647+++ src/platform/graphics/android/android_display_configuration.cpp 2014-03-06 14:19:43 +0000
3648@@ -20,25 +20,9 @@
3649 namespace mga = mg::android;
3650 namespace geom = mir::geometry;
3651
3652-mga::AndroidDisplayConfiguration::AndroidDisplayConfiguration(geom::Size const& display_size)
3653- : configuration{mg::DisplayConfigurationOutputId{1},
3654- mg::DisplayConfigurationCardId{0},
3655- mg::DisplayConfigurationOutputType::lvds,
3656- {
3657- mir_pixel_format_abgr_8888,
3658- mir_pixel_format_xbgr_8888
3659- },
3660- {mg::DisplayConfigurationMode{display_size,0.0f}},
3661- 0,
3662- geom::Size{0,0},
3663- true,
3664- true,
3665- geom::Point{0,0},
3666- 0,
3667- mir_pixel_format_abgr_8888,
3668- mir_power_mode_on,
3669- mir_orientation_normal},
3670- card{mg::DisplayConfigurationCardId{0}, 1}
3671+mga::AndroidDisplayConfiguration::AndroidDisplayConfiguration(mg::DisplayConfigurationOutput && output)
3672+ : configuration(std::move(output)),
3673+ card{mg::DisplayConfigurationCardId{0}, 1}
3674 {
3675 }
3676
3677
3678=== modified file 'src/platform/graphics/android/android_display_configuration.h'
3679--- src/platform/graphics/android/android_display_configuration.h 2014-01-13 06:12:33 +0000
3680+++ src/platform/graphics/android/android_display_configuration.h 2014-03-06 14:19:43 +0000
3681@@ -29,7 +29,7 @@
3682 class AndroidDisplayConfiguration : public graphics::DisplayConfiguration
3683 {
3684 public:
3685- AndroidDisplayConfiguration(geometry::Size const& display_size);
3686+ AndroidDisplayConfiguration(DisplayConfigurationOutput&& output);
3687 AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other);
3688 AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other);
3689
3690
3691=== modified file 'src/platform/graphics/android/android_platform.cpp'
3692--- src/platform/graphics/android/android_platform.cpp 2014-02-04 23:20:36 +0000
3693+++ src/platform/graphics/android/android_platform.cpp 2014-03-06 14:19:43 +0000
3694@@ -29,9 +29,9 @@
3695 #include "mir/graphics/buffer_initializer.h"
3696 #include "mir/graphics/buffer_id.h"
3697 #include "mir/graphics/buffer_ipc_packer.h"
3698+#include "mir/graphics/display_report.h"
3699 #include "mir/options/option.h"
3700
3701-#include "mir/graphics/null_display_report.h"
3702 #include <boost/throw_exception.hpp>
3703 #include <stdexcept>
3704
3705
3706=== added file 'src/platform/graphics/android/configurable_display_buffer.h'
3707--- src/platform/graphics/android/configurable_display_buffer.h 1970-01-01 00:00:00 +0000
3708+++ src/platform/graphics/android/configurable_display_buffer.h 2014-03-06 14:19:43 +0000
3709@@ -0,0 +1,43 @@
3710+/*
3711+ * Copyright © 2013 Canonical Ltd.
3712+ *
3713+ * This program is free software: you can redistribute it and/or modify it
3714+ * under the terms of the GNU Lesser General Public License version 3,
3715+ * as published by the Free Software Foundation.
3716+ *
3717+ * This program is distributed in the hope that it will be useful,
3718+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3719+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3720+ * GNU Lesser General Public License for more details.
3721+ *
3722+ * You should have received a copy of the GNU Lesser General Public License
3723+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3724+ *
3725+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
3726+ */
3727+
3728+#ifndef MIR_GRAPHICS_ANDROID_CONFIGURABLE_DISPLAY_BUFFER_H_
3729+#define MIR_GRAPHICS_ANDROID_CONFIGURABLE_DISPLAY_BUFFER_H_
3730+
3731+#include "mir/graphics/display_buffer.h"
3732+#include "mir/graphics/display_configuration.h"
3733+
3734+namespace mir
3735+{
3736+namespace graphics
3737+{
3738+namespace android
3739+{
3740+
3741+class ConfigurableDisplayBuffer : public graphics::DisplayBuffer
3742+{
3743+public:
3744+ virtual DisplayConfigurationOutput configuration() const = 0;
3745+ virtual void configure(DisplayConfigurationOutput const&) = 0;
3746+};
3747+
3748+}
3749+}
3750+}
3751+
3752+#endif /* MIR_GRAPHICS_ANDROID_CONFIGURABLE_DISPLAY_BUFFER_H_ */
3753
3754=== modified file 'src/platform/graphics/android/display_buffer.cpp'
3755--- src/platform/graphics/android/display_buffer.cpp 2014-01-23 17:26:51 +0000
3756+++ src/platform/graphics/android/display_buffer.cpp 2014-03-06 14:19:43 +0000
3757@@ -24,6 +24,7 @@
3758 #include <boost/throw_exception.hpp>
3759 #include <stdexcept>
3760 #include <algorithm>
3761+#include <sstream>
3762
3763 namespace mg=mir::graphics;
3764 namespace mga=mir::graphics::android;
3765@@ -38,7 +39,23 @@
3766 display_device{display_device},
3767 native_window{native_window},
3768 gl_context{shared_gl_context, std::bind(mga::create_window_surface, std::placeholders::_1, std::placeholders::_2, native_window.get())},
3769- rotation{mir_orientation_normal}
3770+ current_configuration{
3771+ mg::DisplayConfigurationOutputId{1},
3772+ mg::DisplayConfigurationCardId{0},
3773+ mg::DisplayConfigurationOutputType::lvds,
3774+ {
3775+ fb_bundle->fb_format()
3776+ },
3777+ {mg::DisplayConfigurationMode{fb_bundle->fb_size(),0.0f}},
3778+ 0,
3779+ geom::Size{0,0}, //could use DPI information to fill this
3780+ true,
3781+ true,
3782+ geom::Point{0,0},
3783+ 0,
3784+ fb_bundle->fb_format(),
3785+ mir_power_mode_on,
3786+ mir_orientation_normal}
3787 {
3788 }
3789
3790@@ -48,8 +65,11 @@
3791 int width = size.width.as_int();
3792 int height = size.height.as_int();
3793
3794- if (rotation == mir_orientation_left || rotation == mir_orientation_right)
3795+ if (current_configuration.orientation == mir_orientation_left
3796+ || current_configuration.orientation == mir_orientation_right)
3797+ {
3798 std::swap(width, height);
3799+ }
3800
3801 return {{0,0}, {width,height}};
3802 }
3803@@ -111,10 +131,47 @@
3804 * and let the renderer do it.
3805 * If and when we choose to implement HWC rotation, this may change.
3806 */
3807- return rotation;
3808-}
3809-
3810-void mga::DisplayBuffer::orient(MirOrientation rot)
3811-{
3812- rotation = rot;
3813+ return current_configuration.orientation;
3814+}
3815+
3816+mg::DisplayConfigurationOutput mga::DisplayBuffer::configuration() const
3817+{
3818+ return mg::DisplayConfigurationOutput(current_configuration);
3819+}
3820+
3821+void mga::DisplayBuffer::configure(DisplayConfigurationOutput const& new_configuration)
3822+{
3823+ //power mode
3824+ MirPowerMode intended_power_mode = new_configuration.power_mode;
3825+ if ((intended_power_mode == mir_power_mode_standby) ||
3826+ (intended_power_mode == mir_power_mode_suspend))
3827+ {
3828+ intended_power_mode = mir_power_mode_off;
3829+ }
3830+
3831+ if (intended_power_mode != current_configuration.power_mode)
3832+ {
3833+ display_device->mode(intended_power_mode);
3834+ current_configuration.power_mode = intended_power_mode;
3835+ }
3836+
3837+ //If the hardware can rotate for us, we report normal orientation. If it can't
3838+ //we preserve this orientation change so the compositor can rotate everything in GL
3839+ if (display_device->apply_orientation(new_configuration.orientation))
3840+ {
3841+ current_configuration.orientation = mir_orientation_normal;
3842+ }
3843+ else
3844+ {
3845+ current_configuration.orientation = new_configuration.orientation;
3846+ }
3847+
3848+ //do not allow fb format reallocation
3849+ if (new_configuration.current_format != current_configuration.current_format)
3850+ {
3851+ std::stringstream err_msg;
3852+ err_msg << std::string("could not change display buffer format to request: ")
3853+ << new_configuration.current_format;
3854+ BOOST_THROW_EXCEPTION(std::runtime_error(err_msg.str()));
3855+ }
3856 }
3857
3858=== modified file 'src/platform/graphics/android/display_buffer.h'
3859--- src/platform/graphics/android/display_buffer.h 2014-02-06 13:30:26 +0000
3860+++ src/platform/graphics/android/display_buffer.h 2014-03-06 14:19:43 +0000
3861@@ -19,8 +19,9 @@
3862 #ifndef MIR_GRAPHICS_ANDROID_DISPLAY_BUFFER_H_
3863 #define MIR_GRAPHICS_ANDROID_DISPLAY_BUFFER_H_
3864
3865-#include "mir/graphics/display_buffer.h"
3866+#include "configurable_display_buffer.h"
3867 #include "mir/graphics/egl_resources.h"
3868+#include "android_display_configuration.h"
3869 #include "gl_context.h"
3870 #include <system/window.h>
3871
3872@@ -34,7 +35,7 @@
3873 class DisplayDevice;
3874 class FramebufferBundle;
3875
3876-class DisplayBuffer : public graphics::DisplayBuffer
3877+class DisplayBuffer : public ConfigurableDisplayBuffer
3878 {
3879 public:
3880 DisplayBuffer(std::shared_ptr<FramebufferBundle> const& fb_bundle,
3881@@ -52,7 +53,9 @@
3882 std::list<std::shared_ptr<Renderable>> const& renderlist,
3883 std::function<void(Renderable const&)> const& render_fn);
3884 MirOrientation orientation() const override;
3885- void orient(MirOrientation);
3886+
3887+ DisplayConfigurationOutput configuration() const;
3888+ void configure(DisplayConfigurationOutput const&);
3889
3890 private:
3891 void render_and_post();
3892@@ -61,6 +64,8 @@
3893 std::shared_ptr<DisplayDevice> const display_device;
3894 std::shared_ptr<ANativeWindow> const native_window;
3895 GLContext gl_context;
3896+ bool prepared;
3897+ DisplayConfigurationOutput current_configuration;
3898 MirOrientation rotation;
3899 };
3900
3901
3902=== modified file 'src/platform/graphics/android/display_builder.h'
3903--- src/platform/graphics/android/display_builder.h 2014-01-13 06:12:33 +0000
3904+++ src/platform/graphics/android/display_builder.h 2014-03-06 14:19:43 +0000
3905@@ -19,7 +19,7 @@
3906 #ifndef MIR_GRAPHICS_ANDROID_DISPLAY_BUILDER_H_
3907 #define MIR_GRAPHICS_ANDROID_DISPLAY_BUILDER_H_
3908
3909-#include "mir/graphics/display_buffer.h"
3910+#include "configurable_display_buffer.h"
3911 #include "mir_toolkit/common.h"
3912 #include <memory>
3913
3914@@ -29,7 +29,6 @@
3915 {
3916 namespace android
3917 {
3918-class DisplayDevice;
3919 class GLContext;
3920
3921 class DisplayBuilder
3922@@ -38,9 +37,7 @@
3923 virtual ~DisplayBuilder() = default;
3924
3925 virtual MirPixelFormat display_format() = 0;
3926- virtual std::shared_ptr<DisplayDevice> create_display_device() = 0;
3927- virtual std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(
3928- std::shared_ptr<DisplayDevice> const& display_device,
3929+ virtual std::unique_ptr<ConfigurableDisplayBuffer> create_display_buffer(
3930 GLContext const& gl_context) = 0;
3931
3932 protected:
3933
3934=== modified file 'src/platform/graphics/android/display_device.h'
3935--- src/platform/graphics/android/display_device.h 2014-01-23 17:26:51 +0000
3936+++ src/platform/graphics/android/display_device.h 2014-03-06 14:19:43 +0000
3937@@ -44,6 +44,7 @@
3938 virtual void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list) = 0;
3939 virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0;
3940 virtual void post(Buffer const& buffer) = 0;
3941+ virtual bool apply_orientation(MirOrientation orientation) const = 0;
3942
3943 protected:
3944 DisplayDevice() = default;
3945
3946=== modified file 'src/platform/graphics/android/fb_device.cpp'
3947--- src/platform/graphics/android/fb_device.cpp 2014-01-23 17:26:51 +0000
3948+++ src/platform/graphics/android/fb_device.cpp 2014-03-06 14:19:43 +0000
3949@@ -69,6 +69,11 @@
3950 }
3951 }
3952
3953+bool mga::FBDevice::apply_orientation(MirOrientation) const
3954+{
3955+ return false;
3956+}
3957+
3958 void mga::FBDevice::mode(MirPowerMode mode)
3959 {
3960 int enable = 0;
3961
3962=== modified file 'src/platform/graphics/android/fb_device.h'
3963--- src/platform/graphics/android/fb_device.h 2014-01-23 17:26:51 +0000
3964+++ src/platform/graphics/android/fb_device.h 2014-03-06 14:19:43 +0000
3965@@ -35,6 +35,7 @@
3966 public:
3967 FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev);
3968
3969+ bool apply_orientation(MirOrientation orientation) const;
3970 void mode(MirPowerMode mode);
3971 void prepare_gl();
3972 void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list);
3973
3974=== modified file 'src/platform/graphics/android/hwc_common_device.cpp'
3975--- src/platform/graphics/android/hwc_common_device.cpp 2014-01-13 06:12:33 +0000
3976+++ src/platform/graphics/android/hwc_common_device.cpp 2014-03-06 14:19:43 +0000
3977@@ -75,12 +75,10 @@
3978 std::unique_lock<std::mutex> lg(blanked_mutex);
3979 int err = 0;
3980
3981- //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off
3982- // are all treated like mir_power_mode_off
3983 if ((mode_request == mir_power_mode_suspend) ||
3984 (mode_request == mir_power_mode_standby))
3985 {
3986- mode_request = mir_power_mode_off;
3987+ BOOST_THROW_EXCEPTION(std::runtime_error("cannot set to suspend or standby"));
3988 }
3989
3990 if ((mode_request == mir_power_mode_on) &&
3991@@ -129,3 +127,8 @@
3992 return err;
3993 return hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, 1);
3994 }
3995+
3996+bool mga::HWCCommonDevice::apply_orientation(MirOrientation) const
3997+{
3998+ return false;
3999+}
4000
4001=== modified file 'src/platform/graphics/android/hwc_common_device.h'
4002--- src/platform/graphics/android/hwc_common_device.h 2014-01-13 06:12:33 +0000
4003+++ src/platform/graphics/android/hwc_common_device.h 2014-03-06 14:19:43 +0000
4004@@ -48,6 +48,7 @@
4005
4006 void notify_vsync();
4007 void mode(MirPowerMode mode);
4008+ bool apply_orientation(MirOrientation orientation) const;
4009
4010 protected:
4011 HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
4012
4013=== modified file 'src/platform/graphics/android/hwc_device.cpp'
4014--- src/platform/graphics/android/hwc_device.cpp 2014-01-29 18:54:06 +0000
4015+++ src/platform/graphics/android/hwc_device.cpp 2014-03-06 14:19:43 +0000
4016@@ -22,7 +22,6 @@
4017 #include "hwc_vsync_coordinator.h"
4018 #include "framebuffer_bundle.h"
4019 #include "buffer.h"
4020-#include "mir/graphics/android/sync_fence.h"
4021 #include "mir/graphics/android/native_buffer.h"
4022 #include "mir/graphics/buffer.h"
4023
4024@@ -38,17 +37,23 @@
4025 std::shared_ptr<HWCVsyncCoordinator> const& coordinator,
4026 std::shared_ptr<SyncFileOps> const& sync_ops)
4027 : HWCCommonDevice(hwc_device, coordinator),
4028- layer_list({mga::ForceGLLayer{}, mga::FramebufferLayer{}}),
4029 sync_ops(sync_ops)
4030 {
4031 }
4032
4033 void mga::HwcDevice::prepare_gl()
4034 {
4035- //note, although we only have a primary display right now,
4036- // set the external and virtual displays to null as some drivers check for that
4037- hwc_display_contents_1_t* displays[num_displays] {layer_list.native_list(), nullptr, nullptr};
4038- if (hwc_device->prepare(hwc_device.get(), 1, displays))
4039+ auto rc = 0;
4040+ auto display_list = layer_list.native_list().lock();
4041+ if (display_list)
4042+ {
4043+ //note, although we only have a primary display right now,
4044+ // set the external and virtual displays to null as some drivers check for that
4045+ hwc_display_contents_1_t* displays[num_displays] {display_list.get(), nullptr, nullptr};
4046+ rc = hwc_device->prepare(hwc_device.get(), 1, displays);
4047+ }
4048+
4049+ if ((rc != 0) || (!display_list))
4050 {
4051 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()"));
4052 }
4053@@ -71,17 +76,24 @@
4054 {
4055 auto lg = lock_unblanked();
4056
4057- auto native_buffer = buffer.native_buffer_handle();
4058- layer_list.set_fb_target(native_buffer);
4059-
4060- hwc_display_contents_1_t* displays[num_displays] {layer_list.native_list(), nullptr, nullptr};
4061- if (hwc_device->set(hwc_device.get(), 1, displays))
4062+ layer_list.set_fb_target(buffer);
4063+
4064+ auto rc = 0;
4065+ auto display_list = layer_list.native_list().lock();
4066+ if (display_list)
4067+ {
4068+ hwc_display_contents_1_t* displays[num_displays] {display_list.get(), nullptr, nullptr};
4069+ rc = hwc_device->set(hwc_device.get(), 1, displays);
4070+
4071+ mga::SyncFence retire_fence(sync_ops, layer_list.retirement_fence());
4072+
4073+ int framebuffer_fence = layer_list.fb_target_fence();
4074+ auto native_buffer = buffer.native_buffer_handle();
4075+ native_buffer->update_fence(framebuffer_fence);
4076+ }
4077+
4078+ if ((rc != 0) || (!display_list))
4079 {
4080 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()"));
4081 }
4082-
4083- mga::SyncFence retire_fence(sync_ops, displays[HWC_DISPLAY_PRIMARY]->retireFenceFd);
4084-
4085- int framebuffer_fence = layer_list.framebuffer_fence();
4086- native_buffer->update_fence(framebuffer_fence);
4087 }
4088
4089=== modified file 'src/platform/graphics/android/hwc_device.h'
4090--- src/platform/graphics/android/hwc_device.h 2014-02-06 13:30:26 +0000
4091+++ src/platform/graphics/android/hwc_device.h 2014-03-06 14:19:43 +0000
4092@@ -20,6 +20,7 @@
4093 #define MIR_GRAPHICS_ANDROID_HWC_DEVICE_H_
4094
4095 #include "mir_toolkit/common.h"
4096+#include "mir/graphics/android/sync_fence.h"
4097 #include "hwc_common_device.h"
4098 #include "hwc_layerlist.h"
4099 #include <memory>
4100@@ -48,7 +49,7 @@
4101 void post(Buffer const& buffer);
4102
4103 private:
4104- LayerList layer_list;
4105+ FBTargetLayerList layer_list;
4106
4107 std::shared_ptr<SyncFileOps> const sync_ops;
4108 static size_t const num_displays{3}; //primary, external, virtual
4109
4110=== modified file 'src/platform/graphics/android/hwc_fb_device.cpp'
4111--- src/platform/graphics/android/hwc_fb_device.cpp 2014-01-23 18:01:19 +0000
4112+++ src/platform/graphics/android/hwc_fb_device.cpp 2014-03-06 14:19:43 +0000
4113@@ -18,7 +18,6 @@
4114 */
4115
4116 #include "hwc_fb_device.h"
4117-#include "hwc_layers.h"
4118 #include "hwc_vsync_coordinator.h"
4119 #include "framebuffer_bundle.h"
4120 #include "android_format_conversion-inl.h"
4121@@ -36,15 +35,21 @@
4122 std::shared_ptr<framebuffer_device_t> const& fb_device,
4123 std::shared_ptr<HWCVsyncCoordinator> const& coordinator)
4124 : HWCCommonDevice(hwc_device, coordinator),
4125- fb_device(fb_device),
4126- layer_list({mga::ForceGLLayer{}})
4127+ fb_device(fb_device)
4128 {
4129 }
4130
4131 void mga::HwcFbDevice::prepare_gl()
4132 {
4133- auto display_list = layer_list.native_list();
4134- if (hwc_device->prepare(hwc_device.get(), 1, &display_list) != 0)
4135+ auto rc = 0;
4136+ auto display_list = layer_list.native_list().lock();
4137+ if (display_list)
4138+ {
4139+ hwc_display_contents_1_t* displays[num_displays] {display_list.get()};
4140+ rc = hwc_device->prepare(hwc_device.get(), num_displays, displays);
4141+ }
4142+
4143+ if ((rc != 0) || (!display_list))
4144 {
4145 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()"));
4146 }
4147@@ -57,13 +62,20 @@
4148
4149 void mga::HwcFbDevice::gpu_render(EGLDisplay dpy, EGLSurface sur)
4150 {
4151- auto display_list = layer_list.native_list();
4152- display_list->dpy = dpy;
4153- display_list->sur = sur;
4154-
4155- //set() may affect EGL state by calling eglSwapBuffers.
4156- //HWC 1.0 is the only version of HWC that can do this.
4157- if (hwc_device->set(hwc_device.get(), 1, &display_list) != 0)
4158+ auto rc = 0;
4159+ auto display_list = layer_list.native_list().lock();
4160+ if (display_list)
4161+ {
4162+ display_list->dpy = dpy;
4163+ display_list->sur = sur;
4164+
4165+ //set() may affect EGL state by calling eglSwapBuffers.
4166+ //HWC 1.0 is the only version of HWC that can do this.
4167+ hwc_display_contents_1_t* displays[num_displays] {display_list.get()};
4168+ rc = hwc_device->set(hwc_device.get(), num_displays, displays);
4169+ }
4170+
4171+ if ((rc != 0) || (!display_list))
4172 {
4173 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()"));
4174 }
4175
4176=== modified file 'src/platform/graphics/android/hwc_fb_device.h'
4177--- src/platform/graphics/android/hwc_fb_device.h 2014-01-23 18:01:19 +0000
4178+++ src/platform/graphics/android/hwc_fb_device.h 2014-03-06 14:19:43 +0000
4179@@ -45,6 +45,7 @@
4180
4181 private:
4182 std::shared_ptr<framebuffer_device_t> const fb_device;
4183+ static int const num_displays{1};
4184 LayerList layer_list;
4185 };
4186
4187
4188=== modified file 'src/platform/graphics/android/hwc_layerlist.cpp'
4189--- src/platform/graphics/android/hwc_layerlist.cpp 2014-01-23 18:01:19 +0000
4190+++ src/platform/graphics/android/hwc_layerlist.cpp 2014-03-06 14:19:43 +0000
4191@@ -16,6 +16,8 @@
4192 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
4193 */
4194
4195+#include "mir/graphics/renderable.h"
4196+#include "mir/graphics/buffer.h"
4197 #include "mir/graphics/android/sync_fence.h"
4198 #include "mir/graphics/android/native_buffer.h"
4199 #include "hwc_layerlist.h"
4200@@ -26,52 +28,124 @@
4201 namespace mga=mir::graphics::android;
4202 namespace geom=mir::geometry;
4203
4204-mga::LayerList::LayerList(std::initializer_list<HWCLayer> const& layer_list)
4205-{
4206- auto struct_size = sizeof(hwc_display_contents_1_t) + sizeof(hwc_layer_1_t)*(layer_list.size());
4207- hwc_representation = std::shared_ptr<hwc_display_contents_1_t>(
4208+namespace
4209+{
4210+std::shared_ptr<hwc_display_contents_1_t> generate_hwc_list(size_t needed_size)
4211+{
4212+ /* hwc layer list uses hwLayers[0] at the end of the struct */
4213+ auto struct_size = sizeof(hwc_display_contents_1_t) + sizeof(hwc_layer_1_t)*(needed_size);
4214+ auto new_hwc_representation = std::shared_ptr<hwc_display_contents_1_t>(
4215 static_cast<hwc_display_contents_1_t*>( ::operator new(struct_size)));
4216
4217- auto i = 0u;
4218- for(auto& layer : layer_list)
4219- {
4220- hwc_representation->hwLayers[i++] = layer;
4221- }
4222- hwc_representation->numHwLayers = layer_list.size();
4223- hwc_representation->retireFenceFd = -1;
4224- hwc_representation->flags = HWC_GEOMETRY_CHANGED;
4225+ new_hwc_representation->numHwLayers = needed_size;
4226+ new_hwc_representation->retireFenceFd = -1;
4227+ new_hwc_representation->flags = HWC_GEOMETRY_CHANGED;
4228
4229 //aosp exynos hwc in particular, checks that these fields are non-null in hwc1.1, although
4230 //these fields are deprecated in hwc1.1 and later.
4231- hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF);
4232- hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE);
4233-
4234-}
4235-
4236-void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer)
4237-{
4238- if (hwc_representation->numHwLayers == 2)
4239- {
4240- if (hwc_representation->hwLayers[0].flags == HWC_SKIP_LAYER)
4241- {
4242- hwc_representation->hwLayers[0] = mga::ForceGLLayer(*native_buffer);
4243- }
4244-
4245- if (hwc_representation->hwLayers[1].compositionType == HWC_FRAMEBUFFER_TARGET)
4246- {
4247- hwc_representation->hwLayers[1] = mga::FramebufferLayer(*native_buffer);
4248- hwc_representation->hwLayers[1].acquireFenceFd = native_buffer->copy_fence();
4249- }
4250- }
4251-}
4252-
4253-mga::NativeFence mga::LayerList::framebuffer_fence()
4254-{
4255- auto fb_position = hwc_representation->numHwLayers - 1;
4256- return hwc_representation->hwLayers[fb_position].releaseFenceFd;
4257-}
4258-
4259-hwc_display_contents_1_t* mga::LayerList::native_list() const
4260-{
4261- return hwc_representation.get();
4262+ static int fake_egl_values = 0;
4263+ new_hwc_representation->dpy = &fake_egl_values;
4264+ new_hwc_representation->sur = &fake_egl_values;
4265+
4266+ return new_hwc_representation;
4267+}
4268+}
4269+
4270+void mga::LayerListBase::update_representation(size_t needed_size)
4271+{
4272+ std::shared_ptr<hwc_display_contents_1_t> new_hwc_representation;
4273+ std::list<HWCLayer> new_layers;
4274+
4275+ if (hwc_representation->numHwLayers != needed_size)
4276+ {
4277+ new_hwc_representation = generate_hwc_list(needed_size);
4278+ }
4279+ else
4280+ {
4281+ new_hwc_representation = hwc_representation;
4282+ }
4283+
4284+ for (auto i = 0u; i < needed_size; i++)
4285+ {
4286+ new_layers.emplace_back(mga::HWCLayer(new_hwc_representation, i));
4287+ }
4288+
4289+ std::swap(new_layers, layers);
4290+ hwc_representation = new_hwc_representation;
4291+}
4292+
4293+std::weak_ptr<hwc_display_contents_1_t> mga::LayerListBase::native_list()
4294+{
4295+ return hwc_representation;
4296+}
4297+
4298+mga::NativeFence mga::LayerListBase::retirement_fence()
4299+{
4300+ return hwc_representation->retireFenceFd;
4301+}
4302+
4303+mga::LayerListBase::LayerListBase(size_t initial_list_size)
4304+ : hwc_representation{generate_hwc_list(initial_list_size)}
4305+{
4306+ update_representation(initial_list_size);
4307+}
4308+
4309+mga::LayerList::LayerList()
4310+ : LayerListBase{1}
4311+{
4312+ layers.back().set_layer_type(mga::LayerType::skip);
4313+}
4314+
4315+mga::FBTargetLayerList::FBTargetLayerList()
4316+ : LayerListBase{2}
4317+{
4318+ layers.front().set_layer_type(mga::LayerType::skip);
4319+ layers.back().set_layer_type(mga::LayerType::framebuffer_target);
4320+}
4321+
4322+void mga::FBTargetLayerList::reset_composition_layers()
4323+{
4324+ update_representation(2);
4325+
4326+ layers.front().set_layer_type(mga::LayerType::skip);
4327+ layers.back().set_layer_type(mga::LayerType::framebuffer_target);
4328+
4329+ skip_layers_present = true;
4330+}
4331+
4332+void mga::FBTargetLayerList::set_composition_layers(std::list<std::shared_ptr<graphics::Renderable>> const& list)
4333+{
4334+ auto const needed_size = list.size() + 1;
4335+ update_representation(needed_size);
4336+
4337+ auto layers_it = layers.begin();
4338+ for(auto const& renderable : list)
4339+ {
4340+ layers_it->set_layer_type(mga::LayerType::gl_rendered);
4341+ layers_it->set_render_parameters(renderable->screen_position(), renderable->alpha_enabled());
4342+ layers_it->set_buffer(*renderable->buffer());
4343+ layers_it++;
4344+ }
4345+
4346+ layers_it->set_layer_type(mga::LayerType::framebuffer_target);
4347+ skip_layers_present = false;
4348+}
4349+
4350+
4351+void mga::FBTargetLayerList::set_fb_target(mg::Buffer const& buffer)
4352+{
4353+ geom::Rectangle const disp_frame{{0,0}, {buffer.size()}};
4354+ if (skip_layers_present)
4355+ {
4356+ layers.front().set_render_parameters(disp_frame, false);
4357+ layers.front().set_buffer(buffer);
4358+ }
4359+
4360+ layers.back().set_render_parameters(disp_frame, false);
4361+ layers.back().set_buffer(buffer);
4362+}
4363+
4364+mga::NativeFence mga::FBTargetLayerList::fb_target_fence()
4365+{
4366+ return layers.back().release_fence();
4367 }
4368
4369=== modified file 'src/platform/graphics/android/hwc_layerlist.h'
4370--- src/platform/graphics/android/hwc_layerlist.h 2014-01-23 18:01:19 +0000
4371+++ src/platform/graphics/android/hwc_layerlist.h 2014-03-06 14:19:43 +0000
4372@@ -26,32 +26,57 @@
4373 #include <memory>
4374 #include <vector>
4375 #include <initializer_list>
4376+#include <list>
4377
4378 namespace mir
4379 {
4380 namespace graphics
4381 {
4382
4383-class NativeBuffer;
4384+class Renderable;
4385 class Buffer;
4386
4387 namespace android
4388 {
4389
4390-class LayerList
4391+class LayerListBase
4392 {
4393 public:
4394- LayerList(std::initializer_list<HWCLayer> const& layers);
4395-
4396- hwc_display_contents_1_t* native_list() const;
4397-
4398- void set_fb_target(std::shared_ptr<NativeBuffer> const&);
4399- NativeFence framebuffer_fence();
4400+ std::weak_ptr<hwc_display_contents_1_t> native_list();
4401+ NativeFence retirement_fence();
4402+
4403+protected:
4404+ LayerListBase(size_t initial_list_size);
4405+
4406+ void update_representation(size_t needed_size);
4407+ std::list<HWCLayer> layers;
4408
4409 private:
4410+ LayerListBase& operator=(LayerListBase const&) = delete;
4411+ LayerListBase(LayerListBase const&) = delete;
4412+
4413 std::shared_ptr<hwc_display_contents_1_t> hwc_representation;
4414 };
4415
4416+class LayerList : public LayerListBase
4417+{
4418+public:
4419+ LayerList();
4420+};
4421+
4422+class FBTargetLayerList : public LayerListBase
4423+{
4424+public:
4425+ FBTargetLayerList();
4426+ void set_composition_layers(std::list<std::shared_ptr<graphics::Renderable>> const& list);
4427+ void reset_composition_layers();
4428+ NativeFence fb_target_fence();
4429+ void set_fb_target(Buffer const&);
4430+
4431+private:
4432+ bool skip_layers_present{true};
4433+};
4434+
4435 }
4436 }
4437 }
4438
4439=== modified file 'src/platform/graphics/android/hwc_layers.cpp'
4440--- src/platform/graphics/android/hwc_layers.cpp 2014-02-06 13:30:26 +0000
4441+++ src/platform/graphics/android/hwc_layers.cpp 2014-03-06 14:19:43 +0000
4442@@ -22,55 +22,101 @@
4443 #include "mir/graphics/android/native_buffer.h"
4444 #include "hwc_layerlist.h"
4445
4446+#include <boost/throw_exception.hpp>
4447+#include <stdexcept>
4448 #include <cstring>
4449
4450 namespace mg=mir::graphics;
4451 namespace mga=mir::graphics::android;
4452 namespace geom=mir::geometry;
4453
4454-mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer)
4455+mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer && other)
4456 {
4457- memcpy(static_cast<void*>(this),
4458- static_cast<void const*>(&layer),
4459- sizeof(HWCLayer));
4460- this->visibleRegionScreen = {1, &this->visible_rect};
4461+ hwc_layer = other.hwc_layer;
4462+ hwc_list = std::move(other.hwc_list);
4463+ visible_rect = std::move(other.visible_rect);
4464 return *this;
4465 }
4466
4467-mga::HWCLayer::HWCLayer(HWCLayer const& layer)
4468-{
4469- memcpy(static_cast<void*>(this),
4470- static_cast<void const*>(&layer),
4471- sizeof(HWCLayer));
4472- this->visibleRegionScreen = {1, &this->visible_rect};
4473+mga::HWCLayer::HWCLayer(HWCLayer && other)
4474+ : hwc_layer(std::move(other.hwc_layer)),
4475+ hwc_list(std::move(other.hwc_list)),
4476+ visible_rect(std::move(other.visible_rect))
4477+{
4478+}
4479+
4480+mga::HWCLayer::HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index)
4481+ : hwc_layer(&list->hwLayers[layer_index]),
4482+ hwc_list(list)
4483+{
4484+ memset(hwc_layer, 0, sizeof(hwc_layer_1_t));
4485+ memset(&visible_rect, 0, sizeof(hwc_rect_t));
4486+
4487+ hwc_layer->hints = 0;
4488+ hwc_layer->transform = 0;
4489+ hwc_layer->acquireFenceFd = -1;
4490+ hwc_layer->releaseFenceFd = -1;
4491+ hwc_layer->blending = HWC_BLENDING_NONE;
4492+
4493+ hwc_layer->visibleRegionScreen.numRects=1;
4494+ hwc_layer->visibleRegionScreen.rects= &visible_rect;
4495 }
4496
4497 mga::HWCLayer::HWCLayer(
4498- int type,
4499- buffer_handle_t buffer_handle,
4500- geom::Rectangle position,
4501- geom::Size buffer_size,
4502- bool skip, bool alpha)
4503-{
4504- (skip) ? flags = HWC_SKIP_LAYER : flags = 0;
4505- (alpha) ? blending = HWC_BLENDING_COVERAGE : blending = HWC_BLENDING_NONE;
4506- compositionType = type;
4507- hints = 0;
4508- transform = 0;
4509- //TODO: acquireFenceFd should be buffer.fence()
4510- acquireFenceFd = -1;
4511- releaseFenceFd = -1;
4512-
4513- sourceCrop =
4514+ LayerType type,
4515+ geometry::Rectangle position,
4516+ bool alpha_enabled,
4517+ std::shared_ptr<hwc_display_contents_1_t> list,
4518+ size_t layer_index)
4519+ : HWCLayer(list, layer_index)
4520+{
4521+ set_layer_type(type);
4522+ set_render_parameters(position, alpha_enabled);
4523+}
4524+
4525+bool mga::HWCLayer::needs_gl_render() const
4526+{
4527+ return ((hwc_layer->compositionType == HWC_FRAMEBUFFER) || (hwc_layer->flags == HWC_SKIP_LAYER));
4528+}
4529+
4530+mga::NativeFence mga::HWCLayer::release_fence() const
4531+{
4532+ return hwc_layer->releaseFenceFd;
4533+}
4534+
4535+void mga::HWCLayer::set_layer_type(LayerType type)
4536+{
4537+ hwc_layer->flags = 0;
4538+ switch(type)
4539 {
4540- 0, 0,
4541- buffer_size.width.as_int(),
4542- buffer_size.height.as_int()
4543- };
4544-
4545+ case mga::LayerType::skip:
4546+ hwc_layer->compositionType = HWC_FRAMEBUFFER;
4547+ hwc_layer->flags = HWC_SKIP_LAYER;
4548+ break;
4549+
4550+ case mga::LayerType::gl_rendered:
4551+ hwc_layer->compositionType = HWC_FRAMEBUFFER;
4552+ break;
4553+
4554+ case mga::LayerType::framebuffer_target:
4555+ hwc_layer->compositionType = HWC_FRAMEBUFFER_TARGET;
4556+ break;
4557+
4558+ case mga::LayerType::overlay: //driver is the only one who can set to overlay
4559+ default:
4560+ BOOST_THROW_EXCEPTION(std::logic_error("invalid layer type"));
4561+ }
4562+}
4563+
4564+void mga::HWCLayer::set_render_parameters(geometry::Rectangle position, bool alpha_enabled)
4565+{
4566+ if (alpha_enabled)
4567+ hwc_layer->blending = HWC_BLENDING_COVERAGE;
4568+ else
4569+ hwc_layer->blending = HWC_BLENDING_NONE;
4570
4571 /* note, if the sourceCrop and DisplayFrame sizes differ, the output will be linearly scaled */
4572- displayFrame =
4573+ hwc_layer->displayFrame =
4574 {
4575 position.top_left.x.as_int(),
4576 position.top_left.y.as_int(),
4577@@ -78,65 +124,21 @@
4578 position.size.height.as_int()
4579 };
4580
4581- visible_rect = displayFrame;
4582- visibleRegionScreen.numRects=1;
4583- visibleRegionScreen.rects= &visible_rect;
4584-
4585- handle = buffer_handle;
4586- memset(&reserved, 0, sizeof(reserved));
4587-}
4588-
4589-bool mga::HWCLayer::needs_gl_render() const
4590-{
4591- return ((compositionType == HWC_FRAMEBUFFER) || (flags == HWC_SKIP_LAYER));
4592-}
4593-
4594-mga::FramebufferLayer::FramebufferLayer()
4595- : HWCLayer(HWC_FRAMEBUFFER_TARGET,
4596- nullptr,
4597- geom::Rectangle{{0,0}, {0,0}},
4598- geom::Size{0,0},
4599- false,
4600- false)
4601-{
4602-}
4603-
4604-mga::FramebufferLayer::FramebufferLayer(mg::NativeBuffer const& buffer)
4605- : HWCLayer(HWC_FRAMEBUFFER_TARGET,
4606- buffer.handle(),
4607- geom::Rectangle{{0,0}, {buffer.anwb()->width, buffer.anwb()->height}},
4608- geom::Size{buffer.anwb()->width, buffer.anwb()->height},
4609- false,
4610- false)
4611-{
4612-}
4613-
4614-mga::ForceGLLayer::ForceGLLayer()
4615- : HWCLayer(HWC_FRAMEBUFFER,
4616- nullptr,
4617- geom::Rectangle{{0,0}, {0,0}},
4618- geom::Size{0,0},
4619- true,
4620- false)
4621-{
4622-}
4623-
4624-mga::ForceGLLayer::ForceGLLayer(mg::NativeBuffer const& buffer)
4625- : HWCLayer(HWC_FRAMEBUFFER,
4626- buffer.handle(),
4627- geom::Rectangle{{0,0}, {buffer.anwb()->width, buffer.anwb()->height}},
4628- geom::Size{buffer.anwb()->width, buffer.anwb()->height},
4629- true,
4630- false)
4631-{
4632-}
4633-
4634-mga::CompositionLayer::CompositionLayer(mg::Renderable const& renderable)
4635- : HWCLayer(HWC_FRAMEBUFFER,
4636- renderable.buffer()->native_buffer_handle()->handle(),
4637- renderable.screen_position(),
4638- renderable.buffer()->size(),
4639- false,
4640- renderable.alpha_enabled())
4641-{
4642+ visible_rect = hwc_layer->displayFrame;
4643+}
4644+
4645+void mga::HWCLayer::set_buffer(Buffer const& buffer)
4646+{
4647+ auto size = buffer.size();
4648+ auto native_buffer = buffer.native_buffer_handle();
4649+ hwc_layer->handle = native_buffer->handle();
4650+ if (!needs_gl_render())
4651+ hwc_layer->acquireFenceFd = native_buffer->copy_fence();
4652+ hwc_layer->releaseFenceFd = -1;
4653+ hwc_layer->sourceCrop =
4654+ {
4655+ 0, 0,
4656+ size.width.as_int(),
4657+ size.height.as_int()
4658+ };
4659 }
4660
4661=== modified file 'src/platform/graphics/android/hwc_layers.h'
4662--- src/platform/graphics/android/hwc_layers.h 2014-01-20 22:44:58 +0000
4663+++ src/platform/graphics/android/hwc_layers.h 2014-03-06 14:19:43 +0000
4664@@ -34,52 +34,46 @@
4665 {
4666
4667 class Renderable;
4668-class NativeBuffer;
4669+class Buffer;
4670
4671 namespace android
4672 {
4673
4674-struct HWCLayer : public hwc_layer_1
4675-{
4676- virtual ~HWCLayer() = default;
4677-
4678- HWCLayer& operator=(HWCLayer const& layer);
4679- HWCLayer(HWCLayer const& layer);
4680-
4681+enum LayerType
4682+{
4683+ gl_rendered,
4684+ overlay,
4685+ framebuffer_target,
4686+ skip
4687+};
4688+
4689+class HWCLayer
4690+{
4691+public:
4692+ HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index);
4693+ HWCLayer(LayerType,
4694+ geometry::Rectangle screen_position,
4695+ bool alpha_enabled,
4696+ std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index);
4697+
4698+ HWCLayer& operator=(HWCLayer && layer);
4699+ HWCLayer(HWCLayer && layer);
4700+
4701+ HWCLayer& operator=(HWCLayer const& layer) = delete;
4702+ HWCLayer(HWCLayer const& layer) = delete;
4703+
4704+ void set_layer_type(LayerType type);
4705+ void set_render_parameters(geometry::Rectangle screen_position, bool alpha_enabled);
4706+ void set_buffer(Buffer const&);
4707+
4708+ NativeFence release_fence() const;
4709 bool needs_gl_render() const;
4710
4711-protected:
4712- HWCLayer(
4713- int type,
4714- buffer_handle_t handle,
4715- geometry::Rectangle position,
4716- geometry::Size buffer_size,
4717- bool skip, bool alpha
4718- );
4719-
4720+private:
4721+ hwc_layer_1_t* hwc_layer;
4722+ std::shared_ptr<hwc_display_contents_1_t> hwc_list;
4723 hwc_rect_t visible_rect;
4724 };
4725-
4726-//layer could be GLES rendered, or overlaid by hwc.
4727-struct CompositionLayer : public HWCLayer
4728-{
4729- CompositionLayer(graphics::Renderable const& renderable);
4730-};
4731-
4732-//used during compositions when we want to restrict to GLES render only
4733-struct ForceGLLayer : public HWCLayer
4734-{
4735- ForceGLLayer();
4736- ForceGLLayer(NativeBuffer const&);
4737-};
4738-
4739-//used as the target (lowest layer, fb)
4740-struct FramebufferLayer : public HWCLayer
4741-{
4742- FramebufferLayer();
4743- FramebufferLayer(NativeBuffer const&);
4744-};
4745-
4746 }
4747 }
4748 }
4749
4750=== modified file 'src/platform/graphics/android/output_builder.cpp'
4751--- src/platform/graphics/android/output_builder.cpp 2014-02-04 23:20:36 +0000
4752+++ src/platform/graphics/android/output_builder.cpp 2014-03-06 14:19:43 +0000
4753@@ -63,7 +63,8 @@
4754 return framebuffers->fb_format();
4755 }
4756
4757-std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device()
4758+std::unique_ptr<mga::ConfigurableDisplayBuffer> mga::OutputBuilder::create_display_buffer(
4759+ GLContext const& gl_context)
4760 {
4761 std::shared_ptr<mga::DisplayDevice> device;
4762 if (force_backup_display)
4763@@ -98,14 +99,7 @@
4764 }
4765 }
4766
4767- return device;
4768-}
4769-
4770-std::unique_ptr<mg::DisplayBuffer> mga::OutputBuilder::create_display_buffer(
4771- std::shared_ptr<DisplayDevice> const& display_device,
4772- GLContext const& gl_context)
4773-{
4774 auto native_window = res_factory->create_native_window(framebuffers);
4775- return std::unique_ptr<mg::DisplayBuffer>(
4776- new DisplayBuffer(framebuffers, display_device, native_window, gl_context));
4777+ return std::unique_ptr<mga::DisplayBuffer>(
4778+ new DisplayBuffer(framebuffers, device, native_window, gl_context));
4779 }
4780
4781=== modified file 'src/platform/graphics/android/output_builder.h'
4782--- src/platform/graphics/android/output_builder.h 2014-02-04 23:20:36 +0000
4783+++ src/platform/graphics/android/output_builder.h 2014-03-06 14:19:43 +0000
4784@@ -33,6 +33,7 @@
4785 class FramebufferBundle;
4786 class DisplayResourceFactory;
4787 class GraphicBufferAllocator;
4788+class DisplayDevice;
4789
4790 class OutputBuilder : public DisplayBuilder
4791 {
4792@@ -43,9 +44,7 @@
4793 std::shared_ptr<DisplayReport> const& display_report);
4794
4795 MirPixelFormat display_format();
4796- std::shared_ptr<DisplayDevice> create_display_device();
4797- std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(
4798- std::shared_ptr<DisplayDevice> const& display_device,
4799+ std::unique_ptr<ConfigurableDisplayBuffer> create_display_buffer(
4800 GLContext const& gl_context);
4801
4802 private:
4803
4804=== modified file 'src/platform/graphics/mesa/CMakeLists.txt'
4805--- src/platform/graphics/mesa/CMakeLists.txt 2014-01-22 08:32:55 +0000
4806+++ src/platform/graphics/mesa/CMakeLists.txt 2014-03-06 14:19:43 +0000
4807@@ -9,10 +9,11 @@
4808 # gbm.h and drm.h have trailing commas at the end of enum definitions
4809 # This is valid C99, but g++ 4.4 flags it as an error with -pedantic
4810 string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
4811+add_definitions(-D__GBM__)
4812
4813
4814 add_library(
4815- mirplatformgraphics SHARED
4816+ mirplatformgraphicsmesa SHARED
4817
4818 platform.cpp
4819 buffer_allocator.cpp
4820@@ -37,8 +38,14 @@
4821 shm_buffer.cpp
4822 )
4823
4824+set_target_properties(
4825+ mirplatformgraphicsmesa PROPERTIES
4826+ OUTPUT_NAME mirplatformgraphics
4827+ LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
4828+)
4829+
4830 target_link_libraries(
4831- mirplatformgraphics
4832+ mirplatformgraphicsmesa
4833 mirplatform
4834
4835 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
4836@@ -47,4 +54,13 @@
4837 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
4838 )
4839
4840-install(TARGETS mirplatformgraphics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
4841+if (MIR_TEST_PLATFORM STREQUAL "mesa")
4842+ add_custom_command(TARGET mirplatformgraphicsmesa
4843+ POST_BUILD
4844+ COMMAND ${CMAKE_COMMAND} -E remove libmirplatformgraphics.so
4845+ COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> libmirplatformgraphics.so
4846+ WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
4847+ )
4848+endif()
4849+
4850+install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/mesa)
4851
4852=== modified file 'src/platform/graphics/mesa/display.cpp'
4853--- src/platform/graphics/mesa/display.cpp 2014-01-31 07:48:24 +0000
4854+++ src/platform/graphics/mesa/display.cpp 2014-03-06 14:19:43 +0000
4855@@ -134,6 +134,17 @@
4856 auto const& kms_conf = dynamic_cast<RealKMSDisplayConfiguration const&>(conf);
4857 std::vector<std::unique_ptr<DisplayBuffer>> display_buffers_new;
4858
4859+ /*
4860+ * Notice for a little while here we will have duplicate
4861+ * DisplayBuffers attached to each output, and the display_buffers_new
4862+ * will take over the outputs before the old display_buffers are
4863+ * destroyed. So to avoid page flipping confusion in-between, make
4864+ * sure we wait for all pending page flips to finish before the
4865+ * display_buffers_new are created and take control of the outputs.
4866+ */
4867+ for (auto& db : display_buffers)
4868+ db->wait_for_page_flip();
4869+
4870 /* Reset the state of all outputs */
4871 kms_conf.for_each_output([&](DisplayConfigurationOutput const& conf_output)
4872 {
4873
4874=== modified file 'src/platform/graphics/mesa/display_buffer.cpp'
4875--- src/platform/graphics/mesa/display_buffer.cpp 2014-01-23 17:26:51 +0000
4876+++ src/platform/graphics/mesa/display_buffer.cpp 2014-03-06 14:19:43 +0000
4877@@ -103,6 +103,7 @@
4878 MirOrientation rot,
4879 EGLContext shared_context)
4880 : last_flipped_bufobj{nullptr},
4881+ scheduled_bufobj{nullptr},
4882 platform(platform),
4883 listener(listener),
4884 drm(platform->drm),
4885@@ -110,7 +111,8 @@
4886 surface_gbm{std::move(surface_gbm_param)},
4887 area(area),
4888 rotation(rot),
4889- needs_set_crtc{false}
4890+ needs_set_crtc{false},
4891+ page_flips_pending{false}
4892 {
4893 uint32_t area_width = area.size.width.as_uint32_t();
4894 uint32_t area_height = area.size.height.as_uint32_t();
4895@@ -142,13 +144,13 @@
4896
4897 listener->report_successful_egl_buffer_swap_on_construction();
4898
4899- last_flipped_bufobj = get_front_buffer_object();
4900- if (!last_flipped_bufobj)
4901+ scheduled_bufobj = get_front_buffer_object();
4902+ if (!scheduled_bufobj)
4903 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to get frontbuffer"));
4904
4905 for (auto& output : outputs)
4906 {
4907- if (!output->set_crtc(last_flipped_bufobj->get_drm_fb_id()))
4908+ if (!output->set_crtc(scheduled_bufobj->get_drm_fb_id()))
4909 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to set DRM crtc"));
4910 }
4911
4912@@ -171,6 +173,9 @@
4913 */
4914 if (last_flipped_bufobj)
4915 last_flipped_bufobj->release();
4916+
4917+ if (scheduled_bufobj)
4918+ scheduled_bufobj->release();
4919 }
4920
4921 geom::Rectangle mgm::DisplayBuffer::view_area() const
4922@@ -206,6 +211,31 @@
4923 std::shared_ptr<graphics::Buffer> bypass_buf)
4924 {
4925 /*
4926+ * If the last frame was composited then we haven't waited for the
4927+ * page flips yet. This is good because it maximizes the time available
4928+ * to spend rendering each frame. However we have to wait here, because
4929+ * it will be unsafe to swap_buffers before guaranteeing the previous
4930+ * page flip finished.
4931+ */
4932+ wait_for_page_flip();
4933+
4934+ /*
4935+ * Switching from bypass to compositing? Now is the earliest safe time
4936+ * we can unreference the bypass buffer...
4937+ */
4938+ if (scheduled_bufobj)
4939+ last_flipped_bypass_buf = nullptr;
4940+ /*
4941+ * Release the last flipped buffer object (which is not displayed anymore)
4942+ * to make it available for future rendering.
4943+ */
4944+ if (last_flipped_bufobj)
4945+ last_flipped_bufobj->release();
4946+
4947+ last_flipped_bufobj = scheduled_bufobj;
4948+ scheduled_bufobj = nullptr;
4949+
4950+ /*
4951 * Bring the back buffer to the front and get the buffer object
4952 * corresponding to the front buffer.
4953 */
4954@@ -234,7 +264,7 @@
4955 * If the flip fails, release the buffer object to make it available
4956 * for future rendering.
4957 */
4958- if (!needs_set_crtc && !schedule_and_wait_for_page_flip(bufobj))
4959+ if (!needs_set_crtc && !schedule_page_flip(bufobj))
4960 {
4961 if (!bypass_buf)
4962 bufobj->release();
4963@@ -250,22 +280,32 @@
4964 needs_set_crtc = false;
4965 }
4966
4967- /*
4968- * Release the last flipped buffer object (which is not displayed anymore)
4969- * to make it available for future rendering.
4970- */
4971- if (last_flipped_bufobj)
4972- last_flipped_bufobj->release();
4973-
4974- last_flipped_bufobj = bypass_buf ? nullptr : bufobj;
4975-
4976- /*
4977- * Keep a reference to the buffer being bypassed for the entire duration
4978- * of the frame. This ensures the buffer doesn't get reused by the client
4979- * prematurely, which would be seen as tearing.
4980- * If not bypassing, then bypass_buf will be nullptr.
4981- */
4982- last_flipped_bypass_buf = bypass_buf;
4983+ if (bypass_buf)
4984+ {
4985+ /*
4986+ * For composited frames we defer wait_for_page_flip till just before
4987+ * the next frame, but not for bypass frames. Deferring the flip of
4988+ * bypass frames would increase the time we held
4989+ * last_flipped_bypass_buf unacceptably, resulting in client stuttering
4990+ * unless we allocate quad-buffers (which I'm trying to avoid).
4991+ * Also, bypass does not need the deferred page flip because it has
4992+ * no compositing/rendering step for which to save time for.
4993+ */
4994+ wait_for_page_flip();
4995+ scheduled_bufobj = nullptr;
4996+
4997+ /*
4998+ * Keep a reference to the buffer being bypassed for the entire
4999+ * duration of the frame. This ensures the buffer doesn't get reused by
5000+ * the client while its on-screen, which would be seen as tearing or
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches