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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-02-06 17:55:08 +0000
+++ CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -28,9 +28,14 @@
2828
29set(MIR_VERSION_MAJOR 0)29set(MIR_VERSION_MAJOR 0)
30set(MIR_VERSION_MINOR 1)30set(MIR_VERSION_MINOR 1)
31set(MIR_VERSION_PATCH 5)31set(MIR_VERSION_PATCH 6)
3232
33set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)33set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
34execute_process(
35 COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
36 OUTPUT_VARIABLE TARGET_ARCH
37 OUTPUT_STRIP_TRAILING_WHITESPACE
38)
3439
35option(use_debflags "Use build flags from dpkg-buildflags." OFF)40option(use_debflags "Use build flags from dpkg-buildflags." OFF)
36if(use_debflags)41if(use_debflags)
@@ -87,15 +92,28 @@
87)92)
88endif(MIR_DISABLE_EPOLL_REACTOR)93endif(MIR_DISABLE_EPOLL_REACTOR)
8994
95add_definitions(-DMESA_EGL_NO_X11_HEADERS)
96
90# Default to mesa backend97# Default to mesa backend
91set(98set(
92 MIR_PLATFORM99 MIR_PLATFORM
93 mesa100 mesa
94 CACHE101 CACHE
95 STRING102 STRING
96 "graphics backend to build (options are 'mesa' or 'android')"103 "a list of graphics backends to build (options are 'mesa' or 'android')"
97)104)
98105
106list(GET MIR_PLATFORM 0 MIR_TEST_PLATFORM)
107
108foreach(platform IN LISTS MIR_PLATFORM)
109 if (platform STREQUAL "mesa")
110 set(MIR_BUILD_PLATFORM_MESA TRUE)
111 endif()
112 if (platform STREQUAL "android")
113 set(MIR_BUILD_PLATFORM_ANDROID TRUE)
114 endif()
115endforeach(platform)
116
99find_package(EGL REQUIRED)117find_package(EGL REQUIRED)
100find_package(GLESv2 REQUIRED)118find_package(GLESv2 REQUIRED)
101find_package(GLM REQUIRED)119find_package(GLM REQUIRED)
@@ -110,24 +128,14 @@
110include_directories (${EGL_INCLUDE_DIRS})128include_directories (${EGL_INCLUDE_DIRS})
111include_directories (${GLM_INCLUDE_DIRS})129include_directories (${GLM_INCLUDE_DIRS})
112130
113if (MIR_PLATFORM STREQUAL "android")131if (MIR_BUILD_PLATFORM_ANDROID)
114
115 #android headers use 'int foo[0]' as struct members
116 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
117
118 add_definitions( -DANDROID )
119
120 find_package(LibHardware REQUIRED)132 find_package(LibHardware REQUIRED)
133endif()
121134
122 #ctest does not work for android, so turn test discovery off135if (MIR_BUILD_PLATFORM_MESA)
123 set(DISABLE_GTEST_TEST_DISCOVERY ON)
124elseif (MIR_PLATFORM STREQUAL "mesa")
125 find_package( PkgConfig )136 find_package( PkgConfig )
126 pkg_check_modules( GBM REQUIRED gbm>=9.0.0)137 pkg_check_modules( GBM REQUIRED gbm>=9.0.0)
127 pkg_check_modules( DRM REQUIRED libdrm )138 pkg_check_modules( DRM REQUIRED libdrm )
128 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GBM__")
129else ()
130 message (FATAL_ERROR "MIR_BACKEND must be either 'android' or 'mesa'")
131endif()139endif()
132140
133set(MIR_ANDROID_INCLUDE_DIRECTORIES) # to be filled by android-input141set(MIR_ANDROID_INCLUDE_DIRECTORIES) # to be filled by android-input
134142
=== modified file 'cmake/FindXKBCOMMON.cmake'
--- cmake/FindXKBCOMMON.cmake 2013-04-10 18:09:31 +0000
+++ cmake/FindXKBCOMMON.cmake 2014-03-06 14:19:43 +0000
@@ -3,13 +3,8 @@
3find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h3find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h
4 HINTS ${PC_XKBCOMMON_INCLUDEDIR} ${PC_XKBCOMMON_INCLUDE_DIRS})4 HINTS ${PC_XKBCOMMON_INCLUDEDIR} ${PC_XKBCOMMON_INCLUDE_DIRS})
55
6if (MIR_PLATFORM STREQUAL "android")
7find_library(XKBCOMMON_LIBRARY libxkbcommon.so
8 HINTS /usr/lib/arm-linux-gnueabihf/)
9else()
10find_library(XKBCOMMON_LIBRARY xkbcommon6find_library(XKBCOMMON_LIBRARY xkbcommon
11 HINTS ${PC_XKBCOMMON_LIBDIR} ${PC_XKBCOMMON_LIBRARY_DIRS})7 HINTS ${PC_XKBCOMMON_LIBDIR} ${PC_XKBCOMMON_LIBRARY_DIRS})
12endif()
138
14set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})9set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
15set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})10set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
@@ -20,4 +15,4 @@
20find_package_handle_standard_args(XKBCOMMON DEFAULT_MSG15find_package_handle_standard_args(XKBCOMMON DEFAULT_MSG
21 XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR)16 XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR)
2217
23mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY)
24\ No newline at end of file18\ No newline at end of file
19mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY)
2520
=== modified file 'cmake/MirCommon.cmake'
--- cmake/MirCommon.cmake 2014-01-16 04:00:01 +0000
+++ cmake/MirCommon.cmake 2014-03-06 14:19:43 +0000
@@ -22,15 +22,12 @@
22 valgrind)22 valgrind)
2323
24 if(VALGRIND_EXECUTABLE)24 if(VALGRIND_EXECUTABLE)
25 if(MIR_PLATFORM STREQUAL "android")25 set(VALGRIND_ARGS "--error-exitcode=1" "--trace-children=yes")
26 # don't exit with an error when valgrind find errors26 set(DISCOVER_FLAGS "--enable-memcheck")
27 #set(VALGRIND_ARGS "--error-exitcode=1")27 if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf")
28 else()28 set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
29 set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes")29 set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
30 endif()30 endif()
31
32 set(ENABLE_MEMCHECK_FLAG "--enable-memcheck")
33
34 else(VALGRIND_EXECUTABLE)31 else(VALGRIND_EXECUTABLE)
35 message("Not enabling memcheck as valgrind is missing on your system")32 message("Not enabling memcheck as valgrind is missing on your system")
36 endif(VALGRIND_EXECUTABLE)33 endif(VALGRIND_EXECUTABLE)
@@ -63,7 +60,7 @@
6360
64 add_custom_target(61 add_custom_target(
65 ${TEST_DISCOVERY_TARGET_NAME} ALL62 ${TEST_DISCOVERY_TARGET_NAME} ALL
66 ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --gtest_list_tests | ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} ${ENABLE_MEMCHECK_FLAG}63 ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --gtest_list_tests | ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} ${DISCOVER_FLAGS}
67 ${EXTRA_ENV_FLAGS}64 ${EXTRA_ENV_FLAGS}
68 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}65 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
69 COMMENT "Discovering Tests in ${EXECUTABLE}" VERBATIM)66 COMMENT "Discovering Tests in ${EXECUTABLE}" VERBATIM)
@@ -89,7 +86,7 @@
89 else()86 else()
90 add_custom_target(87 add_custom_target(
91 memcheck_test ALL88 memcheck_test ALL
92 ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error --memcheck-test89 ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error --memcheck-test ${DISCOVER_FLAGS}
93 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}90 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
94 COMMENT "Adding memcheck test" VERBATIM)91 COMMENT "Adding memcheck test" VERBATIM)
9592
9693
=== modified file 'cmake/src/mir/mir_discover_gtest_tests.cpp'
--- cmake/src/mir/mir_discover_gtest_tests.cpp 2013-07-01 06:29:43 +0000
+++ cmake/src/mir/mir_discover_gtest_tests.cpp 2014-03-06 14:19:43 +0000
@@ -58,26 +58,34 @@
58 return pattern;58 return pattern;
59}59}
6060
61vector<string> valgrind_cmd_patterns()61vector<string> valgrind_cmd_patterns(vector<string> const& suppressions)
62{62{
63 vector<string> patterns{63 vector<string> patterns{
64 "valgrind",64 "valgrind",
65 "--error-exitcode=1",65 "--error-exitcode=1",
66 "--trace-children=yes",66 "--trace-children=yes"
67 };
68
69 for (auto const& sup : suppressions)
70 patterns.push_back(std::string("--suppressions=") + sup);
71
72 vector<string> gtest_patterns{
67 "%s",73 "%s",
68 "--gtest_death_test_use_fork",74 "--gtest_death_test_use_fork",
69 "--gtest_filter=%s"75 "--gtest_filter=%s"
70 };76 };
7177
78 patterns.insert(patterns.end(), gtest_patterns.begin(), gtest_patterns.end());
79
72 return patterns;80 return patterns;
73}81}
7482
75string memcheck_cmd_line_pattern()83string memcheck_cmd_line_pattern(vector<string> const& suppressions)
76{84{
77 stringstream ss;85 stringstream ss;
7886
79 ss << "ADD_TEST(\"memcheck(%s.%s)\"";87 ss << "ADD_TEST(\"memcheck(%s.%s)\"";
80 for (auto& s : valgrind_cmd_patterns())88 for (auto& s : valgrind_cmd_patterns(suppressions))
81 ss << " \"" << s << "\"";89 ss << " \"" << s << "\"";
82 ss << ")" << endl;90 ss << ")" << endl;
8391
@@ -112,6 +120,7 @@
112 bool enable_memcheck;120 bool enable_memcheck;
113 bool memcheck_test;121 bool memcheck_test;
114 std::vector<std::pair<std::string, std::string>> extra_environment;122 std::vector<std::pair<std::string, std::string>> extra_environment;
123 std::vector<std::string> suppressions;
115};124};
116125
117bool parse_configuration_from_cmd_line(int argc, char** argv, Configuration& config)126bool parse_configuration_from_cmd_line(int argc, char** argv, Configuration& config)
@@ -121,6 +130,7 @@
121 {"enable-memcheck", no_argument, 0, 0},130 {"enable-memcheck", no_argument, 0, 0},
122 {"memcheck-test", no_argument, 0, 0},131 {"memcheck-test", no_argument, 0, 0},
123 {"add-environment", required_argument, 0, 0},132 {"add-environment", required_argument, 0, 0},
133 {"suppressions", required_argument, 0, 0},
124 {0, 0, 0, 0}134 {0, 0, 0, 0}
125 };135 };
126136
@@ -161,17 +171,21 @@
161 return false;171 return false;
162 config.extra_environment.push_back(std::make_pair(std::string(optarg, equal_pos - optarg), std::string(equal_pos + 1)));172 config.extra_environment.push_back(std::make_pair(std::string(optarg, equal_pos - optarg), std::string(equal_pos + 1)));
163 }173 }
174 else if (!strcmp(optname, "suppressions"))
175 {
176 config.suppressions.push_back(std::string(optarg));
177 }
164 }178 }
165179
166 return true;180 return true;
167}181}
168182
169string prepareMemcheckTestLine(string const& exe)183string prepareMemcheckTestLine(string const& exe, vector<string> const& suppressions)
170{184{
171 stringstream ss;185 stringstream ss;
172186
173 ss << "ADD_TEST(\"memcheck-test\" \"sh\" \"-c\" \"";187 ss << "ADD_TEST(\"memcheck-test\" \"sh\" \"-c\" \"";
174 for (auto& s : valgrind_cmd_patterns())188 for (auto& s : valgrind_cmd_patterns(suppressions))
175 ss << s << " ";189 ss << s << " ";
176 ss << "; if [ $? != 0 ]; then exit 0; else exit 1; fi\")";190 ss << "; if [ $? != 0 ]; then exit 0; else exit 1; fi\")";
177191
@@ -186,13 +200,13 @@
186 return cmd_line;200 return cmd_line;
187}201}
188202
189void emitMemcheckTest(string const& exe)203void emitMemcheckTest(string const& exe, vector<string> const& suppressions)
190{204{
191 ifstream CTestTestfile("CTestTestfile.cmake", ifstream::in);205 ifstream CTestTestfile("CTestTestfile.cmake", ifstream::in);
192 bool need_memcheck_test = true;206 bool need_memcheck_test = true;
193 string line;207 string line;
194208
195 string memcheckTestLine = prepareMemcheckTestLine(exe);209 string memcheckTestLine = prepareMemcheckTestLine(exe, suppressions);
196210
197 if (CTestTestfile.is_open())211 if (CTestTestfile.is_open())
198 {212 {
@@ -238,7 +252,7 @@
238252
239 if (config.memcheck_test)253 if (config.memcheck_test)
240 {254 {
241 emitMemcheckTest(config.executable);255 emitMemcheckTest(config.executable, config.suppressions);
242 return 0;256 return 0;
243 }257 }
244258
@@ -277,7 +291,7 @@
277 snprintf(291 snprintf(
278 cmd_line,292 cmd_line,
279 sizeof(cmd_line),293 sizeof(cmd_line),
280 config.enable_memcheck ? memcheck_cmd_line_pattern().c_str() :294 config.enable_memcheck ? memcheck_cmd_line_pattern(config.suppressions).c_str() :
281 ordinary_cmd_line_pattern().c_str(),295 ordinary_cmd_line_pattern().c_str(),
282 test_suite.c_str(),296 test_suite.c_str(),
283 elide_string_left(*test, output_width/2).c_str(),297 elide_string_left(*test, output_width/2).c_str(),
284298
=== modified file 'cross-compile-chroot.sh'
--- cross-compile-chroot.sh 2014-01-22 08:32:55 +0000
+++ cross-compile-chroot.sh 2014-03-06 14:19:43 +0000
@@ -1,27 +1,69 @@
1#!/bin/bash1#!/bin/bash
2# build script for Mir on android arm devices2# build script to compile Mir for armhf devices
3#3#
4set -e4set -e
55
6usage() {
7 echo "usage: $(basename $0) [-c] [-u]"
8 echo "-c clean before building"
9 echo "-u update partial chroot directory"
10 echo "-h this message"
11}
12
13clean_build_dir() {
14 rm -rf ${1}
15 mkdir ${1}
16}
17
6BUILD_DIR=build-android-arm18BUILD_DIR=build-android-arm
7NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))19NUM_JOBS=$(( $(grep -c ^processor /proc/cpuinfo) + 1 ))
820_do_update_chroot=0
9if [ "$MIR_NDK_PATH" = "" ]; then21
10 export MIR_NDK_PATH=`pwd`/partial-armhf-chroot22while getopts "cuh" OPTNAME
11 if [ ! -d ${MIR_NDK_PATH} ]; then 23do
12 echo "no partial root specified or detected. attempting to create one"24 case $OPTNAME in
13 fi25 c )
14fi26 clean_build_dir ${BUILD_DIR}
1527 ;;
16pushd tools > /dev/null28 u )
17 ./setup-partial-armhf-chroot.sh ${MIR_NDK_PATH}29 _do_update_chroot=1
18popd > /dev/null30 ;;
1931 h )
20echo "Using MIR_NDK_PATH: $MIR_NDK_PATH"32 usage
2133 exit 0
22#start with a clean build every time34 ;;
23rm -rf ${BUILD_DIR}35 * )
24mkdir ${BUILD_DIR}36 echo "invalid option specified"
37 usage
38 exit 1
39 ;;
40 esac
41done
42
43
44if [ "${MIR_NDK_PATH}" = "" ]; then
45 export MIR_NDK_PATH=$(pwd)/partial-armhf-chroot
46fi
47
48if [ ! -d ${MIR_NDK_PATH} ]; then
49 echo "no partial chroot dir detected. attempting to create one"
50 _do_update_chroot=1
51fi
52
53if [ ! -d ${BUILD_DIR} ]; then
54 mkdir ${BUILD_DIR}
55fi
56
57if [ ${_do_update_chroot} -eq 1 ] ; then
58 pushd tools > /dev/null
59 ./setup-partial-armhf-chroot.sh ${MIR_NDK_PATH}
60 popd > /dev/null
61 # force a clean build after an update, since CMake cache maybe out of date
62 clean_build_dir ${BUILD_DIR}
63fi
64
65echo "Using MIR_NDK_PATH: ${MIR_NDK_PATH}"
66
25pushd ${BUILD_DIR} > /dev/null 67pushd ${BUILD_DIR} > /dev/null
2668
27 export PKG_CONFIG_PATH="${MIR_NDK_PATH}/usr/lib/pkgconfig:${MIR_NDK_PATH}/usr/lib/arm-linux-gnueabihf/pkgconfig"69 export PKG_CONFIG_PATH="${MIR_NDK_PATH}/usr/lib/pkgconfig:${MIR_NDK_PATH}/usr/lib/arm-linux-gnueabihf/pkgconfig"
@@ -33,9 +75,9 @@
33 echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE"75 echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE"
34 cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \76 cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \
35 -DBoost_COMPILER=-gcc \77 -DBoost_COMPILER=-gcc \
36 -DMIR_PLATFORM=android \78 -DMIR_PLATFORM=android\;mesa \
37 .. 79 ..
3880
39 cmake --build . -- -j${NUM_JOBS}81 make -j${NUM_JOBS}
4082
41popd ${BUILD_DIR} > /dev/null 83popd > /dev/null
4284
=== modified file 'debian/changelog'
--- debian/changelog 2014-02-12 18:29:30 +0000
+++ debian/changelog 2014-03-06 14:19:43 +0000
@@ -1,3 +1,71 @@
1mir (0.1.6-0ubuntu1) UNRELEASED; urgency=medium
2
3 * Cherry-picked from future release 0.1.7:
4 - Enhancement: options: Make it easier to customize DefaultConfiguration
5 - Bug fix: Don't pass a parameter to bash's popd command. It doesn't expect
6 one and will return an error from cross-compile-chroot.sh. (LP: #1287600)
7 * New upstream release 0.1.6 (https://launchpad.net/mir/+milestone/0.1.6)
8 - mirserver ABI bumped to 16.
9 - Server API changes:
10 . Report classes have moved to new namespaces/components. Please
11 consult the server headers.
12 . General clean-ups and virtual function changes affecting the ABI
13 (a rebuild is required for all shells).
14 - mirclient ABI unchanged, still at 7. Clients do not need rebuilding.
15 - Add new feature: Screen recording ("screencasting") as demonstrated by
16 the new mir-util "mirscreencast".
17 - debian: Provide platform packages managed with dpkg alternatives.
18 - Add new valgrind suppressions (mostly for armhf right now)
19 - tools: Add new libmirclientplatform.so to install_on_android.sh.
20 - Add "mir_demo_standalone_render_overlays", which is a free-standing
21 example of overlay support.
22 - Proper DisplayConfiguration for the AndroidDisplay to be better
23 prepared for multi-monitor Android.
24 - Commenced/continued simplifying the surface class hierarchy: BasicSurface
25 has now absorbed SurfaceData.
26 - Dynamically load the client platform library.
27 - Bugs fixed:
28 . Exceptions thrown from within compositing threads were untraceable,
29 resulting in a bunch of undebuggable crash reports (LP: #1237332)
30 . Ensure we close drm device file descriptors on exec. (LP: #1284081)
31 . nested render_surfaces fails on N4 [std::exception::what: Failed to
32 compile vertex shader:] (LP: #1284597)
33 . examples: correct "fullscreen-surfaces" option. (LP: #1284554)
34 . Fix mutex data race reported by helgrind in integration test:
35 SwapperSwappingStress (LP: #1282886)
36 . scene: Return null snapshots for sessions without surfaces
37 (LP: #1281728)
38 . tests: Address some raciness in
39 MesaDisplayTest.drm_device_change_event_triggers_handler.
40 (LP: #1283085)
41 . tests: Suppress spurious memory errors occuring when running the
42 unit tests on armhf with valgrind. (LP: #1279438)
43 . Mir shows an old frame on client startup (for Mesa GL clients)
44 (LP: #1281938)
45 . tests: Add expectation to validate second SessionAuthorizer method
46 is called wit correct parameter. (LP: #1218436)
47 . Set field "current_format" when sending a display config to the
48 server. (LP: #1277343)
49 . Fix crash in android devices by working around a subtle threading
50 bug, use a dummy thead_local array to push the gl/egl context TLS
51 into a region where the future wait code does not overwrite it.
52 (LP: #1280086)
53 . compositor: calling SwitchingBundle::force_requests_to_complete()
54 can be a no-op when there are no requests. (LP: #1281145)
55 . tests: Don't emit an "add" uevent manually when adding a device
56 (LP: #1281146)
57 . config: reduce size of default RPC thread pool. (LP: #1233001)
58 . Clients freeze on startup if 10 or more are already running
59 (LP: #1267323)
60 . Fix Nexus 10 leaking FDs in the hwc prepare/set loop. (LP: #1278658)
61 . Parallelize page flipping with rendering of the next frame, fixing
62 stuttering observed in multi-monitor clone mode (LP: #1213801)
63 . Ubuntu trusty update "glm 0.9.5.1-1" broke Mir builds. Work around the
64 change. (LP: #1285955)
65 . Screencast feature by compositing to offscreen buffer (LP: #1207312)
66
67 -- Kevin Gunn <kevin.gunn@canonical.com> Thu, 27 Feb 2014 19:37:47 -0600
68
1mir (0.1.5+14.04.20140212-0ubuntu1) trusty; urgency=medium69mir (0.1.5+14.04.20140212-0ubuntu1) trusty; urgency=medium
270
3 [ Kevin Gunn ]71 [ Kevin Gunn ]
472
=== modified file 'debian/control'
--- debian/control 2014-02-06 17:55:08 +0000
+++ debian/control 2014-03-06 14:19:43 +0000
@@ -19,20 +19,20 @@
19 libboost-regex-dev,19 libboost-regex-dev,
20 libboost-filesystem-dev,20 libboost-filesystem-dev,
21 protobuf-compiler,21 protobuf-compiler,
22 libdrm-dev [!armhf],22 libdrm-dev,
23 libegl1-mesa-dev,23 libegl1-mesa-dev,
24 libgles2-mesa-dev,24 libgles2-mesa-dev,
25 libgbm-dev [!armhf],25 libgbm-dev,
26 libglm-dev,26 libglm-dev,
27 libprotobuf-dev,27 libprotobuf-dev,
28 pkg-config,28 pkg-config,
29 android-headers (>=4.2.2) [armhf],29 android-headers (>=4.2.2) [i386 amd64 armhf],
30 libhardware-dev [armhf],30 libhardware-dev [i386 amd64 armhf],
31 libgoogle-glog-dev,31 libgoogle-glog-dev,
32 liblttng-ust-dev,32 liblttng-ust-dev,
33 libxkbcommon-dev,33 libxkbcommon-dev,
34 libumockdev-dev [!armhf],34 libumockdev-dev,
35 umockdev [!armhf],35 umockdev,
36 libudev-dev,36 libudev-dev,
37 google-mock (>= 1.6.0+svn437),37 google-mock (>= 1.6.0+svn437),
38 valgrind [!arm64],38 valgrind [!arm64],
@@ -70,7 +70,7 @@
70 .70 .
71 Contains the protocol's definition files.71 Contains the protocol's definition files.
7272
73Package: libmirserver1573Package: libmirserver16
74Section: libs74Section: libs
75Architecture: i386 amd64 armhf arm6475Architecture: i386 amd64 armhf arm64
76Multi-Arch: same76Multi-Arch: same
@@ -78,6 +78,8 @@
78Depends: ${misc:Depends},78Depends: ${misc:Depends},
79 ${shlibs:Depends},79 ${shlibs:Depends},
80 libmirplatform (= ${binary:Version}),80 libmirplatform (= ${binary:Version}),
81 libmirplatformgraphics-mesa (= ${binary:Version}) |
82 libmirplatformgraphics-android (= ${binary:Version}),
81Description: Display server for Ubuntu - server library83Description: Display server for Ubuntu - server library
82 Mir is a display server running on linux systems, with a focus on efficiency,84 Mir is a display server running on linux systems, with a focus on efficiency,
83 robust operation and a well-defined driver model.85 robust operation and a well-defined driver model.
@@ -99,6 +101,36 @@
99 Contains the shared libraries required for the Mir server to interact with101 Contains the shared libraries required for the Mir server to interact with
100 the underlying hardware platform.102 the underlying hardware platform.
101103
104Package: libmirplatformgraphics-mesa
105Section: libs
106Architecture: i386 amd64 armhf arm64
107Multi-Arch: same
108Pre-Depends: ${misc:Pre-Depends}
109Depends: ${misc:Depends},
110 ${shlibs:Depends},
111 libmirplatform (= ${binary:Version}),
112Description: Display server for Ubuntu - platform library for Mesa
113 Mir is a display server running on linux systems, with a focus on efficiency,
114 robust operation and a well-defined driver model.
115 .
116 Contains the shared libraries required for the Mir server to interact with
117 the hardware platform using the Mesa drivers.
118
119Package: libmirplatformgraphics-android
120Section: libs
121Architecture: i386 amd64 armhf
122Multi-Arch: same
123Pre-Depends: ${misc:Pre-Depends}
124Depends: ${misc:Depends},
125 ${shlibs:Depends},
126 libmirplatform (= ${binary:Version}),
127Description: Display server for Ubuntu - platform library for Android
128 Mir is a display server running on linux systems, with a focus on efficiency,
129 robust operation and a well-defined driver model.
130 .
131 Contains the shared libraries required for the Mir server to interact with
132 the hardware platform using the Android drivers.
133
102Package: mircommon-dev134Package: mircommon-dev
103Section: libdevel135Section: libdevel
104Architecture: i386 amd64 armhf arm64136Architecture: i386 amd64 armhf arm64
@@ -116,7 +148,7 @@
116Architecture: i386 amd64 armhf arm64148Architecture: i386 amd64 armhf arm64
117Multi-Arch: same149Multi-Arch: same
118Pre-Depends: ${misc:Pre-Depends}150Pre-Depends: ${misc:Pre-Depends}
119Depends: libmirserver15 (= ${binary:Version}),151Depends: libmirserver16 (= ${binary:Version}),
120 libmirprotobuf-dev (= ${binary:Version}),152 libmirprotobuf-dev (= ${binary:Version}),
121 mircommon-dev (= ${binary:Version}),153 mircommon-dev (= ${binary:Version}),
122 libglm-dev,154 libglm-dev,
@@ -135,6 +167,8 @@
135Pre-Depends: ${misc:Pre-Depends}167Pre-Depends: ${misc:Pre-Depends}
136Depends: ${misc:Depends},168Depends: ${misc:Depends},
137 ${shlibs:Depends},169 ${shlibs:Depends},
170 libmirclientplatform-mesa (= ${binary:Version}) |
171 libmirclientplatform-android (= ${binary:Version}),
138Description: Display server for Ubuntu - client library172Description: Display server for Ubuntu - client library
139 Mir is a display server running on linux systems, with a focus on efficiency,173 Mir is a display server running on linux systems, with a focus on efficiency,
140 robust operation and a well-defined driver model.174 robust operation and a well-defined driver model.
@@ -156,6 +190,36 @@
156 .190 .
157 Contains header files required to develop against Mir.191 Contains header files required to develop against Mir.
158192
193Package: libmirclientplatform-mesa
194Section: libs
195Architecture: i386 amd64 armhf arm64
196Multi-Arch: same
197Pre-Depends: ${misc:Pre-Depends}
198Depends: ${misc:Depends},
199 ${shlibs:Depends}
200Replaces: libmirclientplatform
201Description: Display server for Ubuntu - client platform library for Mesa
202 Mir is a display server running on linux systems, with a focus on efficiency,
203 robust operation and a well-defined driver model.
204 .
205 Contains the shared libraries required for the Mir clients to interact with
206 the underlying hardware platform using the Mesa drivers.
207
208Package: libmirclientplatform-android
209Section: libs
210Architecture: i386 amd64 armhf
211Multi-Arch: same
212Pre-Depends: ${misc:Pre-Depends}
213Depends: ${misc:Depends},
214 ${shlibs:Depends}
215Replaces: libmirclientplatform
216Description: Display server for Ubuntu - client platform library for Android
217 Mir is a display server running on linux systems, with a focus on efficiency,
218 robust operation and a well-defined driver model.
219 .
220 Contains the shared libraries required for the Mir clients to interact with
221 the underlying hardware platform using the Android drivers.
222
159Package: mir-demos223Package: mir-demos
160Architecture: i386 amd64 armhf arm64224Architecture: i386 amd64 armhf arm64
161Depends: ${misc:Depends},225Depends: ${misc:Depends},
162226
=== added file 'debian/create_postinst_prerm_scripts.sh'
--- debian/create_postinst_prerm_scripts.sh 1970-01-01 00:00:00 +0000
+++ debian/create_postinst_prerm_scripts.sh 2014-03-06 14:19:43 +0000
@@ -0,0 +1,30 @@
1#!/bin/sh
2
3set -e
4
5mir_platform_types="platformgraphics clientplatform"
6mir_platforms="android mesa"
7dpkg_alternatives_priority=500
8deb_host_multiarch=$1
9
10create_script()
11{
12 local script=$1
13 local platform_type=$2
14 local platform=$3
15
16 sed -e "s/@DEB_HOST_MULTIARCH@/$deb_host_multiarch/" \
17 -e "s/@MIR_PLATFORM_TYPE@/$platform_type/" \
18 -e "s/@MIR_PLATFORM@/$platform/" \
19 -e "s/@DPKG_ALTERNATIVES_PRIORITY@/$dpkg_alternatives_priority/" \
20 debian/update-alternatives.${script}.in > debian/libmir$platform_type-$platform.${script}
21}
22
23for platform_type in $mir_platform_types;
24do
25 for platform in $mir_platforms;
26 do
27 create_script postinst $platform_type $platform
28 create_script prerm $platform_type $platform
29 done
30done
031
=== added file 'debian/install_ld_so_conf.sh'
--- debian/install_ld_so_conf.sh 1970-01-01 00:00:00 +0000
+++ debian/install_ld_so_conf.sh 2014-03-06 14:19:43 +0000
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3set -e
4
5mir_platform_types="platformgraphics clientplatform"
6mir_platforms="android mesa"
7
8DEB_HOST_MULTIARCH=$1
9
10for platform_type in $mir_platform_types;
11do
12 for platform in $mir_platforms;
13 do
14 platform_dir="/usr/lib/$DEB_HOST_MULTIARCH/mir/$platform_type/$platform"
15 package_dir="debian/libmir$platform_type-$platform/$platform_dir"
16 echo "$platform_dir" > $package_dir/ld.so.conf
17 done
18done
019
=== added file 'debian/libmirclientplatform-android.install'
--- debian/libmirclientplatform-android.install 1970-01-01 00:00:00 +0000
+++ debian/libmirclientplatform-android.install 2014-03-06 14:19:43 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/mir/clientplatform/android/*
02
=== added file 'debian/libmirclientplatform-mesa.install'
--- debian/libmirclientplatform-mesa.install 1970-01-01 00:00:00 +0000
+++ debian/libmirclientplatform-mesa.install 2014-03-06 14:19:43 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/mir/clientplatform/mesa/*
02
=== modified file 'debian/libmirplatform.install'
--- debian/libmirplatform.install 2013-08-09 03:54:38 +0000
+++ debian/libmirplatform.install 2014-03-06 14:19:43 +0000
@@ -1,2 +1,1 @@
1usr/lib/*/libmirplatform.so1usr/lib/*/libmirplatform.so
2usr/lib/*/libmirplatformgraphics.so
32
=== added file 'debian/libmirplatformgraphics-android.install'
--- debian/libmirplatformgraphics-android.install 1970-01-01 00:00:00 +0000
+++ debian/libmirplatformgraphics-android.install 2014-03-06 14:19:43 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/mir/platformgraphics/android/*
02
=== added file 'debian/libmirplatformgraphics-mesa.install'
--- debian/libmirplatformgraphics-mesa.install 1970-01-01 00:00:00 +0000
+++ debian/libmirplatformgraphics-mesa.install 2014-03-06 14:19:43 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/mir/platformgraphics/mesa/*
02
=== renamed file 'debian/libmirserver15.install' => 'debian/libmirserver16.install'
--- debian/libmirserver15.install 2014-02-06 17:55:08 +0000
+++ debian/libmirserver16.install 2014-03-06 14:19:43 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/libmirserver.so.151usr/lib/*/libmirserver.so.16
22
=== modified file 'debian/rules'
--- debian/rules 2014-02-04 09:23:51 +0000
+++ debian/rules 2014-03-06 14:19:43 +0000
@@ -21,19 +21,29 @@
21ifeq ($(DEB_HOST_ARCH),armhf)21ifeq ($(DEB_HOST_ARCH),armhf)
22 dh_auto_configure -- \22 dh_auto_configure -- \
23 $(COMMON_CONFIGURE_OPTIONS) \23 $(COMMON_CONFIGURE_OPTIONS) \
24 -DMIR_RUN_ACCEPTANCE_TESTS=OFF -DMIR_RUN_INTEGRATION_TESTS=OFF \24 -DMIR_RUN_ACCEPTANCE_TESTS=OFF \
25 -DMIR_PLATFORM=android 25 -DMIR_RUN_INTEGRATION_TESTS=OFF \
26else26 -DMIR_PLATFORM=android\;mesa
27ifeq ($(DEB_HOST_ARCH),powerpc)27else
28 dh_auto_configure -- \28ifeq ($(DEB_HOST_ARCH),arm64)
29 $(COMMON_CONFIGURE_OPTIONS) \29 dh_auto_configure -- \
30 -DMIR_ENABLE_TESTS=NO30 $(COMMON_CONFIGURE_OPTIONS) \
31else31 -DMIR_PLATFORM=mesa
32 dh_auto_configure -- \32else
33 $(COMMON_CONFIGURE_OPTIONS)33 dh_auto_configure -- \
34 $(COMMON_CONFIGURE_OPTIONS) \
35 -DMIR_PLATFORM=mesa\;android
34endif36endif
35endif37endif
3638
37# TODO: we'll use a symbol file once mir is abi stable39# TODO: we'll use a symbol file once mir is abi stable
38override_dh_makeshlibs:40override_dh_makeshlibs:
39 dh_makeshlibs -V41 dh_makeshlibs -V
42
43override_dh_install:
44 dh_install --fail-missing
45 sh debian/install_ld_so_conf.sh $(DEB_HOST_MULTIARCH)
46
47override_dh_installdeb:
48 sh debian/create_postinst_prerm_scripts.sh $(DEB_HOST_MULTIARCH)
49 dh_installdeb
4050
=== added file 'debian/update-alternatives.postinst.in'
--- debian/update-alternatives.postinst.in 1970-01-01 00:00:00 +0000
+++ debian/update-alternatives.postinst.in 2014-03-06 14:19:43 +0000
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3set -e
4
5if [ "$1" = "configure" ];
6then
7 update-alternatives --force --install \
8 /etc/ld.so.conf.d/@DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@.conf \
9 @DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@_conf \
10 /usr/lib/@DEB_HOST_MULTIARCH@/mir/@MIR_PLATFORM_TYPE@/@MIR_PLATFORM@/ld.so.conf \
11 @DPKG_ALTERNATIVES_PRIORITY@
12
13 LDCONFIG_NOTRIGGER=y ldconfig
14fi
15
16#DEBHELPER#
17
18exit 0
019
=== added file 'debian/update-alternatives.prerm.in'
--- debian/update-alternatives.prerm.in 1970-01-01 00:00:00 +0000
+++ debian/update-alternatives.prerm.in 2014-03-06 14:19:43 +0000
@@ -0,0 +1,16 @@
1#!/bin/sh
2
3set -e
4
5if [ "$1" = "remove" ];
6then
7 update-alternatives --remove \
8 @DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@_conf \
9 /usr/lib/@DEB_HOST_MULTIARCH@/mir/@MIR_PLATFORM_TYPE@/@MIR_PLATFORM@/ld.so.conf
10
11 ldconfig
12fi
13
14#DEBHELPER#
15
16exit 0
017
=== modified file 'doc/component_reports.md'
--- doc/component_reports.md 2014-01-13 06:12:33 +0000
+++ doc/component_reports.md 2014-03-06 14:19:43 +0000
@@ -18,13 +18,13 @@
1818
19Report | Handlers19Report | Handlers
20----------------------- | --------20----------------------- | --------
21connector-report | log21connector-report | log,lttng
22display-report | log22display-report | log,lttng
23input-report | log,lttng23input-report | log,lttng
24legacy-input-report | log24legacy-input-report | log
25msg-processor-report | log,lttng25msg-processor-report | log,lttng
26session-mediator-report | log26session-mediator-report | log,lttng
27scene-report | log27scene-report | log,lttng
2828
29For example, to enable the LTTng input report, one could either use the29For example, to enable the LTTng input report, one could either use the
30`--input-report=lttng` command-line option to the server, or set the30`--input-report=lttng` command-line option to the server, or set the
@@ -40,7 +40,7 @@
40Report | Handlers40Report | Handlers
41------------------- | --------41------------------- | --------
42rpc-report | log,lttng42rpc-report | log,lttng
43input-receiver | log43input-receiver | log,lttng
4444
45For example, to enable the logging RPC report, one should set the45For example, to enable the logging RPC report, one should set the
46`MIR_CLIENT_RPC_REPORT=log` environment variable.46`MIR_CLIENT_RPC_REPORT=log` environment variable.
4747
=== modified file 'examples/CMakeLists.txt'
--- examples/CMakeLists.txt 2014-01-15 03:41:11 +0000
+++ examples/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -93,12 +93,12 @@
93 ${PROJECT_SOURCE_DIR}/include/server93 ${PROJECT_SOURCE_DIR}/include/server
94 ${PROJECT_SOURCE_DIR}/include/client94 ${PROJECT_SOURCE_DIR}/include/client
95 ${PROJECT_SOURCE_DIR}/include/platform95 ${PROJECT_SOURCE_DIR}/include/platform
96 ${PROJECT_SOURCE_DIR}/include/test/mir_test/draw
96 ${GLESv2_INCLUDE_DIRS}97 ${GLESv2_INCLUDE_DIRS}
97)98)
9899
99set(RENDER_TO_FB_SOURCES render_to_fb.cpp)100add_executable(mir_demo_standalone_render_to_fb
100add_executable(mir_demo_standalone_render_to_fb 101 render_to_fb.cpp
101 ${RENDER_TO_FB_SOURCES}
102)102)
103103
104target_link_libraries(mir_demo_standalone_render_to_fb104target_link_libraries(mir_demo_standalone_render_to_fb
@@ -108,6 +108,17 @@
108 ${Boost_LIBRARIES}108 ${Boost_LIBRARIES}
109)109)
110110
111add_executable(mir_demo_standalone_render_overlays
112 render_overlays.cpp
113)
114
115target_link_libraries(mir_demo_standalone_render_overlays
116 mirserver
117 mirlogging
118 mirdraw
119 mirtestdraw
120)
121
111set(RENDER_SURFACES_SOURCES122set(RENDER_SURFACES_SOURCES
112 render_surfaces.cpp123 render_surfaces.cpp
113 buffer_render_target.cpp124 buffer_render_target.cpp
114125
=== modified file 'examples/basic_server_configuration.cpp'
--- examples/basic_server_configuration.cpp 2014-01-29 15:20:07 +0000
+++ examples/basic_server_configuration.cpp 2014-03-06 14:19:43 +0000
@@ -17,6 +17,7 @@
17 */17 */
1818
19#include "basic_server_configuration.h"19#include "basic_server_configuration.h"
20#include "mir/options/default_configuration.h"
2021
21#include "mir/abnormal_exit.h"22#include "mir/abnormal_exit.h"
22#include "mir/frontend/connector.h"23#include "mir/frontend/connector.h"
@@ -34,14 +35,19 @@
34namespace examples35namespace examples
35{36{
3637
37BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv)38BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv) :
38 : ServerConfiguration(argc, argv)39 ServerConfiguration([argc, argv]
40 {
41 auto result = std::make_shared<options::DefaultConfiguration>(argc, argv);
42
43 namespace po = boost::program_options;
44
45 result->add_options()
46 (launch_child_opt, po::value<std::string>(), "system() command to launch client");
47
48 return result;
49 }())
39{50{
40 namespace po = boost::program_options;
41
42 add_options()
43 (launch_child_opt, po::value<std::string>(), "system() command to launch client");
44;
45}51}
4652
47void BasicServerConfiguration::launch_client()53void BasicServerConfiguration::launch_client()
4854
=== modified file 'examples/demo-shell/demo_shell.cpp'
--- examples/demo-shell/demo_shell.cpp 2014-01-13 06:12:33 +0000
+++ examples/demo-shell/demo_shell.cpp 2014-03-06 14:19:43 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as5 * it under the terms of the GNU General Public License version 3 as
@@ -22,6 +22,7 @@
22#include "fullscreen_placement_strategy.h"22#include "fullscreen_placement_strategy.h"
23#include "../server_configuration.h"23#include "../server_configuration.h"
2424
25#include "mir/options/default_configuration.h"
25#include "mir/run_mir.h"26#include "mir/run_mir.h"
26#include "mir/report_exception.h"27#include "mir/report_exception.h"
27#include "mir/graphics/display.h"28#include "mir/graphics/display.h"
@@ -34,6 +35,7 @@
34namespace mg = mir::graphics;35namespace mg = mir::graphics;
35namespace mf = mir::frontend;36namespace mf = mir::frontend;
36namespace mi = mir::input;37namespace mi = mir::input;
38namespace mo = mir::options;
3739
38namespace mir40namespace mir
39{41{
@@ -44,14 +46,19 @@
44{46{
45 DemoServerConfiguration(int argc, char const* argv[],47 DemoServerConfiguration(int argc, char const* argv[],
46 std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)48 std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)
47 : ServerConfiguration(argc, argv),49 : ServerConfiguration([argc, argv]
50 {
51 auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
52
53 namespace po = boost::program_options;
54
55 result->add_options()
56 ("fullscreen-surfaces", "Make all surfaces fullscreen");
57
58 return result;
59 }()),
48 filter_list(filter_list)60 filter_list(filter_list)
49 {61 {
50 namespace po = boost::program_options;
51
52 add_options()
53 ("fullscreen-surfaces", po::value<bool>(),
54 "Make all surfaces fullscreen [bool:default=false]");
55 }62 }
5663
57 std::shared_ptr<msh::PlacementStrategy> the_shell_placement_strategy() override64 std::shared_ptr<msh::PlacementStrategy> the_shell_placement_strategy() override
5865
=== added file 'examples/render_overlays.cpp'
--- examples/render_overlays.cpp 1970-01-01 00:00:00 +0000
+++ examples/render_overlays.cpp 2014-03-06 14:19:43 +0000
@@ -0,0 +1,135 @@
1/*
2 * Copyright © 2012, 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#include "mir/default_server_configuration.h"
20#include "mir/graphics/display.h"
21#include "mir/graphics/renderable.h"
22#include "mir/graphics/display_buffer.h"
23#include "mir/graphics/platform.h"
24#include "mir/graphics/graphic_buffer_allocator.h"
25#include "mir/graphics/buffer_properties.h"
26#include "mir/report_exception.h"
27
28#include "graphics_region_factory.h"
29#include "patterns.h"
30
31#include <csignal>
32#include <iostream>
33
34namespace mg=mir::graphics;
35namespace ml=mir::logging;
36namespace mo=mir::options;
37namespace geom=mir::geometry;
38
39namespace
40{
41volatile std::sig_atomic_t running = true;
42
43void signal_handler(int /*signum*/)
44{
45 running = false;
46}
47}
48
49class DemoRenderable : public mg::Renderable
50{
51public:
52 DemoRenderable(std::shared_ptr<mg::Buffer> const& buffer, geom::Rectangle rect)
53 : renderable_buffer(buffer),
54 position(rect)
55 {
56 }
57
58 std::shared_ptr<mg::Buffer> buffer() const
59 {
60 return renderable_buffer;
61 }
62
63 bool alpha_enabled() const
64 {
65 return false;
66 }
67
68 geom::Rectangle screen_position() const
69 {
70 return position;
71 }
72
73private:
74 std::shared_ptr<mg::Buffer> const renderable_buffer;
75 geom::Rectangle const position;
76};
77
78int main(int argc, char const** argv)
79try
80{
81 mir::test::draw::DrawPatternSolid fill_with_green(0x00FF00FF);
82 mir::test::draw::DrawPatternSolid fill_with_blue(0x0000FFFF);
83
84 /* Set up graceful exit on SIGINT and SIGTERM */
85 struct sigaction sa;
86 sa.sa_handler = signal_handler;
87 sa.sa_flags = 0;
88 sigemptyset(&sa.sa_mask);
89
90 sigaction(SIGINT, &sa, NULL);
91 sigaction(SIGTERM, &sa, NULL);
92
93 mir::DefaultServerConfiguration conf{argc, argv};
94
95 auto platform = conf.the_graphics_platform();
96 auto display = platform->create_display(conf.the_display_configuration_policy());
97 auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());
98 auto region_factory = mir::test::draw::create_graphics_region_factory();
99
100 mg::BufferProperties buffer_properties{
101 geom::Size{512, 512},
102 mir_pixel_format_abgr_8888,
103 mg::BufferUsage::hardware
104 };
105
106 auto buffer1 = buffer_allocator->alloc_buffer(buffer_properties);
107 auto buffer2 = buffer_allocator->alloc_buffer(buffer_properties);
108
109 fill_with_green.draw(*region_factory->graphic_region_from_handle(*buffer1->native_buffer_handle()));
110 fill_with_blue.draw(*region_factory->graphic_region_from_handle(*buffer2->native_buffer_handle()));
111
112 geom::Rectangle screen_pos1{{0,0} , {512, 512}};
113 geom::Rectangle screen_pos2{{80,80} , {592,592}};
114 std::list<std::shared_ptr<mg::Renderable>> renderlist
115 {
116 std::make_shared<DemoRenderable>(buffer2, screen_pos2),
117 std::make_shared<DemoRenderable>(buffer1, screen_pos1)
118 };
119
120 while (running)
121 {
122 display->for_each_display_buffer([&](mg::DisplayBuffer& buffer)
123 {
124 buffer.make_current();
125 auto render_fn = [](mg::Renderable const&) {};
126 buffer.render_and_post_update(renderlist, render_fn);
127 });
128 }
129 return 0;
130}
131catch (...)
132{
133 mir::report_exception(std::cerr);
134 return 1;
135}
0136
=== modified file 'examples/render_surfaces.cpp'
--- examples/render_surfaces.cpp 2014-02-04 14:48:29 +0000
+++ examples/render_surfaces.cpp 2014-03-06 14:19:43 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2012 Canonical Ltd.2 * Copyright © 2012-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as5 * it under the terms of the GNU General Public License version 3 as
@@ -18,6 +18,7 @@
1818
19#include "mir/compositor/display_buffer_compositor_factory.h"19#include "mir/compositor/display_buffer_compositor_factory.h"
20#include "mir/compositor/display_buffer_compositor.h"20#include "mir/compositor/display_buffer_compositor.h"
21#include "mir/options/default_configuration.h"
21#include "mir/graphics/graphic_buffer_allocator.h"22#include "mir/graphics/graphic_buffer_allocator.h"
22#include "mir/frontend/connector.h"23#include "mir/frontend/connector.h"
23#include "mir/shell/surface_creation_parameters.h"24#include "mir/shell/surface_creation_parameters.h"
@@ -27,10 +28,12 @@
27#include "mir/graphics/cursor.h"28#include "mir/graphics/cursor.h"
28#include "mir/graphics/display.h"29#include "mir/graphics/display.h"
29#include "mir/graphics/display_buffer.h"30#include "mir/graphics/display_buffer.h"
31#include "mir/graphics/gl_context.h"
30#include "mir/shell/surface_factory.h"32#include "mir/shell/surface_factory.h"
31#include "mir/shell/surface.h"33#include "mir/shell/surface.h"
32#include "mir/run_mir.h"34#include "mir/run_mir.h"
33#include "mir/report_exception.h"35#include "mir/report_exception.h"
36#include "mir/raii.h"
3437
35#include "mir_image.h"38#include "mir_image.h"
36#include "buffer_render_target.h"39#include "buffer_render_target.h"
@@ -51,12 +54,14 @@
51namespace mc = mir::compositor;54namespace mc = mir::compositor;
52namespace ms = mir::scene;55namespace ms = mir::scene;
53namespace mf = mir::frontend;56namespace mf = mir::frontend;
57namespace mo = mir::options;
54namespace msh = mir::shell;58namespace msh = mir::shell;
55namespace mi = mir::input;59namespace mi = mir::input;
56namespace geom = mir::geometry;60namespace geom = mir::geometry;
57namespace mt = mir::tools;61namespace mt = mir::tools;
58namespace me = mir::examples;62namespace me = mir::examples;
5963
64
60///\page render_surfaces-example render_surfaces.cpp: A simple program using the mir library.65///\page render_surfaces-example render_surfaces.cpp: A simple program using the mir library.
61///\tableofcontents66///\tableofcontents
62///render_surfaces shows the use of mir to render some moving surfaces67///render_surfaces shows the use of mir to render some moving surfaces
@@ -194,7 +199,7 @@
194 h{static_cast<float>(s->size().height.as_uint32_t())},199 h{static_cast<float>(s->size().height.as_uint32_t())},
195 dx{dx},200 dx{dx},
196 dy{dy},201 dy{dy},
197 rotation_axis{rotation_axis},202 rotation_axis(rotation_axis),
198 alpha_offset{alpha_offset}203 alpha_offset{alpha_offset}
199 {204 {
200 }205 }
@@ -252,16 +257,22 @@
252class RenderSurfacesServerConfiguration : public me::ServerConfiguration257class RenderSurfacesServerConfiguration : public me::ServerConfiguration
253{258{
254public:259public:
255 RenderSurfacesServerConfiguration(int argc, char const** argv)260 RenderSurfacesServerConfiguration(int argc, char const** argv) :
256 : ServerConfiguration(argc, argv)261 ServerConfiguration([argc, argv]
262 {
263 auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
264
265 namespace po = boost::program_options;
266
267 result->add_options()
268 (surfaces_to_render, po::value<int>()->default_value(5),
269 "Number of surfaces to render")
270 (display_cursor, po::value<bool>()->default_value(false),
271 "Display test cursor. (If input is disabled it gets animated.)");
272
273 return result;
274 }())
257 {275 {
258 namespace po = boost::program_options;
259
260 add_options()
261 (surfaces_to_render, po::value<int>()->default_value(5),
262 "Number of surfaces to render")
263 (display_cursor, po::value<bool>()->default_value(false),
264 "Display test cursor. (If input is disabled it gets animated.)");
265 }276 }
266277
267 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]278 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
@@ -287,12 +298,17 @@
287 class RenderResourcesBufferInitializer : public mg::BufferInitializer298 class RenderResourcesBufferInitializer : public mg::BufferInitializer
288 {299 {
289 public:300 public:
290 RenderResourcesBufferInitializer()301 RenderResourcesBufferInitializer(std::unique_ptr<mg::GLContext> gl_context)
302 : gl_context{std::move(gl_context)}
291 {303 {
292 }304 }
293305
294 void operator()(mg::Buffer& buffer)306 void operator()(mg::Buffer& buffer)
295 {307 {
308 auto using_gl_context = mir::raii::paired_calls(
309 [this] { gl_context->make_current(); },
310 [this] { gl_context->release_current(); });
311
296 mt::ImageRenderer img_renderer{mir_image.pixel_data,312 mt::ImageRenderer img_renderer{mir_image.pixel_data,
297 geom::Size{mir_image.width, mir_image.height},313 geom::Size{mir_image.width, mir_image.height},
298 mir_image.bytes_per_pixel};314 mir_image.bytes_per_pixel};
@@ -300,9 +316,13 @@
300 brt.make_current();316 brt.make_current();
301 img_renderer.render();317 img_renderer.render();
302 }318 }
319
320 private:
321 std::unique_ptr<mg::GLContext> const gl_context;
322
303 };323 };
304324
305 return std::make_shared<RenderResourcesBufferInitializer>();325 return std::make_shared<RenderResourcesBufferInitializer>(the_display()->create_gl_context());
306 }326 }
307 ///\internal [RenderResourcesBufferInitializer_tag]327 ///\internal [RenderResourcesBufferInitializer_tag]
308328
@@ -443,7 +463,7 @@
443463
444 bool input_is_on()464 bool input_is_on()
445 {465 {
446 return the_options()->get<bool>(enable_input_opt);466 return the_options()->get<bool>(mo::enable_input_opt);
447 }467 }
448468
449 std::weak_ptr<mg::Cursor> the_cursor()469 std::weak_ptr<mg::Cursor> the_cursor()
450470
=== modified file 'examples/render_to_fb.cpp'
--- examples/render_to_fb.cpp 2014-01-13 06:12:33 +0000
+++ examples/render_to_fb.cpp 2014-03-06 14:19:43 +0000
@@ -27,7 +27,6 @@
27#include <iostream>27#include <iostream>
2828
29namespace mg=mir::graphics;29namespace mg=mir::graphics;
30namespace ml=mir::logging;
31namespace mo=mir::options;30namespace mo=mir::options;
3231
33namespace32namespace
3433
=== modified file 'examples/scroll.cpp'
--- examples/scroll.cpp 2014-01-24 11:15:31 +0000
+++ examples/scroll.cpp 2014-03-06 14:19:43 +0000
@@ -95,7 +95,7 @@
9595
96 EGLNativeDisplayType native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(connection);96 EGLNativeDisplayType native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(connection);
97 EGLNativeWindowType native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(surface);97 EGLNativeWindowType native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(surface);
98 assert(native_window != NULL);98 assert(native_window != (EGLNativeWindowType)NULL);
9999
100 disp = eglGetDisplay(native_display);100 disp = eglGetDisplay(native_display);
101 assert(disp != EGL_NO_DISPLAY);101 assert(disp != EGL_NO_DISPLAY);
102102
=== modified file 'examples/server_configuration.cpp'
--- examples/server_configuration.cpp 2014-01-29 15:20:07 +0000
+++ examples/server_configuration.cpp 2014-03-06 14:19:43 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as5 * it under the terms of the GNU General Public License version 3 as
@@ -17,6 +17,7 @@
17 */17 */
1818
19#include "server_configuration.h"19#include "server_configuration.h"
20#include "mir/options/default_configuration.h"
20#include "mir/graphics/display_configuration_policy.h"21#include "mir/graphics/display_configuration_policy.h"
21#include "mir/graphics/display_configuration.h"22#include "mir/graphics/display_configuration.h"
22#include "mir/input/composite_event_filter.h"23#include "mir/input/composite_event_filter.h"
@@ -145,16 +146,21 @@
145146
146}147}
147148
148me::ServerConfiguration::ServerConfiguration(int argc, char const** argv)149me::ServerConfiguration::ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options) :
149 : DefaultServerConfiguration(argc, argv)150 DefaultServerConfiguration(configuration_options)
150{151{
151 namespace po = boost::program_options;152 namespace po = boost::program_options;
152153
153 add_options()154 configuration_options->add_options()
154 (display_config_opt, po::value<std::string>()->default_value(clone_opt_val),155 (display_config_opt, po::value<std::string>()->default_value(clone_opt_val),
155 "Display configuration [{clone,sidebyside,single}]");156 "Display configuration [{clone,sidebyside,single}]");
156}157}
157158
159me::ServerConfiguration::ServerConfiguration(int argc, char const** argv) :
160 ServerConfiguration(std::make_shared<options::DefaultConfiguration>(argc, argv))
161{
162}
163
158std::shared_ptr<mg::DisplayConfigurationPolicy>164std::shared_ptr<mg::DisplayConfigurationPolicy>
159me::ServerConfiguration::the_display_configuration_policy()165me::ServerConfiguration::the_display_configuration_policy()
160{166{
161167
=== modified file 'examples/server_configuration.h'
--- examples/server_configuration.h 2013-08-28 03:41:48 +0000
+++ examples/server_configuration.h 2014-03-06 14:19:43 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as5 * it under the terms of the GNU General Public License version 3 as
@@ -23,6 +23,11 @@
2323
24namespace mir24namespace mir
25{25{
26namespace options
27{
28class DefaultConfiguration;
29}
30
26namespace examples31namespace examples
27{32{
2833
@@ -30,6 +35,7 @@
30{35{
31public:36public:
32 ServerConfiguration(int argc, char const** argv);37 ServerConfiguration(int argc, char const** argv);
38 explicit ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options);
3339
34 std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy() override;40 std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy() override;
35 std::shared_ptr<input::CompositeEventFilter> the_composite_event_filter() override;41 std::shared_ptr<input::CompositeEventFilter> the_composite_event_filter() override;
3642
=== modified file 'guides/cppguide.xml'
--- guides/cppguide.xml 2014-01-13 04:16:45 +0000
+++ guides/cppguide.xml 2014-03-06 14:19:43 +0000
@@ -1060,12 +1060,13 @@
1060 be private</a>.1060 be private</a>.
1061 </p>1061 </p>
1062 <p>1062 <p>
1063 When redefining an inherited virtual function, explicitly1063 When redefining an inherited virtual method (both pure
1064 declare it <code>virtual</code> in the declaration of the1064 and non-pure), explicitly declare it <code>override</code>
1065 derived class. Rationale: If <code>virtual</code> is1065 in the declaration of the derived class. Rationale: using
1066 omitted, the reader has to check all ancestors of the1066 <code>override</code> allows the compiler to consistently
1067 class in question to determine if the function is virtual1067 detect attempts to override methods that have been changed
1068 or not.1068 or completely removed. It also makes it straightforward for
1069 a reader to determine if a method is virtual or not.
1069 </p>1070 </p>
1070 </DECISION>1071 </DECISION>
1071 </BODY>1072 </BODY>
10721073
=== renamed file 'include/server/mir/abnormal_exit.h' => 'include/platform/mir/abnormal_exit.h'
--- include/server/mir/abnormal_exit.h 2013-04-24 05:22:20 +0000
+++ include/platform/mir/abnormal_exit.h 2014-03-06 14:19:43 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU Lesser General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1717
=== modified file 'include/platform/mir/graphics/drm_authenticator.h'
--- include/platform/mir/graphics/drm_authenticator.h 2013-08-28 03:41:48 +0000
+++ include/platform/mir/graphics/drm_authenticator.h 2014-03-06 14:19:43 +0000
@@ -19,8 +19,6 @@
19#ifndef MIR_GRAPHICS_DRM_AUTHENTICATOR_H_19#ifndef MIR_GRAPHICS_DRM_AUTHENTICATOR_H_
20#define MIR_GRAPHICS_DRM_AUTHENTICATOR_H_20#define MIR_GRAPHICS_DRM_AUTHENTICATOR_H_
2121
22#include <xf86drm.h>
23
24namespace mir22namespace mir
25{23{
26namespace graphics24namespace graphics
@@ -31,7 +29,7 @@
31public:29public:
32 virtual ~DRMAuthenticator() {}30 virtual ~DRMAuthenticator() {}
3331
34 virtual void drm_auth_magic(drm_magic_t magic) = 0;32 virtual void drm_auth_magic(unsigned int magic) = 0;
3533
36protected:34protected:
37 DRMAuthenticator() = default;35 DRMAuthenticator() = default;
3836
=== added file 'include/platform/mir/options/configuration.h'
--- include/platform/mir/options/configuration.h 1970-01-01 00:00:00 +0000
+++ include/platform/mir/options/configuration.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,74 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored By: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIR_OPTIONS_CONFIGURATION_H_
20#define MIR_OPTIONS_CONFIGURATION_H_
21
22#include "mir/options/program_option.h"
23
24#include <memory>
25
26namespace mir
27{
28namespace options
29{
30extern char const* const server_socket_opt;
31extern char const* const no_server_socket_opt;
32extern char const* const enable_input_opt;
33extern char const* const session_mediator_report_opt;
34extern char const* const msg_processor_report_opt;
35extern char const* const compositor_report_opt;
36extern char const* const display_report_opt;
37extern char const* const legacy_input_report_opt;
38extern char const* const connector_report_opt;
39extern char const* const scene_report_opt;
40extern char const* const input_report_opt;
41extern char const* const host_socket_opt;
42extern char const* const standalone_opt;
43extern char const* const frontend_threads_opt;
44
45extern char const* const name_opt;
46extern char const* const offscreen_opt;
47
48extern char const* const glog;
49extern char const* const glog_stderrthreshold;
50extern char const* const glog_minloglevel;
51extern char const* const glog_log_dir;
52
53extern char const* const off_opt_value;
54extern char const* const log_opt_value;
55extern char const* const lttng_opt_value;
56
57extern char const* const platform_graphics_lib;
58
59class Configuration
60{
61public:
62 virtual std::shared_ptr<options::Option> the_options() const = 0;
63
64protected:
65
66 Configuration() = default;
67 virtual ~Configuration() = default;
68 Configuration(Configuration const&) = delete;
69 Configuration& operator=(Configuration const&) = delete;
70};
71}
72}
73
74#endif /* MIR_OPTIONS_CONFIGURATION_H_ */
075
=== renamed file 'include/server/mir/default_configuration_options.h' => 'include/platform/mir/options/default_configuration.h'
--- include/server/mir/default_configuration_options.h 2014-01-27 17:47:06 +0000
+++ include/platform/mir/options/default_configuration.h 2014-03-06 14:19:43 +0000
@@ -1,100 +1,65 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU Lesser General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */17 */
1818
19#ifndef MIR_DEFAULT_CONFIGURATION_OPTIONS_H_19#ifndef MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
20#define MIR_DEFAULT_CONFIGURATION_OPTIONS_H_20#define MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
2121
22#include "mir/options/program_option.h"22#include "mir/options/configuration.h"
2323
24#include <memory>
2524
26namespace mir25namespace mir
27{26{
28class ConfigurationOptions27namespace options
29{28{
30public:29class DefaultConfiguration : public Configuration
31 static char const* const server_socket_opt;30{
32 static char const* const no_server_socket_opt;31public:
33 static char const* const enable_input_opt;32 DefaultConfiguration(int argc, char const* argv[]);
34 static char const* const session_mediator_report_opt;33 virtual ~DefaultConfiguration() = default;
35 static char const* const msg_processor_report_opt;34
36 static char const* const compositor_report_opt;35 // add_options() allows users to add their own options. This MUST be called
37 static char const* const display_report_opt;36 // before the first invocation of the_options() - typically during initialization.
38 static char const* const legacy_input_report_opt;
39 static char const* const connector_report_opt;
40 static char const* const scene_report_opt;
41 static char const* const input_report_opt;
42 static char const* const host_socket_opt;
43 static char const* const standalone_opt;
44 static char const* const frontend_threads_opt;
45 static char const* const name_opt;
46 static char const* const offscreen_opt;
47
48 static char const* const glog;
49 static char const* const glog_stderrthreshold;
50 static char const* const glog_minloglevel;
51 static char const* const glog_log_dir;
52 static char const* const glog_log_dir_default;
53 static int const glog_stderrthreshold_default;
54 static int const glog_minloglevel_default;
55
56 static bool const enable_input_default;
57
58 static char const* const off_opt_value;
59 static char const* const log_opt_value;
60 static char const* const lttng_opt_value;
61
62 static char const* const platform_graphics_lib;
63 static char const* const default_platform_graphics_lib;
64
65 virtual std::shared_ptr<options::Option> the_options() const = 0;
66
67protected:
68
69 int default_ipc_threads = 10;
70
71 ConfigurationOptions() = default;
72 virtual ~ConfigurationOptions() = default;
73 ConfigurationOptions(ConfigurationOptions const&) = delete;
74 ConfigurationOptions& operator=(ConfigurationOptions const&) = delete;
75};
76
77class DefaultConfigurationOptions : public ConfigurationOptions
78{
79public:
80 DefaultConfigurationOptions(int argc, char const* argv[]);
81 virtual ~DefaultConfigurationOptions() = default;
82
83protected:
84 // add_options() allows configuration specializations to add their
85 // own options. This MUST be called before the first invocation of
86 // the_options() - typically during construction.
87 boost::program_options::options_description_easy_init add_options();37 boost::program_options::options_description_easy_init add_options();
88 virtual void parse_options(boost::program_options::options_description& options_description, options::ProgramOption& options) const;
89 virtual std::shared_ptr<options::Option> the_options() const;
9038
91private:39private:
40 // accessed via the base interface, when access to add_options() has been "lost"
41 std::shared_ptr<options::Option> the_options() const override;
42
43 virtual void parse_arguments(
44 boost::program_options::options_description desc,
45 ProgramOption& options,
46 int argc,
47 char const* argv[]) const;
48
49 virtual void parse_environment(
50 boost::program_options::options_description& desc,
51 ProgramOption& options) const;
52
53 virtual void parse_config_file(
54 boost::program_options::options_description& desc,
55 ProgramOption& options) const;
56
92 int const argc;57 int const argc;
93 char const** const argv;58 char const** const argv;
94 std::shared_ptr<boost::program_options::options_description> const program_options;59 std::shared_ptr<boost::program_options::options_description> const program_options;
95 std::shared_ptr<options::Option> mutable options;60 std::shared_ptr<Option> mutable options;
96};61};
97}62}
9863}
9964
100#endif /* MIR_DEFAULT_CONFIGURATION_OPTIONS_H_ */65#endif /* MIR_OPTIONS_DEFAULT_CONFIGURATION_H_ */
10166
=== modified file 'include/platform/mir/udev/wrapper.h'
--- include/platform/mir/udev/wrapper.h 2014-01-22 08:32:55 +0000
+++ include/platform/mir/udev/wrapper.h 2014-03-06 14:19:43 +0000
@@ -93,7 +93,7 @@
93 bool operator!=(iterator const& rhs) const;93 bool operator!=(iterator const& rhs) const;
9494
95 Device const& operator*() const;95 Device const& operator*() const;
9696 Device const* operator->() const;
97 private:97 private:
98 friend class Enumerator;98 friend class Enumerator;
9999
@@ -135,6 +135,7 @@
135 void enable(void);135 void enable(void);
136 int fd(void) const;136 int fd(void) const;
137137
138 void filter_by_subsystem(std::string const& subsystem);
138 void filter_by_subsystem_and_type(std::string const& subsystem, std::string const& devtype);139 void filter_by_subsystem_and_type(std::string const& subsystem, std::string const& devtype);
139140
140 void process_events(std::function<void(EventType, Device const&)> const& handler) const;141 void process_events(std::function<void(EventType, Device const&)> const& handler) const;
141142
=== modified file 'include/server/mir/compositor/compositor_report.h'
--- include/server/mir/compositor/compositor_report.h 2014-01-10 05:48:41 +0000
+++ include/server/mir/compositor/compositor_report.h 2014-03-06 14:19:43 +0000
@@ -41,17 +41,6 @@
41 CompositorReport& operator=(CompositorReport const&) = delete;41 CompositorReport& operator=(CompositorReport const&) = delete;
42};42};
4343
44class NullCompositorReport : public CompositorReport
45{
46public:
47 void added_display(int width, int height, int x, int y, SubCompositorId id);
48 void began_frame(SubCompositorId id);
49 void finished_frame(bool bypassed, SubCompositorId id);
50 void started();
51 void stopped();
52 void scheduled();
53};
54
55} // namespace compositor44} // namespace compositor
56} // namespace mir45} // namespace mir
5746
5847
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2014-01-29 18:02:33 +0000
+++ include/server/mir/default_server_configuration.h 2014-03-06 14:19:43 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2012 Canonical Ltd.2 * Copyright © 2012-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -20,7 +20,6 @@
2020
21#include "mir/cached_ptr.h"21#include "mir/cached_ptr.h"
22#include "mir/server_configuration.h"22#include "mir/server_configuration.h"
23#include "mir/default_configuration_options.h"
2423
25#include <memory>24#include <memory>
26#include <string>25#include <string>
@@ -114,10 +113,22 @@
114class Logger;113class Logger;
115}114}
116115
117class DefaultServerConfiguration : public virtual ServerConfiguration, protected DefaultConfigurationOptions116namespace options
117{
118class Option;
119class Configuration;
120}
121
122namespace report
123{
124class ReportFactory;
125}
126
127class DefaultServerConfiguration : public virtual ServerConfiguration
118{128{
119public:129public:
120 DefaultServerConfiguration(int argc, char const* argv[]);130 DefaultServerConfiguration(int argc, char const* argv[]);
131 explicit DefaultServerConfiguration(std::shared_ptr<options::Configuration> const& configuration_options);
121132
122 /** @name DisplayServer dependencies133 /** @name DisplayServer dependencies
123 * dependencies of DisplayServer on the rest of the Mir134 * dependencies of DisplayServer on the rest of the Mir
@@ -235,9 +246,7 @@
235 virtual std::shared_ptr<time::Clock> the_clock();246 virtual std::shared_ptr<time::Clock> the_clock();
236247
237protected:248protected:
238 using DefaultConfigurationOptions::the_options;249 std::shared_ptr<options::Option> the_options() const;
239 using DefaultConfigurationOptions::add_options;
240 using DefaultConfigurationOptions::parse_options;
241250
242 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();251 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();
243 virtual std::shared_ptr<scene::MediatingDisplayChanger> the_mediating_display_changer();252 virtual std::shared_ptr<scene::MediatingDisplayChanger> the_mediating_display_changer();
@@ -297,6 +306,7 @@
297 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;306 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;
298307
299private:308private:
309 std::shared_ptr<options::Configuration> const configuration_options;
300 std::shared_ptr<input::EventFilter> const default_filter;310 std::shared_ptr<input::EventFilter> const default_filter;
301311
302 virtual std::string the_socket_file() const;312 virtual std::string the_socket_file() const;
@@ -313,7 +323,8 @@
313 std::shared_ptr<scene::SessionManager> the_session_manager();323 std::shared_ptr<scene::SessionManager> the_session_manager();
314 std::shared_ptr<scene::SurfaceBuilder> the_surface_builder();324 std::shared_ptr<scene::SurfaceBuilder> the_surface_builder();
315 std::shared_ptr<scene::SurfaceController> the_surface_controller();325 std::shared_ptr<scene::SurfaceController> the_surface_controller();
316 std::function<void()> force_threads_to_unblock_callback();326
327 auto report_factory(char const* report_opt) -> std::unique_ptr<report::ReportFactory>;
317};328};
318}329}
319330
320331
=== modified file 'include/server/mir/frontend/connector_report.h'
--- include/server/mir/frontend/connector_report.h 2013-09-27 16:07:00 +0000
+++ include/server/mir/frontend/connector_report.h 2014-03-06 14:19:43 +0000
@@ -50,21 +50,6 @@
50 ConnectorReport& operator=(const ConnectorReport&) = delete;50 ConnectorReport& operator=(const ConnectorReport&) = delete;
51};51};
5252
53class NullConnectorReport : public ConnectorReport
54{
55public:
56 void thread_start() override;
57 void thread_end() override;
58 void starting_threads(int count) override;
59 void stopping_threads(int count) override;
60
61 void creating_session_for(int socket_handle) override;
62 void creating_socket_pair(int server_handle, int client_handle) override;
63
64 void listening_on(std::string const& endpoint) override;
65
66 void error(std::exception const& error) override;
67};
68}53}
69}54}
7055
7156
=== modified file 'include/server/mir/frontend/session_mediator_report.h'
--- include/server/mir/frontend/session_mediator_report.h 2013-09-24 07:02:12 +0000
+++ include/server/mir/frontend/session_mediator_report.h 2014-03-06 14:19:43 +0000
@@ -54,30 +54,6 @@
54 std::string const& what) = 0;54 std::string const& what) = 0;
55};55};
5656
57// Do-nothing implementation to satisfy dependencies
58class NullSessionMediatorReport : public SessionMediatorReport
59{
60 virtual void session_connect_called(std::string const& app_name);
61
62 virtual void session_create_surface_called(std::string const& app_name);
63
64 virtual void session_next_buffer_called(std::string const& app_name);
65
66 virtual void session_release_surface_called(std::string const& app_name);
67
68 virtual void session_disconnect_called(std::string const& app_name);
69
70 virtual void session_drm_auth_magic_called(std::string const& app_name);
71
72 virtual void session_configure_surface_called(std::string const& app_name);
73
74 virtual void session_configure_display_called(std::string const& app_name);
75
76 virtual void session_error(
77 std::string const& app_name,
78 char const* method,
79 std::string const& what);
80};
81}57}
82}58}
8359
8460
=== modified file 'include/server/mir/input/surface.h'
--- include/server/mir/input/surface.h 2014-01-13 06:12:33 +0000
+++ include/server/mir/input/surface.h 2014-03-06 14:19:43 +0000
@@ -31,7 +31,7 @@
31{31{
32public:32public:
33 virtual std::string const& name() const = 0;33 virtual std::string const& name() const = 0;
34 virtual geometry::Point position() const = 0;34 virtual geometry::Point top_left() const = 0;
35 virtual geometry::Size size() const = 0;35 virtual geometry::Size size() const = 0;
36 virtual bool contains(geometry::Point const& point) const = 0;36 virtual bool contains(geometry::Point const& point) const = 0;
3737
3838
=== added directory 'include/server/mir/logging'
=== renamed file 'include/server/mir/logging/glog_logger.h' => 'include/server/mir/logging/glog_logger.h'
=== removed directory 'include/server/mir/lttng'
=== added directory 'include/server/mir/report'
=== added file 'include/server/mir/report/legacy_input_report.h'
--- include/server/mir/report/legacy_input_report.h 1970-01-01 00:00:00 +0000
+++ include/server/mir/report/legacy_input_report.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#ifndef MIR_REPORT_LEGACY_INPUT_REPORT_H_
20#define MIR_REPORT_LEGACY_INPUT_REPORT_H_
21
22#include <memory>
23
24namespace mir
25{
26namespace logging
27{
28class Logger;
29}
30namespace report
31{
32namespace legacy_input
33{
34void initialize(std::shared_ptr<mir::logging::Logger> const& logger);
35}
36}
37}
38
39#endif // MIR_REPORT_LEGACY_INPUT_REPORT_H_
040
=== renamed directory 'include/server/mir/logging' => 'include/server/mir/report/logging'
=== modified file 'include/server/mir/scene/scene_report.h'
--- include/server/mir/scene/scene_report.h 2014-01-13 06:12:33 +0000
+++ include/server/mir/scene/scene_report.h 2014-03-06 14:19:43 +0000
@@ -26,16 +26,15 @@
26{26{
27namespace scene27namespace scene
28{28{
29class BasicSurface;
30
31class SceneReport29class SceneReport
32{30{
33public:31public:
34 virtual void surface_created(BasicSurface* const surface) = 0;32 typedef void* BasicSurfaceId;
35 virtual void surface_added(BasicSurface* const surface) = 0;33 virtual void surface_created(BasicSurfaceId id, std::string const& name) = 0;
34 virtual void surface_added(BasicSurfaceId id, std::string const& name) = 0;
3635
37 virtual void surface_removed(BasicSurface* const surface) = 0;36 virtual void surface_removed(BasicSurfaceId id, std::string const& name) = 0;
38 virtual void surface_deleted(BasicSurface* const surface) = 0;37 virtual void surface_deleted(BasicSurfaceId id, std::string const& name) = 0;
3938
40protected:39protected:
41 SceneReport() = default;40 SceneReport() = default;
@@ -44,17 +43,7 @@
44 SceneReport& operator=(SceneReport const&) = delete;43 SceneReport& operator=(SceneReport const&) = delete;
45};44};
4645
47class NullSceneReport : public SceneReport46}
48{47}
49public:
50 virtual void surface_created(BasicSurface* const /*surface*/) override;
51 virtual void surface_added(BasicSurface* const /*surface*/) override;
52
53 virtual void surface_removed(BasicSurface* const /*surface*/) override;
54 virtual void surface_deleted(BasicSurface* const /*surface*/) override;
55};
56}
57}
58
5948
60#endif /* MIR_SCENE_SCENE_REPORT_H_ */49#endif /* MIR_SCENE_SCENE_REPORT_H_ */
6150
=== added directory 'include/shared/mir/logging'
=== removed directory 'include/shared/mir/logging'
=== renamed file 'include/shared/mir/logging/dumb_console_logger.h' => 'include/shared/mir/logging/dumb_console_logger.h'
=== renamed file 'include/shared/mir/logging/input_timestamp.h' => 'include/shared/mir/logging/input_timestamp.h'
=== renamed file 'include/shared/mir/logging/logger.h' => 'include/shared/mir/logging/logger.h'
=== added directory 'include/shared/mir/report'
=== renamed directory 'include/shared/mir/lttng' => 'include/shared/mir/report/lttng'
=== modified file 'include/shared/mir/report/lttng/mir_tracepoint.h'
--- include/shared/mir/lttng/mir_tracepoint.h 2013-06-03 12:15:44 +0000
+++ include/shared/mir/report/lttng/mir_tracepoint.h 2014-03-06 14:19:43 +0000
@@ -27,7 +27,6 @@
27 *27 *
28 * See: http://sourceware.org/bugzilla/show_bug.cgi?id=1397428 * See: http://sourceware.org/bugzilla/show_bug.cgi?id=13974
29 */29 */
30
31#ifdef __clang__30#ifdef __clang__
32namespace mir_systemtap_bug_1397431namespace mir_systemtap_bug_13974
33{32{
@@ -36,7 +35,7 @@
36#define mir_tracepoint(c, e, ...) ::mir_systemtap_bug_13974::mir_tracepoint_consume_args(0, __VA_ARGS__)35#define mir_tracepoint(c, e, ...) ::mir_systemtap_bug_13974::mir_tracepoint_consume_args(0, __VA_ARGS__)
37#pragma message "Building with clang: Disabling LTTng tracepoints."36#pragma message "Building with clang: Disabling LTTng tracepoints."
38#else37#else
39#define mir_tracepoint(c, e, ...) tracepoint(c, e, __VA_ARGS__)38#define mir_tracepoint(c, ...) tracepoint(c, __VA_ARGS__)
40#endif39#endif
4140
42#endif /* MIR_LTTNG_MIR_TRACEPOINT_H_ */41#endif /* MIR_LTTNG_MIR_TRACEPOINT_H_ */
4342
=== modified file 'include/shared/mir/report/lttng/tracepoint_provider.h'
--- include/shared/mir/lttng/tracepoint_provider.h 2013-06-04 10:47:05 +0000
+++ include/shared/mir/report/lttng/tracepoint_provider.h 2014-03-06 14:19:43 +0000
@@ -16,13 +16,15 @@
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */17 */
1818
19#ifndef MIR_LTTNG_TRACEPOINT_PROVIDER_H_19#ifndef MIR_REPORT_LTTNG_TRACEPOINT_PROVIDER_H_
20#define MIR_LTTNG_TRACEPOINT_PROVIDER_H_20#define MIR_REPORT_LTTNG_TRACEPOINT_PROVIDER_H_
2121
22#include <string>22#include <string>
2323
24namespace mir24namespace mir
25{25{
26namespace report
27{
26namespace lttng28namespace lttng
27{29{
2830
@@ -41,5 +43,6 @@
4143
42}44}
43}45}
46}
4447
45#endif /* MIR_LTTNG_TRACEPOINT_PROVIDER_H_ */48#endif /* MIR_REPORT_LTTNG_TRACEPOINT_PROVIDER_H_ */
4649
=== renamed file 'include/server/mir/shared_library.h' => 'include/shared/mir/shared_library.h'
--- include/server/mir/shared_library.h 2013-06-21 10:07:40 +0000
+++ include/shared/mir/shared_library.h 2014-03-06 14:19:43 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU Lesser General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1717
=== renamed file 'include/test/mir_test/draw/android_graphics.h' => 'include/test/mir_test/draw/graphics_region_factory.h'
--- include/test/mir_test/draw/android_graphics.h 2014-01-13 06:12:33 +0000
+++ include/test/mir_test/draw/graphics_region_factory.h 2014-03-06 14:19:43 +0000
@@ -15,45 +15,36 @@
15 *15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
18#ifndef MIR_TEST_DRAW_ANDROID_GRAPHICS18#ifndef MIR_TEST_DRAW_GRAPHICS_REGION_FACTORY
19#define MIR_TEST_DRAW_ANDROID_GRAPHICS19#define MIR_TEST_DRAW_GRAPHICS_REGION_FACTORY
2020
21#include "mir/graphics/native_buffer.h"
21#include "mir_toolkit/mir_client_library.h"22#include "mir_toolkit/mir_client_library.h"
22#include "mir/compositor/buffer_stream.h"
23#include "mir/geometry/size.h"
24
25#include <hardware/gralloc.h>
26#include <memory>23#include <memory>
2724
28namespace mir25namespace mir
29{26{
30namespace compositor
31{
32 class BufferIPCPackage;
33}
34namespace test27namespace test
35{28{
36namespace draw29namespace draw
37{30{
3831
39class TestGrallocMapper32class GraphicsRegionFactory
40{33{
41public:34public:
42 TestGrallocMapper();35 virtual ~GraphicsRegionFactory() {}
43 TestGrallocMapper(const hw_module_t *hw_module, alloc_device_t* alloc_dev);36 virtual std::shared_ptr<MirGraphicsRegion> graphic_region_from_handle(
44 ~TestGrallocMapper();37 graphics::NativeBuffer const& native_buffer) = 0;
45 std::shared_ptr<MirGraphicsRegion> graphic_region_from_handle(ANativeWindowBuffer* package);38
4639protected:
47private:40 GraphicsRegionFactory() = default;
48 TestGrallocMapper(TestGrallocMapper const&) = delete;41 GraphicsRegionFactory(GraphicsRegionFactory const&) = delete;
49 TestGrallocMapper& operator=(TestGrallocMapper const&) = delete;42 GraphicsRegionFactory& operator=(GraphicsRegionFactory const&) = delete;
50
51 const bool gralloc_ownership;
52 gralloc_module_t* module;
53 alloc_device_t* alloc_dev;
54};43};
5544
56}45std::shared_ptr<GraphicsRegionFactory> create_graphics_region_factory();
57}46
58}47}
59#endif /* MIR_TEST_DRAW_ANDROID_GRAPHICS */48}
49}
50#endif /* MIR_TEST_DRAW_GRAPHICS_REGION_FACTORY */
6051
=== modified file 'include/test/mir_test/draw/patterns.h'
--- include/test/mir_test/draw/patterns.h 2013-10-14 20:35:46 +0000
+++ include/test/mir_test/draw/patterns.h 2014-03-06 14:19:43 +0000
@@ -72,7 +72,7 @@
72private:72private:
73 uint32_t color_pattern [Rows][Cols];73 uint32_t color_pattern [Rows][Cols];
74};74};
75#include "mir_test/draw/draw_pattern_checkered-inl.h"75#include "draw_pattern_checkered-inl.h"
7676
77}77}
78}78}
7979
=== modified file 'include/test/mir_test_doubles/mock_display_device.h'
--- include/test/mir_test_doubles/mock_display_device.h 2014-01-23 17:26:51 +0000
+++ include/test/mir_test_doubles/mock_display_device.h 2014-03-06 14:19:43 +0000
@@ -38,6 +38,7 @@
38 MOCK_METHOD1(prepare_gl_and_overlays, void(std::list<std::shared_ptr<graphics::Renderable>> const&));38 MOCK_METHOD1(prepare_gl_and_overlays, void(std::list<std::shared_ptr<graphics::Renderable>> const&));
39 MOCK_METHOD2(gpu_render, void(EGLDisplay, EGLSurface));39 MOCK_METHOD2(gpu_render, void(EGLDisplay, EGLSurface));
40 MOCK_METHOD1(post, void(graphics::Buffer const&));40 MOCK_METHOD1(post, void(graphics::Buffer const&));
41 MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation));
41};42};
42}43}
43}44}
4445
=== modified file 'include/test/mir_test_doubles/mock_drm.h'
--- include/test/mir_test_doubles/mock_drm.h 2013-08-28 03:41:48 +0000
+++ include/test/mir_test_doubles/mock_drm.h 2014-03-06 14:19:43 +0000
@@ -88,6 +88,7 @@
88 MockDRM();88 MockDRM();
89 ~MockDRM() noexcept;89 ~MockDRM() noexcept;
9090
91 MOCK_METHOD3(open, int(char const* path, int flags, mode_t mode));
91 MOCK_METHOD2(drmOpen, int(const char *name, const char *busid));92 MOCK_METHOD2(drmOpen, int(const char *name, const char *busid));
92 MOCK_METHOD1(drmClose, int(int fd));93 MOCK_METHOD1(drmClose, int(int fd));
93 MOCK_METHOD3(drmIoctl, int(int fd, unsigned long request, void *arg));94 MOCK_METHOD3(drmIoctl, int(int fd, unsigned long request, void *arg));
9495
=== modified file 'include/test/mir_test_doubles/mock_gl.h'
--- include/test/mir_test_doubles/mock_gl.h 2014-01-13 06:12:33 +0000
+++ include/test/mir_test_doubles/mock_gl.h 2014-03-06 14:19:43 +0000
@@ -52,6 +52,7 @@
52 MOCK_METHOD1(glCreateShader, GLuint(GLenum));52 MOCK_METHOD1(glCreateShader, GLuint(GLenum));
53 MOCK_METHOD2(glDeleteBuffers, void(GLsizei, const GLuint *));53 MOCK_METHOD2(glDeleteBuffers, void(GLsizei, const GLuint *));
54 MOCK_METHOD2(glDeleteFramebuffers, void(GLsizei, const GLuint *));54 MOCK_METHOD2(glDeleteFramebuffers, void(GLsizei, const GLuint *));
55 MOCK_METHOD2(glDeleteRenderbuffers, void(GLsizei, const GLuint *));
55 MOCK_METHOD1(glDeleteProgram, void(GLuint));56 MOCK_METHOD1(glDeleteProgram, void(GLuint));
56 MOCK_METHOD1(glDeleteShader, void(GLuint));57 MOCK_METHOD1(glDeleteShader, void(GLuint));
57 MOCK_METHOD2(glDeleteTextures, void(GLsizei, const GLuint *));58 MOCK_METHOD2(glDeleteTextures, void(GLsizei, const GLuint *));
@@ -100,6 +101,7 @@
100 void(GLuint, GLint, GLenum, GLboolean, GLsizei,101 void(GLuint, GLint, GLenum, GLboolean, GLsizei,
101 const GLvoid *));102 const GLvoid *));
102 MOCK_METHOD4(glViewport, void(GLint, GLint, GLsizei, GLsizei));103 MOCK_METHOD4(glViewport, void(GLint, GLint, GLsizei, GLsizei));
104 MOCK_METHOD0(glFinish, void());
103};105};
104106
105}107}
106108
=== modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h'
--- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-01-29 18:54:06 +0000
+++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-03-06 14:19:43 +0000
@@ -44,6 +44,8 @@
44 external_set = false;44 external_set = false;
45 virtual_prepare = false;45 virtual_prepare = false;
46 virtual_set = false;46 virtual_set = false;
47 fb_fence = -1;
48 retire_fence = -1;
4749
48 common.version = HWC_DEVICE_API_VERSION_1_1;50 common.version = HWC_DEVICE_API_VERSION_1_1;
4951
5052
=== modified file 'include/test/mir_test_doubles/mock_input_surface.h'
--- include/test/mir_test_doubles/mock_input_surface.h 2014-01-13 06:12:33 +0000
+++ include/test/mir_test_doubles/mock_input_surface.h 2014-03-06 14:19:43 +0000
@@ -35,7 +35,7 @@
35 MockInputSurface()35 MockInputSurface()
36 {36 {
37 using namespace testing;37 using namespace testing;
38 ON_CALL(*this, position())38 ON_CALL(*this, top_left())
39 .WillByDefault(39 .WillByDefault(
40 Return(geometry::Point{}));40 Return(geometry::Point{}));
41 ON_CALL(*this, size())41 ON_CALL(*this, size())
@@ -46,7 +46,7 @@
46 .WillByDefault(testing::ReturnRef(n));46 .WillByDefault(testing::ReturnRef(n));
47 }47 }
48 ~MockInputSurface() noexcept {}48 ~MockInputSurface() noexcept {}
49 MOCK_CONST_METHOD0(position, geometry::Point());49 MOCK_CONST_METHOD0(top_left, geometry::Point());
50 MOCK_CONST_METHOD0(size, geometry::Size());50 MOCK_CONST_METHOD0(size, geometry::Size());
51 MOCK_CONST_METHOD0(name, std::string const&());51 MOCK_CONST_METHOD0(name, std::string const&());
52 MOCK_CONST_METHOD1(contains, bool(geometry::Point const&));52 MOCK_CONST_METHOD1(contains, bool(geometry::Point const&));
5353
=== renamed file 'include/test/mir_test_doubles/mock_surface_renderer.h' => 'include/test/mir_test_doubles/mock_renderer.h'
--- include/test/mir_test_doubles/mock_surface_renderer.h 2014-01-14 07:02:27 +0000
+++ include/test/mir_test_doubles/mock_renderer.h 2014-03-06 14:19:43 +0000
@@ -15,8 +15,8 @@
15 *15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
18#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_18#ifndef MIR_TEST_DOUBLES_MOCK_RENDERER_H_
19#define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_19#define MIR_TEST_DOUBLES_MOCK_RENDERER_H_
2020
21#include "src/server/compositor/renderer.h"21#include "src/server/compositor/renderer.h"
2222
@@ -29,17 +29,19 @@
29namespace doubles29namespace doubles
30{30{
3131
32struct MockSurfaceRenderer : public compositor::Renderer32struct MockRenderer : public compositor::Renderer
33{33{
34 MOCK_CONST_METHOD1(begin, void(float));34 MOCK_METHOD1(set_viewport, void(geometry::Rectangle const&));
35 MOCK_METHOD1(set_rotation, void(float));
36 MOCK_CONST_METHOD0(begin, void());
35 MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&));37 MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&));
36 MOCK_CONST_METHOD0(end, void());38 MOCK_CONST_METHOD0(end, void());
37 MOCK_METHOD0(suspend, void());39 MOCK_METHOD0(suspend, void());
3840
39 ~MockSurfaceRenderer() noexcept {}41 ~MockRenderer() noexcept {}
40};42};
4143
42}44}
43}45}
44}46}
45#endif /* MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ */47#endif /* MIR_TEST_DOUBLES_MOCK_RENDERER_H_ */
4648
=== modified file 'include/test/mir_test_doubles/stub_display_builder.h'
--- include/test/mir_test_doubles/stub_display_builder.h 2014-01-13 06:12:33 +0000
+++ include/test/mir_test_doubles/stub_display_builder.h 2014-03-06 14:19:43 +0000
@@ -20,8 +20,7 @@
20#define MIR_TEST_DOUBLES_STUB_DISPLAY_BUILDER_H_20#define MIR_TEST_DOUBLES_STUB_DISPLAY_BUILDER_H_
2121
22#include "src/platform/graphics/android/display_builder.h"22#include "src/platform/graphics/android/display_builder.h"
23#include "stub_display_buffer.h"23#include "src/platform/graphics/android/configurable_display_buffer.h"
24#include "stub_display_device.h"
25#include <gmock/gmock.h>24#include <gmock/gmock.h>
2625
27namespace mir26namespace mir
@@ -30,25 +29,47 @@
30{29{
31namespace doubles30namespace doubles
32{31{
32
33struct StubConfigurableDisplayBuffer : public graphics::android::ConfigurableDisplayBuffer
34{
35 StubConfigurableDisplayBuffer(geometry::Rectangle rect)
36 : rect(rect)
37 {
38 }
39
40 geometry::Rectangle view_area() const { return rect; }
41 void make_current() {}
42 void release_current() {}
43 void post_update() {}
44 bool can_bypass() const override { return false; }
45 void render_and_post_update(
46 std::list<std::shared_ptr<graphics::Renderable>> const&,
47 std::function<void(graphics::Renderable const&)> const&) {}
48 MirOrientation orientation() const override { return mir_orientation_normal; }
49 void configure(graphics::DisplayConfigurationOutput const&) {}
50 graphics::DisplayConfigurationOutput configuration() const
51 {
52 return graphics::DisplayConfigurationOutput{
53 graphics::DisplayConfigurationOutputId{1},
54 graphics::DisplayConfigurationCardId{0},
55 graphics::DisplayConfigurationOutputType::vga,
56 {}, {}, 0, {}, false, false, {}, 0, mir_pixel_format_abgr_8888,
57 mir_power_mode_off,
58 mir_orientation_normal};
59 }
60private:
61 geometry::Rectangle rect;
62};
63
33struct StubDisplayBuilder : public graphics::android::DisplayBuilder64struct StubDisplayBuilder : public graphics::android::DisplayBuilder
34{65{
35 StubDisplayBuilder(std::shared_ptr<graphics::android::DisplayDevice> const& stub_dev, geometry::Size sz)66 StubDisplayBuilder(geometry::Size sz)
36 : stub_dev(stub_dev), sz(sz)67 : sz(sz)
37 {68 {
38 }69 }
3970
40 StubDisplayBuilder()71 StubDisplayBuilder()
41 : StubDisplayBuilder(std::make_shared<StubDisplayDevice>(), geometry::Size{0,0})72 : StubDisplayBuilder(geometry::Size{0,0})
42 {
43 }
44
45 StubDisplayBuilder(geometry::Size sz)
46 : StubDisplayBuilder(std::make_shared<StubDisplayDevice>(), sz)
47 {
48 }
49
50 StubDisplayBuilder(std::shared_ptr<graphics::android::DisplayDevice> const& stub_dev)
51 : stub_dev(stub_dev), sz(geometry::Size{0,0})
52 {73 {
53 }74 }
5475
@@ -57,20 +78,13 @@
57 return mir_pixel_format_abgr_8888;78 return mir_pixel_format_abgr_8888;
58 }79 }
5980
60 std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(81 std::unique_ptr<graphics::android::ConfigurableDisplayBuffer> create_display_buffer(
61 std::shared_ptr<graphics::android::DisplayDevice> const&,
62 graphics::android::GLContext const&)82 graphics::android::GLContext const&)
63 {83 {
64 return std::unique_ptr<graphics::DisplayBuffer>(84 return std::unique_ptr<graphics::android::ConfigurableDisplayBuffer>(
65 new StubDisplayBuffer(geometry::Rectangle{{0,0},sz}));85 new StubConfigurableDisplayBuffer(geometry::Rectangle{{0,0},sz}));
66 }86 }
6787
68 std::shared_ptr<graphics::android::DisplayDevice> create_display_device()
69 {
70 return stub_dev;
71 }
72
73 std::shared_ptr<graphics::android::DisplayDevice> const stub_dev;
74 geometry::Size sz;88 geometry::Size sz;
75};89};
76}90}
7791
=== modified file 'include/test/mir_test_doubles/stub_display_configuration.h'
--- include/test/mir_test_doubles/stub_display_configuration.h 2014-01-31 07:35:54 +0000
+++ include/test/mir_test_doubles/stub_display_configuration.h 2014-03-06 14:19:43 +0000
@@ -93,8 +93,8 @@
93 graphics::DisplayConfigurationOutputType::vga,93 graphics::DisplayConfigurationOutputType::vga,
94 pfs, modes, i,94 pfs, modes, i,
95 physical_size,95 physical_size,
96 ((i % 2) == 0),96 ((i % 2) == 0), // even numbers have connected==true
97 ((i % 2) == 1),97 ((i % 4) == 0), // only every second even has used==true
98 top_left,98 top_left,
99 mode_index, pfs[0],99 mode_index, pfs[0],
100 mir_power_mode_off,100 mir_power_mode_off,
101101
=== added file 'include/test/mir_test_doubles/stub_renderer.h'
--- include/test/mir_test_doubles/stub_renderer.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_doubles/stub_renderer.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,65 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_STUB_RENDERER_H_
20#define MIR_TEST_DOUBLES_STUB_RENDERER_H_
21
22#include "src/server/compositor/renderer.h"
23
24namespace mir
25{
26namespace test
27{
28namespace doubles
29{
30
31class StubRenderer : public compositor::Renderer
32{
33public:
34 void set_viewport(geometry::Rectangle const&) override
35 {
36 }
37
38 void set_rotation(float) override
39 {
40 }
41
42 void begin() const override
43 {
44 }
45
46 void render(compositor::CompositingCriteria const&,
47 graphics::Buffer&) const override
48 {
49 }
50
51 void end() const override
52 {
53 }
54
55 void suspend() override
56 {
57 }
58};
59
60
61} // namespace doubles
62} // namespace test
63} // namespace mir
64
65#endif // MIR_TEST_DOUBLES_STUB_RENDERER_H_
066
=== modified file 'include/test/mir_test_doubles/stub_surface_builder.h'
--- include/test/mir_test_doubles/stub_surface_builder.h 2014-01-13 06:12:33 +0000
+++ include/test/mir_test_doubles/stub_surface_builder.h 2014-03-06 14:19:43 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -22,8 +22,7 @@
2222
23#include "src/server/scene/surface_builder.h"23#include "src/server/scene/surface_builder.h"
24#include "src/server/scene/basic_surface.h"24#include "src/server/scene/basic_surface.h"
25#include "src/server/scene/surface_data.h"25#include "src/server/report/null_report_factory.h"
26#include "mir/scene/scene_report.h"
27#include "mir/shell/surface_creation_parameters.h"26#include "mir/shell/surface_creation_parameters.h"
2827
29#include "mir_test_doubles/stub_buffer_stream.h"28#include "mir_test_doubles/stub_buffer_stream.h"
@@ -40,11 +39,13 @@
40public:39public:
41 StubSurfaceBuilder() :40 StubSurfaceBuilder() :
42 dummy_surface(std::make_shared<scene::BasicSurface>(41 dummy_surface(std::make_shared<scene::BasicSurface>(
43 std::make_shared<scene::SurfaceData>( 42 std::string("stub"),
44 std::string("stub"), geometry::Rectangle{{},{}}, [](){}, false),43 geometry::Rectangle{{},{}},
44 [](){},
45 false,
45 std::make_shared<StubBufferStream>(),46 std::make_shared<StubBufferStream>(),
46 std::shared_ptr<input::InputChannel>(),47 std::shared_ptr<input::InputChannel>(),
47 std::make_shared<scene::NullSceneReport>()))48 mir::report::null_scene_report()))
48 {49 {
49 }50 }
5051
5152
=== modified file 'include/test/mir_test_framework/udev_environment.h'
--- include/test/mir_test_framework/udev_environment.h 2014-01-13 06:12:33 +0000
+++ include/test/mir_test_framework/udev_environment.h 2014-03-06 14:19:43 +0000
@@ -35,8 +35,6 @@
35 UdevEnvironment();35 UdevEnvironment();
36 ~UdevEnvironment() noexcept;36 ~UdevEnvironment() noexcept;
3737
38 void add_standard_drm_devices();
39
40 std::string add_device(char const* subsystem,38 std::string add_device(char const* subsystem,
41 char const* name,39 char const* name,
42 char const* parent,40 char const* parent,
@@ -45,6 +43,18 @@
45 void remove_device(std::string const& device_path);43 void remove_device(std::string const& device_path);
46 void emit_device_changed(std::string const& device_path);44 void emit_device_changed(std::string const& device_path);
4745
46 /**
47 * Add a device from the set of standard device traces
48 *
49 * Looks for a <tt>name</tt>.umockdev file, and adds a UMockDev device
50 * from that description.
51 *
52 * If <tt>name</tt>.ioctl exists, it loads that ioctl script for the device
53 *
54 * @param name The unadorned filename of the device traces to add.
55 */
56 void add_standard_device(std::string const& name);
57
48 UMockdevTestbed *testbed;58 UMockdevTestbed *testbed;
49};59};
5060
5161
=== modified file 'src/client/CMakeLists.txt'
--- src/client/CMakeLists.txt 2014-02-06 22:37:53 +0000
+++ src/client/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -18,6 +18,14 @@
18add_subdirectory(rpc/)18add_subdirectory(rpc/)
19add_subdirectory(lttng/)19add_subdirectory(lttng/)
2020
21if(MIR_BUILD_PLATFORM_ANDROID)
22add_subdirectory(android/)
23endif()
24
25if(MIR_BUILD_PLATFORM_MESA)
26add_subdirectory(mesa/)
27endif()
28
21set(29set(
22 CLIENT_SOURCES30 CLIENT_SOURCES
2331
@@ -38,34 +46,6 @@
38 mir_screencast_api.cpp46 mir_screencast_api.cpp
39)47)
4048
41if( MIR_PLATFORM STREQUAL "android")
42include_directories(SYSTEM ${LIBHARDWARE_INCLUDE_DIRS})
43set(
44 CLIENT_SOURCES
45
46 android/android_client_buffer.cpp
47 android/android_client_buffer_factory.cpp
48 android/android_registrar.cpp
49 android/android_client_platform.cpp
50 android/client_surface_interpreter.cpp
51 android/android_native_display_container.cpp
52 ${CLIENT_SOURCES}
53)
54endif()
55
56if( MIR_PLATFORM STREQUAL "mesa")
57set(
58 CLIENT_SOURCES
59
60 mesa/client_platform.cpp
61 mesa/client_buffer_factory.cpp
62 mesa/client_buffer.cpp
63 mesa/mesa_native_display_container.cpp
64 mesa/native_surface.cpp
65 ${CLIENT_SOURCES}
66)
67endif()
68
69add_library(49add_library(
70 mirclient SHARED50 mirclient SHARED
7151
@@ -81,14 +61,10 @@
81 SOVERSION ${MIRCLIENT_ABI}61 SOVERSION ${MIRCLIENT_ABI}
82)62)
8363
84# Ensure mirclient_compat_links exist before any dependents of mirclient
85add_dependencies(mirclient mirclient_compat_links)
86
87set(64set(
88 MIR_CLIENT_LIBRARIES65 MIR_CLIENT_LIBRARIES
89 ${Boost_LIBRARIES}66 ${Boost_LIBRARIES}
90 ${CMAKE_THREAD_LIBS_INIT}67 ${CMAKE_THREAD_LIBS_INIT}
91 ${LIBHARDWARE_LIBRARIES}
92 ${PROTOBUF_LIBRARIES}68 ${PROTOBUF_LIBRARIES}
93 ${XKBCOMMON_LIBRARIES}69 ${XKBCOMMON_LIBRARIES}
9470
@@ -96,10 +72,10 @@
96 mirsharedinput72 mirsharedinput
97 mirsharedlogging73 mirsharedlogging
98 mirsharedenv74 mirsharedenv
75 mirsharedsharedlibrary
99 mirclientrpc76 mirclientrpc
100 mirclientlttngstatic77 mirclientlttngstatic
10178
102 ${DRM_LIBRARIES}
103 ${MIR_COMMON_PLATFORM_LIBRARIES}79 ${MIR_COMMON_PLATFORM_LIBRARIES}
104 80
105 3rd_party81 3rd_party
10682
=== added file 'src/client/android/CMakeLists.txt'
--- src/client/android/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/client/android/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -0,0 +1,38 @@
1include_directories(SYSTEM ${LIBHARDWARE_INCLUDE_DIRS})
2add_definitions(-DANDROID)
3
4add_library(
5 mirclientplatformandroid SHARED
6
7 android_client_buffer.cpp
8 android_client_buffer_factory.cpp
9 android_registrar.cpp
10 android_client_platform.cpp
11 client_platform_factory.cpp
12 client_surface_interpreter.cpp
13 android_native_display_container.cpp
14)
15
16set_target_properties(
17 mirclientplatformandroid PROPERTIES
18 OUTPUT_NAME mirclientplatform
19 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
20)
21
22target_link_libraries(
23 mirclientplatformandroid
24 mirclient
25
26 ${LIBHARDWARE_LIBRARIES}
27)
28
29if (MIR_TEST_PLATFORM STREQUAL "android")
30 add_custom_command(TARGET mirclientplatformandroid
31 POST_BUILD
32 COMMAND ${CMAKE_COMMAND} -E remove libmirclientplatform.so
33 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirclientplatformandroid> libmirclientplatform.so
34 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
35 )
36endif()
37
38install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/android)
039
=== modified file 'src/client/android/android_client_platform.cpp'
--- src/client/android/android_client_platform.cpp 2014-01-13 06:12:33 +0000
+++ src/client/android/android_client_platform.cpp 2014-03-06 14:19:43 +0000
@@ -22,7 +22,6 @@
22#include "android_client_buffer_factory.h"22#include "android_client_buffer_factory.h"
23#include "client_surface_interpreter.h"23#include "client_surface_interpreter.h"
24#include "../mir_connection.h"24#include "../mir_connection.h"
25#include "../native_client_platform_factory.h"
2625
27#include <EGL/egl.h>26#include <EGL/egl.h>
2827
@@ -44,12 +43,6 @@
4443
45}44}
4645
47std::shared_ptr<mcl::ClientPlatform>
48mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* /*context*/)
49{
50 return std::make_shared<mcla::AndroidClientPlatform>();
51}
52
53std::shared_ptr<mcl::ClientBufferFactory> mcla::AndroidClientPlatform::create_buffer_factory()46std::shared_ptr<mcl::ClientBufferFactory> mcla::AndroidClientPlatform::create_buffer_factory()
54{47{
55 const hw_module_t *hw_module;48 const hw_module_t *hw_module;
5649
=== added file 'src/client/android/client_platform_factory.cpp'
--- src/client/android/client_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ src/client/android/client_platform_factory.cpp 2014-03-06 14:19:43 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#include "client_platform_factory.h"
20#include "android_client_platform.h"
21
22namespace mcl = mir::client;
23namespace mcla = mcl::android;
24
25std::shared_ptr<mcl::ClientPlatform>
26mcla::ClientPlatformFactory::create_client_platform(mcl::ClientContext* /*context*/)
27{
28 return std::make_shared<mcla::AndroidClientPlatform>();
29}
30
31extern "C" std::shared_ptr<mcl::ClientPlatformFactory> mcl::create_client_platform_factory()
32{
33 return std::make_shared<mcla::ClientPlatformFactory>();
34}
035
=== added file 'src/client/android/client_platform_factory.h'
--- src/client/android/client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ src/client/android/client_platform_factory.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,41 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_CLIENT_ANDROID_CLIENT_PLATFORM_FACTORY_H_
20#define MIR_CLIENT_ANDROID_CLIENT_PLATFORM_FACTORY_H_
21
22#include "../client_platform_factory.h"
23
24namespace mir
25{
26namespace client
27{
28namespace android
29{
30
31class ClientPlatformFactory : public client::ClientPlatformFactory
32{
33public:
34 std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) override;
35};
36
37}
38}
39}
40
41#endif /* MIR_CLIENT_ANDROID_CLIENT_PLATFORM_FACTORY_H_ */
042
=== modified file 'src/client/client_platform_factory.h'
--- src/client/client_platform_factory.h 2013-04-24 05:22:20 +0000
+++ src/client/client_platform_factory.h 2014-03-06 14:19:43 +0000
@@ -18,6 +18,8 @@
18#ifndef MIR_CLIENT_CLIENT_PLATFORM_FACTORY_H_18#ifndef MIR_CLIENT_CLIENT_PLATFORM_FACTORY_H_
19#define MIR_CLIENT_CLIENT_PLATFORM_FACTORY_H_19#define MIR_CLIENT_CLIENT_PLATFORM_FACTORY_H_
2020
21#include <memory>
22
21namespace mir23namespace mir
22{24{
23namespace client25namespace client
@@ -29,16 +31,19 @@
29class ClientPlatformFactory31class ClientPlatformFactory
30{32{
31public:33public:
32 virtual ~ClientPlatformFactory() {}34 virtual ~ClientPlatformFactory() = default;
3335
34 virtual std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) = 0;36 virtual std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) = 0;
3537
36protected:38protected:
37 ClientPlatformFactory() = default;39 ClientPlatformFactory() = default;
38 ClientPlatformFactory(const ClientPlatformFactory& p) = delete;40 ClientPlatformFactory(ClientPlatformFactory const& p) = delete;
39 ClientPlatformFactory& operator=(const ClientPlatformFactory& p) = delete;41 ClientPlatformFactory& operator=(ClientPlatformFactory const& p) = delete;
40};42};
4143
44extern "C" typedef std::shared_ptr<ClientPlatformFactory>(*CreateClientPlatformFactory)();
45extern "C" std::shared_ptr<ClientPlatformFactory> create_client_platform_factory();
46
42}47}
43}48}
4449
4550
=== modified file 'src/client/default_connection_configuration.cpp'
--- src/client/default_connection_configuration.cpp 2014-01-14 04:10:15 +0000
+++ src/client/default_connection_configuration.cpp 2014-03-06 14:19:43 +0000
@@ -22,14 +22,16 @@
22#include "rpc/make_rpc_channel.h"22#include "rpc/make_rpc_channel.h"
23#include "rpc/null_rpc_report.h"23#include "rpc/null_rpc_report.h"
24#include "mir/logging/dumb_console_logger.h"24#include "mir/logging/dumb_console_logger.h"
25#include "native_client_platform_factory.h"
26#include "mir/input/input_platform.h"25#include "mir/input/input_platform.h"
27#include "mir/input/null_input_receiver_report.h"26#include "mir/input/null_input_receiver_report.h"
28#include "logging/rpc_report.h"27#include "logging/rpc_report.h"
29#include "logging/input_receiver_report.h"28#include "logging/input_receiver_report.h"
30#include "lttng/rpc_report.h"29#include "lttng/rpc_report.h"
30#include "lttng/input_receiver_report.h"
31#include "connection_surface_map.h"31#include "connection_surface_map.h"
32#include "lifecycle_control.h"32#include "lifecycle_control.h"
33#include "mir/shared_library.h"
34#include "client_platform_factory.h"
3335
34namespace mcl = mir::client;36namespace mcl = mir::client;
3537
@@ -38,6 +40,23 @@
38std::string const off_opt_val{"off"};40std::string const off_opt_val{"off"};
39std::string const log_opt_val{"log"};41std::string const log_opt_val{"log"};
40std::string const lttng_opt_val{"lttng"};42std::string const lttng_opt_val{"lttng"};
43std::string const default_platform_lib{"libmirclientplatform.so"};
44
45mir::SharedLibrary const* load_library(std::string const& libname)
46{
47 // There's no point in loading twice, and it isn't safe to unload...
48 static std::map<std::string, std::shared_ptr<mir::SharedLibrary>> libraries_cache;
49
50 if (auto& ptr = libraries_cache[libname])
51 {
52 return ptr.get();
53 }
54 else
55 {
56 ptr = std::make_shared<mir::SharedLibrary>(libname);
57 return ptr.get();
58 }
59}
41}60}
4261
43mcl::DefaultConnectionConfiguration::DefaultConnectionConfiguration(62mcl::DefaultConnectionConfiguration::DefaultConnectionConfiguration(
@@ -82,7 +101,15 @@
82 return client_platform_factory(101 return client_platform_factory(
83 []102 []
84 {103 {
85 return std::make_shared<mcl::NativeClientPlatformFactory>();104 auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB");
105 std::string const val{val_raw ? val_raw : default_platform_lib};
106 auto const platform_lib = load_library(val);
107
108 auto const create_client_platform_factory =
109 platform_lib->load_function<mcl::CreateClientPlatformFactory>(
110 "create_client_platform_factory");
111
112 return create_client_platform_factory();
86 });113 });
87}114}
88115
@@ -131,6 +158,8 @@
131158
132 if (val == log_opt_val)159 if (val == log_opt_val)
133 return std::make_shared<mcl::logging::InputReceiverReport>(the_logger());160 return std::make_shared<mcl::logging::InputReceiverReport>(the_logger());
161 else if (val == lttng_opt_val)
162 return std::make_shared<mcl::lttng::InputReceiverReport>();
134 else163 else
135 return std::make_shared<mir::input::receiver::NullInputReceiverReport>();164 return std::make_shared<mir::input::receiver::NullInputReceiverReport>();
136 });165 });
137166
=== modified file 'src/client/lttng/CMakeLists.txt'
--- src/client/lttng/CMakeLists.txt 2014-01-13 06:12:33 +0000
+++ src/client/lttng/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -5,13 +5,10 @@
55
6 client_tracepoint_provider.cpp6 client_tracepoint_provider.cpp
7 rpc_report.cpp7 rpc_report.cpp
8)8 input_receiver_report.cpp
99)
10add_library(10
11 mirclientlttng SHARED11add_library(mirclientlttng SHARED tracepoints.c)
12
13 rpc_report_tp.c
14)
1512
16# Don't treat missing-field-initializers as an error, since13# Don't treat missing-field-initializers as an error, since
17# the LTTng macros contain code that triggers this (but it's14# the LTTng macros contain code that triggers this (but it's
1815
=== modified file 'src/client/lttng/client_tracepoint_provider.h'
--- src/client/lttng/client_tracepoint_provider.h 2013-06-03 12:15:45 +0000
+++ src/client/lttng/client_tracepoint_provider.h 2014-03-06 14:19:43 +0000
@@ -19,7 +19,7 @@
19#ifndef MIR_CLIENT_LTTNG_CLIENT_TRACEPOINT_PROVIDER_H_19#ifndef MIR_CLIENT_LTTNG_CLIENT_TRACEPOINT_PROVIDER_H_
20#define MIR_CLIENT_LTTNG_CLIENT_TRACEPOINT_PROVIDER_H_20#define MIR_CLIENT_LTTNG_CLIENT_TRACEPOINT_PROVIDER_H_
2121
22#include "mir/lttng/tracepoint_provider.h"22#include "mir/report/lttng/tracepoint_provider.h"
2323
24namespace mir24namespace mir
25{25{
@@ -28,7 +28,7 @@
28namespace lttng28namespace lttng
29{29{
3030
31class ClientTracepointProvider : public mir::lttng::TracepointProvider31class ClientTracepointProvider : public mir::report::lttng::TracepointProvider
32{32{
33public:33public:
34 ClientTracepointProvider();34 ClientTracepointProvider();
3535
=== added file 'src/client/lttng/input_receiver_report.cpp'
--- src/client/lttng/input_receiver_report.cpp 1970-01-01 00:00:00 +0000
+++ src/client/lttng/input_receiver_report.cpp 2014-03-06 14:19:43 +0000
@@ -0,0 +1,65 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#include "input_receiver_report.h"
20#include "mir/report/lttng/mir_tracepoint.h"
21
22#include <stdexcept>
23#include <boost/throw_exception.hpp>
24
25#define TRACEPOINT_DEFINE
26#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
27#include "input_receiver_report_tp.h"
28
29void mir::client::lttng::InputReceiverReport::received_event(MirEvent const& event)
30{
31 switch (event.type)
32 {
33 case mir_event_type_key:
34 report(event.key);
35 break;
36 case mir_event_type_motion:
37 report(event.motion);
38 break;
39 default:
40 BOOST_THROW_EXCEPTION(std::runtime_error("Unexpected event type"));
41 }
42}
43
44void mir::client::lttng::InputReceiverReport::report(MirKeyEvent const& event) const
45{
46 mir_tracepoint(mir_client_input_receiver, key_event, event.device_id, event.source_id,
47 static_cast<int>(event.action), static_cast<int>(event.flags), event.modifiers, event.key_code,
48 event.scan_code, event.down_time, event.event_time);
49}
50
51void mir::client::lttng::InputReceiverReport::report(MirMotionEvent const& event) const
52{
53 mir_tracepoint(mir_client_input_receiver, motion_event, event.device_id, event.source_id, event.action,
54 static_cast<int>(event.flags), event.modifiers, event.edge_flags,
55 static_cast<int>(event.button_state), event.down_time, event.event_time);
56 for (unsigned int i = 0; i < event.pointer_count; i++)
57 {
58 mir_tracepoint(mir_client_input_receiver, motion_event_coordinate,
59 event.pointer_coordinates[i].id, event.pointer_coordinates[i].x, event.pointer_coordinates[i].y,
60 event.pointer_coordinates[i].touch_major, event.pointer_coordinates[i].touch_minor,
61 event.pointer_coordinates[i].size, event.pointer_coordinates[i].pressure,
62 event.pointer_coordinates[i].orientation);
63 }
64}
65
066
=== added file 'src/client/lttng/input_receiver_report.h'
--- src/client/lttng/input_receiver_report.h 1970-01-01 00:00:00 +0000
+++ src/client/lttng/input_receiver_report.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#ifndef MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_H_
20#define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_H_
21
22#include "mir/input/input_receiver_report.h"
23#include "client_tracepoint_provider.h"
24
25namespace mir
26{
27namespace client
28{
29namespace lttng
30{
31
32class InputReceiverReport : public input::receiver::InputReceiverReport
33{
34public:
35 void received_event(MirEvent const& event) override;
36private:
37 void report(MirKeyEvent const& event) const;
38 void report(MirMotionEvent const& event) const;
39 ClientTracepointProvider tp_provider;
40};
41
42}
43}
44}
45
46#endif /* MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_H_ */
047
=== added file 'src/client/lttng/input_receiver_report_tp.h'
--- src/client/lttng/input_receiver_report_tp.h 1970-01-01 00:00:00 +0000
+++ src/client/lttng/input_receiver_report_tp.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,96 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#undef TRACEPOINT_PROVIDER
20#define TRACEPOINT_PROVIDER mir_client_input_receiver
21
22#undef TRACEPOINT_INCLUDE
23#define TRACEPOINT_INCLUDE "./input_receiver_report_tp.h"
24
25#if !defined(MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ)
26#define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_
27
28#include <lttng/tracepoint.h>
29
30#ifdef __clang__
31/*
32 * TRACEPOINT_EVENT defines functions; since we disable tracepoints under clang
33 * these functions are unused and so generate fatal warnings.
34 * (see mir_tracepoint.h and http://sourceware.org/bugzilla/show_bug.cgi?id=13974)
35 */
36#pragma clang diagnostic push
37#pragma clang diagnostic warning "-Wunused-function"
38#endif
39
40TRACEPOINT_EVENT(
41 mir_client_input_receiver,
42 key_event,
43 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),
44 TP_FIELDS(
45 ctf_integer(int32_t, device_id, device_id)
46 ctf_integer(int32_t, source_id, source_id)
47 ctf_integer(int, action, action)
48 ctf_integer(int, flags, flags)
49 ctf_integer(unsigned int, modifiers, modifiers)
50 ctf_integer(int32_t, key_code, key_code)
51 ctf_integer(int32_t, scan_code, scan_code)
52 ctf_integer(int64_t, down_time, down_time)
53 ctf_integer(int64_t, event_time, event_time)
54 )
55)
56
57TRACEPOINT_EVENT(
58 mir_client_input_receiver,
59 motion_event,
60 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),
61 TP_FIELDS(
62 ctf_integer(int32_t, device_id, device_id)
63 ctf_integer(int32_t, source_id, source_id)
64 ctf_integer(int, action, action)
65 ctf_integer(int, flags, flags)
66 ctf_integer(unsigned int, modifiers, modifiers)
67 ctf_integer(int32_t, edge_flags, edge_flags)
68 ctf_integer(int, button_state, button_state)
69 ctf_integer(int64_t, down_time, down_time)
70 ctf_integer(int64_t, event_time, event_time)
71 )
72)
73
74TRACEPOINT_EVENT(
75 mir_client_input_receiver,
76 motion_event_coordinate,
77 TP_ARGS(int, id, float, x, float, y, float, touch_major, float, touch_minor, float, size, float, pressure, float, orientation),
78 TP_FIELDS(
79 ctf_integer(int, id, id)
80 ctf_float(float, x, x)
81 ctf_float(float, y, y)
82 ctf_float(float, touch_major, touch_major)
83 ctf_float(float, touch_minor, touch_minor)
84 ctf_float(float, size, size)
85 ctf_float(float, pressure, pressure)
86 ctf_float(float, orientation, orientation)
87 )
88)
89
90#ifdef __clang__
91#pragma clang diagnostic pop
92#endif
93
94#endif /* MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_ */
95
96#include <lttng/tracepoint-event.h>
097
=== modified file 'src/client/lttng/rpc_report.cpp'
--- src/client/lttng/rpc_report.cpp 2013-09-26 13:50:11 +0000
+++ src/client/lttng/rpc_report.cpp 2014-03-06 14:19:43 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "rpc_report.h"19#include "rpc_report.h"
20#include "mir/lttng/mir_tracepoint.h"20#include "mir/report/lttng/mir_tracepoint.h"
2121
22#include "mir_protobuf_wire.pb.h"22#include "mir_protobuf_wire.pb.h"
2323
2424
=== removed file 'src/client/lttng/rpc_report_tp.c'
--- src/client/lttng/rpc_report_tp.c 2013-06-03 12:15:45 +0000
+++ src/client/lttng/rpc_report_tp.c 1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
1/* The probes need to be compiled in a C file (not C++) */
2#define TRACEPOINT_CREATE_PROBES
3
4#include "rpc_report_tp.h"
50
=== added file 'src/client/lttng/tracepoints.c'
--- src/client/lttng/tracepoints.c 1970-01-01 00:00:00 +0000
+++ src/client/lttng/tracepoints.c 2014-03-06 14:19:43 +0000
@@ -0,0 +1,5 @@
1/* The probes need to be compiled in a C file (not C++) */
2#define TRACEPOINT_CREATE_PROBES
3
4#include "rpc_report_tp.h"
5#include "input_receiver_report_tp.h"
06
=== added file 'src/client/mesa/CMakeLists.txt'
--- src/client/mesa/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/client/mesa/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -0,0 +1,40 @@
1include_directories(
2 ${DRM_INCLUDE_DIRS}
3 ${EGL_INCLUDE_DIRS}
4)
5
6add_library(
7 mirclientplatformmesa SHARED
8
9 client_platform_factory.cpp
10 client_platform.cpp
11 client_buffer_factory.cpp
12 client_buffer.cpp
13 mesa_native_display_container.cpp
14 native_surface.cpp
15)
16
17set_target_properties(
18 mirclientplatformmesa PROPERTIES
19 OUTPUT_NAME mirclientplatform
20 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
21)
22
23target_link_libraries(
24 mirclientplatformmesa
25 mirclient
26
27 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
28)
29
30if (MIR_TEST_PLATFORM STREQUAL "mesa")
31 add_custom_command(TARGET mirclientplatformmesa
32 POST_BUILD
33 COMMAND ${CMAKE_COMMAND} -E remove libmirclientplatform.so
34 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirclientplatformmesa> libmirclientplatform.so
35 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
36 )
37endif()
38
39install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/mesa)
40
041
=== modified file 'src/client/mesa/client_platform.cpp'
--- src/client/mesa/client_platform.cpp 2014-01-13 06:12:33 +0000
+++ src/client/mesa/client_platform.cpp 2014-03-06 14:19:43 +0000
@@ -20,14 +20,9 @@
20#include "client_platform.h"20#include "client_platform.h"
21#include "client_buffer_factory.h"21#include "client_buffer_factory.h"
22#include "mesa_native_display_container.h"22#include "mesa_native_display_container.h"
23#include "buffer_file_ops.h"
24#include "native_surface.h"23#include "native_surface.h"
25#include "../mir_connection.h"24#include "../mir_connection.h"
26#include "../client_buffer_factory.h"25#include "../client_buffer_factory.h"
27#include "../native_client_platform_factory.h"
28
29#include <sys/mman.h>
30#include <unistd.h>
3126
32namespace mcl=mir::client;27namespace mcl=mir::client;
33namespace mclm=mir::client::mesa;28namespace mclm=mir::client::mesa;
@@ -36,31 +31,6 @@
36namespace31namespace
37{32{
3833
39struct RealBufferFileOps : public mclm::BufferFileOps
40{
41 int close(int fd) const
42 {
43 while (::close(fd) == -1)
44 {
45 // Retry on EINTR, return error on anything else
46 if (errno != EINTR)
47 return errno;
48 }
49 return 0;
50 }
51
52 void* map(int fd, off_t offset, size_t size) const
53 {
54 return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,
55 fd, offset);
56 }
57
58 void unmap(void* addr, size_t size) const
59 {
60 munmap(addr, size);
61 }
62};
63
64struct NativeDisplayDeleter34struct NativeDisplayDeleter
65{35{
66 NativeDisplayDeleter(mcl::EGLNativeDisplayContainer& container)36 NativeDisplayDeleter(mcl::EGLNativeDisplayContainer& container)
@@ -79,14 +49,6 @@
7949
80}50}
8151
82std::shared_ptr<mcl::ClientPlatform>
83mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
84{
85 auto buffer_file_ops = std::make_shared<RealBufferFileOps>();
86 return std::make_shared<mclm::ClientPlatform>(
87 context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());
88}
89
90mclm::ClientPlatform::ClientPlatform(52mclm::ClientPlatform::ClientPlatform(
91 ClientContext* const context,53 ClientContext* const context,
92 std::shared_ptr<BufferFileOps> const& buffer_file_ops,54 std::shared_ptr<BufferFileOps> const& buffer_file_ops,
@@ -125,7 +87,7 @@
125 //TODO: this is awkward on both android and gbm...87 //TODO: this is awkward on both android and gbm...
126 auto native_window = new NativeSurface(*client_surface);88 auto native_window = new NativeSurface(*client_surface);
127 auto egl_native_window = new EGLNativeWindowType;89 auto egl_native_window = new EGLNativeWindowType;
128 *egl_native_window = native_window;90 *egl_native_window = reinterpret_cast<EGLNativeWindowType>(native_window);
129 NativeWindowDeleter deleter(native_window);91 NativeWindowDeleter deleter(native_window);
130 return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);92 return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);
131}93}
13294
=== added file 'src/client/mesa/client_platform_factory.cpp'
--- src/client/mesa/client_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ src/client/mesa/client_platform_factory.cpp 2014-03-06 14:19:43 +0000
@@ -0,0 +1,71 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#include "client_platform_factory.h"
20#include "client_platform.h"
21#include "buffer_file_ops.h"
22#include "../egl_native_display_container.h"
23
24#include <sys/mman.h>
25#include <unistd.h>
26
27namespace mcl = mir::client;
28namespace mclm = mcl::mesa;
29
30namespace
31{
32
33struct RealBufferFileOps : public mclm::BufferFileOps
34{
35 int close(int fd) const
36 {
37 while (::close(fd) == -1)
38 {
39 // Retry on EINTR, return error on anything else
40 if (errno != EINTR)
41 return errno;
42 }
43 return 0;
44 }
45
46 void* map(int fd, off_t offset, size_t size) const
47 {
48 return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,
49 fd, offset);
50 }
51
52 void unmap(void* addr, size_t size) const
53 {
54 munmap(addr, size);
55 }
56};
57
58}
59
60std::shared_ptr<mcl::ClientPlatform>
61mclm::ClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
62{
63 auto buffer_file_ops = std::make_shared<RealBufferFileOps>();
64 return std::make_shared<mclm::ClientPlatform>(
65 context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());
66}
67
68extern "C" std::shared_ptr<mcl::ClientPlatformFactory> mcl::create_client_platform_factory()
69{
70 return std::make_shared<mclm::ClientPlatformFactory>();
71}
072
=== added file 'src/client/mesa/client_platform_factory.h'
--- src/client/mesa/client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ src/client/mesa/client_platform_factory.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,41 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_CLIENT_MESA_CLIENT_PLATFORM_FACTORY_H_
20#define MIR_CLIENT_MESA_CLIENT_PLATFORM_FACTORY_H_
21
22#include "../client_platform_factory.h"
23
24namespace mir
25{
26namespace client
27{
28namespace mesa
29{
30
31class ClientPlatformFactory : public client::ClientPlatformFactory
32{
33public:
34 std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) override;
35};
36
37}
38}
39}
40
41#endif /* MIR_CLIENT_MESA_CLIENT_PLATFORM_FACTORY_H_ */
042
=== modified file 'src/client/mesa/native_surface.cpp'
--- src/client/mesa/native_surface.cpp 2014-01-27 16:59:40 +0000
+++ src/client/mesa/native_surface.cpp 2014-03-06 14:19:43 +0000
@@ -46,7 +46,7 @@
46}46}
4747
48mclm::NativeSurface::NativeSurface(ClientSurface& surface)48mclm::NativeSurface::NativeSurface(ClientSurface& surface)
49 : surface(surface)49 : starting(true), surface(surface)
50{50{
51 surface_advance_buffer = advance_buffer_static;51 surface_advance_buffer = advance_buffer_static;
52 surface_get_parameters = get_parameters_static;52 surface_get_parameters = get_parameters_static;
@@ -55,7 +55,17 @@
5555
56int mclm::NativeSurface::advance_buffer(MirBufferPackage* buffer_package)56int mclm::NativeSurface::advance_buffer(MirBufferPackage* buffer_package)
57{57{
58 surface.request_and_wait_for_next_buffer();58 /*
59 * At present dri2_create_mir_window_surface will trigger
60 * mir_advance_colour_buffer which will land here. Since we're still
61 * creating the window, we don't have any buffers we want the server to
62 * composite, so avoid sending a request to the server on startup:
63 */
64 if (starting)
65 starting = false;
66 else
67 surface.request_and_wait_for_next_buffer();
68
59 auto buffer = surface.get_current_buffer();69 auto buffer = surface.get_current_buffer();
6070
61 auto buffer_to_driver = buffer->native_buffer_handle();71 auto buffer_to_driver = buffer->native_buffer_handle();
6272
=== modified file 'src/client/mesa/native_surface.h'
--- src/client/mesa/native_surface.h 2014-01-13 06:12:33 +0000
+++ src/client/mesa/native_surface.h 2014-03-06 14:19:43 +0000
@@ -39,6 +39,7 @@
39 int set_swapinterval(int interval);39 int set_swapinterval(int interval);
4040
41private:41private:
42 bool starting;
42 ClientSurface& surface;43 ClientSurface& surface;
43};44};
4445
4546
=== modified file 'src/client/mir_client_library.cpp'
--- src/client/mir_client_library.cpp 2014-01-28 18:21:14 +0000
+++ src/client/mir_client_library.cpp 2014-03-06 14:19:43 +0000
@@ -25,7 +25,6 @@
25#include "mir_connection.h"25#include "mir_connection.h"
26#include "display_configuration.h"26#include "display_configuration.h"
27#include "mir_surface.h"27#include "mir_surface.h"
28#include "native_client_platform_factory.h"
29#include "egl_native_display_container.h"28#include "egl_native_display_container.h"
30#include "default_connection_configuration.h"29#include "default_connection_configuration.h"
31#include "lifecycle_control.h"30#include "lifecycle_control.h"
@@ -397,7 +396,7 @@
397396
398MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface)397MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface)
399{398{
400 return surface->generate_native_window();399 return reinterpret_cast<MirEGLNativeWindowType>(surface->generate_native_window());
401}400}
402401
403MirWaitHandle* mir_surface_set_type(MirSurface *surf,402MirWaitHandle* mir_surface_set_type(MirSurface *surf,
404403
=== modified file 'src/client/mir_connection.cpp'
--- src/client/mir_connection.cpp 2014-01-24 18:11:19 +0000
+++ src/client/mir_connection.cpp 2014-03-06 14:19:43 +0000
@@ -16,8 +16,6 @@
16 * Authored by: Thomas Guest <thomas.guest@canonical.com>16 * Authored by: Thomas Guest <thomas.guest@canonical.com>
17 */17 */
1818
19#include "mir/logging/logger.h"
20
21#include "mir_connection.h"19#include "mir_connection.h"
22#include "mir_surface.h"20#include "mir_surface.h"
23#include "client_platform.h"21#include "client_platform.h"
@@ -28,6 +26,8 @@
28#include "connection_surface_map.h"26#include "connection_surface_map.h"
29#include "lifecycle_control.h"27#include "lifecycle_control.h"
3028
29#include "mir/logging/logger.h"
30
31#include <algorithm>31#include <algorithm>
32#include <cstddef>32#include <cstddef>
33#include <unistd.h>33#include <unistd.h>
@@ -458,6 +458,7 @@
458 display_request->set_output_id(output.output_id);458 display_request->set_output_id(output.output_id);
459 display_request->set_used(output.used);459 display_request->set_used(output.used);
460 display_request->set_current_mode(output.current_mode);460 display_request->set_current_mode(output.current_mode);
461 display_request->set_current_format(output.current_format);
461 display_request->set_position_x(output.position_x);462 display_request->set_position_x(output.position_x);
462 display_request->set_position_y(output.position_y);463 display_request->set_position_y(output.position_y);
463 display_request->set_power_mode(output.power_mode);464 display_request->set_power_mode(output.power_mode);
464465
=== modified file 'src/client/mir_screencast_api.cpp'
--- src/client/mir_screencast_api.cpp 2014-01-29 18:02:33 +0000
+++ src/client/mir_screencast_api.cpp 2014-03-06 14:19:43 +0000
@@ -96,5 +96,5 @@
9696
97MirEGLNativeWindowType mir_screencast_egl_native_window(MirScreencast* screencast)97MirEGLNativeWindowType mir_screencast_egl_native_window(MirScreencast* screencast)
98{98{
99 return screencast->egl_native_window();99 return reinterpret_cast<MirEGLNativeWindowType>(screencast->egl_native_window());
100}100}
101101
=== removed file 'src/client/native_client_platform_factory.h'
--- src/client/native_client_platform_factory.h 2013-06-17 09:51:42 +0000
+++ src/client/native_client_platform_factory.h 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
1/*
2 * Copyright © 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_CLIENT_NATIVE_CLIENT_PLATFORM_FACTORY_
20#define MIR_CLIENT_NATIVE_CLIENT_PLATFORM_FACTORY_
21
22#include "client_platform_factory.h"
23
24namespace mir
25{
26namespace client
27{
28
29/**
30 * Factory for creating the native client platform.
31 * \ingroup platform_enablement
32 */
33class NativeClientPlatformFactory : public ClientPlatformFactory
34{
35public:
36 /**
37 * Creates a client platform.
38 *
39 * This method needs to be implemented by each platform.
40 *
41 * \param [in] context information about the client
42 */
43 std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context);
44};
45
46}
47}
48
49#endif /* MIR_CLIENT_NATIVE_CLIENT_PLATFORM_FACTORY_ */
500
=== modified file 'src/platform/CMakeLists.txt'
--- src/platform/CMakeLists.txt 2014-01-22 08:32:55 +0000
+++ src/platform/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -17,3 +17,4 @@
17install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})17install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
1818
19add_subdirectory(graphics/)19add_subdirectory(graphics/)
20add_subdirectory(options)
2021
=== modified file 'src/platform/graphics/CMakeLists.txt'
--- src/platform/graphics/CMakeLists.txt 2014-01-22 08:32:55 +0000
+++ src/platform/graphics/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -8,7 +8,6 @@
8 egl_extensions.cpp8 egl_extensions.cpp
9 egl_resources.cpp9 egl_resources.cpp
10 display_configuration.cpp10 display_configuration.cpp
11 null_display_report.cpp
12 buffer_basic.cpp11 buffer_basic.cpp
13 pixel_format_utils.cpp12 pixel_format_utils.cpp
14)13)
@@ -26,11 +25,11 @@
26 ${EGL_LDFLAGS} ${EGL_LIBRARIES}25 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
27)26)
2827
29if (MIR_PLATFORM STREQUAL "android")28if (MIR_BUILD_PLATFORM_ANDROID)
30 add_subdirectory(android/)29 add_subdirectory(android/)
31endif()30endif()
3231
33if (MIR_PLATFORM STREQUAL "mesa")32if (MIR_BUILD_PLATFORM_MESA)
34 add_subdirectory(mesa/)33 add_subdirectory(mesa/)
35endif()34endif()
3635
3736
=== modified file 'src/platform/graphics/android/CMakeLists.txt'
--- src/platform/graphics/android/CMakeLists.txt 2014-01-21 18:09:35 +0000
+++ src/platform/graphics/android/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -4,8 +4,11 @@
4 ${GLESv2_INCLUDE_DIRS}4 ${GLESv2_INCLUDE_DIRS}
5)5)
66
7set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
8add_definitions( -DANDROID )
9
7add_library(10add_library(
8 mirplatformgraphics SHARED11 mirplatformgraphicsandroid SHARED
912
10 android_platform.cpp13 android_platform.cpp
11 android_buffer_allocator.cpp14 android_buffer_allocator.cpp
@@ -31,8 +34,14 @@
31 gl_context.cpp34 gl_context.cpp
32)35)
3336
37set_target_properties(
38 mirplatformgraphicsandroid PROPERTIES
39 OUTPUT_NAME mirplatformgraphics
40 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
41)
42
34target_link_libraries(43target_link_libraries(
35 mirplatformgraphics44 mirplatformgraphicsandroid
3645
37 mirplatform46 mirplatform
38 mirsharedandroid47 mirsharedandroid
@@ -42,4 +51,13 @@
42 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}51 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
43)52)
4453
45install(TARGETS mirplatformgraphics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})54if (MIR_TEST_PLATFORM STREQUAL "android")
55 add_custom_command(TARGET mirplatformgraphicsandroid
56 POST_BUILD
57 COMMAND ${CMAKE_COMMAND} -E remove libmirplatformgraphics.so
58 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> libmirplatformgraphics.so
59 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
60 )
61endif()
62
63install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/android)
4664
=== modified file 'src/platform/graphics/android/android_display.cpp'
--- src/platform/graphics/android/android_display.cpp 2014-01-31 07:48:24 +0000
+++ src/platform/graphics/android/android_display.cpp 2014-03-06 14:19:43 +0000
@@ -17,14 +17,13 @@
17 */17 */
1818
19#include "mir/graphics/platform.h"19#include "mir/graphics/platform.h"
20#include "mir/graphics/display_configuration.h"20#include "android_display_configuration.h"
21#include "mir/graphics/display_report.h"21#include "mir/graphics/display_report.h"
22#include "mir/graphics/display_buffer.h"22#include "mir/graphics/display_buffer.h"
23#include "mir/graphics/gl_context.h"23#include "mir/graphics/gl_context.h"
24#include "mir/graphics/egl_resources.h"24#include "mir/graphics/egl_resources.h"
25#include "android_display.h"25#include "android_display.h"
26#include "display_builder.h"26#include "display_builder.h"
27#include "display_device.h"
28#include "mir/geometry/rectangle.h"27#include "mir/geometry/rectangle.h"
2928
30namespace mga=mir::graphics::android;29namespace mga=mir::graphics::android;
@@ -35,9 +34,7 @@
35 std::shared_ptr<DisplayReport> const& display_report)34 std::shared_ptr<DisplayReport> const& display_report)
36 : display_builder{display_builder},35 : display_builder{display_builder},
37 gl_context{display_builder->display_format(), *display_report},36 gl_context{display_builder->display_format(), *display_report},
38 display_device(display_builder->create_display_device()),37 display_buffer{display_builder->create_display_buffer(gl_context)}
39 display_buffer{display_builder->create_display_buffer(display_device, gl_context)},
40 current_configuration{display_buffer->view_area().size}
41{38{
42 display_report->report_successful_setup_of_native_resources();39 display_report->report_successful_setup_of_native_resources();
4340
@@ -55,31 +52,15 @@
55std::unique_ptr<mg::DisplayConfiguration> mga::AndroidDisplay::configuration() const52std::unique_ptr<mg::DisplayConfiguration> mga::AndroidDisplay::configuration() const
56{53{
57 return std::unique_ptr<mg::DisplayConfiguration>(54 return std::unique_ptr<mg::DisplayConfiguration>(
58 new mga::AndroidDisplayConfiguration(current_configuration)55 new mga::AndroidDisplayConfiguration(display_buffer->configuration()));
59 );
60}56}
6157
62void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration)58void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration)
63{59{
64 MirOrientation orientation = mir_orientation_normal;
65
66 configuration.for_each_output([&](mg::DisplayConfigurationOutput const& output)60 configuration.for_each_output([&](mg::DisplayConfigurationOutput const& output)
67 {61 {
68 // TODO: Properly support multiple outputs62 display_buffer->configure(output);
69 display_device->mode(output.power_mode);
70 orientation = output.orientation;
71 });63 });
72 current_configuration = dynamic_cast<mga::AndroidDisplayConfiguration const&>(configuration);
73
74 /*
75 * It's tempting to put orient() into the base class and so avoid this
76 * cast, but we only need it in the Android implementation right now.
77 */
78 if (android::DisplayBuffer* db =
79 dynamic_cast<mga::DisplayBuffer*>(display_buffer.get()))
80 {
81 db->orient(orientation);
82 }
83}64}
8465
85void mga::AndroidDisplay::register_configuration_change_handler(66void mga::AndroidDisplay::register_configuration_change_handler(
8667
=== modified file 'src/platform/graphics/android/android_display.h'
--- src/platform/graphics/android/android_display.h 2014-01-31 07:48:24 +0000
+++ src/platform/graphics/android/android_display.h 2014-03-06 14:19:43 +0000
@@ -19,9 +19,7 @@
19#ifndef MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_H_19#ifndef MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_H_
20#define MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_H_20#define MIR_GRAPHICS_ANDROID_ANDROID_DISPLAY_H_
2121
22#include "display_buffer.h"
23#include "mir/graphics/display.h"22#include "mir/graphics/display.h"
24#include "android_display_configuration.h"
25#include "gl_context.h"23#include "gl_context.h"
2624
27#include <memory>25#include <memory>
@@ -35,10 +33,9 @@
3533
36namespace android34namespace android
37{35{
38class DisplayDevice;
39
40class DisplayBuilder;36class DisplayBuilder;
41class DisplaySupportProvider;37class DisplaySupportProvider;
38class ConfigurableDisplayBuffer;
4239
43class AndroidDisplay : public Display40class AndroidDisplay : public Display
44{41{
@@ -69,10 +66,9 @@
69private:66private:
70 std::shared_ptr<DisplayBuilder> const display_builder;67 std::shared_ptr<DisplayBuilder> const display_builder;
71 GLContext gl_context;68 GLContext gl_context;
72 std::shared_ptr<DisplayDevice> const display_device;69
73 //we only have a primary display at the moment70 //we only have a primary display at the moment
74 std::unique_ptr<graphics::DisplayBuffer> const display_buffer;71 std::unique_ptr<ConfigurableDisplayBuffer> const display_buffer;
75 AndroidDisplayConfiguration current_configuration;
76};72};
7773
78}74}
7975
=== modified file 'src/platform/graphics/android/android_display_configuration.cpp'
--- src/platform/graphics/android/android_display_configuration.cpp 2014-01-23 22:03:09 +0000
+++ src/platform/graphics/android/android_display_configuration.cpp 2014-03-06 14:19:43 +0000
@@ -20,25 +20,9 @@
20namespace mga = mg::android;20namespace mga = mg::android;
21namespace geom = mir::geometry;21namespace geom = mir::geometry;
2222
23mga::AndroidDisplayConfiguration::AndroidDisplayConfiguration(geom::Size const& display_size)23mga::AndroidDisplayConfiguration::AndroidDisplayConfiguration(mg::DisplayConfigurationOutput && output)
24 : configuration{mg::DisplayConfigurationOutputId{1},24 : configuration(std::move(output)),
25 mg::DisplayConfigurationCardId{0},25 card{mg::DisplayConfigurationCardId{0}, 1}
26 mg::DisplayConfigurationOutputType::lvds,
27 {
28 mir_pixel_format_abgr_8888,
29 mir_pixel_format_xbgr_8888
30 },
31 {mg::DisplayConfigurationMode{display_size,0.0f}},
32 0,
33 geom::Size{0,0},
34 true,
35 true,
36 geom::Point{0,0},
37 0,
38 mir_pixel_format_abgr_8888,
39 mir_power_mode_on,
40 mir_orientation_normal},
41 card{mg::DisplayConfigurationCardId{0}, 1}
42{26{
43}27}
4428
4529
=== modified file 'src/platform/graphics/android/android_display_configuration.h'
--- src/platform/graphics/android/android_display_configuration.h 2014-01-13 06:12:33 +0000
+++ src/platform/graphics/android/android_display_configuration.h 2014-03-06 14:19:43 +0000
@@ -29,7 +29,7 @@
29class AndroidDisplayConfiguration : public graphics::DisplayConfiguration29class AndroidDisplayConfiguration : public graphics::DisplayConfiguration
30{30{
31public:31public:
32 AndroidDisplayConfiguration(geometry::Size const& display_size);32 AndroidDisplayConfiguration(DisplayConfigurationOutput&& output);
33 AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other);33 AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other);
34 AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other);34 AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other);
3535
3636
=== modified file 'src/platform/graphics/android/android_platform.cpp'
--- src/platform/graphics/android/android_platform.cpp 2014-02-04 23:20:36 +0000
+++ src/platform/graphics/android/android_platform.cpp 2014-03-06 14:19:43 +0000
@@ -29,9 +29,9 @@
29#include "mir/graphics/buffer_initializer.h"29#include "mir/graphics/buffer_initializer.h"
30#include "mir/graphics/buffer_id.h"30#include "mir/graphics/buffer_id.h"
31#include "mir/graphics/buffer_ipc_packer.h"31#include "mir/graphics/buffer_ipc_packer.h"
32#include "mir/graphics/display_report.h"
32#include "mir/options/option.h"33#include "mir/options/option.h"
3334
34#include "mir/graphics/null_display_report.h"
35#include <boost/throw_exception.hpp>35#include <boost/throw_exception.hpp>
36#include <stdexcept>36#include <stdexcept>
3737
3838
=== added file 'src/platform/graphics/android/configurable_display_buffer.h'
--- src/platform/graphics/android/configurable_display_buffer.h 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/android/configurable_display_buffer.h 2014-03-06 14:19:43 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_ANDROID_CONFIGURABLE_DISPLAY_BUFFER_H_
20#define MIR_GRAPHICS_ANDROID_CONFIGURABLE_DISPLAY_BUFFER_H_
21
22#include "mir/graphics/display_buffer.h"
23#include "mir/graphics/display_configuration.h"
24
25namespace mir
26{
27namespace graphics
28{
29namespace android
30{
31
32class ConfigurableDisplayBuffer : public graphics::DisplayBuffer
33{
34public:
35 virtual DisplayConfigurationOutput configuration() const = 0;
36 virtual void configure(DisplayConfigurationOutput const&) = 0;
37};
38
39}
40}
41}
42
43#endif /* MIR_GRAPHICS_ANDROID_CONFIGURABLE_DISPLAY_BUFFER_H_ */
044
=== modified file 'src/platform/graphics/android/display_buffer.cpp'
--- src/platform/graphics/android/display_buffer.cpp 2014-01-23 17:26:51 +0000
+++ src/platform/graphics/android/display_buffer.cpp 2014-03-06 14:19:43 +0000
@@ -24,6 +24,7 @@
24#include <boost/throw_exception.hpp>24#include <boost/throw_exception.hpp>
25#include <stdexcept>25#include <stdexcept>
26#include <algorithm>26#include <algorithm>
27#include <sstream>
2728
28namespace mg=mir::graphics;29namespace mg=mir::graphics;
29namespace mga=mir::graphics::android;30namespace mga=mir::graphics::android;
@@ -38,7 +39,23 @@
38 display_device{display_device},39 display_device{display_device},
39 native_window{native_window},40 native_window{native_window},
40 gl_context{shared_gl_context, std::bind(mga::create_window_surface, std::placeholders::_1, std::placeholders::_2, native_window.get())},41 gl_context{shared_gl_context, std::bind(mga::create_window_surface, std::placeholders::_1, std::placeholders::_2, native_window.get())},
41 rotation{mir_orientation_normal}42 current_configuration{
43 mg::DisplayConfigurationOutputId{1},
44 mg::DisplayConfigurationCardId{0},
45 mg::DisplayConfigurationOutputType::lvds,
46 {
47 fb_bundle->fb_format()
48 },
49 {mg::DisplayConfigurationMode{fb_bundle->fb_size(),0.0f}},
50 0,
51 geom::Size{0,0}, //could use DPI information to fill this
52 true,
53 true,
54 geom::Point{0,0},
55 0,
56 fb_bundle->fb_format(),
57 mir_power_mode_on,
58 mir_orientation_normal}
42{59{
43}60}
4461
@@ -48,8 +65,11 @@
48 int width = size.width.as_int();65 int width = size.width.as_int();
49 int height = size.height.as_int();66 int height = size.height.as_int();
5067
51 if (rotation == mir_orientation_left || rotation == mir_orientation_right)68 if (current_configuration.orientation == mir_orientation_left
69 || current_configuration.orientation == mir_orientation_right)
70 {
52 std::swap(width, height);71 std::swap(width, height);
72 }
5373
54 return {{0,0}, {width,height}};74 return {{0,0}, {width,height}};
55}75}
@@ -111,10 +131,47 @@
111 * and let the renderer do it.131 * and let the renderer do it.
112 * If and when we choose to implement HWC rotation, this may change.132 * If and when we choose to implement HWC rotation, this may change.
113 */133 */
114 return rotation;134 return current_configuration.orientation;
115}135}
116136
117void mga::DisplayBuffer::orient(MirOrientation rot)137mg::DisplayConfigurationOutput mga::DisplayBuffer::configuration() const
118{138{
119 rotation = rot;139 return mg::DisplayConfigurationOutput(current_configuration);
140}
141
142void mga::DisplayBuffer::configure(DisplayConfigurationOutput const& new_configuration)
143{
144 //power mode
145 MirPowerMode intended_power_mode = new_configuration.power_mode;
146 if ((intended_power_mode == mir_power_mode_standby) ||
147 (intended_power_mode == mir_power_mode_suspend))
148 {
149 intended_power_mode = mir_power_mode_off;
150 }
151
152 if (intended_power_mode != current_configuration.power_mode)
153 {
154 display_device->mode(intended_power_mode);
155 current_configuration.power_mode = intended_power_mode;
156 }
157
158 //If the hardware can rotate for us, we report normal orientation. If it can't
159 //we preserve this orientation change so the compositor can rotate everything in GL
160 if (display_device->apply_orientation(new_configuration.orientation))
161 {
162 current_configuration.orientation = mir_orientation_normal;
163 }
164 else
165 {
166 current_configuration.orientation = new_configuration.orientation;
167 }
168
169 //do not allow fb format reallocation
170 if (new_configuration.current_format != current_configuration.current_format)
171 {
172 std::stringstream err_msg;
173 err_msg << std::string("could not change display buffer format to request: ")
174 << new_configuration.current_format;
175 BOOST_THROW_EXCEPTION(std::runtime_error(err_msg.str()));
176 }
120}177}
121178
=== modified file 'src/platform/graphics/android/display_buffer.h'
--- src/platform/graphics/android/display_buffer.h 2014-02-06 13:30:26 +0000
+++ src/platform/graphics/android/display_buffer.h 2014-03-06 14:19:43 +0000
@@ -19,8 +19,9 @@
19#ifndef MIR_GRAPHICS_ANDROID_DISPLAY_BUFFER_H_19#ifndef MIR_GRAPHICS_ANDROID_DISPLAY_BUFFER_H_
20#define MIR_GRAPHICS_ANDROID_DISPLAY_BUFFER_H_20#define MIR_GRAPHICS_ANDROID_DISPLAY_BUFFER_H_
2121
22#include "mir/graphics/display_buffer.h"22#include "configurable_display_buffer.h"
23#include "mir/graphics/egl_resources.h"23#include "mir/graphics/egl_resources.h"
24#include "android_display_configuration.h"
24#include "gl_context.h"25#include "gl_context.h"
25#include <system/window.h>26#include <system/window.h>
2627
@@ -34,7 +35,7 @@
34class DisplayDevice;35class DisplayDevice;
35class FramebufferBundle;36class FramebufferBundle;
3637
37class DisplayBuffer : public graphics::DisplayBuffer38class DisplayBuffer : public ConfigurableDisplayBuffer
38{39{
39public:40public:
40 DisplayBuffer(std::shared_ptr<FramebufferBundle> const& fb_bundle,41 DisplayBuffer(std::shared_ptr<FramebufferBundle> const& fb_bundle,
@@ -52,7 +53,9 @@
52 std::list<std::shared_ptr<Renderable>> const& renderlist,53 std::list<std::shared_ptr<Renderable>> const& renderlist,
53 std::function<void(Renderable const&)> const& render_fn);54 std::function<void(Renderable const&)> const& render_fn);
54 MirOrientation orientation() const override;55 MirOrientation orientation() const override;
55 void orient(MirOrientation);56
57 DisplayConfigurationOutput configuration() const;
58 void configure(DisplayConfigurationOutput const&);
5659
57private:60private:
58 void render_and_post();61 void render_and_post();
@@ -61,6 +64,8 @@
61 std::shared_ptr<DisplayDevice> const display_device;64 std::shared_ptr<DisplayDevice> const display_device;
62 std::shared_ptr<ANativeWindow> const native_window;65 std::shared_ptr<ANativeWindow> const native_window;
63 GLContext gl_context;66 GLContext gl_context;
67 bool prepared;
68 DisplayConfigurationOutput current_configuration;
64 MirOrientation rotation;69 MirOrientation rotation;
65};70};
6671
6772
=== modified file 'src/platform/graphics/android/display_builder.h'
--- src/platform/graphics/android/display_builder.h 2014-01-13 06:12:33 +0000
+++ src/platform/graphics/android/display_builder.h 2014-03-06 14:19:43 +0000
@@ -19,7 +19,7 @@
19#ifndef MIR_GRAPHICS_ANDROID_DISPLAY_BUILDER_H_19#ifndef MIR_GRAPHICS_ANDROID_DISPLAY_BUILDER_H_
20#define MIR_GRAPHICS_ANDROID_DISPLAY_BUILDER_H_20#define MIR_GRAPHICS_ANDROID_DISPLAY_BUILDER_H_
2121
22#include "mir/graphics/display_buffer.h"22#include "configurable_display_buffer.h"
23#include "mir_toolkit/common.h"23#include "mir_toolkit/common.h"
24#include <memory>24#include <memory>
2525
@@ -29,7 +29,6 @@
29{29{
30namespace android30namespace android
31{31{
32class DisplayDevice;
33class GLContext;32class GLContext;
3433
35class DisplayBuilder34class DisplayBuilder
@@ -38,9 +37,7 @@
38 virtual ~DisplayBuilder() = default;37 virtual ~DisplayBuilder() = default;
3938
40 virtual MirPixelFormat display_format() = 0;39 virtual MirPixelFormat display_format() = 0;
41 virtual std::shared_ptr<DisplayDevice> create_display_device() = 0;40 virtual std::unique_ptr<ConfigurableDisplayBuffer> create_display_buffer(
42 virtual std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(
43 std::shared_ptr<DisplayDevice> const& display_device,
44 GLContext const& gl_context) = 0;41 GLContext const& gl_context) = 0;
4542
46protected:43protected:
4744
=== modified file 'src/platform/graphics/android/display_device.h'
--- src/platform/graphics/android/display_device.h 2014-01-23 17:26:51 +0000
+++ src/platform/graphics/android/display_device.h 2014-03-06 14:19:43 +0000
@@ -44,6 +44,7 @@
44 virtual void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list) = 0; 44 virtual void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list) = 0;
45 virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0;45 virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0;
46 virtual void post(Buffer const& buffer) = 0;46 virtual void post(Buffer const& buffer) = 0;
47 virtual bool apply_orientation(MirOrientation orientation) const = 0;
4748
48protected:49protected:
49 DisplayDevice() = default;50 DisplayDevice() = default;
5051
=== modified file 'src/platform/graphics/android/fb_device.cpp'
--- src/platform/graphics/android/fb_device.cpp 2014-01-23 17:26:51 +0000
+++ src/platform/graphics/android/fb_device.cpp 2014-03-06 14:19:43 +0000
@@ -69,6 +69,11 @@
69 }69 }
70}70}
7171
72bool mga::FBDevice::apply_orientation(MirOrientation) const
73{
74 return false;
75}
76
72void mga::FBDevice::mode(MirPowerMode mode)77void mga::FBDevice::mode(MirPowerMode mode)
73{78{
74 int enable = 0;79 int enable = 0;
7580
=== modified file 'src/platform/graphics/android/fb_device.h'
--- src/platform/graphics/android/fb_device.h 2014-01-23 17:26:51 +0000
+++ src/platform/graphics/android/fb_device.h 2014-03-06 14:19:43 +0000
@@ -35,6 +35,7 @@
35public:35public:
36 FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev);36 FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev);
3737
38 bool apply_orientation(MirOrientation orientation) const;
38 void mode(MirPowerMode mode);39 void mode(MirPowerMode mode);
39 void prepare_gl();40 void prepare_gl();
40 void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list); 41 void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list);
4142
=== modified file 'src/platform/graphics/android/hwc_common_device.cpp'
--- src/platform/graphics/android/hwc_common_device.cpp 2014-01-13 06:12:33 +0000
+++ src/platform/graphics/android/hwc_common_device.cpp 2014-03-06 14:19:43 +0000
@@ -75,12 +75,10 @@
75 std::unique_lock<std::mutex> lg(blanked_mutex);75 std::unique_lock<std::mutex> lg(blanked_mutex);
76 int err = 0;76 int err = 0;
7777
78 //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off
79 // are all treated like mir_power_mode_off
80 if ((mode_request == mir_power_mode_suspend) ||78 if ((mode_request == mir_power_mode_suspend) ||
81 (mode_request == mir_power_mode_standby))79 (mode_request == mir_power_mode_standby))
82 {80 {
83 mode_request = mir_power_mode_off;81 BOOST_THROW_EXCEPTION(std::runtime_error("cannot set to suspend or standby"));
84 }82 }
8583
86 if ((mode_request == mir_power_mode_on) &&84 if ((mode_request == mir_power_mode_on) &&
@@ -129,3 +127,8 @@
129 return err;127 return err;
130 return hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, 1);128 return hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, 1);
131}129}
130
131bool mga::HWCCommonDevice::apply_orientation(MirOrientation) const
132{
133 return false;
134}
132135
=== modified file 'src/platform/graphics/android/hwc_common_device.h'
--- src/platform/graphics/android/hwc_common_device.h 2014-01-13 06:12:33 +0000
+++ src/platform/graphics/android/hwc_common_device.h 2014-03-06 14:19:43 +0000
@@ -48,6 +48,7 @@
4848
49 void notify_vsync();49 void notify_vsync();
50 void mode(MirPowerMode mode);50 void mode(MirPowerMode mode);
51 bool apply_orientation(MirOrientation orientation) const;
5152
52protected:53protected:
53 HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,54 HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
5455
=== modified file 'src/platform/graphics/android/hwc_device.cpp'
--- src/platform/graphics/android/hwc_device.cpp 2014-01-29 18:54:06 +0000
+++ src/platform/graphics/android/hwc_device.cpp 2014-03-06 14:19:43 +0000
@@ -22,7 +22,6 @@
22#include "hwc_vsync_coordinator.h"22#include "hwc_vsync_coordinator.h"
23#include "framebuffer_bundle.h"23#include "framebuffer_bundle.h"
24#include "buffer.h"24#include "buffer.h"
25#include "mir/graphics/android/sync_fence.h"
26#include "mir/graphics/android/native_buffer.h"25#include "mir/graphics/android/native_buffer.h"
27#include "mir/graphics/buffer.h"26#include "mir/graphics/buffer.h"
2827
@@ -38,17 +37,23 @@
38 std::shared_ptr<HWCVsyncCoordinator> const& coordinator,37 std::shared_ptr<HWCVsyncCoordinator> const& coordinator,
39 std::shared_ptr<SyncFileOps> const& sync_ops)38 std::shared_ptr<SyncFileOps> const& sync_ops)
40 : HWCCommonDevice(hwc_device, coordinator),39 : HWCCommonDevice(hwc_device, coordinator),
41 layer_list({mga::ForceGLLayer{}, mga::FramebufferLayer{}}),
42 sync_ops(sync_ops)40 sync_ops(sync_ops)
43{41{
44}42}
4543
46void mga::HwcDevice::prepare_gl()44void mga::HwcDevice::prepare_gl()
47{45{
48 //note, although we only have a primary display right now,46 auto rc = 0;
49 // set the external and virtual displays to null as some drivers check for that47 auto display_list = layer_list.native_list().lock();
50 hwc_display_contents_1_t* displays[num_displays] {layer_list.native_list(), nullptr, nullptr};48 if (display_list)
51 if (hwc_device->prepare(hwc_device.get(), 1, displays))49 {
50 //note, although we only have a primary display right now,
51 // set the external and virtual displays to null as some drivers check for that
52 hwc_display_contents_1_t* displays[num_displays] {display_list.get(), nullptr, nullptr};
53 rc = hwc_device->prepare(hwc_device.get(), 1, displays);
54 }
55
56 if ((rc != 0) || (!display_list))
52 {57 {
53 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()"));58 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()"));
54 }59 }
@@ -71,17 +76,24 @@
71{76{
72 auto lg = lock_unblanked();77 auto lg = lock_unblanked();
7378
74 auto native_buffer = buffer.native_buffer_handle();79 layer_list.set_fb_target(buffer);
75 layer_list.set_fb_target(native_buffer);80
7681 auto rc = 0;
77 hwc_display_contents_1_t* displays[num_displays] {layer_list.native_list(), nullptr, nullptr};82 auto display_list = layer_list.native_list().lock();
78 if (hwc_device->set(hwc_device.get(), 1, displays))83 if (display_list)
84 {
85 hwc_display_contents_1_t* displays[num_displays] {display_list.get(), nullptr, nullptr};
86 rc = hwc_device->set(hwc_device.get(), 1, displays);
87
88 mga::SyncFence retire_fence(sync_ops, layer_list.retirement_fence());
89
90 int framebuffer_fence = layer_list.fb_target_fence();
91 auto native_buffer = buffer.native_buffer_handle();
92 native_buffer->update_fence(framebuffer_fence);
93 }
94
95 if ((rc != 0) || (!display_list))
79 {96 {
80 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()"));97 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()"));
81 }98 }
82
83 mga::SyncFence retire_fence(sync_ops, displays[HWC_DISPLAY_PRIMARY]->retireFenceFd);
84
85 int framebuffer_fence = layer_list.framebuffer_fence();
86 native_buffer->update_fence(framebuffer_fence);
87}99}
88100
=== modified file 'src/platform/graphics/android/hwc_device.h'
--- src/platform/graphics/android/hwc_device.h 2014-02-06 13:30:26 +0000
+++ src/platform/graphics/android/hwc_device.h 2014-03-06 14:19:43 +0000
@@ -20,6 +20,7 @@
20#define MIR_GRAPHICS_ANDROID_HWC_DEVICE_H_20#define MIR_GRAPHICS_ANDROID_HWC_DEVICE_H_
2121
22#include "mir_toolkit/common.h"22#include "mir_toolkit/common.h"
23#include "mir/graphics/android/sync_fence.h"
23#include "hwc_common_device.h"24#include "hwc_common_device.h"
24#include "hwc_layerlist.h"25#include "hwc_layerlist.h"
25#include <memory>26#include <memory>
@@ -48,7 +49,7 @@
48 void post(Buffer const& buffer);49 void post(Buffer const& buffer);
4950
50private:51private:
51 LayerList layer_list;52 FBTargetLayerList layer_list;
5253
53 std::shared_ptr<SyncFileOps> const sync_ops;54 std::shared_ptr<SyncFileOps> const sync_ops;
54 static size_t const num_displays{3}; //primary, external, virtual55 static size_t const num_displays{3}; //primary, external, virtual
5556
=== modified file 'src/platform/graphics/android/hwc_fb_device.cpp'
--- src/platform/graphics/android/hwc_fb_device.cpp 2014-01-23 18:01:19 +0000
+++ src/platform/graphics/android/hwc_fb_device.cpp 2014-03-06 14:19:43 +0000
@@ -18,7 +18,6 @@
18 */18 */
1919
20#include "hwc_fb_device.h"20#include "hwc_fb_device.h"
21#include "hwc_layers.h"
22#include "hwc_vsync_coordinator.h"21#include "hwc_vsync_coordinator.h"
23#include "framebuffer_bundle.h"22#include "framebuffer_bundle.h"
24#include "android_format_conversion-inl.h"23#include "android_format_conversion-inl.h"
@@ -36,15 +35,21 @@
36 std::shared_ptr<framebuffer_device_t> const& fb_device,35 std::shared_ptr<framebuffer_device_t> const& fb_device,
37 std::shared_ptr<HWCVsyncCoordinator> const& coordinator)36 std::shared_ptr<HWCVsyncCoordinator> const& coordinator)
38 : HWCCommonDevice(hwc_device, coordinator),37 : HWCCommonDevice(hwc_device, coordinator),
39 fb_device(fb_device),38 fb_device(fb_device)
40 layer_list({mga::ForceGLLayer{}})
41{39{
42}40}
4341
44void mga::HwcFbDevice::prepare_gl()42void mga::HwcFbDevice::prepare_gl()
45{43{
46 auto display_list = layer_list.native_list();44 auto rc = 0;
47 if (hwc_device->prepare(hwc_device.get(), 1, &display_list) != 0)45 auto display_list = layer_list.native_list().lock();
46 if (display_list)
47 {
48 hwc_display_contents_1_t* displays[num_displays] {display_list.get()};
49 rc = hwc_device->prepare(hwc_device.get(), num_displays, displays);
50 }
51
52 if ((rc != 0) || (!display_list))
48 {53 {
49 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()"));54 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()"));
50 }55 }
@@ -57,13 +62,20 @@
5762
58void mga::HwcFbDevice::gpu_render(EGLDisplay dpy, EGLSurface sur)63void mga::HwcFbDevice::gpu_render(EGLDisplay dpy, EGLSurface sur)
59{64{
60 auto display_list = layer_list.native_list();65 auto rc = 0;
61 display_list->dpy = dpy;66 auto display_list = layer_list.native_list().lock();
62 display_list->sur = sur;67 if (display_list)
6368 {
64 //set() may affect EGL state by calling eglSwapBuffers.69 display_list->dpy = dpy;
65 //HWC 1.0 is the only version of HWC that can do this.70 display_list->sur = sur;
66 if (hwc_device->set(hwc_device.get(), 1, &display_list) != 0)71
72 //set() may affect EGL state by calling eglSwapBuffers.
73 //HWC 1.0 is the only version of HWC that can do this.
74 hwc_display_contents_1_t* displays[num_displays] {display_list.get()};
75 rc = hwc_device->set(hwc_device.get(), num_displays, displays);
76 }
77
78 if ((rc != 0) || (!display_list))
67 {79 {
68 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()"));80 BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()"));
69 }81 }
7082
=== modified file 'src/platform/graphics/android/hwc_fb_device.h'
--- src/platform/graphics/android/hwc_fb_device.h 2014-01-23 18:01:19 +0000
+++ src/platform/graphics/android/hwc_fb_device.h 2014-03-06 14:19:43 +0000
@@ -45,6 +45,7 @@
4545
46private:46private:
47 std::shared_ptr<framebuffer_device_t> const fb_device;47 std::shared_ptr<framebuffer_device_t> const fb_device;
48 static int const num_displays{1};
48 LayerList layer_list;49 LayerList layer_list;
49};50};
5051
5152
=== modified file 'src/platform/graphics/android/hwc_layerlist.cpp'
--- src/platform/graphics/android/hwc_layerlist.cpp 2014-01-23 18:01:19 +0000
+++ src/platform/graphics/android/hwc_layerlist.cpp 2014-03-06 14:19:43 +0000
@@ -16,6 +16,8 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#include "mir/graphics/renderable.h"
20#include "mir/graphics/buffer.h"
19#include "mir/graphics/android/sync_fence.h"21#include "mir/graphics/android/sync_fence.h"
20#include "mir/graphics/android/native_buffer.h"22#include "mir/graphics/android/native_buffer.h"
21#include "hwc_layerlist.h"23#include "hwc_layerlist.h"
@@ -26,52 +28,124 @@
26namespace mga=mir::graphics::android;28namespace mga=mir::graphics::android;
27namespace geom=mir::geometry;29namespace geom=mir::geometry;
2830
29mga::LayerList::LayerList(std::initializer_list<HWCLayer> const& layer_list)31namespace
30{32{
31 auto struct_size = sizeof(hwc_display_contents_1_t) + sizeof(hwc_layer_1_t)*(layer_list.size());33std::shared_ptr<hwc_display_contents_1_t> generate_hwc_list(size_t needed_size)
32 hwc_representation = std::shared_ptr<hwc_display_contents_1_t>(34{
35 /* hwc layer list uses hwLayers[0] at the end of the struct */
36 auto struct_size = sizeof(hwc_display_contents_1_t) + sizeof(hwc_layer_1_t)*(needed_size);
37 auto new_hwc_representation = std::shared_ptr<hwc_display_contents_1_t>(
33 static_cast<hwc_display_contents_1_t*>( ::operator new(struct_size)));38 static_cast<hwc_display_contents_1_t*>( ::operator new(struct_size)));
3439
35 auto i = 0u;40 new_hwc_representation->numHwLayers = needed_size;
36 for(auto& layer : layer_list)41 new_hwc_representation->retireFenceFd = -1;
37 {42 new_hwc_representation->flags = HWC_GEOMETRY_CHANGED;
38 hwc_representation->hwLayers[i++] = layer;
39 }
40 hwc_representation->numHwLayers = layer_list.size();
41 hwc_representation->retireFenceFd = -1;
42 hwc_representation->flags = HWC_GEOMETRY_CHANGED;
4343
44 //aosp exynos hwc in particular, checks that these fields are non-null in hwc1.1, although44 //aosp exynos hwc in particular, checks that these fields are non-null in hwc1.1, although
45 //these fields are deprecated in hwc1.1 and later.45 //these fields are deprecated in hwc1.1 and later.
46 hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF);46 static int fake_egl_values = 0;
47 hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE);47 new_hwc_representation->dpy = &fake_egl_values;
4848 new_hwc_representation->sur = &fake_egl_values;
49}49
5050 return new_hwc_representation;
51void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer)51}
52{52}
53 if (hwc_representation->numHwLayers == 2)53
54 {54void mga::LayerListBase::update_representation(size_t needed_size)
55 if (hwc_representation->hwLayers[0].flags == HWC_SKIP_LAYER)55{
56 {56 std::shared_ptr<hwc_display_contents_1_t> new_hwc_representation;
57 hwc_representation->hwLayers[0] = mga::ForceGLLayer(*native_buffer);57 std::list<HWCLayer> new_layers;
58 }58
5959 if (hwc_representation->numHwLayers != needed_size)
60 if (hwc_representation->hwLayers[1].compositionType == HWC_FRAMEBUFFER_TARGET)60 {
61 {61 new_hwc_representation = generate_hwc_list(needed_size);
62 hwc_representation->hwLayers[1] = mga::FramebufferLayer(*native_buffer);62 }
63 hwc_representation->hwLayers[1].acquireFenceFd = native_buffer->copy_fence();63 else
64 }64 {
65 }65 new_hwc_representation = hwc_representation;
66}66 }
6767
68mga::NativeFence mga::LayerList::framebuffer_fence()68 for (auto i = 0u; i < needed_size; i++)
69{69 {
70 auto fb_position = hwc_representation->numHwLayers - 1;70 new_layers.emplace_back(mga::HWCLayer(new_hwc_representation, i));
71 return hwc_representation->hwLayers[fb_position].releaseFenceFd;71 }
72}72
7373 std::swap(new_layers, layers);
74hwc_display_contents_1_t* mga::LayerList::native_list() const74 hwc_representation = new_hwc_representation;
75{75}
76 return hwc_representation.get();76
77std::weak_ptr<hwc_display_contents_1_t> mga::LayerListBase::native_list()
78{
79 return hwc_representation;
80}
81
82mga::NativeFence mga::LayerListBase::retirement_fence()
83{
84 return hwc_representation->retireFenceFd;
85}
86
87mga::LayerListBase::LayerListBase(size_t initial_list_size)
88 : hwc_representation{generate_hwc_list(initial_list_size)}
89{
90 update_representation(initial_list_size);
91}
92
93mga::LayerList::LayerList()
94 : LayerListBase{1}
95{
96 layers.back().set_layer_type(mga::LayerType::skip);
97}
98
99mga::FBTargetLayerList::FBTargetLayerList()
100 : LayerListBase{2}
101{
102 layers.front().set_layer_type(mga::LayerType::skip);
103 layers.back().set_layer_type(mga::LayerType::framebuffer_target);
104}
105
106void mga::FBTargetLayerList::reset_composition_layers()
107{
108 update_representation(2);
109
110 layers.front().set_layer_type(mga::LayerType::skip);
111 layers.back().set_layer_type(mga::LayerType::framebuffer_target);
112
113 skip_layers_present = true;
114}
115
116void mga::FBTargetLayerList::set_composition_layers(std::list<std::shared_ptr<graphics::Renderable>> const& list)
117{
118 auto const needed_size = list.size() + 1;
119 update_representation(needed_size);
120
121 auto layers_it = layers.begin();
122 for(auto const& renderable : list)
123 {
124 layers_it->set_layer_type(mga::LayerType::gl_rendered);
125 layers_it->set_render_parameters(renderable->screen_position(), renderable->alpha_enabled());
126 layers_it->set_buffer(*renderable->buffer());
127 layers_it++;
128 }
129
130 layers_it->set_layer_type(mga::LayerType::framebuffer_target);
131 skip_layers_present = false;
132}
133
134
135void mga::FBTargetLayerList::set_fb_target(mg::Buffer const& buffer)
136{
137 geom::Rectangle const disp_frame{{0,0}, {buffer.size()}};
138 if (skip_layers_present)
139 {
140 layers.front().set_render_parameters(disp_frame, false);
141 layers.front().set_buffer(buffer);
142 }
143
144 layers.back().set_render_parameters(disp_frame, false);
145 layers.back().set_buffer(buffer);
146}
147
148mga::NativeFence mga::FBTargetLayerList::fb_target_fence()
149{
150 return layers.back().release_fence();
77}151}
78152
=== modified file 'src/platform/graphics/android/hwc_layerlist.h'
--- src/platform/graphics/android/hwc_layerlist.h 2014-01-23 18:01:19 +0000
+++ src/platform/graphics/android/hwc_layerlist.h 2014-03-06 14:19:43 +0000
@@ -26,32 +26,57 @@
26#include <memory>26#include <memory>
27#include <vector>27#include <vector>
28#include <initializer_list>28#include <initializer_list>
29#include <list>
2930
30namespace mir31namespace mir
31{32{
32namespace graphics33namespace graphics
33{34{
3435
35class NativeBuffer;36class Renderable;
36class Buffer;37class Buffer;
3738
38namespace android39namespace android
39{40{
4041
41class LayerList42class LayerListBase
42{43{
43public:44public:
44 LayerList(std::initializer_list<HWCLayer> const& layers);45 std::weak_ptr<hwc_display_contents_1_t> native_list();
4546 NativeFence retirement_fence();
46 hwc_display_contents_1_t* native_list() const;47
4748protected:
48 void set_fb_target(std::shared_ptr<NativeBuffer> const&);49 LayerListBase(size_t initial_list_size);
49 NativeFence framebuffer_fence();50
51 void update_representation(size_t needed_size);
52 std::list<HWCLayer> layers;
5053
51private:54private:
55 LayerListBase& operator=(LayerListBase const&) = delete;
56 LayerListBase(LayerListBase const&) = delete;
57
52 std::shared_ptr<hwc_display_contents_1_t> hwc_representation;58 std::shared_ptr<hwc_display_contents_1_t> hwc_representation;
53};59};
5460
61class LayerList : public LayerListBase
62{
63public:
64 LayerList();
65};
66
67class FBTargetLayerList : public LayerListBase
68{
69public:
70 FBTargetLayerList();
71 void set_composition_layers(std::list<std::shared_ptr<graphics::Renderable>> const& list);
72 void reset_composition_layers();
73 NativeFence fb_target_fence();
74 void set_fb_target(Buffer const&);
75
76private:
77 bool skip_layers_present{true};
78};
79
55}80}
56}81}
57}82}
5883
=== modified file 'src/platform/graphics/android/hwc_layers.cpp'
--- src/platform/graphics/android/hwc_layers.cpp 2014-02-06 13:30:26 +0000
+++ src/platform/graphics/android/hwc_layers.cpp 2014-03-06 14:19:43 +0000
@@ -22,55 +22,101 @@
22#include "mir/graphics/android/native_buffer.h"22#include "mir/graphics/android/native_buffer.h"
23#include "hwc_layerlist.h"23#include "hwc_layerlist.h"
2424
25#include <boost/throw_exception.hpp>
26#include <stdexcept>
25#include <cstring>27#include <cstring>
2628
27namespace mg=mir::graphics;29namespace mg=mir::graphics;
28namespace mga=mir::graphics::android;30namespace mga=mir::graphics::android;
29namespace geom=mir::geometry;31namespace geom=mir::geometry;
3032
31mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer)33mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer && other)
32{34{
33 memcpy(static_cast<void*>(this),35 hwc_layer = other.hwc_layer;
34 static_cast<void const*>(&layer),36 hwc_list = std::move(other.hwc_list);
35 sizeof(HWCLayer));37 visible_rect = std::move(other.visible_rect);
36 this->visibleRegionScreen = {1, &this->visible_rect};
37 return *this;38 return *this;
38}39}
3940
40mga::HWCLayer::HWCLayer(HWCLayer const& layer)41mga::HWCLayer::HWCLayer(HWCLayer && other)
41{42 : hwc_layer(std::move(other.hwc_layer)),
42 memcpy(static_cast<void*>(this),43 hwc_list(std::move(other.hwc_list)),
43 static_cast<void const*>(&layer),44 visible_rect(std::move(other.visible_rect))
44 sizeof(HWCLayer));45{
45 this->visibleRegionScreen = {1, &this->visible_rect};46}
47
48mga::HWCLayer::HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index)
49 : hwc_layer(&list->hwLayers[layer_index]),
50 hwc_list(list)
51{
52 memset(hwc_layer, 0, sizeof(hwc_layer_1_t));
53 memset(&visible_rect, 0, sizeof(hwc_rect_t));
54
55 hwc_layer->hints = 0;
56 hwc_layer->transform = 0;
57 hwc_layer->acquireFenceFd = -1;
58 hwc_layer->releaseFenceFd = -1;
59 hwc_layer->blending = HWC_BLENDING_NONE;
60
61 hwc_layer->visibleRegionScreen.numRects=1;
62 hwc_layer->visibleRegionScreen.rects= &visible_rect;
46}63}
4764
48mga::HWCLayer::HWCLayer(65mga::HWCLayer::HWCLayer(
49 int type,66 LayerType type,
50 buffer_handle_t buffer_handle,67 geometry::Rectangle position,
51 geom::Rectangle position,68 bool alpha_enabled,
52 geom::Size buffer_size,69 std::shared_ptr<hwc_display_contents_1_t> list,
53 bool skip, bool alpha)70 size_t layer_index)
54{71 : HWCLayer(list, layer_index)
55 (skip) ? flags = HWC_SKIP_LAYER : flags = 0;72{
56 (alpha) ? blending = HWC_BLENDING_COVERAGE : blending = HWC_BLENDING_NONE;73 set_layer_type(type);
57 compositionType = type;74 set_render_parameters(position, alpha_enabled);
58 hints = 0;75}
59 transform = 0;76
60 //TODO: acquireFenceFd should be buffer.fence()77bool mga::HWCLayer::needs_gl_render() const
61 acquireFenceFd = -1;78{
62 releaseFenceFd = -1;79 return ((hwc_layer->compositionType == HWC_FRAMEBUFFER) || (hwc_layer->flags == HWC_SKIP_LAYER));
6380}
64 sourceCrop = 81
82mga::NativeFence mga::HWCLayer::release_fence() const
83{
84 return hwc_layer->releaseFenceFd;
85}
86
87void mga::HWCLayer::set_layer_type(LayerType type)
88{
89 hwc_layer->flags = 0;
90 switch(type)
65 {91 {
66 0, 0,92 case mga::LayerType::skip:
67 buffer_size.width.as_int(),93 hwc_layer->compositionType = HWC_FRAMEBUFFER;
68 buffer_size.height.as_int()94 hwc_layer->flags = HWC_SKIP_LAYER;
69 };95 break;
7096
97 case mga::LayerType::gl_rendered:
98 hwc_layer->compositionType = HWC_FRAMEBUFFER;
99 break;
100
101 case mga::LayerType::framebuffer_target:
102 hwc_layer->compositionType = HWC_FRAMEBUFFER_TARGET;
103 break;
104
105 case mga::LayerType::overlay: //driver is the only one who can set to overlay
106 default:
107 BOOST_THROW_EXCEPTION(std::logic_error("invalid layer type"));
108 }
109}
110
111void mga::HWCLayer::set_render_parameters(geometry::Rectangle position, bool alpha_enabled)
112{
113 if (alpha_enabled)
114 hwc_layer->blending = HWC_BLENDING_COVERAGE;
115 else
116 hwc_layer->blending = HWC_BLENDING_NONE;
71117
72 /* note, if the sourceCrop and DisplayFrame sizes differ, the output will be linearly scaled */118 /* note, if the sourceCrop and DisplayFrame sizes differ, the output will be linearly scaled */
73 displayFrame = 119 hwc_layer->displayFrame =
74 {120 {
75 position.top_left.x.as_int(),121 position.top_left.x.as_int(),
76 position.top_left.y.as_int(),122 position.top_left.y.as_int(),
@@ -78,65 +124,21 @@
78 position.size.height.as_int()124 position.size.height.as_int()
79 };125 };
80126
81 visible_rect = displayFrame;127 visible_rect = hwc_layer->displayFrame;
82 visibleRegionScreen.numRects=1;128}
83 visibleRegionScreen.rects= &visible_rect;129
84130void mga::HWCLayer::set_buffer(Buffer const& buffer)
85 handle = buffer_handle;131{
86 memset(&reserved, 0, sizeof(reserved));132 auto size = buffer.size();
87}133 auto native_buffer = buffer.native_buffer_handle();
88134 hwc_layer->handle = native_buffer->handle();
89bool mga::HWCLayer::needs_gl_render() const135 if (!needs_gl_render())
90{136 hwc_layer->acquireFenceFd = native_buffer->copy_fence();
91 return ((compositionType == HWC_FRAMEBUFFER) || (flags == HWC_SKIP_LAYER));137 hwc_layer->releaseFenceFd = -1;
92}138 hwc_layer->sourceCrop =
93139 {
94mga::FramebufferLayer::FramebufferLayer()140 0, 0,
95 : HWCLayer(HWC_FRAMEBUFFER_TARGET,141 size.width.as_int(),
96 nullptr,142 size.height.as_int()
97 geom::Rectangle{{0,0}, {0,0}},143 };
98 geom::Size{0,0},
99 false,
100 false)
101{
102}
103
104mga::FramebufferLayer::FramebufferLayer(mg::NativeBuffer const& buffer)
105 : HWCLayer(HWC_FRAMEBUFFER_TARGET,
106 buffer.handle(),
107 geom::Rectangle{{0,0}, {buffer.anwb()->width, buffer.anwb()->height}},
108 geom::Size{buffer.anwb()->width, buffer.anwb()->height},
109 false,
110 false)
111{
112}
113
114mga::ForceGLLayer::ForceGLLayer()
115 : HWCLayer(HWC_FRAMEBUFFER,
116 nullptr,
117 geom::Rectangle{{0,0}, {0,0}},
118 geom::Size{0,0},
119 true,
120 false)
121{
122}
123
124mga::ForceGLLayer::ForceGLLayer(mg::NativeBuffer const& buffer)
125 : HWCLayer(HWC_FRAMEBUFFER,
126 buffer.handle(),
127 geom::Rectangle{{0,0}, {buffer.anwb()->width, buffer.anwb()->height}},
128 geom::Size{buffer.anwb()->width, buffer.anwb()->height},
129 true,
130 false)
131{
132}
133
134mga::CompositionLayer::CompositionLayer(mg::Renderable const& renderable)
135 : HWCLayer(HWC_FRAMEBUFFER,
136 renderable.buffer()->native_buffer_handle()->handle(),
137 renderable.screen_position(),
138 renderable.buffer()->size(),
139 false,
140 renderable.alpha_enabled())
141{
142}144}
143145
=== modified file 'src/platform/graphics/android/hwc_layers.h'
--- src/platform/graphics/android/hwc_layers.h 2014-01-20 22:44:58 +0000
+++ src/platform/graphics/android/hwc_layers.h 2014-03-06 14:19:43 +0000
@@ -34,52 +34,46 @@
34{34{
3535
36class Renderable;36class Renderable;
37class NativeBuffer;37class Buffer;
3838
39namespace android39namespace android
40{40{
4141
42struct HWCLayer : public hwc_layer_142enum LayerType
43{43{
44 virtual ~HWCLayer() = default;44 gl_rendered,
4545 overlay,
46 HWCLayer& operator=(HWCLayer const& layer);46 framebuffer_target,
47 HWCLayer(HWCLayer const& layer);47 skip
4848};
49
50class HWCLayer
51{
52public:
53 HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index);
54 HWCLayer(LayerType,
55 geometry::Rectangle screen_position,
56 bool alpha_enabled,
57 std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index);
58
59 HWCLayer& operator=(HWCLayer && layer);
60 HWCLayer(HWCLayer && layer);
61
62 HWCLayer& operator=(HWCLayer const& layer) = delete;
63 HWCLayer(HWCLayer const& layer) = delete;
64
65 void set_layer_type(LayerType type);
66 void set_render_parameters(geometry::Rectangle screen_position, bool alpha_enabled);
67 void set_buffer(Buffer const&);
68
69 NativeFence release_fence() const;
49 bool needs_gl_render() const;70 bool needs_gl_render() const;
5071
51protected:72private:
52 HWCLayer(73 hwc_layer_1_t* hwc_layer;
53 int type,74 std::shared_ptr<hwc_display_contents_1_t> hwc_list;
54 buffer_handle_t handle,
55 geometry::Rectangle position,
56 geometry::Size buffer_size,
57 bool skip, bool alpha
58 );
59
60 hwc_rect_t visible_rect;75 hwc_rect_t visible_rect;
61};76};
62
63//layer could be GLES rendered, or overlaid by hwc.
64struct CompositionLayer : public HWCLayer
65{
66 CompositionLayer(graphics::Renderable const& renderable);
67};
68
69//used during compositions when we want to restrict to GLES render only
70struct ForceGLLayer : public HWCLayer
71{
72 ForceGLLayer();
73 ForceGLLayer(NativeBuffer const&);
74};
75
76//used as the target (lowest layer, fb)
77struct FramebufferLayer : public HWCLayer
78{
79 FramebufferLayer();
80 FramebufferLayer(NativeBuffer const&);
81};
82
83}77}
84}78}
85}79}
8680
=== modified file 'src/platform/graphics/android/output_builder.cpp'
--- src/platform/graphics/android/output_builder.cpp 2014-02-04 23:20:36 +0000
+++ src/platform/graphics/android/output_builder.cpp 2014-03-06 14:19:43 +0000
@@ -63,7 +63,8 @@
63 return framebuffers->fb_format();63 return framebuffers->fb_format();
64}64}
6565
66std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device()66std::unique_ptr<mga::ConfigurableDisplayBuffer> mga::OutputBuilder::create_display_buffer(
67 GLContext const& gl_context)
67{68{
68 std::shared_ptr<mga::DisplayDevice> device;69 std::shared_ptr<mga::DisplayDevice> device;
69 if (force_backup_display)70 if (force_backup_display)
@@ -98,14 +99,7 @@
98 } 99 }
99 }100 }
100101
101 return device;
102}
103
104std::unique_ptr<mg::DisplayBuffer> mga::OutputBuilder::create_display_buffer(
105 std::shared_ptr<DisplayDevice> const& display_device,
106 GLContext const& gl_context)
107{
108 auto native_window = res_factory->create_native_window(framebuffers);102 auto native_window = res_factory->create_native_window(framebuffers);
109 return std::unique_ptr<mg::DisplayBuffer>(103 return std::unique_ptr<mga::DisplayBuffer>(
110 new DisplayBuffer(framebuffers, display_device, native_window, gl_context));104 new DisplayBuffer(framebuffers, device, native_window, gl_context));
111}105}
112106
=== modified file 'src/platform/graphics/android/output_builder.h'
--- src/platform/graphics/android/output_builder.h 2014-02-04 23:20:36 +0000
+++ src/platform/graphics/android/output_builder.h 2014-03-06 14:19:43 +0000
@@ -33,6 +33,7 @@
33class FramebufferBundle;33class FramebufferBundle;
34class DisplayResourceFactory;34class DisplayResourceFactory;
35class GraphicBufferAllocator;35class GraphicBufferAllocator;
36class DisplayDevice;
3637
37class OutputBuilder : public DisplayBuilder38class OutputBuilder : public DisplayBuilder
38{39{
@@ -43,9 +44,7 @@
43 std::shared_ptr<DisplayReport> const& display_report);44 std::shared_ptr<DisplayReport> const& display_report);
4445
45 MirPixelFormat display_format();46 MirPixelFormat display_format();
46 std::shared_ptr<DisplayDevice> create_display_device();47 std::unique_ptr<ConfigurableDisplayBuffer> create_display_buffer(
47 std::unique_ptr<graphics::DisplayBuffer> create_display_buffer(
48 std::shared_ptr<DisplayDevice> const& display_device,
49 GLContext const& gl_context);48 GLContext const& gl_context);
5049
51private:50private:
5251
=== modified file 'src/platform/graphics/mesa/CMakeLists.txt'
--- src/platform/graphics/mesa/CMakeLists.txt 2014-01-22 08:32:55 +0000
+++ src/platform/graphics/mesa/CMakeLists.txt 2014-03-06 14:19:43 +0000
@@ -9,10 +9,11 @@
9# gbm.h and drm.h have trailing commas at the end of enum definitions9# gbm.h and drm.h have trailing commas at the end of enum definitions
10# This is valid C99, but g++ 4.4 flags it as an error with -pedantic10# This is valid C99, but g++ 4.4 flags it as an error with -pedantic
11string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})11string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
12add_definitions(-D__GBM__)
1213
1314
14add_library(15add_library(
15 mirplatformgraphics SHARED16 mirplatformgraphicsmesa SHARED
1617
17 platform.cpp18 platform.cpp
18 buffer_allocator.cpp19 buffer_allocator.cpp
@@ -37,8 +38,14 @@
37 shm_buffer.cpp38 shm_buffer.cpp
38)39)
3940
41set_target_properties(
42 mirplatformgraphicsmesa PROPERTIES
43 OUTPUT_NAME mirplatformgraphics
44 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
45)
46
40target_link_libraries(47target_link_libraries(
41 mirplatformgraphics48 mirplatformgraphicsmesa
42 mirplatform49 mirplatform
4350
44 ${DRM_LDFLAGS} ${DRM_LIBRARIES}51 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -47,4 +54,13 @@
47 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}54 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
48)55)
4956
50install(TARGETS mirplatformgraphics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})57if (MIR_TEST_PLATFORM STREQUAL "mesa")
58 add_custom_command(TARGET mirplatformgraphicsmesa
59 POST_BUILD
60 COMMAND ${CMAKE_COMMAND} -E remove libmirplatformgraphics.so
61 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> libmirplatformgraphics.so
62 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
63 )
64endif()
65
66install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/mesa)
5167
=== modified file 'src/platform/graphics/mesa/display.cpp'
--- src/platform/graphics/mesa/display.cpp 2014-01-31 07:48:24 +0000
+++ src/platform/graphics/mesa/display.cpp 2014-03-06 14:19:43 +0000
@@ -134,6 +134,17 @@
134 auto const& kms_conf = dynamic_cast<RealKMSDisplayConfiguration const&>(conf);134 auto const& kms_conf = dynamic_cast<RealKMSDisplayConfiguration const&>(conf);
135 std::vector<std::unique_ptr<DisplayBuffer>> display_buffers_new;135 std::vector<std::unique_ptr<DisplayBuffer>> display_buffers_new;
136136
137 /*
138 * Notice for a little while here we will have duplicate
139 * DisplayBuffers attached to each output, and the display_buffers_new
140 * will take over the outputs before the old display_buffers are
141 * destroyed. So to avoid page flipping confusion in-between, make
142 * sure we wait for all pending page flips to finish before the
143 * display_buffers_new are created and take control of the outputs.
144 */
145 for (auto& db : display_buffers)
146 db->wait_for_page_flip();
147
137 /* Reset the state of all outputs */148 /* Reset the state of all outputs */
138 kms_conf.for_each_output([&](DisplayConfigurationOutput const& conf_output)149 kms_conf.for_each_output([&](DisplayConfigurationOutput const& conf_output)
139 {150 {
140151
=== modified file 'src/platform/graphics/mesa/display_buffer.cpp'
--- src/platform/graphics/mesa/display_buffer.cpp 2014-01-23 17:26:51 +0000
+++ src/platform/graphics/mesa/display_buffer.cpp 2014-03-06 14:19:43 +0000
@@ -103,6 +103,7 @@
103 MirOrientation rot,103 MirOrientation rot,
104 EGLContext shared_context)104 EGLContext shared_context)
105 : last_flipped_bufobj{nullptr},105 : last_flipped_bufobj{nullptr},
106 scheduled_bufobj{nullptr},
106 platform(platform),107 platform(platform),
107 listener(listener),108 listener(listener),
108 drm(platform->drm),109 drm(platform->drm),
@@ -110,7 +111,8 @@
110 surface_gbm{std::move(surface_gbm_param)},111 surface_gbm{std::move(surface_gbm_param)},
111 area(area),112 area(area),
112 rotation(rot),113 rotation(rot),
113 needs_set_crtc{false}114 needs_set_crtc{false},
115 page_flips_pending{false}
114{116{
115 uint32_t area_width = area.size.width.as_uint32_t();117 uint32_t area_width = area.size.width.as_uint32_t();
116 uint32_t area_height = area.size.height.as_uint32_t();118 uint32_t area_height = area.size.height.as_uint32_t();
@@ -142,13 +144,13 @@
142144
143 listener->report_successful_egl_buffer_swap_on_construction();145 listener->report_successful_egl_buffer_swap_on_construction();
144146
145 last_flipped_bufobj = get_front_buffer_object();147 scheduled_bufobj = get_front_buffer_object();
146 if (!last_flipped_bufobj)148 if (!scheduled_bufobj)
147 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to get frontbuffer"));149 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to get frontbuffer"));
148150
149 for (auto& output : outputs)151 for (auto& output : outputs)
150 {152 {
151 if (!output->set_crtc(last_flipped_bufobj->get_drm_fb_id()))153 if (!output->set_crtc(scheduled_bufobj->get_drm_fb_id()))
152 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to set DRM crtc"));154 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to set DRM crtc"));
153 }155 }
154156
@@ -171,6 +173,9 @@
171 */173 */
172 if (last_flipped_bufobj)174 if (last_flipped_bufobj)
173 last_flipped_bufobj->release();175 last_flipped_bufobj->release();
176
177 if (scheduled_bufobj)
178 scheduled_bufobj->release();
174}179}
175180
176geom::Rectangle mgm::DisplayBuffer::view_area() const181geom::Rectangle mgm::DisplayBuffer::view_area() const
@@ -206,6 +211,31 @@
206 std::shared_ptr<graphics::Buffer> bypass_buf)211 std::shared_ptr<graphics::Buffer> bypass_buf)
207{212{
208 /*213 /*
214 * If the last frame was composited then we haven't waited for the
215 * page flips yet. This is good because it maximizes the time available
216 * to spend rendering each frame. However we have to wait here, because
217 * it will be unsafe to swap_buffers before guaranteeing the previous
218 * page flip finished.
219 */
220 wait_for_page_flip();
221
222 /*
223 * Switching from bypass to compositing? Now is the earliest safe time
224 * we can unreference the bypass buffer...
225 */
226 if (scheduled_bufobj)
227 last_flipped_bypass_buf = nullptr;
228 /*
229 * Release the last flipped buffer object (which is not displayed anymore)
230 * to make it available for future rendering.
231 */
232 if (last_flipped_bufobj)
233 last_flipped_bufobj->release();
234
235 last_flipped_bufobj = scheduled_bufobj;
236 scheduled_bufobj = nullptr;
237
238 /*
209 * Bring the back buffer to the front and get the buffer object239 * Bring the back buffer to the front and get the buffer object
210 * corresponding to the front buffer.240 * corresponding to the front buffer.
211 */241 */
@@ -234,7 +264,7 @@
234 * If the flip fails, release the buffer object to make it available264 * If the flip fails, release the buffer object to make it available
235 * for future rendering.265 * for future rendering.
236 */266 */
237 if (!needs_set_crtc && !schedule_and_wait_for_page_flip(bufobj))267 if (!needs_set_crtc && !schedule_page_flip(bufobj))
238 {268 {
239 if (!bypass_buf)269 if (!bypass_buf)
240 bufobj->release();270 bufobj->release();
@@ -250,22 +280,32 @@
250 needs_set_crtc = false;280 needs_set_crtc = false;
251 }281 }
252282
253 /*283 if (bypass_buf)
254 * Release the last flipped buffer object (which is not displayed anymore)284 {
255 * to make it available for future rendering.285 /*
256 */286 * For composited frames we defer wait_for_page_flip till just before
257 if (last_flipped_bufobj)287 * the next frame, but not for bypass frames. Deferring the flip of
258 last_flipped_bufobj->release();288 * bypass frames would increase the time we held
259289 * last_flipped_bypass_buf unacceptably, resulting in client stuttering
260 last_flipped_bufobj = bypass_buf ? nullptr : bufobj;290 * unless we allocate quad-buffers (which I'm trying to avoid).
261291 * Also, bypass does not need the deferred page flip because it has
262 /*292 * no compositing/rendering step for which to save time for.
263 * Keep a reference to the buffer being bypassed for the entire duration293 */
264 * of the frame. This ensures the buffer doesn't get reused by the client294 wait_for_page_flip();
265 * prematurely, which would be seen as tearing.295 scheduled_bufobj = nullptr;
266 * If not bypassing, then bypass_buf will be nullptr.296
267 */297 /*
268 last_flipped_bypass_buf = bypass_buf;298 * Keep a reference to the buffer being bypassed for the entire
299 * duration of the frame. This ensures the buffer doesn't get reused by
300 * 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