Mir

Merge lp:mir/0.9 into lp:mir/ubuntu

Proposed by Alberto Aguirre
Status: Merged
Approved by: Alberto Aguirre
Approved revision: 2077
Merged at revision: 1217
Proposed branch: lp:mir/0.9
Merge into: lp:mir/ubuntu
Diff against target: 29325 lines (+12155/-6466)
446 files modified
3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+6/-5)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+2/-3)
CMakeLists.txt (+2/-1)
benchmarks/CMakeLists.txt (+8/-9)
benchmarks/android-input/CMakeLists.txt (+2/-0)
benchmarks/android-input/input_reader_perf.cpp (+3/-3)
benchmarks/frame-uniformity/CMakeLists.txt (+45/-0)
benchmarks/frame-uniformity/README.txt (+13/-0)
benchmarks/frame-uniformity/frame_uniformity_test.cpp (+52/-0)
benchmarks/frame-uniformity/frame_uniformity_test.h (+64/-0)
benchmarks/frame-uniformity/main.cpp (+143/-0)
benchmarks/frame-uniformity/touch_measuring_client.cpp (+115/-0)
benchmarks/frame-uniformity/touch_measuring_client.h (+52/-0)
benchmarks/frame-uniformity/touch_producing_server.cpp (+114/-0)
benchmarks/frame-uniformity/touch_producing_server.h (+64/-0)
benchmarks/frame-uniformity/touch_samples.cpp (+57/-0)
benchmarks/frame-uniformity/touch_samples.h (+60/-0)
benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp (+145/-0)
benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h (+48/-0)
client-ABI-sha1sums (+6/-7)
cmake/ABICheck.cmake (+4/-0)
cmake/MirCommon.cmake (+16/-1)
cmake/src/mir/mir_discover_gtest_tests.cpp (+19/-1)
common-ABI-sha1sums (+3/-3)
debian/changelog (+54/-0)
debian/control (+148/-56)
debian/libmirclient-debug-extension-dev.install (+3/-0)
debian/libmirclient-debug-extension1.install (+1/-0)
debian/libmirclient-dev.install (+1/-1)
debian/libmircommon3.install (+1/-1)
debian/libmirplatform4.install (+1/-1)
debian/libmirprotobuf0.install (+1/-0)
debian/libmirserver27.install (+1/-1)
debian/mir-test-tools.install (+1/-0)
debian/rules (+10/-1)
doc/building_source_for_android.md (+2/-2)
doc/demo_shell_controls.md (+2/-1)
doc/mainpage.md (+6/-0)
doc/setup_kvm_for_mir.md (+70/-0)
examples/CMakeLists.txt (+5/-19)
examples/basic_server.cpp (+121/-11)
examples/basic_server_configuration.cpp (+0/-62)
examples/basic_server_configuration.h (+0/-43)
examples/demo_input_filter.cpp (+28/-47)
examples/example_display_configuration_policy.cpp (+140/-0)
examples/example_display_configuration_policy.h (+72/-0)
examples/example_input_event_filter.cpp (+45/-0)
examples/example_input_event_filter.h (+43/-0)
examples/glog_logger.cpp (+6/-4)
examples/glog_logger.h (+5/-5)
examples/minimal_server.cpp (+9/-8)
examples/pixel_format_selector.cpp (+0/-72)
examples/pixel_format_selector.h (+0/-51)
examples/progressbar.c (+3/-1)
examples/render_overlays.cpp (+20/-14)
examples/render_to_fb.cpp (+19/-13)
examples/translucent_server.cpp (+0/-38)
examples/translucent_server_configuration.cpp (+0/-45)
examples/translucent_server_configuration.h (+0/-43)
include/client/mir_toolkit/debug/surface.h (+20/-0)
include/client/mir_toolkit/mir_connection.h (+3/-1)
include/client/mir_toolkit/mir_prompt_session.h (+2/-1)
include/client/mir_toolkit/mir_surface.h (+3/-1)
include/common/mir/time/types.h (+35/-0)
include/common/mir_toolkit/common.h (+9/-5)
include/common/mir_toolkit/mesa/native_display.h (+3/-3)
include/platform/mir/graphics/native_platform.h (+7/-7)
include/platform/mir/graphics/platform.h (+1/-6)
include/platform/mir/graphics/platform_ipc_operations.h (+10/-1)
include/platform/mir/graphics/platform_ipc_package.h (+0/-1)
include/platform/mir/options/configuration.h (+2/-5)
include/server/mir/compositor/display_buffer_compositor.h (+3/-1)
include/server/mir/compositor/scene_element.h (+2/-3)
include/server/mir/default_server_configuration.h (+27/-9)
include/server/mir/input/input_configuration.h (+0/-46)
include/server/mir/report_exception.h (+6/-0)
include/server/mir/run_mir.h (+11/-3)
include/server/mir/scene/coordinate_translator.h (+66/-0)
include/server/mir/scene/null_surface_observer.h (+9/-9)
include/server/mir/scene/surface.h (+4/-4)
include/server/mir/server.h (+340/-0)
include/server/mir/server_configuration.h (+0/-1)
include/server/mir/shell/session_coordinator_wrapper.h (+1/-1)
include/server/mir/time/alarm.h (+1/-1)
platform-ABI-sha1sums (+8/-8)
playground/CMakeLists.txt (+5/-0)
playground/demo-inprocess-surface-client/CMakeLists.txt (+1/-0)
playground/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp (+1/-1)
playground/demo-shell/CMakeLists.txt (+1/-0)
playground/demo-shell/demo_compositor.cpp (+23/-10)
playground/demo-shell/demo_compositor.h (+1/-3)
playground/demo-shell/demo_renderer.cpp (+3/-9)
playground/demo-shell/demo_renderer.h (+0/-1)
playground/demo-shell/demo_shell.cpp (+3/-7)
playground/demo-shell/window_manager.cpp (+34/-2)
playground/render_surfaces.cpp (+22/-51)
playground/server_configuration.cpp (+8/-116)
server-ABI-sha1sums (+22/-25)
src/CMakeLists.txt (+1/-0)
src/client/CMakeLists.txt (+56/-11)
src/client/android/CMakeLists.txt (+2/-4)
src/client/android/buffer.cpp (+24/-1)
src/client/android/buffer.h (+7/-6)
src/client/android/gralloc_registrar.cpp (+31/-10)
src/client/client_buffer.h (+1/-0)
src/client/default_connection_configuration.h (+9/-9)
src/client/logging/input_receiver_report.cpp (+1/-1)
src/client/logging/perf_report.cpp (+4/-3)
src/client/logging/rpc_report.cpp (+13/-13)
src/client/mesa/CMakeLists.txt (+2/-5)
src/client/mesa/client_buffer.cpp (+6/-0)
src/client/mesa/client_buffer.h (+1/-0)
src/client/mir_connection.cpp (+37/-20)
src/client/mir_connection.h (+2/-0)
src/client/mir_connection_api.cpp (+14/-6)
src/client/mir_connection_api.h (+5/-1)
src/client/mir_debug_api.cpp (+38/-0)
src/client/mir_prompt_session_api.cpp (+2/-2)
src/client/mir_surface.cpp (+121/-21)
src/client/mir_surface.h (+19/-1)
src/client/mir_surface_api.cpp (+11/-20)
src/client/mirclient-debug-extension.pc.in (+11/-0)
src/client/mirclient.pc.in (+5/-3)
src/client/perf_report.h (+1/-1)
src/client/periodic_perf_report.cpp (+1/-1)
src/client/rpc/mir_basic_rpc_channel.cpp (+4/-1)
src/client/rpc/mir_basic_rpc_channel.h (+2/-1)
src/client/rpc/mir_protobuf_rpc_channel.cpp (+15/-6)
src/client/rpc/mir_protobuf_rpc_channel.h (+3/-2)
src/client/rpc/stream_socket_transport.cpp (+6/-1)
src/client/rpc/stream_socket_transport.h (+1/-1)
src/client/rpc/stream_transport.h (+3/-2)
src/client/symbols-debug.map (+5/-0)
src/common/CMakeLists.txt (+1/-2)
src/common/fd/fd_socket_transmission.cpp (+8/-8)
src/common/input/android/android_input_receiver.cpp (+4/-1)
src/common/logging/CMakeLists.txt (+1/-0)
src/common/logging/dumb_console_logger.cpp (+3/-3)
src/common/logging/logger.cpp (+68/-0)
src/common/logging/shared_library_prober_report.cpp (+4/-4)
src/common/symbols.map (+56/-875)
src/common/time/CMakeLists.txt (+1/-1)
src/common/time/steady_clock.cpp (+9/-2)
src/include/common/mir/basic_observers.h (+2/-95)
src/include/common/mir/fd_socket_transmission.h (+1/-1)
src/include/common/mir/graphics/android/native_buffer.h (+5/-0)
src/include/common/mir/logging/logger.h (+17/-11)
src/include/common/mir/thread_safe_list.h (+186/-0)
src/include/common/mir/time/clock.h (+20/-6)
src/include/common/mir/time/steady_clock.h (+7/-6)
src/include/platform/mir/graphics/buffer_initializer.h (+0/-54)
src/include/platform/mir/graphics/drm_authenticator.h (+0/-43)
src/include/server/mir/asio_main_loop.h (+6/-6)
src/include/server/mir/compositor/buffer_stream.h (+1/-0)
src/include/server/mir/compositor/gl_renderer.h (+3/-2)
src/include/server/mir/compositor/renderer.h (+1/-4)
src/include/server/mir/frontend/message_processor.h (+3/-1)
src/include/server/mir/frontend/unsupported_feature_exception.h (+41/-0)
src/include/server/mir/glib_main_loop.h (+103/-0)
src/include/server/mir/glib_main_loop_sources.h (+122/-0)
src/include/server/mir/input/android/default_android_input_configuration.h (+0/-90)
src/platform/CMakeLists.txt (+1/-1)
src/platform/graphics/CMakeLists.txt (+0/-2)
src/platform/graphics/android/CMakeLists.txt (+2/-4)
src/platform/graphics/android/android_buffer_allocator.cpp (+3/-6)
src/platform/graphics/android/android_graphic_buffer_allocator.h (+1/-4)
src/platform/graphics/android/buffer.h (+4/-4)
src/platform/graphics/android/display.h (+9/-9)
src/platform/graphics/android/display_buffer.h (+7/-7)
src/platform/graphics/android/hwc_device.h (+2/-2)
src/platform/graphics/android/hwc_fallback_gl_renderer.cpp (+8/-1)
src/platform/graphics/android/ipc_operations.cpp (+19/-2)
src/platform/graphics/android/ipc_operations.h (+2/-0)
src/platform/graphics/android/platform.cpp (+9/-15)
src/platform/graphics/android/platform.h (+7/-11)
src/platform/graphics/mesa/CMakeLists.txt (+1/-1)
src/platform/graphics/mesa/anonymous_shm_file.cpp (+14/-14)
src/platform/graphics/mesa/buffer_allocator.cpp (+0/-8)
src/platform/graphics/mesa/buffer_allocator.h (+1/-5)
src/platform/graphics/mesa/cursor.cpp (+18/-11)
src/platform/graphics/mesa/cursor.h (+1/-1)
src/platform/graphics/mesa/display.h (+9/-9)
src/platform/graphics/mesa/display_buffer.cpp (+2/-7)
src/platform/graphics/mesa/display_buffer.h (+5/-5)
src/platform/graphics/mesa/display_helpers.cpp (+3/-3)
src/platform/graphics/mesa/gbm_buffer.h (+7/-7)
src/platform/graphics/mesa/ipc_operations.cpp (+12/-0)
src/platform/graphics/mesa/ipc_operations.h (+3/-0)
src/platform/graphics/mesa/native_platform.cpp (+7/-8)
src/platform/graphics/mesa/native_platform.h (+2/-3)
src/platform/graphics/mesa/platform.cpp (+2/-8)
src/platform/graphics/mesa/platform.h (+5/-11)
src/platform/graphics/mesa/real_kms_display_configuration.h (+3/-3)
src/platform/graphics/mesa/shm_buffer.h (+5/-5)
src/platform/options/default_configuration.cpp (+7/-24)
src/platform/shared_library_loader.cpp (+5/-1)
src/platform/symbols.map (+66/-125)
src/protobuf/CMakeLists.txt (+16/-10)
src/protobuf/mir_protobuf.proto (+17/-0)
src/protobuf/mir_protobuf_wire.proto (+1/-0)
src/server/CMakeLists.txt (+8/-5)
src/server/asio_main_loop.cpp (+4/-3)
src/server/compositor/buffer_bundle.h (+1/-0)
src/server/compositor/buffer_queue.cpp (+11/-0)
src/server/compositor/buffer_queue.h (+2/-0)
src/server/compositor/buffer_stream_surfaces.cpp (+5/-0)
src/server/compositor/buffer_stream_surfaces.h (+1/-0)
src/server/compositor/compositing_screencast.cpp (+26/-2)
src/server/compositor/compositing_screencast.h (+3/-0)
src/server/compositor/default_configuration.cpp (+2/-1)
src/server/compositor/default_display_buffer_compositor.cpp (+19/-21)
src/server/compositor/default_display_buffer_compositor.h (+1/-5)
src/server/compositor/default_display_buffer_compositor_factory.cpp (+5/-9)
src/server/compositor/default_display_buffer_compositor_factory.h (+0/-3)
src/server/compositor/gl_renderer.cpp (+14/-20)
src/server/compositor/multi_threaded_compositor.cpp (+11/-2)
src/server/compositor/screencast_display_buffer.h (+11/-11)
src/server/compositor/temporary_buffers.h (+5/-5)
src/server/default_server_configuration.cpp (+31/-17)
src/server/display_server.cpp (+0/-2)
src/server/frontend/CMakeLists.txt (+1/-0)
src/server/frontend/default_configuration.cpp (+22/-8)
src/server/frontend/default_ipc_factory.cpp (+11/-8)
src/server/frontend/default_ipc_factory.h (+12/-5)
src/server/frontend/message_receiver.h (+2/-0)
src/server/frontend/protobuf_message_processor.cpp (+65/-12)
src/server/frontend/protobuf_message_processor.h (+1/-1)
src/server/frontend/published_socket_connector.cpp (+0/-5)
src/server/frontend/session_mediator.cpp (+46/-26)
src/server/frontend/session_mediator.h (+21/-10)
src/server/frontend/socket_connection.cpp (+8/-1)
src/server/frontend/socket_messenger.cpp (+18/-6)
src/server/frontend/socket_messenger.h (+2/-2)
src/server/frontend/unsupported_coordinate_translator.cpp (+32/-0)
src/server/frontend/unsupported_coordinate_translator.h (+37/-0)
src/server/glib_main_loop.cpp (+306/-0)
src/server/glib_main_loop_sources.cpp (+573/-0)
src/server/graphics/default_configuration.cpp (+48/-16)
src/server/graphics/nested/nested_output.h (+1/-1)
src/server/graphics/nested/nested_platform.cpp (+21/-52)
src/server/graphics/nested/nested_platform.h (+3/-5)
src/server/graphics/offscreen/display.h (+9/-9)
src/server/graphics/offscreen/display_buffer.h (+4/-4)
src/server/graphics/program_factory.h (+1/-1)
src/server/input/CMakeLists.txt (+0/-1)
src/server/input/android/CMakeLists.txt (+0/-1)
src/server/input/android/android_input_dispatcher.cpp (+7/-0)
src/server/input/android/android_input_dispatcher.h (+1/-0)
src/server/input/android/android_input_manager.cpp (+3/-0)
src/server/input/android/default_android_input_configuration.cpp (+0/-123)
src/server/input/default_configuration.cpp (+94/-36)
src/server/input/null_input_configuration.cpp (+0/-27)
src/server/input/null_input_configuration.h (+0/-46)
src/server/input/touchspot_controller.cpp (+6/-6)
src/server/logging/CMakeLists.txt (+0/-15)
src/server/logging/default_configuration.cpp (+0/-48)
src/server/report/logging/compositor_report.cpp (+6/-6)
src/server/report/logging/connector_report.cpp (+8/-8)
src/server/report/logging/display_report.cpp (+12/-12)
src/server/report/logging/input_report.cpp (+8/-8)
src/server/report/logging/message_processor_report.cpp (+8/-8)
src/server/report/logging/scene_report.cpp (+4/-4)
src/server/report/logging/session_mediator_report.cpp (+13/-13)
src/server/report_exception.cpp (+5/-0)
src/server/run_mir.cpp (+25/-9)
src/server/scene/CMakeLists.txt (+1/-0)
src/server/scene/application_session.h (+16/-16)
src/server/scene/basic_surface.cpp (+3/-0)
src/server/scene/basic_surface.h (+10/-10)
src/server/scene/default_configuration.cpp (+11/-0)
src/server/scene/default_coordinate_translator.cpp (+32/-0)
src/server/scene/default_coordinate_translator.h (+37/-0)
src/server/scene/mediating_display_changer.h (+3/-3)
src/server/scene/prompt_session_manager_impl.cpp (+14/-8)
src/server/scene/session_manager.h (+1/-1)
src/server/scene/surface_stack.cpp (+12/-7)
src/server/scene/surface_stack.h (+4/-4)
src/server/server.cpp (+593/-0)
src/server/symbols.map (+100/-374)
src/utils/ping.c (+1/-1)
tests/CMakeLists.txt (+14/-1)
tests/acceptance-tests/CMakeLists.txt (+7/-12)
tests/acceptance-tests/server_configuration_options.cpp (+203/-0)
tests/acceptance-tests/server_configuration_wrapping.cpp (+27/-25)
tests/acceptance-tests/server_signal_handling.cpp (+111/-0)
tests/acceptance-tests/test_client_authorization.cpp (+47/-91)
tests/acceptance-tests/test_client_cursor_api.cpp (+1/-1)
tests/acceptance-tests/test_client_input.cpp (+34/-4)
tests/acceptance-tests/test_client_library.cpp (+5/-48)
tests/acceptance-tests/test_client_library_drm.cpp (+2/-3)
tests/acceptance-tests/test_client_library_errors.cpp (+338/-0)
tests/acceptance-tests/test_client_library_old.cpp (+16/-20)
tests/acceptance-tests/test_client_surface_events.cpp (+1/-1)
tests/acceptance-tests/test_client_surface_swap_buffers.cpp (+45/-33)
tests/acceptance-tests/test_client_surfaces.cpp (+1/-1)
tests/acceptance-tests/test_client_with_custom_display_config_deadlock.cpp (+2/-18)
tests/acceptance-tests/test_command_line_handling.cpp (+16/-21)
tests/acceptance-tests/test_custom_input_dispatcher.cpp (+2/-2)
tests/acceptance-tests/test_debug_api.cpp (+231/-0)
tests/acceptance-tests/test_display_configuration.cpp (+1/-2)
tests/acceptance-tests/test_nested_mir.cpp (+2/-5)
tests/acceptance-tests/test_prompt_session_client_api.cpp (+131/-98)
tests/acceptance-tests/test_server_disconnect.cpp (+4/-1)
tests/acceptance-tests/test_server_startup.cpp (+21/-37)
tests/acceptance-tests/test_unresponsive_client.cpp (+106/-81)
tests/client-language/CMakeLists.txt (+3/-3)
tests/client-language/c99.c (+2/-1)
tests/include/mir_test/fake_event_hub_input_configuration.h (+0/-79)
tests/include/mir_test/stub_server_tool.h (+8/-1)
tests/include/mir_test/validity_matchers.h (+64/-0)
tests/include/mir_test_doubles/advanceable_clock.h (+67/-0)
tests/include/mir_test_doubles/mock_android_native_buffer.h (+0/-3)
tests/include/mir_test_doubles/mock_buffer_bundle.h (+1/-0)
tests/include/mir_test_doubles/mock_buffer_initializer.h (+0/-48)
tests/include/mir_test_doubles/mock_buffer_stream.h (+1/-0)
tests/include/mir_test_doubles/mock_coordinate_translator.h (+42/-0)
tests/include/mir_test_doubles/mock_renderer.h (+0/-2)
tests/include/mir_test_doubles/mock_surface.h (+2/-1)
tests/include/mir_test_doubles/null_client_buffer.h (+1/-0)
tests/include/mir_test_doubles/null_display.h (+6/-6)
tests/include/mir_test_doubles/null_display_buffer.h (+5/-5)
tests/include/mir_test_doubles/null_display_buffer_compositor_factory.h (+1/-1)
tests/include/mir_test_doubles/null_platform.h (+5/-6)
tests/include/mir_test_doubles/null_platform_ipc_operations.h (+5/-0)
tests/include/mir_test_doubles/stub_android_native_buffer.h (+57/-0)
tests/include/mir_test_doubles/stub_buffer.h (+11/-24)
tests/include/mir_test_doubles/stub_buffer_allocator.h (+0/-3)
tests/include/mir_test_doubles/stub_buffer_stream.h (+1/-0)
tests/include/mir_test_doubles/stub_renderable.h (+19/-8)
tests/include/mir_test_doubles/stub_renderer.h (+0/-8)
tests/include/mir_test_doubles/stub_scene_element.h (+8/-2)
tests/include/mir_test_framework/basic_client_server_fixture.h (+2/-2)
tests/include/mir_test_framework/connected_client_headless_server.h (+38/-0)
tests/include/mir_test_framework/fake_event_hub_server_configuration.h (+3/-12)
tests/include/mir_test_framework/headless_in_process_server.h (+36/-0)
tests/include/mir_test_framework/headless_test.h (+79/-0)
tests/include/mir_test_framework/input_testing_server_configuration.h (+5/-6)
tests/include/mir_test_framework/interprocess_client_server_test.h (+69/-0)
tests/include/mir_test_framework/stubbed_server_configuration.h (+1/-1)
tests/include/mir_test_framework/temporary_environment_value.h (+41/-0)
tests/include/mir_test_framework/testing_server_configuration.h (+1/-1)
tests/include/mir_test_framework/using_stub_client_platform.h (+61/-17)
tests/integration-tests/CMakeLists.txt (+14/-0)
tests/integration-tests/client/test_client_render.cpp (+16/-20)
tests/integration-tests/compositor/test_buffer_stream.cpp (+6/-3)
tests/integration-tests/frontend/test_session_mediator_report.cpp (+2/-0)
tests/integration-tests/graphics/android/test_buffer_integration.cpp (+3/-6)
tests/integration-tests/graphics/android/test_display_integration.cpp (+1/-3)
tests/integration-tests/graphics/android/test_internal_client.cpp (+1/-3)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-5)
tests/integration-tests/input/android/test_android_cursor_listener.cpp (+36/-67)
tests/integration-tests/input/android/test_android_input_manager.cpp (+88/-144)
tests/integration-tests/session_management.cpp (+0/-1)
tests/integration-tests/surface_composition.cpp (+125/-0)
tests/integration-tests/test_display_info.cpp (+1/-2)
tests/integration-tests/test_display_server_main_loop_events.cpp (+2/-2)
tests/integration-tests/test_drm_auth_magic.cpp (+36/-12)
tests/integration-tests/test_error_reporting.cpp (+49/-34)
tests/integration-tests/test_exchange_buffer.cpp (+143/-8)
tests/integration-tests/test_protobuf.cpp (+12/-14)
tests/integration-tests/test_server_shutdown.cpp (+50/-19)
tests/integration-tests/test_session.cpp (+6/-6)
tests/integration-tests/test_stale_frames.cpp (+41/-13)
tests/integration-tests/test_surface_first_frame_sync.cpp (+16/-6)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+0/-1)
tests/integration-tests/test_surfaceloop.cpp (+1/-2)
tests/mir_test/CMakeLists.txt (+2/-1)
tests/mir_test/validity_matchers.cpp (+32/-0)
tests/mir_test_doubles/CMakeLists.txt (+1/-1)
tests/mir_test_doubles/fake_event_hub_input_configuration.cpp (+0/-50)
tests/mir_test_doubles/stub_buffer.cpp (+37/-0)
tests/mir_test_framework/CMakeLists.txt (+24/-0)
tests/mir_test_framework/connected_client_headless_server.cpp (+42/-0)
tests/mir_test_framework/fake_event_hub_server_configuration.cpp (+10/-12)
tests/mir_test_framework/headless_in_process_server.cpp (+36/-0)
tests/mir_test_framework/headless_test.cpp (+121/-0)
tests/mir_test_framework/input_testing_server_options.cpp (+9/-11)
tests/mir_test_framework/interprocess_client_server_test.cpp (+164/-0)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+206/-0)
tests/mir_test_framework/stubbed_graphics_platform.h (+47/-0)
tests/mir_test_framework/stubbed_server_configuration.cpp (+6/-173)
tests/mir_test_framework/temporary_environment_value.cpp (+42/-0)
tests/mir_test_framework/testing_client_options.cpp (+15/-12)
tests/mir_test_framework/using_stub_client_platform.cpp (+15/-53)
tests/unit-tests/CMakeLists.txt (+3/-1)
tests/unit-tests/android_input/input_reader.cpp (+2/-2)
tests/unit-tests/android_input/test_eventhub.cpp (+1/-0)
tests/unit-tests/client/android/test_android_native_window.cpp (+1/-0)
tests/unit-tests/client/android/test_buffer.cpp (+49/-2)
tests/unit-tests/client/android/test_client_surface_interpreter.cpp (+2/-1)
tests/unit-tests/client/android/test_gralloc_registrar.cpp (+11/-7)
tests/unit-tests/client/mesa/test_client_buffer.cpp (+13/-0)
tests/unit-tests/client/mesa/test_native_surface.cpp (+1/-0)
tests/unit-tests/client/test_aging_buffer.cpp (+25/-21)
tests/unit-tests/client/test_client_buffer_depository.cpp (+1/-0)
tests/unit-tests/client/test_client_mir_surface.cpp (+4/-2)
tests/unit-tests/client/test_periodic_perf_report.cpp (+19/-33)
tests/unit-tests/client/test_protobuf_rpc_channel.cpp (+12/-12)
tests/unit-tests/client/test_stream_transport.cpp (+4/-2)
tests/unit-tests/compositor/test_buffer_queue.cpp (+21/-0)
tests/unit-tests/compositor/test_compositing_screencast.cpp (+51/-5)
tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+100/-187)
tests/unit-tests/compositor/test_gl_renderer.cpp (+0/-10)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+24/-3)
tests/unit-tests/examples/test_demo_compositor.cpp (+33/-43)
tests/unit-tests/frontend/CMakeLists.txt (+1/-10)
tests/unit-tests/frontend/stress_protobuf_communicator.cpp (+17/-14)
tests/unit-tests/frontend/test_protobuf_message_processor.cpp (+115/-0)
tests/unit-tests/frontend/test_session_mediator.cpp (+103/-51)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+0/-95)
tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+0/-141)
tests/unit-tests/frontend/test_socket_connection.cpp (+32/-6)
tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+3/-39)
tests/unit-tests/graphics/android/test_fb_device.cpp (+1/-0)
tests/unit-tests/graphics/android/test_hwc_fallback_gl_renderer.cpp (+2/-1)
tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+1/-0)
tests/unit-tests/graphics/android/test_hwc_layers.cpp (+2/-2)
tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp (+1/-1)
tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp (+1/-0)
tests/unit-tests/graphics/android/test_ipc_operations.cpp (+50/-0)
tests/unit-tests/graphics/android/test_platform.cpp (+125/-52)
tests/unit-tests/graphics/android/test_server_interpreter.cpp (+1/-0)
tests/unit-tests/graphics/mesa/test_anonymous_shm_file.cpp (+8/-201)
tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp (+1/-28)
tests/unit-tests/graphics/mesa/test_cursor.cpp (+6/-1)
tests/unit-tests/graphics/mesa/test_display.cpp (+8/-8)
tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp (+1/-4)
tests/unit-tests/graphics/mesa/test_native_platform.cpp (+5/-12)
tests/unit-tests/graphics/mesa/test_platform.cpp (+10/-5)
tests/unit-tests/graphics/nested/test_nested_platform.cpp (+1/-4)
tests/unit-tests/graphics/test_graphics_platform.cpp (+2/-5)
tests/unit-tests/input/android/test_android_input_dispatcher.cpp (+15/-1)
tests/unit-tests/input/android/test_android_input_manager.cpp (+40/-19)
tests/unit-tests/logging/message_processor_report.cpp (+24/-20)
tests/unit-tests/logging/test_compositor_report.cpp (+37/-51)
tests/unit-tests/logging/test_display_report.cpp (+3/-3)
tests/unit-tests/logging/test_legacy_input_report.cpp (+4/-4)
tests/unit-tests/scene/test_application_session.cpp (+9/-19)
tests/unit-tests/scene/test_surface_allocator.cpp (+0/-76)
tests/unit-tests/scene/test_surface_stack.cpp (+7/-7)
tests/unit-tests/test_asio_main_loop.cpp (+41/-43)
tests/unit-tests/test_glib_main_loop.cpp (+1078/-0)
tests/unit-tests/test_thread_safe_list.cpp (+121/-86)
tools/install_on_android.sh (+4/-3)
tools/setup-partial-armhf-chroot.sh (+1/-1)
To merge this branch: bzr merge lp:mir/0.9
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Information
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+242146@code.launchpad.net

Commit message

mir 0.9.0 release

Description of the change

mir 0.9.0 release

Preparation for 0.9.0 release

To post a comment you must log in.
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
Alan Griffiths (alan-griffiths) wrote :

I don't see this in the CI queue - triggering build manually

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> I don't see this in the CI queue - triggering build manually

aborted that - there are still conflicts

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Weird, the silo builders don't see any conflicts and all tests pass.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

^-> ummm interesting...

8: [ RUN ] GLibMainLoopTest.propagates_exception_from_signal_handler
8: unknown file: Failure
8: C++ exception with description "Timeout while waiting for child to change state" thrown in the test body.
8: disInstr(thumb): unhandled instruction: 0xDEFF 0xF893
8: [ FAILED ] GLibMainLoopTest.propagates_exception_from_signal_handler (5988 ms)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

I guess 5 seconds isn't enough?

        auto const result = child.wait_for_termination(std::chrono::seconds{5});

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

It's the same 6 failures:

[ FAILED ] GLibMainLoopTest.propagates_exception_from_signal_handler
[ FAILED ] GLibMainLoopTest.propagates_exception_from_fd_handler
[ FAILED ] GLibMainLoopTest.propagates_exception_from_server_action
[ FAILED ] GLibMainLoopTest.can_be_rerun_after_exception
[ FAILED ] GLibMainLoopAlarmTest.propagates_exception_from_alarm
[ FAILED ] GLibMainLoopForkTest.handles_signals_when_created_in_forked_process

And at least one of them has "8: disInstr(thumb): unhandled instruction: 0xDEFF 0xF893", I guess valgrind didn't like that in this machine?

In any case, silo builders built tests succesfully.

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

That's weird. If we're targeting the right branch, this shouldn't be visible:

1395 +mir (0.8.0+14.10.20141010-0ubuntu2) vivid; urgency=medium
1396 +
1397 + * No change rebuild to get debug symbols on all architectures.
1398 +
1399 + -- Brian Murray <email address hidden> Wed, 19 Nov 2014 11:33:10 -0800

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Needs Information
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

@Daniel,

A rebuild was done in archive. I merged that changelog entry to avoid conflicts when publishing the new release.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp'
2--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2014-03-26 05:48:59 +0000
3+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2014-11-25 17:45:03 +0000
4@@ -24,6 +24,7 @@
5 #define release_wake_lock(id) {}
6
7 #include "mir/input/input_report.h"
8+#include "mir/udev/wrapper.h"
9
10 #include <cutils/properties.h>
11 #include <std/Log.h>
12@@ -212,7 +213,7 @@
13
14 EventHub::EventHub(std::shared_ptr<mi::InputReport> const& input_report) :
15 input_report(input_report),
16- device_listener{mir::udev::Context()},
17+ device_listener{new mir::udev::Monitor{mir::udev::Context()}},
18 mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1),
19 mOpeningDevices(0), mClosingDevices(0),
20 mNeedToSendFinishedDeviceScan(false),
21@@ -223,15 +224,15 @@
22 mEpollFd = epoll_create(EPOLL_SIZE_HINT);
23 LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
24
25- device_listener.filter_by_subsystem("input");
26- device_listener.enable();
27+ device_listener->filter_by_subsystem("input");
28+ device_listener->enable();
29
30
31 struct epoll_event eventItem;
32 memset(&eventItem, 0, sizeof(eventItem));
33 eventItem.events = EPOLLIN;
34 eventItem.data.u32 = EPOLL_ID_UDEV;
35- int result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, device_listener.fd(), &eventItem);
36+ int result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, device_listener->fd(), &eventItem);
37 LOG_ALWAYS_FATAL_IF(result != 0, "Could not add Udev monitor to epoll instance. errno=%d", errno);
38
39 int wakeFds[2];
40@@ -935,7 +936,7 @@
41
42 void EventHub::handleUdevEventsLocked()
43 {
44- device_listener.process_events([this](mir::udev::Monitor::EventType type, mir::udev::Device const& dev){
45+ device_listener->process_events([this](mir::udev::Monitor::EventType type, mir::udev::Device const& dev){
46 if (type == mir::udev::Monitor::ADDED)
47 {
48 if (dev.devnode() != nullptr)
49
50=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h'
51--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2014-09-11 05:51:44 +0000
52+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2014-11-25 17:45:03 +0000
53@@ -18,8 +18,6 @@
54 #ifndef _RUNTIME_EVENT_HUB_H
55 #define _RUNTIME_EVENT_HUB_H
56
57-#include "mir/udev/wrapper.h"
58-
59 #include <androidfw/Input.h>
60 #include <androidfw/InputDevice.h>
61 #include <androidfw/Keyboard.h>
62@@ -41,6 +39,7 @@
63
64 namespace mir
65 {
66+namespace udev { class Monitor; }
67 namespace input
68 {
69 class InputReport;
70@@ -407,7 +406,7 @@
71 Vector<String8> mExcludedDevices;
72
73 int mEpollFd;
74- mir::udev::Monitor device_listener;
75+ std::unique_ptr<mir::udev::Monitor> const device_listener;
76 int mWakeReadPipeFd;
77 int mWakeWritePipeFd;
78
79
80=== modified file 'CMakeLists.txt'
81--- CMakeLists.txt 2014-09-30 06:11:33 +0000
82+++ CMakeLists.txt 2014-11-25 17:45:03 +0000
83@@ -27,7 +27,7 @@
84 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
85
86 set(MIR_VERSION_MAJOR 0)
87-set(MIR_VERSION_MINOR 8) # This should change at least with every MIRSERVER_ABI
88+set(MIR_VERSION_MINOR 9) # This should change at least with every MIRSERVER_ABI
89 set(MIR_VERSION_PATCH 0)
90
91 set(MIR_VERSION ${MIR_VERSION_MAJOR}.${MIR_VERSION_MINOR}.${MIR_VERSION_PATCH})
92@@ -154,6 +154,7 @@
93 find_package(XKBCOMMON REQUIRED)
94 find_package(LTTngUST REQUIRED)
95 pkg_check_modules(UDEV REQUIRED libudev)
96+pkg_check_modules(GLIB REQUIRED glib-2.0)
97
98 include_directories (${GLESv2_INCLUDE_DIRS})
99 include_directories (${EGL_INCLUDE_DIRS})
100
101=== modified file 'benchmarks/CMakeLists.txt'
102--- benchmarks/CMakeLists.txt 2014-03-06 06:05:17 +0000
103+++ benchmarks/CMakeLists.txt 2014-11-25 17:45:03 +0000
104@@ -1,13 +1,12 @@
105-include_directories(${MIR_3RD_PARTY_INCLUDE_DIRECTORIES})
106-include_directories(${MIR_ANDROID_INCLUDE_DIRECTORIES})
107-add_custom_target(
108- benchmarks
109-)
110+add_custom_target(benchmarks) # XXX Is this used by anything?
111+
112+add_subdirectory(cpu)
113+add_subdirectory(memory)
114+add_dependencies(benchmarks cpu_benchmarks memory_benchmarks)
115
116 if (MIR_ENABLE_TESTS)
117+ # Shouldn't tests dependent things be in tests/?
118 add_subdirectory(android-input)
119+ add_subdirectory(frame-uniformity)
120+ add_dependencies(benchmarks frame_uniformity_test_client)
121 endif ()
122-add_subdirectory(cpu)
123-add_subdirectory(memory)
124-
125-add_dependencies(benchmarks cpu_benchmarks memory_benchmarks)
126
127=== modified file 'benchmarks/android-input/CMakeLists.txt'
128--- benchmarks/android-input/CMakeLists.txt 2014-09-30 06:11:33 +0000
129+++ benchmarks/android-input/CMakeLists.txt 2014-11-25 17:45:03 +0000
130@@ -7,6 +7,8 @@
131 include_directories(
132 ${Mir_SOURCE_DIR}/tests/include
133 ${Mir_SOURCE_DIR}/include/platform
134+ ${MIR_ANDROID_INCLUDE_DIRECTORIES}
135+ ${MIR_3RD_PARTY_INCLUDE_DIRECTORIES}
136 )
137
138 add_executable(input-reader-perf ${SOURCES})
139
140=== modified file 'benchmarks/android-input/input_reader_perf.cpp'
141--- benchmarks/android-input/input_reader_perf.cpp 2014-09-11 05:51:44 +0000
142+++ benchmarks/android-input/input_reader_perf.cpp 2014-11-25 17:45:03 +0000
143@@ -62,13 +62,13 @@
144 }
145
146 void getAssociatedDisplayInfo(InputDeviceIdentifier const& /* identifier */,
147- int& out_associated_display_id, bool& out_associated_display_is_external) {
148+ int& out_associated_display_id, bool& out_associated_display_is_external) override {
149 out_associated_display_id = 0;
150 out_associated_display_is_external = false;
151 }
152
153 private:
154- virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) {
155+ virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) override {
156 *outConfig = mConfig;
157 }
158
159@@ -77,7 +77,7 @@
160 return sp<PointerControllerInterface>();
161 }
162
163- virtual void notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices) {
164+ virtual void notifyInputDevicesChanged(const Vector<InputDeviceInfo>& inputDevices) override {
165 mInputDevices = inputDevices;
166 }
167
168
169=== added directory 'benchmarks/frame-uniformity'
170=== added file 'benchmarks/frame-uniformity/CMakeLists.txt'
171--- benchmarks/frame-uniformity/CMakeLists.txt 1970-01-01 00:00:00 +0000
172+++ benchmarks/frame-uniformity/CMakeLists.txt 2014-11-25 17:45:03 +0000
173@@ -0,0 +1,45 @@
174+include_directories(
175+ ${PROJECT_SOURCE_DIR}/include/common
176+ ${PROJECT_SOURCE_DIR}/include/platform
177+ ${PROJECT_SOURCE_DIR}/include/server
178+ ${PROJECT_SOURCE_DIR}/include/client
179+ ${PROJECT_SOURCE_DIR}/tests/include/
180+
181+ ${PROJECT_SOURCE_DIR}/src/include/platform
182+ ${PROJECT_SOURCE_DIR}
183+ ${MIR_ANDROID_INCLUDE_DIRECTORIES}
184+ ${MIR_3RD_PARTY_INCLUDE_DIRECTORIES}
185+)
186+
187+add_executable(frame_uniformity_test_client
188+ touch_measuring_client.cpp
189+ touch_producing_server.cpp
190+ frame_uniformity_test.cpp
191+ vsync_simulating_graphics_platform.cpp
192+ touch_samples.cpp
193+ main.cpp
194+)
195+
196+target_link_libraries(frame_uniformity_test_client
197+ mirserver
198+ mirclient
199+
200+ mir-test
201+ mir-test-framework
202+ mir-test-doubles
203+ mir-test-doubles-platform
204+
205+ # Why does this have to come after mir-test-framework here but not in tests/acceptance-tests/
206+ # /CMakeLists.txt? ~racarr
207+ mirplatform
208+
209+ 3rd_party
210+ ${PROTOBUF_LIBRARIES}
211+ ${Boost_LIBRARIES}
212+ ${GTEST_BOTH_LIBRARIES}
213+ ${GMOCK_LIBRARY}
214+ ${GMOCK_MAIN_LIBRARY}
215+ ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
216+)
217+
218+uses_android_input(frame_uniformity_test_client)
219
220=== added file 'benchmarks/frame-uniformity/README.txt'
221--- benchmarks/frame-uniformity/README.txt 1970-01-01 00:00:00 +0000
222+++ benchmarks/frame-uniformity/README.txt 2014-11-25 17:45:03 +0000
223@@ -0,0 +1,13 @@
224+This benchmark uses a client server setup and simulated touch events in order to compute two metrics: Average Pixel Lag, and Frame Uniformity.
225+
226+Average pixel lag is measured as follows. A client is run, and put in position to receive the simulated touch events. Said client renders frames as fast as allowed (in the test, a simulated vsync timer on the server throttles rendering). At each frame time, the client records its most up to date pointer sample. Following receipt of all the events, the touch simulation parameters are used to interpolate where the touch was expected at each frame time. The average pixel lag is the average difference between this physical (simulated) touch location, and the client recording at each frame time.
227+
228+Frame uniformity is the standard deviation of the average pixel lag over all samples.
229+
230+Several test parameters are variable : TODO: Explain how to vary, currently requires code changes.
231+Touch event start
232+Touch event end
233+Touch duration
234+Vsync rate
235+Input event rate
236+Test repeat count (resulting in averaged results).
237
238=== added file 'benchmarks/frame-uniformity/frame_uniformity_test.cpp'
239--- benchmarks/frame-uniformity/frame_uniformity_test.cpp 1970-01-01 00:00:00 +0000
240+++ benchmarks/frame-uniformity/frame_uniformity_test.cpp 2014-11-25 17:45:03 +0000
241@@ -0,0 +1,52 @@
242+/*
243+ * Copyright © 2014 Canonical Ltd.
244+ *
245+ * This program is free software: you can redistribute it and/or modify
246+ * it under the terms of the GNU General Public License version 3 as
247+ * published by the Free Software Foundation.
248+ *
249+ * This program is distributed in the hope that it will be useful,
250+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
251+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
252+ * GNU General Public License for more details.
253+ *
254+ * You should have received a copy of the GNU General Public License
255+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
256+ *
257+ * Authored by: Robert Carr <robert.carr@canonical.com>
258+ */
259+
260+#include "frame_uniformity_test.h"
261+
262+FrameUniformityTest::FrameUniformityTest(FrameUniformityTestParameters const& parameters)
263+ : client_ready_fence{2},
264+ server_configuration({{0, 0}, parameters.screen_size},
265+ parameters.touch_start,
266+ parameters.touch_end,
267+ parameters.touch_duration,
268+ client_ready_fence),
269+ client(client_ready_fence, parameters.touch_duration)
270+{
271+}
272+
273+mir::DefaultServerConfiguration& FrameUniformityTest::server_config()
274+{
275+ return server_configuration;
276+}
277+
278+void FrameUniformityTest::run_test()
279+{
280+ start_server();
281+ client.run(new_connection());
282+ stop_server();
283+}
284+
285+std::shared_ptr<TouchSamples> FrameUniformityTest::client_results()
286+{
287+ return client.results();
288+}
289+
290+TouchProducingServer::TouchTimings FrameUniformityTest::server_timings()
291+{
292+ return server_configuration.touch_timings();
293+}
294
295=== added file 'benchmarks/frame-uniformity/frame_uniformity_test.h'
296--- benchmarks/frame-uniformity/frame_uniformity_test.h 1970-01-01 00:00:00 +0000
297+++ benchmarks/frame-uniformity/frame_uniformity_test.h 2014-11-25 17:45:03 +0000
298@@ -0,0 +1,64 @@
299+/*
300+ * Copyright © 2014 Canonical Ltd.
301+ *
302+ * This program is free software: you can redistribute it and/or modify
303+ * it under the terms of the GNU General Public License version 3 as
304+ * published by the Free Software Foundation.
305+ *
306+ * This program is distributed in the hope that it will be useful,
307+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
308+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
309+ * GNU General Public License for more details.
310+ *
311+ * You should have received a copy of the GNU General Public License
312+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
313+ *
314+ * Authored by: Robert Carr <robert.carr@canonical.com>
315+ */
316+
317+#ifndef FRAME_UNIFORMITY_TEST_H_
318+#define FRAME_UNIFORMITY_TEST_H_
319+
320+#include "touch_producing_server.h"
321+#include "touch_measuring_client.h"
322+#include "touch_samples.h"
323+
324+#include "mir/geometry/size.h"
325+#include "mir/geometry/point.h"
326+
327+#include "mir_test/barrier.h"
328+
329+#include "mir_test_framework/server_runner.h"
330+
331+#include <chrono>
332+
333+struct FrameUniformityTestParameters
334+{
335+ mir::geometry::Size screen_size;
336+ mir::geometry::Point touch_start;
337+ mir::geometry::Point touch_end;
338+
339+ std::chrono::milliseconds touch_duration;
340+};
341+
342+class FrameUniformityTest : public mir_test_framework::ServerRunner
343+{
344+public:
345+ FrameUniformityTest(FrameUniformityTestParameters const& parameters);
346+ virtual ~FrameUniformityTest() = default;
347+
348+ mir::DefaultServerConfiguration& server_config() override;
349+
350+ void run_test();
351+
352+ std::shared_ptr<TouchSamples> client_results();
353+
354+ TouchProducingServer::TouchTimings server_timings();
355+
356+private:
357+ mir::test::Barrier client_ready_fence;
358+ TouchProducingServer server_configuration;
359+ TouchMeasuringClient client;
360+};
361+
362+#endif // FRAME_UNIFORMITY_TEST_H_
363
364=== added file 'benchmarks/frame-uniformity/main.cpp'
365--- benchmarks/frame-uniformity/main.cpp 1970-01-01 00:00:00 +0000
366+++ benchmarks/frame-uniformity/main.cpp 2014-11-25 17:45:03 +0000
367@@ -0,0 +1,143 @@
368+/*
369+ * Copyright © 2014 Canonical Ltd.
370+ *
371+ * This program is free software: you can redistribute it and/or modify
372+ * it under the terms of the GNU General Public License version 3 as
373+ * published by the Free Software Foundation.
374+ *
375+ * This program is distributed in the hope that it will be useful,
376+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
377+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
378+ * GNU General Public License for more details.
379+ *
380+ * You should have received a copy of the GNU General Public License
381+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
382+ *
383+ * Authored by: Robert Carr <robert.carr@canonical.com>
384+ */
385+
386+#include "frame_uniformity_test.h"
387+
388+#include <assert.h>
389+#include <cmath>
390+
391+#include <chrono>
392+#include <iostream>
393+
394+#include <gtest/gtest.h>
395+
396+namespace geom = mir::geometry;
397+
398+namespace
399+{
400+
401+geom::Point interpolated_touch_at_time(geom::Point touch_start, geom::Point touch_end,
402+ std::chrono::high_resolution_clock::time_point touch_start_time,
403+ std::chrono::high_resolution_clock::time_point touch_end_time,
404+ std::chrono::high_resolution_clock::time_point interpolated_touch_time)
405+{
406+ assert(interpolated_touch_time > touch_start_time);
407+
408+ double elapsed_interval = interpolated_touch_time.time_since_epoch().count() - touch_start_time.time_since_epoch().count();
409+ double total_interval = touch_end_time.time_since_epoch().count() -
410+ touch_start_time.time_since_epoch().count();
411+
412+ double alpha = elapsed_interval / total_interval;
413+
414+ auto ix = touch_start.x.as_int() + (touch_end.x.as_int()-touch_start.x.as_int())*alpha;
415+ auto iy = touch_start.y.as_int() + (touch_end.y.as_int()-touch_start.y.as_int())*alpha;
416+ return {ix, iy};
417+}
418+
419+double pixel_lag_for_sample_at_time(geom::Point touch_start_point, geom::Point touch_end_point,
420+ std::chrono::high_resolution_clock::time_point touch_start_time,
421+ std::chrono::high_resolution_clock::time_point touch_end_time,
422+ TouchSamples::Sample const& sample)
423+{
424+ auto expected_point = interpolated_touch_at_time(touch_start_point, touch_end_point, touch_start_time,
425+ touch_end_time, sample.frame_time);
426+ auto dx = sample.x - expected_point.x.as_int();
427+ auto dy = sample.y - expected_point.y.as_int();
428+ auto distance = std::sqrt(dx*dx+dy*dy);
429+ return distance;
430+}
431+
432+double compute_average_frame_offset(std::vector<TouchSamples::Sample> const& results,
433+ geom::Point touch_start_point, geom::Point touch_end_point,
434+ std::chrono::high_resolution_clock::time_point touch_start_time,
435+ std::chrono::high_resolution_clock::time_point touch_end_time)
436+{
437+ double sum = 0;
438+ for (auto const& sample : results)
439+ {
440+ auto distance = pixel_lag_for_sample_at_time(touch_start_point, touch_end_point, touch_start_time,
441+ touch_end_time, sample);
442+ sum += distance;
443+ }
444+ return sum / results.size();
445+}
446+
447+struct Results
448+{
449+ double average_pixel_offset;
450+ double frame_uniformity;
451+};
452+
453+Results compute_frame_uniformity(std::vector<TouchSamples::Sample> const& results,
454+ geom::Point touch_start_point, geom::Point touch_end_point,
455+ std::chrono::high_resolution_clock::time_point touch_start_time,
456+ std::chrono::high_resolution_clock::time_point touch_end_time)
457+{
458+ auto average_pixel_offset = compute_average_frame_offset(results, touch_start_point, touch_end_point,
459+ touch_start_time, touch_end_time);
460+
461+ double sum = 0;
462+ for (auto const& sample : results)
463+ {
464+ auto distance = pixel_lag_for_sample_at_time(touch_start_point, touch_end_point, touch_start_time,
465+ touch_end_time, sample);
466+ sum += (distance-average_pixel_offset)*(distance-average_pixel_offset);
467+ }
468+ double uniformity = std::sqrt(sum/results.size());
469+ return {average_pixel_offset, uniformity};
470+}
471+
472+}
473+
474+// Main is inside a test to work around mir_test_framework 'issues' (e.g. mir_test_framework contains
475+// a main function).
476+TEST(FrameUniformity, average_frame_offset)
477+{
478+ geom::Size const screen_size{1024, 1024};
479+ geom::Point const touch_start_point{0, 0};
480+ geom::Point const touch_end_point{1024, 1024};
481+ std::chrono::milliseconds touch_duration{1000};
482+
483+ int const run_count = 1;
484+ double average_lag = 0, average_uniformity = 0;
485+
486+ for (int i = 0; i < run_count; i++)
487+ {
488+ FrameUniformityTest t({screen_size, touch_start_point, touch_end_point, touch_duration});
489+
490+ t.run_test();
491+
492+ auto touch_timings = t.server_timings();
493+ auto touch_start_time = touch_timings.touch_start;
494+ auto touch_end_time = touch_timings.touch_end;
495+ auto samples = t.client_results()->get();
496+
497+ auto results = compute_frame_uniformity(samples, touch_start_point, touch_end_point,
498+ touch_start_time, touch_end_time);
499+
500+ average_lag += results.average_pixel_offset;
501+ average_uniformity += results.frame_uniformity;
502+ }
503+
504+ average_lag /= run_count;
505+ average_uniformity /= run_count;
506+
507+ std::cout << "Average pixel lag: " << average_lag << "px" << std::endl;
508+ std::cout << "Frame Uniformity (smaller scores are more uniform): " << average_uniformity << "px per sample\n"
509+ << std::endl;
510+}
511
512=== added file 'benchmarks/frame-uniformity/touch_measuring_client.cpp'
513--- benchmarks/frame-uniformity/touch_measuring_client.cpp 1970-01-01 00:00:00 +0000
514+++ benchmarks/frame-uniformity/touch_measuring_client.cpp 2014-11-25 17:45:03 +0000
515@@ -0,0 +1,115 @@
516+/*
517+ * Copyright © 2014 Canonical Ltd.
518+ *
519+ * This program is free software: you can redistribute it and/or modify
520+ * it under the terms of the GNU General Public License version 3 as
521+ * published by the Free Software Foundation.
522+ *
523+ * This program is distributed in the hope that it will be useful,
524+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
525+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
526+ * GNU General Public License for more details.
527+ *
528+ * You should have received a copy of the GNU General Public License
529+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
530+ *
531+ * Authored by: Robert Carr <robert.carr@canonical.com>
532+ */
533+
534+#include "touch_measuring_client.h"
535+
536+#include "mir/time/clock.h"
537+
538+#include "mir_toolkit/mir_client_library.h"
539+
540+#include <chrono>
541+#include <memory>
542+#include <vector>
543+
544+#include <assert.h>
545+
546+namespace mt = mir::test;
547+
548+namespace
549+{
550+
551+MirSurface *create_surface(MirConnection *connection)
552+{
553+ MirPixelFormat pixel_format;
554+ unsigned int valid_formats;
555+ mir_connection_get_available_surface_formats(connection, &pixel_format, 1, &valid_formats);
556+ MirSurfaceParameters const surface_params = { "frame-uniformity-test",
557+ 1024, 1024, /* TODO: Ensure fullscreen? */
558+ pixel_format,
559+ mir_buffer_usage_hardware,
560+ mir_display_output_id_invalid};
561+
562+ auto surface = mir_connection_create_surface_sync(connection, &surface_params);
563+ assert(mir_surface_is_valid(surface));
564+
565+ return surface;
566+}
567+
568+void input_callback(MirSurface * /* surface */, MirEvent const* event, void* context)
569+{
570+ auto results = static_cast<TouchSamples*>(context);
571+
572+ results->record_pointer_coordinates(std::chrono::high_resolution_clock::now(), *event);
573+}
574+
575+void collect_input_and_frame_timing(MirSurface *surface, mt::Barrier& client_ready, std::chrono::high_resolution_clock::duration duration, std::shared_ptr<TouchSamples> const& results)
576+{
577+ MirEventDelegate event_handler = { input_callback, results.get() };
578+ mir_surface_set_event_handler(surface, &event_handler);
579+
580+ client_ready.ready();
581+
582+ // May be better if end time were relative to the first input event
583+ auto end_time = std::chrono::high_resolution_clock::now() + duration;
584+ while (std::chrono::high_resolution_clock::now() < end_time)
585+ {
586+ mir_surface_swap_buffers_sync(surface);
587+ results->record_frame_time(std::chrono::high_resolution_clock::now());
588+ }
589+}
590+
591+}
592+
593+TouchMeasuringClient::TouchMeasuringClient(mt::Barrier& client_ready,
594+ std::chrono::high_resolution_clock::duration const& touch_duration)
595+ : client_ready(client_ready),
596+ touch_duration(touch_duration),
597+ results_(std::make_shared<TouchSamples>())
598+{
599+}
600+
601+namespace
602+{
603+void null_lifecycle_callback(MirConnection*, MirLifecycleState, void*)
604+{
605+}
606+}
607+
608+void TouchMeasuringClient::run(std::string const& connect_string)
609+{
610+ auto connection = mir_connect_sync(connect_string.c_str(), "frame-uniformity-test");
611+ assert(mir_connection_is_valid(connection));
612+
613+ /*
614+ * Set a null callback to avoid killing the process
615+ * (default callback raises SIGHUP).
616+ */
617+ mir_connection_set_lifecycle_event_callback(connection, null_lifecycle_callback, nullptr);
618+
619+ auto surface = create_surface(connection);
620+
621+ collect_input_and_frame_timing(surface, client_ready, touch_duration, results_);
622+
623+ mir_surface_release_sync(surface);
624+ mir_connection_release(connection);
625+}
626+
627+std::shared_ptr<TouchSamples> TouchMeasuringClient::results()
628+{
629+ return results_;
630+}
631
632=== added file 'benchmarks/frame-uniformity/touch_measuring_client.h'
633--- benchmarks/frame-uniformity/touch_measuring_client.h 1970-01-01 00:00:00 +0000
634+++ benchmarks/frame-uniformity/touch_measuring_client.h 2014-11-25 17:45:03 +0000
635@@ -0,0 +1,52 @@
636+/*
637+ * Copyright © 2014 Canonical Ltd.
638+ *
639+ * This program is free software: you can redistribute it and/or modify
640+ * it under the terms of the GNU General Public License version 3 as
641+ * published by the Free Software Foundation.
642+ *
643+ * This program is distributed in the hope that it will be useful,
644+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
645+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
646+ * GNU General Public License for more details.
647+ *
648+ * You should have received a copy of the GNU General Public License
649+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
650+ *
651+ * Authored by: Robert Carr <robert.carr@canonical.com>
652+ */
653+
654+#ifndef TOUCH_MEASURING_CLIENT_H_
655+#define TOUCH_MEASURING_CLIENT_H_
656+
657+#include "touch_samples.h"
658+
659+#include "mir_test/barrier.h"
660+
661+#include "mir_toolkit/mir_client_library.h"
662+
663+#include <chrono>
664+#include <memory>
665+#include <vector>
666+#include <string>
667+#include <mutex>
668+
669+class TouchMeasuringClient
670+{
671+public:
672+ TouchMeasuringClient(mir::test::Barrier& client_ready,
673+ std::chrono::high_resolution_clock::duration const& touch_duration);
674+
675+ void run(std::string const& connect_string);
676+
677+ std::shared_ptr<TouchSamples> results();
678+
679+private:
680+ mir::test::Barrier& client_ready;
681+
682+ std::chrono::high_resolution_clock::duration const touch_duration;
683+
684+ std::shared_ptr<TouchSamples> results_;
685+};
686+
687+#endif // TOUCH_MEASURING_CLIENT_H_
688
689=== added file 'benchmarks/frame-uniformity/touch_producing_server.cpp'
690--- benchmarks/frame-uniformity/touch_producing_server.cpp 1970-01-01 00:00:00 +0000
691+++ benchmarks/frame-uniformity/touch_producing_server.cpp 2014-11-25 17:45:03 +0000
692@@ -0,0 +1,114 @@
693+/*
694+ * Copyright © 2014 Canonical Ltd.
695+ *
696+ * This program is free software: you can redistribute it and/or modify
697+ * it under the terms of the GNU General Public License version 3 as
698+ * published by the Free Software Foundation.
699+ *
700+ * This program is distributed in the hope that it will be useful,
701+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
702+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
703+ * GNU General Public License for more details.
704+ *
705+ * You should have received a copy of the GNU General Public License
706+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
707+ *
708+ * Authored by: Robert Carr <robert.carr@canonical.com>
709+ */
710+
711+#include "touch_producing_server.h"
712+#include "vsync_simulating_graphics_platform.h"
713+
714+#include "mir_test/event_factory.h"
715+#include "mir_test/fake_event_hub.h"
716+
717+#include <functional>
718+
719+namespace mi = mir::input;
720+namespace mia = mi::android;
721+namespace mg = mir::graphics;
722+namespace mis = mi::synthesis;
723+namespace geom = mir::geometry;
724+namespace mt = mir::test;
725+
726+namespace mtf = mir_test_framework;
727+
728+TouchProducingServer::TouchProducingServer(geom::Rectangle screen_dimensions, geom::Point touch_start,
729+ geom::Point touch_end, std::chrono::high_resolution_clock::duration touch_duration,
730+ mt::Barrier &client_ready)
731+ : FakeEventHubServerConfiguration({screen_dimensions}),
732+ screen_dimensions(screen_dimensions),
733+ touch_start(touch_start),
734+ touch_end(touch_end),
735+ touch_duration(touch_duration),
736+ client_ready(client_ready)
737+{
738+ input_injection_thread = std::thread(std::mem_fn(&TouchProducingServer::thread_function), this);
739+}
740+
741+TouchProducingServer::~TouchProducingServer()
742+{
743+ if (input_injection_thread.joinable())
744+ input_injection_thread.join();
745+}
746+
747+std::shared_ptr<mg::Platform> TouchProducingServer::the_graphics_platform()
748+{
749+ // TODO: Support configuration
750+ int const refresh_rate_in_hz = 60;
751+
752+ if (!graphics_platform)
753+ graphics_platform = std::make_shared<VsyncSimulatingPlatform>(screen_dimensions.size, refresh_rate_in_hz);
754+
755+ return graphics_platform;
756+}
757+
758+void TouchProducingServer::synthesize_event_at(geom::Point const& point)
759+{
760+ auto const minimum_touch = mia::FakeEventHub::TouchScreenMinAxisValue;
761+ auto const maximum_touch = mia::FakeEventHub::TouchScreenMaxAxisValue;
762+ auto const display_width = screen_dimensions.size.width.as_int();
763+ auto const display_height = screen_dimensions.size.height.as_int();
764+
765+ auto px_frac = point.x.as_int() / static_cast<double>(display_width);
766+ auto py_frac = point.y.as_int() / static_cast<double>(display_height);
767+ auto const abs_touch_x = minimum_touch + (maximum_touch-minimum_touch) * px_frac;
768+ auto const abs_touch_y = minimum_touch + (maximum_touch-minimum_touch) * py_frac;
769+
770+ fake_event_hub->synthesize_event(
771+ mis::a_touch_event().at_position({abs_touch_x, abs_touch_y}));
772+}
773+
774+void TouchProducingServer::thread_function()
775+{
776+ // We could make the touch sampling rate customizable
777+ std::chrono::milliseconds const pause_between_events{10};
778+
779+ client_ready.ready();
780+
781+ auto start = std::chrono::high_resolution_clock::now();
782+ auto end = start + touch_duration;
783+ auto now = start;
784+
785+ touch_start_time = std::chrono::high_resolution_clock::time_point::min();
786+ while (now < end)
787+ {
788+ std::this_thread::sleep_for(pause_between_events);
789+
790+ now = std::chrono::high_resolution_clock::now();
791+ if (touch_start_time == std::chrono::high_resolution_clock::time_point::min())
792+ touch_start_time = now;
793+ touch_end_time = now;
794+
795+ double alpha = (now.time_since_epoch().count()-start.time_since_epoch().count()) / static_cast<double>(end.time_since_epoch().count()-start.time_since_epoch().count());
796+ auto point = geom::Point{touch_start.x.as_int()+(touch_end.x.as_int()-touch_start.x.as_int())*alpha,
797+ touch_start.y.as_int()+(touch_end.y.as_int()-touch_start.y.as_int())*alpha};
798+ synthesize_event_at(point);
799+ }
800+}
801+
802+TouchProducingServer::TouchTimings
803+TouchProducingServer::touch_timings()
804+{
805+ return {touch_start_time, touch_end_time};
806+}
807
808=== added file 'benchmarks/frame-uniformity/touch_producing_server.h'
809--- benchmarks/frame-uniformity/touch_producing_server.h 1970-01-01 00:00:00 +0000
810+++ benchmarks/frame-uniformity/touch_producing_server.h 2014-11-25 17:45:03 +0000
811@@ -0,0 +1,64 @@
812+/*
813+ * Copyright © 2014 Canonical Ltd.
814+ *
815+ * This program is free software: you can redistribute it and/or modify
816+ * it under the terms of the GNU General Public License version 3 as
817+ * published by the Free Software Foundation.
818+ *
819+ * This program is distributed in the hope that it will be useful,
820+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
821+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
822+ * GNU General Public License for more details.
823+ *
824+ * You should have received a copy of the GNU General Public License
825+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
826+ *
827+ * Authored by: Robert Carr <robert.carr@canonical.com>
828+ */
829+
830+#ifndef TOUCH_PRODUCING_SERVER_H_
831+#define TOUCH_PRODUCING_SERVER_H_
832+
833+#include "mir_test_framework/fake_event_hub_server_configuration.h"
834+#include "mir_test/barrier.h"
835+
836+#include "mir/geometry/rectangle.h"
837+#include "mir/geometry/point.h"
838+
839+#include <thread>
840+
841+class TouchProducingServer : public mir_test_framework::FakeEventHubServerConfiguration
842+{
843+public:
844+ TouchProducingServer(mir::geometry::Rectangle screen_dimensions, mir::geometry::Point touch_start, mir::geometry::Point touch_end, std::chrono::high_resolution_clock::duration touch_duration, mir::test::Barrier& client_ready);
845+
846+ struct TouchTimings {
847+ std::chrono::high_resolution_clock::time_point touch_start;
848+ std::chrono::high_resolution_clock::time_point touch_end;
849+ };
850+ TouchTimings touch_timings();
851+
852+ std::shared_ptr<mir::graphics::Platform> the_graphics_platform() override;
853+
854+ ~TouchProducingServer();
855+private:
856+ mir::geometry::Rectangle const screen_dimensions;
857+
858+ mir::geometry::Point const touch_start;
859+ mir::geometry::Point const touch_end;
860+ std::chrono::high_resolution_clock::duration const touch_duration;
861+
862+ mir::test::Barrier& client_ready;
863+
864+ std::thread input_injection_thread;
865+
866+ std::chrono::high_resolution_clock::time_point touch_start_time;
867+ std::chrono::high_resolution_clock::time_point touch_end_time;
868+
869+ std::shared_ptr<mir::graphics::Platform> graphics_platform;
870+
871+ void synthesize_event_at(mir::geometry::Point const& point);
872+ void thread_function();
873+};
874+
875+#endif
876
877=== added file 'benchmarks/frame-uniformity/touch_samples.cpp'
878--- benchmarks/frame-uniformity/touch_samples.cpp 1970-01-01 00:00:00 +0000
879+++ benchmarks/frame-uniformity/touch_samples.cpp 2014-11-25 17:45:03 +0000
880@@ -0,0 +1,57 @@
881+/*
882+ * Copyright © 2014 Canonical Ltd.
883+ *
884+ * This program is free software: you can redistribute it and/or modify
885+ * it under the terms of the GNU General Public License version 3 as
886+ * published by the Free Software Foundation.
887+ *
888+ * This program is distributed in the hope that it will be useful,
889+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
890+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
891+ * GNU General Public License for more details.
892+ *
893+ * You should have received a copy of the GNU General Public License
894+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
895+ *
896+ * Authored by: Robert Carr <robert.carr@canonical.com>
897+ */
898+
899+#include "touch_samples.h"
900+
901+void TouchSamples::record_frame_time(std::chrono::high_resolution_clock::time_point time)
902+{
903+ std::unique_lock<std::mutex> lg(guard);
904+ for (auto& sample: samples_being_prepared)
905+ {
906+ sample.frame_time = time;
907+ completed_samples.push_back(sample);
908+ }
909+ samples_being_prepared.clear();
910+}
911+
912+void TouchSamples::record_pointer_coordinates(std::chrono::high_resolution_clock::time_point reception_time,
913+ MirEvent const& event)
914+{
915+ std::unique_lock<std::mutex> lg(guard);
916+
917+ if (event.type != mir_event_type_motion)
918+ return;
919+
920+ auto const& mev = event.motion;
921+ if (mev.action != mir_motion_action_down &&
922+ mev.action != mir_motion_action_up &&
923+ mev.action != mir_motion_action_move)
924+ {
925+ return;
926+ }
927+ // We could support multitouch, etc...
928+ auto const& coordinates = mev.pointer_coordinates[0];
929+
930+ // TODO: Record both event time and reception time
931+ samples_being_prepared.push_back(Sample{coordinates.x, coordinates.y, reception_time, {}});
932+}
933+
934+std::vector<TouchSamples::Sample> TouchSamples::get()
935+{
936+ return completed_samples;
937+}
938
939=== added file 'benchmarks/frame-uniformity/touch_samples.h'
940--- benchmarks/frame-uniformity/touch_samples.h 1970-01-01 00:00:00 +0000
941+++ benchmarks/frame-uniformity/touch_samples.h 2014-11-25 17:45:03 +0000
942@@ -0,0 +1,60 @@
943+/*
944+ * Copyright © 2014 Canonical Ltd.
945+ *
946+ * This program is free software: you can redistribute it and/or modify
947+ * it under the terms of the GNU General Public License version 3 as
948+ * published by the Free Software Foundation.
949+ *
950+ * This program is distributed in the hope that it will be useful,
951+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
952+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
953+ * GNU General Public License for more details.
954+ *
955+ * You should have received a copy of the GNU General Public License
956+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
957+ *
958+ * Authored by: Robert Carr <robert.carr@canonical.com>
959+ */
960+
961+#ifndef TOUCH_SAMPLES_H_
962+#define TOUCH_SAMPLES_H_
963+
964+#include <vector>
965+#include <chrono>
966+#include <mutex>
967+
968+#include <mir_toolkit/event.h>
969+
970+class TouchSamples
971+{
972+public:
973+ TouchSamples() = default;
974+ ~TouchSamples() = default;
975+
976+ // A touch sample
977+ struct Sample
978+ {
979+ // Coordinates of the touch
980+ float x,y;
981+ // Time at which the event left the input device
982+ std::chrono::high_resolution_clock::time_point event_time;
983+ // Submission time of first frame after receipt of event, e.g.
984+ // the earliest the event could potentially arrive onscreen.
985+ std::chrono::high_resolution_clock::time_point frame_time;
986+ };
987+ std::vector<Sample> get();
988+
989+ void record_frame_time(std::chrono::high_resolution_clock::time_point time);
990+ void record_pointer_coordinates(std::chrono::high_resolution_clock::time_point reception_time,
991+ MirEvent const& ev);
992+private:
993+ std::mutex guard;
994+
995+ // In between frames we will accumulate partially completed samples (lacking frame time)
996+ // in the "samples_being_prepared" collection. At each frame time we will move them to
997+ // the completed samples collection.
998+ std::vector<Sample> samples_being_prepared;
999+ std::vector<Sample> completed_samples;
1000+};
1001+
1002+#endif // TOUCH_SAMPLES_H_
1003
1004=== added file 'benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp'
1005--- benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 1970-01-01 00:00:00 +0000
1006+++ benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2014-11-25 17:45:03 +0000
1007@@ -0,0 +1,145 @@
1008+/*
1009+ * Copyright © 2014 Canonical Ltd.
1010+ *
1011+ * This program is free software: you can redistribute it and/or modify
1012+ * it under the terms of the GNU General Public License version 3 as
1013+ * published by the Free Software Foundation.
1014+ *
1015+ * This program is distributed in the hope that it will be useful,
1016+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1017+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1018+ * GNU General Public License for more details.
1019+ *
1020+ * You should have received a copy of the GNU General Public License
1021+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1022+ *
1023+ * Authored by: Robert Carr <robert.carr@canonical.com>
1024+ */
1025+
1026+#include "vsync_simulating_graphics_platform.h"
1027+
1028+#include "mir/graphics/buffer_writer.h"
1029+#include "mir/graphics/platform_ipc_operations.h"
1030+#include "mir/graphics/platform_ipc_package.h"
1031+
1032+#include "mir_test_doubles/stub_buffer_allocator.h"
1033+#include "mir_test_doubles/stub_display.h"
1034+
1035+#include <chrono>
1036+#include <functional>
1037+
1038+namespace mg = mir::graphics;
1039+namespace geom = mir::geometry;
1040+
1041+namespace mtd = mir::test::doubles;
1042+
1043+namespace
1044+{
1045+
1046+struct StubBufferWriter : public mg::BufferWriter
1047+{
1048+ void write(mg::Buffer&, unsigned char const*, size_t) override
1049+ {
1050+ }
1051+};
1052+
1053+class StubIpcOps : public mg::PlatformIpcOperations
1054+{
1055+ void pack_buffer(
1056+ mg::BufferIpcMessage&,
1057+ mg::Buffer const&,
1058+ mg::BufferIpcMsgType) const override
1059+ {
1060+ }
1061+
1062+ void unpack_buffer(
1063+ mg::BufferIpcMessage&, mg::Buffer const&) const override
1064+ {
1065+ }
1066+
1067+ std::shared_ptr<mg::PlatformIPCPackage> connection_ipc_package() override
1068+ {
1069+ return std::make_shared<mg::PlatformIPCPackage>();
1070+ }
1071+
1072+ mg::PlatformIPCPackage platform_operation(unsigned int const, mg::PlatformIPCPackage const&) override
1073+ {
1074+ return mg::PlatformIPCPackage();
1075+ }
1076+};
1077+
1078+struct StubDisplayBuffer : mtd::StubDisplayBuffer
1079+{
1080+ StubDisplayBuffer(geom::Size output_size, int vsync_rate_in_hz)
1081+ : mtd::StubDisplayBuffer({{0, 0}, output_size}),
1082+ vsync_rate_in_hz(vsync_rate_in_hz),
1083+ last_sync(std::chrono::high_resolution_clock::now())
1084+ {
1085+ }
1086+
1087+ void post_update() override
1088+ {
1089+ auto now = std::chrono::high_resolution_clock::now();
1090+ auto next_sync = last_sync + std::chrono::seconds(1) / vsync_rate_in_hz;
1091+
1092+ if (now < next_sync)
1093+ std::this_thread::sleep_for(next_sync - now);
1094+
1095+ last_sync = now;
1096+ }
1097+
1098+ double const vsync_rate_in_hz;
1099+
1100+ std::chrono::high_resolution_clock::time_point last_sync;
1101+};
1102+
1103+struct StubDisplay : public mtd::StubDisplay
1104+{
1105+ StubDisplay(geom::Size output_size, int vsync_rate_in_hz)
1106+ : mtd::StubDisplay({{{0,0}, output_size}}),
1107+ buffer(output_size, vsync_rate_in_hz)
1108+ {
1109+ }
1110+
1111+ void for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& exec) override
1112+ {
1113+ exec(buffer);
1114+ }
1115+
1116+ StubDisplayBuffer buffer;
1117+};
1118+
1119+}
1120+
1121+VsyncSimulatingPlatform::VsyncSimulatingPlatform(geom::Size const& output_size, int vsync_rate_in_hz)
1122+ : display(std::make_shared<StubDisplay>(output_size, vsync_rate_in_hz))
1123+{
1124+}
1125+
1126+std::shared_ptr<mg::GraphicBufferAllocator> VsyncSimulatingPlatform::create_buffer_allocator()
1127+{
1128+ return std::make_shared<mtd::StubBufferAllocator>();
1129+}
1130+
1131+std::shared_ptr<mg::BufferWriter> VsyncSimulatingPlatform::make_buffer_writer()
1132+{
1133+ return std::make_shared<StubBufferWriter>();
1134+}
1135+
1136+std::shared_ptr<mg::Display> VsyncSimulatingPlatform::create_display(
1137+ std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
1138+ std::shared_ptr<mg::GLProgramFactory> const&,
1139+ std::shared_ptr<mg::GLConfig> const&)
1140+{
1141+ return display;
1142+}
1143+
1144+std::shared_ptr<mg::PlatformIpcOperations> VsyncSimulatingPlatform::make_ipc_operations() const
1145+{
1146+ return std::make_shared<StubIpcOps>();
1147+}
1148+
1149+std::shared_ptr<mg::InternalClient> VsyncSimulatingPlatform::create_internal_client()
1150+{
1151+ return nullptr;
1152+}
1153
1154=== added file 'benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h'
1155--- benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h 1970-01-01 00:00:00 +0000
1156+++ benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h 2014-11-25 17:45:03 +0000
1157@@ -0,0 +1,48 @@
1158+/*
1159+ * Copyright © 2014 Canonical Ltd.
1160+ *
1161+ * This program is free software: you can redistribute it and/or modify
1162+ * it under the terms of the GNU General Public License version 3 as
1163+ * published by the Free Software Foundation.
1164+ *
1165+ * This program is distributed in the hope that it will be useful,
1166+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1167+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1168+ * GNU General Public License for more details.
1169+ *
1170+ * You should have received a copy of the GNU General Public License
1171+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1172+ *
1173+ * Authored by: Robert Carr <robert.carr@canonical.com>
1174+ */
1175+
1176+#ifndef VSYNC_SIMULATING_GRAPHICS_PLATFORM_H_
1177+#define VSYNC_SIMULATING_GRAPHICS_PLATFORM_H_
1178+
1179+#include "mir/graphics/platform.h"
1180+#include "mir/geometry/rectangle.h"
1181+
1182+#include "mir_test_doubles/null_platform.h"
1183+
1184+class VsyncSimulatingPlatform : public mir::test::doubles::NullPlatform
1185+{
1186+public:
1187+ VsyncSimulatingPlatform(mir::geometry::Size const& output_size, int vsync_rate_in_hz);
1188+ ~VsyncSimulatingPlatform() = default;
1189+
1190+ std::shared_ptr<mir::graphics::GraphicBufferAllocator> create_buffer_allocator();
1191+ std::shared_ptr<mir::graphics::BufferWriter> make_buffer_writer();
1192+
1193+ std::shared_ptr<mir::graphics::Display> create_display(
1194+ std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> const& initial_conf_policy,
1195+ std::shared_ptr<mir::graphics::GLProgramFactory> const& gl_program_factory,
1196+ std::shared_ptr<mir::graphics::GLConfig> const& gl_config);
1197+
1198+ std::shared_ptr<mir::graphics::PlatformIpcOperations> make_ipc_operations() const;
1199+ std::shared_ptr<mir::graphics::InternalClient> create_internal_client();
1200+
1201+private:
1202+ std::shared_ptr<mir::graphics::Display> display;
1203+};
1204+
1205+#endif // VSYNC_SIMULATING_GRAPHICS_PLATFORM_H_
1206
1207=== modified file 'client-ABI-sha1sums'
1208--- client-ABI-sha1sums 2014-09-30 06:11:33 +0000
1209+++ client-ABI-sha1sums 2014-11-25 17:45:03 +0000
1210@@ -1,16 +1,15 @@
1211-b64b3ca16e4130c838bdca248189f8055804c849 include/client/mir/client/private.h
1212-cbe1e3ccfea6ab5865510f4f598ec11571fcc852 include/client/mir_toolkit/mir_client_library_debug.h
1213+afd66e984f4f8c0303fd25fb6fea32fa47bbd37f include/client/mir_toolkit/debug/surface.h
1214 b53736bcb22ddc09aab8275cfdd05c109fdd0f12 include/client/mir_toolkit/mir_client_library_drm.h
1215 1522a5fcdb01c0d9a990364539c4f1255853eef7 include/client/mir_toolkit/mir_client_library.h
1216-e6185b680533c5fdcf1294a4797d5c3dd01d433f include/client/mir_toolkit/mir_connection.h
1217+626fbcc008539c5f1713d8f6eef8c2acc4929af9 include/client/mir_toolkit/mir_connection.h
1218 1ef8f51a3e3f8d1559266c5af58fbfde7cfabf0a include/client/mir_toolkit/mir_cursor_configuration.h
1219-6ff12425fed19f2a5aa37390904c14ff6a647bcd include/client/mir_toolkit/mir_prompt_session.h
1220+9d50df5a141ca03ee8a79f7e844ed4b8b3b7d5d3 include/client/mir_toolkit/mir_prompt_session.h
1221 21d07e655e85eeec8a3523e1c6f9c2252176ec01 include/client/mir_toolkit/mir_screencast.h
1222-8609754db3be20e11e43858dd2c36b5bd480d5ec include/client/mir_toolkit/mir_surface.h
1223+4f85e3d00314a7df869e56c3701a45310909fae2 include/client/mir_toolkit/mir_surface.h
1224 b141c4d79802ad626d969249c0004744e5c2a525 include/client/mir_toolkit/mir_wait.h
1225 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
1226-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
1227+2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h
1228 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
1229 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
1230-99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
1231+4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h
1232 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h
1233
1234=== modified file 'cmake/ABICheck.cmake'
1235--- cmake/ABICheck.cmake 2014-10-03 03:02:09 +0000
1236+++ cmake/ABICheck.cmake 2014-11-25 17:45:03 +0000
1237@@ -39,6 +39,10 @@
1238 ${private_headers}"
1239 )
1240
1241+ if (NOT ${CMAKE_MAJOR_VERSION} LESS 3)
1242+ cmake_policy(SET CMP0026 OLD)
1243+ endif()
1244+ # TODO: Deprecate use of "LOCATION" (CMP0026) ...
1245 if ("${ABI_DUMP_PREBUILT_LIBDIR}" STREQUAL "")
1246 get_property(LIB_DESC_LIBS TARGET ${libname} PROPERTY LOCATION)
1247 else()
1248
1249=== modified file 'cmake/MirCommon.cmake'
1250--- cmake/MirCommon.cmake 2014-09-30 06:11:33 +0000
1251+++ cmake/MirCommon.cmake 2014-11-25 17:45:03 +0000
1252@@ -43,7 +43,22 @@
1253
1254 function (mir_discover_tests EXECUTABLE)
1255 if(DISABLE_GTEST_TEST_DISCOVERY)
1256- add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} "--gtest_filter=-*DeathTest.*")
1257+ execute_process(
1258+ COMMAND uname -r
1259+ OUTPUT_VARIABLE KERNEL_VERSION_FULL
1260+ OUTPUT_STRIP_TRAILING_WHITESPACE
1261+ )
1262+ string(REGEX MATCH "^[0-9]+[.][0-9]+" KERNEL_VERSION ${KERNEL_VERSION_FULL})
1263+ message(STATUS "Kernel version detected: " ${KERNEL_VERSION})
1264+ # Some tests expect kernel version 3.11 and up
1265+ if (${KERNEL_VERSION} VERSION_LESS "3.11")
1266+ add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}
1267+ "--gtest_filter=-*DeathTest.*:AnonymousShmFile.*:MesaBufferAllocatorTest.software_buffers_dont_bypass:MesaBufferAllocatorTest.creates_software_rendering_buffer")
1268+ else()
1269+ add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}
1270+ "--gtest_filter=-*DeathTest.*")
1271+ endif()
1272+
1273 add_test(${EXECUTABLE}_death_tests ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} "--gtest_filter=*DeathTest.*")
1274 if (${ARGC} GREATER 1)
1275 set_property(TEST ${EXECUTABLE} PROPERTY ENVIRONMENT ${ARGN})
1276
1277=== modified file 'cmake/src/mir/mir_discover_gtest_tests.cpp'
1278--- cmake/src/mir/mir_discover_gtest_tests.cpp 2014-09-11 05:51:44 +0000
1279+++ cmake/src/mir/mir_discover_gtest_tests.cpp 2014-11-25 17:45:03 +0000
1280@@ -16,6 +16,11 @@
1281 #include <getopt.h>
1282 #include <sys/ioctl.h>
1283 #include <unistd.h>
1284+#ifndef _GNU_SOURCE
1285+// Needed for O_TMPFILE
1286+#define _GNU_SOURCE
1287+#endif
1288+#include <fcntl.h>
1289
1290 using namespace std;
1291
1292@@ -302,9 +307,19 @@
1293 {
1294 testfilecmake << "SET( ENV{"<<env_pair.first<<"} \""<<env_pair.second<<"\" )"<<std::endl;
1295 }
1296+
1297+ int ret = open("/dev/shm", O_TMPFILE | O_RDWR | O_EXCL, S_IRWXU);
1298+ bool kernel_supports_O_TMPFILE = (ret != -1);
1299+ if (kernel_supports_O_TMPFILE) close(ret);
1300+
1301 for (auto test = tests.begin(); test != tests.end(); ++ test)
1302 {
1303 static char cmd_line[1024] = "";
1304+
1305+ // Don't run AnonymousShmFile.* tests on older kernels
1306+ if (!kernel_supports_O_TMPFILE && *test == "AnonymousShmFile.*")
1307+ continue;
1308+
1309 snprintf(
1310 cmd_line,
1311 sizeof(cmd_line),
1312@@ -314,7 +329,10 @@
1313 test_suite.c_str(),
1314 elide_string_left(*test, output_width/2).c_str(),
1315 config.executable,
1316- test->c_str());
1317+ // Don't run MesaBufferAllocatorTest.{software_buffers_dont_bypass|creates_software_rendering_buffer} tests on older kernels
1318+ ((*test == "MesaBufferAllocatorTest.*") && !kernel_supports_O_TMPFILE)
1319+ ? "MesaBufferAllocatorTest.*:-MesaBufferAllocatorTest.software_buffers_dont_bypass:MesaBufferAllocatorTest.creates_software_rendering_buffer"
1320+ : test->c_str());
1321
1322 if (testfilecmake.good())
1323 {
1324
1325=== modified file 'common-ABI-sha1sums'
1326--- common-ABI-sha1sums 2014-09-30 06:11:33 +0000
1327+++ common-ABI-sha1sums 2014-11-25 17:45:03 +0000
1328@@ -9,10 +9,10 @@
1329 dcf8b8982f138bdde39a241825c610e955cd5e33 include/common/mir/input/input_platform.h
1330 208cd6aed5ef5f8f39b3eb86604e4133cb840485 include/common/mir/input/input_receiver_thread.h
1331 be7d58c9fde2ce91cc66dd6144b76e08b536266b include/common/mir/int_wrapper.h
1332-48015c67ddc4998ed5a2e8bb04ff3a4bfdd6a613 include/common/mir/time/clock.h
1333+9ae8473df05dd9e048a73797f01a2f34f7447554 include/common/mir/time/types.h
1334 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
1335-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
1336+2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h
1337 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
1338 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
1339-99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
1340+4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h
1341 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h
1342
1343=== modified file 'debian/changelog'
1344--- debian/changelog 2014-10-10 14:01:27 +0000
1345+++ debian/changelog 2014-11-25 17:45:03 +0000
1346@@ -1,3 +1,57 @@
1347+mir (0.9.0) UNRELEASED; urgency=medium
1348+
1349+ * New upstream release 0.9.0 (https://launchpad.net/mir/+milestone/0.9.0)
1350+ - Enhancements:
1351+ . New simpler API to configure and run a mir server.
1352+ . The event loop is now based on GLib's main loop library instead of
1353+ Boost.Asio.
1354+ . For Android platforms, the server now sends buffer fence fds to its
1355+ clients instead of potentially stalling the compositor thread waiting
1356+ for them to be signalled.
1357+ . New client debug interface to translate from surface to screen
1358+ coordinates.
1359+ - ABI summary: Servers need rebuilding, but clients do not;
1360+ . Mirclient ABI unchanged at 8
1361+ . Mircommon ABI bumped to 3
1362+ . Mirplatform ABI bumped to 4
1363+ . Mirserver ABI bumped to 27
1364+ - Bug fixes:
1365+ . Add a debug interface to translate from surface to screen coordinates
1366+ (LP: #1346633)
1367+ . Ensure a buffer requested by a surface is not delivered
1368+ after the surface is deleted (LP: #1376324)
1369+ . Overlays are not displayed onscreen in some positions (LP: #1378326)
1370+ . Server aborts when an exception is thrown from the main thread
1371+ (LP: #1378740)
1372+ . Fix race causing lost alarm notifications (LP: #1381925)
1373+ . Avoid lifecycle notifications racing with connection release
1374+ (LP: #1386646)
1375+ . Improve error checking and reporting for the client library
1376+ (LP: #1390388)
1377+ . Mir demo-shell now detects power button using proper Linux scan codes
1378+ (LP: #1303817)
1379+ . A prompt session with an invalid application pid should be an error
1380+ (LP: #1377968)
1381+ . When XDG_RUNTIME_DIR is defined but pointing to a non-existing
1382+ directory use "/tmp" (LP: #1304873)
1383+ . [regression] demo-shell bypass is not used on fullscreen surfaces if
1384+ there are windowed surfaces behind (LP: #1378706)
1385+ . Mir upgrade through dist-upgrade installs incorrect platform
1386+ (LP: #1378995)
1387+ . Fix Mir progressbar example using internal glibc defines(LP: #239272)
1388+ . Stop the default_lifecycle_event_handler raising SIGHUP while
1389+ disconnecting (LP: #1386185)
1390+ . [regression] Mir fails to build with MIR_ENABLE_TESTS=OFF (LP: #1388539)
1391+ . [regression] mir_demo_server_basic does not start (LP: #1391923)
1392+
1393+ -- Alberto Aguirre <alberto.aguirre@canonical.com> Thu, 20 Nov 2014 10:04:54 -0600
1394+
1395+mir (0.8.0+14.10.20141010-0ubuntu2) vivid; urgency=medium
1396+
1397+ * No change rebuild to get debug symbols on all architectures.
1398+
1399+ -- Brian Murray <brian@ubuntu.com> Wed, 19 Nov 2014 11:33:10 -0800
1400+
1401 mir (0.8.0+14.10.20141010-0ubuntu1) utopic; urgency=medium
1402
1403 [ Daniel van Vugt ]
1404
1405=== modified file 'debian/control'
1406--- debian/control 2014-10-01 03:41:21 +0000
1407+++ debian/control 2014-11-25 17:45:03 +0000
1408@@ -35,31 +35,46 @@
1409 liblttng-ust-dev,
1410 libxkbcommon-dev,
1411 libumockdev-dev (>= 0.6),
1412- umockdev,
1413+ umockdev (>= 0.8.7),
1414 libudev-dev,
1415 google-mock (>= 1.6.0+svn437),
1416 valgrind [!arm64],
1417+ libglib2.0-dev,
1418 Standards-Version: 3.9.4
1419 Homepage: https://launchpad.net/mir
1420 # If you aren't a member of ~mir-team but need to upload packaging changes,
1421 # just go ahead. ~mir-team will notice and sync up the code again.
1422 Vcs-Bzr: https://code.launchpad.net/~mir-team/mir/trunk
1423
1424-Package: libmirserver26
1425-Section: libs
1426-Architecture: i386 amd64 armhf arm64
1427-Multi-Arch: same
1428-Pre-Depends: ${misc:Pre-Depends}
1429-Depends: ${misc:Depends},
1430- ${shlibs:Depends},
1431- libmirplatform3driver-mesa | libmirplatform3driver-android,
1432+Package: libmirprotobuf0
1433+Section: libs
1434+Architecture: i386 amd64 armhf arm64
1435+Multi-Arch: same
1436+Pre-Depends: ${misc:Pre-Depends}
1437+Depends: ${misc:Depends},
1438+ ${shlibs:Depends},
1439+Description: Display server for Ubuntu - RPC definitions
1440+ Mir is a display server running on linux systems, with a focus on efficiency,
1441+ robust operation and a well-defined driver model.
1442+ .
1443+ Contains the shared library containing the Google Protobuf definitions
1444+ required for Mir clients and servers.
1445+
1446+Package: libmirserver27
1447+Section: libs
1448+Architecture: i386 amd64 armhf arm64
1449+Multi-Arch: same
1450+Pre-Depends: ${misc:Pre-Depends}
1451+Depends: ${misc:Depends},
1452+ ${shlibs:Depends},
1453+ libmir${platform-driver}-mesa | libmir${platform-driver}-android,
1454 Description: Display server for Ubuntu - server library
1455 Mir is a display server running on linux systems, with a focus on efficiency,
1456 robust operation and a well-defined driver model.
1457 .
1458 Contains the shared library needed by server applications for Mir.
1459
1460-Package: libmirplatform3
1461+Package: libmirplatform4
1462 Section: libs
1463 Architecture: i386 amd64 armhf arm64
1464 Multi-Arch: same
1465@@ -73,40 +88,12 @@
1466 Contains the shared libraries required for the Mir server to interact with
1467 the underlying hardware platform.
1468
1469-Package: libmirplatform3driver-mesa
1470-Section: libs
1471-Architecture: i386 amd64 armhf arm64
1472-Multi-Arch: same
1473-Pre-Depends: ${misc:Pre-Depends}
1474-Depends: ${misc:Depends},
1475- ${shlibs:Depends},
1476-Description: Display server for Ubuntu - platform library for Mesa
1477- Mir is a display server running on linux systems, with a focus on efficiency,
1478- robust operation and a well-defined driver model.
1479- .
1480- Contains the shared libraries required for the Mir server to interact with
1481- the hardware platform using the Mesa drivers.
1482-
1483-Package: libmirplatform3driver-android
1484-Section: libs
1485-Architecture: i386 amd64 armhf
1486-Multi-Arch: same
1487-Pre-Depends: ${misc:Pre-Depends}
1488-Depends: ${misc:Depends},
1489- ${shlibs:Depends},
1490-Description: Display server for Ubuntu - platform library for Android
1491- Mir is a display server running on linux systems, with a focus on efficiency,
1492- robust operation and a well-defined driver model.
1493- .
1494- Contains the shared libraries required for the Mir server to interact with
1495- the hardware platform using the Android drivers.
1496-
1497 Package: libmircommon-dev
1498 Section: libdevel
1499 Architecture: i386 amd64 armhf arm64
1500 Multi-Arch: same
1501 Pre-Depends: ${misc:Pre-Depends}
1502-Depends: libmircommon2 (= ${binary:Version}),
1503+Depends: libmircommon3 (= ${binary:Version}),
1504 libprotobuf-dev (>= 2.4.1),
1505 ${misc:Depends},
1506 Breaks: mircommon-dev (<< 0.6)
1507@@ -122,7 +109,7 @@
1508 Architecture: i386 amd64 armhf arm64
1509 Multi-Arch: same
1510 Pre-Depends: ${misc:Pre-Depends}
1511-Depends: libmirplatform3 (= ${binary:Version}),
1512+Depends: libmirplatform4 (= ${binary:Version}),
1513 libmircommon-dev,
1514 libboost-program-options-dev,
1515 ${misc:Depends},
1516@@ -139,7 +126,7 @@
1517 Architecture: i386 amd64 armhf arm64
1518 Multi-Arch: same
1519 Pre-Depends: ${misc:Pre-Depends}
1520-Depends: libmirserver26 (= ${binary:Version}),
1521+Depends: libmirserver27 (= ${binary:Version}),
1522 libmirplatform-dev (= ${binary:Version}),
1523 libmircommon-dev (= ${binary:Version}),
1524 libglm-dev,
1525@@ -157,7 +144,7 @@
1526 Pre-Depends: ${misc:Pre-Depends}
1527 Depends: ${misc:Depends},
1528 ${shlibs:Depends},
1529- libmirclient8driver-mesa | libmirclient8driver-android,
1530+ libmir${client-driver}-mesa | libmir${client-driver}-android,
1531 Description: Display server for Ubuntu - client library
1532 Mir is a display server running on linux systems, with a focus on efficiency,
1533 robust operation and a well-defined driver model.
1534@@ -179,33 +166,51 @@
1535 .
1536 Contains header files required to develop against Mir.
1537
1538-Package: libmirclient8driver-mesa
1539+Package: libmirclient-debug-extension1
1540 Section: libs
1541 Architecture: i386 amd64 armhf arm64
1542 Multi-Arch: same
1543 Pre-Depends: ${misc:Pre-Depends}
1544 Depends: ${misc:Depends},
1545- ${shlibs:Depends}
1546-Description: Display server for Ubuntu - client platform library for Mesa
1547+ ${shlibs:Depends},
1548+Description: Display server for Ubuntu - optional client debug interfaces
1549 Mir is a display server running on linux systems, with a focus on efficiency,
1550 robust operation and a well-defined driver model.
1551 .
1552- Contains the shared libraries required for the Mir clients to interact with
1553- the underlying hardware platform using the Mesa drivers.
1554+ This package contains both a shared library containing the client side of
1555+ various optional debugging interfaces and the development headers required
1556+ to use them.
1557+ .
1558+ This is primarily useful for developing Mir servers, low-level client
1559+ toolkits, or for automated testing in constrained environments.
1560+ .
1561+ Not all Mir servers have the capability to service these APIs; end-user
1562+ applications SHOULD NOT depend on this library.
1563
1564-Package: libmirclient8driver-android
1565-Section: libs
1566-Architecture: i386 amd64 armhf
1567+Package: libmirclient-debug-extension-dev
1568+Section: libdevel
1569+Architecture: i386 amd64 armhf arm64
1570 Multi-Arch: same
1571 Pre-Depends: ${misc:Pre-Depends}
1572-Depends: ${misc:Depends},
1573- ${shlibs:Depends}
1574-Description: Display server for Ubuntu - client platform library for Android
1575+Depends: libmirclient-debug-extension1 (= ${binary:Version}),
1576+ ${misc:Depends},
1577+ ${shlibs:Depends},
1578+Description: Display server for Ubuntu - client debug interface headers
1579 Mir is a display server running on linux systems, with a focus on efficiency,
1580 robust operation and a well-defined driver model.
1581 .
1582- Contains the shared libraries required for the Mir clients to interact with
1583- the underlying hardware platform using the Android drivers.
1584+ This package contains both a shared library containing the client side of
1585+ various optional debugging interfaces and the development headers required
1586+ to use them.
1587+ .
1588+ This is primarily useful for developing Mir servers, low-level client
1589+ toolkits, or for automated testing in constrained environments.
1590+ .
1591+ Not all Mir servers have the capability to service these APIs; end-user
1592+ applications SHOULD NOT depend on this library.
1593+ .
1594+ This package contains the development headers required to develop against
1595+ the debug extensions.
1596
1597 Package: mir-demos
1598 Architecture: i386 amd64 armhf arm64
1599@@ -247,7 +252,7 @@
1600 .
1601 Contains a tool for stress testing the Mir display server
1602
1603-Package: libmircommon2
1604+Package: libmircommon3
1605 Section: libs
1606 Architecture: i386 amd64 armhf arm64
1607 Multi-Arch: same
1608@@ -259,3 +264,90 @@
1609 robust operation and a well-defined driver model.
1610 .
1611 Contains the shared libraries required for the Mir server and client.
1612+
1613+# Longer-term these drivers should move out-of-tree
1614+Package: libmirclient8driver-mesa
1615+Section: libs
1616+Architecture: i386 amd64 armhf arm64
1617+Multi-Arch: same
1618+Pre-Depends: ${misc:Pre-Depends}
1619+Depends: ${misc:Depends},
1620+ ${shlibs:Depends}
1621+Description: Display server for Ubuntu - client platform library for Mesa
1622+ Mir is a display server running on linux systems, with a focus on efficiency,
1623+ robust operation and a well-defined driver model.
1624+ .
1625+ Contains the shared libraries required for the Mir clients to interact with
1626+ the underlying hardware platform using the Mesa drivers.
1627+
1628+Package: libmirclient8driver-android
1629+Section: libs
1630+Architecture: i386 amd64 armhf
1631+Multi-Arch: same
1632+Pre-Depends: ${misc:Pre-Depends}
1633+Depends: ${misc:Depends},
1634+ ${shlibs:Depends}
1635+Description: Display server for Ubuntu - client platform library for Android
1636+ Mir is a display server running on linux systems, with a focus on efficiency,
1637+ robust operation and a well-defined driver model.
1638+ .
1639+ Contains the shared libraries required for the Mir clients to interact with
1640+ the underlying hardware platform using the Android drivers.
1641+
1642+Package: libmirplatform4driver-mesa
1643+Section: libs
1644+Architecture: i386 amd64 armhf arm64
1645+Multi-Arch: same
1646+Pre-Depends: ${misc:Pre-Depends}
1647+Depends: ${misc:Depends},
1648+ ${shlibs:Depends},
1649+Description: Display server for Ubuntu - platform library for Mesa
1650+ Mir is a display server running on linux systems, with a focus on efficiency,
1651+ robust operation and a well-defined driver model.
1652+ .
1653+ Contains the shared libraries required for the Mir server to interact with
1654+ the hardware platform using the Mesa drivers.
1655+
1656+Package: libmirplatform4driver-android
1657+Section: libs
1658+Architecture: i386 amd64 armhf
1659+Multi-Arch: same
1660+Pre-Depends: ${misc:Pre-Depends}
1661+Depends: ${misc:Depends},
1662+ ${shlibs:Depends},
1663+Description: Display server for Ubuntu - platform library for Android
1664+ Mir is a display server running on linux systems, with a focus on efficiency,
1665+ robust operation and a well-defined driver model.
1666+ .
1667+ Contains the shared libraries required for the Mir server to interact with
1668+ the hardware platform using the Android drivers.
1669+
1670+Package: mir-graphics-drivers-desktop
1671+Section: libs
1672+Architecture: i386 amd64 armhf arm64
1673+Multi-Arch: same
1674+Pre-Depends: ${misc:Pre-Depends}
1675+Depends: ${misc:Depends},
1676+ libmir${platform-driver}-mesa,
1677+ libmir${client-driver}-mesa
1678+Description: Display server for Ubuntu - desktop driver metapackage
1679+ Mir is a display server running on linux systems, with a focus on efficiency,
1680+ robust operation and a well-defined driver model.
1681+ .
1682+ This package depends on a full set of graphics drivers for traditional desktop
1683+ systems.
1684+
1685+Package: mir-graphics-drivers-android
1686+Section: libs
1687+Architecture: i386 amd64 armhf
1688+Multi-Arch: same
1689+Pre-Depends: ${misc:Pre-Depends}
1690+Depends: ${misc:Depends},
1691+ libmir${platform-driver}-android,
1692+ libmir${client-driver}-android
1693+Description: Display server for Ubuntu - android driver metapackage
1694+ Mir is a display server running on linux systems, with a focus on efficiency,
1695+ robust operation and a well-defined driver model.
1696+ .
1697+ This package depends on a full set of graphics drivers for running Mir on top
1698+ of an existing Android driver stack.
1699
1700=== added file 'debian/libmirclient-debug-extension-dev.install'
1701--- debian/libmirclient-debug-extension-dev.install 1970-01-01 00:00:00 +0000
1702+++ debian/libmirclient-debug-extension-dev.install 2014-11-25 17:45:03 +0000
1703@@ -0,0 +1,3 @@
1704+usr/include/mirclient/mir_toolkit/debug
1705+usr/lib/*/pkgconfig/mirclient-debug-extension.pc
1706+usr/lib/*/libmirclient-debug-extension.so
1707
1708=== added file 'debian/libmirclient-debug-extension1.install'
1709--- debian/libmirclient-debug-extension1.install 1970-01-01 00:00:00 +0000
1710+++ debian/libmirclient-debug-extension1.install 2014-11-25 17:45:03 +0000
1711@@ -0,0 +1,1 @@
1712+usr/lib/*/libmirclient-debug-extension.so.*
1713
1714=== modified file 'debian/libmirclient-dev.install'
1715--- debian/libmirclient-dev.install 2013-06-24 12:15:28 +0000
1716+++ debian/libmirclient-dev.install 2014-11-25 17:45:03 +0000
1717@@ -1,3 +1,3 @@
1718-usr/include/mirclient
1719+usr/include/mirclient/mir_toolkit/*.h
1720 usr/lib/*/pkgconfig/mirclient.pc
1721 usr/lib/*/libmirclient.so
1722
1723=== renamed file 'debian/libmircommon2.install' => 'debian/libmircommon3.install'
1724--- debian/libmircommon2.install 2014-09-30 06:11:33 +0000
1725+++ debian/libmircommon3.install 2014-11-25 17:45:03 +0000
1726@@ -1,1 +1,1 @@
1727-usr/lib/*/libmircommon.so.2
1728+usr/lib/*/libmircommon.so.3
1729
1730=== renamed file 'debian/libmirplatform3.install' => 'debian/libmirplatform4.install'
1731--- debian/libmirplatform3.install 2014-09-30 06:11:33 +0000
1732+++ debian/libmirplatform4.install 2014-11-25 17:45:03 +0000
1733@@ -1,1 +1,1 @@
1734-usr/lib/*/libmirplatform.so.3
1735+usr/lib/*/libmirplatform.so.4
1736
1737=== renamed file 'debian/libmirplatform3driver-android.install' => 'debian/libmirplatform4driver-android.install'
1738=== renamed file 'debian/libmirplatform3driver-mesa.install' => 'debian/libmirplatform4driver-mesa.install'
1739=== added file 'debian/libmirprotobuf0.install'
1740--- debian/libmirprotobuf0.install 1970-01-01 00:00:00 +0000
1741+++ debian/libmirprotobuf0.install 2014-11-25 17:45:03 +0000
1742@@ -0,0 +1,1 @@
1743+usr/lib/*/libmirprotobuf.so.0
1744
1745=== renamed file 'debian/libmirserver26.install' => 'debian/libmirserver27.install'
1746--- debian/libmirserver26.install 2014-09-30 06:11:33 +0000
1747+++ debian/libmirserver27.install 2014-11-25 17:45:03 +0000
1748@@ -1,1 +1,1 @@
1749-usr/lib/*/libmirserver.so.26
1750+usr/lib/*/libmirserver.so.27
1751
1752=== modified file 'debian/mir-test-tools.install'
1753--- debian/mir-test-tools.install 2014-09-11 05:51:44 +0000
1754+++ debian/mir-test-tools.install 2014-11-25 17:45:03 +0000
1755@@ -5,3 +5,4 @@
1756 usr/bin/mir_performance_tests
1757 usr/lib/*/mir/tools/libmirclientlttng.so
1758 usr/lib/*/mir/tools/libmirserverlttng.so
1759+usr/lib/*/libmirplatformstub.so
1760
1761=== modified file 'debian/rules'
1762--- debian/rules 2014-09-30 06:11:33 +0000
1763+++ debian/rules 2014-11-25 17:45:03 +0000
1764@@ -13,7 +13,7 @@
1765 export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
1766 export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
1767
1768-export PLATFORM_DRIVER = platform3driver
1769+export PLATFORM_DRIVER = platform4driver
1770 export CLIENT_DRIVER = client8driver
1771
1772 %:
1773@@ -51,6 +51,10 @@
1774 dh_makeshlibs -V
1775
1776 override_dh_install:
1777+# Nothing outside Mir should link to libmirprotobuf directly.
1778+# Delete the symlink so that --fail-missing doesn't think we've missed it
1779+# accidentally.
1780+ rm debian/tmp/usr/lib/*/libmirprotobuf.so
1781 dh_install --fail-missing \
1782 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmir$(PLATFORM_DRIVER).so \
1783 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmir$(CLIENT_DRIVER).so
1784@@ -60,3 +64,8 @@
1785 sh debian/create_postinst_prerm_scripts.sh \
1786 $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
1787 dh_installdeb
1788+
1789+override_dh_gencontrol:
1790+ dh_gencontrol -- \
1791+ -Vplatform-driver=$(PLATFORM_DRIVER) \
1792+ -Vclient-driver=$(CLIENT_DRIVER)
1793
1794=== modified file 'doc/building_source_for_android.md'
1795--- doc/building_source_for_android.md 2014-09-11 05:51:44 +0000
1796+++ doc/building_source_for_android.md 2014-11-25 17:45:03 +0000
1797@@ -54,13 +54,13 @@
1798 Initial setup of a desktop machine for cross-compiling to armhf is simple:
1799
1800 $ sudo apt-get install g++-arm-linux-gnueabihf debootstrap
1801- $ sudo sh -c 'echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ utopic main restricted universe multiverse" > /etc/apt/sources.list.d/armhf-xcompile.list'
1802+ $ sudo sh -c 'echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ `lsb_release -sc` main restricted universe multiverse" > /etc/apt/sources.list.d/armhf-xcompile.list'
1803 $ sudo apt-get update
1804
1805 Now to test that everything is working you can try downloading a package like
1806 this:
1807
1808- $ apt-get download gcc:armhf
1809+ $ apt-get download gcc:armhf && echo Success || echo Failure
1810
1811 Once you're able to download armhf packages from the repository, the
1812 cross-compile-chroot.sh script provides an example of how to build Mir for
1813
1814=== modified file 'doc/demo_shell_controls.md'
1815--- doc/demo_shell_controls.md 2014-05-20 07:11:21 +0000
1816+++ doc/demo_shell_controls.md 2014-11-25 17:45:03 +0000
1817@@ -37,7 +37,8 @@
1818 - Move window: *Alt-leftmousebutton* or *3-finger drag*
1819 - Resize window: *Alt-middlemousebutton* or *3-finger pinch/zoom*
1820 - Sleep/wake all displays: *Alt-P* or *Android power button*
1821- - Rotate the focussed monitor: *Ctrl-Alt-(Left/Right/Up/Down)*
1822+ - Rotate the focussed monitor: *Ctrl-Alt-(Left/Right/Up/Down)* or
1823+ *Volume up/down while touching the screen*
1824 - Change display mode of the focussed monitor: *Ctrl-Alt-(=/-)*
1825 - Reset display mode to default, on focussed monitor: *Ctrl-Alt-0*
1826 - Adjust window opacity/alpha: *Alt-mousewheel*
1827
1828=== modified file 'doc/mainpage.md'
1829--- doc/mainpage.md 2014-10-03 03:02:09 +0000
1830+++ doc/mainpage.md 2014-11-25 17:45:03 +0000
1831@@ -29,6 +29,12 @@
1832 - \ref building_source_for_pc
1833 - \ref building_source_for_android
1834
1835+### Preparing a VM to run Mir
1836+
1837+Especially if you want to debug the shell without locking your system this might be a helpful setup:
1838+
1839+- \ref setup_kvm_for_mir
1840+
1841 Using Mir
1842 ---------
1843
1844
1845=== added file 'doc/setup_kvm_for_mir.md'
1846--- doc/setup_kvm_for_mir.md 1970-01-01 00:00:00 +0000
1847+++ doc/setup_kvm_for_mir.md 2014-11-25 17:45:03 +0000
1848@@ -0,0 +1,70 @@
1849+Setup KVM for Mir {#setup_kvm_for_mir}
1850+=================
1851+
1852+At the time of writing not all necessary patches to run Mir inside KVM can be
1853+found in a vanilla kernel release. The steps below describe setting up KVM and
1854+installing the right version of Mesa and the Linux kernel.
1855+
1856+Install KVM and utilities
1857+-------------------------
1858+
1859+The only way to run Mir inside KVM requires a setup with
1860+[SPICE](http://spice-space.org). So next to KVM a SPICE client is needed on
1861+the host to provide a monitor to the guest. The following description will use
1862+virt-manager for this task:
1863+
1864+ $ apt-get install qemu-KVM virt-manager python-spice-client-gtk
1865+
1866+More details on setting up KVM can be found in the
1867+[wiki](https://help.ubuntu.com/community/KVM/Installation).
1868+
1869+Now create a new virtual machine with virt-manager and a current Linux boot iso
1870+image or reconfigure an existing installation.
1871+
1872+Configure the virtual machine
1873+-----------------------------
1874+
1875+Launch virt-manager and open your virtual machine. Go to the configuration
1876+options through the info icon in the toolbar. There are now two relevant
1877+configuration entries: Video and Display.
1878+
1879+* Open the Display settings and select SPICE instead of KVM
1880+* Open the Video settings and select QXL as model.
1881+
1882+Now boot the machine and build a new kernel and verify that you have the right
1883+Mesa package.
1884+
1885+Build the right kernel
1886+----------------------
1887+
1888+Until Linux 3.18 is released either build
1889+[drm-next](http://cgit.freedesktop.org/~airlied/linux/log/?h=drm-next) for your
1890+KVM architecture or pull the sources of the current Ubuntu kernel image and
1891+apply the following two patches before you build:
1892+
1893+* [drm/qxl: simple crtc page flipping emulated using buffer copy]
1894+(http://cgit.freedesktop.org/~airlied/linux/patch/?id=058e9f5c8236ad740ab984588b507758e5feee6d)
1895+* [drm/qxl: enables gem prime helpers for qxl using dummy driver callbacks]
1896+(http://cgit.freedesktop.org/~airlied/linux/patch/?id=47c1296829505d119d7d58dd23d39cc5db344f12)
1897+
1898+More detais on building a Kernel within and for Ubuntu is described [here]
1899+(https://help.ubuntu.com/community/Kernel/Compile) in full detail.
1900+
1901+
1902+Verify Mesa installation
1903+------------------------
1904+
1905+Since the DRM QXL driver only provides KMS, GEM and dma-buf support, and no 3D
1906+GPU emulation or forwarding, Mesa will load the kms-swrast driver. This driver
1907+is available since Mesa 10.3.0
1908+With that we have enough support for EGL and GLESv2 to run Mir.
1909+
1910+Additional steps
1911+----------------
1912+
1913+This is not necessary but helpful for day to day use:
1914+
1915+* Set up sharing on file system level using 9p as shown in
1916+[Fileystem Passthrough](http://www.linux-kvm.org/page/9p_virtio)
1917+
1918+Now you can finally install & run unity8-desktop-session-mir in KVM.
1919
1920=== modified file 'examples/CMakeLists.txt'
1921--- examples/CMakeLists.txt 2014-10-03 15:10:23 +0000
1922+++ examples/CMakeLists.txt 2014-11-25 17:45:03 +0000
1923@@ -6,7 +6,8 @@
1924 )
1925
1926 add_library(exampleserverconfig STATIC
1927- server_configuration.cpp
1928+ example_display_configuration_policy.cpp
1929+ example_input_event_filter.cpp
1930 )
1931
1932 target_link_libraries(eglapp
1933@@ -153,12 +154,14 @@
1934
1935 add_executable(mir_demo_server_basic
1936 basic_server.cpp
1937- basic_server_configuration.cpp
1938+ glog_logger.cpp
1939 )
1940
1941 target_link_libraries(mir_demo_server_basic
1942 mirserver
1943 exampleserverconfig
1944+ ${GLog_LIBRARY}
1945+ ${GFlags_LIBRARY}
1946 ${Boost_LIBRARIES}
1947 )
1948
1949@@ -172,23 +175,6 @@
1950 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1951 )
1952
1953-add_executable(mir_demo_server_translucent
1954- translucent_server.cpp
1955- translucent_server_configuration.cpp
1956- pixel_format_selector.cpp
1957- basic_server_configuration.cpp
1958-)
1959-
1960-target_link_libraries(mir_demo_server_translucent
1961- mirserver
1962- exampleserverconfig
1963- ${Boost_LIBRARIES}
1964-)
1965-
1966-install(TARGETS mir_demo_server_translucent
1967- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1968-)
1969-
1970 add_executable(mir_demo_standalone_render_overlays
1971 render_overlays.cpp
1972 )
1973
1974=== modified file 'examples/basic_server.cpp'
1975--- examples/basic_server.cpp 2014-03-06 06:05:17 +0000
1976+++ examples/basic_server.cpp 2014-11-25 17:45:03 +0000
1977@@ -1,5 +1,5 @@
1978 /*
1979- * Copyright © 2012, 2013 Canonical Ltd.
1980+ * Copyright © 2012-2014 Canonical Ltd.
1981 *
1982 * This program is free software: you can redistribute it and/or modify
1983 * it under the terms of the GNU General Public License version 3 as
1984@@ -16,23 +16,133 @@
1985 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1986 */
1987
1988-#include "basic_server_configuration.h"
1989+#include "example_input_event_filter.h"
1990+#include "example_display_configuration_policy.h"
1991+#include "glog_logger.h"
1992
1993+#include "mir/server.h"
1994 #include "mir/report_exception.h"
1995-#include "mir/run_mir.h"
1996-
1997-#include <iostream>
1998+#include "mir/options/option.h"
1999+#include "mir/input/composite_event_filter.h"
2000+
2001+#include <cstdlib>
2002+
2003+namespace me = mir::examples;
2004+namespace ml = mir::logging;
2005+namespace mg = mir::graphics;
2006+
2007+namespace
2008+{
2009+char const* const glog = "glog";
2010+char const* const glog_stderrthreshold = "glog-stderrthreshold";
2011+char const* const glog_minloglevel = "glog-minloglevel";
2012+char const* const glog_log_dir = "glog-log-dir";
2013+
2014+int const glog_stderrthreshold_default = 2;
2015+int const glog_minloglevel_default = 0;
2016+char const* const glog_log_dir_default = "";
2017+}
2018
2019 int main(int argc, char const* argv[])
2020 try
2021 {
2022- mir::examples::BasicServerConfiguration config(argc, argv);
2023-
2024- run_mir(config, [&](mir::DisplayServer&){ config.launch_client(); });
2025- return 0;
2026+ static char const* const launch_child_opt = "launch-client";
2027+ static char const* const launch_client_descr = "system() command to launch client";
2028+
2029+ mir::Server server;
2030+
2031+ // Set up a Ctrl+Alt+BkSp => quit
2032+ auto const quit_filter = std::make_shared<me::QuitFilter>([&]{ server.stop(); });
2033+
2034+ server.add_init_callback([&] { server.the_composite_event_filter()->append(quit_filter); });
2035+
2036+ // Add choice of monitor configuration
2037+ server.add_configuration_option(
2038+ me::display_config_opt, me::display_config_descr, me::clone_opt_val);
2039+ server.add_configuration_option(
2040+ me::display_alpha_opt, me::display_alpha_descr, me::display_alpha_off);
2041+
2042+ server.add_configuration_option(glog, "Use google::GLog for logging", mir::OptionType::null);
2043+
2044+ server.add_configuration_option(
2045+ glog_stderrthreshold,
2046+ "Copy log messages at or above this level "
2047+ "to stderr in addition to logfiles. The numbers "
2048+ "of severity levels INFO, WARNING, ERROR, and "
2049+ "FATAL are 0, 1, 2, and 3, respectively.",
2050+ glog_stderrthreshold_default);
2051+
2052+ server.add_configuration_option(
2053+ glog_minloglevel,
2054+ "Log messages at or above this level. The numbers "
2055+ "of severity levels INFO, WARNING, ERROR, and "
2056+ "FATAL are 0, 1, 2, and 3, respectively.",
2057+ glog_minloglevel_default);
2058+
2059+ server.add_configuration_option(
2060+ glog_log_dir,
2061+ "logfiles are written into this directory.",
2062+ glog_log_dir_default);
2063+
2064+ server.override_the_logger(
2065+ [&]() -> std::shared_ptr<ml::Logger>
2066+ {
2067+ if (server.get_options()->is_set(glog))
2068+ {
2069+ return std::make_shared<me::GlogLogger>(
2070+ "mir",
2071+ server.get_options()->get<int>(glog_stderrthreshold),
2072+ server.get_options()->get<int>(glog_minloglevel),
2073+ server.get_options()->get<std::string>(glog_log_dir));
2074+ }
2075+ else
2076+ {
2077+ return std::shared_ptr<ml::Logger>{};
2078+ }
2079+ });
2080+
2081+ server.wrap_display_configuration_policy(
2082+ [&](std::shared_ptr<mg::DisplayConfigurationPolicy> const& wrapped)
2083+ -> std::shared_ptr<mg::DisplayConfigurationPolicy>
2084+ {
2085+ auto const options = server.get_options();
2086+ auto display_layout = options->get<std::string>(me::display_config_opt);
2087+ auto with_alpha = options->get<std::string>(me::display_alpha_opt) == me::display_alpha_on;
2088+
2089+ auto layout_selector = wrapped;
2090+
2091+ if (display_layout == me::sidebyside_opt_val)
2092+ layout_selector = std::make_shared<me::SideBySideDisplayConfigurationPolicy>();
2093+ else if (display_layout == me::single_opt_val)
2094+ layout_selector = std::make_shared<me::SingleDisplayConfigurationPolicy>();
2095+
2096+ // Whatever the layout select a pixel format with requested alpha
2097+ return std::make_shared<me::PixelFormatSelector>(layout_selector, with_alpha);
2098+ });
2099+
2100+ // Add a launcher option
2101+ server.add_configuration_option(
2102+ launch_child_opt, launch_client_descr, mir::OptionType::string);
2103+
2104+ server.add_init_callback([&]
2105+ {
2106+ auto const options = server.get_options();
2107+
2108+ if (options->is_set(launch_child_opt))
2109+ {
2110+ auto ignore = std::system((options->get<std::string>(launch_child_opt) + "&").c_str());
2111+ (void)ignore;
2112+ }
2113+ });
2114+
2115+ // Provide the command line and run the server
2116+ server.set_command_line(argc, argv);
2117+ server.apply_settings();
2118+ server.run();
2119+ return server.exited_normally() ? EXIT_SUCCESS : EXIT_FAILURE;
2120 }
2121 catch (...)
2122 {
2123- mir::report_exception(std::cerr);
2124- return 1;
2125+ mir::report_exception();
2126+ return EXIT_FAILURE;
2127 }
2128
2129=== removed file 'examples/basic_server_configuration.cpp'
2130--- examples/basic_server_configuration.cpp 2014-09-12 05:56:28 +0000
2131+++ examples/basic_server_configuration.cpp 1970-01-01 00:00:00 +0000
2132@@ -1,62 +0,0 @@
2133-/*
2134- * Copyright © 2012, 2014 Canonical Ltd.
2135- *
2136- * This program is free software: you can redistribute it and/or modify
2137- * it under the terms of the GNU General Public License version 3 as
2138- * published by the Free Software Foundation.
2139- *
2140- * This program is distributed in the hope that it will be useful,
2141- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2142- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2143- * GNU General Public License for more details.
2144- *
2145- * You should have received a copy of the GNU General Public License
2146- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2147- *
2148- * Authored by: Alan Griffiths <alan@octopull.co.uk>
2149- */
2150-
2151-#include "basic_server_configuration.h"
2152-#include "mir/options/default_configuration.h"
2153-
2154-#include "mir/abnormal_exit.h"
2155-#include "mir/options/option.h"
2156-
2157-#include <cstdlib>
2158-
2159-namespace
2160-{
2161-char const* const launch_child_opt = "launch-client";
2162-}
2163-
2164-namespace mir
2165-{
2166-namespace examples
2167-{
2168-
2169-BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv) :
2170- ServerConfiguration([argc, argv]
2171- {
2172- auto result = std::make_shared<options::DefaultConfiguration>(argc, argv);
2173-
2174- namespace po = boost::program_options;
2175-
2176- result->add_options()
2177- (launch_child_opt, po::value<std::string>(), "system() command to launch client");
2178-
2179- return result;
2180- }())
2181-{
2182-}
2183-
2184-void BasicServerConfiguration::launch_client()
2185-{
2186- if (the_options()->is_set(launch_child_opt))
2187- {
2188- auto ignore = std::system((the_options()->get<std::string>(launch_child_opt) + "&").c_str());
2189- (void)ignore;
2190- }
2191-}
2192-
2193-}
2194-}
2195
2196=== removed file 'examples/basic_server_configuration.h'
2197--- examples/basic_server_configuration.h 2014-01-02 14:54:13 +0000
2198+++ examples/basic_server_configuration.h 1970-01-01 00:00:00 +0000
2199@@ -1,43 +0,0 @@
2200-/*
2201- * Copyright © 2014 Canonical Ltd.
2202- *
2203- * This program is free software: you can redistribute it and/or modify
2204- * it under the terms of the GNU General Public License version 3 as
2205- * published by the Free Software Foundation.
2206- *
2207- * This program is distributed in the hope that it will be useful,
2208- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2209- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2210- * GNU General Public License for more details.
2211- *
2212- * You should have received a copy of the GNU General Public License
2213- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2214- *
2215- * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
2216- */
2217-
2218-#ifndef MIR_EXAMPLES_BASIC_SERVER_CONFIGURATION_H_
2219-#define MIR_EXAMPLES_BASIC_SERVER_CONFIGURATION_H_
2220-
2221-#include "server_configuration.h"
2222-
2223-namespace mir
2224-{
2225-namespace examples
2226-{
2227-
2228-/**
2229- * \brief BasicServerConfiguration extends ServerConfiguration with the ability to launch a client application
2230- */
2231-class BasicServerConfiguration : public ServerConfiguration
2232-{
2233-public:
2234- BasicServerConfiguration(int argc, char const** argv);
2235-
2236- void launch_client();
2237-};
2238-
2239-}
2240-}
2241-
2242-#endif /* MIR_EXAMPLES_BASIC_SERVER_CONFIGURATION_H_ */
2243
2244=== modified file 'examples/demo_input_filter.cpp'
2245--- examples/demo_input_filter.cpp 2014-09-12 05:56:28 +0000
2246+++ examples/demo_input_filter.cpp 2014-11-25 17:45:03 +0000
2247@@ -1,5 +1,5 @@
2248 /*
2249- * Copyright © 2013 Canonical Ltd.
2250+ * Copyright © 2013-2014 Canonical Ltd.
2251 *
2252 * This program is free software: you can redistribute it and/or modify
2253 * it under the terms of the GNU General Public License version 3 as
2254@@ -16,20 +16,20 @@
2255 * Authored by: Robert Carr <robert.carr@canonical.com>
2256 */
2257
2258-#include "mir/run_mir.h"
2259-#include "mir/abnormal_exit.h"
2260+#include "mir/server.h"
2261+#include "mir/report_exception.h"
2262+
2263+#include "example_input_event_filter.h"
2264 #include "mir/input/composite_event_filter.h"
2265-#include "server_configuration.h"
2266-
2267-#include <boost/exception/diagnostic_information.hpp>
2268-
2269+
2270+#include <cstdlib>
2271 #include <iostream>
2272
2273+namespace me = mir::examples;
2274 namespace mi = mir::input;
2275
2276 namespace
2277 {
2278-
2279 struct PrintingEventFilter : public mi::EventFilter
2280 {
2281 void print_motion_event(MirMotionEvent const& ev)
2282@@ -62,48 +62,29 @@
2283 return false;
2284 }
2285 };
2286-
2287-struct DemoServerConfiguration : public mir::examples::ServerConfiguration
2288-{
2289- DemoServerConfiguration(int argc, char const* argv[])
2290- : ServerConfiguration(argc, argv),
2291- event_filter(std::make_shared<PrintingEventFilter>())
2292- {
2293- }
2294-
2295- std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override
2296- {
2297- auto composite_filter = ServerConfiguration::the_composite_event_filter();
2298- composite_filter->prepend(event_filter);
2299- return composite_filter;
2300- }
2301-
2302- std::shared_ptr<PrintingEventFilter> const event_filter;
2303-};
2304-
2305-}
2306-
2307-
2308-void my_write_to_log(int /*prio*/, char const* buffer)
2309-{
2310- printf("%s\n", buffer);
2311 }
2312
2313 int main(int argc, char const* argv[])
2314 try
2315 {
2316- DemoServerConfiguration config(argc, argv);
2317-
2318- mir::run_mir(config, [](mir::DisplayServer&) {/* empty init */});
2319- return 0;
2320-}
2321-catch (mir::AbnormalExit const& error)
2322-{
2323- std::cerr << error.what() << std::endl;
2324- return 1;
2325-}
2326-catch (std::exception const& error)
2327-{
2328- std::cerr << "ERROR: " << boost::diagnostic_information(error) << std::endl;
2329- return 1;
2330+ mir::Server server;
2331+
2332+ // Set up Ctrl+Alt+BkSp => quit
2333+ auto const quit_filter = std::make_shared<me::QuitFilter>([&]{ server.stop(); });
2334+ server.add_init_callback([&] { server.the_composite_event_filter()->append(quit_filter); });
2335+
2336+ // Set up a PrintingEventFilter
2337+ auto const printing_filter = std::make_shared<PrintingEventFilter>();
2338+ server.add_init_callback([&] { server.the_composite_event_filter()->prepend(printing_filter); });
2339+
2340+ // Provide the command line and run the server
2341+ server.set_command_line(argc, argv);
2342+ server.apply_settings();
2343+ server.run();
2344+ return server.exited_normally() ? EXIT_SUCCESS : EXIT_FAILURE;
2345+}
2346+catch (...)
2347+{
2348+ mir::report_exception(std::cerr);
2349+ return EXIT_FAILURE;
2350 }
2351
2352=== added file 'examples/example_display_configuration_policy.cpp'
2353--- examples/example_display_configuration_policy.cpp 1970-01-01 00:00:00 +0000
2354+++ examples/example_display_configuration_policy.cpp 2014-11-25 17:45:03 +0000
2355@@ -0,0 +1,140 @@
2356+/*
2357+ * Copyright © 2014 Canonical Ltd.
2358+ *
2359+ * This program is free software: you can redistribute it and/or modify it
2360+ * under the terms of the GNU General Public License version 3,
2361+ * as published by the Free Software Foundation.
2362+ *
2363+ * This program is distributed in the hope that it will be useful,
2364+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2365+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2366+ * GNU General Public License for more details.
2367+ *
2368+ * You should have received a copy of the GNU General Public License
2369+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2370+ *
2371+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
2372+ */
2373+
2374+#include "example_display_configuration_policy.h"
2375+
2376+#include "mir/graphics/display_configuration.h"
2377+
2378+#include <algorithm>
2379+#include <unordered_map>
2380+#include <stdexcept>
2381+
2382+namespace geom = mir::geometry;
2383+namespace me = mir::examples;
2384+namespace mg = mir::graphics;
2385+
2386+char const* const me::display_config_opt = "display-config";
2387+char const* const me::display_config_descr = "Display configuration [{clone,sidebyside,single}]";
2388+
2389+char const* const me::clone_opt_val = "clone";
2390+char const* const me::sidebyside_opt_val = "sidebyside";
2391+char const* const me::single_opt_val = "single";
2392+
2393+char const* const me::display_alpha_opt = "translucent";
2394+char const* const me::display_alpha_descr = "Select a display mode with alpha[{on,off}]";
2395+
2396+char const* const me::display_alpha_off = "off";
2397+char const* const me::display_alpha_on = "on";
2398+
2399+void me::SideBySideDisplayConfigurationPolicy::apply_to(graphics::DisplayConfiguration& conf)
2400+{
2401+ size_t const preferred_mode_index{0};
2402+ int max_x = 0;
2403+ std::unordered_map<mg::DisplayConfigurationCardId, size_t> available_outputs_for_card;
2404+
2405+ conf.for_each_card(
2406+ [&](mg::DisplayConfigurationCard const& card)
2407+ {
2408+ available_outputs_for_card[card.id] = card.max_simultaneous_outputs;
2409+ });
2410+
2411+ conf.for_each_output(
2412+ [&](mg::UserDisplayConfigurationOutput& conf_output)
2413+ {
2414+ if (conf_output.connected && conf_output.modes.size() > 0 &&
2415+ available_outputs_for_card[conf_output.card_id] > 0)
2416+ {
2417+ conf_output.used = true;
2418+ conf_output.top_left = geom::Point{max_x, 0};
2419+ conf_output.current_mode_index = preferred_mode_index;
2420+ conf_output.power_mode = mir_power_mode_on;
2421+ conf_output.orientation = mir_orientation_normal;
2422+ max_x += conf_output.modes[preferred_mode_index].size.width.as_int();
2423+ --available_outputs_for_card[conf_output.card_id];
2424+ }
2425+ else
2426+ {
2427+ conf_output.used = false;
2428+ conf_output.power_mode = mir_power_mode_off;
2429+ }
2430+ });
2431+}
2432+
2433+
2434+void me::SingleDisplayConfigurationPolicy::apply_to(graphics::DisplayConfiguration& conf)
2435+{
2436+ size_t const preferred_mode_index{0};
2437+ bool done{false};
2438+
2439+ conf.for_each_output(
2440+ [&](mg::UserDisplayConfigurationOutput& conf_output)
2441+ {
2442+ if (!done && conf_output.connected && conf_output.modes.size() > 0)
2443+ {
2444+ conf_output.used = true;
2445+ conf_output.top_left = geom::Point{0, 0};
2446+ conf_output.current_mode_index = preferred_mode_index;
2447+ conf_output.power_mode = mir_power_mode_on;
2448+ done = true;
2449+ }
2450+ else
2451+ {
2452+ conf_output.used = false;
2453+ conf_output.power_mode = mir_power_mode_off;
2454+ }
2455+ });
2456+}
2457+
2458+namespace
2459+{
2460+bool contains_alpha(MirPixelFormat format)
2461+{
2462+ return (format == mir_pixel_format_abgr_8888 ||
2463+ format == mir_pixel_format_argb_8888);
2464+}
2465+}
2466+
2467+me::PixelFormatSelector::PixelFormatSelector(std::shared_ptr<DisplayConfigurationPolicy> const& base_policy,
2468+ bool with_alpha)
2469+ : base_policy{base_policy},
2470+ with_alpha{with_alpha}
2471+{}
2472+
2473+void me::PixelFormatSelector::apply_to(graphics::DisplayConfiguration & conf)
2474+{
2475+ base_policy->apply_to(conf);
2476+ conf.for_each_output(
2477+ [&](graphics::UserDisplayConfigurationOutput& conf_output)
2478+ {
2479+ if (!conf_output.connected || !conf_output.used) return;
2480+
2481+ auto const& pos = find_if(conf_output.pixel_formats.begin(),
2482+ conf_output.pixel_formats.end(),
2483+ [&](MirPixelFormat format) -> bool
2484+ {
2485+ return contains_alpha(format) == with_alpha;
2486+ }
2487+ );
2488+
2489+ // keep the default settings if nothing was found
2490+ if (pos == conf_output.pixel_formats.end())
2491+ return;
2492+
2493+ conf_output.current_format = *pos;
2494+ });
2495+}
2496
2497=== added file 'examples/example_display_configuration_policy.h'
2498--- examples/example_display_configuration_policy.h 1970-01-01 00:00:00 +0000
2499+++ examples/example_display_configuration_policy.h 2014-11-25 17:45:03 +0000
2500@@ -0,0 +1,72 @@
2501+/*
2502+ * Copyright © 2014 Canonical Ltd.
2503+ *
2504+ * This program is free software: you can redistribute it and/or modify it
2505+ * under the terms of the GNU General Public License version 3,
2506+ * as published by the Free Software Foundation.
2507+ *
2508+ * This program is distributed in the hope that it will be useful,
2509+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2510+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2511+ * GNU General Public License for more details.
2512+ *
2513+ * You should have received a copy of the GNU General Public License
2514+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2515+ *
2516+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
2517+ */
2518+
2519+#ifndef MIR_EXAMPLE_DISPLAY_CONFIGURATION_POLICY_H_
2520+#define MIR_EXAMPLE_DISPLAY_CONFIGURATION_POLICY_H_
2521+
2522+#include "mir/graphics/display_configuration_policy.h"
2523+
2524+#include <memory>
2525+
2526+namespace mir
2527+{
2528+namespace examples
2529+{
2530+extern char const* const display_config_opt;
2531+extern char const* const display_config_descr;
2532+extern char const* const clone_opt_val;
2533+extern char const* const sidebyside_opt_val;
2534+extern char const* const single_opt_val;
2535+
2536+class SideBySideDisplayConfigurationPolicy : public graphics::DisplayConfigurationPolicy
2537+{
2538+public:
2539+ void apply_to(graphics::DisplayConfiguration& conf);
2540+};
2541+
2542+class SingleDisplayConfigurationPolicy : public graphics::DisplayConfigurationPolicy
2543+{
2544+public:
2545+ void apply_to(graphics::DisplayConfiguration& conf);
2546+};
2547+
2548+extern char const* const display_alpha_opt;
2549+extern char const* const display_alpha_descr;
2550+extern char const* const display_alpha_off;
2551+extern char const* const display_alpha_on;
2552+
2553+/**
2554+ * \brief Example of a DisplayConfigurationPolicy that tries to find
2555+ * an opaque or transparent pixel format, or falls back to the default
2556+ * if not found.
2557+ */
2558+class PixelFormatSelector : public graphics::DisplayConfigurationPolicy
2559+{
2560+public:
2561+ PixelFormatSelector(std::shared_ptr<graphics::DisplayConfigurationPolicy> const& base_policy,
2562+ bool with_alpha);
2563+ virtual void apply_to(graphics::DisplayConfiguration& conf);
2564+private:
2565+ std::shared_ptr<graphics::DisplayConfigurationPolicy> const base_policy;
2566+ bool const with_alpha;
2567+};
2568+
2569+}
2570+}
2571+
2572+#endif /* MIR_EXAMPLE_DISPLAY_CONFIGURATION_POLICY_H_ */
2573
2574=== added file 'examples/example_input_event_filter.cpp'
2575--- examples/example_input_event_filter.cpp 1970-01-01 00:00:00 +0000
2576+++ examples/example_input_event_filter.cpp 2014-11-25 17:45:03 +0000
2577@@ -0,0 +1,45 @@
2578+/*
2579+ * Copyright © 2014 Canonical Ltd.
2580+ *
2581+ * This program is free software: you can redistribute it and/or modify it
2582+ * under the terms of the GNU General Public License version 3,
2583+ * as published by the Free Software Foundation.
2584+ *
2585+ * This program is distributed in the hope that it will be useful,
2586+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2587+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2588+ * GNU General Public License for more details.
2589+ *
2590+ * You should have received a copy of the GNU General Public License
2591+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2592+ *
2593+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
2594+ */
2595+
2596+#include "example_input_event_filter.h"
2597+
2598+#include "mir/server.h"
2599+
2600+#include <linux/input.h>
2601+
2602+namespace me = mir::examples;
2603+
2604+me::QuitFilter::QuitFilter(std::function<void()> const& quit_action)
2605+ : quit_action{quit_action}
2606+{
2607+}
2608+
2609+bool me::QuitFilter::handle(MirEvent const& event)
2610+{
2611+ if (event.type == mir_event_type_key &&
2612+ event.key.action == mir_key_action_down &&
2613+ (event.key.modifiers & mir_key_modifier_alt) &&
2614+ (event.key.modifiers & mir_key_modifier_ctrl) &&
2615+ event.key.scan_code == KEY_BACKSPACE)
2616+ {
2617+ quit_action();
2618+ return true;
2619+ }
2620+
2621+ return false;
2622+}
2623
2624=== added file 'examples/example_input_event_filter.h'
2625--- examples/example_input_event_filter.h 1970-01-01 00:00:00 +0000
2626+++ examples/example_input_event_filter.h 2014-11-25 17:45:03 +0000
2627@@ -0,0 +1,43 @@
2628+/*
2629+ * Copyright © 2014 Canonical Ltd.
2630+ *
2631+ * This program is free software: you can redistribute it and/or modify it
2632+ * under the terms of the GNU General Public License version 3,
2633+ * as published by the Free Software Foundation.
2634+ *
2635+ * This program is distributed in the hope that it will be useful,
2636+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2637+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2638+ * GNU General Public License for more details.
2639+ *
2640+ * You should have received a copy of the GNU General Public License
2641+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2642+ *
2643+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
2644+ */
2645+
2646+#ifndef EXAMPLE_INPUT_EVENT_FILTER_H_
2647+#define EXAMPLE_INPUT_EVENT_FILTER_H_
2648+
2649+#include "mir/input/event_filter.h"
2650+
2651+#include <functional>
2652+
2653+namespace mir
2654+{
2655+namespace examples
2656+{
2657+class QuitFilter : public mir::input::EventFilter
2658+{
2659+public:
2660+ QuitFilter(std::function<void()> const& quit_action);
2661+
2662+ bool handle(MirEvent const& event) override;
2663+
2664+private:
2665+ std::function<void()> const quit_action;
2666+};
2667+}
2668+}
2669+
2670+#endif /* EXAMPLE_INPUT_EVENT_FILTER_H_ */
2671
2672=== renamed file 'src/server/logging/glog_logger.cpp' => 'examples/glog_logger.cpp'
2673--- src/server/logging/glog_logger.cpp 2014-03-06 06:05:17 +0000
2674+++ examples/glog_logger.cpp 2014-11-25 17:45:03 +0000
2675@@ -16,7 +16,7 @@
2676 * Authored by: Alan Griffiths <alan@octopull.co.uk>
2677 */
2678
2679-#include "mir/logging/glog_logger.h"
2680+#include "glog_logger.h"
2681
2682 #include <glog/logging.h>
2683 #include <gflags/gflags.h>
2684@@ -24,6 +24,8 @@
2685 #include <mutex>
2686 #include <cstdlib>
2687
2688+namespace ml=mir::logging;
2689+
2690 namespace
2691 {
2692 std::once_flag init_flag;
2693@@ -53,7 +55,7 @@
2694 }
2695
2696
2697-mir::logging::GlogLogger::GlogLogger(
2698+mir::examples::GlogLogger::GlogLogger(
2699 const char* argv0,
2700 int stderrthreshold,
2701 int minloglevel,
2702@@ -66,7 +68,7 @@
2703 static google_glog_guard_t guard(argv0);
2704 }
2705
2706-void mir::logging::GlogLogger::log(Severity severity, const std::string& message, const std::string& component)
2707+void mir::examples::GlogLogger::log(ml::Severity severity, std::string const& message, std::string const& component)
2708 {
2709 static int glog_level[] =
2710 {
2711@@ -78,6 +80,6 @@
2712 };
2713
2714 // Since we're not collecting __FILE__ or __LINE__ this is misleading
2715- google::LogMessage(__FILE__, __LINE__, glog_level[severity]).stream()
2716+ google::LogMessage(__FILE__, __LINE__, glog_level[static_cast<int>(severity)]).stream()
2717 << '[' << component << "] " << message;
2718 }
2719
2720=== renamed file 'src/include/server/mir/logging/glog_logger.h' => 'examples/glog_logger.h'
2721--- src/include/server/mir/logging/glog_logger.h 2014-09-11 05:51:44 +0000
2722+++ examples/glog_logger.h 2014-11-25 17:45:03 +0000
2723@@ -20,9 +20,9 @@
2724
2725 namespace mir
2726 {
2727-namespace logging
2728+namespace examples
2729 {
2730-class GlogLogger : public Logger
2731+class GlogLogger : public logging::Logger
2732 {
2733 public:
2734 GlogLogger(
2735@@ -33,9 +33,9 @@
2736
2737 private:
2738 virtual void log(
2739- Severity severity,
2740- const std::string& message,
2741- const std::string& component) override;
2742+ mir::logging::Severity severity,
2743+ std::string const& message,
2744+ std::string const& component) override;
2745 };
2746 }
2747 }
2748
2749=== modified file 'examples/minimal_server.cpp'
2750--- examples/minimal_server.cpp 2014-09-11 05:51:44 +0000
2751+++ examples/minimal_server.cpp 2014-11-25 17:45:03 +0000
2752@@ -16,21 +16,22 @@
2753 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
2754 */
2755
2756-#include "mir/default_server_configuration.h"
2757+#include "mir/server.h"
2758 #include "mir/report_exception.h"
2759-#include "mir/run_mir.h"
2760
2761-#include <iostream>
2762+#include <cstdlib>
2763
2764 int main(int argc, char const* argv[])
2765 try
2766 {
2767- mir::DefaultServerConfiguration config(argc, argv);
2768- run_mir(config, [](mir::DisplayServer&){} );
2769- return 0;
2770+ mir::Server server;
2771+ server.set_command_line(argc, argv);
2772+ server.apply_settings();
2773+ server.run();
2774+ return server.exited_normally() ? EXIT_SUCCESS : EXIT_FAILURE;
2775 }
2776 catch (...)
2777 {
2778- mir::report_exception(std::cerr);
2779- return 1;
2780+ mir::report_exception();
2781+ return EXIT_FAILURE;
2782 }
2783
2784=== removed file 'examples/pixel_format_selector.cpp'
2785--- examples/pixel_format_selector.cpp 2014-09-12 05:56:28 +0000
2786+++ examples/pixel_format_selector.cpp 1970-01-01 00:00:00 +0000
2787@@ -1,72 +0,0 @@
2788-/*
2789- * Copyright © 2014 Canonical Ltd.
2790- *
2791- * This program is free software: you can redistribute it and/or modify
2792- * it under the terms of the GNU General Public License version 3 as
2793- * published by the Free Software Foundation.
2794- *
2795- * This program is distributed in the hope that it will be useful,
2796- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2797- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2798- * GNU General Public License for more details.
2799- *
2800- * You should have received a copy of the GNU General Public License
2801- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2802- *
2803- * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
2804- */
2805-
2806-#include "pixel_format_selector.h"
2807-
2808-#include "mir/graphics/display_configuration.h"
2809-
2810-#include <stdexcept>
2811-#include <algorithm>
2812-
2813-namespace
2814-{
2815-bool contains_alpha(MirPixelFormat format)
2816-{
2817- return (format == mir_pixel_format_abgr_8888 ||
2818- format == mir_pixel_format_argb_8888);
2819-}
2820-}
2821-
2822-namespace mir
2823-{
2824-namespace examples
2825-{
2826-
2827-PixelFormatSelector::PixelFormatSelector(std::shared_ptr<DisplayConfigurationPolicy> const& base_policy,
2828- bool with_alpha)
2829- : base_policy{base_policy},
2830- with_alpha{with_alpha}
2831-{}
2832-
2833-void PixelFormatSelector::apply_to(graphics::DisplayConfiguration & conf)
2834-{
2835- base_policy->apply_to(conf);
2836- conf.for_each_output(
2837- [&](graphics::UserDisplayConfigurationOutput& conf_output)
2838- {
2839- if (!conf_output.connected || !conf_output.used) return;
2840-
2841- auto const& pos = find_if(conf_output.pixel_formats.begin(),
2842- conf_output.pixel_formats.end(),
2843- [&](MirPixelFormat format) -> bool
2844- {
2845- return contains_alpha(format) == with_alpha;
2846- }
2847- );
2848-
2849- // keep the default settings if nothing was found
2850- if (pos == conf_output.pixel_formats.end())
2851- return;
2852-
2853- conf_output.current_format = *pos;
2854- });
2855-}
2856-
2857-}
2858-}
2859-
2860
2861=== removed file 'examples/pixel_format_selector.h'
2862--- examples/pixel_format_selector.h 2014-01-13 17:03:34 +0000
2863+++ examples/pixel_format_selector.h 1970-01-01 00:00:00 +0000
2864@@ -1,51 +0,0 @@
2865-/*
2866- * Copyright © 2014 Canonical Ltd.
2867- *
2868- * This program is free software: you can redistribute it and/or modify
2869- * it under the terms of the GNU General Public License version 3 as
2870- * published by the Free Software Foundation.
2871- *
2872- * This program is distributed in the hope that it will be useful,
2873- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2874- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2875- * GNU General Public License for more details.
2876- *
2877- * You should have received a copy of the GNU General Public License
2878- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2879- *
2880- * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
2881- */
2882-
2883-
2884-#ifndef MIR_EXAMPLES_SELECT_PIXEL_FORMAT_H
2885-#define MIR_EXAMPLES_SELECT_PIXEL_FORMAT_H
2886-
2887-#include "mir/graphics/display_configuration_policy.h"
2888-
2889-#include <memory>
2890-
2891-namespace mir
2892-{
2893-namespace examples
2894-{
2895-
2896-/**
2897- * \brief Example of a DisplayConfigurationPolicy that tries to find
2898- * an opaque or transparent pixel format, or falls back to the default
2899- * if not found.
2900- */
2901-class PixelFormatSelector : public graphics::DisplayConfigurationPolicy
2902-{
2903-public:
2904- PixelFormatSelector(std::shared_ptr<graphics::DisplayConfigurationPolicy> const& base_policy,
2905- bool with_alpha);
2906- virtual void apply_to(graphics::DisplayConfiguration& conf);
2907-private:
2908- std::shared_ptr<graphics::DisplayConfigurationPolicy> const base_policy;
2909- bool const with_alpha;
2910-};
2911-
2912-}
2913-}
2914-
2915-#endif
2916
2917=== modified file 'examples/progressbar.c'
2918--- examples/progressbar.c 2014-09-11 05:51:44 +0000
2919+++ examples/progressbar.c 2014-11-25 17:45:03 +0000
2920@@ -16,12 +16,14 @@
2921 * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
2922 */
2923
2924+#define _DEFAULT_SOURCE
2925+#define _BSD_SOURCE /* for usleep() */
2926+
2927 #include "mir_toolkit/mir_client_library.h"
2928 #include <stdio.h>
2929 #include <signal.h>
2930 #include <stdint.h>
2931 #include <stdlib.h>
2932-#define __USE_BSD 1 /* for usleep() */
2933 #include <unistd.h> /* sleep() */
2934 #include <string.h>
2935
2936
2937=== modified file 'examples/render_overlays.cpp'
2938--- examples/render_overlays.cpp 2014-10-01 10:35:29 +0000
2939+++ examples/render_overlays.cpp 2014-11-25 17:45:03 +0000
2940@@ -16,14 +16,14 @@
2941 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
2942 */
2943
2944-#include "mir/default_server_configuration.h"
2945+#include "mir/server.h"
2946+#include "mir/report_exception.h"
2947 #include "mir/graphics/display.h"
2948 #include "mir/graphics/renderable.h"
2949 #include "mir/graphics/display_buffer.h"
2950 #include "mir/graphics/platform.h"
2951 #include "mir/graphics/graphic_buffer_allocator.h"
2952 #include "mir/graphics/buffer_properties.h"
2953-#include "mir/report_exception.h"
2954
2955 #include "testdraw/graphics_region_factory.h"
2956 #include "testdraw/patterns.h"
2957@@ -33,7 +33,6 @@
2958 #include <iostream>
2959
2960 namespace mg=mir::graphics;
2961-namespace ml=mir::logging;
2962 namespace mo=mir::options;
2963 namespace geom=mir::geometry;
2964
2965@@ -150,12 +149,9 @@
2966 geom::Rectangle const position;
2967 glm::mat4 const trans;
2968 };
2969-}
2970
2971-int main(int argc, char const** argv)
2972-try
2973+void render_loop(mir::Server& server)
2974 {
2975-
2976 /* Set up graceful exit on SIGINT and SIGTERM */
2977 struct sigaction sa;
2978 sa.sa_handler = signal_handler;
2979@@ -165,11 +161,9 @@
2980 sigaction(SIGINT, &sa, NULL);
2981 sigaction(SIGTERM, &sa, NULL);
2982
2983- mir::DefaultServerConfiguration conf{argc, argv};
2984-
2985- auto platform = conf.the_graphics_platform();
2986- auto display = conf.the_display();
2987- auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());
2988+ auto platform = server.the_graphics_platform();
2989+ auto display = server.the_display();
2990+ auto buffer_allocator = platform->create_buffer_allocator();
2991
2992 mg::BufferProperties buffer_properties{
2993 geom::Size{512, 512},
2994@@ -196,10 +190,22 @@
2995 buffer.post_renderables_if_optimizable(renderlist);
2996 });
2997 }
2998- return 0;
2999+}
3000+}
3001+
3002+int main(int argc, char const** argv)
3003+try
3004+{
3005+ mir::Server server;
3006+ server.set_command_line(argc, argv);
3007+ server.apply_settings();
3008+
3009+ render_loop(server);
3010+
3011+ return EXIT_SUCCESS;
3012 }
3013 catch (...)
3014 {
3015 mir::report_exception(std::cerr);
3016- return 1;
3017+ return EXIT_FAILURE;
3018 }
3019
3020=== modified file 'examples/render_to_fb.cpp'
3021--- examples/render_to_fb.cpp 2014-03-11 13:44:57 +0000
3022+++ examples/render_to_fb.cpp 2014-11-25 17:45:03 +0000
3023@@ -1,5 +1,5 @@
3024 /*
3025- * Copyright © 2012 Canonical Ltd.
3026+ * Copyright © 2012-2014 Canonical Ltd.
3027 *
3028 * This program is free software: you can redistribute it and/or modify
3029 * it under the terms of the GNU General Public License version 3 as
3030@@ -18,13 +18,12 @@
3031
3032 #include "graphics.h"
3033
3034-#include "mir/default_server_configuration.h"
3035+#include "mir/server.h"
3036+#include "mir/report_exception.h"
3037 #include "mir/graphics/display.h"
3038 #include "mir/graphics/display_buffer.h"
3039-#include "mir/report_exception.h"
3040
3041 #include <csignal>
3042-#include <iostream>
3043
3044 namespace mg=mir::graphics;
3045 namespace mo=mir::options;
3046@@ -39,8 +38,7 @@
3047 }
3048 }
3049
3050-int main(int argc, char const** argv)
3051-try
3052+void render_loop(mir::Server& server)
3053 {
3054 /* Set up graceful exit on SIGINT and SIGTERM */
3055 struct sigaction sa;
3056@@ -51,9 +49,7 @@
3057 sigaction(SIGINT, &sa, NULL);
3058 sigaction(SIGTERM, &sa, NULL);
3059
3060- mir::DefaultServerConfiguration conf{argc, argv};
3061-
3062- auto display = conf.the_display();
3063+ auto display = server.the_display();
3064
3065 mir::draw::glAnimationBasic gl_animation;
3066
3067@@ -76,11 +72,21 @@
3068
3069 gl_animation.step();
3070 }
3071-
3072- return 0;
3073+}
3074+
3075+int main(int argc, char const** argv)
3076+try
3077+{
3078+ mir::Server server;
3079+ server.set_command_line(argc, argv);
3080+ server.apply_settings();
3081+
3082+ render_loop(server);
3083+
3084+ return EXIT_SUCCESS;
3085 }
3086 catch (...)
3087 {
3088- mir::report_exception(std::cerr);
3089- return 1;
3090+ mir::report_exception();
3091+ return EXIT_FAILURE;
3092 }
3093
3094=== removed file 'examples/translucent_server.cpp'
3095--- examples/translucent_server.cpp 2014-01-02 14:54:13 +0000
3096+++ examples/translucent_server.cpp 1970-01-01 00:00:00 +0000
3097@@ -1,38 +0,0 @@
3098-/*
3099- * Copyright © 2014 Canonical Ltd.
3100- *
3101- * This program is free software: you can redistribute it and/or modify
3102- * it under the terms of the GNU General Public License version 3 as
3103- * published by the Free Software Foundation.
3104- *
3105- * This program is distributed in the hope that it will be useful,
3106- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3107- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3108- * GNU General Public License for more details.
3109- *
3110- * You should have received a copy of the GNU General Public License
3111- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3112- *
3113- * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
3114- */
3115-
3116-#include "translucent_server_configuration.h"
3117-
3118-#include "mir/report_exception.h"
3119-#include "mir/run_mir.h"
3120-
3121-#include <iostream>
3122-
3123-int main(int argc, char const* argv[])
3124-try
3125-{
3126- mir::examples::TranslucentServerConfiguration config(argc, argv);
3127-
3128- run_mir(config, [&](mir::DisplayServer&){ config.launch_client(); });
3129- return 0;
3130-}
3131-catch (...)
3132-{
3133- mir::report_exception(std::cerr);
3134- return 1;
3135-}
3136
3137=== removed file 'examples/translucent_server_configuration.cpp'
3138--- examples/translucent_server_configuration.cpp 2014-01-02 14:54:13 +0000
3139+++ examples/translucent_server_configuration.cpp 1970-01-01 00:00:00 +0000
3140@@ -1,45 +0,0 @@
3141-/*
3142- * Copyright © 2014 Canonical Ltd.
3143- *
3144- * This program is free software: you can redistribute it and/or modify
3145- * it under the terms of the GNU General Public License version 3 as
3146- * published by the Free Software Foundation.
3147- *
3148- * This program is distributed in the hope that it will be useful,
3149- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3150- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3151- * GNU General Public License for more details.
3152- *
3153- * You should have received a copy of the GNU General Public License
3154- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3155- *
3156- * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
3157- */
3158-
3159-#include "translucent_server_configuration.h"
3160-
3161-#include "pixel_format_selector.h"
3162-
3163-namespace mir
3164-{
3165-namespace examples
3166-{
3167-
3168-TranslucentServerConfiguration::TranslucentServerConfiguration(int argc, char const** argv)
3169- : BasicServerConfiguration(argc, argv)
3170-{
3171-}
3172-
3173-std::shared_ptr<graphics::DisplayConfigurationPolicy>
3174-TranslucentServerConfiguration::the_display_configuration_policy()
3175-{
3176- return display_configuration_policy(
3177- [this]() -> std::shared_ptr<graphics::DisplayConfigurationPolicy>
3178- {
3179- return std::make_shared<PixelFormatSelector>(BasicServerConfiguration::the_display_configuration_policy(), true);
3180- });
3181-}
3182-
3183-
3184-}
3185-}
3186
3187=== removed file 'examples/translucent_server_configuration.h'
3188--- examples/translucent_server_configuration.h 2014-01-02 14:54:13 +0000
3189+++ examples/translucent_server_configuration.h 1970-01-01 00:00:00 +0000
3190@@ -1,43 +0,0 @@
3191-/*
3192- * Copyright © 2014 Canonical Ltd.
3193- *
3194- * This program is free software: you can redistribute it and/or modify
3195- * it under the terms of the GNU General Public License version 3 as
3196- * published by the Free Software Foundation.
3197- *
3198- * This program is distributed in the hope that it will be useful,
3199- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3200- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3201- * GNU General Public License for more details.
3202- *
3203- * You should have received a copy of the GNU General Public License
3204- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3205- *
3206- * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
3207- */
3208-
3209-#ifndef MIR_EXAMPLES_TRANSLUCENT_SERVER_CONFIGURATION_H_
3210-#define MIR_EXAMPLES_TRANSLUCENT_SERVER_CONFIGURATION_H_
3211-
3212-#include "basic_server_configuration.h"
3213-
3214-namespace mir
3215-{
3216-namespace examples
3217-{
3218-
3219-/**
3220- * \brief TranslucentServerConfiguration extends BasicServerConfiguration with a different pixel format selection
3221- */
3222-class TranslucentServerConfiguration : public BasicServerConfiguration
3223-{
3224-public:
3225- TranslucentServerConfiguration(int argc, char const** argv);
3226-
3227- std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy();
3228-};
3229-
3230-}
3231-}
3232-
3233-#endif /* MIR_EXAMPLES_TRANSLUCENT_SERVER_CONFIGURATION_H_ */
3234
3235=== removed directory 'include/client/mir'
3236=== removed directory 'include/client/mir/client'
3237=== added directory 'include/client/mir_toolkit/debug'
3238=== renamed file 'include/client/mir_toolkit/mir_client_library_debug.h' => 'include/client/mir_toolkit/debug/surface.h'
3239--- include/client/mir_toolkit/mir_client_library_debug.h 2014-09-11 05:51:44 +0000
3240+++ include/client/mir_toolkit/debug/surface.h 2014-11-25 17:45:03 +0000
3241@@ -28,6 +28,7 @@
3242
3243 /**
3244 * Return the ID of a surface (only useful for debug output).
3245+ * \pre The surface is valid
3246 * \param [in] surface The surface
3247 * \return An internal ID that identifies the surface
3248 */
3249@@ -43,6 +44,25 @@
3250 */
3251 uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface);
3252
3253+/**
3254+ * Get the screen coordinates corresponding to a pair of surface coordinates
3255+ * \pre The surface is valid
3256+ * \param [in] surface The surface
3257+ * \param [in] x, y Surface coordinates to map to screen coordinates
3258+ * \param [out] screen_x, screen_y The screen coordinates corresponding to x, y.
3259+ * \return True if screen_x and screen_y contain values
3260+ * \note There are many cases where such a mapping does not exist or would be expensive
3261+ * to calculate. Only Mir servers started with the --debug option will ever return
3262+ * values for this call, and even when --debug is enabled servers are free to
3263+ * return nothing.
3264+ *
3265+ * This call will only be interesting for automated testing, where both the client
3266+ * and shell state is known and constrained.
3267+ */
3268+bool mir_debug_surface_coords_to_screen(MirSurface* surface,
3269+ int x, int y,
3270+ int* screen_x, int* screen_y);
3271+
3272 #ifdef __cplusplus
3273 }
3274 #endif
3275
3276=== modified file 'include/client/mir_toolkit/mir_connection.h'
3277--- include/client/mir_toolkit/mir_connection.h 2014-09-11 05:51:44 +0000
3278+++ include/client/mir_toolkit/mir_connection.h 2014-11-25 17:45:03 +0000
3279@@ -21,6 +21,8 @@
3280 #include <mir_toolkit/client_types.h>
3281 #include <mir_toolkit/common.h>
3282
3283+#include <stdbool.h>
3284+
3285 #ifdef __cplusplus
3286 /**
3287 * \addtogroup mir_toolkit
3288@@ -66,7 +68,7 @@
3289 * \return True if the supplied connection is valid, or
3290 * false otherwise.
3291 */
3292-MirBool mir_connection_is_valid(MirConnection *connection);
3293+bool mir_connection_is_valid(MirConnection *connection);
3294
3295 /**
3296 * Retrieve a text description of the last error. The returned string is owned
3297
3298=== modified file 'include/client/mir_toolkit/mir_prompt_session.h'
3299--- include/client/mir_toolkit/mir_prompt_session.h 2014-09-11 05:51:44 +0000
3300+++ include/client/mir_toolkit/mir_prompt_session.h 2014-11-25 17:45:03 +0000
3301@@ -20,6 +20,7 @@
3302 #include "mir_toolkit/mir_client_library.h"
3303
3304 #include <sys/types.h>
3305+#include <stdbool.h>
3306
3307 #ifdef __cplusplus
3308 /**
3309@@ -74,7 +75,7 @@
3310 * \param [in] prompt_session The prompt session
3311 * \return True if prompt_session is valid, false otherwise
3312 */
3313-MirBool mir_prompt_session_is_valid(MirPromptSession *prompt_session);
3314+bool mir_prompt_session_is_valid(MirPromptSession *prompt_session);
3315
3316 /**
3317 * Retrieve a text description of the last error. The returned string is owned
3318
3319=== modified file 'include/client/mir_toolkit/mir_surface.h'
3320--- include/client/mir_toolkit/mir_surface.h 2014-09-11 05:51:44 +0000
3321+++ include/client/mir_toolkit/mir_surface.h 2014-11-25 17:45:03 +0000
3322@@ -23,6 +23,8 @@
3323 #include <mir_toolkit/common.h>
3324 #include <mir_toolkit/mir_cursor_configuration.h>
3325
3326+#include <stdbool.h>
3327+
3328 #ifdef __cplusplus
3329 /**
3330 * \addtogroup mir_toolkit
3331@@ -89,7 +91,7 @@
3332 * \return True if the supplied surface is valid, or
3333 * false otherwise.
3334 */
3335-MirBool mir_surface_is_valid(MirSurface *surface);
3336+bool mir_surface_is_valid(MirSurface *surface);
3337
3338 /**
3339 * Retrieve a text description of the error. The returned string is owned by
3340
3341=== added file 'include/common/mir/time/types.h'
3342--- include/common/mir/time/types.h 1970-01-01 00:00:00 +0000
3343+++ include/common/mir/time/types.h 2014-11-25 17:45:03 +0000
3344@@ -0,0 +1,35 @@
3345+/*
3346+ * Copyright © 2014 Canonical Ltd.
3347+ *
3348+ * This program is free software: you can redistribute it and/or modify it
3349+ * under the terms of the GNU Lesser General Public License version 3,
3350+ * as published by the Free Software Foundation.
3351+ *
3352+ * This program is distributed in the hope that it will be useful,
3353+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3354+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3355+ * GNU Lesser General Public License for more details.
3356+ *
3357+ * You should have received a copy of the GNU Lesser General Public License
3358+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3359+ *
3360+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
3361+ */
3362+
3363+#ifndef MIR_TIME_TYPES_H_
3364+#define MIR_TIME_TYPES_H_
3365+
3366+#include <chrono>
3367+
3368+namespace mir
3369+{
3370+namespace time
3371+{
3372+
3373+using Timestamp = std::chrono::steady_clock::time_point;
3374+using Duration = std::chrono::steady_clock::duration;
3375+
3376+}
3377+}
3378+
3379+#endif
3380
3381=== modified file 'include/common/mir_toolkit/common.h'
3382--- include/common/mir_toolkit/common.h 2014-09-11 05:51:44 +0000
3383+++ include/common/mir_toolkit/common.h 2014-11-25 17:45:03 +0000
3384@@ -48,13 +48,17 @@
3385
3386 typedef enum MirSurfaceType
3387 {
3388- mir_surface_type_normal,
3389- mir_surface_type_utility,
3390+ mir_surface_type_normal, /**< AKA "regular" */
3391+ mir_surface_type_utility, /**< AKA "floating" */
3392 mir_surface_type_dialog,
3393- mir_surface_type_overlay,
3394+ mir_surface_type_overlay, /**< \deprecated Use "gloss" instead. */
3395+ mir_surface_type_gloss = mir_surface_type_overlay,
3396 mir_surface_type_freestyle,
3397- mir_surface_type_popover,
3398- mir_surface_type_inputmethod,
3399+ mir_surface_type_popover, /**< \deprecated Choose "menu" or "tip" */
3400+ mir_surface_type_menu = mir_surface_type_popover,
3401+ mir_surface_type_inputmethod, /**< AKA "OSK" or handwriting etc. */
3402+ mir_surface_type_satellite, /**< AKA "toolbox"/"toolbar" */
3403+ mir_surface_type_tip, /**< AKA "tooltip" */
3404 mir_surface_types
3405 } MirSurfaceType;
3406
3407
3408=== modified file 'include/common/mir_toolkit/mesa/native_display.h'
3409--- include/common/mir_toolkit/mesa/native_display.h 2013-08-28 03:41:48 +0000
3410+++ include/common/mir_toolkit/mesa/native_display.h 2014-11-25 17:45:03 +0000
3411@@ -39,7 +39,7 @@
3412 struct MirMesaEGLNativeDisplay
3413 {
3414 int (*display_get_platform)(MirMesaEGLNativeDisplay* display,
3415- MirPlatformPackage* package);
3416+ MirPlatformPackage* package);
3417 void *context;
3418 };
3419
3420@@ -47,9 +47,9 @@
3421 {
3422 int (*surface_set_swapinterval)(MirMesaEGLNativeSurface* surface, int interval);
3423 int (*surface_advance_buffer)(MirMesaEGLNativeSurface* surface,
3424- MirBufferPackage* buffer_package);
3425+ MirBufferPackage* buffer_package);
3426 int (*surface_get_parameters)(MirMesaEGLNativeSurface* surface,
3427- MirSurfaceParameters* surface_parameters);
3428+ MirSurfaceParameters* surface_parameters);
3429 };
3430
3431 typedef int (*MirMesaEGLNativeDisplayIsValidFunc)(MirMesaEGLNativeDisplay* display);
3432
3433=== modified file 'include/platform/mir/graphics/native_platform.h'
3434--- include/platform/mir/graphics/native_platform.h 2014-10-03 03:02:09 +0000
3435+++ include/platform/mir/graphics/native_platform.h 2014-11-25 17:45:03 +0000
3436@@ -32,7 +32,6 @@
3437 namespace graphics
3438 {
3439 class GraphicBufferAllocator;
3440-class BufferInitializer;
3441 class PlatformIPCPackage;
3442 class InternalClient;
3443 class BufferIpcMessage;
3444@@ -46,10 +45,7 @@
3445 public:
3446 NativePlatform() {}
3447
3448- virtual void initialize(std::shared_ptr<NestedContext> const& nested_context) = 0;
3449-
3450- virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator(
3451- std::shared_ptr<BufferInitializer> const& buffer_initializer) = 0;
3452+ virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() = 0;
3453
3454 virtual std::shared_ptr<PlatformIPCPackage> connection_ipc_package() = 0;
3455
3456@@ -67,8 +63,12 @@
3457 NativePlatform& operator=(NativePlatform const&) = delete;
3458 };
3459
3460-extern "C" typedef std::shared_ptr<NativePlatform>(*CreateNativePlatform)(std::shared_ptr<DisplayReport> const& report);
3461-extern "C" std::shared_ptr<NativePlatform> create_native_platform(std::shared_ptr<DisplayReport> const& report);
3462+extern "C" typedef std::shared_ptr<NativePlatform>(*CreateNativePlatform)(
3463+ std::shared_ptr<DisplayReport> const&,
3464+ std::shared_ptr<NestedContext> const&);
3465+extern "C" std::shared_ptr<NativePlatform> create_native_platform(
3466+ std::shared_ptr<DisplayReport> const& report,
3467+ std::shared_ptr<NestedContext> const&);
3468 }
3469 }
3470
3471
3472=== modified file 'include/platform/mir/graphics/platform.h'
3473--- include/platform/mir/graphics/platform.h 2014-09-24 17:01:33 +0000
3474+++ include/platform/mir/graphics/platform.h 2014-11-25 17:45:03 +0000
3475@@ -44,7 +44,6 @@
3476 {
3477 class Buffer;
3478 class Display;
3479-class BufferInitializer;
3480 class InternalClient;
3481 class DisplayReport;
3482 class DisplayConfigurationPolicy;
3483@@ -75,12 +74,8 @@
3484
3485 /**
3486 * Creates the buffer allocator subsystem.
3487- *
3488- * \param [in] buffer_initializer the object responsible for initializing the buffers
3489 */
3490-
3491- virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator(
3492- std::shared_ptr<BufferInitializer> const& buffer_initializer) = 0;
3493+ virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() = 0;
3494
3495 virtual std::shared_ptr<BufferWriter> make_buffer_writer() = 0;
3496
3497
3498=== modified file 'include/platform/mir/graphics/platform_ipc_operations.h'
3499--- include/platform/mir/graphics/platform_ipc_operations.h 2014-10-03 03:02:09 +0000
3500+++ include/platform/mir/graphics/platform_ipc_operations.h 2014-11-25 17:45:03 +0000
3501@@ -19,6 +19,7 @@
3502 #ifndef MIR_GRAPHICS_PLATFORM_IPC_OPERATIONS_H_
3503 #define MIR_GRAPHICS_PLATFORM_IPC_OPERATIONS_H_
3504
3505+#include "platform_ipc_package.h"
3506 #include <memory>
3507
3508 namespace mir
3509@@ -32,7 +33,6 @@
3510 };
3511 class Buffer;
3512 class BufferIpcMessage;
3513-struct PlatformIPCPackage;
3514
3515 class PlatformIpcOperations
3516 {
3517@@ -68,6 +68,15 @@
3518 */
3519 virtual std::shared_ptr<PlatformIPCPackage> connection_ipc_package() = 0;
3520
3521+
3522+ /**
3523+ * Arranges a platform specific operation triggered by an IPC call
3524+ * \returns the response that will be sent to the client
3525+ * \param [in] opcode the opcode that indicates the action to be performed
3526+ * \param [in] request the message that was sent to the server
3527+ */
3528+ virtual PlatformIPCPackage platform_operation(unsigned int const opcode, PlatformIPCPackage const& package) = 0;
3529+
3530 protected:
3531 PlatformIpcOperations() = default;
3532 PlatformIpcOperations(PlatformIpcOperations const&) = delete;
3533
3534=== modified file 'include/platform/mir/graphics/platform_ipc_package.h'
3535--- include/platform/mir/graphics/platform_ipc_package.h 2014-10-03 03:02:09 +0000
3536+++ include/platform/mir/graphics/platform_ipc_package.h 2014-11-25 17:45:03 +0000
3537@@ -32,7 +32,6 @@
3538 */
3539 struct PlatformIPCPackage
3540 {
3541- virtual ~PlatformIPCPackage() {}
3542 std::vector<int32_t> ipc_data;
3543 std::vector<int32_t> ipc_fds;
3544 };
3545
3546=== modified file 'include/platform/mir/options/configuration.h'
3547--- include/platform/mir/options/configuration.h 2014-09-30 06:11:33 +0000
3548+++ include/platform/mir/options/configuration.h 2014-11-25 17:45:03 +0000
3549@@ -43,15 +43,12 @@
3550 extern char const* const frontend_threads_opt;
3551 extern char const* const touchspots_opt;
3552 extern char const* const fatal_abort_opt;
3553+extern char const* const debug_opt;
3554+extern char const* const use_asio_main_loop_opt;
3555
3556 extern char const* const name_opt;
3557 extern char const* const offscreen_opt;
3558
3559-extern char const* const glog;
3560-extern char const* const glog_stderrthreshold;
3561-extern char const* const glog_minloglevel;
3562-extern char const* const glog_log_dir;
3563-
3564 extern char const* const off_opt_value;
3565 extern char const* const log_opt_value;
3566 extern char const* const lttng_opt_value;
3567
3568=== renamed file 'src/include/server/mir/compositor/display_buffer_compositor.h' => 'include/server/mir/compositor/display_buffer_compositor.h'
3569--- src/include/server/mir/compositor/display_buffer_compositor.h 2014-10-03 03:02:09 +0000
3570+++ include/server/mir/compositor/display_buffer_compositor.h 2014-11-25 17:45:03 +0000
3571@@ -20,6 +20,8 @@
3572 #ifndef MIR_COMPOSITOR_DISPLAY_BUFFER_COMPOSITOR_H_
3573 #define MIR_COMPOSITOR_DISPLAY_BUFFER_COMPOSITOR_H_
3574
3575+#include "mir/compositor/scene.h"
3576+
3577 namespace mir
3578 {
3579 namespace compositor
3580@@ -30,7 +32,7 @@
3581 public:
3582 virtual ~DisplayBufferCompositor() = default;
3583
3584- virtual void composite() = 0;
3585+ virtual void composite(SceneElementSequence&& scene_sequence) = 0;
3586
3587 protected:
3588 DisplayBufferCompositor() = default;
3589
3590=== renamed file 'src/include/server/mir/compositor/display_buffer_compositor_factory.h' => 'include/server/mir/compositor/display_buffer_compositor_factory.h'
3591=== modified file 'include/server/mir/compositor/scene_element.h'
3592--- include/server/mir/compositor/scene_element.h 2014-10-03 03:02:09 +0000
3593+++ include/server/mir/compositor/scene_element.h 2014-11-25 17:45:03 +0000
3594@@ -19,7 +19,6 @@
3595 #ifndef MIR_COMPOSITOR_SCENE_ELEMENT_H_
3596 #define MIR_COMPOSITOR_SCENE_ELEMENT_H_
3597
3598-#include "mir/compositor/compositor_id.h"
3599 #include <memory>
3600
3601 namespace mir
3602@@ -37,8 +36,8 @@
3603 virtual ~SceneElement() = default;
3604
3605 virtual std::shared_ptr<graphics::Renderable> renderable() const = 0;
3606- virtual void rendered_in(CompositorID cid) = 0;
3607- virtual void occluded_in(CompositorID cid) = 0;
3608+ virtual void rendered() = 0;
3609+ virtual void occluded() = 0;
3610
3611 // Query whether the SceneElement represents a window-surface, which at the discretion of the compositor
3612 // may be eligible for window decoration.
3613
3614=== modified file 'include/server/mir/default_server_configuration.h'
3615--- include/server/mir/default_server_configuration.h 2014-09-30 06:11:33 +0000
3616+++ include/server/mir/default_server_configuration.h 2014-11-25 17:45:03 +0000
3617@@ -26,7 +26,12 @@
3618
3619 namespace android
3620 {
3621+class EventHubInterface;
3622+class InputReaderInterface;
3623+class InputReaderPolicyInterface;
3624+class InputListenerInterface;
3625 class InputDispatcherInterface;
3626+class InputEnumerator;
3627 class InputDispatcherPolicyInterface;
3628 }
3629
3630@@ -96,13 +101,13 @@
3631 class SceneReport;
3632 class PromptSessionListener;
3633 class PromptSessionManager;
3634+class CoordinateTranslator;
3635 }
3636 namespace graphics
3637 {
3638 class NativePlatform;
3639 class Platform;
3640 class Display;
3641-class BufferInitializer;
3642 class DisplayReport;
3643 class GraphicBufferAllocator;
3644 class BufferWriter;
3645@@ -119,7 +124,6 @@
3646 class InputManager;
3647 class CompositeEventFilter;
3648 class InputChannelFactory;
3649-class InputConfiguration;
3650 class CursorListener;
3651 class TouchVisualizer;
3652 class InputRegion;
3653@@ -169,7 +173,6 @@
3654 std::shared_ptr<ServerStatusListener> the_server_status_listener() override;
3655 std::shared_ptr<DisplayChanger> the_display_changer() override;
3656 std::shared_ptr<graphics::Platform> the_graphics_platform() override;
3657- std::shared_ptr<input::InputConfiguration> the_input_configuration() override;
3658 std::shared_ptr<input::InputDispatcher> the_input_dispatcher() override;
3659 std::shared_ptr<EmergencyCleanup> the_emergency_cleanup() override;
3660 /**
3661@@ -186,7 +189,6 @@
3662 /** @name graphics configuration - customization
3663 * configurable interfaces for modifying graphics
3664 * @{ */
3665- virtual std::shared_ptr<graphics::BufferInitializer> the_buffer_initializer();
3666 virtual std::shared_ptr<compositor::RendererFactory> the_renderer_factory();
3667 virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy();
3668 virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection();
3669@@ -285,6 +287,7 @@
3670 * @{ */
3671 // To customize this behaviour it is recommended you override wrap_session_coordinator().
3672 virtual std::shared_ptr<scene::SessionCoordinator> the_session_coordinator();
3673+ virtual std::shared_ptr<scene::CoordinateTranslator> the_coordinate_translator();
3674 /** @} */
3675
3676
3677@@ -299,6 +302,11 @@
3678 virtual std::shared_ptr<input::InputRegion> the_input_region();
3679 virtual std::shared_ptr<input::InputSender> the_input_sender();
3680 virtual std::shared_ptr<input::InputSendObserver> the_input_send_observer();
3681+ virtual std::shared_ptr<droidinput::EventHubInterface> the_event_hub();
3682+ virtual std::shared_ptr<droidinput::InputReaderInterface> the_input_reader();
3683+ virtual std::shared_ptr<droidinput::InputReaderPolicyInterface> the_input_reader_policy();
3684+ virtual std::shared_ptr<droidinput::InputListenerInterface> the_input_translator();
3685+ virtual std::shared_ptr<input::android::InputThread> the_input_reader_thread();
3686 /** @} */
3687
3688 /** @name logging configuration - customization
3689@@ -323,6 +331,7 @@
3690 * @{ */
3691 virtual std::shared_ptr<input::android::InputRegistrar> the_input_registrar();
3692 virtual std::shared_ptr<droidinput::InputDispatcherInterface> the_android_input_dispatcher();
3693+ virtual std::shared_ptr<droidinput::InputEnumerator> the_input_target_enumerator();
3694 virtual std::shared_ptr<input::android::InputThread> the_dispatcher_thread();
3695 virtual std::shared_ptr<droidinput::InputDispatcherPolicyInterface> the_dispatcher_policy();
3696 virtual bool is_key_repeat_enabled() const;
3697@@ -330,23 +339,33 @@
3698
3699 /** @Convenience wrapper functions
3700 * @{ */
3701+ virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> wrap_display_configuration_policy(
3702+ std::shared_ptr<graphics::DisplayConfigurationPolicy> const& wrapped);
3703+
3704 virtual std::shared_ptr<scene::SurfaceCoordinator> wrap_surface_coordinator(
3705 std::shared_ptr<scene::SurfaceCoordinator> const& wrapped);
3706
3707 virtual std::shared_ptr<scene::SessionCoordinator> wrap_session_coordinator(
3708 std::shared_ptr<scene::SessionCoordinator> const& wrapped);
3709+
3710+ virtual std::shared_ptr<input::CursorListener> wrap_cursor_listener(
3711+ std::shared_ptr<input::CursorListener> const& wrapped);
3712 /** @} */
3713
3714 CachedPtr<input::android::InputRegistrar> input_registrar;
3715 CachedPtr<input::android::InputThread> dispatcher_thread;
3716+ CachedPtr<input::android::InputThread> input_reader_thread;
3717 CachedPtr<droidinput::InputDispatcherInterface> android_input_dispatcher;
3718+ CachedPtr<droidinput::InputEnumerator> input_target_enumerator;
3719 CachedPtr<droidinput::InputDispatcherPolicyInterface> android_dispatcher_policy;
3720+ CachedPtr<droidinput::EventHubInterface> event_hub;
3721+ CachedPtr<droidinput::InputReaderPolicyInterface> input_reader_policy;
3722+ CachedPtr<droidinput::InputReaderInterface> input_reader;
3723+ CachedPtr<droidinput::InputListenerInterface> input_translator;
3724
3725 CachedPtr<frontend::Connector> connector;
3726 CachedPtr<frontend::Connector> prompt_connector;
3727
3728- CachedPtr<input::InputConfiguration> input_configuration;
3729-
3730 CachedPtr<input::InputReport> input_report;
3731 CachedPtr<input::CompositeEventFilter> composite_event_filter;
3732 CachedPtr<input::InputManager> input_manager;
3733@@ -359,7 +378,6 @@
3734 CachedPtr<input::TouchVisualizer> touch_visualizer;
3735 CachedPtr<graphics::Platform> graphics_platform;
3736 CachedPtr<graphics::NativePlatform> graphics_native_platform;
3737- CachedPtr<graphics::BufferInitializer> buffer_initializer;
3738 CachedPtr<graphics::GraphicBufferAllocator> buffer_allocator;
3739 CachedPtr<graphics::BufferWriter> buffer_writer;
3740 CachedPtr<graphics::Display> display;
3741@@ -396,8 +414,7 @@
3742 CachedPtr<compositor::CompositorReport> compositor_report;
3743 CachedPtr<logging::Logger> logger;
3744 CachedPtr<graphics::DisplayReport> display_report;
3745- // static to workaround the singleton clock in AsioMainLoop when running multiple servers
3746- static CachedPtr<time::Clock> clock;
3747+ CachedPtr<time::Clock> clock;
3748 CachedPtr<MainLoop> main_loop;
3749 CachedPtr<ServerStatusListener> server_status_listener;
3750 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;
3751@@ -408,6 +425,7 @@
3752 CachedPtr<scene::PromptSessionListener> prompt_session_listener;
3753 CachedPtr<scene::PromptSessionManager> prompt_session_manager;
3754 CachedPtr<scene::SessionCoordinator> session_coordinator;
3755+ CachedPtr<scene::CoordinateTranslator> coordinate_translator;
3756 CachedPtr<EmergencyCleanup> emergency_cleanup;
3757 CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener;
3758
3759
3760=== removed file 'include/server/mir/input/input_configuration.h'
3761--- include/server/mir/input/input_configuration.h 2014-10-03 03:02:09 +0000
3762+++ include/server/mir/input/input_configuration.h 1970-01-01 00:00:00 +0000
3763@@ -1,46 +0,0 @@
3764-/*
3765- * Copyright © 2014 Canonical Ltd.
3766- *
3767- * This program is free software: you can redistribute it and/or modify it
3768- * under the terms of the GNU General Public License version 3,
3769- * as published by the Free Software Foundation.
3770- *
3771- * This program is distributed in the hope that it will be useful,
3772- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3773- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3774- * GNU General Public License for more details.
3775- *
3776- * You should have received a copy of the GNU General Public License
3777- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3778- *
3779- * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
3780- */
3781-
3782-#ifndef MIR_INPUT_INPUT_CONFIGURATION_H_
3783-#define MIR_INPUT_INPUT_CONFIGURATION_H_
3784-
3785-#include <memory>
3786-
3787-namespace mir
3788-{
3789-namespace input
3790-{
3791-class InputManager;
3792-
3793-class InputConfiguration
3794-{
3795-public:
3796- virtual ~InputConfiguration() = default;
3797-
3798- virtual std::shared_ptr<InputManager> the_input_manager() = 0;
3799-
3800-protected:
3801- InputConfiguration() = default;
3802- InputConfiguration(InputConfiguration const&) = delete;
3803- InputConfiguration& operator=(InputConfiguration const&) = delete;
3804-};
3805-
3806-}
3807-}
3808-
3809-#endif
3810
3811=== modified file 'include/server/mir/report_exception.h'
3812--- include/server/mir/report_exception.h 2013-04-25 16:52:27 +0000
3813+++ include/server/mir/report_exception.h 2014-11-25 17:45:03 +0000
3814@@ -29,6 +29,12 @@
3815 * to write error information to an output stream.
3816 */
3817 void report_exception(std::ostream& out);
3818+
3819+/**
3820+ * Call this from a catch block (and only from a catch block)
3821+ * to write error information to std:cerr.
3822+ */
3823+void report_exception();
3824 }
3825
3826
3827
3828=== modified file 'include/server/mir/run_mir.h'
3829--- include/server/mir/run_mir.h 2014-09-11 05:51:44 +0000
3830+++ include/server/mir/run_mir.h 2014-11-25 17:45:03 +0000
3831@@ -38,11 +38,19 @@
3832 ServerConfiguration& config,
3833 std::function<void(DisplayServer&)> init);
3834
3835-void report_exception(std::ostream& out);
3836+/**
3837+ * Run a DisplayServer with the supplied configuration.
3838+ * init will be called after constructing the server, but before invoking DisplayServer::run()
3839+ * The terminator will be called following receipt of SIGTERM or SIGINT
3840+ * (but not in a signal handler - so arbitrary functions may be invoked).
3841+ * This function does not return until the server has stopped.
3842+ */
3843+void run_mir(
3844+ ServerConfiguration& config,
3845+ std::function<void(DisplayServer&)> init,
3846+ std::function<void(int)> const& terminator);
3847
3848 void terminate_with_current_exception();
3849 }
3850
3851-
3852-
3853 #endif /* MIR_RUN_MIR_H_ */
3854
3855=== added file 'include/server/mir/scene/coordinate_translator.h'
3856--- include/server/mir/scene/coordinate_translator.h 1970-01-01 00:00:00 +0000
3857+++ include/server/mir/scene/coordinate_translator.h 2014-11-25 17:45:03 +0000
3858@@ -0,0 +1,66 @@
3859+/*
3860+ * Copyright © 2014 Canonical Ltd.
3861+ *
3862+ * This program is free software: you can redistribute it and/or modify it
3863+ * under the terms of the GNU General Public License version 3,
3864+ * as published by the Free Software Foundation.
3865+ *
3866+ * This program is distributed in the hope that it will be useful,
3867+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3868+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3869+ * GNU General Public License for more details.
3870+ *
3871+ * You should have received a copy of the GNU General Public License
3872+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3873+ *
3874+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
3875+ */
3876+
3877+#ifndef MIR_SCENE_COORDINATE_TRANSLATOR_H_
3878+#define MIR_SCENE_COORDINATE_TRANSLATOR_H_
3879+
3880+#include "mir/geometry/point.h"
3881+#include <memory>
3882+
3883+namespace mir
3884+{
3885+namespace frontend
3886+{
3887+class Surface;
3888+}
3889+
3890+namespace scene
3891+{
3892+
3893+/**
3894+ * Support for the debug "surface to screen" coordinate translation interface.
3895+ * \note For shells which do surface transformations the default implementation
3896+ * will return incorrect results.
3897+ */
3898+class CoordinateTranslator
3899+{
3900+public:
3901+ virtual ~CoordinateTranslator() = default;
3902+
3903+ /**
3904+ * \brief Translate a surface coordinate into the screen coordinate space
3905+ * \param [in] surface A frontend::Surface. This will need to be dynamic_cast into
3906+ * the scene::Surface relevant for the shell.
3907+ * \param [in] x, y Coordinates to translate from the surface coordinate space
3908+ * \return The coordinates in the screen coordinate space.
3909+ * \throws A std::runtime_error if the translation cannot be performed
3910+ * for any reason.
3911+ *
3912+ * \note It is acceptable for this call to unconditionally throw a std::runtime_error.
3913+ * It is not required for normal functioning of the server or clients; clients which
3914+ * use the debug extension will receive an appropriate failure notice.
3915+ */
3916+ virtual geometry::Point surface_to_screen(std::shared_ptr<frontend::Surface> surface,
3917+ int32_t x, int32_t y) = 0;
3918+};
3919+
3920+
3921+}
3922+}
3923+
3924+#endif // MIR_SCENE_COORDINATE_TRANSLATOR_H_
3925
3926=== renamed file 'src/include/server/mir/scene/null_session_listener.h' => 'include/server/mir/scene/null_session_listener.h'
3927=== modified file 'include/server/mir/scene/null_surface_observer.h'
3928--- include/server/mir/scene/null_surface_observer.h 2014-09-11 05:51:44 +0000
3929+++ include/server/mir/scene/null_surface_observer.h 2014-11-25 17:45:03 +0000
3930@@ -31,16 +31,16 @@
3931 NullSurfaceObserver() = default;
3932 virtual ~NullSurfaceObserver() = default;
3933
3934- void attrib_changed(MirSurfaceAttrib attrib, int value);
3935- void resized_to(geometry::Size const& size);
3936- void moved_to(geometry::Point const& top_left);
3937- void hidden_set_to(bool hide);
3938- void frame_posted(int frames_available);
3939- void alpha_set_to(float alpha);
3940+ void attrib_changed(MirSurfaceAttrib attrib, int value) override;
3941+ void resized_to(geometry::Size const& size) override;
3942+ void moved_to(geometry::Point const& top_left) override;
3943+ void hidden_set_to(bool hide) override;
3944+ void frame_posted(int frames_available) override;
3945+ void alpha_set_to(float alpha) override;
3946 void orientation_set_to(MirOrientation orientation) override;
3947- void transformation_set_to(glm::mat4 const& t);
3948- void cursor_image_set_to(graphics::CursorImage const& image);
3949- void reception_mode_set_to(input::InputReceptionMode mode);
3950+ void transformation_set_to(glm::mat4 const& t) override;
3951+ void cursor_image_set_to(graphics::CursorImage const& image) override;
3952+ void reception_mode_set_to(input::InputReceptionMode mode) override;
3953
3954 protected:
3955 NullSurfaceObserver(NullSurfaceObserver const&) = delete;
3956
3957=== modified file 'include/server/mir/scene/surface.h'
3958--- include/server/mir/scene/surface.h 2014-09-11 05:51:44 +0000
3959+++ include/server/mir/scene/surface.h 2014-11-25 17:45:03 +0000
3960@@ -30,7 +30,7 @@
3961 {
3962 namespace input { class InputChannel; }
3963 namespace shell { class InputTargeter; }
3964-namespace geometry { class Rectangle; }
3965+namespace geometry { struct Rectangle; }
3966 namespace graphics { class CursorImage; }
3967
3968 namespace scene
3969@@ -85,15 +85,15 @@
3970 virtual void set_orientation(MirOrientation orientation) = 0;
3971 virtual void force_requests_to_complete() = 0;
3972
3973- virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) = 0;
3974- virtual std::shared_ptr<graphics::CursorImage> cursor_image() const = 0;
3975+ virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) override = 0;
3976+ virtual std::shared_ptr<graphics::CursorImage> cursor_image() const override = 0;
3977
3978 virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
3979 virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0;
3980
3981 // TODO input_channel() relates to adding and removing the surface
3982 // TODO from the scene and is probably not cleanest interface for this.
3983- virtual std::shared_ptr<input::InputChannel> input_channel() const = 0;
3984+ virtual std::shared_ptr<input::InputChannel> input_channel() const override = 0;
3985 virtual void set_reception_mode(input::InputReceptionMode mode) = 0;
3986 };
3987 }
3988
3989=== added file 'include/server/mir/server.h'
3990--- include/server/mir/server.h 1970-01-01 00:00:00 +0000
3991+++ include/server/mir/server.h 2014-11-25 17:45:03 +0000
3992@@ -0,0 +1,340 @@
3993+/*
3994+ * Copyright © 2014 Canonical Ltd.
3995+ *
3996+ * This program is free software: you can redistribute it and/or modify it
3997+ * under the terms of the GNU General Public License version 3,
3998+ * as published by the Free Software Foundation.
3999+ *
4000+ * This program is distributed in the hope that it will be useful,
4001+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4002+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4003+ * GNU General Public License for more details.
4004+ *
4005+ * You should have received a copy of the GNU General Public License
4006+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4007+ *
4008+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
4009+ */
4010+
4011+#ifndef MIR_SERVER_H_
4012+#define MIR_SERVER_H_
4013+
4014+#include <functional>
4015+#include <memory>
4016+
4017+namespace mir
4018+{
4019+namespace compositor { class Compositor; class DisplayBufferCompositorFactory; }
4020+namespace frontend { class SessionAuthorizer; class Session; }
4021+namespace graphics { class Platform; class Display; class GLConfig; class DisplayConfigurationPolicy; }
4022+namespace input { class CompositeEventFilter; class InputDispatcher; class CursorListener; class TouchVisualizer; }
4023+namespace logging { class Logger; }
4024+namespace options { class Option; }
4025+namespace shell { class FocusController; class FocusSetter; class DisplayLayout; }
4026+namespace scene
4027+{
4028+class PlacementStrategy;
4029+class PromptSessionListener;
4030+class PromptSessionManager;
4031+class SessionListener;
4032+class SessionCoordinator;
4033+class SurfaceConfigurator;
4034+class SurfaceCoordinator;
4035+}
4036+
4037+class Fd;
4038+class MainLoop;
4039+class ServerStatusListener;
4040+
4041+enum class OptionType
4042+{
4043+ null,
4044+ integer,
4045+ string,
4046+ boolean
4047+};
4048+
4049+/// Customise and run a Mir server.
4050+class Server
4051+{
4052+public:
4053+ Server();
4054+
4055+/** @name Essential operations
4056+ * These are the commands used to run and stop.
4057+ * @{ */
4058+ /// set the command line.
4059+ /// This must remain valid while apply_settings() and run() are called.
4060+ void set_command_line(int argc, char const* argv[]);
4061+
4062+ /// Applies any configuration options, hooks, or custom implementations.
4063+ /// Must be called before calling run() or accessing any mir subsystems.
4064+ void apply_settings();
4065+
4066+ /// Run the Mir server until it exits
4067+ void run();
4068+
4069+ /// Tell the Mir server to exit
4070+ void stop();
4071+
4072+ /// returns true if and only if server exited normally. Otherwise false.
4073+ bool exited_normally();
4074+/** @} */
4075+
4076+/** @name Configuration options
4077+ * These functions allow customization of the handling of configuration
4078+ * options. The add and set functions should be called before apply_settings()
4079+ * otherwise they throw a std::logic_error.
4080+ * @{ */
4081+ /// Add user configuration option(s) to Mir's option handling.
4082+ /// These will be resolved during initialisation from the command line,
4083+ /// environment variables, a config file or the supplied default.
4084+ void add_configuration_option(
4085+ std::string const& option,
4086+ std::string const& description,
4087+ int default_value);
4088+
4089+ /// Add user configuration option(s) to Mir's option handling.
4090+ /// These will be resolved during initialisation from the command line,
4091+ /// environment variables, a config file or the supplied default.
4092+ void add_configuration_option(
4093+ std::string const& option,
4094+ std::string const& description,
4095+ std::string const& default_value);
4096+
4097+ /// Add user configuration option(s) to Mir's option handling.
4098+ /// These will be resolved during initialisation from the command line,
4099+ /// environment variables, a config file or the supplied default.
4100+ void add_configuration_option(
4101+ std::string const& option,
4102+ std::string const& description,
4103+ char const* default_value);
4104+
4105+ /// Add user configuration option(s) to Mir's option handling.
4106+ /// These will be resolved during initialisation from the command line,
4107+ /// environment variables, a config file or the supplied default.
4108+ void add_configuration_option(
4109+ std::string const& option,
4110+ std::string const& description,
4111+ bool default_value);
4112+
4113+ /// Add user configuration option(s) to Mir's option handling.
4114+ /// These will be resolved during initialisation from the command line,
4115+ /// environment variables, a config file or the supplied default.
4116+ void add_configuration_option(
4117+ std::string const& option,
4118+ std::string const& description,
4119+ OptionType type);
4120+
4121+ /// Set a handler for any command line options Mir does not recognise.
4122+ /// This will be invoked if any unrecognised options are found during initialisation.
4123+ /// Any unrecognised arguments are passed to this function. The pointers remain valid
4124+ /// for the duration of the call only.
4125+ /// If set_command_line_handler is not called the default action is to exit by
4126+ /// throwing mir::AbnormalExit (which will be handled by the exception handler prior to
4127+ /// exiting run().
4128+ void set_command_line_handler(
4129+ std::function<void(int argc, char const* const* argv)> const& command_line_hander);
4130+
4131+ /// Set the configuration filename.
4132+ /// This will be searched for and parsed in the standard locations. Vis:
4133+ /// 1. $XDG_CONFIG_HOME (if set, otherwise $HOME/.config (if set))
4134+ /// 2. $XDG_CONFIG_DIRS (if set, otherwise /etc/xdg)
4135+ void set_config_filename(std::string const& config_file);
4136+
4137+ /// Returns the configuration options.
4138+ /// This will be null before initialization starts. It will be available
4139+ /// when the init_callback has been invoked (and thereafter until the server exits).
4140+ auto get_options() const -> std::shared_ptr<options::Option>;
4141+/** @} */
4142+
4143+/** @name Using hooks into the run() logic
4144+ * These allow the user to insert logic into startup or error handling.
4145+ * For obvious reasons they should be called before run().
4146+ * @{ */
4147+ /// Add a callback to be invoked when the server has been initialized,
4148+ /// but before it starts. This allows client code to get access Mir objects.
4149+ /// If multiple callbacks are added they will be invoked in the sequence added.
4150+ void add_init_callback(std::function<void()> const& init_callback);
4151+
4152+ /// Set a handler for exceptions. This is invoked in a catch (...) block and
4153+ /// the exception can be re-thrown to retrieve type information.
4154+ /// The default action is to call mir::report_exception(std::cerr)
4155+ void set_exception_handler(std::function<void()> const& exception_handler);
4156+
4157+ /// Functor for processing SIGTERM or SIGINT
4158+ /// This will not be called directly by a signal handler: arbitrary functions may be invoked.
4159+ using Terminator = std::function<void(int signal)>;
4160+
4161+ /// Set handler for termination requests.
4162+ /// terminator will be called following receipt of SIGTERM or SIGINT.
4163+ /// The default terminator stop()s the server, replacements should probably
4164+ /// do the same in addition to any additional shutdown logic.
4165+ void set_terminator(Terminator const& terminator);
4166+
4167+ /// Functor for processing fatal signals for any "emergency cleanup".
4168+ /// That is: SIGQUIT, SIGABRT, SIGFPE, SIGSEGV & SIGBUS
4169+ ///
4170+ /// \warning This will be called directly by a signal handler:
4171+ /// Only async-signal-safe functions may be called
4172+ using EmergencyCleanupHandler = std::function<void()>;
4173+
4174+ /// Add cleanup for abnormal terminations.
4175+ /// handler will be called on receipt of a fatal signal after which the
4176+ /// default signal-handler will terminate the process.
4177+ void add_emergency_cleanup(EmergencyCleanupHandler const& handler);
4178+/** @} */
4179+
4180+/** @name Providing custom implementation
4181+ * Provide alternative implementations of Mir subsystems: the functors will be invoked
4182+ * during initialization of the Mir server (or when accessor methods are called).
4183+ * They should be called before apply_settings() otherwise they throw a std::logic_error.
4184+ * @{ */
4185+ /// Each of the override functions takes a builder functor of the same form
4186+ /// \note If a null pointer is returned by the builder the default is used instead.
4187+ template<typename T> using Builder = std::function<std::shared_ptr<T>()>;
4188+
4189+ /// Sets an override functor for creating the compositor.
4190+ void override_the_compositor(Builder<compositor::Compositor> const& compositor_builder);
4191+
4192+ /// Sets an override functor for creating the per-display rendering code.
4193+ void override_the_display_buffer_compositor_factory(
4194+ Builder<compositor::DisplayBufferCompositorFactory> const& compositor_builder);
4195+
4196+ /// Sets an override functor for creating the gl config.
4197+ void override_the_gl_config(Builder<graphics::GLConfig> const& gl_config_builder);
4198+
4199+ /// Sets an override functor for creating the input dispatcher.
4200+ void override_the_input_dispatcher(Builder<input::InputDispatcher> const& input_dispatcher_builder);
4201+
4202+ /// Sets an override functor for creating the logger.
4203+ void override_the_logger(Builder<logging::Logger> const& logger_builder);
4204+
4205+ /// Sets an override functor for creating the placement strategy.
4206+ void override_the_placement_strategy(Builder<scene::PlacementStrategy> const& placement_strategy_builder);
4207+
4208+ /// Sets an override functor for creating the prompt session listener.
4209+ void override_the_prompt_session_listener(Builder<scene::PromptSessionListener> const& prompt_session_listener_builder);
4210+
4211+ /// Sets an override functor for creating the prompt session manager.
4212+ void override_the_prompt_session_manager(Builder<scene::PromptSessionManager> const& prompt_session_manager_builder);
4213+
4214+ /// Sets an override functor for creating the status listener.
4215+ void override_the_server_status_listener(Builder<ServerStatusListener> const& server_status_listener_builder);
4216+
4217+ /// Sets an override functor for creating the session authorizer.
4218+ void override_the_session_authorizer(Builder<frontend::SessionAuthorizer> const& session_authorizer_builder);
4219+
4220+ /// Sets an override functor for creating the session listener.
4221+ void override_the_session_listener(Builder<scene::SessionListener> const& session_listener_builder);
4222+
4223+ /// Sets an override functor for creating the shell focus setter.
4224+ void override_the_shell_focus_setter(Builder<shell::FocusSetter> const& focus_setter_builder);
4225+
4226+ /// Sets an override functor for creating the surface configurator.
4227+ void override_the_surface_configurator(Builder<scene::SurfaceConfigurator> const& surface_configurator_builder);
4228+
4229+ /// Each of the wrap functions takes a wrapper functor of the same form
4230+ template<typename T> using Wrapper = std::function<std::shared_ptr<T>(std::shared_ptr<T> const&)>;
4231+
4232+ /// Sets a wrapper functor for creating the cursor listener.
4233+ void wrap_cursor_listener(Wrapper<input::CursorListener> const& wrapper);
4234+
4235+ /// Sets a wrapper functor for creating the display configuration policy.
4236+ void wrap_display_configuration_policy(Wrapper<graphics::DisplayConfigurationPolicy> const& wrapper);
4237+
4238+ /// Sets a wrapper functor for creating the session coordinator.
4239+ void wrap_session_coordinator(Wrapper<scene::SessionCoordinator> const& wrapper);
4240+
4241+ /// Sets a wrapper functor for creating the surface coordinator.
4242+ void wrap_surface_coordinator(Wrapper<scene::SurfaceCoordinator> const& wrapper);
4243+/** @} */
4244+
4245+/** @name Getting access to Mir subsystems
4246+ * These may be invoked by the functors that provide alternative implementations of
4247+ * Mir subsystems.
4248+ * They should only be used after apply_settings() is called - otherwise they throw
4249+ * a std::logic_error.
4250+ * @{ */
4251+ /// \return the compositor.
4252+ auto the_compositor() const -> std::shared_ptr<compositor::Compositor>;
4253+
4254+ /// \return the composite event filter.
4255+ auto the_composite_event_filter() const -> std::shared_ptr<input::CompositeEventFilter>;
4256+
4257+ /// \return the cursor listener.
4258+ auto the_cursor_listener() const -> std::shared_ptr<input::CursorListener>;
4259+
4260+ /// \return the focus controller.
4261+ auto the_focus_controller() const -> std::shared_ptr<shell::FocusController>;
4262+
4263+ /// \return the graphics display.
4264+ auto the_display() const -> std::shared_ptr<graphics::Display>;
4265+
4266+ /// \return the GL config.
4267+ auto the_gl_config() const -> std::shared_ptr<graphics::GLConfig>;
4268+
4269+ /// \return the graphics platform.
4270+ auto the_graphics_platform() const -> std::shared_ptr<graphics::Platform>;
4271+
4272+ /// \return the main loop.
4273+ auto the_main_loop() const -> std::shared_ptr<MainLoop>;
4274+
4275+ /// \return the prompt session listener.
4276+ auto the_prompt_session_listener() const -> std::shared_ptr<scene::PromptSessionListener>;
4277+
4278+ /// \return the prompt session manager.
4279+ auto the_prompt_session_manager() const ->std::shared_ptr<scene::PromptSessionManager>;
4280+
4281+ /// \return the session authorizer.
4282+ auto the_session_authorizer() const -> std::shared_ptr<frontend::SessionAuthorizer>;
4283+
4284+ /// \return the session coordinator.
4285+ auto the_session_coordinator() const -> std::shared_ptr<scene::SessionCoordinator>;
4286+
4287+ /// \return the session listener.
4288+ auto the_session_listener() const -> std::shared_ptr<scene::SessionListener>;
4289+
4290+ /// \return the display layout.
4291+ auto the_shell_display_layout() const -> std::shared_ptr<shell::DisplayLayout>;
4292+
4293+ /// \return the surface configurator.
4294+ auto the_surface_configurator() const -> std::shared_ptr<scene::SurfaceConfigurator>;
4295+
4296+ /// \return the surface coordinator.
4297+ auto the_surface_coordinator() const -> std::shared_ptr<scene::SurfaceCoordinator>;
4298+
4299+ /// \return the touch visualizer.
4300+ auto the_touch_visualizer() const -> std::shared_ptr<input::TouchVisualizer>;
4301+/** @} */
4302+
4303+/** @name Client side support
4304+ * These facilitate use of the server through the client API.
4305+ * They should be called while the server is running (i.e. run() has been called and
4306+ * not exited) otherwise they throw a std::logic_error.
4307+ * @{ */
4308+ using ConnectHandler = std::function<void(std::shared_ptr<frontend::Session> const& session)>;
4309+
4310+ /// Get a file descriptor that can be used to connect a client
4311+ /// It can be passed to another process, or used directly with mir_connect()
4312+ /// using the format "fd://%d".
4313+ auto open_client_socket() -> Fd;
4314+
4315+ /// Get a file descriptor that can be used to connect a client
4316+ /// It can be passed to another process, or used directly with mir_connect()
4317+ /// using the format "fd://%d".
4318+ /// \param connect_handler callback to be invoked when the client connects
4319+ auto open_client_socket(ConnectHandler const& connect_handler) -> Fd;
4320+
4321+ /// Get a file descriptor that can be used to connect a prompt provider
4322+ /// It can be passed to another process, or used directly with mir_connect()
4323+ /// using the format "fd://%d".
4324+ auto open_prompt_socket() -> Fd;
4325+/** @} */
4326+private:
4327+ struct ServerConfiguration;
4328+ struct Self;
4329+ std::shared_ptr<Self> const self;
4330+};
4331+}
4332+#endif /* SERVER_H_ */
4333
4334=== modified file 'include/server/mir/server_configuration.h'
4335--- include/server/mir/server_configuration.h 2014-09-30 06:11:33 +0000
4336+++ include/server/mir/server_configuration.h 2014-11-25 17:45:03 +0000
4337@@ -69,7 +69,6 @@
4338 virtual std::shared_ptr<ServerStatusListener> the_server_status_listener() = 0;
4339 virtual std::shared_ptr<DisplayChanger> the_display_changer() = 0;
4340 virtual std::shared_ptr<graphics::Platform> the_graphics_platform() = 0;
4341- virtual std::shared_ptr<input::InputConfiguration> the_input_configuration() = 0;
4342 virtual std::shared_ptr<EmergencyCleanup> the_emergency_cleanup() = 0;
4343 virtual auto the_fatal_error_strategy() -> void (*)(char const* reason, ...) = 0;
4344
4345
4346=== modified file 'include/server/mir/shell/session_coordinator_wrapper.h'
4347--- include/server/mir/shell/session_coordinator_wrapper.h 2014-09-30 06:11:33 +0000
4348+++ include/server/mir/shell/session_coordinator_wrapper.h 2014-11-25 17:45:03 +0000
4349@@ -39,7 +39,7 @@
4350 virtual void close_session(std::shared_ptr<frontend::Session> const& session) override;
4351
4352 void focus_next() override;
4353- std::weak_ptr<scene::Session> focussed_application() const;
4354+ std::weak_ptr<scene::Session> focussed_application() const override;
4355 void set_focus_to(std::shared_ptr<scene::Session> const& focus) override;
4356
4357 void handle_surface_created(std::shared_ptr<frontend::Session> const& session) override;
4358
4359=== modified file 'include/server/mir/time/alarm.h'
4360--- include/server/mir/time/alarm.h 2014-09-11 05:51:44 +0000
4361+++ include/server/mir/time/alarm.h 2014-11-25 17:45:03 +0000
4362@@ -19,7 +19,7 @@
4363 #ifndef MIR_TIME_ALARM_H_
4364 #define MIR_TIME_ALARM_H_
4365
4366-#include "mir/time/clock.h"
4367+#include "mir/time/types.h"
4368
4369 namespace mir
4370 {
4371
4372=== modified file 'platform-ABI-sha1sums'
4373--- platform-ABI-sha1sums 2014-10-03 03:02:09 +0000
4374+++ platform-ABI-sha1sums 2014-11-25 17:45:03 +0000
4375@@ -9,12 +9,12 @@
4376 dcf8b8982f138bdde39a241825c610e955cd5e33 include/common/mir/input/input_platform.h
4377 208cd6aed5ef5f8f39b3eb86604e4133cb840485 include/common/mir/input/input_receiver_thread.h
4378 be7d58c9fde2ce91cc66dd6144b76e08b536266b include/common/mir/int_wrapper.h
4379-48015c67ddc4998ed5a2e8bb04ff3a4bfdd6a613 include/common/mir/time/clock.h
4380+9ae8473df05dd9e048a73797f01a2f34f7447554 include/common/mir/time/types.h
4381 9907751d046e4aea81881cf19e5df52c7a6a813e include/common/mir_toolkit/client_types.h
4382-183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/common/mir_toolkit/common.h
4383+2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h
4384 fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h
4385 bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h
4386-99ef5f3bf548508fae24c60f74be1dea018a6e8c include/common/mir_toolkit/mesa/native_display.h
4387+4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h
4388 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h
4389 871e609c0fed0d566ddbaaa8ac2d7cd5c06dd09a include/platform/mir/abnormal_exit.h
4390 8f47feb6d983aa5c9ebd58e9d1524361c9f5e651 include/platform/mir/fatal.h
4391@@ -35,12 +35,12 @@
4392 979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
4393 f90a35371e236a6cfec8e9a8474dbb3305c7621e include/platform/mir/graphics/internal_client.h
4394 c9730cac4a3a101f9706ec6f444958abe047fd88 include/platform/mir/graphics/internal_surface.h
4395-b4aaa941df9c0a6f9342629b26542700876f3aaa include/platform/mir/graphics/native_platform.h
4396-f47dac961f060eb29a44ed3c8c18a49a3d353bb1 include/platform/mir/graphics/platform.h
4397-1fbe488b4581486fd01e2f03e504f31b72c09040 include/platform/mir/graphics/platform_ipc_operations.h
4398-9c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
4399+d062fde60f1caa3102560b0b50da9909e18b3449 include/platform/mir/graphics/native_platform.h
4400+109d2c82d245a512e7c1790a3b853c9c275ebd4d include/platform/mir/graphics/platform.h
4401+3b3463d2513f4c3985f2400496dab333518f9a13 include/platform/mir/graphics/platform_ipc_operations.h
4402+1b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h
4403 84c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
4404-f5746dab3336266cfd410ce4e4d01333df6e5b99 include/platform/mir/options/configuration.h
4405+abeb45a8c6bfc81a12136f25e455e9803c32c10e include/platform/mir/options/configuration.h
4406 47007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h
4407 b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
4408 3c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h
4409
4410=== modified file 'playground/CMakeLists.txt'
4411--- playground/CMakeLists.txt 2014-10-03 15:10:23 +0000
4412+++ playground/CMakeLists.txt 2014-11-25 17:45:03 +0000
4413@@ -8,6 +8,10 @@
4414 ${PROJECT_SOURCE_DIR}/examples/
4415 )
4416
4417+add_library(playgroundserverconfig STATIC
4418+ server_configuration.cpp
4419+)
4420+
4421 set(RENDER_SURFACES_SOURCES
4422 render_surfaces.cpp
4423 buffer_render_target.cpp
4424@@ -16,6 +20,7 @@
4425 add_executable(mir_demo_standalone_render_surfaces ${RENDER_SURFACES_SOURCES})
4426 target_link_libraries(mir_demo_standalone_render_surfaces
4427 mirserver
4428+ playgroundserverconfig
4429 exampleserverconfig
4430 ${Boost_LIBRARIES}
4431 )
4432
4433=== modified file 'playground/demo-inprocess-surface-client/CMakeLists.txt'
4434--- playground/demo-inprocess-surface-client/CMakeLists.txt 2014-10-03 15:46:20 +0000
4435+++ playground/demo-inprocess-surface-client/CMakeLists.txt 2014-11-25 17:45:03 +0000
4436@@ -7,6 +7,7 @@
4437 target_link_libraries(mir_demo_standalone_inprocess_egl
4438 mirserver
4439 mirdraw
4440+ playgroundserverconfig
4441 exampleserverconfig
4442 )
4443 # TODO Install this demo?
4444
4445=== modified file 'playground/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp'
4446--- playground/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp 2014-09-12 05:56:28 +0000
4447+++ playground/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp 2014-11-25 17:45:03 +0000
4448@@ -19,7 +19,7 @@
4449 #include "inprocess_egl_client.h"
4450
4451 #include "mir/run_mir.h"
4452-#include "server_configuration.h"
4453+#include "../server_configuration.h"
4454
4455 #include "mir/report_exception.h"
4456
4457
4458=== modified file 'playground/demo-shell/CMakeLists.txt'
4459--- playground/demo-shell/CMakeLists.txt 2014-09-30 06:11:33 +0000
4460+++ playground/demo-shell/CMakeLists.txt 2014-11-25 17:45:03 +0000
4461@@ -12,6 +12,7 @@
4462 target_link_libraries(mir_demo_server_shell
4463 demo-shell
4464 mirserver
4465+ playgroundserverconfig
4466 exampleserverconfig
4467 )
4468
4469
4470=== modified file 'playground/demo-shell/demo_compositor.cpp'
4471--- playground/demo-shell/demo_compositor.cpp 2014-09-30 06:11:33 +0000
4472+++ playground/demo-shell/demo_compositor.cpp 2014-11-25 17:45:03 +0000
4473@@ -18,7 +18,6 @@
4474
4475 #include "mir/graphics/display_buffer.h"
4476 #include "mir/compositor/compositor_report.h"
4477-#include "mir/compositor/scene.h"
4478 #include "mir/compositor/scene_element.h"
4479 #include "mir/compositor/destination_alpha.h"
4480 #include "demo_compositor.h"
4481@@ -38,11 +37,9 @@
4482
4483 me::DemoCompositor::DemoCompositor(
4484 mg::DisplayBuffer& display_buffer,
4485- std::shared_ptr<mc::Scene> const& scene,
4486 mg::GLProgramFactory const& factory,
4487 std::shared_ptr<mc::CompositorReport> const& report) :
4488 display_buffer(display_buffer),
4489- scene(scene),
4490 report(report),
4491 renderer(
4492 factory,
4493@@ -51,15 +48,13 @@
4494 30.0f, //titlebar_height
4495 80.0f) //shadow_radius
4496 {
4497- scene->register_compositor(this);
4498 }
4499
4500 me::DemoCompositor::~DemoCompositor()
4501 {
4502- scene->unregister_compositor(this);
4503 }
4504
4505-void me::DemoCompositor::composite()
4506+void me::DemoCompositor::composite(mc::SceneElementSequence&& elements)
4507 {
4508 report->began_frame(this);
4509 //a simple filtering out of renderables that shouldn't be drawn
4510@@ -68,7 +63,6 @@
4511 mg::RenderableList renderable_list;
4512 std::unordered_set<mg::Renderable::ID> decoration_skip_list;
4513
4514- auto elements = scene->scene_elements_for(this);
4515 for(auto const& it : elements)
4516 {
4517 auto const& renderable = it->renderable();
4518@@ -81,15 +75,35 @@
4519 if (renderable->visible() && any_part_drawn)
4520 {
4521 renderable_list.push_back(renderable);
4522- it->rendered_in(this);
4523+
4524+ // Fullscreen and opaque? Definitely no embellishment
4525+ if (renderable->screen_position() == view_area &&
4526+ renderable->alpha() == 1.0f &&
4527+ !renderable->shaped() &&
4528+ renderable->transformation() == glm::mat4())
4529+ {
4530+ embellished = false;
4531+ nonrenderlist_elements = false; // Don't care what's underneath
4532+ }
4533+
4534+ it->rendered();
4535 }
4536 else
4537 {
4538- it->occluded_in(this);
4539+ it->occluded();
4540 }
4541 nonrenderlist_elements |= embellished;
4542 }
4543
4544+ /*
4545+ * Note: Buffer lifetimes are ensured by the two objects holding
4546+ * references to them; elements and renderable_list.
4547+ * So no buffer is going to be released back to the client till
4548+ * both of those containers get destroyed (end of the function).
4549+ * Actually, there's a third reference held by the texture cache
4550+ * in GLRenderer, but that gets released earlier in render().
4551+ */
4552+
4553 if (!nonrenderlist_elements &&
4554 display_buffer.post_renderables_if_optimizable(renderable_list))
4555 {
4556@@ -104,7 +118,6 @@
4557 renderer.begin(std::move(decoration_skip_list));
4558 renderer.render(renderable_list);
4559 display_buffer.post_update();
4560- renderer.end();
4561 report->finished_frame(false, this);
4562 }
4563 }
4564
4565=== modified file 'playground/demo-shell/demo_compositor.h'
4566--- playground/demo-shell/demo_compositor.h 2014-09-30 06:11:33 +0000
4567+++ playground/demo-shell/demo_compositor.h 2014-11-25 17:45:03 +0000
4568@@ -43,16 +43,14 @@
4569 public:
4570 DemoCompositor(
4571 graphics::DisplayBuffer& display_buffer,
4572- std::shared_ptr<compositor::Scene> const& scene,
4573 graphics::GLProgramFactory const& factory,
4574 std::shared_ptr<compositor::CompositorReport> const& report);
4575 ~DemoCompositor();
4576
4577- void composite() override;
4578+ void composite(compositor::SceneElementSequence&& elements) override;
4579
4580 private:
4581 graphics::DisplayBuffer& display_buffer;
4582- std::shared_ptr<compositor::Scene> const scene;
4583 std::shared_ptr<compositor::CompositorReport> const report;
4584 DemoRenderer renderer;
4585 };
4586
4587=== modified file 'playground/demo-shell/demo_renderer.cpp'
4588--- playground/demo-shell/demo_renderer.cpp 2014-10-01 03:41:21 +0000
4589+++ playground/demo-shell/demo_renderer.cpp 2014-11-25 17:45:03 +0000
4590@@ -163,6 +163,9 @@
4591 titlebar_corner_tex = generate_frame_corner_texture(corner_radius,
4592 {128,128,128,255},
4593 255);
4594+
4595+ clear_color[0] = clear_color[1] = clear_color[2] = 0.2f;
4596+ clear_color[3] = 1.0f;
4597 }
4598
4599 DemoRenderer::~DemoRenderer()
4600@@ -173,15 +176,6 @@
4601
4602 void DemoRenderer::begin(std::unordered_set<graphics::Renderable::ID> decoration_skip_list_) const
4603 {
4604- bool const opaque = destination_alpha() == compositor::DestinationAlpha::opaque;
4605- glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
4606-
4607- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
4608- glClear(GL_COLOR_BUFFER_BIT);
4609-
4610- if (opaque)
4611- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
4612-
4613 decoration_skip_list = decoration_skip_list_;
4614 }
4615
4616
4617=== modified file 'playground/demo-shell/demo_renderer.h'
4618--- playground/demo-shell/demo_renderer.h 2014-09-30 06:11:33 +0000
4619+++ playground/demo-shell/demo_renderer.h 2014-11-25 17:45:03 +0000
4620@@ -39,7 +39,6 @@
4621 float const shadow_radius);
4622 ~DemoRenderer();
4623
4624- void begin() const override { GLRenderer::begin(); }
4625 void begin(std::unordered_set<graphics::Renderable::ID> renderables_not_to_decorate) const;
4626
4627 void tessellate(
4628
4629=== modified file 'playground/demo-shell/demo_shell.cpp'
4630--- playground/demo-shell/demo_shell.cpp 2014-09-12 05:56:28 +0000
4631+++ playground/demo-shell/demo_shell.cpp 2014-11-25 17:45:03 +0000
4632@@ -21,7 +21,7 @@
4633 #include "demo_compositor.h"
4634 #include "window_manager.h"
4635 #include "fullscreen_placement_strategy.h"
4636-#include "server_configuration.h"
4637+#include "../server_configuration.h"
4638
4639 #include "mir/options/default_configuration.h"
4640 #include "mir/run_mir.h"
4641@@ -53,10 +53,8 @@
4642 {
4643 public:
4644 DisplayBufferCompositorFactory(
4645- std::shared_ptr<mc::Scene> const& scene,
4646 std::shared_ptr<mg::GLProgramFactory> const& gl_program_factory,
4647 std::shared_ptr<mc::CompositorReport> const& report) :
4648- scene(scene),
4649 gl_program_factory(gl_program_factory),
4650 report(report)
4651 {
4652@@ -66,11 +64,10 @@
4653 mg::DisplayBuffer& display_buffer) override
4654 {
4655 return std::unique_ptr<mc::DisplayBufferCompositor>(
4656- new me::DemoCompositor{display_buffer, scene, *gl_program_factory, report});
4657+ new me::DemoCompositor{display_buffer, *gl_program_factory, report});
4658 }
4659
4660 private:
4661- std::shared_ptr<mc::Scene> const scene;
4662 std::shared_ptr<mg::GLProgramFactory> const gl_program_factory;
4663 std::shared_ptr<mc::CompositorReport> const report;
4664 };
4665@@ -96,13 +93,12 @@
4666 }
4667
4668
4669- std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory()
4670+ std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory() override
4671 {
4672 return display_buffer_compositor_factory(
4673 [this]()
4674 {
4675 return std::make_shared<me::DisplayBufferCompositorFactory>(
4676- the_scene(),
4677 the_gl_program_factory(),
4678 the_compositor_report());
4679 });
4680
4681=== modified file 'playground/demo-shell/window_manager.cpp'
4682--- playground/demo-shell/window_manager.cpp 2014-09-12 05:56:28 +0000
4683+++ playground/demo-shell/window_manager.cpp 2014-11-25 17:45:03 +0000
4684@@ -123,7 +123,6 @@
4685 assert(compositor);
4686
4687 bool handled = false;
4688- static int const ANDROID_KEYCODE_POWER = 26;
4689
4690 if (event.key.type == mir_event_type_key &&
4691 event.key.action == mir_key_action_down)
4692@@ -136,7 +135,7 @@
4693 }
4694 else if ((event.key.modifiers & mir_key_modifier_alt &&
4695 event.key.scan_code == KEY_P) ||
4696- (event.key.key_code == ANDROID_KEYCODE_POWER))
4697+ (event.key.scan_code == KEY_POWER))
4698 {
4699 compositor->stop();
4700 auto conf = display->configuration();
4701@@ -232,7 +231,37 @@
4702 return true;
4703 }
4704 }
4705+ else if ((event.key.scan_code == KEY_VOLUMEDOWN ||
4706+ event.key.scan_code == KEY_VOLUMEUP) &&
4707+ max_fingers == 1)
4708+ {
4709+ int delta = (event.key.scan_code == KEY_VOLUMEDOWN) ? -1 : +1;
4710+ static const MirOrientation order[4] =
4711+ {
4712+ mir_orientation_normal,
4713+ mir_orientation_right,
4714+ mir_orientation_inverted,
4715+ mir_orientation_left
4716+ };
4717
4718+ compositor->stop();
4719+ auto conf = display->configuration();
4720+ conf->for_each_output(
4721+ [&](mg::UserDisplayConfigurationOutput& output)
4722+ {
4723+ int i = 0;
4724+ for (; i < 4; ++i)
4725+ {
4726+ if (output.orientation == order[i])
4727+ break;
4728+ }
4729+ output.orientation = order[(i+4+delta) % 4];
4730+ }
4731+ );
4732+ display->configure(*conf.get());
4733+ compositor->start();
4734+ return true;
4735+ }
4736 }
4737 else if (event.type == mir_event_type_motion &&
4738 focus_controller)
4739@@ -346,6 +375,9 @@
4740 }
4741 }
4742
4743+ if (fingers == 1 && action == mir_motion_action_up)
4744+ max_fingers = 0;
4745+
4746 old_cursor = cursor;
4747 }
4748 return handled;
4749
4750=== modified file 'playground/render_surfaces.cpp'
4751--- playground/render_surfaces.cpp 2014-09-12 05:56:28 +0000
4752+++ playground/render_surfaces.cpp 2014-11-25 17:45:03 +0000
4753@@ -25,7 +25,6 @@
4754 #include "mir/scene/surface_creation_parameters.h"
4755 #include "mir/geometry/size.h"
4756 #include "mir/geometry/rectangles.h"
4757-#include "mir/graphics/buffer_initializer.h"
4758 #include "mir/graphics/display.h"
4759 #include "mir/graphics/display_buffer.h"
4760 #include "mir/graphics/gl_context.h"
4761@@ -72,9 +71,7 @@
4762 ///\section RenderSurfacesServerConfiguration RenderSurfacesServerConfiguration
4763 /// The configuration stubs out client connectivity and input.
4764 /// \snippet render_surfaces.cpp RenderSurfacesServerConfiguration_stubs_tag
4765-/// it also provides a bespoke buffer initializer
4766-/// \snippet render_surfaces.cpp RenderResourcesBufferInitializer_tag
4767-/// and a bespoke display buffer compositor
4768+/// it also provides a bespoke display buffer compositor
4769 /// \snippet render_surfaces.cpp RenderSurfacesDisplayBufferCompositor_tag
4770 ///\section Utilities Utility classes
4771 /// For smooth animation we need to track time and move surfaces accordingly
4772@@ -238,8 +235,8 @@
4773 {
4774 struct NullConnector : public mf::Connector
4775 {
4776- void start() {}
4777- void stop() {}
4778+ void start() override {}
4779+ void stop() override {}
4780 int client_socket_fd() const override { return 0; }
4781 int client_socket_fd(std::function<void(std::shared_ptr<mf::Session> const&)> const&) const override { return 0; }
4782 };
4783@@ -248,44 +245,9 @@
4784 }
4785 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
4786
4787- ///\internal [RenderResourcesBufferInitializer_tag]
4788- // Override for a bespoke buffer initializer
4789- std::shared_ptr<mg::BufferInitializer> the_buffer_initializer() override
4790- {
4791- class RenderResourcesBufferInitializer : public mg::BufferInitializer
4792- {
4793- public:
4794- RenderResourcesBufferInitializer(std::unique_ptr<mg::GLContext> gl_context)
4795- : gl_context{std::move(gl_context)}
4796- {
4797- }
4798-
4799- void operator()(mg::Buffer& buffer)
4800- {
4801- auto using_gl_context = mir::raii::paired_calls(
4802- [this] { gl_context->make_current(); },
4803- [this] { gl_context->release_current(); });
4804-
4805- mt::ImageRenderer img_renderer{mir_image.pixel_data,
4806- geom::Size{mir_image.width, mir_image.height},
4807- mir_image.bytes_per_pixel};
4808- mt::BufferRenderTarget brt{buffer};
4809- brt.make_current();
4810- img_renderer.render();
4811- }
4812-
4813- private:
4814- std::unique_ptr<mg::GLContext> const gl_context;
4815-
4816- };
4817-
4818- return std::make_shared<RenderResourcesBufferInitializer>(the_display()->create_gl_context());
4819- }
4820- ///\internal [RenderResourcesBufferInitializer_tag]
4821-
4822 // Unless the compositor starts before we create the surfaces it won't respond to
4823 // the change notification that causes.
4824- std::shared_ptr<mir::ServerStatusListener> the_server_status_listener()
4825+ std::shared_ptr<mir::ServerStatusListener> the_server_status_listener() override
4826 {
4827 struct ServerStatusListener : mir::ServerStatusListener
4828 {
4829@@ -324,7 +286,7 @@
4830 {
4831 }
4832
4833- void composite()
4834+ void composite(mc::SceneElementSequence&& scene_sequence) override
4835 {
4836 while (!created) std::this_thread::yield();
4837 stop_watch.stop();
4838@@ -336,7 +298,7 @@
4839 }
4840
4841 glClearColor(0.0, 1.0, 0.0, 1.0);
4842- db_compositor->composite();
4843+ db_compositor->composite(std::move(scene_sequence));
4844
4845 for (auto& m : moveables)
4846 m.step();
4847@@ -389,6 +351,8 @@
4848
4849 auto const display = the_display();
4850 auto const surface_coordinator = the_surface_coordinator();
4851+ auto const gl_context = the_display()->create_gl_context();
4852+
4853 /* TODO: Get proper configuration */
4854 geom::Rectangles view_area;
4855 display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)
4856@@ -413,16 +377,23 @@
4857 .of_buffer_usage(mg::BufferUsage::hardware),
4858 nullptr);
4859
4860- /*
4861- * We call swap_buffers() twice so that the surface is
4862- * considers the first buffer to be posted.
4863- * (TODO There must be a better way!)
4864- */
4865 {
4866 mg::Buffer* buffer{nullptr};
4867 auto const complete = [&](mg::Buffer* new_buf){ buffer = new_buf; };
4868- s->swap_buffers(buffer, complete);
4869- s->swap_buffers(buffer, complete);
4870+ s->swap_buffers(buffer, complete); // Fetch buffer for rendering
4871+ {
4872+ auto using_gl_context = mir::raii::paired_calls(
4873+ [&gl_context] { gl_context->make_current(); },
4874+ [&gl_context] { gl_context->release_current(); });
4875+
4876+ mt::ImageRenderer img_renderer{mir_image.pixel_data,
4877+ geom::Size{mir_image.width, mir_image.height},
4878+ mir_image.bytes_per_pixel};
4879+ mt::BufferRenderTarget brt{*buffer};
4880+ brt.make_current();
4881+ img_renderer.render();
4882+ }
4883+ s->swap_buffers(buffer, complete); // Post rendered buffer
4884 }
4885
4886 /*
4887
4888=== renamed file 'examples/server_configuration.cpp' => 'playground/server_configuration.cpp'
4889--- examples/server_configuration.cpp 2014-03-26 05:48:59 +0000
4890+++ playground/server_configuration.cpp 2014-11-25 17:45:03 +0000
4891@@ -18,122 +18,14 @@
4892
4893 #include "server_configuration.h"
4894 #include "mir/options/default_configuration.h"
4895-#include "mir/graphics/display_configuration_policy.h"
4896-#include "mir/graphics/display_configuration.h"
4897 #include "mir/input/composite_event_filter.h"
4898 #include "mir/main_loop.h"
4899
4900-#include <string>
4901-
4902-#include <linux/input.h>
4903-#include <unordered_map>
4904+#include "example_display_configuration_policy.h"
4905+#include "example_input_event_filter.h"
4906
4907 namespace me = mir::examples;
4908 namespace mg = mir::graphics;
4909-namespace geom = mir::geometry;
4910-
4911-namespace
4912-{
4913-
4914-char const* const display_config_opt = "display-config";
4915-char const* const clone_opt_val = "clone";
4916-char const* const sidebyside_opt_val = "sidebyside";
4917-char const* const single_opt_val = "single";
4918-
4919-class SideBySideDisplayConfigurationPolicy : public mg::DisplayConfigurationPolicy
4920-{
4921-public:
4922- void apply_to(mg::DisplayConfiguration& conf)
4923- {
4924- size_t const preferred_mode_index{0};
4925- int max_x = 0;
4926- std::unordered_map<mg::DisplayConfigurationCardId, size_t> available_outputs_for_card;
4927-
4928- conf.for_each_card(
4929- [&](mg::DisplayConfigurationCard const& card)
4930- {
4931- available_outputs_for_card[card.id] = card.max_simultaneous_outputs;
4932- });
4933-
4934- conf.for_each_output(
4935- [&](mg::UserDisplayConfigurationOutput& conf_output)
4936- {
4937- if (conf_output.connected && conf_output.modes.size() > 0 &&
4938- available_outputs_for_card[conf_output.card_id] > 0)
4939- {
4940- conf_output.used = true;
4941- conf_output.top_left = geom::Point{max_x, 0};
4942- conf_output.current_mode_index = preferred_mode_index;
4943- conf_output.power_mode = mir_power_mode_on;
4944- conf_output.orientation = mir_orientation_normal;
4945- max_x += conf_output.modes[preferred_mode_index].size.width.as_int();
4946- --available_outputs_for_card[conf_output.card_id];
4947- }
4948- else
4949- {
4950- conf_output.used = false;
4951- conf_output.power_mode = mir_power_mode_off;
4952- }
4953- });
4954- }
4955-};
4956-
4957-class SingleDisplayConfigurationPolicy : public mg::DisplayConfigurationPolicy
4958-{
4959-public:
4960- void apply_to(mg::DisplayConfiguration& conf)
4961- {
4962- size_t const preferred_mode_index{0};
4963- bool done{false};
4964-
4965- conf.for_each_output(
4966- [&](mg::UserDisplayConfigurationOutput& conf_output)
4967- {
4968- if (!done && conf_output.connected && conf_output.modes.size() > 0)
4969- {
4970- conf_output.used = true;
4971- conf_output.top_left = geom::Point{0, 0};
4972- conf_output.current_mode_index = preferred_mode_index;
4973- conf_output.power_mode = mir_power_mode_on;
4974- done = true;
4975- }
4976- else
4977- {
4978- conf_output.used = false;
4979- conf_output.power_mode = mir_power_mode_off;
4980- }
4981- });
4982- }
4983-};
4984-
4985-class QuitFilter : public mir::input::EventFilter
4986-{
4987-public:
4988- QuitFilter(std::shared_ptr<mir::MainLoop> const& main_loop)
4989- : main_loop{main_loop}
4990- {
4991- }
4992-
4993- bool handle(MirEvent const& event) override
4994- {
4995- if (event.type == mir_event_type_key &&
4996- event.key.action == mir_key_action_down &&
4997- (event.key.modifiers & mir_key_modifier_alt) &&
4998- (event.key.modifiers & mir_key_modifier_ctrl) &&
4999- event.key.scan_code == KEY_BACKSPACE)
5000- {
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: