Status: | Merged |
---|---|
Approved by: | Kevin DuBois |
Approved revision: | 3622 |
Merged at revision: | 1289 |
Proposed branch: | lp:mir/0.24 |
Merge into: | lp:mir/ubuntu |
Prerequisite: | lp:mir/0.23 |
Diff against target: |
29624 lines (+13565/-4898) 458 files modified
.bzrignore (+2/-0) 3rd_party/android-deps/android/input.h (+4/-1) 3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h (+12/-0) 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h (+17/-5) 3rd_party/android-input/android/frameworks/base/services/input/Input.cpp (+18/-0) 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp (+74/-13) CMakeLists.txt (+51/-6) cmake/MirCommon.cmake (+3/-7) debian/changelog (+110/-0) debian/control (+11/-10) debian/libmirplatform13.install (+1/-1) debian/libmirserver41.install (+1/-1) debian/mir-platform-graphics-android10.install (+1/-1) debian/mir-platform-graphics-mesa-kms10.install (+1/-1) debian/mir-platform-graphics-mesa-x10.install (+1/-1) debian/mir-test-tools.install (+2/-0) debian/mir-utils.install (+1/-0) doc/mainpage.md (+1/-0) doc/measuring_latency.md (+24/-0) examples/CMakeLists.txt (+3/-3) examples/eglplasma.c (+19/-33) examples/graphics_utils.cpp (+2/-0) examples/image_renderer.cpp (+2/-0) examples/mir_demo_server_loader.cpp (+5/-5) examples/render_surfaces.cpp (+17/-7) examples/server_example.cpp (+43/-5) examples/server_example_adorning_compositor.cpp (+10/-8) examples/server_example_canonical_window_manager.cpp (+18/-4) examples/server_example_tiling_window_manager.cpp (+0/-640) examples/server_example_tiling_window_manager.h (+0/-124) examples/server_example_window_management.cpp (+2/-8) examples/server_example_window_management_info.cpp (+27/-18) examples/server_example_window_management_info.h (+3/-1) include/client/mir/event_printer.h (+1/-0) include/client/mir/events/event_builders.h (+14/-0) include/client/mir_toolkit/client_types.h (+2/-1) include/client/mir_toolkit/events/event.h (+14/-0) include/client/mir_toolkit/events/input_device_state_event.h (+135/-0) include/client/mir_toolkit/events/surface_output_event.h (+3/-2) include/client/mir_toolkit/mir_surface.h (+27/-5) include/common/mir/geometry/dimensions.h (+0/-5) include/common/mir/input/keymap.h (+73/-0) include/common/mir/optional_value.h (+8/-1) include/common/mir_toolkit/common.h (+10/-0) include/platform/mir/graphics/platform.h (+0/-3) include/platform/mir/input/event_builder.h (+2/-0) include/platform/mir/input/input_sink.h (+22/-0) include/server/mir/frontend/buffer_sink.h (+3/-0) include/server/mir/frontend/buffer_stream.h (+7/-3) include/server/mir/frontend/session.h (+6/-0) include/server/mir/input/device.h (+3/-0) include/server/mir/input/keyboard_configuration.h (+49/-0) include/server/mir/scene/application_not_responding_detector_wrapper.h (+49/-0) include/server/mir/scene/buffer_stream_factory.h (+5/-3) include/server/mir/scene/session.h (+4/-0) include/server/mir/scene/surface.h (+3/-0) include/server/mir/scene/surface_creation_parameters.h (+1/-0) include/server/mir/server.h (+20/-6) include/server/mir/shell/abstract_shell.h (+7/-1) include/server/mir/shell/surface_specification.h (+1/-0) include/test/mir/test/doubles/mock_egl.h (+7/-4) include/test/mir/test/doubles/null_platform.h (+0/-5) include/test/mir/test/doubles/stub_input_device.h (+10/-0) include/test/mir/test/doubles/stub_session.h (+4/-0) include/test/mir/test/doubles/stub_surface.h (+2/-0) include/test/mir/test/event_matchers.h (+36/-4) playground/CMakeLists.txt (+8/-0) playground/demo-shell/CMakeLists.txt (+0/-1) playground/demo-shell/default_window_manager.cpp (+0/-150) playground/demo-shell/default_window_manager.h (+0/-86) playground/demo-shell/demo_compositor.cpp (+2/-2) playground/demo-shell/demo_renderer.cpp (+4/-0) playground/demo-shell/demo_shell.cpp (+5/-53) playground/demo-shell/typo/CMakeLists.txt (+1/-3) playground/demo-shell/typo/typo_glcache.cpp (+1/-1) playground/mir_demo_client_chain_jumping_buffers.c (+260/-0) playground/mir_demo_client_prerendered_frames.c (+15/-4) playground/server_configuration.cpp (+0/-8) playground/server_configuration.h (+0/-6) src/CMakeLists.txt (+1/-3) src/client/CMakeLists.txt (+1/-0) src/client/atomic_callback.h (+5/-0) src/client/buffer.cpp (+23/-8) src/client/buffer.h (+33/-28) src/client/buffer_factory.cpp (+23/-12) src/client/buffer_factory.h (+7/-6) src/client/buffer_receiver.h (+0/-45) src/client/buffer_stream.cpp (+3/-3) src/client/buffer_vault.cpp (+7/-8) src/client/buffer_vault.h (+8/-8) src/client/client_buffer_stream.h (+3/-2) src/client/connection_surface_map.h (+13/-8) src/client/error_buffer.cpp (+78/-0) src/client/error_buffer.h (+63/-0) src/client/error_chain.cpp (+0/-20) src/client/error_chain.h (+0/-5) src/client/event.cpp (+77/-0) src/client/event_printer.cpp (+31/-1) src/client/events/event_builders.cpp (+23/-3) src/client/input/android/android_input_lexicon.cpp (+6/-0) src/client/input/android/android_input_receiver.cpp (+1/-4) src/client/input/xkb_mapper.cpp (+236/-88) src/client/logging/rpc_report.cpp (+3/-3) src/client/mir_buffer.h (+65/-0) src/client/mir_buffer_api.cpp (+59/-16) src/client/mir_connection.cpp (+40/-40) src/client/mir_connection.h (+3/-5) src/client/mir_presentation_chain.h (+4/-8) src/client/mir_presentation_chain_api.cpp (+2/-1) src/client/mir_surface.cpp (+20/-18) src/client/mir_surface.h (+8/-2) src/client/mir_surface_api.cpp (+10/-0) src/client/presentation_chain.cpp (+2/-39) src/client/presentation_chain.h (+0/-8) src/client/rpc/mir_protobuf_rpc_channel.cpp (+3/-3) src/client/surface_map.cpp (+18/-6) src/client/surface_map.h (+10/-6) src/client/symbols.map (+33/-1) src/common/CMakeLists.txt (+0/-3) src/common/events/CMakeLists.txt (+1/-0) src/common/events/event.cpp (+17/-3) src/common/events/input_device_state_event.cpp (+223/-0) src/common/fatal/fatal.cpp (+1/-1) src/common/symbols.map (+33/-0) src/gl/program.cpp (+2/-0) src/include/client/mir/client_context.h (+1/-0) src/include/client/mir_toolkit/client_types_nbs.h (+1/-1) src/include/client/mir_toolkit/mir_buffer.h (+48/-0) src/include/client/mir_toolkit/mir_presentation_chain.h (+0/-21) src/include/common/mir/events/event.h (+3/-0) src/include/common/mir/events/event_private.h (+1/-0) src/include/common/mir/events/input_device_state_event.h (+75/-0) src/include/common/mir/input/key_mapper.h (+101/-0) src/include/common/mir/input/xkb_mapper.h (+40/-19) src/include/gl/mir/gl/primitive.h (+1/-1) src/include/gl/mir/gl/program.h (+1/-1) src/include/gl/mir/gl/texture.h (+1/-1) src/include/platform/mir/graphics/egl_extensions.h (+2/-3) src/include/platform/mir/options/configuration.h (+1/-2) src/include/server/mir/default_server_configuration.h (+11/-3) src/include/server/mir/input/seat.h (+10/-0) src/include/server/mir/server_configuration.h (+3/-1) src/include/server/mir/shell/canonical_window_manager.h (+3/-1) src/include/server/mir/shell/window_management_info.h (+1/-0) src/platform/CMakeLists.txt (+3/-2) src/platform/graphics/CMakeLists.txt (+1/-1) src/platform/graphics/egl_error.cpp (+21/-0) src/platform/graphics/egl_extensions.cpp (+7/-0) src/platform/options/default_configuration.cpp (+3/-6) src/platform/symbols.map (+3/-10) src/platforms/CMakeLists.txt (+7/-3) src/platforms/android/client/android_client_platform.cpp (+14/-35) src/platforms/android/client/client_platform_factory.cpp (+6/-6) src/platforms/android/common/CMakeLists.txt (+1/-0) src/platforms/android/common/mir_native_window.cpp (+55/-6) src/platforms/android/common/native_window_report.cpp (+170/-0) src/platforms/android/include/egl_sync_extensions.h (+2/-0) src/platforms/android/include/mir_native_window.h (+7/-1) src/platforms/android/include/native_window_report.h (+81/-0) src/platforms/android/server/buffer.h (+2/-0) src/platforms/android/server/device_quirks.cpp (+72/-8) src/platforms/android/server/device_quirks.h (+9/-0) src/platforms/android/server/display.cpp (+8/-2) src/platforms/android/server/display.h (+3/-0) src/platforms/android/server/hwc_fallback_gl_renderer.cpp (+4/-2) src/platforms/android/server/hwc_layers.cpp (+4/-4) src/platforms/android/server/platform.cpp (+55/-39) src/platforms/android/server/platform.h (+3/-1) src/platforms/android/utils/CMakeLists.txt (+3/-1) src/platforms/android/utils/render_overlays.cpp (+68/-29) src/platforms/common/server/CMakeLists.txt (+4/-2) src/platforms/common/server/kms-utils/CMakeLists.txt (+14/-0) src/platforms/common/server/kms-utils/drm_mode_resources.cpp (+404/-74) src/platforms/common/server/kms-utils/drm_mode_resources.h (+108/-8) src/platforms/common/server/kms-utils/kms_connector.cpp (+233/-0) src/platforms/common/server/kms-utils/kms_connector.h (+60/-0) src/platforms/common/server/shm_buffer.cpp (+12/-2) src/platforms/eglstream-kms/CMakeLists.txt (+2/-0) src/platforms/eglstream-kms/client/CMakeLists.txt (+39/-0) src/platforms/eglstream-kms/client/client_buffer.cpp (+159/-0) src/platforms/eglstream-kms/client/client_buffer.h (+67/-0) src/platforms/eglstream-kms/client/client_buffer_factory.cpp (+36/-0) src/platforms/eglstream-kms/client/client_buffer_factory.h (+45/-0) src/platforms/eglstream-kms/client/client_platform.cpp (+77/-0) src/platforms/eglstream-kms/client/client_platform.h (+52/-0) src/platforms/eglstream-kms/client/client_platform_factory.cpp (+59/-0) src/platforms/eglstream-kms/client/symbols.map (+7/-0) src/platforms/eglstream-kms/server/CMakeLists.txt (+55/-0) src/platforms/eglstream-kms/server/buffer_allocator.cpp (+69/-0) src/platforms/eglstream-kms/server/buffer_allocator.h (+48/-0) src/platforms/eglstream-kms/server/display.cpp (+363/-0) src/platforms/eglstream-kms/server/display.h (+82/-0) src/platforms/eglstream-kms/server/egl_output.cpp (+359/-0) src/platforms/eglstream-kms/server/egl_output.h (+79/-0) src/platforms/eglstream-kms/server/kms_display_configuration.cpp (+331/-0) src/platforms/eglstream-kms/server/kms_display_configuration.h (+70/-0) src/platforms/eglstream-kms/server/platform.cpp (+157/-0) src/platforms/eglstream-kms/server/platform.h (+64/-0) src/platforms/eglstream-kms/server/platform_symbols.cpp (+189/-0) src/platforms/eglstream-kms/server/symbols.map.in (+10/-0) src/platforms/evdev/libinput_device.cpp (+1/-1) src/platforms/evdev/platform.cpp (+1/-1) src/platforms/mesa/CMakeLists.txt (+1/-0) src/platforms/mesa/client/client_platform_factory.cpp (+8/-6) src/platforms/mesa/server/CMakeLists.txt (+22/-2) src/platforms/mesa/server/buffer_allocator.cpp (+4/-2) src/platforms/mesa/server/common/CMakeLists.txt (+0/-21) src/platforms/mesa/server/display_helpers.cpp (+19/-5) src/platforms/mesa/server/display_helpers.h (+0/-1) src/platforms/mesa/server/kms/CMakeLists.txt (+8/-4) src/platforms/mesa/server/kms/display_buffer.cpp (+1/-1) src/platforms/mesa/server/kms/guest_platform.cpp (+0/-5) src/platforms/mesa/server/kms/guest_platform.h (+0/-1) src/platforms/mesa/server/kms/platform.cpp (+0/-5) src/platforms/mesa/server/kms/platform.h (+0/-2) src/platforms/mesa/server/kms/platform_symbols.cpp (+14/-0) src/platforms/mesa/server/kms/real_kms_display_configuration.cpp (+8/-9) src/platforms/mesa/server/kms/real_kms_display_configuration.h (+2/-1) src/platforms/mesa/server/kms/real_kms_output.cpp (+47/-159) src/platforms/mesa/server/kms/real_kms_output.h (+3/-3) src/platforms/mesa/server/kms/symbols.map.in (+0/-6) src/platforms/mesa/server/x11/CMakeLists.txt (+1/-1) src/platforms/mesa/server/x11/graphics/CMakeLists.txt (+2/-2) src/platforms/mesa/server/x11/graphics/display.cpp (+42/-7) src/platforms/mesa/server/x11/graphics/display.h (+13/-2) src/platforms/mesa/server/x11/graphics/display_buffer.cpp (+8/-1) src/platforms/mesa/server/x11/graphics/display_configuration.cpp (+2/-3) src/platforms/mesa/server/x11/graphics/display_configuration.h (+4/-1) src/platforms/mesa/server/x11/graphics/guest_platform.cpp (+0/-5) src/platforms/mesa/server/x11/graphics/guest_platform.h (+0/-1) src/platforms/mesa/server/x11/graphics/platform.cpp (+2/-7) src/platforms/mesa/server/x11/graphics/platform.h (+0/-1) src/platforms/mesa/server/x11/input/input_device.cpp (+12/-12) src/platforms/mesa/server/x11/input/input_platform.cpp (+7/-1) src/protobuf/mir_protobuf.proto (+2/-0) src/renderers/gl/program_family.cpp (+2/-1) src/renderers/gl/program_family.h (+1/-1) src/renderers/gl/renderer.cpp (+10/-5) src/renderers/gl/renderer.h (+1/-1) src/server/CMakeLists.txt (+3/-4) src/server/compositor/buffer_map.cpp (+12/-7) src/server/compositor/buffer_map.h (+0/-3) src/server/compositor/buffer_stream_factory.cpp (+10/-4) src/server/compositor/buffer_stream_factory.h (+4/-2) src/server/compositor/buffer_stream_surfaces.cpp (+6/-13) src/server/compositor/buffer_stream_surfaces.h (+2/-3) src/server/compositor/screencast_display_buffer.h (+2/-1) src/server/compositor/stream.cpp (+16/-26) src/server/compositor/stream.h (+5/-5) src/server/default_server_configuration.cpp (+7/-2) src/server/display_server.cpp (+5/-1) src/server/frontend/event_sender.cpp (+11/-0) src/server/frontend/event_sender.h (+1/-0) src/server/frontend/session_mediator.cpp (+29/-18) src/server/graphics/CMakeLists.txt (+1/-2) src/server/graphics/default_configuration.cpp (+3/-15) src/server/graphics/nested/CMakeLists.txt (+1/-0) src/server/graphics/nested/display.cpp (+12/-13) src/server/graphics/nested/display.h (+2/-11) src/server/graphics/nested/display_buffer.cpp (+7/-41) src/server/graphics/nested/display_buffer.h (+4/-9) src/server/graphics/nested/host_connection.h (+8/-0) src/server/graphics/nested/input_platform.cpp (+325/-0) src/server/graphics/nested/input_platform.h (+75/-0) src/server/graphics/nested/mir_client_host_connection.cpp (+69/-169) src/server/graphics/nested/mir_client_host_connection.h (+29/-18) src/server/graphics/offscreen/CMakeLists.txt (+0/-12) src/server/graphics/offscreen/display.cpp (+0/-197) src/server/graphics/offscreen/display.h (+0/-115) src/server/graphics/offscreen/display_buffer.cpp (+0/-173) src/server/graphics/offscreen/display_buffer.h (+0/-91) src/server/graphics/offscreen/display_configuration.cpp (+0/-84) src/server/graphics/offscreen/display_configuration.h (+0/-51) src/server/graphics/surfaceless_egl_context.cpp (+5/-1) src/server/input/android/input_sender.cpp (+28/-19) src/server/input/basic_seat.cpp (+34/-2) src/server/input/basic_seat.h (+14/-1) src/server/input/default_configuration.cpp (+45/-44) src/server/input/default_device.cpp (+25/-2) src/server/input/default_device.h (+7/-1) src/server/input/default_event_builder.cpp (+11/-2) src/server/input/default_event_builder.h (+6/-1) src/server/input/default_input_device_hub.cpp (+30/-5) src/server/input/default_input_device_hub.h (+9/-2) src/server/input/seat_input_device_tracker.cpp (+126/-62) src/server/input/seat_input_device_tracker.h (+25/-6) src/server/input/surface_input_dispatcher.cpp (+3/-74) src/server/input/surface_input_dispatcher.h (+1/-14) src/server/report/logging/display_report.cpp (+3/-3) src/server/scene/CMakeLists.txt (+1/-0) src/server/scene/application_not_responding_detector_wrapper.cpp (+54/-0) src/server/scene/application_session.cpp (+30/-6) src/server/scene/application_session.h (+8/-1) src/server/scene/basic_surface.cpp (+14/-1) src/server/scene/basic_surface.h (+6/-0) src/server/scene/default_configuration.cpp (+12/-3) src/server/scene/gl_pixel_buffer.cpp (+2/-2) src/server/scene/gl_pixel_buffer.h (+1/-1) src/server/scene/global_event_sender.cpp (+4/-0) src/server/scene/global_event_sender.h (+1/-1) src/server/scene/session_manager.cpp (+6/-3) src/server/scene/session_manager.h (+4/-1) src/server/scene/surface_allocator.cpp (+2/-0) src/server/server.cpp (+74/-4) src/server/shell/abstract_shell.cpp (+24/-1) src/server/shell/canonical_window_manager.cpp (+20/-3) src/server/shell/default_configuration.cpp (+3/-2) src/server/symbols.map (+21/-3) src/utils/CMakeLists.txt (+4/-0) src/utils/run.cpp (+1/-0) src/utils/vanity.c (+807/-0) tests/CMakeLists.txt (+4/-0) tests/acceptance-tests/CMakeLists.txt (+3/-0) tests/acceptance-tests/server_configuration_options.cpp (+1/-1) tests/acceptance-tests/server_configuration_wrapping.cpp (+13/-0) tests/acceptance-tests/server_stop_callback.cpp (+63/-0) tests/acceptance-tests/test_application_not_responding_detection.cpp (+79/-0) tests/acceptance-tests/test_buffer_stream_arrangement.cpp (+72/-11) tests/acceptance-tests/test_client_input.cpp (+7/-5) tests/acceptance-tests/test_client_library.cpp (+18/-0) tests/acceptance-tests/test_client_surface_events.cpp (+132/-1) tests/acceptance-tests/test_client_surface_visibility.cpp (+20/-8) tests/acceptance-tests/test_confined_pointer.cpp (+214/-0) tests/acceptance-tests/test_latency.cpp (+4/-6) tests/acceptance-tests/test_nested_input.cpp (+83/-11) tests/acceptance-tests/test_nested_mir.cpp (+238/-34) tests/acceptance-tests/test_persistent_surface_store.cpp (+84/-0) tests/acceptance-tests/test_server_shutdown.cpp (+3/-5) tests/acceptance-tests/test_surface_modifications.cpp (+8/-8) tests/acceptance-tests/test_surface_placement.cpp (+3/-2) tests/acceptance-tests/test_surface_specification.cpp (+7/-7) tests/acceptance-tests/test_system_compositor_window_manager.cpp (+69/-13) tests/acceptance-tests/throwback/test_presentation_chain.cpp (+80/-17) tests/include/mir/test/doubles/mock_buffer_stream.h (+2/-3) tests/include/mir/test/doubles/mock_client_context.h (+1/-0) tests/include/mir/test/doubles/mock_drm.h (+8/-0) tests/include/mir/test/doubles/mock_event_sink.h (+1/-1) tests/include/mir/test/doubles/mock_gl.h (+1/-0) tests/include/mir/test/doubles/mock_input_seat.h (+8/-0) tests/include/mir/test/doubles/mock_input_sink.h (+2/-0) tests/include/mir/test/doubles/mock_key_mapper.h (+51/-0) tests/include/mir/test/doubles/mock_mir_buffer.h (+68/-0) tests/include/mir/test/doubles/mock_scene_session.h (+4/-0) tests/include/mir/test/doubles/mock_surface.h (+1/-0) tests/include/mir/test/doubles/mock_x11.h (+4/-0) tests/include/mir/test/doubles/null_event_sink.h (+1/-0) tests/include/mir/test/doubles/stub_buffer_stream.h (+2/-3) tests/include/mir/test/doubles/stub_buffer_stream_factory.h (+31/-2) tests/include/mir/test/doubles/stub_gbm_native_buffer.h (+1/-1) tests/include/mir/test/doubles/stub_host_connection.h (+19/-0) tests/include/mir/test/doubles/stub_scene_surface.h (+3/-0) tests/include/mir/test/doubles/stub_session.h (+14/-0) tests/integration-tests/CMakeLists.txt (+2/-2) tests/integration-tests/graphics/mesa/CMakeLists.txt (+2/-2) tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-0) tests/integration-tests/input/test_single_seat_setup.cpp (+18/-9) tests/integration-tests/session_management.cpp (+26/-14) tests/integration-tests/surface_composition.cpp (+1/-0) tests/integration-tests/test_buffer_scheduling.cpp (+10/-11) tests/integration-tests/test_exchange_buffer.cpp (+4/-2) tests/integration-tests/test_session.cpp (+3/-2) tests/integration-tests/test_surface_stack_with_compositor.cpp (+1/-0) tests/integration-tests/test_swapinterval.cpp (+7/-2) tests/integration-tests/test_test_framework.cpp (+16/-9) tests/mir_test/CMakeLists.txt (+4/-0) tests/mir_test_doubles/CMakeLists.txt (+7/-3) tests/mir_test_doubles/mock_drm.cpp (+40/-0) tests/mir_test_doubles/mock_egl.cpp (+5/-5) tests/mir_test_doubles/mock_event_sink_factory.cpp (+7/-0) tests/mir_test_doubles/mock_gl.cpp (+8/-1) tests/mir_test_doubles/mock_x11.cpp (+23/-0) tests/mir_test_framework/CMakeLists.txt (+9/-4) tests/mir_test_framework/async_server_runner.cpp (+1/-1) tests/mir_test_framework/executable_path.cpp (+15/-1) tests/mir_test_framework/fake_input_device_impl.cpp (+8/-8) tests/mir_test_framework/platform_graphics_dummy.cpp (+8/-4) tests/mir_test_framework/platform_graphics_throw.cpp (+1/-12) tests/mir_test_framework/stub_client_platform_module.cpp (+5/-1) tests/mir_test_framework/stub_session.cpp (+15/-0) tests/mir_test_framework/stub_surface.cpp (+10/-0) tests/mir_test_framework/stubbed_graphics_platform.cpp (+9/-16) tests/mirtest.pc.in (+1/-1) tests/performance-tests/CMakeLists.txt (+19/-0) tests/performance-tests/performance_tests.sh (+3/-1) tests/performance-tests/test_client_startup.cpp (+115/-0) tests/performance-tests/test_compositor.cpp (+222/-0) tests/unit-tests/CMakeLists.txt (+14/-3) tests/unit-tests/client/CMakeLists.txt (+1/-0) tests/unit-tests/client/android/test_android_native_window.cpp (+27/-28) tests/unit-tests/client/input/test_xkb_mapper.cpp (+297/-38) tests/unit-tests/client/mesa/CMakeLists.txt (+1/-1) tests/unit-tests/client/mesa/test_client_platform.cpp (+4/-0) tests/unit-tests/client/test_buffer_vault.cpp (+8/-29) tests/unit-tests/client/test_client_mir_surface.cpp (+48/-0) tests/unit-tests/client/test_client_platform.cpp (+84/-32) tests/unit-tests/client/test_connection_resource_map.cpp (+7/-10) tests/unit-tests/client/test_error_buffer.cpp (+77/-0) tests/unit-tests/client/test_mir_buffer.cpp (+19/-1) tests/unit-tests/client/test_mir_connection.cpp (+10/-79) tests/unit-tests/client/test_presentation_chain.cpp (+17/-205) tests/unit-tests/client/test_probing_client_platform_factory.cpp (+194/-65) tests/unit-tests/client/test_protobuf_rpc_channel.cpp (+19/-15) tests/unit-tests/compositor/test_buffer_stream.cpp (+0/-12) tests/unit-tests/compositor/test_client_buffers.cpp (+14/-3) tests/unit-tests/compositor/test_stream.cpp (+18/-9) tests/unit-tests/frontend/test_event_sender.cpp (+42/-0) tests/unit-tests/frontend/test_session_mediator.cpp (+29/-14) tests/unit-tests/graphics/CMakeLists.txt (+1/-1) tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/android/test_anw_logger.cpp (+107/-0) tests/unit-tests/graphics/android/test_device_detection.cpp (+37/-9) tests/unit-tests/graphics/android/test_display.cpp (+34/-1) tests/unit-tests/graphics/android/test_display_buffer.cpp (+3/-1) tests/unit-tests/graphics/android/test_display_generic.cpp (+7/-6) tests/unit-tests/graphics/android/test_display_hotplug.cpp (+2/-0) tests/unit-tests/graphics/android/test_hwc_layers.cpp (+2/-2) tests/unit-tests/graphics/android/test_platform.cpp (+10/-16) tests/unit-tests/graphics/android/test_server_interpreter.cpp (+6/-2) tests/unit-tests/graphics/kms-utils/CMakeLists.txt (+6/-0) tests/unit-tests/graphics/kms-utils/test_connector_utils.cpp (+216/-0) tests/unit-tests/graphics/kms-utils/test_drm_mode_resources.cpp (+206/-0) tests/unit-tests/graphics/mesa/CMakeLists.txt (+13/-3) tests/unit-tests/graphics/mesa/common/CMakeLists.txt (+0/-15) tests/unit-tests/graphics/mesa/kms/CMakeLists.txt (+1/-1) tests/unit-tests/graphics/mesa/kms/test_buffer_allocator.cpp (+1/-1) tests/unit-tests/graphics/mesa/kms/test_display.cpp (+3/-1) tests/unit-tests/graphics/mesa/kms/test_display_configuration.cpp (+1/-0) tests/unit-tests/graphics/mesa/kms/test_gbm_buffer.cpp (+2/-2) tests/unit-tests/graphics/mesa/kms/test_platform.cpp (+47/-8) tests/unit-tests/graphics/mesa/kms/test_real_kms_output.cpp (+50/-0) tests/unit-tests/graphics/mesa/test_drm_helper.cpp (+1/-1) tests/unit-tests/graphics/mesa/test_ipc_operations.cpp (+2/-2) tests/unit-tests/graphics/mesa/x11/test_display.cpp (+90/-3) tests/unit-tests/graphics/nested/test_nested_display.cpp (+1/-2) tests/unit-tests/graphics/offscreen/CMakeLists.txt (+0/-6) tests/unit-tests/graphics/offscreen/test_offscreen_display.cpp (+0/-175) tests/unit-tests/graphics/test_platform_prober.cpp (+15/-7) tests/unit-tests/input/CMakeLists.txt (+1/-0) tests/unit-tests/input/android/test_android_input_sender.cpp (+48/-5) tests/unit-tests/input/android/test_input_consumer.cpp (+120/-13) tests/unit-tests/input/evdev/test_libinput_device.cpp (+10/-1) tests/unit-tests/input/test_default_device.cpp (+30/-6) tests/unit-tests/input/test_default_input_device_hub.cpp (+3/-1) tests/unit-tests/input/test_event_builders.cpp (+97/-1) tests/unit-tests/input/test_key_repeat_dispatcher.cpp (+3/-0) tests/unit-tests/input/test_nested_input_platform.cpp (+182/-0) tests/unit-tests/input/test_seat_input_device_tracker.cpp (+75/-69) tests/unit-tests/input/test_surface_input_dispatcher.cpp (+0/-91) tests/unit-tests/input/test_x11_platform.cpp (+3/-1) tests/unit-tests/scene/test_abstract_shell.cpp (+31/-2) tests/unit-tests/scene/test_application_session.cpp (+24/-13) tests/unit-tests/scene/test_basic_surface.cpp (+8/-2) tests/unit-tests/scene/test_session_manager.cpp (+11/-3) tests/unit-tests/scene/test_surface.cpp (+4/-1) tests/unit-tests/scene/test_surface_impl.cpp (+3/-1) tests/unit-tests/scene/test_surface_stack.cpp (+14/-0) tests/unit-tests/test_fatal.cpp (+2/-0) tools/valgrind_suppressions_libhybris (+0/-10) |
To merge this branch: | bzr merge lp:mir/0.24 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Daniel van Vugt | Approve | ||
Alexandros Frantzis (community) | Abstain | ||
Review via email: mp+300589@code.launchpad.net |
Commit message
Mir 0.24.0 release.
Description of the change
Mir 0.24 release. (branched at rev 3602)
Note 1: This is the second time branching from trunk, so that bugfixes could be picked up. The first branch that was being used is now at lp:~mir-team/mir/0.24-before-rebranch, if anyone's still interested in that.
Note 2: There's a mir 0.23.4 release in flight that needs to land before this one.
Mir CI Bot (mir-ci-bot) wrote : | # |
- 3608. By Kevin DuBois
-
pick up the 0.23.4 changelog entry. we already have patch for that change in this branch
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3608
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 3609. By Daniel van Vugt
-
debian/changelog: Correct grammar of new entries
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3609
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
Network unreachable on one of the hosts. Try again.
- 3610. By Daniel van Vugt
-
Try again.
- 3611. By Daniel van Vugt
-
debian/changelog: Correction; NBS is not enabled by default
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3610
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3611
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
@Daniel, thanks for noticing. This release should have nbs on by default, it being off was a result of a mis-merge with lp:mir/ubuntu in rev 3603
- 3612. By Kevin DuBois
-
enable nbs and correct changelog to reflect NBS being enabled
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3612
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 3613. By Kevin DuBois
-
merge in lp:mir/ubuntu again for 0.23.4 changes, fix 1 conflict
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3613
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
Alright, built in silo 36.
I've started testing on some devices, so please don't upload new changes without coordination and rebuilding of the silo. Tracking testing using a google doc: https:/
Kevin DuBois (kdub) wrote : | # |
Actually, probably need this link to edit: https:/
Daniel van Vugt (vanvugt) wrote : | # |
The changelog is wrong. We bumped to 10:
. mirplatformgraphics ABI unchanged at 9
Alexandros Frantzis (afrantzis) wrote : | # |
Also:
7870 +set(MIR_
Should be 0.24.
We reverted from 0.25 to 0.24 in https:/
- 3614. By Kevin DuBois
-
update changelog
- 3615. By Kevin DuBois
-
change variable in CMakeLists.txt to be 0.24
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3615
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alexandros Frantzis (afrantzis) wrote : | # |
Haven't performed a thorough review, but my previous concern has been addressed.
Kevin DuBois (kdub) wrote : | # |
the 0.24 release is currently blocked on two fronts:
1) 0.23.5 should be released first
2) the usc/repowerd revert fallout needs to be addressed in order to release the USC compatibility branch that 0.24 needs (this generated the need for 1)
Daniel van Vugt (vanvugt) wrote : | # |
I'd say 0.23.5 should not be released at all. It's poor discipline and project management to enable major new features in a stable point release...
https:/
Daniel van Vugt (vanvugt) wrote : | # |
Let's do this. Incidentally, it's been two months since release 0.23.0.
- 3616. By Daniel van Vugt
-
Merge latest lp:mir/ubuntu and fix conflicts (which results in
zero diff)
Daniel van Vugt (vanvugt) wrote : | # |
It might also be a good idea to pull in the updated debian/changelog I put in lp:mir/0.23 today.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3616
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 3617. By Kevin DuBois
-
pull in changelog retrospective changelog modifications present in lp:mir/0.23
Kevin DuBois (kdub) wrote : | # |
sure, don't mind pulling those in
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3617
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3618
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
In addition to being blocked by the repowerd un-revert (silo0), mir and USC are now both blocked by an issue with gmock (lp: #1609793). So, in order to land this:
1) gmock patch has to be accepted
2) the no-change-rebuild that boost generated on us has to produce binaries and move to main.
3) usc in silo0 has to land to recorrect the situation there
4) this silo can land.
- 3619. By Kevin DuBois
-
pick up changelog from no-change rebuild
- 3620. By Kevin DuBois
-
port over fix for gcc6 from trunk mir rev 3626
- 3621. By Kevin DuBois
-
port over fix for LP: #1610215
- 3622. By Kevin DuBois
-
note bug fixes to build in changelog
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3619
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3622
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 3623. By Kevin DuBois
-
port fix for lp: #1612256 to 0.24 series
- 3624. By Kevin DuBois
-
note fix in changelog
Kevin DuBois (kdub) wrote : | # |
built with known fixes (encountered some general chaos in yakkety)... please don't push to branch without ensuring the whole silo rebuilds.
Preview Diff
1 | === added file '.bzrignore' |
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 |
3 | +++ .bzrignore 2016-08-12 14:07:23 +0000 |
4 | @@ -0,0 +1,2 @@ |
5 | +.idea |
6 | +include/server/mir/version.h |
7 | |
8 | === modified file '3rd_party/android-deps/android/input.h' |
9 | --- 3rd_party/android-deps/android/input.h 2013-09-20 11:55:05 +0000 |
10 | +++ 3rd_party/android-deps/android/input.h 2016-08-12 14:07:23 +0000 |
11 | @@ -141,7 +141,10 @@ |
12 | AINPUT_EVENT_TYPE_KEY = 1, |
13 | |
14 | /* Indicates that the input event is a motion event. */ |
15 | - AINPUT_EVENT_TYPE_MOTION = 2 |
16 | + AINPUT_EVENT_TYPE_MOTION = 2, |
17 | + |
18 | + /* Indicates that the event contains a raw buffer. */ |
19 | + AINPUT_EVENT_TYPE_BUFFER = 3 |
20 | }; |
21 | |
22 | /* |
23 | |
24 | === modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h' |
25 | --- 3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h 2016-03-23 06:39:56 +0000 |
26 | +++ 3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h 2016-08-12 14:07:23 +0000 |
27 | @@ -571,6 +571,13 @@ |
28 | Vector<PointerCoords> mSamplePointerCoords; |
29 | }; |
30 | |
31 | +struct RawBufferEvent : public InputEvent { |
32 | + |
33 | + virtual int32_t getType() const { return AINPUT_EVENT_TYPE_BUFFER; } |
34 | + virtual ~RawBufferEvent() { } |
35 | + std::string buffer; |
36 | +}; |
37 | + |
38 | /* |
39 | * Input event factory. |
40 | */ |
41 | @@ -583,6 +590,7 @@ |
42 | |
43 | virtual KeyEvent* createKeyEvent() = 0; |
44 | virtual MotionEvent* createMotionEvent() = 0; |
45 | + virtual RawBufferEvent* createRawBufferEvent() = 0; |
46 | }; |
47 | |
48 | /* |
49 | @@ -596,10 +604,12 @@ |
50 | |
51 | virtual KeyEvent* createKeyEvent() { return & mKeyEvent; } |
52 | virtual MotionEvent* createMotionEvent() { return & mMotionEvent; } |
53 | + virtual RawBufferEvent* createRawBufferEvent() { return &mRawEvent; } |
54 | |
55 | private: |
56 | KeyEvent mKeyEvent; |
57 | MotionEvent mMotionEvent; |
58 | + RawBufferEvent mRawEvent; |
59 | }; |
60 | |
61 | /* |
62 | @@ -612,6 +622,7 @@ |
63 | |
64 | virtual KeyEvent* createKeyEvent(); |
65 | virtual MotionEvent* createMotionEvent(); |
66 | + virtual RawBufferEvent* createRawBufferEvent(); |
67 | |
68 | void recycle(InputEvent* event); |
69 | |
70 | @@ -620,6 +631,7 @@ |
71 | |
72 | Vector<KeyEvent*> mKeyEventPool; |
73 | Vector<MotionEvent*> mMotionEventPool; |
74 | + Vector<RawBufferEvent*> mRawBufferEventPool; |
75 | }; |
76 | |
77 | } // namespace android |
78 | |
79 | === modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h' |
80 | --- 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h 2016-04-11 16:56:16 +0000 |
81 | +++ 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h 2016-08-12 14:07:23 +0000 |
82 | @@ -46,21 +46,26 @@ |
83 | */ |
84 | struct InputMessage { |
85 | InputMessage(); |
86 | + InputMessage(uint32_t seq, std::string const& buffer); |
87 | + InputMessage(InputMessage const& cp); |
88 | + InputMessage& operator=(InputMessage const& cp); |
89 | |
90 | enum { |
91 | TYPE_KEY = 1, |
92 | TYPE_MOTION = 2, |
93 | - TYPE_FINISHED = 3 |
94 | + TYPE_FINISHED = 3, |
95 | + TYPE_BUFFER = 4 |
96 | }; |
97 | |
98 | struct Header { |
99 | uint32_t type; |
100 | - uint32_t padding; // 8 byte alignment for the body that follows |
101 | + uint32_t seq; |
102 | + uint32_t size; // size of the Body |
103 | + uint32_t padding; // padding for 8byte tokens in Body |
104 | } header; |
105 | |
106 | union Body { |
107 | struct Key { |
108 | - uint32_t seq; |
109 | int64_t eventTime; |
110 | mir::cookie::Blob cookieBlob; |
111 | int32_t deviceId; |
112 | @@ -79,7 +84,6 @@ |
113 | } key; |
114 | |
115 | struct Motion { |
116 | - uint32_t seq; |
117 | int64_t eventTime; |
118 | mir::cookie::Blob cookieBlob; |
119 | int32_t deviceId; |
120 | @@ -113,17 +117,22 @@ |
121 | } motion; |
122 | |
123 | struct Finished { |
124 | - uint32_t seq; |
125 | bool handled; |
126 | |
127 | inline size_t size() const { |
128 | return sizeof(Finished); |
129 | } |
130 | } finished; |
131 | + |
132 | + struct Buffer { |
133 | + uint8_t buffer[sizeof(Motion)]; |
134 | + } buffer; |
135 | } body; |
136 | |
137 | bool isValid(size_t actualSize) const; |
138 | size_t size() const; |
139 | + |
140 | + static const size_t raw_event_payload = sizeof(body.buffer); |
141 | }; |
142 | |
143 | /* |
144 | @@ -188,6 +197,8 @@ |
145 | /* Gets the underlying input channel. */ |
146 | inline sp<InputChannel> getChannel() { return mChannel; } |
147 | |
148 | + status_t publishEventBuffer(uint32_t seq, std::string const& buffer); |
149 | + |
150 | /* Publishes a key event to the input channel. |
151 | * |
152 | * Returns OK on success. |
153 | @@ -430,6 +441,7 @@ |
154 | |
155 | static void initializeKeyEvent(KeyEvent* event, const InputMessage* msg); |
156 | static void initializeMotionEvent(MotionEvent* event, const InputMessage* msg); |
157 | + static void initializeBufferEvent(RawBufferEvent* event, const InputMessage* msg); |
158 | static void addSample(MotionEvent* event, const InputMessage* msg); |
159 | static bool canAddSample(const Batch& batch, const InputMessage* msg); |
160 | static ssize_t findSampleNoLaterThan(const Batch& batch, std::chrono::nanoseconds time); |
161 | |
162 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/Input.cpp' |
163 | --- 3rd_party/android-input/android/frameworks/base/services/input/Input.cpp 2016-03-23 06:39:56 +0000 |
164 | +++ 3rd_party/android-input/android/frameworks/base/services/input/Input.cpp 2016-08-12 14:07:23 +0000 |
165 | @@ -612,6 +612,9 @@ |
166 | for (size_t i = 0; i < mMotionEventPool.size(); i++) { |
167 | delete mMotionEventPool.itemAt(i); |
168 | } |
169 | + for (size_t i = 0; i < mRawBufferEventPool.size(); i++) { |
170 | + delete mRawBufferEventPool.itemAt(i); |
171 | + } |
172 | } |
173 | |
174 | KeyEvent* PooledInputEventFactory::createKeyEvent() { |
175 | @@ -632,8 +635,23 @@ |
176 | return new MotionEvent(); |
177 | } |
178 | |
179 | +RawBufferEvent* PooledInputEventFactory::createRawBufferEvent() { |
180 | + if (!mRawBufferEventPool.isEmpty()) { |
181 | + RawBufferEvent* event = mRawBufferEventPool.top(); |
182 | + mRawBufferEventPool.pop(); |
183 | + return event; |
184 | + } |
185 | + return new RawBufferEvent(); |
186 | +} |
187 | + |
188 | void PooledInputEventFactory::recycle(InputEvent* event) { |
189 | switch (event->getType()) { |
190 | + case AINPUT_EVENT_TYPE_BUFFER: |
191 | + if (mRawBufferEventPool.size() < mMaxPoolSize) { |
192 | + mRawBufferEventPool.push(static_cast<RawBufferEvent*>(event)); |
193 | + return; |
194 | + } |
195 | + break; |
196 | case AINPUT_EVENT_TYPE_KEY: |
197 | if (mKeyEventPool.size() < mMaxPoolSize) { |
198 | mKeyEventPool.push(static_cast<KeyEvent*>(event)); |
199 | |
200 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp' |
201 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2016-04-11 16:56:16 +0000 |
202 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2016-08-12 14:07:23 +0000 |
203 | @@ -29,6 +29,9 @@ |
204 | #include <sys/socket.h> |
205 | #include <math.h> |
206 | |
207 | +#include <boost/throw_exception.hpp> |
208 | +#include <stdexcept> |
209 | + |
210 | |
211 | namespace android { |
212 | |
213 | @@ -62,16 +65,32 @@ |
214 | memset(this, 0, sizeof(InputMessage)); |
215 | } |
216 | |
217 | +InputMessage::InputMessage(uint32_t seq, std::string const& buffer) |
218 | +{ |
219 | + memset(this, 0, sizeof(InputMessage)); |
220 | + header.type = TYPE_BUFFER; |
221 | + header.seq = seq; |
222 | + header.size = buffer.size(); |
223 | + |
224 | + if (raw_event_payload < buffer.size()) |
225 | + BOOST_THROW_EXCEPTION(std::runtime_error("raw buffer event exceeds payload")); |
226 | + memcpy(body.buffer.buffer, buffer.data(), header.size); |
227 | +} |
228 | + |
229 | +InputMessage::InputMessage(InputMessage const& cp) = default; |
230 | + |
231 | +InputMessage& InputMessage::operator=(InputMessage const& cp) = default; |
232 | + |
233 | bool InputMessage::isValid(size_t actualSize) const { |
234 | if (size() == actualSize) { |
235 | switch (header.type) { |
236 | + case TYPE_FINISHED: |
237 | + case TYPE_BUFFER: |
238 | case TYPE_KEY: |
239 | return true; |
240 | case TYPE_MOTION: |
241 | return body.motion.pointerCount > 0 |
242 | && body.motion.pointerCount <= MAX_POINTERS; |
243 | - case TYPE_FINISHED: |
244 | - return true; |
245 | } |
246 | } |
247 | return false; |
248 | @@ -85,11 +104,11 @@ |
249 | return sizeof(Header) + body.motion.size(); |
250 | case TYPE_FINISHED: |
251 | return sizeof(Header) + body.finished.size(); |
252 | + case TYPE_BUFFER: |
253 | + return sizeof(Header) + header.size; |
254 | } |
255 | return sizeof(Header); |
256 | } |
257 | - |
258 | - |
259 | // --- InputChannel --- |
260 | |
261 | InputChannel::InputChannel(const String8& name, int fd) : |
262 | @@ -197,6 +216,20 @@ |
263 | InputPublisher::~InputPublisher() { |
264 | } |
265 | |
266 | +status_t InputPublisher::publishEventBuffer(uint32_t seq, std::string const& buffer) { |
267 | +#if DEBUG_TRANSPORT_ACTIONS |
268 | + ALOGD("channel '%s' publisher ~ publishInputBuffer: seq=%u", c_str(mChannel->getName()), seq); |
269 | +#endif |
270 | + |
271 | + if (!seq) { |
272 | + ALOGE("Attempted to publish a buffer with sequence number 0."); |
273 | + return BAD_VALUE; |
274 | + } |
275 | + |
276 | + InputMessage msg(seq, buffer); |
277 | + return mChannel->sendMessage(&msg); |
278 | +} |
279 | + |
280 | status_t InputPublisher::publishKeyEvent( |
281 | uint32_t seq, |
282 | int32_t deviceId, |
283 | @@ -226,7 +259,8 @@ |
284 | |
285 | InputMessage msg; |
286 | msg.header.type = InputMessage::TYPE_KEY; |
287 | - msg.body.key.seq = seq; |
288 | + msg.header.seq = seq; |
289 | + msg.header.size = sizeof(msg.body.key); |
290 | msg.body.key.deviceId = deviceId; |
291 | msg.body.key.source = source; |
292 | msg.body.key.action = action; |
293 | @@ -284,7 +318,7 @@ |
294 | |
295 | InputMessage msg; |
296 | msg.header.type = InputMessage::TYPE_MOTION; |
297 | - msg.body.motion.seq = seq; |
298 | + msg.header.seq = seq; |
299 | msg.body.motion.deviceId = deviceId; |
300 | msg.body.motion.source = source; |
301 | msg.body.motion.action = action; |
302 | @@ -304,6 +338,8 @@ |
303 | msg.body.motion.pointers[i].properties.copyFrom(pointerProperties[i]); |
304 | msg.body.motion.pointers[i].coords.copyFrom(pointerCoords[i]); |
305 | } |
306 | + |
307 | + msg.header.size = msg.body.motion.size(); |
308 | return mChannel->sendMessage(&msg); |
309 | } |
310 | |
311 | @@ -325,7 +361,7 @@ |
312 | c_str(mChannel->getName()), msg.header.type); |
313 | return UNKNOWN_ERROR; |
314 | } |
315 | - *outSeq = msg.body.finished.seq; |
316 | + *outSeq = msg.header.seq; |
317 | *outHandled = msg.body.finished.handled; |
318 | return OK; |
319 | } |
320 | @@ -392,12 +428,25 @@ |
321 | } |
322 | |
323 | switch (mMsg.header.type) { |
324 | + case InputMessage::TYPE_BUFFER: { |
325 | + RawBufferEvent* bufferEvent = factory->createRawBufferEvent(); |
326 | + if (!bufferEvent) return NO_MEMORY; |
327 | + |
328 | + initializeBufferEvent(bufferEvent, &mMsg); |
329 | + *outSeq = mMsg.header.seq; |
330 | + *outEvent = bufferEvent; |
331 | +#if DEBUG_TRANSPORT_ACTIONS |
332 | + ALOGD("channel '%s' consumer ~ consumed buffer event, seq=%u", |
333 | + c_str(mChannel->getName()), *outSeq); |
334 | +#endif |
335 | + break; |
336 | + } |
337 | case InputMessage::TYPE_KEY: { |
338 | KeyEvent* keyEvent = factory->createKeyEvent(); |
339 | if (!keyEvent) return NO_MEMORY; |
340 | |
341 | initializeKeyEvent(keyEvent, &mMsg); |
342 | - *outSeq = mMsg.body.key.seq; |
343 | + *outSeq = mMsg.header.seq; |
344 | *outEvent = keyEvent; |
345 | #if DEBUG_TRANSPORT_ACTIONS |
346 | ALOGD("channel '%s' consumer ~ consumed key event, seq=%u", |
347 | @@ -455,7 +504,7 @@ |
348 | |
349 | updateTouchState(&mMsg); |
350 | initializeMotionEvent(motionEvent, &mMsg); |
351 | - *outSeq = mMsg.body.motion.seq; |
352 | + *outSeq = mMsg.header.seq; |
353 | *outEvent = motionEvent; |
354 | #if DEBUG_TRANSPORT_ACTIONS |
355 | ALOGD("channel '%s' consumer ~ consumed motion event, seq=%u", |
356 | @@ -519,14 +568,14 @@ |
357 | updateTouchState(&msg); |
358 | if (i) { |
359 | SeqChain seqChain; |
360 | - seqChain.seq = msg.body.motion.seq; |
361 | + seqChain.seq = msg.header.seq; |
362 | seqChain.chain = chain; |
363 | mSeqChains.push(seqChain); |
364 | addSample(motionEvent, &msg); |
365 | } else { |
366 | initializeMotionEvent(motionEvent, &msg); |
367 | } |
368 | - chain = msg.body.motion.seq; |
369 | + chain = msg.header.seq; |
370 | } |
371 | batch.samples.removeItemsAt(0, count); |
372 | |
373 | @@ -721,6 +770,7 @@ |
374 | // Resample touch coordinates. |
375 | touchState.lastResample.eventTime = sampleTime; |
376 | touchState.lastResample.ids.clear(); |
377 | + bool coords_resampled = false; |
378 | for (size_t i = 0; i < pointerCount; i++) { |
379 | uint32_t id = event->getPointerId(i); |
380 | touchState.lastResample.idToIndex[id] = i; |
381 | @@ -735,6 +785,9 @@ |
382 | lerp(currentCoords.getX(), otherCoords.getX(), alpha)); |
383 | resampledCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, |
384 | lerp(currentCoords.getY(), otherCoords.getY(), alpha)); |
385 | + coords_resampled = true; |
386 | + // No coordinate resampling for tooltype mouse - if we intend to |
387 | + // change that we must also resample RX, RY, HSCROLL, VSCROLL |
388 | #if DEBUG_RESAMPLING |
389 | ALOGD("[%d] - out (%0.3f, %0.3f), cur (%0.3f, %0.3f), " |
390 | "other (%0.3f, %0.3f), alpha %0.3f", |
391 | @@ -744,6 +797,8 @@ |
392 | alpha); |
393 | #endif |
394 | } else { |
395 | + // Before calling this method currentCoords was already part of the |
396 | + // event -> no need to add them to the event. |
397 | resampledCoords.copyFrom(currentCoords); |
398 | #if DEBUG_RESAMPLING |
399 | ALOGD("[%d] - out (%0.3f, %0.3f), cur (%0.3f, %0.3f)", |
400 | @@ -753,7 +808,8 @@ |
401 | } |
402 | } |
403 | |
404 | - event->addSample(sampleTime, touchState.lastResample.pointers); |
405 | + if (coords_resampled) |
406 | + event->addSample(sampleTime, touchState.lastResample.pointers); |
407 | } |
408 | |
409 | bool InputConsumer::shouldResampleTool(int32_t toolType) { |
410 | @@ -809,7 +865,8 @@ |
411 | status_t InputConsumer::sendUnchainedFinishedSignal(uint32_t seq, bool handled) { |
412 | InputMessage msg; |
413 | msg.header.type = InputMessage::TYPE_FINISHED; |
414 | - msg.body.finished.seq = seq; |
415 | + msg.header.size = sizeof(msg.body.finished); |
416 | + msg.header.seq = seq; |
417 | msg.body.finished.handled = handled; |
418 | return mChannel->sendMessage(&msg); |
419 | } |
420 | @@ -843,6 +900,10 @@ |
421 | return -1; |
422 | } |
423 | |
424 | +void InputConsumer::initializeBufferEvent(RawBufferEvent* event, const InputMessage* msg) { |
425 | + event->buffer.assign(msg->body.buffer.buffer, msg->body.buffer.buffer + msg->header.size); |
426 | +} |
427 | + |
428 | void InputConsumer::initializeKeyEvent(KeyEvent* event, const InputMessage* msg) { |
429 | event->initialize( |
430 | msg->body.key.deviceId, |
431 | |
432 | === modified file 'CMakeLists.txt' |
433 | --- CMakeLists.txt 2016-08-12 14:07:21 +0000 |
434 | +++ CMakeLists.txt 2016-08-12 14:07:23 +0000 |
435 | @@ -28,8 +28,8 @@ |
436 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) |
437 | |
438 | set(MIR_VERSION_MAJOR 0) |
439 | -set(MIR_VERSION_MINOR 23) |
440 | -set(MIR_VERSION_PATCH 6) |
441 | +set(MIR_VERSION_MINOR 24) |
442 | +set(MIR_VERSION_PATCH 0) |
443 | |
444 | add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR}) |
445 | add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR}) |
446 | @@ -62,6 +62,9 @@ |
447 | |
448 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -g -Werror -Wall -pedantic -Wextra -fPIC") |
449 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -g -std=c++14 -Werror -Wall -fno-strict-aliasing -pedantic -Wnon-virtual-dtor -Wextra -fPIC") |
450 | +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") |
451 | +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed") |
452 | +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") |
453 | |
454 | option(MIR_USE_LD_GOLD "Enables the \"gold\" linker." OFF) |
455 | if(MIR_USE_LD_GOLD) |
456 | @@ -81,8 +84,8 @@ |
457 | |
458 | option(MIR_LINK_TIME_OPTIMIZATION "Enables the linker to optimize binaries." OFF) |
459 | if(MIR_LINK_TIME_OPTIMIZATION) |
460 | - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto") |
461 | - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto") |
462 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto -ffat-lto-objects") |
463 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -ffat-lto-objects") |
464 | if(${CMAKE_COMPILER_IS_GNUCXX}) |
465 | set(CMAKE_NM "gcc-nm") |
466 | set(CMAKE_AR "gcc-ar") |
467 | @@ -163,10 +166,10 @@ |
468 | # Default to KMS backend, but build all of them |
469 | set( |
470 | MIR_PLATFORM |
471 | - mesa-kms;android;mesa-x11 |
472 | + mesa-kms;android;mesa-x11;eglstream-kms |
473 | CACHE |
474 | STRING |
475 | - "a list of graphics backends to build (options are 'mesa-kms', 'android' or 'mesa-x11')" |
476 | + "a list of graphics backends to build (options are 'mesa-kms', 'android', 'mesa-x11', or 'eglstream-kms')" |
477 | ) |
478 | |
479 | list(GET MIR_PLATFORM 0 MIR_TEST_PLATFORM) |
480 | @@ -183,6 +186,9 @@ |
481 | if (platform STREQUAL "mesa-x11") |
482 | set(MIR_BUILD_PLATFORM_MESA_X11 TRUE) |
483 | endif() |
484 | + if (platform STREQUAL "eglstream-kms") |
485 | + set(MIR_BUILD_PLATFORM_EGLSTREAM_KMS TRUE) |
486 | + endif() |
487 | endforeach(platform) |
488 | |
489 | find_package(EGL REQUIRED) |
490 | @@ -199,6 +205,41 @@ |
491 | include_directories (SYSTEM ${EGL_INCLUDE_DIRS}) |
492 | include_directories (SYSTEM ${GLM_INCLUDE_DIRS}) |
493 | |
494 | +# |
495 | +# Full OpenGL support is possibly complete but not yet perfect. So is |
496 | +# presently disabled by default. See the TODOs in: |
497 | +# src/platform/graphics/egl_extensions.cpp: glEGLImageTargetTexture2DOES |
498 | +# src/platforms/common/server/shm_buffer.cpp: glTexImage2D |
499 | +# |
500 | +#if (TARGET_ARCH STREQUAL "x86_64-linux-gnu" OR |
501 | +# TARGET_ARCH STREQUAL "i386-linux-gnu") |
502 | +# set(DEFAULT_LIBGL "libGL") |
503 | +#else() |
504 | + set(DEFAULT_LIBGL "libGLESv2") |
505 | +#endif() |
506 | +set(MIR_SERVER_LIBGL ${DEFAULT_LIBGL} CACHE STRING "OpenGL library to use in Mir servers {libGL,libGLESv2}") |
507 | + |
508 | +if (MIR_SERVER_LIBGL STREQUAL "libGL") |
509 | + pkg_check_modules(GL REQUIRED gl) |
510 | + add_definitions( |
511 | + -DGL_GLEXT_PROTOTYPES |
512 | + -DMIR_SERVER_GL_H=<GL/gl.h> |
513 | + -DMIR_SERVER_GLEXT_H=<GL/glext.h> |
514 | + -DMIR_SERVER_EGL_OPENGL_BIT=EGL_OPENGL_BIT |
515 | + -DMIR_SERVER_EGL_OPENGL_API=EGL_OPENGL_API |
516 | + ) |
517 | +elseif (MIR_SERVER_LIBGL STREQUAL "libGLESv2") |
518 | + pkg_check_modules(GL REQUIRED glesv2) |
519 | + add_definitions( |
520 | + -DMIR_SERVER_GL_H=<GLES2/gl2.h> |
521 | + -DMIR_SERVER_GLEXT_H=<GLES2/gl2ext.h> |
522 | + -DMIR_SERVER_EGL_OPENGL_BIT=EGL_OPENGL_ES2_BIT |
523 | + -DMIR_SERVER_EGL_OPENGL_API=EGL_OPENGL_ES_API |
524 | + ) |
525 | +else() |
526 | + message(FATAL_ERROR "Invalid MIR_SERVER_LIBGL value ${MIR_SERVER_LIBGL}") |
527 | +endif() |
528 | + |
529 | if (MIR_BUILD_PLATFORM_ANDROID) |
530 | find_package(AndroidProperties REQUIRED) |
531 | find_package(LibHardware REQUIRED) |
532 | @@ -210,6 +251,10 @@ |
533 | pkg_check_modules( DRM REQUIRED libdrm ) |
534 | endif() |
535 | |
536 | +if (MIR_BUILD_PLATFORM_EGLSTREAM_KMS) |
537 | + pkg_check_modules(EPOXY REQUIRED epoxy) |
538 | +endif() |
539 | + |
540 | set(MIR_ANDROID_INCLUDE_DIRECTORIES) # to be filled by android-input |
541 | set(MIR_ANDROID_INPUT_COMPILE_FLAGS) # to be filled by android-input |
542 | set(MIR_3RD_PARTY_INCLUDE_DIRECTORIES) |
543 | |
544 | === modified file 'cmake/MirCommon.cmake' |
545 | --- cmake/MirCommon.cmake 2016-07-28 18:42:04 +0000 |
546 | +++ cmake/MirCommon.cmake 2016-08-12 14:07:23 +0000 |
547 | @@ -118,10 +118,10 @@ |
548 | list_to_string("${test_cmd_no_memcheck}" "" discover_cmd_no_memcheck) |
549 | |
550 | file(APPEND ${CMAKE_BINARY_DIR}/discover_all_tests.sh |
551 | - "sh ${CMAKE_SOURCE_DIR}/tools/discover_gtests.sh ${discover_env} -- ${discover_cmd}\n") |
552 | + "sh ${CMAKE_SOURCE_DIR}/tools/discover_gtests.sh ${discover_env} --test-name ${test_name} -- ${discover_cmd}\n") |
553 | if (test_no_memcheck_filter) |
554 | file(APPEND ${CMAKE_BINARY_DIR}/discover_all_tests.sh |
555 | - "sh ${CMAKE_SOURCE_DIR}/tools/discover_gtests.sh ${discover_env} -- ${discover_cmd_no_memcheck}\n") |
556 | + "sh ${CMAKE_SOURCE_DIR}/tools/discover_gtests.sh ${discover_env} --test-name ${test_name}_no_memcheck -- ${discover_cmd_no_memcheck}\n") |
557 | endif() |
558 | endfunction () |
559 | |
560 | @@ -170,11 +170,7 @@ |
561 | set(TARGET_COMPILE_DEFINITIONS "$<$<BOOL:${TARGET_COMPILE_DEFINITIONS}>:-D$<JOIN:${TARGET_COMPILE_DEFINITIONS},\n-D>\n>") |
562 | |
563 | foreach(dir ${TARGET_INCLUDE_DIRECTORIES}) |
564 | - if (${dir} MATCHES "usr/include") |
565 | - set(TARGET_INCLUDE_DIRECTORIES_STRING "${TARGET_INCLUDE_DIRECTORIES_STRING} -isystem ${dir}") |
566 | - else() |
567 | - set(TARGET_INCLUDE_DIRECTORIES_STRING "${TARGET_INCLUDE_DIRECTORIES_STRING} -I${dir}") |
568 | - endif() |
569 | + set(TARGET_INCLUDE_DIRECTORIES_STRING "${TARGET_INCLUDE_DIRECTORIES_STRING} -I${dir}") |
570 | endforeach() |
571 | |
572 | # So. |
573 | |
574 | === modified file 'debian/changelog' |
575 | --- debian/changelog 2016-08-12 14:07:21 +0000 |
576 | +++ debian/changelog 2016-08-12 14:07:23 +0000 |
577 | @@ -1,3 +1,113 @@ |
578 | +mir (0.24.0-0ubuntu1) UNRELEASED; urgency=medium |
579 | + |
580 | + * New upstream release 0.24.0 (https://launchpad.net/mir/+milestone/0.24.0) |
581 | + - ABI summary: |
582 | + . mirclient ABI unchanged at 9 |
583 | + . mirserver ABI bumped to 41 |
584 | + . mircommon ABI unchanged at 6 |
585 | + . mirplatform ABI bumped to 12 |
586 | + . mirprotobuf ABI unchanged at 3 |
587 | + . mirplatformgraphics ABI bumped to 10 |
588 | + . mirclientplatform ABI unchanged at 5 |
589 | + . mirinputplatform ABI unchanged at 5 |
590 | + - Enhancements: |
591 | + . Added a new tool 'mirvanity' which can use a high speed video camera |
592 | + to measure client-to-screen latency. |
593 | + . Added (build-time) support for desktop full OpenGL servers (disabled |
594 | + by default in favor of GLESv2). |
595 | + . Introduced new buffer semantics (NBS) and enabled it by default. |
596 | + . Avoided using libmirserver in mir_demo_standalone_render_overlays, |
597 | + making bringup traces less cluttered. |
598 | + . Removed TilingWindowManager from example servers. |
599 | + . Added two new mir_*_performance_test tools that are run as part of |
600 | + 'mir_performance_tests'. |
601 | + . Added pointer confinement to the client API. |
602 | + . Added new platform supporting software EGLStreams. |
603 | + . Added an input platform that the nested server can use. |
604 | + . Allow configuration of the application_not_responding_detector |
605 | + . Handle server-side keymapping using XKBMapper. |
606 | + . Remove the offscreen display. |
607 | + . Add callback option to notify shells that the server is about to stop. |
608 | + . Add logging for ANativeWindow events on Android. |
609 | + - Bugs fixed: |
610 | + . usage of std:call_once in mirclient causes TLS collisions with some |
611 | + android devices (LP: #1599867) |
612 | + . AltGr not working on external keyboards (LP: #1565236) |
613 | + . [regression] unity8 fails to start when built with 0.24 series (lp:mir) |
614 | + (LP: #1597717) |
615 | + . CI failure in MirSurfaceVisibilityEvent.exposed_received_when_surface_ |
616 | + raised_over_occluding_surface [called twice - over-saturated and active] |
617 | + (LP: #1556045) |
618 | + . package-built mir_demo_server does not start on device (LP: #1577357) |
619 | + . During surface creation, first stream in spec becomes default stream. |
620 | + (LP: #1577967) |
621 | + . mouse is getting stuck on a phantom edge (LP: #1580774) |
622 | + . [testsfail] in MirSurfaceVisibilityEvent.exposed_received_when_surface_ |
623 | + raised_over_occluding_surface [never called] (LP: #1581385) |
624 | + . [enhancement] Add support for full OpenGL compositing (LP: #1420581) |
625 | + . [testsfail] ServerSignal.terminate_handler_is_called_for_SIGINT|SIGTERM |
626 | + (LP: #1570353) |
627 | + . [testsfail] ClientLatency.triple_buffered_client_has_less_than_two_ |
628 | + frames_latency (LP: #1576690) |
629 | + . [testsfail] NestedServer.when_monitor_plugged_in_client_is_notified_of_ |
630 | + new_display_configuration (LP: #1576760) |
631 | + . mir server crashed in what(): drmModeMoveCursor failed (returned -13) |
632 | + (LP: #1579630) |
633 | + . mirtest-dev is hard to use as the objects used are compiled with LTO |
634 | + (LP: #1583536) |
635 | + . [testsfail] ClientLogging.reports_performance [Value of: lag] |
636 | + (LP: #1583970) |
637 | + . [ FAILED ] ClientLogging.reports_performance (Value of: nbuffers) |
638 | + (LP: #1584603) |
639 | + . [ FAILED ] ClientLogging.reports_performance (Value of: render) |
640 | + (LP: #1584605) |
641 | + . ClientCredsTestFixture.session_authorizer_receives_pid_of_connecting_ |
642 | + clients failure (LP: #1587604) |
643 | + . Mir on X11 ignores mir::graphics::GLConfig depth & stencil buffer size |
644 | + (LP: #1589632) |
645 | + . Need to support pointer confinement (LP: #1590099) |
646 | + . [tests] given_nested_server_set_base_display_configuration_when_ |
647 | + monitor_plugged_in_configuration_is_reset fails (LP: #1591354) |
648 | + . CI failure in DemoInProcessServerWithStubClientPlatform.surface_ |
649 | + creation_does_not_leak_fds (LP: #1598802) |
650 | + . Screen is squashed/distorted when rotated in Mir-on-X11 (LP: #1577262) |
651 | + . --display-report=log shows some invalid uninitialized EGL attribute |
652 | + values (LP: #1582066) |
653 | + . mir_demo_client_eglplasma falls back to software rendering on i915 |
654 | + (Intel Atoms), which explains why it's so slow (LP: #1583532) |
655 | + . [regression] x11 platform only draws to a small part of the x11 window |
656 | + (LP: #1598267) |
657 | + . mir ftbfs in yakkety builders (LP: #1600343) |
658 | + . Autolanding keeps failing: mock_egl.h:89:7: error: type 'struct |
659 | + MockEGL' violates one definition rule [-Werror=odr] (LP: #1603303) |
660 | + . [regression] The Super/Windows key doesn't work any more (LP: #1602966) |
661 | + . mir_acceptance_tests.bin: double free or corruption (fasttop) |
662 | + (LP: #1603114) |
663 | + . ftbfs in linking libmir-test-assist.a in xenial+overlay and |
664 | + yakkety+overlay (LP: #1601810) |
665 | + . [testsfail] failure in NestedInput.on_input_device_state_nested_* |
666 | + (LP: #1602646) |
667 | + . mirtest-dev provides an incorrect .pc file (LP: #1603080) |
668 | + . mir_test_framework::server_platform_path(), |
669 | + mir_test_framework::server_platform() don't support use in a downstream |
670 | + test built against mir-test-assist (LP: #1603091) |
671 | + . Servers based on Mir need a hook to execute code when the server is |
672 | + closing (LP: #1593655) |
673 | + . Android graphics platform doesn't get packaged for arm64 (LP: #157866) |
674 | + . memory leaks in unit tests on android (LP: #1253486) |
675 | + . Physical "screen" size reported by the X11 backend is same as pixel |
676 | + count, fixing dpi to 25.4 (LP: #1596051) |
677 | + . Mir build and test failures with gcc-6 and LTO (LP: #1610215) |
678 | + . [regression] Trust prompt not shown when starting camera (LP: #1612256) |
679 | + |
680 | + -- Kevin DuBois <kevin.dubois@canonical.com> Thu, 07 Jul 2016 09:30:44 -0400 |
681 | + |
682 | +mir (0.23.5+16.10.20160729-0ubuntu2) yakkety; urgency=medium |
683 | + |
684 | + * No-change rebuild for boost soname change. |
685 | + |
686 | + -- Matthias Klose <doko@ubuntu.com> Thu, 04 Aug 2016 08:25:48 +0000 |
687 | + |
688 | mir (0.23.5+16.10.20160729-0ubuntu1) yakkety; urgency=medium |
689 | |
690 | * New upstream release 0.23.5 (https://launchpad.net/mir/+milestone/0.23.5) |
691 | |
692 | === modified file 'debian/control' |
693 | --- debian/control 2016-07-19 16:12:03 +0000 |
694 | +++ debian/control 2016-08-12 14:07:23 +0000 |
695 | @@ -19,6 +19,7 @@ |
696 | libdrm-dev, |
697 | libegl1-mesa-dev, |
698 | libgles2-mesa-dev, |
699 | + libgl1-mesa-dev [amd64 i386], |
700 | libgbm-dev, |
701 | libglm-dev, |
702 | libprotobuf-dev, |
703 | @@ -67,7 +68,7 @@ |
704 | |
705 | #TODO: Packaging infrastructure for better dependency generation, |
706 | # ala pkg-xorg's xviddriver:Provides and ABI detection. |
707 | -Package: libmirserver40 |
708 | +Package: libmirserver41 |
709 | Section: libs |
710 | Architecture: linux-any |
711 | Multi-Arch: same |
712 | @@ -80,7 +81,7 @@ |
713 | . |
714 | Contains the shared library needed by server applications for Mir. |
715 | |
716 | -Package: libmirplatform11 |
717 | +Package: libmirplatform13 |
718 | Section: libs |
719 | Architecture: linux-any |
720 | Multi-Arch: same |
721 | @@ -116,7 +117,7 @@ |
722 | Architecture: linux-any |
723 | Multi-Arch: same |
724 | Pre-Depends: ${misc:Pre-Depends} |
725 | -Depends: libmirplatform11 (= ${binary:Version}), |
726 | +Depends: libmirplatform13 (= ${binary:Version}), |
727 | libmircommon-dev, |
728 | libboost-program-options-dev, |
729 | ${misc:Depends}, |
730 | @@ -133,7 +134,7 @@ |
731 | Architecture: linux-any |
732 | Multi-Arch: same |
733 | Pre-Depends: ${misc:Pre-Depends} |
734 | -Depends: libmirserver40 (= ${binary:Version}), |
735 | +Depends: libmirserver41 (= ${binary:Version}), |
736 | libmirplatform-dev (= ${binary:Version}), |
737 | libmircommon-dev (= ${binary:Version}), |
738 | libglm-dev, |
739 | @@ -301,7 +302,7 @@ |
740 | Contains the shared libraries required for the Mir server and client. |
741 | |
742 | # Longer-term these drivers should move out-of-tree |
743 | -Package: mir-platform-graphics-mesa-x9 |
744 | +Package: mir-platform-graphics-mesa-x10 |
745 | Section: libs |
746 | Architecture: linux-any |
747 | Multi-Arch: same |
748 | @@ -315,7 +316,7 @@ |
749 | Contains the shared libraries required for the Mir server to interact with |
750 | the X11 platform using the Mesa drivers. |
751 | |
752 | -Package: mir-platform-graphics-mesa-kms9 |
753 | +Package: mir-platform-graphics-mesa-kms10 |
754 | Section: libs |
755 | Architecture: linux-any |
756 | Multi-Arch: same |
757 | @@ -329,7 +330,7 @@ |
758 | Contains the shared libraries required for the Mir server to interact with |
759 | the hardware platform using the Mesa drivers. |
760 | |
761 | -Package: mir-platform-graphics-android9 |
762 | +Package: mir-platform-graphics-android10 |
763 | Section: libs |
764 | Architecture: i386 amd64 armhf arm64 |
765 | Multi-Arch: same |
766 | @@ -405,8 +406,8 @@ |
767 | Multi-Arch: same |
768 | Pre-Depends: ${misc:Pre-Depends} |
769 | Depends: ${misc:Depends}, |
770 | - mir-platform-graphics-mesa-kms9, |
771 | - mir-platform-graphics-mesa-x9, |
772 | + mir-platform-graphics-mesa-kms10, |
773 | + mir-platform-graphics-mesa-x10, |
774 | mir-client-platform-mesa5, |
775 | mir-platform-input-evdev5, |
776 | Description: Display server for Ubuntu - desktop driver metapackage |
777 | @@ -422,7 +423,7 @@ |
778 | Multi-Arch: same |
779 | Pre-Depends: ${misc:Pre-Depends} |
780 | Depends: ${misc:Depends}, |
781 | - mir-platform-graphics-android9, |
782 | + mir-platform-graphics-android10, |
783 | mir-client-platform-android5, |
784 | mir-platform-input-evdev5, |
785 | Description: Display server for Ubuntu - android driver metapackage |
786 | |
787 | === renamed file 'debian/libmirplatform11.install' => 'debian/libmirplatform13.install' |
788 | --- debian/libmirplatform11.install 2016-01-29 08:18:22 +0000 |
789 | +++ debian/libmirplatform13.install 2016-08-12 14:07:23 +0000 |
790 | @@ -1,1 +1,1 @@ |
791 | -usr/lib/*/libmirplatform.so.11 |
792 | +usr/lib/*/libmirplatform.so.13 |
793 | |
794 | === renamed file 'debian/libmirserver40.install' => 'debian/libmirserver41.install' |
795 | --- debian/libmirserver40.install 2016-04-29 17:25:33 +0000 |
796 | +++ debian/libmirserver41.install 2016-08-12 14:07:23 +0000 |
797 | @@ -1,1 +1,1 @@ |
798 | -usr/lib/*/libmirserver.so.40 |
799 | +usr/lib/*/libmirserver.so.41 |
800 | |
801 | === renamed file 'debian/mir-platform-graphics-android9.install' => 'debian/mir-platform-graphics-android10.install' |
802 | --- debian/mir-platform-graphics-android9.install 2016-04-21 07:33:07 +0000 |
803 | +++ debian/mir-platform-graphics-android10.install 2016-08-12 14:07:23 +0000 |
804 | @@ -1,1 +1,1 @@ |
805 | -usr/lib/*/mir/server-platform/graphics-android.so.9 |
806 | +usr/lib/*/mir/server-platform/graphics-android.so.10 |
807 | |
808 | === renamed file 'debian/mir-platform-graphics-mesa-kms9.install' => 'debian/mir-platform-graphics-mesa-kms10.install' |
809 | --- debian/mir-platform-graphics-mesa-kms9.install 2016-04-21 07:33:07 +0000 |
810 | +++ debian/mir-platform-graphics-mesa-kms10.install 2016-08-12 14:07:23 +0000 |
811 | @@ -1,1 +1,1 @@ |
812 | -usr/lib/*/mir/server-platform/graphics-mesa-kms.so.9 |
813 | +usr/lib/*/mir/server-platform/graphics-mesa-kms.so.10 |
814 | |
815 | === renamed file 'debian/mir-platform-graphics-mesa-x9.install' => 'debian/mir-platform-graphics-mesa-x10.install' |
816 | --- debian/mir-platform-graphics-mesa-x9.install 2016-04-21 07:33:07 +0000 |
817 | +++ debian/mir-platform-graphics-mesa-x10.install 2016-08-12 14:07:23 +0000 |
818 | @@ -1,1 +1,1 @@ |
819 | -usr/lib/*/mir/server-platform/server-mesa-x11.so.9 |
820 | +usr/lib/*/mir/server-platform/server-mesa-x11.so.10 |
821 | |
822 | === modified file 'debian/mir-test-tools.install' |
823 | --- debian/mir-test-tools.install 2016-04-22 03:37:10 +0000 |
824 | +++ debian/mir-test-tools.install 2016-08-12 14:07:23 +0000 |
825 | @@ -6,6 +6,8 @@ |
826 | usr/bin/mir_integration_tests* |
827 | usr/bin/mir_performance_tests |
828 | usr/bin/mir_glmark2_performance_test |
829 | +usr/bin/mir_compositor_performance_test |
830 | +usr/bin/mir_client_startup_performance_test |
831 | usr/bin/mir_privileged_tests |
832 | usr/bin/mir_test_reload_protobuf |
833 | usr/bin/mir_test_client_* |
834 | |
835 | === modified file 'debian/mir-utils.install' |
836 | --- debian/mir-utils.install 2016-04-11 16:56:16 +0000 |
837 | +++ debian/mir-utils.install 2016-08-12 14:07:23 +0000 |
838 | @@ -1,4 +1,5 @@ |
839 | usr/bin/mirping |
840 | +usr/bin/mirvanity |
841 | usr/bin/mirout |
842 | usr/bin/mirin |
843 | usr/bin/mirscreencast |
844 | |
845 | === modified file 'doc/mainpage.md' |
846 | --- doc/mainpage.md 2016-01-29 08:18:22 +0000 |
847 | +++ doc/mainpage.md 2016-08-12 14:07:23 +0000 |
848 | @@ -113,3 +113,4 @@ |
849 | - \ref dso_versioning_guide |
850 | - \ref abi_compatibility_tools |
851 | - \ref mir_performance_framework |
852 | + - \ref latency "Measuring visual latency" |
853 | |
854 | === added file 'doc/measuring_latency.md' |
855 | --- doc/measuring_latency.md 1970-01-01 00:00:00 +0000 |
856 | +++ doc/measuring_latency.md 2016-08-12 14:07:23 +0000 |
857 | @@ -0,0 +1,24 @@ |
858 | +Measuring Visual Latency {#latency} |
859 | +======================== |
860 | + |
861 | +Mir includes a utility called `mirvanity` that can use a high speed camera |
862 | +to measure the visual latency of your display (from client rendering to |
863 | +your eye). |
864 | + |
865 | +It is called "mirvanity" because it works by rendering a pattern to the |
866 | +screen and then looking at the screen itself via the camera. In theory you |
867 | +could also use a laptop screen and webcam with a mirror, however laptop |
868 | +webcams tend to be too slow for this task. In order to use `mirvanity` you |
869 | +need a high speed camera supported by Linux, such as a PlayStation Eye. |
870 | + |
871 | +How to use mirvanity |
872 | +-------------------- |
873 | + |
874 | + 1. Start your Mir server |
875 | + 2. Plug in your camera |
876 | + 3. Position the camera on a stable surface so that it does not move |
877 | + during the test, and such that it is primarily looking at your |
878 | + display only. The camera must be centred on the display. |
879 | + 4. Run `mirvanity` |
880 | + 5. Wait until the output (in the console/stdout for now) shows that the |
881 | + test is complete (which means enough data has been gathered). |
882 | |
883 | === modified file 'examples/CMakeLists.txt' |
884 | --- examples/CMakeLists.txt 2016-03-26 15:38:30 +0000 |
885 | +++ examples/CMakeLists.txt 2016-08-12 14:07:23 +0000 |
886 | @@ -27,7 +27,6 @@ |
887 | server_example_log_options.cpp |
888 | server_example_input_filter.cpp |
889 | server_example_host_lifecycle_event.cpp |
890 | - server_example_tiling_window_manager.cpp |
891 | server_example_window_management.cpp |
892 | server_example_window_management_info.cpp |
893 | server_example_window_management_info.h |
894 | @@ -168,20 +167,20 @@ |
895 | target_link_libraries(mir_demo_client_scroll |
896 | eglapp |
897 | mirdraw |
898 | + ${GLESv2_LIBRARIES} |
899 | ) |
900 | |
901 | mir_add_wrapped_executable(mir_demo_client_prompt_session prompt_session.c) |
902 | target_link_libraries(mir_demo_client_prompt_session mirclient) |
903 | |
904 | add_library(mirdraw STATIC graphics_utils.cpp) |
905 | -target_link_libraries(mirdraw ${GLESv2_LIBRARIES}) |
906 | |
907 | include_directories( |
908 | ${PROJECT_SOURCE_DIR}/include/server |
909 | ${PROJECT_SOURCE_DIR}/include/client |
910 | ${PROJECT_SOURCE_DIR}/include/platform |
911 | ${PROJECT_SOURCE_DIR}/include/renderers/gl |
912 | - ${GLESv2_INCLUDE_DIRS} |
913 | + ${GL_INCLUDE_DIRS} |
914 | ) |
915 | |
916 | mir_add_wrapped_executable(mir_demo_standalone_render_to_fb |
917 | @@ -191,6 +190,7 @@ |
918 | target_link_libraries(mir_demo_standalone_render_to_fb |
919 | mirserver |
920 | mirdraw |
921 | + ${GL_LIBRARIES} |
922 | ${Boost_LIBRARIES} |
923 | ) |
924 | |
925 | |
926 | === modified file 'examples/eglplasma.c' |
927 | --- examples/eglplasma.c 2014-03-05 09:26:01 +0000 |
928 | +++ examples/eglplasma.c 2016-08-12 14:07:23 +0000 |
929 | @@ -61,40 +61,23 @@ |
930 | |
931 | const char fshadersrc[] = |
932 | "precision mediump float; \n" |
933 | - "uniform float theta; \n" |
934 | + "uniform vec4 theta; \n" |
935 | "varying vec2 texcoord; \n" |
936 | "uniform vec3 low_color, high_color; \n" |
937 | " \n" |
938 | - "vec3 gradient(float x) \n" |
939 | - "{ \n" |
940 | - " vec3 col; \n" |
941 | - " const vec3 white = vec3(1.0, 1.0, 1.0); \n" |
942 | - " if (x < 0.333) \n" |
943 | - " col = x * low_color / 0.333; \n" |
944 | - " else if (x < 0.666) \n" |
945 | - " col = (x - 0.333) * (high_color - low_color) / \n" |
946 | - " 0.333 + low_color; \n" |
947 | - " else \n" |
948 | - " col = (x - 0.666) * (white - high_color) / \n" |
949 | - " 0.333 + high_color; \n" |
950 | - " return col; \n" |
951 | - "} \n" |
952 | - " \n" |
953 | "void main() \n" |
954 | "{ \n" |
955 | " const float pi2 = 6.283185308; \n" |
956 | - " float u = texcoord.x * pi2; \n" |
957 | - " float v = texcoord.y * pi2; \n" |
958 | - " float us = (cos(1.1 * u + 7.0 * theta) + \n" |
959 | - " cos(2.3 * v * cos(1.0 * theta)) + \n" |
960 | - " cos(0.3 * u * cos(3.0 * theta)) \n" |
961 | - " ) / 3.0; \n" |
962 | - " float vs = (cos(2.3 * v + 8.0 * theta) + \n" |
963 | - " cos(1.3 * u * cos(3.0 * theta)) + \n" |
964 | - " cos(1.7 * v * cos(2.0 * theta)) \n" |
965 | - " ) / 3.0; \n" |
966 | - " float x = (us * vs + 1.0) / 2.0; \n" |
967 | - " gl_FragColor = vec4(gradient(x), 1.0); \n" |
968 | + " float x = texcoord.x * pi2; \n" |
969 | + " float y = texcoord.y * pi2; \n" |
970 | + " float a = cos(1.0 * (x + theta.x)); \n" |
971 | + " float b = cos(2.0 * (y + theta.y + a)); \n" |
972 | + " float c = cos(2.0 * (2.0*x + theta.z + b)); \n" |
973 | + " float d = cos(1.0 * (3.0*y + theta.w + c)); \n" |
974 | + " float v = (a+b+c+d + 4.0) / 8.0; \n" |
975 | + " vec3 color = v * (high_color - low_color) + \n" |
976 | + " low_color; \n" |
977 | + " gl_FragColor = vec4(color, 1.0); \n" |
978 | "} \n"; |
979 | |
980 | const GLfloat vertices[] = |
981 | @@ -108,7 +91,7 @@ |
982 | GLuint vshader, fshader, prog; |
983 | GLint linked, low_color, high_color, vpos, theta; |
984 | unsigned int width = 0, height = 0; |
985 | - GLfloat angle = 0.0f; |
986 | + GLfloat angle[4] = {3.1f, 4.1f, 5.9f, 2.6f}; |
987 | |
988 | if (!mir_eglapp_init(argc, argv, &width, &height)) |
989 | return 1; |
990 | @@ -149,10 +132,13 @@ |
991 | |
992 | while (mir_eglapp_running()) |
993 | { |
994 | - glUniform1f(theta, angle); |
995 | - angle += 0.005f; |
996 | - if (angle > pi2) |
997 | - angle -= pi2; |
998 | + glUniform4fv(theta, 1, angle); |
999 | + angle[0] += 0.00345f; |
1000 | + angle[1] += 0.01947f; |
1001 | + angle[2] += 0.03758f; |
1002 | + angle[3] += 0.01711f; |
1003 | + for (int a = 0; a < 4; ++a) |
1004 | + if (angle[a] > pi2) angle[a] -= pi2; |
1005 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
1006 | mir_eglapp_swap_buffers(); |
1007 | } |
1008 | |
1009 | === modified file 'examples/graphics_utils.cpp' |
1010 | --- examples/graphics_utils.cpp 2013-04-24 05:22:20 +0000 |
1011 | +++ examples/graphics_utils.cpp 2016-08-12 14:07:23 +0000 |
1012 | @@ -38,7 +38,9 @@ |
1013 | |
1014 | static const GLchar *frag_shader_src = |
1015 | { |
1016 | + "#ifdef GL_ES\n" |
1017 | "precision mediump float;\n" |
1018 | + "#endif\n" |
1019 | "uniform sampler2D tex;\n" |
1020 | "varying vec2 texcoord;\n" |
1021 | "void main() {\n" |
1022 | |
1023 | === modified file 'examples/image_renderer.cpp' |
1024 | --- examples/image_renderer.cpp 2015-07-16 07:03:19 +0000 |
1025 | +++ examples/image_renderer.cpp 2016-08-12 14:07:23 +0000 |
1026 | @@ -49,7 +49,9 @@ |
1027 | |
1028 | const GLchar* fragment_shader_src = |
1029 | { |
1030 | + "#ifdef GL_ES\n" |
1031 | "precision mediump float;\n" |
1032 | + "#endif\n" |
1033 | "uniform sampler2D tex;\n" |
1034 | "varying vec2 v_texcoord;\n" |
1035 | "void main() {\n" |
1036 | |
1037 | === modified file 'examples/mir_demo_server_loader.cpp' |
1038 | --- examples/mir_demo_server_loader.cpp 2016-03-23 06:39:56 +0000 |
1039 | +++ examples/mir_demo_server_loader.cpp 2016-08-12 14:07:23 +0000 |
1040 | @@ -19,7 +19,7 @@ |
1041 | #include <dlfcn.h> |
1042 | #include <stdexcept> |
1043 | #include <iostream> |
1044 | -#include <pthread.h> |
1045 | +#include <thread> |
1046 | |
1047 | namespace |
1048 | { |
1049 | @@ -28,14 +28,14 @@ |
1050 | |
1051 | // Work around gold (or gcc/libstdc++-4.9 bug, it's not yet clear) bug |
1052 | // https://sourceware.org/bugzilla/show_bug.cgi?id=16417 by ensuring the |
1053 | -// executable links with libpthread. |
1054 | +// executable links with libpthread. A similar problem, where the pthread |
1055 | +// link dependency mysteriously disappears, also exists when using LTO |
1056 | +// with ld.bfd. |
1057 | struct GoldBug16417Workaround |
1058 | { |
1059 | GoldBug16417Workaround() |
1060 | { |
1061 | - pthread_attr_t attr; |
1062 | - pthread_attr_init(&attr); |
1063 | - pthread_attr_destroy(&attr); |
1064 | + std::thread{[]{}}.join(); |
1065 | } |
1066 | } gold_bug_16417_workaround; |
1067 | } |
1068 | |
1069 | === modified file 'examples/render_surfaces.cpp' |
1070 | --- examples/render_surfaces.cpp 2016-04-18 17:45:54 +0000 |
1071 | +++ examples/render_surfaces.cpp 2016-08-12 14:07:23 +0000 |
1072 | @@ -33,6 +33,7 @@ |
1073 | #include "mir/scene/surface_factory.h" |
1074 | #include "mir/shell/surface_stack.h" |
1075 | #include "mir/frontend/buffer_sink.h" |
1076 | +#include "mir/frontend/client_buffers.h" |
1077 | #include "mir/server.h" |
1078 | #include "mir/report_exception.h" |
1079 | |
1080 | @@ -142,10 +143,10 @@ |
1081 | Moveable(std::shared_ptr<ms::Surface> const& s, const geom::Size& display_size, |
1082 | float dx, float dy, const glm::vec3& rotation_axis, float alpha_offset) |
1083 | : surface(s), display_size(display_size), |
1084 | - x{s->top_left().x.as_float()}, |
1085 | - y{s->top_left().y.as_float()}, |
1086 | - w{s->size().width.as_float()}, |
1087 | - h{s->size().height.as_float()}, |
1088 | + x(s->top_left().x.as_int()), |
1089 | + y(s->top_left().y.as_int()), |
1090 | + w(s->size().width.as_int()), |
1091 | + h(s->size().height.as_int()), |
1092 | dx{dx}, |
1093 | dy{dy}, |
1094 | rotation_axis(rotation_axis), |
1095 | @@ -376,17 +377,26 @@ |
1096 | void add_buffer(mg::Buffer&) override {} |
1097 | void remove_buffer(mg::Buffer&) override {} |
1098 | void update_buffer(mg::Buffer&) override {} |
1099 | + void error_buffer(mg::BufferProperties const&, std::string const&) override {} |
1100 | }; |
1101 | |
1102 | - auto const stream = buffer_stream_factory->create_buffer_stream( |
1103 | - mf::BufferStreamId{}, std::make_shared<NullBufferSink>(), properties); |
1104 | - auto const surface = surface_factory->create_surface({ ms::StreamInfo{ stream, {0, 0}, {} } }, params); |
1105 | + auto buffers = buffer_stream_factory->create_buffer_map(std::make_shared<NullBufferSink>()); |
1106 | + auto const stream = buffer_stream_factory->create_buffer_stream({}, buffers, properties); |
1107 | + auto const surface = surface_factory->create_surface( |
1108 | + {ms::StreamInfo{stream, {}, {}}}, params); |
1109 | surface_stack->add_surface(surface, params.input_mode); |
1110 | |
1111 | { |
1112 | mg::Buffer* buffer{nullptr}; |
1113 | auto const complete = [&](mg::Buffer* new_buf){ buffer = new_buf; }; |
1114 | + |
1115 | surface->primary_buffer_stream()->swap_buffers(buffer, complete); // Fetch buffer for rendering |
1116 | + if (!buffer) |
1117 | + { |
1118 | + auto buffer_id = buffers->add_buffer(properties); |
1119 | + buffer = (*buffers)[buffer_id].get(); |
1120 | + } |
1121 | + |
1122 | { |
1123 | gl_context->make_current(); |
1124 | |
1125 | |
1126 | === modified file 'examples/server_example.cpp' |
1127 | --- examples/server_example.cpp 2016-04-07 02:10:16 +0000 |
1128 | +++ examples/server_example.cpp 2016-08-12 14:07:23 +0000 |
1129 | @@ -27,6 +27,7 @@ |
1130 | #include "server_example_cursor_images.h" |
1131 | #include "server_example_input_device_config.h" |
1132 | |
1133 | +#include "mir/abnormal_exit.h" |
1134 | #include "mir/server.h" |
1135 | #include "mir/main_loop.h" |
1136 | #include "mir/fd.h" |
1137 | @@ -34,6 +35,8 @@ |
1138 | #include "mir/report_exception.h" |
1139 | #include "mir/options/option.h" |
1140 | |
1141 | +#include <boost/exception/diagnostic_information.hpp> |
1142 | + |
1143 | #include <chrono> |
1144 | #include <cstdlib> |
1145 | |
1146 | @@ -65,17 +68,19 @@ |
1147 | const auto options = server.get_options(); |
1148 | if (options->is_set(launch_child_opt)) |
1149 | { |
1150 | + unsetenv("DISPLAY"); // Discourage toolkits from using X11 |
1151 | + setenv("GDK_BACKEND", "mir", true); // configure GTK to use Mir |
1152 | + setenv("QT_QPA_PLATFORM", "ubuntumirclient", true); // configure Qt to use Mir |
1153 | + unsetenv("QT_QPA_PLATFORMTHEME"); // Discourage Qt from unsupported theme |
1154 | + setenv("SDL_VIDEODRIVER", "mir", true); // configure SDL to use Mir |
1155 | + |
1156 | auto const value = options->get<std::string>(launch_child_opt); |
1157 | |
1158 | for (auto i = begin(value); i != end(value); ) |
1159 | { |
1160 | auto const j = find(i, end(value), '&'); |
1161 | |
1162 | - auto const cmd ="DISPLAY= " // Discourage toolkits from using X11 |
1163 | - "GDK_BACKEND=mir " // configure GTK to use Mir |
1164 | - "QT_QPA_PLATFORM=ubuntumirclient " // configure Qt to use Mir |
1165 | - "SDL_VIDEODRIVER=mir " // configure SDL to use Mir |
1166 | - "MIR_SOCKET=" + connection(server.open_client_socket()) + " " + |
1167 | + auto const cmd ="MIR_SOCKET=" + connection(server.open_client_socket()) + " " + |
1168 | std::string{i, j} + "&"; |
1169 | |
1170 | auto ignore = std::system(cmd.c_str()); |
1171 | @@ -104,6 +109,37 @@ |
1172 | } |
1173 | }); |
1174 | } |
1175 | + |
1176 | +void exception_handler() |
1177 | +try |
1178 | +{ |
1179 | + throw; |
1180 | +} |
1181 | +catch (mir::AbnormalExit const& /*error*/) |
1182 | +{ |
1183 | +} |
1184 | +catch (std::exception const& error) |
1185 | +{ |
1186 | + char const command_fmt[] = "/usr/share/apport/recoverable_problem --pid %d"; |
1187 | + char command[sizeof(command_fmt)+32]; |
1188 | + snprintf(command, sizeof(command), command_fmt, getpid()); |
1189 | + char const options[] = "we"; |
1190 | + char const key[] = "UnhandledException"; |
1191 | + auto const value = boost::diagnostic_information(error); |
1192 | + |
1193 | + if (auto const output = popen(command, options)) |
1194 | + { |
1195 | + fwrite(key, sizeof(key), 1, output); // the null terminator is used intentionally as a separator |
1196 | + fwrite(value.c_str(), value.size(), 1, output); |
1197 | + pclose(output); |
1198 | + } |
1199 | + |
1200 | + mir::report_exception(); |
1201 | +} |
1202 | +catch (...) |
1203 | +{ |
1204 | + mir::report_exception(); |
1205 | +} |
1206 | } |
1207 | |
1208 | int main(int argc, char const* argv[]) |
1209 | @@ -125,6 +161,8 @@ |
1210 | add_timeout_option_to(server); |
1211 | me::add_x_cursor_images(server); |
1212 | |
1213 | + server.set_exception_handler(exception_handler); |
1214 | + |
1215 | me::ClientContext context; |
1216 | me::add_test_client_option_to(server, context); |
1217 | |
1218 | |
1219 | === modified file 'examples/server_example_adorning_compositor.cpp' |
1220 | --- examples/server_example_adorning_compositor.cpp 2016-03-23 06:39:56 +0000 |
1221 | +++ examples/server_example_adorning_compositor.cpp 2016-08-12 14:07:23 +0000 |
1222 | @@ -29,7 +29,7 @@ |
1223 | #include <stdexcept> |
1224 | #include <boost/throw_exception.hpp> |
1225 | |
1226 | -#include <GLES2/gl2.h> |
1227 | +#include MIR_SERVER_GL_H |
1228 | |
1229 | namespace me = mir::examples; |
1230 | namespace mg = mir::graphics; |
1231 | @@ -85,7 +85,9 @@ |
1232 | "}" |
1233 | }, |
1234 | frag_shader_src{ |
1235 | - "precision mediump float;" |
1236 | + "#ifdef GL_ES\n" |
1237 | + "precision mediump float;\n" |
1238 | + "#endif\n" |
1239 | "varying vec2 texcoord;" |
1240 | "uniform sampler2D tex;" |
1241 | "uniform float alpha;" |
1242 | @@ -187,8 +189,8 @@ |
1243 | // we'll always use GLES. |
1244 | render_target->make_current(); |
1245 | |
1246 | - auto display_width = db.view_area().size.width.as_float(); |
1247 | - auto display_height = db.view_area().size.height.as_float(); |
1248 | + auto display_width = db.view_area().size.width.as_int(); |
1249 | + auto display_height = db.view_area().size.height.as_int(); |
1250 | |
1251 | glUseProgram(program.program); |
1252 | glViewport(0, 0, display_width, display_height); |
1253 | @@ -206,10 +208,10 @@ |
1254 | auto const renderable = element->renderable(); |
1255 | renderable_list.push_back(renderable); |
1256 | |
1257 | - float width = renderable->screen_position().size.width.as_float(); |
1258 | - float height = renderable->screen_position().size.height.as_float(); |
1259 | - float x = renderable->screen_position().top_left.x.as_float() - db.view_area().top_left.x.as_float(); |
1260 | - float y = renderable->screen_position().top_left.y.as_float() - db.view_area().top_left.y.as_float(); |
1261 | + float width = renderable->screen_position().size.width.as_int(); |
1262 | + float height = renderable->screen_position().size.height.as_int(); |
1263 | + float x = renderable->screen_position().top_left.x.as_int() - db.view_area().top_left.x.as_int(); |
1264 | + float y = renderable->screen_position().top_left.y.as_int() - db.view_area().top_left.y.as_int(); |
1265 | float scale[2] { |
1266 | width/display_width * 2, |
1267 | height/display_height * -2}; |
1268 | |
1269 | === modified file 'examples/server_example_canonical_window_manager.cpp' |
1270 | --- examples/server_example_canonical_window_manager.cpp 2016-04-28 09:07:56 +0000 |
1271 | +++ examples/server_example_canonical_window_manager.cpp 2016-08-12 14:07:23 +0000 |
1272 | @@ -276,7 +276,7 @@ |
1273 | surface_map.emplace(titlebar, SurfaceInfo{session, titlebar, {}}).first->second; |
1274 | titlebar_info.is_titlebar = true; |
1275 | titlebar_info.parent = surface; |
1276 | - titlebar_info.init_titlebar(titlebar); |
1277 | + titlebar_info.init_titlebar(session, titlebar); |
1278 | } |
1279 | |
1280 | void me::CanonicalWindowManagerPolicyCopy::handle_new_surface(std::shared_ptr<ms::Session> const& session, std::shared_ptr<ms::Surface> const& surface) |
1281 | @@ -416,11 +416,17 @@ |
1282 | auto const state = handle_set_state(surface, modifications.state.value()); |
1283 | surface->configure(mir_surface_attrib_state, state); |
1284 | } |
1285 | + |
1286 | + if (modifications.confine_pointer.is_set()) |
1287 | + { |
1288 | + surface->set_confine_pointer_state(modifications.confine_pointer.value()); |
1289 | + } |
1290 | } |
1291 | |
1292 | void me::CanonicalWindowManagerPolicyCopy::handle_delete_surface(std::shared_ptr<ms::Session> const& session, std::weak_ptr<ms::Surface> const& surface) |
1293 | { |
1294 | fullscreen_surfaces.erase(surface); |
1295 | + bool const is_active_surface{surface.lock() == active_surface()}; |
1296 | |
1297 | auto& info = tools->info_for(surface); |
1298 | |
1299 | @@ -457,11 +463,19 @@ |
1300 | } |
1301 | } |
1302 | |
1303 | - if (surfaces.empty() && session == tools->focused_session()) |
1304 | + if (is_active_surface) |
1305 | { |
1306 | active_surface_.reset(); |
1307 | - tools->focus_next_session(); |
1308 | - select_active_surface(tools->focused_surface()); |
1309 | + |
1310 | + if (surfaces.empty()) |
1311 | + { |
1312 | + tools->focus_next_session(); |
1313 | + select_active_surface(tools->focused_surface()); |
1314 | + } |
1315 | + else |
1316 | + { |
1317 | + select_active_surface(surfaces[0].lock()); |
1318 | + } |
1319 | } |
1320 | } |
1321 | |
1322 | |
1323 | === removed file 'examples/server_example_tiling_window_manager.cpp' |
1324 | --- examples/server_example_tiling_window_manager.cpp 2016-04-15 03:41:28 +0000 |
1325 | +++ examples/server_example_tiling_window_manager.cpp 1970-01-01 00:00:00 +0000 |
1326 | @@ -1,640 +0,0 @@ |
1327 | -/* |
1328 | - * Copyright © 2015 Canonical Ltd. |
1329 | - * |
1330 | - * This program is free software: you can redistribute it and/or modify it |
1331 | - * under the terms of the GNU General Public License version 3, |
1332 | - * as published by the Free Software Foundation. |
1333 | - * |
1334 | - * This program is distributed in the hope that it will be useful, |
1335 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1336 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1337 | - * GNU General Public License for more details. |
1338 | - * |
1339 | - * You should have received a copy of the GNU General Public License |
1340 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1341 | - * |
1342 | - * Authored By: Alan Griffiths <alan@octopull.co.uk> |
1343 | - */ |
1344 | - |
1345 | -#include "server_example_tiling_window_manager.h" |
1346 | - |
1347 | -#include "mir/scene/session.h" |
1348 | -#include "mir/scene/surface.h" |
1349 | -#include "mir/scene/surface_creation_parameters.h" |
1350 | -#include "mir/shell/surface_specification.h" |
1351 | -#include "mir/shell/surface_stack.h" |
1352 | -#include "mir/shell/surface_ready_observer.h" |
1353 | -#include "mir/geometry/displacement.h" |
1354 | - |
1355 | -#include <linux/input.h> |
1356 | -#include <csignal> |
1357 | - |
1358 | -namespace me = mir::examples; |
1359 | -namespace ms = mir::scene; |
1360 | -namespace mf = mir::frontend; |
1361 | -using namespace mir::geometry; |
1362 | - |
1363 | -///\example server_example_tiling_window_manager.cpp |
1364 | -/// Demonstrate implementing a simple tiling algorithm |
1365 | - |
1366 | -me::TilingWindowManagerPolicy::TilingWindowManagerPolicy(WindowManagerTools* const tools) : |
1367 | - tools{tools} |
1368 | -{ |
1369 | -} |
1370 | - |
1371 | -void me::TilingWindowManagerPolicy::click(Point cursor) |
1372 | -{ |
1373 | - auto const session = session_under(cursor); |
1374 | - auto const surface = tools->surface_at(cursor); |
1375 | - select_active_surface(session, surface); |
1376 | -} |
1377 | - |
1378 | -void me::TilingWindowManagerPolicy::handle_session_info_updated(SessionInfoMap& session_info, Rectangles const& displays) |
1379 | -{ |
1380 | - update_tiles(session_info, displays); |
1381 | -} |
1382 | - |
1383 | -void me::TilingWindowManagerPolicy::handle_displays_updated(SessionInfoMap& session_info, Rectangles const& displays) |
1384 | -{ |
1385 | - update_tiles(session_info, displays); |
1386 | -} |
1387 | - |
1388 | -void me::TilingWindowManagerPolicy::resize(Point cursor) |
1389 | -{ |
1390 | - if (auto const session = session_under(cursor)) |
1391 | - { |
1392 | - if (session == session_under(old_cursor)) |
1393 | - { |
1394 | - if (auto const surface = select_active_surface(session, tools->surface_at(old_cursor))) |
1395 | - { |
1396 | - resize(surface, cursor, old_cursor, tools->info_for(session).tile); |
1397 | - } |
1398 | - } |
1399 | - } |
1400 | -} |
1401 | - |
1402 | -auto me::TilingWindowManagerPolicy::handle_place_new_surface( |
1403 | - std::shared_ptr<ms::Session> const& session, |
1404 | - ms::SurfaceCreationParameters const& request_parameters) |
1405 | --> ms::SurfaceCreationParameters |
1406 | -{ |
1407 | - auto parameters = request_parameters; |
1408 | - |
1409 | - Rectangle const& tile = tools->info_for(session).tile; |
1410 | - parameters.top_left = parameters.top_left + (tile.top_left - Point{0, 0}); |
1411 | - |
1412 | - if (auto const parent = parameters.parent.lock()) |
1413 | - { |
1414 | - auto const width = parameters.size.width.as_int(); |
1415 | - auto const height = parameters.size.height.as_int(); |
1416 | - |
1417 | - if (parameters.aux_rect.is_set() && parameters.edge_attachment.is_set()) |
1418 | - { |
1419 | - auto const edge_attachment = parameters.edge_attachment.value(); |
1420 | - auto const aux_rect = parameters.aux_rect.value(); |
1421 | - auto const parent_top_left = parent->top_left(); |
1422 | - auto const top_left = aux_rect.top_left -Point{} + parent_top_left; |
1423 | - auto const top_right= aux_rect.top_right() -Point{} + parent_top_left; |
1424 | - auto const bot_left = aux_rect.bottom_left()-Point{} + parent_top_left; |
1425 | - |
1426 | - if (edge_attachment & mir_edge_attachment_vertical) |
1427 | - { |
1428 | - if (tile.contains(top_right + Displacement{width, height})) |
1429 | - { |
1430 | - parameters.top_left = top_right; |
1431 | - } |
1432 | - else if (tile.contains(top_left + Displacement{-width, height})) |
1433 | - { |
1434 | - parameters.top_left = top_left + Displacement{-width, 0}; |
1435 | - } |
1436 | - } |
1437 | - |
1438 | - if (edge_attachment & mir_edge_attachment_horizontal) |
1439 | - { |
1440 | - if (tile.contains(bot_left + Displacement{width, height})) |
1441 | - { |
1442 | - parameters.top_left = bot_left; |
1443 | - } |
1444 | - else if (tile.contains(top_left + Displacement{width, -height})) |
1445 | - { |
1446 | - parameters.top_left = top_left + Displacement{0, -height}; |
1447 | - } |
1448 | - } |
1449 | - } |
1450 | - else |
1451 | - { |
1452 | - auto const parent_top_left = parent->top_left(); |
1453 | - auto const centred = parent_top_left |
1454 | - + 0.5*(as_displacement(parent->size()) - as_displacement(parameters.size)) |
1455 | - - DeltaY{(parent->size().height.as_int()-height)/6}; |
1456 | - |
1457 | - parameters.top_left = centred; |
1458 | - } |
1459 | - } |
1460 | - |
1461 | - clip_to_tile(parameters, tile); |
1462 | - return parameters; |
1463 | -} |
1464 | - |
1465 | -void me::TilingWindowManagerPolicy::generate_decorations_for( |
1466 | - std::shared_ptr<ms::Session> const&, |
1467 | - std::shared_ptr<ms::Surface> const&, |
1468 | - SurfaceInfoMap&, |
1469 | - std::function<mf::SurfaceId(std::shared_ptr<ms::Session> const&, ms::SurfaceCreationParameters const&)> const&) |
1470 | -{ |
1471 | -} |
1472 | - |
1473 | -void me::TilingWindowManagerPolicy::handle_new_surface(std::shared_ptr<ms::Session> const& session, std::shared_ptr<ms::Surface> const& surface) |
1474 | -{ |
1475 | - tools->info_for(session).surfaces.push_back(surface); |
1476 | - |
1477 | - auto& surface_info = tools->info_for(surface); |
1478 | - if (auto const parent = surface_info.parent.lock()) |
1479 | - { |
1480 | - tools->info_for(parent).children.push_back(surface); |
1481 | - } |
1482 | - |
1483 | - if (surface_info.can_be_active()) |
1484 | - { |
1485 | - surface->add_observer(std::make_shared<shell::SurfaceReadyObserver>( |
1486 | - [this](std::shared_ptr<scene::Session> const& session, std::shared_ptr<scene::Surface> const& surface) |
1487 | - { select_active_surface(session, surface); }, |
1488 | - session, |
1489 | - surface)); |
1490 | - } |
1491 | -} |
1492 | - |
1493 | -void me::TilingWindowManagerPolicy::handle_modify_surface( |
1494 | - std::shared_ptr<scene::Session> const& /*session*/, |
1495 | - std::shared_ptr<scene::Surface> const& surface, |
1496 | - shell::SurfaceSpecification const& modifications) |
1497 | -{ |
1498 | - if (modifications.name.is_set()) |
1499 | - surface->rename(modifications.name.value()); |
1500 | -} |
1501 | - |
1502 | -void me::TilingWindowManagerPolicy::handle_delete_surface(std::shared_ptr<ms::Session> const& session, std::weak_ptr<ms::Surface> const& surface) |
1503 | -{ |
1504 | - auto& info = tools->info_for(surface); |
1505 | - |
1506 | - if (auto const parent = info.parent.lock()) |
1507 | - { |
1508 | - auto& siblings = tools->info_for(parent).children; |
1509 | - |
1510 | - for (auto i = begin(siblings); i != end(siblings); ++i) |
1511 | - { |
1512 | - if (surface.lock() == i->lock()) |
1513 | - { |
1514 | - siblings.erase(i); |
1515 | - break; |
1516 | - } |
1517 | - } |
1518 | - } |
1519 | - |
1520 | - auto& surfaces = tools->info_for(session).surfaces; |
1521 | - |
1522 | - for (auto i = begin(surfaces); i != end(surfaces); ++i) |
1523 | - { |
1524 | - if (surface.lock() == i->lock()) |
1525 | - { |
1526 | - surfaces.erase(i); |
1527 | - break; |
1528 | - } |
1529 | - } |
1530 | - |
1531 | - session->destroy_surface(surface); |
1532 | - |
1533 | - if (surfaces.empty() && session == tools->focused_session()) |
1534 | - { |
1535 | - tools->focus_next_session(); |
1536 | - select_active_surface(tools->focused_session(), tools->focused_surface()); |
1537 | - } |
1538 | -} |
1539 | - |
1540 | -int me::TilingWindowManagerPolicy::handle_set_state(std::shared_ptr<ms::Surface> const& surface, MirSurfaceState value) |
1541 | -{ |
1542 | - auto& info = tools->info_for(surface); |
1543 | - |
1544 | - switch (value) |
1545 | - { |
1546 | - case mir_surface_state_restored: |
1547 | - case mir_surface_state_maximized: |
1548 | - case mir_surface_state_vertmaximized: |
1549 | - case mir_surface_state_horizmaximized: |
1550 | - break; |
1551 | - |
1552 | - default: |
1553 | - return info.state; |
1554 | - } |
1555 | - |
1556 | - if (info.state == mir_surface_state_restored) |
1557 | - { |
1558 | - info.restore_rect = {surface->top_left(), surface->size()}; |
1559 | - } |
1560 | - |
1561 | - if (info.state == value) |
1562 | - { |
1563 | - return info.state; |
1564 | - } |
1565 | - |
1566 | - auto const& tile = tools->info_for(info.session).tile; |
1567 | - |
1568 | - switch (value) |
1569 | - { |
1570 | - case mir_surface_state_restored: |
1571 | - surface->resize(info.restore_rect.size); |
1572 | - drag(surface, info.restore_rect.top_left, surface->top_left(), tile); |
1573 | - break; |
1574 | - |
1575 | - case mir_surface_state_maximized: |
1576 | - surface->resize(tile.size); |
1577 | - drag(surface, tile.top_left, surface->top_left(), tile); |
1578 | - break; |
1579 | - |
1580 | - case mir_surface_state_horizmaximized: |
1581 | - surface->resize({tile.size.width, info.restore_rect.size.height}); |
1582 | - drag(surface, {tile.top_left.x, info.restore_rect.top_left.y}, surface->top_left(), tile); |
1583 | - break; |
1584 | - |
1585 | - case mir_surface_state_vertmaximized: |
1586 | - surface->resize({info.restore_rect.size.width, tile.size.height}); |
1587 | - drag(surface, {info.restore_rect.top_left.x, tile.top_left.y}, surface->top_left(), tile); |
1588 | - break; |
1589 | - |
1590 | - default: |
1591 | - break; |
1592 | - } |
1593 | - |
1594 | - return info.state = value; |
1595 | -} |
1596 | - |
1597 | -void me::TilingWindowManagerPolicy::drag(Point cursor) |
1598 | -{ |
1599 | - if (auto const session = session_under(cursor)) |
1600 | - { |
1601 | - if (session == session_under(old_cursor)) |
1602 | - { |
1603 | - if (auto const surface = select_active_surface(session, tools->surface_at(old_cursor))) |
1604 | - { |
1605 | - drag(surface, cursor, old_cursor, tools->info_for(session).tile); |
1606 | - } |
1607 | - } |
1608 | - } |
1609 | -} |
1610 | - |
1611 | -void me::TilingWindowManagerPolicy::handle_raise_surface( |
1612 | - std::shared_ptr<ms::Session> const& session, |
1613 | - std::shared_ptr<ms::Surface> const& surface) |
1614 | -{ |
1615 | - select_active_surface(session, surface); |
1616 | -} |
1617 | - |
1618 | -bool me::TilingWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event) |
1619 | -{ |
1620 | - auto const action = mir_keyboard_event_action(event); |
1621 | - auto const scan_code = mir_keyboard_event_scan_code(event); |
1622 | - auto const modifiers = mir_keyboard_event_modifiers(event) & modifier_mask; |
1623 | - |
1624 | - if (action == mir_keyboard_action_down && scan_code == KEY_F11) |
1625 | - { |
1626 | - switch (modifiers & modifier_mask) |
1627 | - { |
1628 | - case mir_input_event_modifier_alt: |
1629 | - toggle(mir_surface_state_maximized); |
1630 | - return true; |
1631 | - |
1632 | - case mir_input_event_modifier_shift: |
1633 | - toggle(mir_surface_state_vertmaximized); |
1634 | - return true; |
1635 | - |
1636 | - case mir_input_event_modifier_ctrl: |
1637 | - toggle(mir_surface_state_horizmaximized); |
1638 | - return true; |
1639 | - |
1640 | - default: |
1641 | - break; |
1642 | - } |
1643 | - } |
1644 | - else if (action == mir_keyboard_action_down && scan_code == KEY_F4) |
1645 | - { |
1646 | - if (auto const session = tools->focused_session()) |
1647 | - { |
1648 | - switch (modifiers & modifier_mask) |
1649 | - { |
1650 | - case mir_input_event_modifier_alt: |
1651 | - kill(session->process_id(), SIGTERM); |
1652 | - return true; |
1653 | - |
1654 | - case mir_input_event_modifier_ctrl: |
1655 | - if (auto const surf = session->default_surface()) |
1656 | - { |
1657 | - surf->request_client_surface_close(); |
1658 | - return true; |
1659 | - } |
1660 | - |
1661 | - default: |
1662 | - break; |
1663 | - } |
1664 | - } |
1665 | - } |
1666 | - else if (action == mir_keyboard_action_down && |
1667 | - modifiers == mir_input_event_modifier_alt && |
1668 | - scan_code == KEY_TAB) |
1669 | - { |
1670 | - tools->focus_next_session(); |
1671 | - select_active_surface(tools->focused_session(), tools->focused_surface()); |
1672 | - |
1673 | - return true; |
1674 | - } |
1675 | - else if (action == mir_keyboard_action_down && |
1676 | - modifiers == mir_input_event_modifier_alt && |
1677 | - scan_code == KEY_GRAVE) |
1678 | - { |
1679 | - if (auto const prev = tools->focused_surface()) |
1680 | - { |
1681 | - if (auto const app = tools->focused_session()) |
1682 | - if (auto const surface = app->surface_after(prev)) |
1683 | - { |
1684 | - select_active_surface(app, surface); |
1685 | - } |
1686 | - } |
1687 | - |
1688 | - return true; |
1689 | - } |
1690 | - |
1691 | - return false; |
1692 | -} |
1693 | - |
1694 | -bool me::TilingWindowManagerPolicy::handle_touch_event(MirTouchEvent const* event) |
1695 | -{ |
1696 | - auto const count = mir_touch_event_point_count(event); |
1697 | - |
1698 | - long total_x = 0; |
1699 | - long total_y = 0; |
1700 | - |
1701 | - for (auto i = 0U; i != count; ++i) |
1702 | - { |
1703 | - total_x += mir_touch_event_axis_value(event, i, mir_touch_axis_x); |
1704 | - total_y += mir_touch_event_axis_value(event, i, mir_touch_axis_y); |
1705 | - } |
1706 | - |
1707 | - Point const cursor{total_x/count, total_y/count}; |
1708 | - |
1709 | - bool is_drag = true; |
1710 | - for (auto i = 0U; i != count; ++i) |
1711 | - { |
1712 | - switch (mir_touch_event_action(event, i)) |
1713 | - { |
1714 | - case mir_touch_action_up: |
1715 | - return false; |
1716 | - |
1717 | - case mir_touch_action_down: |
1718 | - is_drag = false; |
1719 | - |
1720 | - case mir_touch_action_change: |
1721 | - continue; |
1722 | - } |
1723 | - } |
1724 | - |
1725 | - bool consumes_event = false; |
1726 | - if (is_drag) |
1727 | - { |
1728 | - switch (count) |
1729 | - { |
1730 | - case 2: |
1731 | - resize(cursor); |
1732 | - consumes_event = true; |
1733 | - break; |
1734 | - |
1735 | - case 3: |
1736 | - drag(cursor); |
1737 | - consumes_event = true; |
1738 | - break; |
1739 | - } |
1740 | - } |
1741 | - |
1742 | - old_cursor = cursor; |
1743 | - return consumes_event; |
1744 | -} |
1745 | - |
1746 | -bool me::TilingWindowManagerPolicy::handle_pointer_event(MirPointerEvent const* event) |
1747 | -{ |
1748 | - auto const action = mir_pointer_event_action(event); |
1749 | - auto const modifiers = mir_pointer_event_modifiers(event) & modifier_mask; |
1750 | - Point const cursor{ |
1751 | - mir_pointer_event_axis_value(event, mir_pointer_axis_x), |
1752 | - mir_pointer_event_axis_value(event, mir_pointer_axis_y)}; |
1753 | - |
1754 | - bool consumes_event = false; |
1755 | - |
1756 | - if (action == mir_pointer_action_button_down) |
1757 | - { |
1758 | - click(cursor); |
1759 | - } |
1760 | - else if (action == mir_pointer_action_motion && |
1761 | - modifiers == mir_input_event_modifier_alt) |
1762 | - { |
1763 | - if (mir_pointer_event_button_state(event, mir_pointer_button_primary)) |
1764 | - { |
1765 | - drag(cursor); |
1766 | - consumes_event = true; |
1767 | - } |
1768 | - else if (mir_pointer_event_button_state(event, mir_pointer_button_tertiary)) |
1769 | - { |
1770 | - resize(cursor); |
1771 | - consumes_event = true; |
1772 | - } |
1773 | - } |
1774 | - |
1775 | - old_cursor = cursor; |
1776 | - return consumes_event; |
1777 | -} |
1778 | - |
1779 | -void me::TilingWindowManagerPolicy::toggle(MirSurfaceState state) |
1780 | -{ |
1781 | - if (auto const session = tools->focused_session()) |
1782 | - { |
1783 | - if (auto const surface = session->default_surface()) |
1784 | - { |
1785 | - if (surface->state() == state) |
1786 | - state = mir_surface_state_restored; |
1787 | - |
1788 | - auto const value = handle_set_state(surface, MirSurfaceState(state)); |
1789 | - surface->configure(mir_surface_attrib_state, value); |
1790 | - } |
1791 | - } |
1792 | -} |
1793 | - |
1794 | -std::shared_ptr<ms::Session> me::TilingWindowManagerPolicy::session_under(Point position) |
1795 | -{ |
1796 | - return tools->find_session([&](SessionInfo const& info) { return info.tile.contains(position);}); |
1797 | -} |
1798 | - |
1799 | -void me::TilingWindowManagerPolicy::update_tiles( |
1800 | - SessionInfoMap& session_info, |
1801 | - Rectangles const& displays) |
1802 | -{ |
1803 | - if (session_info.size() < 1 || displays.size() < 1) return; |
1804 | - |
1805 | - auto const sessions = session_info.size(); |
1806 | - |
1807 | - auto const bounding_rect = displays.bounding_rectangle(); |
1808 | - |
1809 | - auto const total_width = bounding_rect.size.width.as_int(); |
1810 | - auto const total_height = bounding_rect.size.height.as_int(); |
1811 | - |
1812 | - auto index = 0; |
1813 | - |
1814 | - for (auto& info : session_info) |
1815 | - { |
1816 | - auto const x = (total_width*index)/sessions; |
1817 | - ++index; |
1818 | - auto const dx = (total_width*index)/sessions - x; |
1819 | - |
1820 | - auto const old_tile = info.second.tile; |
1821 | - Rectangle const new_tile{{x, 0}, {dx, total_height}}; |
1822 | - |
1823 | - update_surfaces(info.first, old_tile, new_tile); |
1824 | - |
1825 | - info.second.tile = new_tile; |
1826 | - } |
1827 | -} |
1828 | - |
1829 | -void me::TilingWindowManagerPolicy::update_surfaces(std::weak_ptr<ms::Session> const& session, Rectangle const& old_tile, Rectangle const& new_tile) |
1830 | -{ |
1831 | - auto displacement = new_tile.top_left - old_tile.top_left; |
1832 | - auto& info = tools->info_for(session); |
1833 | - |
1834 | - for (auto const& ps : info.surfaces) |
1835 | - { |
1836 | - if (auto const surface = ps.lock()) |
1837 | - { |
1838 | - auto const old_pos = surface->top_left(); |
1839 | - surface->move_to(old_pos + displacement); |
1840 | - |
1841 | - fit_to_new_tile(*surface, old_tile, new_tile); |
1842 | - } |
1843 | - } |
1844 | -} |
1845 | - |
1846 | -void me::TilingWindowManagerPolicy::clip_to_tile(ms::SurfaceCreationParameters& parameters, Rectangle const& tile) |
1847 | -{ |
1848 | - auto const displacement = parameters.top_left - tile.top_left; |
1849 | - |
1850 | - auto width = std::min(tile.size.width.as_int()-displacement.dx.as_int(), parameters.size.width.as_int()); |
1851 | - auto height = std::min(tile.size.height.as_int()-displacement.dy.as_int(), parameters.size.height.as_int()); |
1852 | - |
1853 | - parameters.size = Size{width, height}; |
1854 | -} |
1855 | - |
1856 | -void me::TilingWindowManagerPolicy::fit_to_new_tile(ms::Surface& surface, Rectangle const& old_tile, Rectangle const& new_tile) |
1857 | -{ |
1858 | - auto const displacement = surface.top_left() - new_tile.top_left; |
1859 | - |
1860 | - // For now just scale if was filling width/height of tile |
1861 | - auto const old_size = surface.size(); |
1862 | - auto const scaled_width = old_size.width == old_tile.size.width ? new_tile.size.width : old_size.width; |
1863 | - auto const scaled_height = old_size.height == old_tile.size.height ? new_tile.size.height : old_size.height; |
1864 | - |
1865 | - auto width = std::min(new_tile.size.width.as_int()-displacement.dx.as_int(), scaled_width.as_int()); |
1866 | - auto height = std::min(new_tile.size.height.as_int()-displacement.dy.as_int(), scaled_height.as_int()); |
1867 | - |
1868 | - surface.resize({width, height}); |
1869 | -} |
1870 | - |
1871 | -void me::TilingWindowManagerPolicy::drag(std::shared_ptr<ms::Surface> surface, Point to, Point from, Rectangle bounds) |
1872 | -{ |
1873 | - if (surface && surface->input_area_contains(from)) |
1874 | - { |
1875 | - auto movement = to - from; |
1876 | - |
1877 | - constrained_move(surface, movement, bounds); |
1878 | - |
1879 | - for (auto const& child: tools->info_for(surface).children) |
1880 | - { |
1881 | - auto move = movement; |
1882 | - constrained_move(child.lock(), move, bounds); |
1883 | - } |
1884 | - } |
1885 | -} |
1886 | - |
1887 | -void me::TilingWindowManagerPolicy::constrained_move( |
1888 | - std::shared_ptr<scene::Surface> const& surface, |
1889 | - Displacement& movement, |
1890 | - Rectangle const& bounds) |
1891 | -{ |
1892 | - auto const top_left = surface->top_left(); |
1893 | - auto const surface_size = surface->size(); |
1894 | - auto const bottom_right = top_left + as_displacement(surface_size); |
1895 | - |
1896 | - if (movement.dx < DeltaX{0}) |
1897 | - movement.dx = std::max(movement.dx, (bounds.top_left - top_left).dx); |
1898 | - |
1899 | - if (movement.dy < DeltaY{0}) |
1900 | - movement.dy = std::max(movement.dy, (bounds.top_left - top_left).dy); |
1901 | - |
1902 | - if (movement.dx > DeltaX{0}) |
1903 | - movement.dx = std::min(movement.dx, (bounds.bottom_right() - bottom_right).dx); |
1904 | - |
1905 | - if (movement.dy > DeltaY{0}) |
1906 | - movement.dy = std::min(movement.dy, (bounds.bottom_right() - bottom_right).dy); |
1907 | - |
1908 | - auto new_pos = surface->top_left() + movement; |
1909 | - |
1910 | - surface->move_to(new_pos); |
1911 | -} |
1912 | - |
1913 | -void me::TilingWindowManagerPolicy::resize(std::shared_ptr<ms::Surface> surface, Point cursor, Point old_cursor, Rectangle bounds) |
1914 | -{ |
1915 | - if (surface && surface->input_area_contains(old_cursor)) |
1916 | - { |
1917 | - auto const top_left = surface->top_left(); |
1918 | - |
1919 | - auto const old_displacement = old_cursor - top_left; |
1920 | - auto const new_displacement = cursor - top_left; |
1921 | - |
1922 | - auto const scale_x = new_displacement.dx.as_float()/std::max(1.0f, old_displacement.dx.as_float()); |
1923 | - auto const scale_y = new_displacement.dy.as_float()/std::max(1.0f, old_displacement.dy.as_float()); |
1924 | - |
1925 | - if (scale_x <= 0.0f || scale_y <= 0.0f) return; |
1926 | - |
1927 | - auto const old_size = surface->size(); |
1928 | - Size new_size{scale_x*old_size.width, scale_y*old_size.height}; |
1929 | - |
1930 | - auto const size_limits = as_size(bounds.bottom_right() - top_left); |
1931 | - |
1932 | - if (new_size.width > size_limits.width) |
1933 | - new_size.width = size_limits.width; |
1934 | - |
1935 | - if (new_size.height > size_limits.height) |
1936 | - new_size.height = size_limits.height; |
1937 | - |
1938 | - surface->resize(new_size); |
1939 | - } |
1940 | -} |
1941 | - |
1942 | -std::shared_ptr<ms::Surface> me::TilingWindowManagerPolicy::select_active_surface(std::shared_ptr<ms::Session> const& session, std::shared_ptr<scene::Surface> const& surface) |
1943 | -{ |
1944 | - if (!surface) |
1945 | - { |
1946 | - tools->set_focus_to({}, {}); |
1947 | - return surface; |
1948 | - } |
1949 | - |
1950 | - auto const& info_for = tools->info_for(surface); |
1951 | - |
1952 | - if (info_for.can_be_active()) |
1953 | - { |
1954 | - tools->set_focus_to(session, surface); |
1955 | - tools->raise_tree(surface); |
1956 | - return surface; |
1957 | - } |
1958 | - else |
1959 | - { |
1960 | - // Cannot have input focus - try the parent |
1961 | - if (auto const parent = info_for.parent.lock()) |
1962 | - return select_active_surface(session, parent); |
1963 | - |
1964 | - return {}; |
1965 | - } |
1966 | -} |
1967 | |
1968 | === removed file 'examples/server_example_tiling_window_manager.h' |
1969 | --- examples/server_example_tiling_window_manager.h 2016-04-15 03:41:28 +0000 |
1970 | +++ examples/server_example_tiling_window_manager.h 1970-01-01 00:00:00 +0000 |
1971 | @@ -1,124 +0,0 @@ |
1972 | -/* |
1973 | - * Copyright © 2015 Canonical Ltd. |
1974 | - * |
1975 | - * This program is free software: you can redistribute it and/or modify it |
1976 | - * under the terms of the GNU General Public License version 3, |
1977 | - * as published by the Free Software Foundation. |
1978 | - * |
1979 | - * This program is distributed in the hope that it will be useful, |
1980 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1981 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1982 | - * GNU General Public License for more details. |
1983 | - * |
1984 | - * You should have received a copy of the GNU General Public License |
1985 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1986 | - * |
1987 | - * Authored By: Alan Griffiths <alan@octopull.co.uk> |
1988 | - */ |
1989 | - |
1990 | -#ifndef MIR_EXAMPLE_TILING_WINDOW_MANAGER_H_ |
1991 | -#define MIR_EXAMPLE_TILING_WINDOW_MANAGER_H_ |
1992 | - |
1993 | -#include "server_example_basic_window_manager.h" |
1994 | - |
1995 | -///\example server_example_tiling_window_manager.h |
1996 | -/// Demonstrate implementing a simple tiling algorithm |
1997 | - |
1998 | -namespace mir |
1999 | -{ |
2000 | -namespace examples |
2001 | -{ |
2002 | -// simple tiling algorithm: |
2003 | -// o Switch apps: tap or click on the corresponding tile |
2004 | -// o Move window: Alt-leftmousebutton drag (three finger drag) |
2005 | -// o Resize window: Alt-middle_button drag (two finger drag) |
2006 | -// o Maximize/restore current window (to tile size): Alt-F11 |
2007 | -// o Maximize/restore current window (to tile height): Shift-F11 |
2008 | -// o Maximize/restore current window (to tile width): Ctrl-F11 |
2009 | -// o client requests to maximize, vertically maximize & restore |
2010 | -class TilingWindowManagerPolicy : public WindowManagementPolicy |
2011 | -{ |
2012 | -public: |
2013 | - explicit TilingWindowManagerPolicy(WindowManagerTools* const tools); |
2014 | - |
2015 | - void click(geometry::Point cursor); |
2016 | - |
2017 | - void handle_session_info_updated(SessionInfoMap& session_info, geometry::Rectangles const& displays); |
2018 | - |
2019 | - void handle_displays_updated(SessionInfoMap& session_info, geometry::Rectangles const& displays); |
2020 | - |
2021 | - void resize(geometry::Point cursor); |
2022 | - |
2023 | - auto handle_place_new_surface( |
2024 | - std::shared_ptr<scene::Session> const& session, |
2025 | - scene::SurfaceCreationParameters const& request_parameters) |
2026 | - -> scene::SurfaceCreationParameters; |
2027 | - |
2028 | - void handle_new_surface(std::shared_ptr<scene::Session> const& session, std::shared_ptr<scene::Surface> const& surface); |
2029 | - |
2030 | - void handle_modify_surface( |
2031 | - std::shared_ptr<scene::Session> const& session, |
2032 | - std::shared_ptr<scene::Surface> const& surface, |
2033 | - shell::SurfaceSpecification const& modifications); |
2034 | - |
2035 | - void handle_delete_surface(std::shared_ptr<scene::Session> const& session, std::weak_ptr<scene::Surface> const& surface); |
2036 | - |
2037 | - int handle_set_state(std::shared_ptr<scene::Surface> const& surface, MirSurfaceState value); |
2038 | - |
2039 | - void drag(geometry::Point cursor); |
2040 | - |
2041 | - bool handle_keyboard_event(MirKeyboardEvent const* event); |
2042 | - |
2043 | - bool handle_touch_event(MirTouchEvent const* event); |
2044 | - |
2045 | - bool handle_pointer_event(MirPointerEvent const* event); |
2046 | - |
2047 | - void handle_raise_surface( |
2048 | - std::shared_ptr<scene::Session> const& session, |
2049 | - std::shared_ptr<scene::Surface> const& surface); |
2050 | - |
2051 | - void generate_decorations_for( |
2052 | - std::shared_ptr<scene::Session> const& session, std::shared_ptr<scene::Surface> const& surface, |
2053 | - SurfaceInfoMap& surface_info, |
2054 | - std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const&, scene::SurfaceCreationParameters const&)> const& build); |
2055 | - |
2056 | -private: |
2057 | - static const int modifier_mask = |
2058 | - mir_input_event_modifier_alt | |
2059 | - mir_input_event_modifier_shift | |
2060 | - mir_input_event_modifier_sym | |
2061 | - mir_input_event_modifier_ctrl | |
2062 | - mir_input_event_modifier_meta; |
2063 | - |
2064 | - void toggle(MirSurfaceState state); |
2065 | - |
2066 | - std::shared_ptr<scene::Session> session_under(geometry::Point position); |
2067 | - |
2068 | - void update_tiles( |
2069 | - SessionInfoMap& session_info, |
2070 | - geometry::Rectangles const& displays); |
2071 | - |
2072 | - void update_surfaces(std::weak_ptr<scene::Session> const& session, geometry::Rectangle const& old_tile, geometry::Rectangle const& new_tile); |
2073 | - |
2074 | - static void clip_to_tile(scene::SurfaceCreationParameters& parameters, geometry::Rectangle const& tile); |
2075 | - |
2076 | - static void fit_to_new_tile(scene::Surface& surface, geometry::Rectangle const& old_tile, geometry::Rectangle const& new_tile); |
2077 | - |
2078 | - void drag(std::shared_ptr<scene::Surface> surface, geometry::Point to, geometry::Point from, geometry::Rectangle bounds); |
2079 | - |
2080 | - static void resize(std::shared_ptr<scene::Surface> surface, geometry::Point cursor, geometry::Point old_cursor, geometry::Rectangle bounds); |
2081 | - |
2082 | - static void constrained_move(std::shared_ptr<scene::Surface> const& surface, geometry::Displacement& movement, geometry::Rectangle const& bounds); |
2083 | - |
2084 | - std::shared_ptr<scene::Surface> select_active_surface(std::shared_ptr<scene::Session> const& session, std::shared_ptr<scene::Surface> const& surface); |
2085 | - |
2086 | - WindowManagerTools* const tools; |
2087 | - |
2088 | - geometry::Point old_cursor{}; |
2089 | -}; |
2090 | - |
2091 | -using TilingWindowManager = WindowManagerBuilder<TilingWindowManagerPolicy>; |
2092 | -} |
2093 | -} |
2094 | - |
2095 | -#endif /* MIR_EXAMPLE_TILING_WINDOW_MANAGER_H_ */ |
2096 | |
2097 | === modified file 'examples/server_example_window_management.cpp' |
2098 | --- examples/server_example_window_management.cpp 2016-04-15 03:41:28 +0000 |
2099 | +++ examples/server_example_window_management.cpp 2016-08-12 14:07:23 +0000 |
2100 | @@ -18,7 +18,6 @@ |
2101 | |
2102 | #include "server_example_window_management.h" |
2103 | |
2104 | -#include "server_example_tiling_window_manager.h" |
2105 | #include "server_example_canonical_window_manager.h" |
2106 | |
2107 | #include "mir/abnormal_exit.h" |
2108 | @@ -44,9 +43,8 @@ |
2109 | namespace |
2110 | { |
2111 | char const* const wm_option = "window-manager"; |
2112 | -char const* const wm_description = "window management strategy [{tiling|fullscreen|canonical|system-compositor}]"; |
2113 | +char const* const wm_description = "window management strategy [{canonical|fullscreen|system-compositor}]"; |
2114 | |
2115 | -char const* const wm_tiling = "tiling"; |
2116 | char const* const wm_fullscreen = "fullscreen"; |
2117 | char const* const wm_canonical = "canonical"; |
2118 | char const* const wm_system_compositor = "system-compositor"; |
2119 | @@ -130,11 +128,7 @@ |
2120 | auto const options = server.get_options(); |
2121 | auto const selection = options->get<std::string>(wm_option); |
2122 | |
2123 | - if (selection == wm_tiling) |
2124 | - { |
2125 | - return std::make_shared<TilingWindowManager>(focus_controller); |
2126 | - } |
2127 | - else if (selection == wm_fullscreen) |
2128 | + if (selection == wm_fullscreen) |
2129 | { |
2130 | return std::make_shared<FullscreenWindowManager>(focus_controller, server.the_shell_display_layout()); |
2131 | } |
2132 | |
2133 | === modified file 'examples/server_example_window_management_info.cpp' |
2134 | --- examples/server_example_window_management_info.cpp 2016-04-27 11:53:16 +0000 |
2135 | +++ examples/server_example_window_management_info.cpp 2016-08-12 14:07:23 +0000 |
2136 | @@ -20,6 +20,7 @@ |
2137 | |
2138 | #include "mir/scene/surface.h" |
2139 | #include "mir/scene/surface_creation_parameters.h" |
2140 | +#include "mir/scene/session.h" |
2141 | |
2142 | #include "mir/graphics/buffer.h" |
2143 | |
2144 | @@ -172,6 +173,8 @@ |
2145 | buffer_stream{buffer_stream}, buffer{nullptr} |
2146 | { |
2147 | swap_buffers(nullptr); |
2148 | + if (!buffer) |
2149 | + throw std::runtime_error("no buffer after swap"); |
2150 | } |
2151 | |
2152 | void swap_buffers(graphics::Buffer* buf) |
2153 | @@ -204,55 +207,61 @@ |
2154 | struct mir::examples::SurfaceInfo::AllocatingPainter |
2155 | : mir::examples::SurfaceInfo::StreamPainter |
2156 | { |
2157 | - AllocatingPainter(std::shared_ptr<frontend::BufferStream> const& buffer_stream, Size size) : |
2158 | + AllocatingPainter( |
2159 | + std::shared_ptr<frontend::BufferStream> const& buffer_stream, |
2160 | + std::shared_ptr<scene::Session> const& session, |
2161 | + Size size) : |
2162 | buffer_stream(buffer_stream), |
2163 | + session(session), |
2164 | properties({ |
2165 | size, |
2166 | buffer_stream->pixel_format(), |
2167 | mg::BufferUsage::software |
2168 | }), |
2169 | - front_buffer(buffer_stream->allocate_buffer(properties)), |
2170 | - back_buffer(buffer_stream->allocate_buffer(properties)) |
2171 | + front_buffer(session->create_buffer(properties)), |
2172 | + back_buffer(session->create_buffer(properties)) |
2173 | { |
2174 | } |
2175 | |
2176 | void paint(int intensity) override |
2177 | { |
2178 | - buffer_stream->with_buffer(back_buffer, |
2179 | - [this, intensity](graphics::Buffer& buffer) |
2180 | - { |
2181 | - auto const format = buffer.pixel_format(); |
2182 | - auto const sz = buffer.size().height.as_int() * |
2183 | - buffer.size().width.as_int() * MIR_BYTES_PER_PIXEL(format); |
2184 | - std::vector<unsigned char> pixels(sz, intensity); |
2185 | - buffer.write(pixels.data(), sz); |
2186 | - buffer_stream->swap_buffers(&buffer, [](mg::Buffer*){}); |
2187 | - }); |
2188 | + auto buffer = session->get_buffer(back_buffer); |
2189 | + |
2190 | + auto const format = buffer->pixel_format(); |
2191 | + auto const sz = buffer->size().height.as_int() * |
2192 | + buffer->size().width.as_int() * MIR_BYTES_PER_PIXEL(format); |
2193 | + std::vector<unsigned char> pixels(sz, intensity); |
2194 | + buffer->write(pixels.data(), sz); |
2195 | + buffer_stream->swap_buffers(buffer.get(), [](mg::Buffer*){}); |
2196 | + |
2197 | std::swap(front_buffer, back_buffer); |
2198 | } |
2199 | |
2200 | ~AllocatingPainter() |
2201 | { |
2202 | - buffer_stream->remove_buffer(front_buffer); |
2203 | - buffer_stream->remove_buffer(back_buffer); |
2204 | + session->destroy_buffer(front_buffer); |
2205 | + session->destroy_buffer(back_buffer); |
2206 | } |
2207 | |
2208 | std::shared_ptr<frontend::BufferStream> const buffer_stream; |
2209 | + std::shared_ptr<scene::Session> const session; |
2210 | mg::BufferProperties properties; |
2211 | mg::BufferID front_buffer; |
2212 | mg::BufferID back_buffer; |
2213 | }; |
2214 | |
2215 | -void mir::examples::SurfaceInfo::init_titlebar(std::shared_ptr<scene::Surface> const& surface) |
2216 | +void mir::examples::SurfaceInfo::init_titlebar( |
2217 | + std::shared_ptr<scene::Session> const& session, |
2218 | + std::shared_ptr<scene::Surface> const& surface) |
2219 | { |
2220 | auto stream = surface->primary_buffer_stream(); |
2221 | try |
2222 | { |
2223 | - stream_painter = std::make_shared<AllocatingPainter>(stream, surface->size()); |
2224 | + stream_painter = std::make_shared<SwappingPainter>(stream); |
2225 | } |
2226 | catch (...) |
2227 | { |
2228 | - stream_painter = std::make_shared<SwappingPainter>(stream); |
2229 | + stream_painter = std::make_shared<AllocatingPainter>(stream, session, surface->size()); |
2230 | } |
2231 | } |
2232 | |
2233 | |
2234 | === modified file 'examples/server_example_window_management_info.h' |
2235 | --- examples/server_example_window_management_info.h 2016-04-15 03:41:28 +0000 |
2236 | +++ examples/server_example_window_management_info.h 2016-08-12 14:07:23 +0000 |
2237 | @@ -77,7 +77,9 @@ |
2238 | mir::optional_value<shell::SurfaceAspectRatio> max_aspect; |
2239 | mir::optional_value<graphics::DisplayConfigurationOutputId> output_id; |
2240 | |
2241 | - void init_titlebar(std::shared_ptr <scene::Surface> const& surface); |
2242 | + void init_titlebar( |
2243 | + std::shared_ptr<scene::Session> const& session, |
2244 | + std::shared_ptr<scene::Surface> const& surface); |
2245 | |
2246 | void paint_titlebar(int intensity); |
2247 | |
2248 | |
2249 | === modified file 'include/client/mir/event_printer.h' |
2250 | --- include/client/mir/event_printer.h 2015-05-19 21:34:34 +0000 |
2251 | +++ include/client/mir/event_printer.h 2016-08-12 14:07:23 +0000 |
2252 | @@ -47,6 +47,7 @@ |
2253 | std::ostream& operator<<(std::ostream& out, MirCloseSurfaceEvent const& event); |
2254 | std::ostream& operator<<(std::ostream& out, MirKeymapEvent const& event); |
2255 | std::ostream& operator<<(std::ostream& out, MirSurfaceEvent const& event); |
2256 | +std::ostream& operator<<(std::ostream& out, MirInputDeviceStateEvent const& event); |
2257 | std::ostream& operator<<(std::ostream& out, MirEvent const& event); |
2258 | |
2259 | } |
2260 | |
2261 | === modified file 'include/client/mir/events/event_builders.h' |
2262 | --- include/client/mir/events/event_builders.h 2016-01-29 08:18:22 +0000 |
2263 | +++ include/client/mir/events/event_builders.h 2016-08-12 14:07:23 +0000 |
2264 | @@ -133,6 +133,20 @@ |
2265 | // Input configuration event |
2266 | EventUPtr make_event(MirInputConfigurationAction action, |
2267 | MirInputDeviceId id, std::chrono::nanoseconds time); |
2268 | + |
2269 | +struct InputDeviceState |
2270 | +{ |
2271 | + MirInputDeviceId id; |
2272 | + std::vector<uint32_t> pressed_keys; |
2273 | + MirPointerButtons buttons; |
2274 | +}; |
2275 | + |
2276 | +EventUPtr make_event(std::chrono::nanoseconds timestamp, |
2277 | + MirPointerButtons pointer_buttons, |
2278 | + MirInputEventModifiers modifiers, |
2279 | + float x_axis_value, |
2280 | + float y_axis_value, |
2281 | + std::vector<InputDeviceState>&& device_states); |
2282 | } |
2283 | } |
2284 | |
2285 | |
2286 | === modified file 'include/client/mir_toolkit/client_types.h' |
2287 | --- include/client/mir_toolkit/client_types.h 2016-04-29 16:12:21 +0000 |
2288 | +++ include/client/mir_toolkit/client_types.h 2016-08-12 14:07:23 +0000 |
2289 | @@ -200,7 +200,8 @@ |
2290 | typedef enum MirPlatformType |
2291 | { |
2292 | mir_platform_type_gbm, |
2293 | - mir_platform_type_android |
2294 | + mir_platform_type_android, |
2295 | + mir_platform_type_eglstream, |
2296 | } MirPlatformType; |
2297 | |
2298 | typedef struct MirPlatformPackage |
2299 | |
2300 | === modified file 'include/client/mir_toolkit/events/event.h' |
2301 | --- include/client/mir_toolkit/events/event.h 2016-03-29 23:37:32 +0000 |
2302 | +++ include/client/mir_toolkit/events/event.h 2016-08-12 14:07:23 +0000 |
2303 | @@ -46,6 +46,7 @@ |
2304 | mir_event_type_keymap, |
2305 | mir_event_type_input_configuration, |
2306 | mir_event_type_surface_output, |
2307 | + mir_event_type_input_device_state, |
2308 | } MirEventType; |
2309 | |
2310 | typedef struct MirSurfaceEvent MirSurfaceEvent; |
2311 | @@ -57,6 +58,7 @@ |
2312 | typedef struct MirKeymapEvent MirKeymapEvent; |
2313 | typedef struct MirInputConfigurationEvent MirInputConfigurationEvent; |
2314 | typedef struct MirSurfaceOutputEvent MirSurfaceOutputEvent; |
2315 | +typedef struct MirInputDeviceStateEvent MirInputDeviceStateEvent; |
2316 | |
2317 | typedef struct MirCookie MirCookie; |
2318 | |
2319 | @@ -75,6 +77,7 @@ |
2320 | #include "mir_toolkit/events/keymap_event.h" |
2321 | #include "mir_toolkit/events/input_configuration_event.h" |
2322 | #include "mir_toolkit/events/surface_output_event.h" |
2323 | +#include "mir_toolkit/events/input_device_state_event.h" |
2324 | |
2325 | #ifdef __cplusplus |
2326 | /** |
2327 | @@ -195,6 +198,17 @@ |
2328 | */ |
2329 | MirSurfaceOutputEvent const* mir_event_get_surface_output_event(MirEvent const* ev); |
2330 | |
2331 | +/** |
2332 | + * Retrieve the MirInputDeviceStateEvent associated with a MirEvent of |
2333 | + * type mir_event_type_input_device_state. The event signifies that the |
2334 | + * client has not received the most recent input events, and thus receives |
2335 | + * a state update for all attached devices. |
2336 | + * |
2337 | + * \param [in] event The event |
2338 | + * \return The associated MirInputConfigurationEvent |
2339 | + */ |
2340 | +MirInputDeviceStateEvent const* mir_event_get_input_device_state_event(MirEvent const* ev); |
2341 | + |
2342 | /* |
2343 | * |
2344 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2345 | |
2346 | === added file 'include/client/mir_toolkit/events/input_device_state_event.h' |
2347 | --- include/client/mir_toolkit/events/input_device_state_event.h 1970-01-01 00:00:00 +0000 |
2348 | +++ include/client/mir_toolkit/events/input_device_state_event.h 2016-08-12 14:07:23 +0000 |
2349 | @@ -0,0 +1,135 @@ |
2350 | +/* |
2351 | + * Copyright © 2016 Canonical Ltd. |
2352 | + * |
2353 | + * This program is free software: you can redistribute it and/or modify it |
2354 | + * under the terms of the GNU Lesser General Public License version 3, |
2355 | + * as published by the Free Software Foundation. |
2356 | + * |
2357 | + * This program is distributed in the hope that it will be useful, |
2358 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2359 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2360 | + * GNU Lesser General Public License for more details. |
2361 | + * |
2362 | + * You should have received a copy of the GNU Lesser General Public License |
2363 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2364 | + * |
2365 | + * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
2366 | + */ |
2367 | + |
2368 | +#ifndef MIR_TOOLKIT_EVENTS_INPUT_DEVICE_STATE_EVENT_H_ |
2369 | +#define MIR_TOOLKIT_EVENTS_INPUT_DEVICE_STATE_EVENT_H_ |
2370 | + |
2371 | +#include <mir_toolkit/events/event.h> |
2372 | + |
2373 | +#ifdef __cplusplus |
2374 | +/** |
2375 | + * \addtogroup mir_toolkit |
2376 | + * @{ |
2377 | + */ |
2378 | +extern "C" { |
2379 | +#endif |
2380 | + |
2381 | +/** |
2382 | + * MirInputDeviceStateEvent informs clients about the current state of the |
2383 | + * input devices. This is necessary when the client did not receive the most |
2384 | + * recent input events. The event is sent when the server was resumed after |
2385 | + * a pause, or when the client just received the input focus. |
2386 | + * |
2387 | + * The event contains a single pointer button state and the current cursor |
2388 | + * position and the pressed modifier keys. Additionally for key and pointer |
2389 | + * devices the pressed keys and buttons are supplied individually. |
2390 | + */ |
2391 | + |
2392 | +/** |
2393 | + * Retrieve the button state. |
2394 | + * |
2395 | + * \param[in] ev The input device state event |
2396 | + * \return The combined pointer button state |
2397 | + */ |
2398 | +MirPointerButtons mir_input_device_state_event_pointer_buttons( |
2399 | + MirInputDeviceStateEvent const* ev); |
2400 | + |
2401 | +/** |
2402 | + * Retrieve the pointer position |
2403 | + * |
2404 | + * \param[in] ev The input device state event |
2405 | + * \param[in] axis The pointer axis: mir_pointer_axis_x or mir_pointer_axis_y |
2406 | + * \return The pointer position |
2407 | + */ |
2408 | +float mir_input_device_state_event_pointer_axis( |
2409 | + MirInputDeviceStateEvent const* ev, MirPointerAxis axis); |
2410 | + |
2411 | +/** |
2412 | + * Retrieve the time associated with a MirInputDeviceStateEvent |
2413 | + * |
2414 | + * \param[in] ev The input device state event |
2415 | + * \return The time in nanoseconds since epoch |
2416 | + */ |
2417 | +int64_t mir_input_device_state_event_time( |
2418 | + MirInputDeviceStateEvent const* ev); |
2419 | + |
2420 | +/** |
2421 | + * Retrieve the modifier keys pressed on all input devices. |
2422 | + * |
2423 | + * \param[in] ev The input device state event |
2424 | + * \return The modifier mask |
2425 | + */ |
2426 | +MirInputEventModifiers mir_input_device_state_event_modifiers( |
2427 | + MirInputDeviceStateEvent const* ev); |
2428 | + |
2429 | +/** |
2430 | + * Retrieve the number of attached input devices. |
2431 | + * |
2432 | + * \param[in] ev The input device state event |
2433 | + * \return The time in nanoseconds since epoch |
2434 | + */ |
2435 | +uint32_t mir_input_device_state_event_device_count( |
2436 | + MirInputDeviceStateEvent const* ev); |
2437 | + |
2438 | +/** |
2439 | + * Retrieve the device id |
2440 | + * |
2441 | + * \param[in] ev The input device state event |
2442 | + * \param[in] index The index of the input device |
2443 | + * \return The device id |
2444 | + */ |
2445 | +MirInputDeviceId mir_input_device_state_event_device_id( |
2446 | + MirInputDeviceStateEvent const* ev, uint32_t index); |
2447 | + |
2448 | +/** |
2449 | + * Retrieve an array of pressed keys on the device identified by the \a index. |
2450 | + * The keys are encoded as scan codes. |
2451 | + * |
2452 | + * \param[in] ev The input device state event |
2453 | + * \param[in] index The index of the input device |
2454 | + * \return An array of pressed keys |
2455 | + */ |
2456 | +uint32_t const* mir_input_device_state_event_device_pressed_keys( |
2457 | + MirInputDeviceStateEvent const* ev, uint32_t index); |
2458 | + |
2459 | +/** |
2460 | + * Retrieve the size of scan code array of the device identified by the \a index. |
2461 | + * |
2462 | + * \param[in] ev The input device state event |
2463 | + * \param[in] index The index of the input device |
2464 | + * \return Size of the pressed keys array |
2465 | + */ |
2466 | +uint32_t mir_input_device_state_event_device_pressed_keys_count( |
2467 | + MirInputDeviceStateEvent const* ev, uint32_t index); |
2468 | + |
2469 | +/** |
2470 | + * Retrieve the pointer button state of the device identified by the \a index |
2471 | + * |
2472 | + * \param[in] ev The input device state event |
2473 | + * \param[in] index The index of the input device |
2474 | + * \return The pointer button state of the device |
2475 | + */ |
2476 | +MirPointerButtons mir_input_device_state_event_device_pointer_buttons( |
2477 | + MirInputDeviceStateEvent const* ev, uint32_t index); |
2478 | + |
2479 | +#ifdef __cplusplus |
2480 | +} |
2481 | +/**@}*/ |
2482 | +#endif |
2483 | + |
2484 | +#endif /* MIR_TOOLKIT_EVENTS_INPUT_DEVICE_STATE_EVENT_H_ */ |
2485 | |
2486 | === modified file 'include/client/mir_toolkit/events/surface_output_event.h' |
2487 | --- include/client/mir_toolkit/events/surface_output_event.h 2016-01-29 08:18:22 +0000 |
2488 | +++ include/client/mir_toolkit/events/surface_output_event.h 2016-08-12 14:07:23 +0000 |
2489 | @@ -46,10 +46,11 @@ |
2490 | MirFormFactor mir_surface_output_event_get_form_factor(MirSurfaceOutputEvent const* ev); |
2491 | |
2492 | /** |
2493 | - * Retrieve the form factor of the new output configuration of a MirSurfaceOutputEvent |
2494 | + * Retrieve the suggested scaling factor of the new output configuration of a |
2495 | + * MirSurfaceOutputEvent. |
2496 | * |
2497 | * \param [in] ev The event |
2498 | - * \return The new form factor of the output the surface is primarily on. |
2499 | + * \return The new scaling factor of the output the surface is primarily on. |
2500 | */ |
2501 | float mir_surface_output_event_get_scale(MirSurfaceOutputEvent const* ev); |
2502 | |
2503 | |
2504 | === modified file 'include/client/mir_toolkit/mir_surface.h' |
2505 | --- include/client/mir_toolkit/mir_surface.h 2016-03-23 06:39:56 +0000 |
2506 | +++ include/client/mir_toolkit/mir_surface.h 2016-08-12 14:07:23 +0000 |
2507 | @@ -521,6 +521,16 @@ |
2508 | void mir_surface_spec_set_shell_chrome(MirSurfaceSpec* spec, MirShellChrome style); |
2509 | |
2510 | /** |
2511 | + * Attempts to set the pointer confinement spec for this surface |
2512 | + * |
2513 | + * This will request the window manager to confine the pointer to the surfaces region. |
2514 | + * |
2515 | + * \param [in] spec The spec to accumulate the request in. |
2516 | + * \param [in] state The state you would like the pointer confinement to be in. |
2517 | + */ |
2518 | +void mir_surface_spec_set_pointer_confinement(MirSurfaceSpec* spec, MirPointerConfinementState state); |
2519 | + |
2520 | +/** |
2521 | * Set the event handler to be called when events arrive for a surface. |
2522 | * \warning event_handler could be called from another thread. You must do |
2523 | * any locking appropriate to protect your data accessed in the |
2524 | @@ -538,7 +548,14 @@ |
2525 | /** |
2526 | * Retrieve the primary MirBufferStream associated with a surface (to advance buffers, |
2527 | * obtain EGLNativeWindow, etc...) |
2528 | - * |
2529 | + * |
2530 | + * \deprecated Users should use mir_surface_spec_set_streams() to arrange |
2531 | + * the content of a surface, instead of relying on a stream |
2532 | + * being created by default. |
2533 | + * \warning If the surface was created with, or modified to have a |
2534 | + * MirSurfaceSpec containing streams added through |
2535 | + * mir_surface_spec_set_streams(), the default stream will |
2536 | + * be removed, and this function will return NULL. |
2537 | * \param[in] surface The surface |
2538 | */ |
2539 | MirBufferStream* mir_surface_get_buffer_stream(MirSurface *surface); |
2540 | @@ -618,9 +635,13 @@ |
2541 | MirSurfaceState mir_surface_get_state(MirSurface *surface); |
2542 | |
2543 | /** |
2544 | - * Set the swapinterval for mir_surface_swap_buffers. EGL users should use |
2545 | - * eglSwapInterval directly. |
2546 | - * At the time being, only swapinterval of 0 or 1 is supported. |
2547 | + * Set the swapinterval for the default stream. |
2548 | + * \warning EGL users should use eglSwapInterval directly. |
2549 | + * \warning Only swapinterval of 0 or 1 is supported. |
2550 | + * \warning If the surface was created with, or modified to have a |
2551 | + * MirSurfaceSpec containing streams added through |
2552 | + * mir_surface_spec_set_streams(), the default stream will |
2553 | + * be removed, and this function will return NULL. |
2554 | * \param [in] surface The surface to operate on |
2555 | * \param [in] interval The number of vblank signals that |
2556 | * mir_surface_swap_buffers will wait for |
2557 | @@ -634,7 +655,8 @@ |
2558 | * The default interval is 1. |
2559 | * \param [in] surface The surface to operate on |
2560 | * \return The swapinterval value that the client is operating with. |
2561 | - * Returns -1 if surface is invalid. |
2562 | + * Returns -1 if surface is invalid, or if the default stream |
2563 | + * was removed by use of mir_surface_spec_set_streams(). |
2564 | */ |
2565 | int mir_surface_get_swapinterval(MirSurface* surface); |
2566 | |
2567 | |
2568 | === modified file 'include/common/mir/geometry/dimensions.h' |
2569 | --- include/common/mir/geometry/dimensions.h 2016-04-26 10:37:20 +0000 |
2570 | +++ include/common/mir/geometry/dimensions.h 2016-08-12 14:07:23 +0000 |
2571 | @@ -55,11 +55,6 @@ |
2572 | return value; |
2573 | } |
2574 | |
2575 | - constexpr float as_float() const |
2576 | - { |
2577 | - return value; |
2578 | - } |
2579 | - |
2580 | private: |
2581 | ValueType value; |
2582 | }; |
2583 | |
2584 | === added directory 'include/common/mir/input' |
2585 | === added file 'include/common/mir/input/keymap.h' |
2586 | --- include/common/mir/input/keymap.h 1970-01-01 00:00:00 +0000 |
2587 | +++ include/common/mir/input/keymap.h 2016-08-12 14:07:23 +0000 |
2588 | @@ -0,0 +1,73 @@ |
2589 | +/* |
2590 | + * Copyright © 2016 Canonical Ltd. |
2591 | + * |
2592 | + * This program is free software: you can redistribute it and/or modify it |
2593 | + * under the terms of the GNU Lesser General Public License version 3, |
2594 | + * as published by the Free Software Foundation. |
2595 | + * |
2596 | + * This program is distributed in the hope that it will be useful, |
2597 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2598 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2599 | + * GNU Lesser General Public License for more details. |
2600 | + * |
2601 | + * You should have received a copy of the GNU Lesser General Public License |
2602 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2603 | + * |
2604 | + * Authored by: |
2605 | + * Andreas Pokorny <andreas.pokorny@canonical.com> |
2606 | + */ |
2607 | + |
2608 | +#ifndef MIR_INPUT_KEYMAP_H_ |
2609 | +#define MIR_INPUT_KEYMAP_H_ |
2610 | + |
2611 | +#include <string> |
2612 | + |
2613 | +namespace mir |
2614 | +{ |
2615 | +namespace input |
2616 | +{ |
2617 | + |
2618 | +struct Keymap |
2619 | +{ |
2620 | + Keymap() = default; |
2621 | + Keymap(std::string&& model, |
2622 | + std::string&& layout, |
2623 | + std::string&& variant, |
2624 | + std::string&& options) |
2625 | + : model{model}, layout{layout}, variant{variant}, options{options} |
2626 | + { |
2627 | + } |
2628 | + |
2629 | + Keymap(std::string const& model, |
2630 | + std::string const& layout, |
2631 | + std::string const& variant, |
2632 | + std::string const& options) |
2633 | + : model{model}, layout{layout}, variant{variant}, options{options} |
2634 | + { |
2635 | + } |
2636 | + |
2637 | + std::string model{"pc105+inet"}; |
2638 | + std::string layout{"us"}; |
2639 | + std::string variant; |
2640 | + std::string options; |
2641 | + |
2642 | +}; |
2643 | + |
2644 | +inline bool operator==(Keymap const& lhs, Keymap const& rhs) |
2645 | +{ |
2646 | + return lhs.model == rhs.model && |
2647 | + lhs.layout == rhs.layout && |
2648 | + lhs.variant == rhs.variant && |
2649 | + lhs.options == rhs.options; |
2650 | +} |
2651 | + |
2652 | +inline bool operator!=(Keymap const& lhs, Keymap const& rhs) |
2653 | +{ |
2654 | + return !(lhs == rhs); |
2655 | +} |
2656 | + |
2657 | +} |
2658 | +} |
2659 | + |
2660 | +#endif |
2661 | + |
2662 | |
2663 | === modified file 'include/common/mir/optional_value.h' |
2664 | --- include/common/mir/optional_value.h 2016-03-25 20:55:55 +0000 |
2665 | +++ include/common/mir/optional_value.h 2016-08-12 14:07:23 +0000 |
2666 | @@ -39,7 +39,14 @@ |
2667 | } |
2668 | |
2669 | bool is_set() const { return is_set_; } |
2670 | - T value() const |
2671 | + |
2672 | + T const& value() const |
2673 | + { |
2674 | + die_if_unset(); |
2675 | + return value_; |
2676 | + } |
2677 | + |
2678 | + T& value() |
2679 | { |
2680 | die_if_unset(); |
2681 | return value_; |
2682 | |
2683 | === modified file 'include/common/mir_toolkit/common.h' |
2684 | --- include/common/mir_toolkit/common.h 2016-03-28 23:15:00 +0000 |
2685 | +++ include/common/mir_toolkit/common.h 2016-08-12 14:07:23 +0000 |
2686 | @@ -221,6 +221,16 @@ |
2687 | mir_shell_chrome_low, |
2688 | } MirShellChrome; |
2689 | |
2690 | +/** |
2691 | + * Pointer Confinement |
2692 | + */ |
2693 | + |
2694 | +typedef enum MirPointerConfinementState |
2695 | +{ |
2696 | + mir_pointer_unconfined, |
2697 | + mir_pointer_confined_to_surface, |
2698 | +} MirPointerConfinementState; |
2699 | + |
2700 | /**@}*/ |
2701 | |
2702 | #endif |
2703 | |
2704 | === modified file 'include/platform/mir/graphics/platform.h' |
2705 | --- include/platform/mir/graphics/platform.h 2016-01-29 08:18:22 +0000 |
2706 | +++ include/platform/mir/graphics/platform.h 2016-08-12 14:07:23 +0000 |
2707 | @@ -21,7 +21,6 @@ |
2708 | #define MIR_GRAPHICS_PLATFORM_H_ |
2709 | |
2710 | #include <boost/program_options/options_description.hpp> |
2711 | -#include <EGL/egl.h> |
2712 | |
2713 | #include "mir/module_properties.h" |
2714 | #include "mir/module_deleter.h" |
2715 | @@ -89,8 +88,6 @@ |
2716 | * before they are sent or after they are recieved accross IPC |
2717 | */ |
2718 | virtual UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const = 0; |
2719 | - |
2720 | - virtual EGLNativeDisplayType egl_native_display() const = 0; |
2721 | }; |
2722 | |
2723 | /** |
2724 | |
2725 | === modified file 'include/platform/mir/input/event_builder.h' |
2726 | --- include/platform/mir/input/event_builder.h 2016-01-29 08:18:22 +0000 |
2727 | +++ include/platform/mir/input/event_builder.h 2016-08-12 14:07:23 +0000 |
2728 | @@ -51,6 +51,8 @@ |
2729 | |
2730 | virtual EventUPtr configuration_event(Timestamp timestamp, MirInputConfigurationAction action) = 0; |
2731 | |
2732 | + virtual EventUPtr device_state_event(float cursor_x, float cursor_y) = 0; |
2733 | + |
2734 | protected: |
2735 | EventBuilder(EventBuilder const&) = delete; |
2736 | EventBuilder& operator=(EventBuilder const&) = delete; |
2737 | |
2738 | === modified file 'include/platform/mir/input/input_sink.h' |
2739 | --- include/platform/mir/input/input_sink.h 2016-01-29 08:18:22 +0000 |
2740 | +++ include/platform/mir/input/input_sink.h 2016-08-12 14:07:23 +0000 |
2741 | @@ -24,6 +24,8 @@ |
2742 | #include "mir/geometry/rectangle.h" |
2743 | #include "mir/geometry/displacement.h" |
2744 | |
2745 | +#include <vector> |
2746 | + |
2747 | namespace mir |
2748 | { |
2749 | namespace input |
2750 | @@ -39,6 +41,26 @@ |
2751 | */ |
2752 | virtual mir::geometry::Rectangle bounding_rectangle() const = 0; |
2753 | |
2754 | + /** |
2755 | + * \name Device State interface of InputSink |
2756 | + * |
2757 | + * In scenarios in which the system is not capable of receiving all changes as they occur, |
2758 | + * these method should be used to update the input device state as needed |
2759 | + * \{ |
2760 | + */ |
2761 | + /** |
2762 | + * Set all pressed scan codes. |
2763 | + * \param scan_codes currently pressed |
2764 | + */ |
2765 | + virtual void key_state(std::vector<uint32_t> const& scan_codes) = 0; |
2766 | + /** |
2767 | + * Set button state of a pointing device. |
2768 | + * \param buttons mask of the buttons currently pressed |
2769 | + */ |
2770 | + virtual void pointer_state(MirPointerButtons buttons) = 0; |
2771 | + /** |
2772 | + * \} |
2773 | + */ |
2774 | private: |
2775 | InputSink(InputSink const&) = delete; |
2776 | InputSink& operator=(InputSink const&) = delete; |
2777 | |
2778 | === modified file 'include/server/mir/frontend/buffer_sink.h' |
2779 | --- include/server/mir/frontend/buffer_sink.h 2016-03-22 17:00:04 +0000 |
2780 | +++ include/server/mir/frontend/buffer_sink.h 2016-08-12 14:07:23 +0000 |
2781 | @@ -21,6 +21,8 @@ |
2782 | |
2783 | #include "mir/frontend/buffer_stream_id.h" |
2784 | #include "mir/graphics/platform_ipc_operations.h" |
2785 | +#include "mir/graphics/buffer_properties.h" |
2786 | +#include <string> |
2787 | |
2788 | namespace mir |
2789 | { |
2790 | @@ -34,6 +36,7 @@ |
2791 | |
2792 | virtual void send_buffer(frontend::BufferStreamId id, graphics::Buffer& buffer, graphics::BufferIpcMsgType) = 0; |
2793 | virtual void add_buffer(graphics::Buffer&) = 0; |
2794 | + virtual void error_buffer(graphics::BufferProperties const&, std::string const&) = 0; |
2795 | virtual void remove_buffer(graphics::Buffer&) = 0; |
2796 | virtual void update_buffer(graphics::Buffer&) = 0; |
2797 | |
2798 | |
2799 | === modified file 'include/server/mir/frontend/buffer_stream.h' |
2800 | --- include/server/mir/frontend/buffer_stream.h 2016-01-29 08:18:22 +0000 |
2801 | +++ include/server/mir/frontend/buffer_stream.h 2016-08-12 14:07:23 +0000 |
2802 | @@ -54,9 +54,13 @@ |
2803 | |
2804 | virtual MirPixelFormat pixel_format() const = 0; |
2805 | |
2806 | - virtual graphics::BufferID allocate_buffer(graphics::BufferProperties const&) = 0; |
2807 | - virtual void remove_buffer(graphics::BufferID) = 0; |
2808 | - virtual void with_buffer(graphics::BufferID id, std::function<void(graphics::Buffer&)> const& fn) = 0; |
2809 | + //TODO: associate/disassociate_buffer are only used for timeout framedropping policy decisions. |
2810 | + // They will be removed once timeout framedropping policy moves to the client side. |
2811 | + virtual void associate_buffer(graphics::BufferID) = 0; |
2812 | + virtual void disassociate_buffer(graphics::BufferID) = 0; |
2813 | + |
2814 | + //TODO: framedropping for swapinterval-0 can probably be effectively managed from the client |
2815 | + // side once we only support the NBS system. |
2816 | virtual void allow_framedropping(bool) = 0; |
2817 | virtual void set_scale(float scale) = 0; |
2818 | protected: |
2819 | |
2820 | === renamed file 'src/include/server/mir/frontend/client_buffers.h' => 'include/server/mir/frontend/client_buffers.h' |
2821 | === modified file 'include/server/mir/frontend/session.h' |
2822 | --- include/server/mir/frontend/session.h 2016-03-23 06:39:56 +0000 |
2823 | +++ include/server/mir/frontend/session.h 2016-08-12 14:07:23 +0000 |
2824 | @@ -21,6 +21,7 @@ |
2825 | |
2826 | #include "mir_toolkit/common.h" |
2827 | #include "mir/frontend/surface_id.h" |
2828 | +#include "mir/graphics/buffer_id.h" |
2829 | #include "mir/frontend/buffer_stream_id.h" |
2830 | |
2831 | #include <memory> |
2832 | @@ -32,6 +33,7 @@ |
2833 | { |
2834 | class DisplayConfiguration; |
2835 | struct BufferProperties; |
2836 | +class Buffer; |
2837 | } |
2838 | |
2839 | namespace frontend |
2840 | @@ -50,6 +52,10 @@ |
2841 | virtual BufferStreamId create_buffer_stream(graphics::BufferProperties const& props) = 0; |
2842 | virtual void destroy_buffer_stream(BufferStreamId stream) = 0; |
2843 | |
2844 | + virtual graphics::BufferID create_buffer(graphics::BufferProperties const& properties) = 0; |
2845 | + virtual void destroy_buffer(graphics::BufferID) = 0; |
2846 | + virtual std::shared_ptr<graphics::Buffer> get_buffer(graphics::BufferID) = 0; |
2847 | + |
2848 | virtual std::string name() const = 0; |
2849 | |
2850 | virtual void send_display_config(graphics::DisplayConfiguration const&) = 0; |
2851 | |
2852 | === modified file 'include/server/mir/input/device.h' |
2853 | --- include/server/mir/input/device.h 2016-01-29 08:18:22 +0000 |
2854 | +++ include/server/mir/input/device.h 2016-08-12 14:07:23 +0000 |
2855 | @@ -33,6 +33,7 @@ |
2856 | |
2857 | class PointerConfiguration; |
2858 | class TouchpadConfiguration; |
2859 | +class KeyboardConfiguration; |
2860 | |
2861 | class Device |
2862 | { |
2863 | @@ -50,6 +51,8 @@ |
2864 | virtual mir::optional_value<TouchpadConfiguration> touchpad_configuration() const = 0; |
2865 | virtual void apply_touchpad_configuration(TouchpadConfiguration const&) = 0; |
2866 | |
2867 | + virtual optional_value<KeyboardConfiguration> keyboard_configuration() const = 0; |
2868 | + virtual void apply_keyboard_configuration(KeyboardConfiguration const&) = 0; |
2869 | private: |
2870 | Device(Device const&) = delete; |
2871 | Device& operator=(Device const&) = delete; |
2872 | |
2873 | === added file 'include/server/mir/input/keyboard_configuration.h' |
2874 | --- include/server/mir/input/keyboard_configuration.h 1970-01-01 00:00:00 +0000 |
2875 | +++ include/server/mir/input/keyboard_configuration.h 2016-08-12 14:07:23 +0000 |
2876 | @@ -0,0 +1,49 @@ |
2877 | +/* |
2878 | + * Copyright © 2016 Canonical Ltd. |
2879 | + * |
2880 | + * This program is free software: you can redistribute it and/or modify it |
2881 | + * under the terms of the GNU General Public License version 3, |
2882 | + * as published by the Free Software Foundation. |
2883 | + * |
2884 | + * This program is distributed in the hope that it will be useful, |
2885 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2886 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2887 | + * GNU General Public License for more details. |
2888 | + * |
2889 | + * You should have received a copy of the GNU General Public License |
2890 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2891 | + * |
2892 | + * Authored by: |
2893 | + * Andreas Pokorny <andreas.pokorny@canonical.com> |
2894 | + */ |
2895 | + |
2896 | +#ifndef MIR_INPUT_KEYBOARD_CONFIGURATION_H_ |
2897 | +#define MIR_INPUT_KEYBOARD_CONFIGURATION_H_ |
2898 | + |
2899 | +#include "mir_toolkit/common.h" |
2900 | +#include "mir_toolkit/mir_input_device.h" |
2901 | +#include "mir/input/keymap.h" |
2902 | + |
2903 | +namespace mir |
2904 | +{ |
2905 | +namespace input |
2906 | +{ |
2907 | + |
2908 | +/* |
2909 | + * Keyboard device configuration. |
2910 | + */ |
2911 | +struct KeyboardConfiguration |
2912 | +{ |
2913 | + KeyboardConfiguration() = default; |
2914 | + KeyboardConfiguration(Keymap&& keymap) |
2915 | + : device_keymap{keymap} |
2916 | + { |
2917 | + } |
2918 | + |
2919 | + Keymap device_keymap; |
2920 | +}; |
2921 | + |
2922 | +} |
2923 | +} |
2924 | + |
2925 | +#endif |
2926 | |
2927 | === added file 'include/server/mir/scene/application_not_responding_detector_wrapper.h' |
2928 | --- include/server/mir/scene/application_not_responding_detector_wrapper.h 1970-01-01 00:00:00 +0000 |
2929 | +++ include/server/mir/scene/application_not_responding_detector_wrapper.h 2016-08-12 14:07:23 +0000 |
2930 | @@ -0,0 +1,49 @@ |
2931 | +/* |
2932 | + * Copyright © 2016 Canonical Ltd. |
2933 | + * |
2934 | + * This program is free software: you can redistribute it and/or modify it |
2935 | + * under the terms of the GNU General Public License version 3, |
2936 | + * as published by the Free Software Foundation. |
2937 | + * |
2938 | + * This program is distributed in the hope that it will be useful, |
2939 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2940 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2941 | + * GNU General Public License for more details. |
2942 | + * |
2943 | + * You should have received a copy of the GNU General Public License |
2944 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2945 | + * |
2946 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2947 | + */ |
2948 | + |
2949 | +#ifndef MIR_SCENE_APPLICATION_NOT_RESPONDING_DETECTOR_WRAPPER_H_ |
2950 | +#define MIR_SCENE_APPLICATION_NOT_RESPONDING_DETECTOR_WRAPPER_H_ |
2951 | + |
2952 | +#include "mir/scene/application_not_responding_detector.h" |
2953 | + |
2954 | +#include <memory> |
2955 | + |
2956 | +namespace mir |
2957 | +{ |
2958 | +namespace scene |
2959 | +{ |
2960 | +class ApplicationNotRespondingDetectorWrapper : public ApplicationNotRespondingDetector |
2961 | +{ |
2962 | +public: |
2963 | + ApplicationNotRespondingDetectorWrapper(std::shared_ptr<ApplicationNotRespondingDetector> const& wrapped); |
2964 | + ~ApplicationNotRespondingDetectorWrapper(); |
2965 | + |
2966 | + virtual void register_session(frontend::Session const* session, std::function<void()> const& pinger) override; |
2967 | + virtual void unregister_session(frontend::Session const* session) override; |
2968 | + virtual void pong_received(frontend::Session const* received_for) override; |
2969 | + virtual void register_observer(std::shared_ptr<Observer> const& observer) override; |
2970 | + virtual void unregister_observer(std::shared_ptr<Observer> const& observer) override; |
2971 | + |
2972 | +protected: |
2973 | + std::shared_ptr<ApplicationNotRespondingDetector> const wrapped; |
2974 | +}; |
2975 | +} |
2976 | +} |
2977 | + |
2978 | + |
2979 | +#endif //MIR_SCENE_APPLICATION_NOT_RESPONDING_DETECTOR_WRAPPER_H_ |
2980 | |
2981 | === modified file 'include/server/mir/scene/buffer_stream_factory.h' |
2982 | --- include/server/mir/scene/buffer_stream_factory.h 2016-01-29 08:18:22 +0000 |
2983 | +++ include/server/mir/scene/buffer_stream_factory.h 2016-08-12 14:07:23 +0000 |
2984 | @@ -28,7 +28,7 @@ |
2985 | { |
2986 | namespace compositor { class BufferStream; } |
2987 | namespace graphics { struct BufferProperties; } |
2988 | -namespace frontend { class BufferSink; } |
2989 | +namespace frontend { class ClientBuffers; class BufferSink; } |
2990 | namespace scene |
2991 | { |
2992 | class BufferStreamFactory |
2993 | @@ -37,11 +37,13 @@ |
2994 | virtual ~BufferStreamFactory() = default; |
2995 | |
2996 | virtual std::shared_ptr<compositor::BufferStream> create_buffer_stream( |
2997 | - frontend::BufferStreamId, std::shared_ptr<frontend::BufferSink> const& sink, |
2998 | + frontend::BufferStreamId, std::shared_ptr<frontend::ClientBuffers> const& sink, |
2999 | int nbuffers, graphics::BufferProperties const& buffer_properties) = 0; |
3000 | virtual std::shared_ptr<compositor::BufferStream> create_buffer_stream( |
3001 | - frontend::BufferStreamId, std::shared_ptr<frontend::BufferSink> const& sink, |
3002 | + frontend::BufferStreamId, std::shared_ptr<frontend::ClientBuffers> const& sink, |
3003 | graphics::BufferProperties const& buffer_properties) = 0; |
3004 | + virtual std::shared_ptr<frontend::ClientBuffers> create_buffer_map( |
3005 | + std::shared_ptr<frontend::BufferSink> const& sink) = 0; |
3006 | |
3007 | protected: |
3008 | BufferStreamFactory() = default; |
3009 | |
3010 | === modified file 'include/server/mir/scene/session.h' |
3011 | --- include/server/mir/scene/session.h 2016-04-06 08:44:01 +0000 |
3012 | +++ include/server/mir/scene/session.h 2016-08-12 14:07:23 +0000 |
3013 | @@ -68,6 +68,10 @@ |
3014 | virtual void configure_streams(Surface& surface, std::vector<shell::StreamSpecification> const& config) = 0; |
3015 | virtual void destroy_surface(std::weak_ptr<Surface> const& surface) = 0; |
3016 | virtual void send_input_device_change(std::vector<std::shared_ptr<input::Device>> const& devices) = 0; |
3017 | + |
3018 | + virtual graphics::BufferID create_buffer(graphics::BufferProperties const& properties) = 0; |
3019 | + virtual void destroy_buffer(graphics::BufferID) = 0; |
3020 | + virtual std::shared_ptr<graphics::Buffer> get_buffer(graphics::BufferID) = 0; |
3021 | }; |
3022 | } |
3023 | } |
3024 | |
3025 | === modified file 'include/server/mir/scene/surface.h' |
3026 | --- include/server/mir/scene/surface.h 2016-04-21 17:36:10 +0000 |
3027 | +++ include/server/mir/scene/surface.h 2016-08-12 14:07:23 +0000 |
3028 | @@ -115,6 +115,9 @@ |
3029 | std::string const& variant, std::string const& options) = 0; |
3030 | virtual void rename(std::string const& title) = 0; |
3031 | virtual void set_streams(std::list<StreamInfo> const& streams) = 0; |
3032 | + |
3033 | + virtual void set_confine_pointer_state(MirPointerConfinementState state) = 0; |
3034 | + virtual MirPointerConfinementState confine_pointer_state() const = 0; |
3035 | }; |
3036 | } |
3037 | } |
3038 | |
3039 | === modified file 'include/server/mir/scene/surface_creation_parameters.h' |
3040 | --- include/server/mir/scene/surface_creation_parameters.h 2016-04-13 01:27:36 +0000 |
3041 | +++ include/server/mir/scene/surface_creation_parameters.h 2016-08-12 14:07:23 +0000 |
3042 | @@ -102,6 +102,7 @@ |
3043 | mir::optional_value<std::vector<geometry::Rectangle>> input_shape; |
3044 | mir::optional_value<MirShellChrome> shell_chrome; |
3045 | mir::optional_value<std::vector<shell::StreamSpecification>> streams; |
3046 | + mir::optional_value<MirPointerConfinementState> confine_pointer; |
3047 | }; |
3048 | |
3049 | bool operator==(const SurfaceCreationParameters& lhs, const SurfaceCreationParameters& rhs); |
3050 | |
3051 | === modified file 'include/server/mir/server.h' |
3052 | --- include/server/mir/server.h 2016-01-29 08:18:22 +0000 |
3053 | +++ include/server/mir/server.h 2016-08-12 14:07:23 +0000 |
3054 | @@ -46,6 +46,7 @@ |
3055 | class FocusController; |
3056 | class HostLifecycleEventListener; |
3057 | class InputTargeter; |
3058 | +class PersistentSurfaceStore; |
3059 | class Shell; |
3060 | class SurfaceStack; |
3061 | } |
3062 | @@ -86,12 +87,6 @@ |
3063 | /// This must remain valid while apply_settings() and run() are called. |
3064 | void set_command_line(int argc, char const* argv[]); |
3065 | |
3066 | - /// Sets an override functor for creating the cookie authority. |
3067 | - /// A secret can be saved and any process this secret is shared |
3068 | - /// with can verify Mir-generated cookies, or produce their own. |
3069 | - void override_the_cookie_authority( |
3070 | - std::function<std::shared_ptr<cookie::Authority>()> const& cookie_authority_builder); |
3071 | - |
3072 | /// Applies any configuration options, hooks, or custom implementations. |
3073 | /// Must be called before calling run() or accessing any mir subsystems. |
3074 | void apply_settings(); |
3075 | @@ -193,6 +188,10 @@ |
3076 | /// If multiple callbacks are added they will be invoked in the sequence added. |
3077 | void add_init_callback(std::function<void()> const& init_callback); |
3078 | |
3079 | + /// Add a callback to be invoked when the server is about to stop, |
3080 | + /// If multiple callbacks are added they will be invoked in the reverse sequence added. |
3081 | + void add_stop_callback(std::function<void()> const& stop_callback); |
3082 | + |
3083 | /// Set a handler for exceptions. This is invoked in a catch (...) block and |
3084 | /// the exception can be re-thrown to retrieve type information. |
3085 | /// The default action is to call mir::report_exception(std::cerr) |
3086 | @@ -247,6 +246,11 @@ |
3087 | /// Sets an override functor for creating the gl config. |
3088 | void override_the_gl_config(Builder<graphics::GLConfig> const& gl_config_builder); |
3089 | |
3090 | + /// Sets an override functor for creating the cookie authority. |
3091 | + /// A secret can be saved and any process this secret is shared |
3092 | + /// with can verify Mir-generated cookies, or produce their own. |
3093 | + void override_the_cookie_authority(Builder<cookie::Authority> const& cookie_authority_builder); |
3094 | + |
3095 | /// Sets an override functor for creating the coordinate translator. |
3096 | void override_the_coordinate_translator( |
3097 | Builder<scene::CoordinateTranslator> const& coordinate_translator_builder); |
3098 | @@ -289,6 +293,9 @@ |
3099 | void override_the_application_not_responding_detector( |
3100 | Builder<scene::ApplicationNotRespondingDetector> const& anr_detector_builder); |
3101 | |
3102 | + /// Sets an override functor for creating the persistent_surface_store |
3103 | + void override_the_persistent_surface_store(Builder<shell::PersistentSurfaceStore> const& persistent_surface_store); |
3104 | + |
3105 | /// Each of the wrap functions takes a wrapper functor of the same form |
3106 | template<typename T> using Wrapper = std::function<std::shared_ptr<T>(std::shared_ptr<T> const&)>; |
3107 | |
3108 | @@ -310,6 +317,9 @@ |
3109 | |
3110 | /// Sets a wrapper functor for creating the surface stack. |
3111 | void wrap_surface_stack(Wrapper<shell::SurfaceStack> const& surface_stack); |
3112 | + |
3113 | + /// Sets a wrapper functor for creating the application not responding detector. |
3114 | + void wrap_application_not_responding_detector(Wrapper<scene::ApplicationNotRespondingDetector> const & anr_detector); |
3115 | /** @} */ |
3116 | |
3117 | /** @name Getting access to Mir subsystems |
3118 | @@ -395,6 +405,10 @@ |
3119 | /// \return the application not responding detector |
3120 | auto the_application_not_responding_detector() const -> |
3121 | std::shared_ptr<scene::ApplicationNotRespondingDetector>; |
3122 | + |
3123 | + /// \return the persistent surface store |
3124 | + auto the_persistent_surface_store() const -> std::shared_ptr<shell::PersistentSurfaceStore>; |
3125 | + |
3126 | /** @} */ |
3127 | |
3128 | /** @name Client side support |
3129 | |
3130 | === modified file 'include/server/mir/shell/abstract_shell.h' |
3131 | --- include/server/mir/shell/abstract_shell.h 2016-01-29 08:18:22 +0000 |
3132 | +++ include/server/mir/shell/abstract_shell.h 2016-08-12 14:07:23 +0000 |
3133 | @@ -26,6 +26,10 @@ |
3134 | |
3135 | namespace mir |
3136 | { |
3137 | +namespace input |
3138 | +{ |
3139 | +class Seat; |
3140 | +} |
3141 | namespace shell |
3142 | { |
3143 | class ShellReport; |
3144 | @@ -41,7 +45,8 @@ |
3145 | std::shared_ptr<scene::SessionCoordinator> const& session_coordinator, |
3146 | std::shared_ptr<scene::PromptSessionManager> const& prompt_session_manager, |
3147 | std::shared_ptr<ShellReport> const& report, |
3148 | - WindowManagerBuilder const& wm_builder); |
3149 | + WindowManagerBuilder const& wm_builder, |
3150 | + std::shared_ptr<input::Seat> const& seat); |
3151 | |
3152 | ~AbstractShell() noexcept; |
3153 | |
3154 | @@ -122,6 +127,7 @@ |
3155 | std::shared_ptr<scene::SessionCoordinator> const session_coordinator; |
3156 | std::shared_ptr<scene::PromptSessionManager> const prompt_session_manager; |
3157 | std::shared_ptr<WindowManager> const window_manager; |
3158 | + std::shared_ptr<input::Seat> const seat; |
3159 | |
3160 | private: |
3161 | std::shared_ptr<ShellReport> const report; |
3162 | |
3163 | === modified file 'include/server/mir/shell/surface_specification.h' |
3164 | --- include/server/mir/shell/surface_specification.h 2016-04-21 17:36:10 +0000 |
3165 | +++ include/server/mir/shell/surface_specification.h 2016-08-12 14:07:23 +0000 |
3166 | @@ -83,6 +83,7 @@ |
3167 | // it also has size instead of width + height |
3168 | // Maybe SurfaceCreationParameters /HasA/ SurfaceSpecification? |
3169 | mir::optional_value<MirShellChrome> shell_chrome; |
3170 | + optional_value<MirPointerConfinementState> confine_pointer; |
3171 | }; |
3172 | } |
3173 | } |
3174 | |
3175 | === modified file 'include/test/mir/test/doubles/mock_egl.h' |
3176 | --- include/test/mir/test/doubles/mock_egl.h 2016-01-29 08:18:22 +0000 |
3177 | +++ include/test/mir/test/doubles/mock_egl.h 2016-08-12 14:07:23 +0000 |
3178 | @@ -25,7 +25,9 @@ |
3179 | #include <thread> |
3180 | #include <unordered_map> |
3181 | |
3182 | +#ifndef GL_GLEXT_PROTOTYPES |
3183 | #define GL_GLEXT_PROTOTYPES |
3184 | +#endif |
3185 | #define EGL_EGLEXT_PROTOTYPES |
3186 | #include <EGL/egl.h> |
3187 | #include <EGL/eglext.h> |
3188 | @@ -100,8 +102,9 @@ |
3189 | void provide_stub_platform_buffer_swapping(); |
3190 | |
3191 | typedef void (*generic_function_pointer_t)(void); |
3192 | + typedef void* AnyNativeType; |
3193 | |
3194 | - MOCK_METHOD1(eglGetDisplay, EGLDisplay(NativeDisplayType)); |
3195 | + MOCK_METHOD1(eglGetDisplay, EGLDisplay(AnyNativeType)); |
3196 | MOCK_METHOD3(eglInitialize, EGLBoolean(EGLDisplay,EGLint*,EGLint*)); |
3197 | MOCK_METHOD1(eglTerminate, EGLBoolean(EGLDisplay)); |
3198 | MOCK_METHOD2(eglQueryString,const char*(EGLDisplay, EGLint)); |
3199 | @@ -114,8 +117,8 @@ |
3200 | MOCK_METHOD4(eglGetConfigAttrib, EGLBoolean(EGLDisplay,EGLConfig,EGLint,EGLint*)); |
3201 | |
3202 | // Surface management |
3203 | - MOCK_METHOD4(eglCreateWindowSurface, EGLSurface(EGLDisplay,EGLConfig,NativeWindowType,const EGLint*)); |
3204 | - MOCK_METHOD4(eglCreatePixmapSurface, EGLSurface(EGLDisplay,EGLConfig,NativePixmapType,const EGLint*)); |
3205 | + MOCK_METHOD4(eglCreateWindowSurface, EGLSurface(EGLDisplay,EGLConfig,AnyNativeType,const EGLint*)); |
3206 | + MOCK_METHOD4(eglCreatePixmapSurface, EGLSurface(EGLDisplay,EGLConfig,AnyNativeType,const EGLint*)); |
3207 | MOCK_METHOD3(eglCreatePbufferSurface, EGLSurface(EGLDisplay,EGLConfig,const EGLint*)); |
3208 | MOCK_METHOD2(eglDestroySurface, EGLBoolean(EGLDisplay,EGLSurface)); |
3209 | MOCK_METHOD4(eglQuerySurface, EGLBoolean(EGLDisplay,EGLSurface,EGLint,EGLint*)); |
3210 | @@ -139,7 +142,7 @@ |
3211 | MOCK_METHOD0(eglWaitGL, EGLBoolean()); |
3212 | MOCK_METHOD1(eglWaitNative, EGLBoolean(EGLint)); |
3213 | MOCK_METHOD2(eglSwapBuffers, EGLBoolean(EGLDisplay,EGLSurface)); |
3214 | - MOCK_METHOD3(eglCopyBuffers, EGLBoolean(EGLDisplay,EGLSurface,NativePixmapType)); |
3215 | + MOCK_METHOD3(eglCopyBuffers, EGLBoolean(EGLDisplay,EGLSurface,AnyNativeType)); |
3216 | |
3217 | MOCK_METHOD0(eglGetError, EGLint (void)); |
3218 | |
3219 | |
3220 | === modified file 'include/test/mir/test/doubles/null_platform.h' |
3221 | --- include/test/mir/test/doubles/null_platform.h 2016-04-20 07:18:17 +0000 |
3222 | +++ include/test/mir/test/doubles/null_platform.h 2016-08-12 14:07:23 +0000 |
3223 | @@ -50,11 +50,6 @@ |
3224 | { |
3225 | return mir::make_module_ptr<NullPlatformIpcOperations>(); |
3226 | } |
3227 | - |
3228 | - EGLNativeDisplayType egl_native_display() const override |
3229 | - { |
3230 | - return EGLNativeDisplayType(); |
3231 | - } |
3232 | }; |
3233 | } |
3234 | } |
3235 | |
3236 | === modified file 'include/test/mir/test/doubles/stub_input_device.h' |
3237 | --- include/test/mir/test/doubles/stub_input_device.h 2016-02-01 15:54:51 +0000 |
3238 | +++ include/test/mir/test/doubles/stub_input_device.h 2016-08-12 14:07:23 +0000 |
3239 | @@ -23,6 +23,7 @@ |
3240 | #include "mir/input/device_capability.h" |
3241 | #include "mir/input/pointer_configuration.h" |
3242 | #include "mir/input/touchpad_configuration.h" |
3243 | +#include "mir/input/keyboard_configuration.h" |
3244 | #include "mir/optional_value.h" |
3245 | |
3246 | namespace mir |
3247 | @@ -69,6 +70,15 @@ |
3248 | { |
3249 | } |
3250 | |
3251 | + mir::optional_value<input::KeyboardConfiguration> keyboard_configuration() const override |
3252 | + { |
3253 | + return {}; |
3254 | + } |
3255 | + |
3256 | + void apply_keyboard_configuration(input::KeyboardConfiguration const&) override |
3257 | + { |
3258 | + } |
3259 | + |
3260 | MirInputDeviceId device_id; |
3261 | input::DeviceCapabilities device_capabilities; |
3262 | std::string device_name; |
3263 | |
3264 | === modified file 'include/test/mir/test/doubles/stub_session.h' |
3265 | --- include/test/mir/test/doubles/stub_session.h 2016-04-06 08:44:01 +0000 |
3266 | +++ include/test/mir/test/doubles/stub_session.h 2016-08-12 14:07:23 +0000 |
3267 | @@ -89,6 +89,10 @@ |
3268 | |
3269 | void send_input_device_change(std::vector<std::shared_ptr<input::Device>> const& devices) override; |
3270 | |
3271 | + graphics::BufferID create_buffer(graphics::BufferProperties const& properties); |
3272 | + void destroy_buffer(graphics::BufferID); |
3273 | + std::shared_ptr<graphics::Buffer> get_buffer(graphics::BufferID); |
3274 | + |
3275 | pid_t pid; |
3276 | }; |
3277 | } |
3278 | |
3279 | === modified file 'include/test/mir/test/doubles/stub_surface.h' |
3280 | --- include/test/mir/test/doubles/stub_surface.h 2016-01-29 08:18:22 +0000 |
3281 | +++ include/test/mir/test/doubles/stub_surface.h 2016-08-12 14:07:23 +0000 |
3282 | @@ -70,6 +70,8 @@ |
3283 | void set_keymap(MirInputDeviceId id, std::string const& model, std::string const& layout, |
3284 | std::string const& variant, std::string const& options) override; |
3285 | void rename(std::string const& title) override; |
3286 | + void set_confine_pointer_state(MirPointerConfinementState state) override; |
3287 | + MirPointerConfinementState confine_pointer_state() const override; |
3288 | }; |
3289 | } |
3290 | } |
3291 | |
3292 | === modified file 'include/test/mir/test/event_matchers.h' |
3293 | --- include/test/mir/test/event_matchers.h 2016-04-28 12:32:52 +0000 |
3294 | +++ include/test/mir/test/event_matchers.h 2016-08-12 14:07:23 +0000 |
3295 | @@ -261,9 +261,9 @@ |
3296 | return false; |
3297 | if (mir_pointer_event_button_state(pev, static_cast<MirPointerButton>(button)) == false) |
3298 | return false; |
3299 | - if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != pos.x.as_float()) |
3300 | + if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != pos.x.as_int()) |
3301 | return false; |
3302 | - if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != pos.y.as_float()) |
3303 | + if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != pos.y.as_int()) |
3304 | return false; |
3305 | return true; |
3306 | } |
3307 | @@ -295,9 +295,9 @@ |
3308 | return false; |
3309 | if (mir_pointer_event_button_state(pev, button) == true) |
3310 | return false; |
3311 | - if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != pos.x.as_float()) |
3312 | + if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != pos.x.as_int()) |
3313 | return false; |
3314 | - if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != pos.y.as_float()) |
3315 | + if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != pos.y.as_int()) |
3316 | return false; |
3317 | return true; |
3318 | } |
3319 | @@ -503,6 +503,38 @@ |
3320 | return false; |
3321 | } |
3322 | |
3323 | +MATCHER(InputDeviceStateEvent, "") |
3324 | +{ |
3325 | + auto as_address = to_address(arg); |
3326 | + if (mir_event_get_type(as_address) == mir_event_type_input_device_state) |
3327 | + return true; |
3328 | + return false; |
3329 | +} |
3330 | + |
3331 | +MATCHER_P(DeviceStateWithPressedKeys, keys, "") |
3332 | +{ |
3333 | + auto as_address = to_address(arg); |
3334 | + if (mir_event_get_type(as_address) != mir_event_type_input_device_state) |
3335 | + return false; |
3336 | + auto device_state = mir_event_get_input_device_state_event(as_address); |
3337 | + for (size_t index = 0, count = mir_input_device_state_event_device_count(device_state); |
3338 | + index != count; ++index) |
3339 | + { |
3340 | + auto key_count = mir_input_device_state_event_device_pressed_keys_count(device_state, index); |
3341 | + auto it_keys = begin(keys); |
3342 | + auto end_keys = end(keys); |
3343 | + decltype(key_count) num_required_keys = distance(it_keys, end_keys); |
3344 | + if (num_required_keys != key_count) |
3345 | + continue; |
3346 | + |
3347 | + auto pressed_keys = mir_input_device_state_event_device_pressed_keys(device_state, index); |
3348 | + if (!std::equal(it_keys, end_keys, pressed_keys)) |
3349 | + continue; |
3350 | + return true; |
3351 | + } |
3352 | + return false; |
3353 | +} |
3354 | + |
3355 | MATCHER(InputDeviceConfigurationChangedEvent, "") |
3356 | { |
3357 | auto as_address = to_address(arg); |
3358 | |
3359 | === modified file 'playground/CMakeLists.txt' |
3360 | --- playground/CMakeLists.txt 2016-03-23 06:39:56 +0000 |
3361 | +++ playground/CMakeLists.txt 2016-08-12 14:07:23 +0000 |
3362 | @@ -28,3 +28,11 @@ |
3363 | mirclient |
3364 | m |
3365 | ) |
3366 | + |
3367 | +mir_add_wrapped_executable(mir_demo_client_chain_jumping_buffers |
3368 | + mir_demo_client_chain_jumping_buffers.c |
3369 | +) |
3370 | + |
3371 | +target_link_libraries(mir_demo_client_chain_jumping_buffers |
3372 | + mirclient |
3373 | +) |
3374 | |
3375 | === modified file 'playground/demo-shell/CMakeLists.txt' |
3376 | --- playground/demo-shell/CMakeLists.txt 2015-06-24 03:00:56 +0000 |
3377 | +++ playground/demo-shell/CMakeLists.txt 2016-08-12 14:07:23 +0000 |
3378 | @@ -2,7 +2,6 @@ |
3379 | demo_compositor.cpp |
3380 | demo_renderer.cpp |
3381 | window_manager.cpp |
3382 | - default_window_manager.cpp |
3383 | ) |
3384 | |
3385 | add_subdirectory(typo) |
3386 | |
3387 | === removed file 'playground/demo-shell/default_window_manager.cpp' |
3388 | --- playground/demo-shell/default_window_manager.cpp 2016-01-29 08:18:22 +0000 |
3389 | +++ playground/demo-shell/default_window_manager.cpp 1970-01-01 00:00:00 +0000 |
3390 | @@ -1,150 +0,0 @@ |
3391 | -/* |
3392 | - * Copyright © 2015 Canonical Ltd. |
3393 | - * |
3394 | - * This program is free software: you can redistribute it and/or modify it |
3395 | - * under the terms of the GNU General Public License version 3, |
3396 | - * as published by the Free Software Foundation. |
3397 | - * |
3398 | - * This program is distributed in the hope that it will be useful, |
3399 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3400 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3401 | - * GNU General Public License for more details. |
3402 | - * |
3403 | - * You should have received a copy of the GNU General Public License |
3404 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3405 | - * |
3406 | - * Authored By: Alan Griffiths <alan@octopull.co.uk> |
3407 | - */ |
3408 | - |
3409 | -#include "default_window_manager.h" |
3410 | - |
3411 | -#include "mir/scene/session.h" |
3412 | -#include "mir/scene/session_coordinator.h" |
3413 | -#include "mir/scene/surface.h" |
3414 | -#include "mir/scene/surface_creation_parameters.h" |
3415 | -#include "mir/shell/display_layout.h" |
3416 | -#include "mir/shell/focus_controller.h" |
3417 | -#include "mir/shell/surface_ready_observer.h" |
3418 | -#include "mir/shell/surface_specification.h" |
3419 | - |
3420 | -#include "mir_toolkit/client_types.h" |
3421 | - |
3422 | -namespace mf = mir::frontend; |
3423 | -namespace ms = mir::scene; |
3424 | -namespace msh = mir::shell; |
3425 | -namespace me = mir::examples; |
3426 | -namespace geom = mir::geometry; |
3427 | - |
3428 | -me::DefaultWindowManager::DefaultWindowManager( |
3429 | - msh::FocusController* focus_controller, |
3430 | - std::shared_ptr<shell::DisplayLayout> const& display_layout, |
3431 | - std::shared_ptr<scene::SessionCoordinator> const& session_coordinator) : |
3432 | - focus_controller{focus_controller}, |
3433 | - display_layout{display_layout}, |
3434 | - session_coordinator{session_coordinator} |
3435 | -{ |
3436 | -} |
3437 | - |
3438 | -void me::DefaultWindowManager::add_session(std::shared_ptr<scene::Session> const& session) |
3439 | -{ |
3440 | - focus_controller->set_focus_to(session, {}); |
3441 | -} |
3442 | - |
3443 | -void me::DefaultWindowManager::remove_session(std::shared_ptr<scene::Session> const& /*session*/) |
3444 | -{ |
3445 | - auto const next_session = session_coordinator->successor_of({}); |
3446 | - if (next_session) |
3447 | - focus_controller->set_focus_to(next_session, next_session->default_surface()); |
3448 | - else |
3449 | - focus_controller->set_focus_to(next_session, {}); |
3450 | -} |
3451 | - |
3452 | -auto me::DefaultWindowManager::add_surface( |
3453 | - std::shared_ptr<scene::Session> const& session, |
3454 | - scene::SurfaceCreationParameters const& request_parameters, |
3455 | - std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build) |
3456 | --> frontend::SurfaceId |
3457 | -{ |
3458 | - mir::graphics::DisplayConfigurationOutputId const output_id_invalid{ |
3459 | - mir_display_output_id_invalid}; |
3460 | - auto placed_parameters = request_parameters; |
3461 | - |
3462 | - geom::Rectangle rect{request_parameters.top_left, request_parameters.size}; |
3463 | - |
3464 | - if (request_parameters.output_id != output_id_invalid) |
3465 | - { |
3466 | - display_layout->place_in_output(request_parameters.output_id, rect); |
3467 | - } |
3468 | - |
3469 | - placed_parameters.top_left = rect.top_left; |
3470 | - placed_parameters.size = rect.size; |
3471 | - |
3472 | - auto const result = build(session, placed_parameters); |
3473 | - auto const surface = session->surface(result); |
3474 | - |
3475 | - surface->add_observer(std::make_shared<msh::SurfaceReadyObserver>( |
3476 | - [this](std::shared_ptr<scene::Session> const& session, |
3477 | - std::shared_ptr<scene::Surface> const& surface) |
3478 | - { |
3479 | - focus_controller->set_focus_to(session, surface); |
3480 | - }, |
3481 | - session, |
3482 | - surface)); |
3483 | - |
3484 | - return result; |
3485 | -} |
3486 | - |
3487 | -void me::DefaultWindowManager::modify_surface( |
3488 | - std::shared_ptr<scene::Session> const& /*session*/, |
3489 | - std::shared_ptr<scene::Surface> const& surface, |
3490 | - msh::SurfaceSpecification const& modifications) |
3491 | -{ |
3492 | - if (modifications.name.is_set()) |
3493 | - surface->rename(modifications.name.value()); |
3494 | -} |
3495 | - |
3496 | -void me::DefaultWindowManager::remove_surface( |
3497 | - std::shared_ptr<scene::Session> const& session, |
3498 | - std::weak_ptr<scene::Surface> const& surface) |
3499 | -{ |
3500 | - session->destroy_surface(surface); |
3501 | -} |
3502 | - |
3503 | -void me::DefaultWindowManager::add_display(geometry::Rectangle const& /*area*/) |
3504 | -{ |
3505 | -} |
3506 | - |
3507 | -void me::DefaultWindowManager::remove_display(geometry::Rectangle const& /*area*/) |
3508 | -{ |
3509 | -} |
3510 | - |
3511 | -void me::DefaultWindowManager::handle_raise_surface( |
3512 | - std::shared_ptr<scene::Session> const& /*session*/, |
3513 | - std::shared_ptr<scene::Surface> const& /*surface*/, |
3514 | - uint64_t /*timestamp*/) |
3515 | -{ |
3516 | -} |
3517 | - |
3518 | -bool me::DefaultWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/) |
3519 | -{ |
3520 | - return false; |
3521 | -} |
3522 | - |
3523 | -bool me::DefaultWindowManager::handle_touch_event(MirTouchEvent const* /*event*/) |
3524 | -{ |
3525 | - return false; |
3526 | -} |
3527 | - |
3528 | -bool me::DefaultWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/) |
3529 | -{ |
3530 | - return false; |
3531 | -} |
3532 | - |
3533 | -int me::DefaultWindowManager::set_surface_attribute( |
3534 | - std::shared_ptr<scene::Session> const& /*session*/, |
3535 | - std::shared_ptr<scene::Surface> const& surface, |
3536 | - MirSurfaceAttrib attrib, |
3537 | - int value) |
3538 | -{ |
3539 | - return surface->configure(attrib, value); |
3540 | -} |
3541 | |
3542 | === removed file 'playground/demo-shell/default_window_manager.h' |
3543 | --- playground/demo-shell/default_window_manager.h 2016-01-29 08:18:22 +0000 |
3544 | +++ playground/demo-shell/default_window_manager.h 1970-01-01 00:00:00 +0000 |
3545 | @@ -1,86 +0,0 @@ |
3546 | -/* |
3547 | - * Copyright © 2015 Canonical Ltd. |
3548 | - * |
3549 | - * This program is free software: you can redistribute it and/or modify it |
3550 | - * under the terms of the GNU General Public License version 3, |
3551 | - * as published by the Free Software Foundation. |
3552 | - * |
3553 | - * This program is distributed in the hope that it will be useful, |
3554 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3555 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3556 | - * GNU General Public License for more details. |
3557 | - * |
3558 | - * You should have received a copy of the GNU General Public License |
3559 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3560 | - * |
3561 | - * Authored By: Alan Griffiths <alan@octopull.co.uk> |
3562 | - */ |
3563 | - |
3564 | -#ifndef MIR_EXAMPLES_DEFAULT_WINDOW_MANAGER_H_ |
3565 | -#define MIR_EXAMPLES_DEFAULT_WINDOW_MANAGER_H_ |
3566 | - |
3567 | -#include "mir/shell/window_manager.h" |
3568 | - |
3569 | -namespace mir |
3570 | -{ |
3571 | -namespace scene { class SessionCoordinator; } |
3572 | - |
3573 | -namespace shell { class FocusController; class DisplayLayout; } |
3574 | - |
3575 | -namespace examples |
3576 | -{ |
3577 | -class DefaultWindowManager : public shell::WindowManager |
3578 | -{ |
3579 | -public: |
3580 | - explicit DefaultWindowManager(shell::FocusController* focus_controller, |
3581 | - std::shared_ptr<shell::DisplayLayout> const& display_layout, |
3582 | - std::shared_ptr<scene::SessionCoordinator> const& session_coordinator); |
3583 | - |
3584 | - void add_session(std::shared_ptr<scene::Session> const& session) override; |
3585 | - |
3586 | - void remove_session(std::shared_ptr<scene::Session> const& session) override; |
3587 | - |
3588 | - frontend::SurfaceId add_surface( |
3589 | - std::shared_ptr<scene::Session> const& session, |
3590 | - scene::SurfaceCreationParameters const& params, |
3591 | - std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build) override; |
3592 | - |
3593 | - void modify_surface( |
3594 | - std::shared_ptr<scene::Session> const& session, |
3595 | - std::shared_ptr<scene::Surface> const& surface, |
3596 | - shell::SurfaceSpecification const& modifications) override; |
3597 | - |
3598 | - void remove_surface( |
3599 | - std::shared_ptr<scene::Session> const& session, |
3600 | - std::weak_ptr<scene::Surface> const& surface) override; |
3601 | - |
3602 | - void add_display(geometry::Rectangle const& area) override; |
3603 | - |
3604 | - void remove_display(geometry::Rectangle const& area) override; |
3605 | - |
3606 | - bool handle_keyboard_event(MirKeyboardEvent const* event) override; |
3607 | - |
3608 | - bool handle_touch_event(MirTouchEvent const* event) override; |
3609 | - |
3610 | - bool handle_pointer_event(MirPointerEvent const* event) override; |
3611 | - |
3612 | - void handle_raise_surface( |
3613 | - std::shared_ptr<scene::Session> const& session, |
3614 | - std::shared_ptr<scene::Surface> const& surface, |
3615 | - uint64_t timestamp) override; |
3616 | - |
3617 | - int set_surface_attribute( |
3618 | - std::shared_ptr<scene::Session> const& session, |
3619 | - std::shared_ptr<scene::Surface> const& surface, |
3620 | - MirSurfaceAttrib attrib, |
3621 | - int value) override; |
3622 | - |
3623 | -private: |
3624 | - shell::FocusController* const focus_controller; |
3625 | - std::shared_ptr<shell::DisplayLayout> const display_layout; |
3626 | - std::shared_ptr<scene::SessionCoordinator> const session_coordinator; |
3627 | -}; |
3628 | -} |
3629 | -} |
3630 | - |
3631 | -#endif /* MIR_SHELL_DEFAULT_WINDOW_MANAGER_H_ */ |
3632 | |
3633 | === modified file 'playground/demo-shell/demo_compositor.cpp' |
3634 | --- playground/demo-shell/demo_compositor.cpp 2016-03-28 23:15:00 +0000 |
3635 | +++ playground/demo-shell/demo_compositor.cpp 2016-08-12 14:07:23 +0000 |
3636 | @@ -186,8 +186,8 @@ |
3637 | // Note the 0.5f. This is because cursors (and all input in general) |
3638 | // measures coordinates at the centre of a pixel. But GL measures to |
3639 | // the top-left corner of a pixel. |
3640 | - float screen_x = cursor_pos.x.as_float() + 0.5f - db_x; |
3641 | - float screen_y = cursor_pos.y.as_float() + 0.5f - db_y; |
3642 | + float screen_x = cursor_pos.x.as_int() + 0.5f - db_x; |
3643 | + float screen_y = cursor_pos.y.as_int() + 0.5f - db_y; |
3644 | |
3645 | float normal_x = screen_x / db_width; |
3646 | float normal_y = screen_y / db_height; |
3647 | |
3648 | === modified file 'playground/demo-shell/demo_renderer.cpp' |
3649 | --- playground/demo-shell/demo_renderer.cpp 2016-01-29 08:18:22 +0000 |
3650 | +++ playground/demo-shell/demo_renderer.cpp 2016-08-12 14:07:23 +0000 |
3651 | @@ -152,7 +152,9 @@ |
3652 | |
3653 | static const GLchar inverse_fshader[] = |
3654 | { |
3655 | + "#ifdef GL_ES\n" |
3656 | "precision mediump float;\n" |
3657 | + "#endif\n" |
3658 | "uniform sampler2D tex;\n" |
3659 | "uniform float alpha;\n" |
3660 | "varying vec2 v_texcoord;\n" |
3661 | @@ -164,7 +166,9 @@ |
3662 | }; |
3663 | static const GLchar contrast_fshader[] = |
3664 | { |
3665 | + "#ifdef GL_ES\n" |
3666 | "precision mediump float;\n" |
3667 | + "#endif\n" |
3668 | "uniform sampler2D tex;\n" |
3669 | "uniform float alpha;\n" |
3670 | "varying vec2 v_texcoord;\n" |
3671 | |
3672 | === modified file 'playground/demo-shell/demo_shell.cpp' |
3673 | --- playground/demo-shell/demo_shell.cpp 2016-01-29 08:18:22 +0000 |
3674 | +++ playground/demo-shell/demo_shell.cpp 2016-08-12 14:07:23 +0000 |
3675 | @@ -29,9 +29,6 @@ |
3676 | #include "mir/compositor/display_buffer_compositor_factory.h" |
3677 | #include "mir/compositor/renderer_factory.h" |
3678 | #include "mir/options/option.h" |
3679 | -#include "default_window_manager.h" |
3680 | -#include "server_example_tiling_window_manager.h" |
3681 | -#include "mir/shell/canonical_window_manager.h" |
3682 | #include "server_example_host_lifecycle_event_listener.h" |
3683 | |
3684 | #include <iostream> |
3685 | @@ -71,13 +68,7 @@ |
3686 | class DemoServerConfiguration : public mir::examples::ServerConfiguration |
3687 | { |
3688 | public: |
3689 | - DemoServerConfiguration(int argc, char const* argv[], |
3690 | - std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list) |
3691 | - : ServerConfiguration(argc, argv), |
3692 | - filter_list(filter_list) |
3693 | - { |
3694 | - } |
3695 | - |
3696 | + using mir::examples::ServerConfiguration::ServerConfiguration; |
3697 | |
3698 | std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory() override |
3699 | { |
3700 | @@ -89,45 +80,6 @@ |
3701 | }); |
3702 | } |
3703 | |
3704 | - std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override |
3705 | - { |
3706 | - return composite_event_filter( |
3707 | - [this]() -> std::shared_ptr<mi::CompositeEventFilter> |
3708 | - { |
3709 | - auto composite_filter = ServerConfiguration::the_composite_event_filter(); |
3710 | - for (auto const& filter : filter_list) |
3711 | - composite_filter->append(filter); |
3712 | - |
3713 | - return composite_filter; |
3714 | - }); |
3715 | - } |
3716 | - |
3717 | - auto the_window_manager_builder() -> shell::WindowManagerBuilder override |
3718 | - { |
3719 | - return [this](shell::FocusController* focus_controller) |
3720 | - -> std::shared_ptr<msh::WindowManager> |
3721 | - { |
3722 | - auto const options = the_options(); |
3723 | - auto const selection = options->get<std::string>(wm_option); |
3724 | - |
3725 | - if (selection == wm_tiling) |
3726 | - { |
3727 | - return std::make_shared<TilingWindowManager>(focus_controller); |
3728 | - } |
3729 | - else if (selection == wm_canonical) |
3730 | - { |
3731 | - return std::make_shared<msh::CanonicalWindowManager>( |
3732 | - focus_controller, |
3733 | - the_shell_display_layout()); |
3734 | - } |
3735 | - |
3736 | - return std::make_shared<DefaultWindowManager>( |
3737 | - focus_controller, |
3738 | - the_shell_display_layout(), |
3739 | - the_session_coordinator()); |
3740 | - }; |
3741 | - } |
3742 | - |
3743 | std::shared_ptr<msh::HostLifecycleEventListener> the_host_lifecycle_event_listener() override |
3744 | { |
3745 | return host_lifecycle_event_listener( |
3746 | @@ -136,9 +88,6 @@ |
3747 | return std::make_shared<HostLifecycleEventListener>(the_logger()); |
3748 | }); |
3749 | } |
3750 | - |
3751 | -private: |
3752 | - std::vector<std::shared_ptr<mi::EventFilter>> const filter_list; |
3753 | }; |
3754 | |
3755 | } |
3756 | @@ -147,8 +96,9 @@ |
3757 | int main(int argc, char const* argv[]) |
3758 | try |
3759 | { |
3760 | + me::DemoServerConfiguration config(argc, argv); |
3761 | + |
3762 | auto wm = std::make_shared<me::WindowManager>(); |
3763 | - me::DemoServerConfiguration config(argc, argv, {wm}); |
3764 | |
3765 | mir::run_mir(config, [&config, &wm](mir::DisplayServer&) |
3766 | { |
3767 | @@ -158,6 +108,8 @@ |
3768 | wm->set_display(config.the_display()); |
3769 | wm->set_compositor(config.the_compositor()); |
3770 | wm->set_input_scene(config.the_input_scene()); |
3771 | + |
3772 | + config.the_composite_event_filter()->prepend(wm); |
3773 | }); |
3774 | return 0; |
3775 | } |
3776 | |
3777 | === modified file 'playground/demo-shell/typo/CMakeLists.txt' |
3778 | --- playground/demo-shell/typo/CMakeLists.txt 2015-02-19 09:30:02 +0000 |
3779 | +++ playground/demo-shell/typo/CMakeLists.txt 2016-08-12 14:07:23 +0000 |
3780 | @@ -1,4 +1,3 @@ |
3781 | -find_package(GLESv2 REQUIRED) |
3782 | find_package(PkgConfig) |
3783 | |
3784 | pkg_search_module(FREETYPE freetype2) |
3785 | @@ -13,8 +12,7 @@ |
3786 | ${OPTIONAL_SRCS} |
3787 | ) |
3788 | |
3789 | -target_link_libraries(typo ${GLESv2_LIBRARIES}) |
3790 | -include_directories(${GLESv2_INCLUDE_DIRS}) |
3791 | +target_link_libraries(typo ${GL_LIBRARIES}) |
3792 | target_include_directories(typo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
3793 | |
3794 | if (FREETYPE_FOUND) |
3795 | |
3796 | === modified file 'playground/demo-shell/typo/typo_glcache.cpp' |
3797 | --- playground/demo-shell/typo/typo_glcache.cpp 2015-07-16 07:03:19 +0000 |
3798 | +++ playground/demo-shell/typo/typo_glcache.cpp 2016-08-12 14:07:23 +0000 |
3799 | @@ -17,7 +17,7 @@ |
3800 | */ |
3801 | |
3802 | #include "typo_glcache.h" |
3803 | -#include <GLES2/gl2.h> // TODO: Support plain OpenGL too |
3804 | +#include MIR_SERVER_GL_H |
3805 | |
3806 | using namespace mir::examples::typo; |
3807 | |
3808 | |
3809 | === added file 'playground/mir_demo_client_chain_jumping_buffers.c' |
3810 | --- playground/mir_demo_client_chain_jumping_buffers.c 1970-01-01 00:00:00 +0000 |
3811 | +++ playground/mir_demo_client_chain_jumping_buffers.c 2016-08-12 14:07:23 +0000 |
3812 | @@ -0,0 +1,260 @@ |
3813 | +/* |
3814 | + * Copyright © 2016 Canonical Ltd. |
3815 | + * |
3816 | + * This program is free software: you can redistribute it and/or modify it |
3817 | + * under the terms of the GNU Lesser General Public License version 3, |
3818 | + * as published by the Free Software Foundation. |
3819 | + * |
3820 | + * This program is distributed in the hope that it will be useful, |
3821 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3822 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3823 | + * GNU Lesser General Public License for more details. |
3824 | + * |
3825 | + * You should have received a copy of the GNU Lesser General Public License |
3826 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3827 | + * |
3828 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
3829 | + * |
3830 | + */ |
3831 | + |
3832 | +#include <mir_toolkit/mir_connection.h> |
3833 | +#include <mir_toolkit/mir_buffer_stream.h> |
3834 | +#include <mir_toolkit/mir_surface.h> |
3835 | +#include <mir_toolkit/mir_presentation_chain.h> |
3836 | +#include <mir_toolkit/mir_buffer.h> |
3837 | +#include <mir_toolkit/version.h> |
3838 | +#include <sys/types.h> |
3839 | +#include <signal.h> |
3840 | +#include <string.h> |
3841 | +#include <pthread.h> |
3842 | +#include <math.h> |
3843 | +#include <stdlib.h> |
3844 | +#include <getopt.h> |
3845 | +#include <unistd.h> |
3846 | +#include <assert.h> |
3847 | + |
3848 | +#define PALETTE_SIZE 5 |
3849 | + |
3850 | +void fill_buffer_diagonal_stripes( |
3851 | + MirBuffer* buffer, unsigned int fg, unsigned int bg) |
3852 | +{ |
3853 | + MirGraphicsRegion region = mir_buffer_get_graphics_region(buffer, mir_read_write); |
3854 | + if ((!region.vaddr) || (region.pixel_format != mir_pixel_format_abgr_8888)) |
3855 | + return; |
3856 | + |
3857 | + unsigned char* vaddr = (unsigned char*) region.vaddr; |
3858 | + int const num_stripes = 10; |
3859 | + int const stripes_thickness = region.width / num_stripes; |
3860 | + for(int i = 0; i < region.height; i++) |
3861 | + { |
3862 | + unsigned int* pixel = (unsigned int*) vaddr; |
3863 | + for(int j = 0; j < region.width ; j++) |
3864 | + { |
3865 | + if ((((i + j) / stripes_thickness) % stripes_thickness) % 2) |
3866 | + pixel[j] = bg; |
3867 | + else |
3868 | + pixel[j] = fg; |
3869 | + } |
3870 | + vaddr += region.stride; |
3871 | + } |
3872 | +} |
3873 | + |
3874 | +typedef struct SubmissionInfo |
3875 | +{ |
3876 | + int available; |
3877 | + MirBuffer* buffer; |
3878 | + pthread_mutex_t lock; |
3879 | + pthread_cond_t cv; |
3880 | +} SubmissionInfo; |
3881 | + |
3882 | +static void available_callback(MirBuffer* buffer, void* client_context) |
3883 | +{ |
3884 | + SubmissionInfo* info = (SubmissionInfo*) client_context; |
3885 | + pthread_mutex_lock(&info->lock); |
3886 | + info->available = 1; |
3887 | + info->buffer = buffer; |
3888 | + pthread_cond_broadcast(&info->cv); |
3889 | + pthread_mutex_unlock(&info->lock); |
3890 | +} |
3891 | + |
3892 | +volatile sig_atomic_t rendering = 1; |
3893 | +static void shutdown(int signum) |
3894 | +{ |
3895 | + if ((signum == SIGTERM) || (signum == SIGINT)) |
3896 | + rendering = 0; |
3897 | +} |
3898 | + |
3899 | +int main(int argc, char** argv) |
3900 | +{ |
3901 | + static char const *socket_file = NULL; |
3902 | + int arg = -1; |
3903 | + int width = 400; |
3904 | + int height = 400; |
3905 | + while ((arg = getopt (argc, argv, "m:s:h:")) != -1) |
3906 | + { |
3907 | + switch (arg) |
3908 | + { |
3909 | + case 'm': |
3910 | + socket_file = optarg; |
3911 | + break; |
3912 | + case 's': |
3913 | + { |
3914 | + unsigned int w, h; |
3915 | + if (sscanf(optarg, "%ux%u", &w, &h) == 2) |
3916 | + { |
3917 | + width = w; |
3918 | + height = h; |
3919 | + } |
3920 | + else |
3921 | + { |
3922 | + printf("Invalid size: %s, using default size\n", optarg); |
3923 | + } |
3924 | + break; |
3925 | + } |
3926 | + case 'h': |
3927 | + case '?': |
3928 | + default: |
3929 | + puts(argv[0]); |
3930 | + printf("Usage:\n"); |
3931 | + printf(" -m <Mir server socket>\n"); |
3932 | + printf(" -s WIDTHxHEIGHT of window\n"); |
3933 | + printf(" -h help dialog\n"); |
3934 | + return -1; |
3935 | + } |
3936 | + } |
3937 | + |
3938 | + |
3939 | + int const chain_width = width / 2; |
3940 | + int const chain_height = height / 2; |
3941 | + |
3942 | + sigset_t signal_set; |
3943 | + sigemptyset(&signal_set); |
3944 | + sigaddset(&signal_set, SIGALRM); |
3945 | + sigprocmask(SIG_BLOCK, &signal_set, NULL); |
3946 | + |
3947 | + struct sigaction action; |
3948 | + action.sa_handler = shutdown; |
3949 | + sigemptyset(&action.sa_mask); |
3950 | + action.sa_flags = 0; |
3951 | + sigaction(SIGINT, &action, NULL); |
3952 | + sigaction(SIGTERM, &action, NULL); |
3953 | + |
3954 | + |
3955 | + int displacement_x = 0; |
3956 | + int displacement_y = 0; |
3957 | + |
3958 | + MirPixelFormat format = mir_pixel_format_abgr_8888; |
3959 | + |
3960 | + MirConnection* connection = mir_connect_sync(socket_file, "prerendered_frames"); |
3961 | + if (!mir_connection_is_valid(connection)) |
3962 | + { |
3963 | + printf("could not connect to server file at: %s\n", socket_file); |
3964 | + return -1; |
3965 | + } |
3966 | + |
3967 | + unsigned int const num_chains = 4; |
3968 | + unsigned int const num_buffers = num_chains + 1; |
3969 | + unsigned int const fg[PALETTE_SIZE] = { |
3970 | + 0xFF14BEA0, |
3971 | + 0xFF000000, |
3972 | + 0xFF1111FF, |
3973 | + 0xFFAAAAAA, |
3974 | + 0xFFB00076 |
3975 | + }; |
3976 | + unsigned int const bg[PALETTE_SIZE] = { |
3977 | + 0xFFDF2111, |
3978 | + 0xFFFFFFFF, |
3979 | + 0xFF11DDDD, |
3980 | + 0xFF404040, |
3981 | + 0xFFFFFF00 |
3982 | + }; |
3983 | + unsigned int spare_buffer = 0; |
3984 | + |
3985 | + MirPresentationChain* chain[num_chains]; |
3986 | + for(unsigned int i = 0u; i < num_chains; i++) |
3987 | + { |
3988 | + chain[i] = mir_connection_create_presentation_chain_sync(connection); |
3989 | + if (!mir_presentation_chain_is_valid(chain[i])) |
3990 | + { |
3991 | + printf("could not create MirPresentationChain\n"); |
3992 | + |
3993 | + // TODO this is a frig to pass smoke tests until we support NBS by default |
3994 | +#if (MIR_CLIENT_VERSION <= MIR_VERSION_NUMBER(3, 3, 0)) |
3995 | + printf("This is currently an unreleased API - likely server support is switched off\n"); |
3996 | + return 0; |
3997 | +#else |
3998 | + return -1; |
3999 | +#endif |
4000 | + } |
4001 | + } |
4002 | + |
4003 | + //Arrange a 2x2 grid of chains within surface |
4004 | + MirSurfaceSpec* spec = mir_connection_create_spec_for_normal_surface(connection, width, height, format); |
4005 | + mir_surface_spec_add_presentation_chain( |
4006 | + spec, chain_width, chain_height, displacement_x, displacement_y, chain[0]); |
4007 | + mir_surface_spec_add_presentation_chain( |
4008 | + spec, chain_width, chain_height, chain_width, displacement_y, chain[1]); |
4009 | + mir_surface_spec_add_presentation_chain( |
4010 | + spec, chain_width, chain_height, displacement_x, chain_height, chain[2]); |
4011 | + mir_surface_spec_add_presentation_chain( |
4012 | + spec, chain_width, chain_height, chain_width, chain_height, chain[3]); |
4013 | + MirSurface* surface = mir_surface_create_sync(spec); |
4014 | + mir_surface_spec_release(spec); |
4015 | + |
4016 | + MirBufferUsage usage = mir_buffer_usage_software; |
4017 | + SubmissionInfo buffer_available[num_buffers]; |
4018 | + |
4019 | + //prerender the frames |
4020 | + for (unsigned int i = 0u; i < num_buffers; i++) |
4021 | + { |
4022 | + pthread_cond_init(&buffer_available[i].cv, NULL); |
4023 | + pthread_mutex_init(&buffer_available[i].lock, NULL); |
4024 | + buffer_available[i].available = 0; |
4025 | + buffer_available[i].buffer = NULL; |
4026 | + |
4027 | + mir_connection_allocate_buffer( |
4028 | + connection, width, height, format, usage, available_callback, &buffer_available[i]); |
4029 | + |
4030 | + pthread_mutex_lock(&buffer_available[i].lock); |
4031 | + while(!buffer_available[i].buffer) |
4032 | + pthread_cond_wait(&buffer_available[i].cv, &buffer_available[i].lock); |
4033 | + |
4034 | + fill_buffer_diagonal_stripes(buffer_available[i].buffer, |
4035 | + fg[i % PALETTE_SIZE], bg[i % PALETTE_SIZE]); |
4036 | + |
4037 | + pthread_mutex_unlock(&buffer_available[i].lock); |
4038 | + } |
4039 | + |
4040 | + while (rendering) |
4041 | + { |
4042 | + for(unsigned int i = 0u; i < num_chains; i++) |
4043 | + { |
4044 | + MirBuffer* b; |
4045 | + pthread_mutex_lock(&buffer_available[spare_buffer].lock); |
4046 | + while(!buffer_available[spare_buffer].available) |
4047 | + pthread_cond_wait(&buffer_available[spare_buffer].cv, &buffer_available[spare_buffer].lock); |
4048 | + buffer_available[spare_buffer].available = 0; |
4049 | + b = buffer_available[spare_buffer].buffer; |
4050 | + pthread_mutex_unlock(&buffer_available[spare_buffer].lock); |
4051 | + |
4052 | + mir_presentation_chain_submit_buffer(chain[i], b); |
4053 | + |
4054 | + //just looks like a blur if we don't slow things down |
4055 | + ualarm(500000, 0); |
4056 | + int sig; |
4057 | + sigwait(&signal_set, &sig); |
4058 | + if (!rendering) break; |
4059 | + |
4060 | + if (++spare_buffer > num_chains) |
4061 | + spare_buffer = 0; |
4062 | + } |
4063 | + } |
4064 | + |
4065 | + for (unsigned int i = 0u; i < num_buffers; i++) |
4066 | + mir_buffer_release(buffer_available[i].buffer); |
4067 | + for (unsigned int i = 0u; i < num_chains; i++) |
4068 | + mir_presentation_chain_release(chain[i]); |
4069 | + mir_surface_release_sync(surface); |
4070 | + mir_connection_release(connection); |
4071 | + return 0; |
4072 | +} |
4073 | |
4074 | === modified file 'playground/mir_demo_client_prerendered_frames.c' |
4075 | --- playground/mir_demo_client_prerendered_frames.c 2016-04-15 03:41:28 +0000 |
4076 | +++ playground/mir_demo_client_prerendered_frames.c 2016-08-12 14:07:23 +0000 |
4077 | @@ -71,9 +71,8 @@ |
4078 | pthread_cond_t cv; |
4079 | } SubmissionInfo; |
4080 | |
4081 | -static void available_callback(MirPresentationChain* chain, MirBuffer* buffer, void* client_context) |
4082 | +static void available_callback(MirBuffer* buffer, void* client_context) |
4083 | { |
4084 | - (void)chain; |
4085 | SubmissionInfo* info = (SubmissionInfo*) client_context; |
4086 | pthread_mutex_lock(&info->lock); |
4087 | info->available = 1; |
4088 | @@ -162,6 +161,12 @@ |
4089 | mir_surface_spec_add_presentation_chain( |
4090 | spec, width, height, displacement_x, displacement_y, chain); |
4091 | MirSurface* surface = mir_surface_create_sync(spec); |
4092 | + if (!mir_surface_is_valid(surface)) |
4093 | + { |
4094 | + printf("could not create MirSurface\n"); |
4095 | + return -1; |
4096 | + } |
4097 | + |
4098 | mir_surface_spec_release(spec); |
4099 | |
4100 | int num_prerendered_frames = 20; |
4101 | @@ -175,13 +180,19 @@ |
4102 | buffer_available[i].available = 0; |
4103 | buffer_available[i].buffer = NULL; |
4104 | |
4105 | - mir_presentation_chain_allocate_buffer( |
4106 | - chain, width, height, format, usage, available_callback, &buffer_available[i]); |
4107 | + mir_connection_allocate_buffer( |
4108 | + connection, width, height, format, usage, available_callback, &buffer_available[i]); |
4109 | |
4110 | pthread_mutex_lock(&buffer_available[i].lock); |
4111 | while(!buffer_available[i].buffer) |
4112 | pthread_cond_wait(&buffer_available[i].cv, &buffer_available[i].lock); |
4113 | |
4114 | + if (!mir_buffer_is_valid(buffer_available[i].buffer)) |
4115 | + { |
4116 | + printf("could not create MirBuffer\n"); |
4117 | + return -1; |
4118 | + } |
4119 | + |
4120 | float max_radius = distance(0, 0, width, height) / 2.0f; |
4121 | float radius_i = ((float) i + 1) / num_prerendered_frames * max_radius; |
4122 | fill_buffer_with_centered_circle_abgr(buffer_available[i].buffer, radius_i, fg, bg); |
4123 | |
4124 | === modified file 'playground/server_configuration.cpp' |
4125 | --- playground/server_configuration.cpp 2015-06-25 13:43:43 +0000 |
4126 | +++ playground/server_configuration.cpp 2016-08-12 14:07:23 +0000 |
4127 | @@ -28,12 +28,6 @@ |
4128 | namespace me = mir::examples; |
4129 | namespace mg = mir::graphics; |
4130 | |
4131 | -char const* const me::wm_option = "window-manager"; |
4132 | -char const* const me::wm_description = "window management strategy [{legacy|canonical|tiling}]"; |
4133 | -char const* const me::wm_tiling = "tiling"; |
4134 | -char const* const me::wm_legacy = "legacy"; |
4135 | -char const* const me::wm_canonical = "canonical"; |
4136 | - |
4137 | me::ServerConfiguration::ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options) : |
4138 | DefaultServerConfiguration(configuration_options) |
4139 | { |
4140 | @@ -42,8 +36,6 @@ |
4141 | configuration_options->add_options() |
4142 | (me::display_config_opt, po::value<std::string>()->default_value(me::clone_opt_val), |
4143 | me::display_config_descr); |
4144 | - configuration_options->add_options() |
4145 | - (wm_option, po::value<std::string>()->default_value(wm_legacy), wm_description); |
4146 | } |
4147 | |
4148 | me::ServerConfiguration::ServerConfiguration(int argc, char const** argv) : |
4149 | |
4150 | === modified file 'playground/server_configuration.h' |
4151 | --- playground/server_configuration.h 2015-06-17 05:20:42 +0000 |
4152 | +++ playground/server_configuration.h 2016-08-12 14:07:23 +0000 |
4153 | @@ -43,12 +43,6 @@ |
4154 | private: |
4155 | std::shared_ptr<input::EventFilter> quit_filter; |
4156 | }; |
4157 | - |
4158 | -extern char const* const wm_option; |
4159 | -extern char const* const wm_description; |
4160 | -extern char const* const wm_tiling; |
4161 | -extern char const* const wm_legacy; |
4162 | -extern char const* const wm_canonical; |
4163 | } |
4164 | } |
4165 | |
4166 | |
4167 | === modified file 'src/CMakeLists.txt' |
4168 | --- src/CMakeLists.txt 2016-03-23 06:39:56 +0000 |
4169 | +++ src/CMakeLists.txt 2016-08-12 14:07:23 +0000 |
4170 | @@ -1,5 +1,5 @@ |
4171 | # We need MIRPLATFORM_ABI in both libmirplatform and the platform implementations. |
4172 | -set(MIRPLATFORM_ABI 11) |
4173 | +set(MIRPLATFORM_ABI 13) |
4174 | |
4175 | # Add the cookie implementation before exposing any APIs |
4176 | add_subdirectory(cookie/) |
4177 | @@ -42,8 +42,6 @@ |
4178 | set(MIR_SERVER_REFERENCES ${MIR_SERVER_REFERENCES} PARENT_SCOPE) |
4179 | set(MIR_PLATFORM_OBJECTS ${MIR_PLATFORM_OBJECTS} PARENT_SCOPE) |
4180 | set(MIR_PLATFORM_REFERENCES ${MIR_PLATFORM_REFERENCES} PARENT_SCOPE) |
4181 | -set(MIR_COMMON_OBJECTS ${MIR_COMMON_OBJECTS} PARENT_SCOPE) |
4182 | -set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE) |
4183 | set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE) |
4184 | set(MIR_SERVER_PLATFORM_PATH ${MIR_SERVER_PLATFORM_PATH} PARENT_SCOPE) |
4185 | |
4186 | |
4187 | === modified file 'src/client/CMakeLists.txt' |
4188 | --- src/client/CMakeLists.txt 2016-04-18 17:45:54 +0000 |
4189 | +++ src/client/CMakeLists.txt 2016-08-12 14:07:23 +0000 |
4190 | @@ -79,6 +79,7 @@ |
4191 | error_stream.cpp |
4192 | error_chain.cpp |
4193 | buffer.cpp |
4194 | + error_buffer.cpp |
4195 | presentation_chain.cpp |
4196 | mir_presentation_chain_api.cpp |
4197 | mir_buffer_api.cpp |
4198 | |
4199 | === modified file 'src/client/atomic_callback.h' |
4200 | --- src/client/atomic_callback.h 2016-01-29 08:18:22 +0000 |
4201 | +++ src/client/atomic_callback.h 2016-08-12 14:07:23 +0000 |
4202 | @@ -35,6 +35,11 @@ |
4203 | { |
4204 | } |
4205 | |
4206 | + AtomicCallback(std::function<void(Args...)> const& fn) |
4207 | + : callback(fn) |
4208 | + { |
4209 | + } |
4210 | + |
4211 | ~AtomicCallback() = default; |
4212 | |
4213 | void set_callback(std::function<void(Args...)> const& fn) |
4214 | |
4215 | === modified file 'src/client/buffer.cpp' |
4216 | --- src/client/buffer.cpp 2016-04-13 10:48:30 +0000 |
4217 | +++ src/client/buffer.cpp 2016-08-12 14:07:23 +0000 |
4218 | @@ -26,14 +26,13 @@ |
4219 | mir_buffer_callback cb, void* context, |
4220 | int buffer_id, |
4221 | std::shared_ptr<ClientBuffer> const& buffer, |
4222 | - MirPresentationChain* chain, |
4223 | + MirConnection* connection, |
4224 | MirBufferUsage usage) : |
4225 | - cb(cb), |
4226 | - cb_context(context), |
4227 | buffer_id(buffer_id), |
4228 | buffer(buffer), |
4229 | + cb([this, cb, context]{ (*cb)(reinterpret_cast<::MirBuffer*>(this), context); }), |
4230 | owned(false), |
4231 | - chain(chain), |
4232 | + connection(connection), |
4233 | usage(usage) |
4234 | { |
4235 | } |
4236 | @@ -60,8 +59,8 @@ |
4237 | if (!owned) |
4238 | owned = true; |
4239 | } |
4240 | - cb(nullptr, reinterpret_cast<MirBuffer*>(this), cb_context); |
4241 | |
4242 | + cb(); |
4243 | } |
4244 | |
4245 | void mcl::Buffer::received(MirBufferPackage const& update_package) |
4246 | @@ -74,7 +73,8 @@ |
4247 | buffer->update_from(update_package); |
4248 | } |
4249 | } |
4250 | - cb(nullptr, reinterpret_cast<MirBuffer*>(this), cb_context); |
4251 | + |
4252 | + cb(); |
4253 | } |
4254 | |
4255 | MirGraphicsRegion mcl::Buffer::map_region() |
4256 | @@ -110,9 +110,9 @@ |
4257 | return buffer->wait_fence(access, timeout); |
4258 | } |
4259 | |
4260 | -MirPresentationChain* mcl::Buffer::allocating_chain() const |
4261 | +MirConnection* mcl::Buffer::allocating_connection() const |
4262 | { |
4263 | - return chain; |
4264 | + return connection; |
4265 | } |
4266 | |
4267 | MirBufferUsage mcl::Buffer::buffer_usage() const |
4268 | @@ -138,3 +138,18 @@ |
4269 | { |
4270 | buffer->increment_age(); |
4271 | } |
4272 | + |
4273 | +bool mcl::Buffer::valid() const |
4274 | +{ |
4275 | + return true; |
4276 | +} |
4277 | + |
4278 | +char const* mcl::Buffer::error_message() const |
4279 | +{ |
4280 | + return ""; |
4281 | +} |
4282 | + |
4283 | +void mcl::Buffer::set_callback(mir_buffer_callback callback, void* context) |
4284 | +{ |
4285 | + cb.set_callback([&, callback, context]{ (*callback)(reinterpret_cast<::MirBuffer*>(this), context); }); |
4286 | +} |
4287 | |
4288 | === modified file 'src/client/buffer.h' |
4289 | --- src/client/buffer.h 2016-04-13 10:48:30 +0000 |
4290 | +++ src/client/buffer.h 2016-08-12 14:07:23 +0000 |
4291 | @@ -21,6 +21,8 @@ |
4292 | |
4293 | #include "mir_toolkit/mir_buffer.h" |
4294 | #include "mir/geometry/size.h" |
4295 | +#include "atomic_callback.h" |
4296 | +#include "mir_buffer.h" |
4297 | #include <memory> |
4298 | #include <chrono> |
4299 | #include <mutex> |
4300 | @@ -31,47 +33,50 @@ |
4301 | { |
4302 | class ClientBuffer; |
4303 | class MemoryRegion; |
4304 | -//this is the type backing MirBuffer* |
4305 | -class Buffer |
4306 | +class Buffer : public MirBuffer |
4307 | { |
4308 | public: |
4309 | Buffer( |
4310 | mir_buffer_callback cb, void* context, |
4311 | int buffer_id, |
4312 | std::shared_ptr<ClientBuffer> const& buffer, |
4313 | - MirPresentationChain* chain, |
4314 | + MirConnection* connection, |
4315 | MirBufferUsage usage); |
4316 | - int rpc_id() const; |
4317 | - |
4318 | - void submitted(); |
4319 | - void received(); |
4320 | - void received(MirBufferPackage const& update_message); |
4321 | - |
4322 | - MirNativeBuffer* as_mir_native_buffer() const; |
4323 | - std::shared_ptr<ClientBuffer> client_buffer() const; |
4324 | - MirGraphicsRegion map_region(); |
4325 | - |
4326 | - void set_fence(MirNativeFence*, MirBufferAccess); |
4327 | - MirNativeFence* get_fence() const; |
4328 | - bool wait_fence(MirBufferAccess, std::chrono::nanoseconds); |
4329 | - |
4330 | - MirBufferUsage buffer_usage() const; |
4331 | - MirPixelFormat pixel_format() const; |
4332 | - geometry::Size size() const; |
4333 | - |
4334 | - MirPresentationChain* allocating_chain() const; |
4335 | - |
4336 | - void increment_age(); |
4337 | + |
4338 | + int rpc_id() const override; |
4339 | + |
4340 | + void submitted() override; |
4341 | + void received() override; |
4342 | + void received(MirBufferPackage const& update_message) override; |
4343 | + |
4344 | + MirNativeBuffer* as_mir_native_buffer() const override; |
4345 | + std::shared_ptr<ClientBuffer> client_buffer() const override; |
4346 | + MirGraphicsRegion map_region() override; |
4347 | + |
4348 | + void set_fence(MirNativeFence*, MirBufferAccess) override; |
4349 | + MirNativeFence* get_fence() const override; |
4350 | + bool wait_fence(MirBufferAccess, std::chrono::nanoseconds) override; |
4351 | + |
4352 | + MirBufferUsage buffer_usage() const override; |
4353 | + MirPixelFormat pixel_format() const override; |
4354 | + geometry::Size size() const override; |
4355 | + |
4356 | + MirConnection* allocating_connection() const override; |
4357 | + |
4358 | + void increment_age() override; |
4359 | + bool valid() const override; |
4360 | + char const* error_message() const override; |
4361 | + void set_callback(mir_buffer_callback callback, void* context) override; |
4362 | private: |
4363 | - mir_buffer_callback cb; |
4364 | - void* cb_context; |
4365 | int const buffer_id; |
4366 | - std::shared_ptr<ClientBuffer> buffer; |
4367 | + std::shared_ptr<ClientBuffer> const buffer; |
4368 | + |
4369 | + AtomicCallback<> cb; |
4370 | |
4371 | std::mutex mutex; |
4372 | bool owned; |
4373 | std::shared_ptr<MemoryRegion> mapped_region; |
4374 | - MirPresentationChain* const chain; |
4375 | + MirConnection* const connection; |
4376 | MirBufferUsage const usage; |
4377 | }; |
4378 | } |
4379 | |
4380 | === modified file 'src/client/buffer_factory.cpp' |
4381 | --- src/client/buffer_factory.cpp 2016-04-11 14:14:38 +0000 |
4382 | +++ src/client/buffer_factory.cpp 2016-08-12 14:07:23 +0000 |
4383 | @@ -18,6 +18,7 @@ |
4384 | |
4385 | #include "mir/client_buffer_factory.h" |
4386 | #include "buffer_factory.h" |
4387 | +#include "error_buffer.h" |
4388 | #include <algorithm> |
4389 | #include <boost/throw_exception.hpp> |
4390 | #include "protobuf_to_native_buffer.h" |
4391 | @@ -27,11 +28,11 @@ |
4392 | |
4393 | mcl::BufferFactory::AllocationRequest::AllocationRequest( |
4394 | std::shared_ptr<mcl::ClientBufferFactory> const& native_buffer_factory, |
4395 | - MirPresentationChain* chain, |
4396 | + MirConnection* connection, |
4397 | geom::Size size, MirPixelFormat format, MirBufferUsage usage, |
4398 | mir_buffer_callback cb, void* cb_context) : |
4399 | native_buffer_factory(native_buffer_factory), |
4400 | - chain(chain), |
4401 | + connection(connection), |
4402 | size(size), |
4403 | format(format), |
4404 | usage(usage), |
4405 | @@ -42,7 +43,7 @@ |
4406 | |
4407 | void mcl::BufferFactory::expect_buffer( |
4408 | std::shared_ptr<mcl::ClientBufferFactory> const& factory, |
4409 | - MirPresentationChain* chain, |
4410 | + MirConnection* connection, |
4411 | geometry::Size size, |
4412 | MirPixelFormat format, |
4413 | MirBufferUsage usage, |
4414 | @@ -51,10 +52,10 @@ |
4415 | { |
4416 | std::lock_guard<decltype(mutex)> lk(mutex); |
4417 | allocation_requests.emplace_back( |
4418 | - std::make_unique<AllocationRequest>(factory, chain, size, format, usage, cb, cb_context)); |
4419 | + std::make_unique<AllocationRequest>(factory, connection, size, format, usage, cb, cb_context)); |
4420 | } |
4421 | |
4422 | -std::unique_ptr<mcl::Buffer> mcl::BufferFactory::generate_buffer(mir::protobuf::Buffer const& buffer) |
4423 | +std::unique_ptr<mcl::MirBuffer> mcl::BufferFactory::generate_buffer(mir::protobuf::Buffer const& buffer) |
4424 | { |
4425 | std::lock_guard<decltype(mutex)> lk(mutex); |
4426 | auto request_it = std::find_if(allocation_requests.begin(), allocation_requests.end(), |
4427 | @@ -66,13 +67,23 @@ |
4428 | if (request_it == allocation_requests.end()) |
4429 | BOOST_THROW_EXCEPTION(std::logic_error("unrequested buffer received")); |
4430 | |
4431 | - auto b = std::make_unique<Buffer>( |
4432 | - (*request_it)->cb, (*request_it)->cb_context, |
4433 | - buffer.buffer_id(), |
4434 | - (*request_it)->native_buffer_factory->create_buffer( |
4435 | - mcl::protobuf_to_native_buffer(buffer), |
4436 | - (*request_it)->size, (*request_it)->format), |
4437 | - (*request_it)->chain, (*request_it)->usage); |
4438 | + std::unique_ptr<mcl::MirBuffer> b; |
4439 | + if (buffer.has_error()) |
4440 | + { |
4441 | + b = std::make_unique<ErrorBuffer>( |
4442 | + buffer.error(), error_id--, |
4443 | + (*request_it)->cb, (*request_it)->cb_context, (*request_it)->connection); |
4444 | + } |
4445 | + else |
4446 | + { |
4447 | + b = std::make_unique<Buffer>( |
4448 | + (*request_it)->cb, (*request_it)->cb_context, |
4449 | + buffer.buffer_id(), |
4450 | + (*request_it)->native_buffer_factory->create_buffer( |
4451 | + mcl::protobuf_to_native_buffer(buffer), |
4452 | + (*request_it)->size, (*request_it)->format), |
4453 | + (*request_it)->connection, (*request_it)->usage); |
4454 | + } |
4455 | |
4456 | allocation_requests.erase(request_it); |
4457 | return std::move(b); |
4458 | |
4459 | === modified file 'src/client/buffer_factory.h' |
4460 | --- src/client/buffer_factory.h 2016-04-11 14:14:38 +0000 |
4461 | +++ src/client/buffer_factory.h 2016-08-12 14:07:23 +0000 |
4462 | @@ -36,10 +36,10 @@ |
4463 | virtual ~AsyncBufferFactory() = default; |
4464 | AsyncBufferFactory() = default; |
4465 | |
4466 | - virtual std::unique_ptr<Buffer> generate_buffer(mir::protobuf::Buffer const& buffer) = 0; |
4467 | + virtual std::unique_ptr<MirBuffer> generate_buffer(mir::protobuf::Buffer const& buffer) = 0; |
4468 | virtual void expect_buffer( |
4469 | std::shared_ptr<ClientBufferFactory> const& native_buffer_factory, |
4470 | - MirPresentationChain* chain, |
4471 | + MirConnection* connection, |
4472 | geometry::Size size, |
4473 | MirPixelFormat format, |
4474 | MirBufferUsage usage, |
4475 | @@ -55,10 +55,10 @@ |
4476 | class BufferFactory : public AsyncBufferFactory |
4477 | { |
4478 | public: |
4479 | - std::unique_ptr<Buffer> generate_buffer(mir::protobuf::Buffer const& buffer) override; |
4480 | + std::unique_ptr<MirBuffer> generate_buffer(mir::protobuf::Buffer const& buffer) override; |
4481 | void expect_buffer( |
4482 | std::shared_ptr<ClientBufferFactory> const& native_buffer_factory, |
4483 | - MirPresentationChain* chain, |
4484 | + MirConnection* connection, |
4485 | geometry::Size size, |
4486 | MirPixelFormat format, |
4487 | MirBufferUsage usage, |
4488 | @@ -68,11 +68,12 @@ |
4489 | |
4490 | private: |
4491 | std::mutex mutex; |
4492 | + int error_id { -1 }; |
4493 | struct AllocationRequest |
4494 | { |
4495 | AllocationRequest( |
4496 | std::shared_ptr<ClientBufferFactory> const& native_buffer_factory, |
4497 | - MirPresentationChain* chain, |
4498 | + MirConnection* connection, |
4499 | geometry::Size size, |
4500 | MirPixelFormat format, |
4501 | MirBufferUsage usage, |
4502 | @@ -80,7 +81,7 @@ |
4503 | void* cb_context); |
4504 | |
4505 | std::shared_ptr<ClientBufferFactory> const native_buffer_factory; |
4506 | - MirPresentationChain* chain; |
4507 | + MirConnection* connection; |
4508 | geometry::Size size; |
4509 | MirPixelFormat format; |
4510 | MirBufferUsage usage; |
4511 | |
4512 | === removed file 'src/client/buffer_receiver.h' |
4513 | --- src/client/buffer_receiver.h 2016-02-05 19:47:01 +0000 |
4514 | +++ src/client/buffer_receiver.h 1970-01-01 00:00:00 +0000 |
4515 | @@ -1,45 +0,0 @@ |
4516 | -/* |
4517 | - * Copyright © 2016 Canonical Ltd. |
4518 | - * |
4519 | - * This program is free software: you can redistribute it and/or modify it |
4520 | - * under the terms of the GNU Lesser General Public License version 3, |
4521 | - * as published by the Free Software Foundation. |
4522 | - * |
4523 | - * This program is distributed in the hope that it will be useful, |
4524 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4525 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4526 | - * GNU Lesser General Public License for more details. |
4527 | - * |
4528 | - * You should have received a copy of the GNU Lesser General Public License |
4529 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4530 | - * |
4531 | - * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
4532 | - */ |
4533 | - |
4534 | -#ifndef MIR_CLIENT_BUFFER_RECEIVER_H_ |
4535 | -#define MIR_CLIENT_BUFFER_RECEIVER_H_ |
4536 | - |
4537 | -namespace mir |
4538 | -{ |
4539 | -namespace protobuf |
4540 | -{ |
4541 | -class Buffer; |
4542 | -} |
4543 | -namespace client |
4544 | -{ |
4545 | - |
4546 | -class BufferReceiver |
4547 | -{ |
4548 | -public: |
4549 | - virtual void buffer_available(mir::protobuf::Buffer const& buffer) = 0; |
4550 | - virtual void buffer_unavailable() = 0; |
4551 | -protected: |
4552 | - virtual ~BufferReceiver() = default; |
4553 | - BufferReceiver() = default; |
4554 | - BufferReceiver(const BufferReceiver&) = delete; |
4555 | - BufferReceiver& operator=(const BufferReceiver&) = delete; |
4556 | -}; |
4557 | - |
4558 | -} |
4559 | -} |
4560 | -#endif /* MIR_CLIENT_BUFFER_RECEIVER_H_ */ |
4561 | |
4562 | === modified file 'src/client/buffer_stream.cpp' |
4563 | --- src/client/buffer_stream.cpp 2016-06-02 13:03:43 +0000 |
4564 | +++ src/client/buffer_stream.cpp 2016-08-12 14:07:23 +0000 |
4565 | @@ -274,7 +274,7 @@ |
4566 | google::protobuf::NewCallback(Requests::ignore_response, protobuf_void)); |
4567 | } |
4568 | |
4569 | - void submit_buffer(mcl::Buffer& buffer) override |
4570 | + void submit_buffer(mcl::MirBuffer& buffer) override |
4571 | { |
4572 | mp::BufferRequest request; |
4573 | request.mutable_id()->set_value(stream_id); |
4574 | @@ -405,8 +405,8 @@ |
4575 | |
4576 | mcl::BufferVault vault; |
4577 | std::mutex mutable mutex; |
4578 | - std::shared_ptr<mcl::Buffer> current{nullptr}; |
4579 | - mir::client::NoTLSFuture<std::shared_ptr<mcl::Buffer>> future; |
4580 | + std::shared_ptr<mcl::MirBuffer> current{nullptr}; |
4581 | + mir::client::NoTLSFuture<std::shared_ptr<mcl::MirBuffer>> future; |
4582 | MirWaitHandle scale_wait_handle; |
4583 | int current_swap_interval = 1; |
4584 | geom::Size size_; |
4585 | |
4586 | === modified file 'src/client/buffer_vault.cpp' |
4587 | --- src/client/buffer_vault.cpp 2016-07-27 12:35:58 +0000 |
4588 | +++ src/client/buffer_vault.cpp 2016-08-12 14:07:23 +0000 |
4589 | @@ -45,7 +45,7 @@ |
4590 | |
4591 | namespace |
4592 | { |
4593 | -void incoming_buffer(MirPresentationChain*, MirBuffer* buffer, void* context) |
4594 | +void incoming_buffer(MirBuffer* buffer, void* context) |
4595 | { |
4596 | auto vault = static_cast<mcl::BufferVault*>(context); |
4597 | vault->wire_transfer_inbound(reinterpret_cast<mcl::Buffer*>(buffer)->rpc_id()); |
4598 | @@ -108,7 +108,7 @@ |
4599 | alloc_buffer(size, format, usage); |
4600 | } |
4601 | |
4602 | -std::shared_ptr<mcl::Buffer> mcl::BufferVault::checked_buffer_from_map(int id) |
4603 | +std::shared_ptr<mcl::MirBuffer> mcl::BufferVault::checked_buffer_from_map(int id) |
4604 | { |
4605 | auto map = surface_map.lock(); |
4606 | if (!map) |
4607 | @@ -120,7 +120,6 @@ |
4608 | BOOST_THROW_EXCEPTION(std::logic_error("no buffer in map")); |
4609 | } |
4610 | |
4611 | - |
4612 | mcl::BufferVault::BufferMap::iterator mcl::BufferVault::available_buffer() |
4613 | { |
4614 | auto it = std::find_if(buffers.begin(), buffers.end(), |
4615 | @@ -136,10 +135,10 @@ |
4616 | return it; |
4617 | } |
4618 | |
4619 | -mcl::NoTLSFuture<std::shared_ptr<mcl::Buffer>> mcl::BufferVault::withdraw() |
4620 | +mcl::NoTLSFuture<std::shared_ptr<mcl::MirBuffer>> mcl::BufferVault::withdraw() |
4621 | { |
4622 | - std::unique_lock<std::mutex> lk(mutex); |
4623 | std::vector<int> free_ids; |
4624 | + std::unique_lock<std::mutex> lk(mutex); |
4625 | if (disconnected_) |
4626 | BOOST_THROW_EXCEPTION(std::logic_error("server_disconnected")); |
4627 | |
4628 | @@ -159,7 +158,7 @@ |
4629 | } |
4630 | } |
4631 | |
4632 | - mcl::NoTLSPromise<std::shared_ptr<mcl::Buffer>> promise; |
4633 | + mcl::NoTLSPromise<std::shared_ptr<mcl::MirBuffer>> promise; |
4634 | auto it = available_buffer(); |
4635 | auto future = promise.get_future(); |
4636 | if (it != buffers.end()) |
4637 | @@ -187,7 +186,7 @@ |
4638 | return future; |
4639 | } |
4640 | |
4641 | -void mcl::BufferVault::deposit(std::shared_ptr<mcl::Buffer> const& buffer) |
4642 | +void mcl::BufferVault::deposit(std::shared_ptr<mcl::MirBuffer> const& buffer) |
4643 | { |
4644 | std::lock_guard<std::mutex> lk(mutex); |
4645 | auto it = buffers.find(buffer->rpc_id()); |
4646 | @@ -199,7 +198,7 @@ |
4647 | } |
4648 | |
4649 | MirWaitHandle* mcl::BufferVault::wire_transfer_outbound( |
4650 | - std::shared_ptr<mcl::Buffer> const& buffer, std::function<void()> const& done) |
4651 | + std::shared_ptr<mcl::MirBuffer> const& buffer, std::function<void()> const& done) |
4652 | { |
4653 | std::unique_lock<std::mutex> lk(mutex); |
4654 | auto it = buffers.find(buffer->rpc_id()); |
4655 | |
4656 | === modified file 'src/client/buffer_vault.h' |
4657 | --- src/client/buffer_vault.h 2016-07-27 12:35:58 +0000 |
4658 | +++ src/client/buffer_vault.h 2016-08-12 14:07:23 +0000 |
4659 | @@ -34,7 +34,7 @@ |
4660 | namespace client |
4661 | { |
4662 | class ClientBuffer; |
4663 | -class Buffer; |
4664 | +class MirBuffer; |
4665 | class AsyncBufferFactory; |
4666 | class SurfaceMap; |
4667 | |
4668 | @@ -43,7 +43,7 @@ |
4669 | public: |
4670 | virtual void allocate_buffer(geometry::Size size, MirPixelFormat format, int usage) = 0; |
4671 | virtual void free_buffer(int buffer_id) = 0; |
4672 | - virtual void submit_buffer(Buffer&) = 0; |
4673 | + virtual void submit_buffer(MirBuffer&) = 0; |
4674 | virtual ~ServerBufferRequests() = default; |
4675 | protected: |
4676 | ServerBufferRequests() = default; |
4677 | @@ -65,11 +65,11 @@ |
4678 | unsigned int initial_nbuffers); |
4679 | ~BufferVault(); |
4680 | |
4681 | - NoTLSFuture<std::shared_ptr<Buffer>> withdraw(); |
4682 | - void deposit(std::shared_ptr<Buffer> const& buffer); |
4683 | + NoTLSFuture<std::shared_ptr<MirBuffer>> withdraw(); |
4684 | + void deposit(std::shared_ptr<MirBuffer> const& buffer); |
4685 | void wire_transfer_inbound(int buffer_id); |
4686 | MirWaitHandle* wire_transfer_outbound( |
4687 | - std::shared_ptr<Buffer> const& buffer, std::function<void()> const&); |
4688 | + std::shared_ptr<MirBuffer> const& buffer, std::function<void()> const&); |
4689 | void set_size(geometry::Size); |
4690 | void disconnected(); |
4691 | void set_scale(float scale); |
4692 | @@ -85,9 +85,9 @@ |
4693 | void alloc_buffer(geometry::Size size, MirPixelFormat format, int usage); |
4694 | void free_buffer(int free_id); |
4695 | void realloc_buffer(int free_id, geometry::Size size, MirPixelFormat format, int usage); |
4696 | - void set_size(std::unique_lock<std::mutex>const& lk, geometry::Size new_size); |
4697 | + std::shared_ptr<MirBuffer> checked_buffer_from_map(int id); |
4698 | + void set_size(std::unique_lock<std::mutex> const& lk, geometry::Size new_size); |
4699 | |
4700 | - std::shared_ptr<Buffer> checked_buffer_from_map(int id); |
4701 | |
4702 | std::shared_ptr<ClientBufferFactory> const platform_factory; |
4703 | std::shared_ptr<AsyncBufferFactory> const buffer_factory; |
4704 | @@ -98,7 +98,7 @@ |
4705 | |
4706 | std::mutex mutex; |
4707 | BufferMap buffers; |
4708 | - std::deque<NoTLSPromise<std::shared_ptr<Buffer>>> promises; |
4709 | + std::deque<NoTLSPromise<std::shared_ptr<MirBuffer>>> promises; |
4710 | geometry::Size size; |
4711 | bool disconnected_; |
4712 | size_t current_buffer_count; |
4713 | |
4714 | === modified file 'src/client/client_buffer_stream.h' |
4715 | --- src/client/client_buffer_stream.h 2016-03-23 06:39:56 +0000 |
4716 | +++ src/client/client_buffer_stream.h 2016-08-12 14:07:23 +0000 |
4717 | @@ -19,7 +19,6 @@ |
4718 | #ifndef MIR_CLIENT_CLIENT_BUFFER_STREAM_H_ |
4719 | #define MIR_CLIENT_CLIENT_BUFFER_STREAM_H_ |
4720 | |
4721 | -#include "buffer_receiver.h" |
4722 | #include "mir/frontend/buffer_stream_id.h" |
4723 | #include "mir/geometry/size.h" |
4724 | |
4725 | @@ -66,7 +65,7 @@ |
4726 | class ClientBuffer; |
4727 | class MemoryRegion; |
4728 | |
4729 | -class ClientBufferStream : public BufferReceiver |
4730 | +class ClientBufferStream |
4731 | { |
4732 | public: |
4733 | virtual ~ClientBufferStream() = default; |
4734 | @@ -93,6 +92,8 @@ |
4735 | virtual char const* get_error_message() const = 0; |
4736 | virtual MirConnection* connection() const = 0; |
4737 | |
4738 | + virtual void buffer_available(mir::protobuf::Buffer const& buffer) = 0; |
4739 | + virtual void buffer_unavailable() = 0; |
4740 | protected: |
4741 | ClientBufferStream() = default; |
4742 | ClientBufferStream(const ClientBufferStream&) = delete; |
4743 | |
4744 | === modified file 'src/client/connection_surface_map.h' |
4745 | --- src/client/connection_surface_map.h 2016-04-01 17:26:51 +0000 |
4746 | +++ src/client/connection_surface_map.h 2016-08-12 14:07:23 +0000 |
4747 | @@ -24,11 +24,12 @@ |
4748 | #include <shared_mutex> |
4749 | #include <unordered_map> |
4750 | |
4751 | +class MirPresentationChain; |
4752 | namespace mir |
4753 | { |
4754 | namespace client |
4755 | { |
4756 | -class Buffer; |
4757 | +class MirBuffer; |
4758 | class PresentationChain; |
4759 | class ConnectionSurfaceMap : public SurfaceMap |
4760 | { |
4761 | @@ -37,22 +38,26 @@ |
4762 | void insert(frontend::SurfaceId surface_id, std::shared_ptr<MirSurface> const& surface); |
4763 | void erase(frontend::SurfaceId surface_id); |
4764 | |
4765 | - void with_stream_do(frontend::BufferStreamId stream_id, std::function<void(BufferReceiver*)> const& exec) const override; |
4766 | - void with_all_streams_do(std::function<void(BufferReceiver*)> const&) const override; |
4767 | + void with_stream_do(frontend::BufferStreamId stream_id, std::function<void(ClientBufferStream*)> const& exec) const override; |
4768 | + void with_all_streams_do(std::function<void(ClientBufferStream*)> const&) const override; |
4769 | |
4770 | - void insert(frontend::BufferStreamId stream_id, std::shared_ptr<BufferReceiver> const& stream); |
4771 | + void insert(frontend::BufferStreamId stream_id, std::shared_ptr<ClientBufferStream> const& chain); |
4772 | + void insert(frontend::BufferStreamId stream_id, std::shared_ptr<MirPresentationChain> const& chain); |
4773 | void erase(frontend::BufferStreamId surface_id); |
4774 | |
4775 | //TODO: should have a mf::BufferID |
4776 | - void insert(int buffer_id, std::shared_ptr<Buffer> const& buffer) override; |
4777 | + void insert(int buffer_id, std::shared_ptr<MirBuffer> const& buffer) override; |
4778 | void erase(int buffer_id) override; |
4779 | - std::shared_ptr<Buffer> buffer(int buffer_id) const override; |
4780 | + std::shared_ptr<MirBuffer> buffer(int buffer_id) const override; |
4781 | |
4782 | private: |
4783 | std::shared_timed_mutex mutable guard; |
4784 | std::unordered_map<frontend::SurfaceId, std::shared_ptr<MirSurface>> surfaces; |
4785 | - std::unordered_map<frontend::BufferStreamId, std::shared_ptr<BufferReceiver>> streams; |
4786 | - std::unordered_map<int, std::shared_ptr<Buffer>> buffers; |
4787 | + std::shared_timed_mutex mutable stream_guard; |
4788 | + std::unordered_map<frontend::BufferStreamId, std::shared_ptr<ClientBufferStream>> streams; |
4789 | + std::unordered_map<frontend::BufferStreamId, std::shared_ptr<MirPresentationChain>> chains; |
4790 | + std::shared_timed_mutex mutable buffer_guard; |
4791 | + std::unordered_map<int, std::shared_ptr<MirBuffer>> buffers; |
4792 | }; |
4793 | |
4794 | } |
4795 | |
4796 | === added file 'src/client/error_buffer.cpp' |
4797 | --- src/client/error_buffer.cpp 1970-01-01 00:00:00 +0000 |
4798 | +++ src/client/error_buffer.cpp 2016-08-12 14:07:23 +0000 |
4799 | @@ -0,0 +1,78 @@ |
4800 | +/* |
4801 | + * Copyright © 2016 Canonical Ltd. |
4802 | + * |
4803 | + * This program is free software: you can redistribute it and/or modify it |
4804 | + * under the terms of the GNU Lesser General Public License version 3, |
4805 | + * as published by the Free Software Foundation. |
4806 | + * |
4807 | + * This program is distributed in the hope that it will be useful, |
4808 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4809 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4810 | + * GNU Lesser General Public License for more details. |
4811 | + * |
4812 | + * You should have received a copy of the GNU Lesser General Public License |
4813 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4814 | + * |
4815 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
4816 | + */ |
4817 | + |
4818 | +#include "error_buffer.h" |
4819 | +#include <boost/throw_exception.hpp> |
4820 | + |
4821 | +namespace mcl = mir::client; |
4822 | +namespace geom = mir::geometry; |
4823 | + |
4824 | +mcl::ErrorBuffer::ErrorBuffer( |
4825 | + std::string const& msg, int buffer_id, |
4826 | + mir_buffer_callback cb, void* context, |
4827 | + MirConnection* connection) : |
4828 | + error_msg(msg), |
4829 | + buffer_id(buffer_id), |
4830 | + cb(cb), |
4831 | + cb_context(context), |
4832 | + connection(connection) |
4833 | +{ |
4834 | +} |
4835 | + |
4836 | +bool mcl::ErrorBuffer::valid() const |
4837 | +{ |
4838 | + return false; |
4839 | +} |
4840 | + |
4841 | +char const* mcl::ErrorBuffer::error_message() const |
4842 | +{ |
4843 | + return error_msg.c_str(); |
4844 | +} |
4845 | + |
4846 | +void mcl::ErrorBuffer::received() |
4847 | +{ |
4848 | + cb(reinterpret_cast<::MirBuffer*>(static_cast<mcl::MirBuffer*>(this)), cb_context); |
4849 | +} |
4850 | + |
4851 | +int mcl::ErrorBuffer::rpc_id() const |
4852 | +{ |
4853 | + return buffer_id; |
4854 | +} |
4855 | + |
4856 | +MirConnection* mcl::ErrorBuffer::allocating_connection() const |
4857 | +{ |
4858 | + return connection; |
4859 | +} |
4860 | + |
4861 | +#define THROW_EXCEPTION \ |
4862 | +{ \ |
4863 | + BOOST_THROW_EXCEPTION(std::logic_error("error: use of MirBuffer when mir_buffer_is_valid() is false"));\ |
4864 | +} |
4865 | +void mcl::ErrorBuffer::submitted() THROW_EXCEPTION |
4866 | +void mcl::ErrorBuffer::received(MirBufferPackage const&) THROW_EXCEPTION |
4867 | +MirNativeBuffer* mcl::ErrorBuffer::as_mir_native_buffer() const THROW_EXCEPTION |
4868 | +std::shared_ptr<mcl::ClientBuffer> mcl::ErrorBuffer::client_buffer() const THROW_EXCEPTION |
4869 | +MirGraphicsRegion mcl::ErrorBuffer::map_region() THROW_EXCEPTION |
4870 | +void mcl::ErrorBuffer::set_fence(MirNativeFence*, MirBufferAccess) THROW_EXCEPTION |
4871 | +MirNativeFence* mcl::ErrorBuffer::get_fence() const THROW_EXCEPTION |
4872 | +bool mcl::ErrorBuffer::wait_fence(MirBufferAccess, std::chrono::nanoseconds) THROW_EXCEPTION |
4873 | +MirBufferUsage mcl::ErrorBuffer::buffer_usage() const THROW_EXCEPTION |
4874 | +MirPixelFormat mcl::ErrorBuffer::pixel_format() const THROW_EXCEPTION |
4875 | +geom::Size mcl::ErrorBuffer::size() const THROW_EXCEPTION |
4876 | +void mcl::ErrorBuffer::increment_age() THROW_EXCEPTION |
4877 | +void mcl::ErrorBuffer::set_callback(mir_buffer_callback, void*) THROW_EXCEPTION |
4878 | |
4879 | === added file 'src/client/error_buffer.h' |
4880 | --- src/client/error_buffer.h 1970-01-01 00:00:00 +0000 |
4881 | +++ src/client/error_buffer.h 2016-08-12 14:07:23 +0000 |
4882 | @@ -0,0 +1,63 @@ |
4883 | +/* |
4884 | + * Copyright © 2016 Canonical Ltd. |
4885 | + * |
4886 | + * This program is free software: you can redistribute it and/or modify |
4887 | + * it under the terms of the GNU Lesser General Public License version 3 as |
4888 | + * published by the Free Software Foundation. |
4889 | + * |
4890 | + * This program is distributed in the hope that it will be useful, |
4891 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4892 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4893 | + * GNU Lesser General Public License for more details. |
4894 | + * |
4895 | + * You should have received a copy of the GNU Lesser General Public License |
4896 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4897 | + * |
4898 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
4899 | + */ |
4900 | + |
4901 | +#ifndef MIR_CLIENT_ERROR_BUFFER_H |
4902 | +#define MIR_CLIENT_ERROR_BUFFER_H |
4903 | + |
4904 | +#include "mir_buffer.h" |
4905 | + |
4906 | +namespace mir |
4907 | +{ |
4908 | +namespace client |
4909 | +{ |
4910 | +class ErrorBuffer : public MirBuffer |
4911 | +{ |
4912 | +public: |
4913 | + ErrorBuffer( |
4914 | + std::string const& error_msg, int buffer_id, |
4915 | + mir_buffer_callback cb, void* context, MirConnection* connection); |
4916 | + |
4917 | + int rpc_id() const override; |
4918 | + void submitted() override; |
4919 | + void received() override; |
4920 | + void received(MirBufferPackage const& update_message) override; |
4921 | + MirNativeBuffer* as_mir_native_buffer() const override; |
4922 | + std::shared_ptr<ClientBuffer> client_buffer() const override; |
4923 | + MirGraphicsRegion map_region() override; |
4924 | + void set_fence(MirNativeFence*, MirBufferAccess) override; |
4925 | + MirNativeFence* get_fence() const override; |
4926 | + bool wait_fence(MirBufferAccess, std::chrono::nanoseconds) override; |
4927 | + MirBufferUsage buffer_usage() const override; |
4928 | + MirPixelFormat pixel_format() const override; |
4929 | + geometry::Size size() const override; |
4930 | + MirConnection* allocating_connection() const override; |
4931 | + void increment_age() override; |
4932 | + void set_callback(mir_buffer_callback callback, void* context) override; |
4933 | + |
4934 | + bool valid() const override; |
4935 | + char const* error_message() const override; |
4936 | +private: |
4937 | + std::string const error_msg; |
4938 | + int const buffer_id; |
4939 | + mir_buffer_callback const cb; |
4940 | + void* const cb_context; |
4941 | + MirConnection* connection; |
4942 | +}; |
4943 | +} |
4944 | +} |
4945 | +#endif /* MIR_CLIENT_BUFFER_H_ */ |
4946 | |
4947 | === modified file 'src/client/error_chain.cpp' |
4948 | --- src/client/error_chain.cpp 2016-03-23 06:39:56 +0000 |
4949 | +++ src/client/error_chain.cpp 2016-08-12 14:07:23 +0000 |
4950 | @@ -21,7 +21,6 @@ |
4951 | |
4952 | namespace mcl = mir::client; |
4953 | namespace geom = mir::geometry; |
4954 | -namespace mp = mir::protobuf; |
4955 | |
4956 | mcl::ErrorChain::ErrorChain( |
4957 | MirConnection* connection, |
4958 | @@ -48,26 +47,7 @@ |
4959 | return stream_id; |
4960 | } |
4961 | |
4962 | -void mcl::ErrorChain::allocate_buffer( |
4963 | - geometry::Size, MirPixelFormat, MirBufferUsage, mir_buffer_callback, void*) |
4964 | -{ |
4965 | - BOOST_THROW_EXCEPTION(std::logic_error("Cannot allocate: invalid MirPresentationChain")); |
4966 | -} |
4967 | - |
4968 | void mcl::ErrorChain::submit_buffer(MirBuffer*) |
4969 | { |
4970 | BOOST_THROW_EXCEPTION(std::logic_error("Cannot submit: invalid MirPresentationChain")); |
4971 | } |
4972 | - |
4973 | -void mcl::ErrorChain::release_buffer(MirBuffer*) |
4974 | -{ |
4975 | - BOOST_THROW_EXCEPTION(std::logic_error("Cannot release: invalid MirPresentationChain")); |
4976 | -} |
4977 | - |
4978 | -void mcl::ErrorChain::buffer_available(mir::protobuf::Buffer const&) |
4979 | -{ |
4980 | -} |
4981 | - |
4982 | -void mcl::ErrorChain::buffer_unavailable() |
4983 | -{ |
4984 | -} |
4985 | |
4986 | === modified file 'src/client/error_chain.h' |
4987 | --- src/client/error_chain.h 2016-03-23 06:39:56 +0000 |
4988 | +++ src/client/error_chain.h 2016-08-12 14:07:23 +0000 |
4989 | @@ -34,12 +34,7 @@ |
4990 | MirConnection* connection, |
4991 | int id, |
4992 | std::string const& error_msg); |
4993 | - void allocate_buffer( |
4994 | - geometry::Size size, MirPixelFormat format, MirBufferUsage usage, mir_buffer_callback, void*) override; |
4995 | void submit_buffer(MirBuffer* buffer) override; |
4996 | - void release_buffer(MirBuffer* buffer) override; |
4997 | - void buffer_available(mir::protobuf::Buffer const& buffer) override; |
4998 | - void buffer_unavailable() override; |
4999 | MirConnection* connection() const override; |
5000 | int rpc_id() const override; |
PASSED: Continuous integration, rev:3607 /mir-jenkins. ubuntu. com/job/ mir-ubuntu- ci/33/ /mir-jenkins. ubuntu. com/job/ build-mir/ 1567 /mir-jenkins. ubuntu. com/job/ build-0- fetch/1620 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1611 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1611 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 1611 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1582 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= vivid+overlay/ 1582/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1582 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1582/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1582 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1582/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1582 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1582/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1582 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1582/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ubuntu- ci/33/rebuild
https:/