Merge lp:~afrantzis/mir/build-options-for-tests into lp:mir/0.1
- build-options-for-tests
- Merge into trusty
Proposed by
Alexandros Frantzis
Status: | Superseded |
---|---|
Proposed branch: | lp:~afrantzis/mir/build-options-for-tests |
Merge into: | lp:mir/0.1 |
Diff against target: |
10194 lines (+2210/-1627) 306 files modified
cmake/MirCommon.cmake (+15/-5) debian/mir-test-tools.install (+3/-0) debian/rules (+1/-4) examples/eglapp.c (+19/-4) examples/fingerpaint.c (+12/-0) examples/render_surfaces.cpp (+6/-3) include/client/mir_toolkit/mir_client_library.h (+17/-17) include/client/mir_toolkit/mir_client_library_debug.h (+1/-1) include/platform/mir/graphics/internal_surface.h (+1/-1) include/server/mir/compositor/buffer_stream.h (+2/-1) include/server/mir/compositor/compositing_criteria.h (+1/-1) include/server/mir/default_server_configuration.h (+0/-3) include/server/mir/frontend/message_processor_report.h (+1/-1) include/server/mir/frontend/null_message_processor_report.h (+1/-1) include/server/mir/frontend/session_authorizer.h (+1/-1) include/server/mir/frontend/surface.h (+1/-1) include/server/mir/input/input_configuration.h (+1/-1) include/server/mir/input/input_report.h (+2/-2) include/server/mir/input/null_input_report.h (+1/-1) include/server/mir/input/surface.h (+2/-2) include/server/mir/logging/input_report.h (+2/-2) include/server/mir/lttng/input_report.h (+2/-2) include/server/mir/scene/input_registrar.h (+1/-1) include/server/mir/shell/input_targeter.h (+1/-1) include/server/mir/shell/session_listener.h (+1/-1) include/server/mir/shell/surface_configurator.h (+1/-1) include/server/mir/shell/surface_controller.h (+1/-1) include/server/mir/shell/surface_creation_parameters.h (+3/-3) include/shared/mir/geometry/rectangle.h (+1/-1) include/shared/mir/graphics/android/android_driver_interpreter.h (+1/-1) include/shared/mir/graphics/android/mir_native_window.h (+1/-1) include/shared/mir/graphics/android/native_buffer.h (+2/-2) include/shared/mir/input/android/android_input_lexicon.h (+1/-1) include/shared/mir/input/input_platform.h (+1/-1) include/shared/mir/input/xkb_mapper.h (+1/-1) include/shared/mir_toolkit/client_types.h (+11/-5) include/shared/mir_toolkit/event.h (+13/-2) include/shared/mir_toolkit/mir_native_buffer.h (+1/-1) include/test/gmock_set_arg.h (+57/-0) include/test/mir_test/draw/draw_pattern_checkered-inl.h (+2/-2) include/test/mir_test/fake_event_hub_input_configuration.h (+1/-1) include/test/mir_test_doubles/mock_alloc_adaptor.h (+1/-1) include/test/mir_test_doubles/mock_android_native_buffer.h (+1/-1) include/test/mir_test_doubles/mock_android_registrar.h (+1/-1) include/test/mir_test_doubles/mock_buffer_stream.h (+2/-1) include/test/mir_test_doubles/mock_display_device.h (+1/-1) include/test/mir_test_doubles/mock_egl.h (+0/-1) include/test/mir_test_doubles/mock_fb_hal_device.h (+15/-6) include/test/mir_test_doubles/mock_frontend_surface.h (+1/-1) include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+2/-2) include/test/mir_test_doubles/mock_input_dispatcher.h (+1/-1) include/test/mir_test_doubles/mock_input_surface.h (+1/-1) include/test/mir_test_doubles/mock_session_listener.h (+1/-1) include/test/mir_test_doubles/mock_shell_session.h (+1/-1) include/test/mir_test_doubles/mock_surface_renderer.h (+2/-4) include/test/mir_test_doubles/stub_buffer_stream.h (+22/-19) include/test/mir_test_doubles/stub_display_builder.h (+1/-1) include/test/mir_test_doubles/stub_display_configuration.h (+1/-1) include/test/mir_test_doubles/stub_display_device.h (+2/-2) include/test/mir_test_doubles/stub_driver_interpreter.h (+1/-1) include/test/mir_test_doubles/stub_shell_session.h (+1/-1) include/test/mir_test_doubles/stub_surface.h (+0/-74) include/test/mir_test_framework/cross_process_sync.h (+1/-1) include/test/mir_test_framework/input_testing_server_configuration.h (+2/-2) include/test/mir_test_framework/testing_client_configuration.h (+1/-1) native-compile.sh (+3/-3) src/client/aging_buffer.h (+0/-1) src/client/android/android_client_platform.cpp (+2/-2) src/client/android/android_client_platform.h (+1/-1) src/client/android/android_registrar.cpp (+1/-1) src/client/android/client_surface_interpreter.cpp (+1/-1) src/client/android/client_surface_interpreter.h (+1/-1) src/client/client_buffer.h (+6/-0) src/client/client_platform.h (+1/-1) src/client/default_connection_configuration.cpp (+1/-1) src/client/display_configuration.cpp (+5/-5) src/client/gbm/buffer_file_ops.h (+11/-13) src/client/gbm/gbm_client_buffer.cpp (+20/-65) src/client/gbm/gbm_client_buffer.h (+7/-9) src/client/gbm/gbm_client_buffer_factory.cpp (+3/-3) src/client/gbm/gbm_client_buffer_factory.h (+3/-3) src/client/gbm/gbm_client_platform.cpp (+16/-43) src/client/gbm/gbm_client_platform.h (+4/-4) src/client/gbm/gbm_native_surface.cpp (+5/-5) src/client/logging/input_receiver_report.cpp (+1/-1) src/client/mir_client_library.cpp (+5/-5) src/client/mir_connection.cpp (+6/-6) src/client/mir_connection.h (+1/-1) src/client/mir_surface.cpp (+2/-2) src/client/rpc/mir_socket_rpc_channel.cpp (+1/-1) src/client/surface_map.cpp (+3/-3) src/server/asio_main_loop.cpp (+1/-1) src/server/compositor/buffer_stream_surfaces.cpp (+15/-5) src/server/compositor/buffer_stream_surfaces.h (+6/-5) src/server/compositor/default_configuration.cpp (+1/-18) src/server/compositor/default_display_buffer_compositor.cpp (+3/-7) src/server/compositor/default_display_buffer_compositor.h (+1/-4) src/server/compositor/default_display_buffer_compositor_factory.cpp (+3/-7) src/server/compositor/default_display_buffer_compositor_factory.h (+1/-4) src/server/compositor/gl_renderer.cpp (+4/-11) src/server/compositor/gl_renderer.h (+2/-6) src/server/compositor/overlay_renderer.h (+0/-53) src/server/compositor/renderer.h (+6/-7) src/server/compositor/rendering_operator.cpp (+8/-7) src/server/compositor/rendering_operator.h (+6/-2) src/server/compositor/switching_bundle.cpp (+1/-1) src/server/compositor/switching_bundle.h (+1/-1) src/server/compositor/temporary_buffers.cpp (+0/-12) src/server/compositor/temporary_buffers.h (+0/-10) src/server/default_server_configuration.cpp (+1/-1) src/server/frontend/event_sender.cpp (+1/-1) src/server/frontend/event_sender.h (+1/-1) src/server/frontend/fd_sets.h (+1/-1) src/server/frontend/message_receiver.h (+2/-2) src/server/frontend/session_mediator.cpp (+2/-5) src/server/frontend/session_mediator_android.cpp (+1/-1) src/server/frontend/socket_messenger.cpp (+4/-4) src/server/frontend/socket_messenger.h (+6/-6) src/server/frontend/socket_session.cpp (+1/-1) src/server/frontend/surface.cpp (+2/-2) src/server/graphics/android/android_buffer_allocator.cpp (+1/-1) src/server/graphics/android/android_display.h (+1/-1) src/server/graphics/android/android_display_configuration.h (+1/-1) src/server/graphics/android/android_platform.cpp (+1/-1) src/server/graphics/android/buffer.cpp (+1/-1) src/server/graphics/android/display_buffer.h (+1/-1) src/server/graphics/android/display_device.h (+1/-1) src/server/graphics/android/fb_device.cpp (+12/-2) src/server/graphics/android/fb_device.h (+3/-3) src/server/graphics/android/framebuffers.cpp (+5/-5) src/server/graphics/android/gl_context.cpp (+1/-1) src/server/graphics/android/hwc10_device.h (+1/-1) src/server/graphics/android/hwc11_device.h (+1/-1) src/server/graphics/android/hwc_common_device.cpp (+6/-6) src/server/graphics/android/hwc_common_device.h (+1/-1) src/server/graphics/android/hwc_layerlist.cpp (+8/-6) src/server/graphics/android/hwc_vsync.cpp (+1/-1) src/server/graphics/android/hwc_vsync.h (+1/-1) src/server/graphics/android/hwc_vsync_coordinator.h (+1/-1) src/server/graphics/android/internal_client.cpp (+1/-1) src/server/graphics/android/internal_client_window.cpp (+3/-2) src/server/graphics/android/internal_client_window.h (+1/-1) src/server/graphics/android/interpreter_cache.cpp (+1/-1) src/server/graphics/android/output_builder.cpp (+2/-2) src/server/graphics/android/resource_factory.cpp (+3/-3) src/server/graphics/android/server_render_window.cpp (+1/-1) src/server/graphics/android/server_render_window.h (+2/-2) src/server/graphics/gbm/CMakeLists.txt (+3/-1) src/server/graphics/gbm/anonymous_shm_file.cpp (+129/-0) src/server/graphics/gbm/anonymous_shm_file.h (+82/-0) src/server/graphics/gbm/black_arrow.c (+1/-1) src/server/graphics/gbm/buffer_allocator.cpp (+62/-23) src/server/graphics/gbm/buffer_allocator.h (+10/-6) src/server/graphics/gbm/gbm_buffer.cpp (+1/-1) src/server/graphics/gbm/gbm_display_helpers.cpp (+1/-1) src/server/graphics/gbm/gbm_platform.cpp (+5/-6) src/server/graphics/gbm/gbm_platform.h (+1/-1) src/server/graphics/gbm/internal_native_surface.cpp (+2/-3) src/server/graphics/gbm/kms_output.h (+1/-1) src/server/graphics/gbm/native_gbm_platform.cpp (+2/-2) src/server/graphics/gbm/real_kms_display_configuration.cpp (+1/-1) src/server/graphics/gbm/real_kms_output.h (+2/-2) src/server/graphics/gbm/shm_buffer.cpp (+87/-0) src/server/graphics/gbm/shm_buffer.h (+67/-0) src/server/graphics/gbm/shm_file.h (+50/-0) src/server/graphics/gbm/udev_wrapper.cpp (+1/-1) src/server/graphics/gbm/udev_wrapper.h (+1/-1) src/server/graphics/nested/nested_display_configuration.cpp (+1/-1) src/server/graphics/offscreen/display_buffer.cpp (+0/-6) src/server/input/android/android_input_application_handle.cpp (+1/-1) src/server/input/android/android_input_channel.cpp (+1/-1) src/server/input/android/android_input_reader_policy.cpp (+1/-1) src/server/input/android/android_input_registrar.cpp (+1/-1) src/server/input/android/android_input_target_enumerator.h (+2/-2) src/server/input/android/android_input_targeter.cpp (+3/-3) src/server/input/android/android_input_window_handle.cpp (+1/-1) src/server/input/android/android_window_handle_repository.h (+1/-1) src/server/input/android/event_filter_dispatcher_policy.cpp (+1/-1) src/server/input/null_input_configuration.cpp (+1/-1) src/server/input/null_input_configuration.h (+1/-1) src/server/logging/display_report.cpp (+1/-1) src/server/logging/input_report.cpp (+5/-5) src/server/scene/application_session.cpp (+3/-3) src/server/scene/basic_surface.h (+1/-1) src/server/scene/default_session_container.cpp (+3/-3) src/server/scene/global_event_sender.cpp (+1/-1) src/server/scene/mediating_display_changer.cpp (+2/-2) src/server/scene/mutable_surface_state.h (+1/-1) src/server/scene/session_manager.cpp (+1/-1) src/server/scene/surface.cpp (+10/-21) src/server/scene/surface.h (+1/-3) src/server/scene/surface_data.cpp (+2/-2) src/server/scene/surface_impl.cpp (+12/-3) src/server/scene/surface_impl.h (+1/-1) src/server/scene/surface_stack.h (+3/-3) src/server/scene/surface_state.h (+2/-2) src/server/shell/default_focus_mechanism.cpp (+2/-2) src/server/shell/surface_creation_parameters.cpp (+4/-4) src/shared/graphics/android/mir_native_window.cpp (+1/-1) src/shared/graphics/android/syncfence.cpp (+2/-2) src/shared/input/android/android_input_platform.h (+1/-1) src/shared/input/android/android_input_receiver.cpp (+4/-4) src/shared/input/android/android_input_receiver.h (+3/-3) src/shared/input/android/android_input_receiver_thread.h (+2/-2) src/shared/input/xkb_mapper.cpp (+5/-5) tests/CMakeLists.txt (+12/-11) tests/acceptance-tests/CMakeLists.txt (+20/-4) tests/acceptance-tests/test_client_authorization.cpp (+8/-8) tests/acceptance-tests/test_client_focus_notification.cpp (+5/-5) tests/acceptance-tests/test_client_input.cpp (+33/-33) tests/acceptance-tests/test_client_library.cpp (+2/-2) tests/acceptance-tests/test_focus_selection.cpp (+1/-1) tests/acceptance-tests/test_server_shutdown.cpp (+6/-6) tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+1/-1) tests/integration-tests/CMakeLists.txt (+20/-4) tests/integration-tests/client/test_client_render.cpp (+4/-4) tests/integration-tests/compositor/test_buffer_stream.cpp (+34/-25) tests/integration-tests/compositor/test_swapping_swappers.cpp (+2/-2) tests/integration-tests/graphics/android/test_internal_client.cpp (+4/-4) tests/integration-tests/graphics/gbm/test_buffer_integration.cpp (+0/-1) tests/integration-tests/input/android/test_android_input_manager.cpp (+4/-4) tests/integration-tests/shell/test_session_lifecycle_event.cpp (+2/-2) tests/integration-tests/test_display_info.cpp (+2/-2) tests/integration-tests/test_display_server_main_loop_events.cpp (+1/-1) tests/integration-tests/test_session.cpp (+8/-9) tests/integration-tests/test_surface_first_frame_sync.cpp (+4/-2) tests/integration-tests/test_swapinterval.cpp (+5/-4) tests/mir_test_doubles/mock_android_hw.cpp (+1/-1) tests/mir_test_doubles/mock_drm.cpp (+2/-2) tests/mir_test_doubles/mock_egl.cpp (+0/-39) tests/mir_test_framework/cross_process_sync.cpp (+1/-1) tests/mir_test_framework/input_testing_server_options.cpp (+1/-1) tests/mir_test_framework/testing_client_options.cpp (+1/-1) tests/mir_test_framework/testing_server_options.cpp (+5/-6) tests/unit-tests/CMakeLists.txt (+24/-7) tests/unit-tests/client/android/test_android_native_window.cpp (+2/-2) tests/unit-tests/client/android/test_client_android_registrar.cpp (+3/-3) tests/unit-tests/client/android/test_client_surface_interpreter.cpp (+1/-1) tests/unit-tests/client/gbm/mock_drm_fd_handler.h (+0/-46) tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp (+35/-92) tests/unit-tests/client/input/test_android_input_receiver.cpp (+15/-15) tests/unit-tests/client/input/test_android_input_receiver_thread.cpp (+4/-4) tests/unit-tests/client/input/test_xkb_mapper.cpp (+3/-3) tests/unit-tests/client/test_client_display_conf.cpp (+3/-3) tests/unit-tests/client/test_client_mir_surface.cpp (+5/-5) tests/unit-tests/client/test_client_platform.cpp (+1/-1) tests/unit-tests/client/test_mir_connection.cpp (+2/-2) tests/unit-tests/compositor/test_buffer_stream.cpp (+5/-2) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+44/-93) tests/unit-tests/compositor/test_gl_renderer.cpp (+7/-41) tests/unit-tests/compositor/test_rendering_operator.cpp (+33/-72) tests/unit-tests/compositor/test_switching_bundle.cpp (+2/-2) tests/unit-tests/compositor/test_temporary_buffers.cpp (+0/-23) tests/unit-tests/frontend/test_event_sender.cpp (+37/-1) tests/unit-tests/frontend/test_session_mediator.cpp (+14/-13) tests/unit-tests/frontend/test_socket_session.cpp (+2/-2) tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+1/-1) tests/unit-tests/graphics/android/test_android_fb.cpp (+9/-9) tests/unit-tests/graphics/android/test_android_platform.cpp (+2/-2) tests/unit-tests/graphics/android/test_buffer.cpp (+1/-1) tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+2/-9) tests/unit-tests/graphics/android/test_external_refcount.cpp (+4/-4) tests/unit-tests/graphics/android/test_fb_device.cpp (+28/-4) tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp (+6/-6) tests/unit-tests/graphics/android/test_hwc10_device.cpp (+9/-7) tests/unit-tests/graphics/android/test_hwc11_device.cpp (+2/-0) tests/unit-tests/graphics/android/test_hwc_device.cpp (+1/-1) tests/unit-tests/graphics/android/test_hwc_display.cpp (+3/-3) tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+17/-16) tests/unit-tests/graphics/android/test_internal_client.cpp (+1/-2) tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp (+15/-14) tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp (+1/-1) tests/unit-tests/graphics/android/test_output_builder.cpp (+2/-2) tests/unit-tests/graphics/android/test_resource_factory.cpp (+2/-2) tests/unit-tests/graphics/android/test_server_interpreter.cpp (+7/-7) tests/unit-tests/graphics/android/test_sync_fence.cpp (+1/-1) tests/unit-tests/graphics/gbm/CMakeLists.txt (+2/-0) tests/unit-tests/graphics/gbm/test_anonymous_shm_file.cpp (+260/-0) tests/unit-tests/graphics/gbm/test_gbm_buffer.cpp (+3/-3) tests/unit-tests/graphics/gbm/test_gbm_buffer_allocator.cpp (+7/-10) tests/unit-tests/graphics/gbm/test_gbm_cursor.cpp (+2/-2) tests/unit-tests/graphics/gbm/test_gbm_display.cpp (+21/-2) tests/unit-tests/graphics/gbm/test_gbm_platform.cpp (+3/-3) tests/unit-tests/graphics/gbm/test_internal_client.cpp (+1/-2) tests/unit-tests/graphics/gbm/test_internal_native_display.cpp (+3/-3) tests/unit-tests/graphics/gbm/test_internal_native_surface.cpp (+23/-22) tests/unit-tests/graphics/gbm/test_shm_buffer.cpp (+101/-0) tests/unit-tests/graphics/gbm/test_udev_helper.cpp (+4/-4) tests/unit-tests/graphics/test_display.cpp (+1/-1) tests/unit-tests/input/android/test_android_input_registrar.cpp (+5/-5) tests/unit-tests/input/android/test_android_input_target_enumerator.cpp (+3/-3) tests/unit-tests/input/android/test_android_input_targeter.cpp (+2/-2) tests/unit-tests/logging/test_display_report.cpp (+1/-1) tests/unit-tests/scene/test_application_session.cpp (+3/-4) tests/unit-tests/scene/test_default_focus_mechanism.cpp (+11/-12) tests/unit-tests/scene/test_global_event_sender.cpp (+1/-1) tests/unit-tests/scene/test_session_manager.cpp (+1/-1) tests/unit-tests/scene/test_surface.cpp (+28/-30) tests/unit-tests/scene/test_surface_data.cpp (+4/-4) tests/unit-tests/scene/test_surface_impl.cpp (+51/-10) tests/unit-tests/scene/test_surface_stack.cpp (+3/-3) tests/unit-tests/scene/test_the_session_container_implementation.cpp (+3/-3) tests/unit-tests/scene/test_threaded_snapshot_strategy.cpp (+2/-2) tests/unit-tests/shell/test_organising_surface_factory.cpp (+1/-1) tests/unit-tests/test_asio_main_loop.cpp (+1/-1) tools/install_on_android.sh (+9/-9) |
To merge this branch: | bzr merge lp:~afrantzis/mir/build-options-for-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir development team | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2013-11-28.
Commit message
build: Expose options to allow building but not running tests by default
Description of the change
build: Expose options to allow building but not running tests by default
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'cmake/MirCommon.cmake' | |||
2 | --- cmake/MirCommon.cmake 2013-08-28 03:41:48 +0000 | |||
3 | +++ cmake/MirCommon.cmake 2013-11-28 12:22:03 +0000 | |||
4 | @@ -1,11 +1,14 @@ | |||
5 | 1 | cmake_minimum_required (VERSION 2.6) | 1 | cmake_minimum_required (VERSION 2.6) |
6 | 2 | # Create target to discover tests | 2 | # Create target to discover tests |
7 | 3 | 3 | ||
9 | 4 | option( | 4 | include(CMakeDependentOption) |
10 | 5 | |||
11 | 6 | CMAKE_DEPENDENT_OPTION( | ||
12 | 5 | DISABLE_GTEST_TEST_DISCOVERY | 7 | DISABLE_GTEST_TEST_DISCOVERY |
13 | 6 | "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior" | 8 | "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior" |
14 | 7 | OFF | 9 | OFF |
16 | 8 | ) | 10 | "NOT MIR_IS_CROSS_COMPILING" |
17 | 11 | ON) | ||
18 | 9 | 12 | ||
19 | 10 | option( | 13 | option( |
20 | 11 | ENABLE_MEMCHECK_OPTION | 14 | ENABLE_MEMCHECK_OPTION |
21 | @@ -19,15 +22,22 @@ | |||
22 | 19 | valgrind) | 22 | valgrind) |
23 | 20 | 23 | ||
24 | 21 | if(VALGRIND_EXECUTABLE) | 24 | if(VALGRIND_EXECUTABLE) |
26 | 22 | set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes") | 25 | if(MIR_PLATFORM STREQUAL "android") |
27 | 26 | # don't exit with an error when valgrind find errors | ||
28 | 27 | #set(VALGRIND_ARGS "--error-exitcode=1") | ||
29 | 28 | else() | ||
30 | 29 | set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes") | ||
31 | 30 | endif() | ||
32 | 31 | |||
33 | 23 | set(ENABLE_MEMCHECK_FLAG "--enable-memcheck") | 32 | set(ENABLE_MEMCHECK_FLAG "--enable-memcheck") |
34 | 33 | |||
35 | 24 | else(VALGRIND_EXECUTABLE) | 34 | else(VALGRIND_EXECUTABLE) |
36 | 25 | message("Not enabling memcheck as valgrind is missing on your system") | 35 | message("Not enabling memcheck as valgrind is missing on your system") |
37 | 26 | endif(VALGRIND_EXECUTABLE) | 36 | endif(VALGRIND_EXECUTABLE) |
38 | 27 | endif(ENABLE_MEMCHECK_OPTION) | 37 | endif(ENABLE_MEMCHECK_OPTION) |
39 | 28 | 38 | ||
40 | 29 | function (mir_discover_tests EXECUTABLE) | 39 | function (mir_discover_tests EXECUTABLE) |
42 | 30 | if(BUILD_ANDROID OR DISABLE_GTEST_TEST_DISCOVERY) | 40 | if(DISABLE_GTEST_TEST_DISCOVERY) |
43 | 31 | add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}") | 41 | add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}") |
44 | 32 | 42 | ||
45 | 33 | if (${ARGC} GREATER 1) | 43 | if (${ARGC} GREATER 1) |
46 | @@ -74,7 +84,7 @@ | |||
47 | 74 | 84 | ||
48 | 75 | function (mir_add_memcheck_test) | 85 | function (mir_add_memcheck_test) |
49 | 76 | if (ENABLE_MEMCHECK_OPTION) | 86 | if (ENABLE_MEMCHECK_OPTION) |
51 | 77 | if(BUILD_ANDROID OR DISABLE_GTEST_TEST_DISCOVERY) | 87 | if(DISABLE_GTEST_TEST_DISCOVERY) |
52 | 78 | ADD_TEST("memcheck-test" "sh" "-c" "${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error; if [ $? != 0 ]; then exit 0; else exit 1; fi") | 88 | ADD_TEST("memcheck-test" "sh" "-c" "${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error; if [ $? != 0 ]; then exit 0; else exit 1; fi") |
53 | 79 | else() | 89 | else() |
54 | 80 | add_custom_target( | 90 | add_custom_target( |
55 | 81 | 91 | ||
56 | === modified file 'debian/mir-test-tools.install' | |||
57 | --- debian/mir-test-tools.install 2013-08-28 03:41:48 +0000 | |||
58 | +++ debian/mir-test-tools.install 2013-11-28 12:22:03 +0000 | |||
59 | @@ -1,3 +1,6 @@ | |||
60 | 1 | usr/bin/mir_stress | 1 | usr/bin/mir_stress |
61 | 2 | usr/bin/mir_unit_tests | ||
62 | 3 | usr/bin/mir_acceptance_tests | ||
63 | 4 | usr/bin/mir_integration_tests | ||
64 | 2 | usr/lib/*/mir/tools/libmirclientlttng.so | 5 | usr/lib/*/mir/tools/libmirclientlttng.so |
65 | 3 | usr/lib/*/mir/tools/libmirserverlttng.so | 6 | usr/lib/*/mir/tools/libmirserverlttng.so |
66 | 4 | 7 | ||
67 | === modified file 'debian/rules' | |||
68 | --- debian/rules 2013-11-21 03:16:21 +0000 | |||
69 | +++ debian/rules 2013-11-28 12:22:03 +0000 | |||
70 | @@ -21,10 +21,7 @@ | |||
71 | 21 | ifeq ($(DEB_HOST_ARCH),armhf) | 21 | ifeq ($(DEB_HOST_ARCH),armhf) |
72 | 22 | dh_auto_configure -- \ | 22 | dh_auto_configure -- \ |
73 | 23 | $(COMMON_CONFIGURE_OPTIONS) \ | 23 | $(COMMON_CONFIGURE_OPTIONS) \ |
78 | 24 | -DMIR_PLATFORM=android \ | 24 | -DMIR_PLATFORM=android |
75 | 25 | -DMIR_ENABLE_UNIT_TESTS=NO \ | ||
76 | 26 | -DMIR_ENABLE_ACCEPTANCE_TESTS=NO \ | ||
77 | 27 | -DMIR_ENABLE_INTEGRATION_TESTS=NO | ||
79 | 28 | else | 25 | else |
80 | 29 | ifeq ($(DEB_HOST_ARCH),powerpc) | 26 | ifeq ($(DEB_HOST_ARCH),powerpc) |
81 | 30 | dh_auto_configure -- \ | 27 | dh_auto_configure -- \ |
82 | 31 | 28 | ||
83 | === modified file 'examples/eglapp.c' | |||
84 | --- examples/eglapp.c 2013-11-21 03:16:21 +0000 | |||
85 | +++ examples/eglapp.c 2013-11-28 12:22:03 +0000 | |||
86 | @@ -93,8 +93,12 @@ | |||
87 | 93 | lastcount = count; | 93 | lastcount = count; |
88 | 94 | } | 94 | } |
89 | 95 | 95 | ||
92 | 96 | /* This is one way to handle window resizing. But in future it would be | 96 | /* |
93 | 97 | better to have resize events coming from the server */ | 97 | * Querying the surface (actually the current buffer) dimensions here is |
94 | 98 | * the only truly safe way to be sure that the dimensions we think we | ||
95 | 99 | * have are those of the buffer being rendered to. But this should be | ||
96 | 100 | * improved in future; https://bugs.launchpad.net/mir/+bug/1194384 | ||
97 | 101 | */ | ||
98 | 98 | if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width) && | 102 | if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width) && |
99 | 99 | eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height)) | 103 | eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height)) |
100 | 100 | { | 104 | { |
101 | @@ -102,7 +106,7 @@ | |||
102 | 102 | } | 106 | } |
103 | 103 | } | 107 | } |
104 | 104 | 108 | ||
106 | 105 | static void mir_eglapp_handle_input(MirSurface* surface, MirEvent const* ev, void* context) | 109 | static void mir_eglapp_handle_event(MirSurface* surface, MirEvent const* ev, void* context) |
107 | 106 | { | 110 | { |
108 | 107 | (void) surface; | 111 | (void) surface; |
109 | 108 | (void) context; | 112 | (void) context; |
110 | @@ -112,6 +116,17 @@ | |||
111 | 112 | { | 116 | { |
112 | 113 | running = 0; | 117 | running = 0; |
113 | 114 | } | 118 | } |
114 | 119 | else if (ev->type == mir_event_type_resize) | ||
115 | 120 | { | ||
116 | 121 | /* | ||
117 | 122 | * FIXME: https://bugs.launchpad.net/mir/+bug/1194384 | ||
118 | 123 | * It is unsafe to set the width and height here because we're in a | ||
119 | 124 | * different thread to that doing the rendering. So we either need | ||
120 | 125 | * support for event queuing (directing them to another thread) or | ||
121 | 126 | * full single-threaded callbacks. (LP: #1194384). | ||
122 | 127 | */ | ||
123 | 128 | printf("Resized to %dx%d\n", ev->resize.width, ev->resize.height); | ||
124 | 129 | } | ||
125 | 115 | } | 130 | } |
126 | 116 | 131 | ||
127 | 117 | static unsigned int get_bpp(MirPixelFormat pf) | 132 | static unsigned int get_bpp(MirPixelFormat pf) |
128 | @@ -172,7 +187,7 @@ | |||
129 | 172 | }; | 187 | }; |
130 | 173 | MirEventDelegate delegate = | 188 | MirEventDelegate delegate = |
131 | 174 | { | 189 | { |
133 | 175 | mir_eglapp_handle_input, | 190 | mir_eglapp_handle_event, |
134 | 176 | NULL | 191 | NULL |
135 | 177 | }; | 192 | }; |
136 | 178 | EGLConfig eglconfig; | 193 | EGLConfig eglconfig; |
137 | 179 | 194 | ||
138 | === modified file 'examples/fingerpaint.c' | |||
139 | --- examples/fingerpaint.c 2013-09-19 13:24:22 +0000 | |||
140 | +++ examples/fingerpaint.c 2013-11-28 12:22:03 +0000 | |||
141 | @@ -247,6 +247,18 @@ | |||
142 | 247 | redraw(surface, canvas); | 247 | redraw(surface, canvas); |
143 | 248 | } | 248 | } |
144 | 249 | } | 249 | } |
145 | 250 | else if (event->type == mir_event_type_resize) | ||
146 | 251 | { | ||
147 | 252 | /* FIXME: https://bugs.launchpad.net/mir/+bug/1194384 | ||
148 | 253 | * mir_event_type_resize will arrive in a different thread to that of | ||
149 | 254 | * mir_event_type_motion, so we cannot safely redraw from this thread. | ||
150 | 255 | * Either the callbacks will need to become thread-safe, or we'd have | ||
151 | 256 | * to employ some non-trivial event queuing and inter-thread signals, | ||
152 | 257 | * which I think is beyond the scope of this example code. | ||
153 | 258 | * | ||
154 | 259 | * redraw(surface, canvas); | ||
155 | 260 | */ | ||
156 | 261 | } | ||
157 | 250 | } | 262 | } |
158 | 251 | 263 | ||
159 | 252 | static const MirDisplayOutput *find_active_output( | 264 | static const MirDisplayOutput *find_active_output( |
160 | 253 | 265 | ||
161 | === modified file 'examples/render_surfaces.cpp' | |||
162 | --- examples/render_surfaces.cpp 2013-11-21 12:34:49 +0000 | |||
163 | +++ examples/render_surfaces.cpp 2013-11-28 12:22:03 +0000 | |||
164 | @@ -414,12 +414,15 @@ | |||
165 | 414 | mf::SurfaceId(), {}); | 414 | mf::SurfaceId(), {}); |
166 | 415 | 415 | ||
167 | 416 | /* | 416 | /* |
169 | 417 | * We call advance_client_buffer() twice so that the surface is | 417 | * We call swap_buffers() twice so that the surface is |
170 | 418 | * considers the first buffer to be posted. | 418 | * considers the first buffer to be posted. |
171 | 419 | * (TODO There must be a better way!) | 419 | * (TODO There must be a better way!) |
172 | 420 | */ | 420 | */ |
175 | 421 | s->advance_client_buffer(); | 421 | { |
176 | 422 | s->advance_client_buffer(); | 422 | std::shared_ptr<mg::Buffer> tmp; |
177 | 423 | s->swap_buffers(tmp); | ||
178 | 424 | s->swap_buffers(tmp); | ||
179 | 425 | } | ||
180 | 423 | 426 | ||
181 | 424 | /* | 427 | /* |
182 | 425 | * Place each surface at a different starting location and give it a | 428 | * Place each surface at a different starting location and give it a |
183 | 426 | 429 | ||
184 | === modified file 'include/client/mir_toolkit/mir_client_library.h' | |||
185 | --- include/client/mir_toolkit/mir_client_library.h 2013-11-21 12:34:49 +0000 | |||
186 | +++ include/client/mir_toolkit/mir_client_library.h 2013-11-28 12:22:03 +0000 | |||
187 | @@ -66,10 +66,10 @@ | |||
188 | 66 | /** | 66 | /** |
189 | 67 | * Test for a valid connection | 67 | * Test for a valid connection |
190 | 68 | * \param [in] connection The connection | 68 | * \param [in] connection The connection |
193 | 69 | * \return A non-zero value if the supplied connection is | 69 | * \return True if the supplied connection is valid, or |
194 | 70 | * valid, 0 otherwise | 70 | * false otherwise. |
195 | 71 | */ | 71 | */ |
197 | 72 | int mir_connection_is_valid(MirConnection *connection); | 72 | MirBool mir_connection_is_valid(MirConnection *connection); |
198 | 73 | 73 | ||
199 | 74 | /** | 74 | /** |
200 | 75 | * Retrieve a text description of the last error. The returned string is owned | 75 | * Retrieve a text description of the last error. The returned string is owned |
201 | @@ -104,7 +104,7 @@ | |||
202 | 104 | void mir_connection_set_lifecycle_event_callback(MirConnection* connection, | 104 | void mir_connection_set_lifecycle_event_callback(MirConnection* connection, |
203 | 105 | mir_lifecycle_event_callback callback, void* context); | 105 | mir_lifecycle_event_callback callback, void* context); |
204 | 106 | 106 | ||
206 | 107 | /** | 107 | /** |
207 | 108 | * \deprecated Use mir_connection_create_display_config | 108 | * \deprecated Use mir_connection_create_display_config |
208 | 109 | */ | 109 | */ |
209 | 110 | __attribute__((__deprecated__("Use mir_connection_create_display_config()"))) | 110 | __attribute__((__deprecated__("Use mir_connection_create_display_config()"))) |
210 | @@ -112,8 +112,8 @@ | |||
211 | 112 | 112 | ||
212 | 113 | /** | 113 | /** |
213 | 114 | * Query the display | 114 | * Query the display |
216 | 115 | * \warning return value must be destroyed via mir_display_config_destroy() | 115 | * \warning return value must be destroyed via mir_display_config_destroy() |
217 | 116 | * \warning may return null if connection is invalid | 116 | * \warning may return null if connection is invalid |
218 | 117 | * \param [in] connection The connection | 117 | * \param [in] connection The connection |
219 | 118 | * \return structure that describes the display configuration | 118 | * \return structure that describes the display configuration |
220 | 119 | */ | 119 | */ |
221 | @@ -135,7 +135,7 @@ | |||
222 | 135 | 135 | ||
223 | 136 | /** | 136 | /** |
224 | 137 | * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config | 137 | * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config |
226 | 138 | * \param [in] display_configuration The display_configuration information resource to be destroyed | 138 | * \param [in] display_configuration The display_configuration information resource to be destroyed |
227 | 139 | */ | 139 | */ |
228 | 140 | void mir_display_config_destroy(MirDisplayConfiguration* display_configuration); | 140 | void mir_display_config_destroy(MirDisplayConfiguration* display_configuration); |
229 | 141 | 141 | ||
230 | @@ -149,7 +149,7 @@ | |||
231 | 149 | * | 149 | * |
232 | 150 | * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message. | 150 | * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message. |
233 | 151 | * \param [in] connection The connection | 151 | * \param [in] connection The connection |
235 | 152 | * \param [in] display_configuration The display_configuration to apply | 152 | * \param [in] display_configuration The display_configuration to apply |
236 | 153 | * \return A handle that can be passed to mir_wait_for | 153 | * \return A handle that can be passed to mir_wait_for |
237 | 154 | */ | 154 | */ |
238 | 155 | MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration); | 155 | MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration); |
239 | @@ -164,10 +164,10 @@ | |||
240 | 164 | /** | 164 | /** |
241 | 165 | * Get the list of possible formats that a surface can be created with. | 165 | * Get the list of possible formats that a surface can be created with. |
242 | 166 | * \param [in] connection The connection | 166 | * \param [in] connection The connection |
244 | 167 | * \param [out] formats List of valid formats to create surfaces with | 167 | * \param [out] formats List of valid formats to create surfaces with |
245 | 168 | * \param [in] formats_size size of formats list | 168 | * \param [in] formats_size size of formats list |
246 | 169 | * \param [out] num_valid_formats number of valid formats returned in formats | 169 | * \param [out] num_valid_formats number of valid formats returned in formats |
248 | 170 | */ | 170 | */ |
249 | 171 | void mir_connection_get_available_surface_formats( | 171 | void mir_connection_get_available_surface_formats( |
250 | 172 | MirConnection* connection, MirPixelFormat* formats, | 172 | MirConnection* connection, MirPixelFormat* formats, |
251 | 173 | unsigned const int format_size, unsigned int *num_valid_formats); | 173 | unsigned const int format_size, unsigned int *num_valid_formats); |
252 | @@ -227,10 +227,10 @@ | |||
253 | 227 | /** | 227 | /** |
254 | 228 | * Test for a valid surface | 228 | * Test for a valid surface |
255 | 229 | * \param [in] surface The surface | 229 | * \param [in] surface The surface |
258 | 230 | * \return A non-zero value if the supplied surface is valid, | 230 | * \return True if the supplied surface is valid, or |
259 | 231 | * 0 otherwise | 231 | * false otherwise. |
260 | 232 | */ | 232 | */ |
262 | 233 | int mir_surface_is_valid(MirSurface *surface); | 233 | MirBool mir_surface_is_valid(MirSurface *surface); |
263 | 234 | 234 | ||
264 | 235 | /** | 235 | /** |
265 | 236 | * Retrieve a text description of the error. The returned string is owned by | 236 | * Retrieve a text description of the error. The returned string is owned by |
266 | @@ -253,7 +253,7 @@ | |||
267 | 253 | 253 | ||
268 | 254 | /** | 254 | /** |
269 | 255 | * Get the underlying platform type so the buffer obtained in "raw" representation | 255 | * Get the underlying platform type so the buffer obtained in "raw" representation |
271 | 256 | * in mir_surface_get_current_buffer() can be understood | 256 | * in mir_surface_get_current_buffer() can be understood |
272 | 257 | * \pre The surface is valid | 257 | * \pre The surface is valid |
273 | 258 | * \param [in] surface The surface | 258 | * \param [in] surface The surface |
274 | 259 | * \return One of mir_platform_type_android or mir_platform_type_gbm | 259 | * \return One of mir_platform_type_android or mir_platform_type_gbm |
275 | @@ -386,12 +386,12 @@ | |||
276 | 386 | /** | 386 | /** |
277 | 387 | * Set the swapinterval for mir_surface_swap_buffers. EGL users should use | 387 | * Set the swapinterval for mir_surface_swap_buffers. EGL users should use |
278 | 388 | * eglSwapInterval directly. | 388 | * eglSwapInterval directly. |
280 | 389 | * At the time being, only swapinterval of 0 or 1 is supported. | 389 | * At the time being, only swapinterval of 0 or 1 is supported. |
281 | 390 | * \param [in] surface The surface to operate on | 390 | * \param [in] surface The surface to operate on |
282 | 391 | * \param [in] interval The number of vblank signals that | 391 | * \param [in] interval The number of vblank signals that |
284 | 392 | * mir_surface_swap_buffers will wait for | 392 | * mir_surface_swap_buffers will wait for |
285 | 393 | * \return A wait handle that can be passed to mir_wait_for, | 393 | * \return A wait handle that can be passed to mir_wait_for, |
287 | 394 | * or NULL if the interval could not be supported | 394 | * or NULL if the interval could not be supported |
288 | 395 | */ | 395 | */ |
289 | 396 | MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval); | 396 | MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval); |
290 | 397 | 397 | ||
291 | 398 | 398 | ||
292 | === modified file 'include/client/mir_toolkit/mir_client_library_debug.h' | |||
293 | --- include/client/mir_toolkit/mir_client_library_debug.h 2013-09-11 20:57:29 +0000 | |||
294 | +++ include/client/mir_toolkit/mir_client_library_debug.h 2013-11-28 12:22:03 +0000 | |||
295 | @@ -38,6 +38,6 @@ | |||
296 | 38 | * This is the buffer that is currently being drawn to, | 38 | * This is the buffer that is currently being drawn to, |
297 | 39 | * and would be returned by mir_surface_get_current_buffer. | 39 | * and would be returned by mir_surface_get_current_buffer. |
298 | 40 | */ | 40 | */ |
300 | 41 | uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface); | 41 | uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface); |
301 | 42 | 42 | ||
302 | 43 | #endif /* MIR_CLIENT_LIBRARY_DEBUG_H */ | 43 | #endif /* MIR_CLIENT_LIBRARY_DEBUG_H */ |
303 | 44 | 44 | ||
304 | === modified file 'include/platform/mir/graphics/internal_surface.h' | |||
305 | --- include/platform/mir/graphics/internal_surface.h 2013-08-28 03:41:48 +0000 | |||
306 | +++ include/platform/mir/graphics/internal_surface.h 2013-11-28 12:22:03 +0000 | |||
307 | @@ -35,7 +35,7 @@ | |||
308 | 35 | public: | 35 | public: |
309 | 36 | virtual ~InternalSurface() = default; | 36 | virtual ~InternalSurface() = default; |
310 | 37 | 37 | ||
312 | 38 | virtual std::shared_ptr<Buffer> advance_client_buffer() = 0; | 38 | virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0; |
313 | 39 | virtual geometry::Size size() const = 0; | 39 | virtual geometry::Size size() const = 0; |
314 | 40 | virtual MirPixelFormat pixel_format() const = 0; | 40 | virtual MirPixelFormat pixel_format() const = 0; |
315 | 41 | 41 | ||
316 | 42 | 42 | ||
317 | === modified file 'include/server/mir/compositor/buffer_stream.h' | |||
318 | --- include/server/mir/compositor/buffer_stream.h 2013-11-21 03:16:21 +0000 | |||
319 | +++ include/server/mir/compositor/buffer_stream.h 2013-11-28 12:22:03 +0000 | |||
320 | @@ -41,7 +41,8 @@ | |||
321 | 41 | public: | 41 | public: |
322 | 42 | virtual ~BufferStream() = default; | 42 | virtual ~BufferStream() = default; |
323 | 43 | 43 | ||
325 | 44 | virtual std::shared_ptr<graphics::Buffer> secure_client_buffer() = 0; | 44 | virtual void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) = 0; |
326 | 45 | virtual void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) = 0; | ||
327 | 45 | virtual std::shared_ptr<graphics::Buffer> | 46 | virtual std::shared_ptr<graphics::Buffer> |
328 | 46 | lock_compositor_buffer(unsigned long frameno) = 0; | 47 | lock_compositor_buffer(unsigned long frameno) = 0; |
329 | 47 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; | 48 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; |
330 | 48 | 49 | ||
331 | === modified file 'include/server/mir/compositor/compositing_criteria.h' | |||
332 | --- include/server/mir/compositor/compositing_criteria.h 2013-10-07 07:56:05 +0000 | |||
333 | +++ include/server/mir/compositor/compositing_criteria.h 2013-11-28 12:22:03 +0000 | |||
334 | @@ -30,7 +30,7 @@ | |||
335 | 30 | namespace compositor | 30 | namespace compositor |
336 | 31 | { | 31 | { |
337 | 32 | 32 | ||
339 | 33 | class CompositingCriteria | 33 | class CompositingCriteria |
340 | 34 | { | 34 | { |
341 | 35 | public: | 35 | public: |
342 | 36 | virtual float alpha() const = 0; | 36 | virtual float alpha() const = 0; |
343 | 37 | 37 | ||
344 | === modified file 'include/server/mir/default_server_configuration.h' | |||
345 | --- include/server/mir/default_server_configuration.h 2013-11-21 12:34:49 +0000 | |||
346 | +++ include/server/mir/default_server_configuration.h 2013-11-28 12:22:03 +0000 | |||
347 | @@ -35,7 +35,6 @@ | |||
348 | 35 | class Drawer; | 35 | class Drawer; |
349 | 36 | class DisplayBufferCompositorFactory; | 36 | class DisplayBufferCompositorFactory; |
350 | 37 | class Compositor; | 37 | class Compositor; |
351 | 38 | class OverlayRenderer; | ||
352 | 39 | class RendererFactory; | 38 | class RendererFactory; |
353 | 40 | } | 39 | } |
354 | 41 | namespace frontend | 40 | namespace frontend |
355 | @@ -152,7 +151,6 @@ | |||
356 | 152 | * configurable interfaces for modifying compositor | 151 | * configurable interfaces for modifying compositor |
357 | 153 | * @{ */ | 152 | * @{ */ |
358 | 154 | virtual std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory(); | 153 | virtual std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory(); |
359 | 155 | virtual std::shared_ptr<compositor::OverlayRenderer> the_overlay_renderer(); | ||
360 | 156 | /** @} */ | 154 | /** @} */ |
361 | 157 | 155 | ||
362 | 158 | /** @name compositor configuration - dependencies | 156 | /** @name compositor configuration - dependencies |
363 | @@ -279,7 +277,6 @@ | |||
364 | 279 | CachedPtr<shell::DisplayLayout> shell_display_layout; | 277 | CachedPtr<shell::DisplayLayout> shell_display_layout; |
365 | 280 | CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator; | 278 | CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator; |
366 | 281 | CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory; | 279 | CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory; |
367 | 282 | CachedPtr<compositor::OverlayRenderer> overlay_renderer; | ||
368 | 283 | CachedPtr<compositor::Compositor> compositor; | 280 | CachedPtr<compositor::Compositor> compositor; |
369 | 284 | CachedPtr<logging::Logger> logger; | 281 | CachedPtr<logging::Logger> logger; |
370 | 285 | CachedPtr<graphics::DisplayReport> display_report; | 282 | CachedPtr<graphics::DisplayReport> display_report; |
371 | 286 | 283 | ||
372 | === modified file 'include/server/mir/frontend/message_processor_report.h' | |||
373 | --- include/server/mir/frontend/message_processor_report.h 2013-08-28 03:41:48 +0000 | |||
374 | +++ include/server/mir/frontend/message_processor_report.h 2013-11-28 12:22:03 +0000 | |||
375 | @@ -44,7 +44,7 @@ | |||
376 | 44 | virtual void exception_handled(void const* mediator, int id, std::exception const& error) = 0; | 44 | virtual void exception_handled(void const* mediator, int id, std::exception const& error) = 0; |
377 | 45 | 45 | ||
378 | 46 | virtual void exception_handled(void const* mediator, std::exception const& error) = 0; | 46 | virtual void exception_handled(void const* mediator, std::exception const& error) = 0; |
380 | 47 | 47 | ||
381 | 48 | virtual void sent_event(void const* mediator, MirSurfaceEvent const& ev) = 0; | 48 | virtual void sent_event(void const* mediator, MirSurfaceEvent const& ev) = 0; |
382 | 49 | 49 | ||
383 | 50 | private: | 50 | private: |
384 | 51 | 51 | ||
385 | === modified file 'include/server/mir/frontend/null_message_processor_report.h' | |||
386 | --- include/server/mir/frontend/null_message_processor_report.h 2013-08-28 03:41:48 +0000 | |||
387 | +++ include/server/mir/frontend/null_message_processor_report.h 2013-11-28 12:22:03 +0000 | |||
388 | @@ -36,7 +36,7 @@ | |||
389 | 36 | void exception_handled(void const*, int, std::exception const&); | 36 | void exception_handled(void const*, int, std::exception const&); |
390 | 37 | 37 | ||
391 | 38 | void exception_handled(void const*, std::exception const&); | 38 | void exception_handled(void const*, std::exception const&); |
393 | 39 | 39 | ||
394 | 40 | void sent_event(void const*, MirSurfaceEvent const& e); | 40 | void sent_event(void const*, MirSurfaceEvent const& e); |
395 | 41 | }; | 41 | }; |
396 | 42 | } | 42 | } |
397 | 43 | 43 | ||
398 | === modified file 'include/server/mir/frontend/session_authorizer.h' | |||
399 | --- include/server/mir/frontend/session_authorizer.h 2013-08-28 03:41:48 +0000 | |||
400 | +++ include/server/mir/frontend/session_authorizer.h 2013-11-28 12:22:03 +0000 | |||
401 | @@ -30,7 +30,7 @@ | |||
402 | 30 | { | 30 | { |
403 | 31 | public: | 31 | public: |
404 | 32 | virtual ~SessionAuthorizer() {} | 32 | virtual ~SessionAuthorizer() {} |
406 | 33 | 33 | ||
407 | 34 | virtual bool connection_is_allowed(pid_t pid) = 0; | 34 | virtual bool connection_is_allowed(pid_t pid) = 0; |
408 | 35 | virtual bool configure_display_is_allowed(pid_t pid) = 0; | 35 | virtual bool configure_display_is_allowed(pid_t pid) = 0; |
409 | 36 | protected: | 36 | protected: |
410 | 37 | 37 | ||
411 | === modified file 'include/server/mir/frontend/surface.h' | |||
412 | --- include/server/mir/frontend/surface.h 2013-11-21 03:16:21 +0000 | |||
413 | +++ include/server/mir/frontend/surface.h 2013-11-28 12:22:03 +0000 | |||
414 | @@ -57,7 +57,7 @@ | |||
415 | 57 | virtual geometry::Size size() const = 0; | 57 | virtual geometry::Size size() const = 0; |
416 | 58 | virtual geometry::PixelFormat pixel_format() const = 0; | 58 | virtual geometry::PixelFormat pixel_format() const = 0; |
417 | 59 | 59 | ||
419 | 60 | virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0; | 60 | virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0; |
420 | 61 | 61 | ||
421 | 62 | virtual bool supports_input() const = 0; | 62 | virtual bool supports_input() const = 0; |
422 | 63 | virtual int client_input_fd() const = 0; | 63 | virtual int client_input_fd() const = 0; |
423 | 64 | 64 | ||
424 | === modified file 'include/server/mir/input/input_configuration.h' | |||
425 | --- include/server/mir/input/input_configuration.h 2013-11-20 15:56:58 +0000 | |||
426 | +++ include/server/mir/input/input_configuration.h 2013-11-28 12:22:03 +0000 | |||
427 | @@ -44,7 +44,7 @@ | |||
428 | 44 | virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar() = 0; | 44 | virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar() = 0; |
429 | 45 | virtual std::shared_ptr<shell::InputTargeter> the_input_targeter() = 0; | 45 | virtual std::shared_ptr<shell::InputTargeter> the_input_targeter() = 0; |
430 | 46 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; | 46 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; |
432 | 47 | 47 | ||
433 | 48 | virtual void set_input_targets(std::shared_ptr<input::InputTargets> const& targets) = 0; | 48 | virtual void set_input_targets(std::shared_ptr<input::InputTargets> const& targets) = 0; |
434 | 49 | 49 | ||
435 | 50 | protected: | 50 | protected: |
436 | 51 | 51 | ||
437 | === modified file 'include/server/mir/input/input_report.h' | |||
438 | --- include/server/mir/input/input_report.h 2013-05-29 14:11:56 +0000 | |||
439 | +++ include/server/mir/input/input_report.h 2013-11-28 12:22:03 +0000 | |||
440 | @@ -31,7 +31,7 @@ | |||
441 | 31 | { | 31 | { |
442 | 32 | public: | 32 | public: |
443 | 33 | virtual ~InputReport() = default; | 33 | virtual ~InputReport() = default; |
445 | 34 | 34 | ||
446 | 35 | virtual void received_event_from_kernel(int64_t when, int type, int code, int value) = 0; | 35 | virtual void received_event_from_kernel(int64_t when, int type, int code, int value) = 0; |
447 | 36 | 36 | ||
448 | 37 | virtual void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; | 37 | virtual void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; |
449 | @@ -39,7 +39,7 @@ | |||
450 | 39 | virtual void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; | 39 | virtual void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; |
451 | 40 | 40 | ||
452 | 41 | virtual void received_event_finished_signal(int src_fd, uint32_t seq_id) = 0; | 41 | virtual void received_event_finished_signal(int src_fd, uint32_t seq_id) = 0; |
454 | 42 | 42 | ||
455 | 43 | protected: | 43 | protected: |
456 | 44 | InputReport() = default; | 44 | InputReport() = default; |
457 | 45 | InputReport(InputReport const&) = delete; | 45 | InputReport(InputReport const&) = delete; |
458 | 46 | 46 | ||
459 | === modified file 'include/server/mir/input/null_input_report.h' | |||
460 | --- include/server/mir/input/null_input_report.h 2013-05-29 14:11:56 +0000 | |||
461 | +++ include/server/mir/input/null_input_report.h 2013-11-28 12:22:03 +0000 | |||
462 | @@ -32,7 +32,7 @@ | |||
463 | 32 | public: | 32 | public: |
464 | 33 | NullInputReport() = default; | 33 | NullInputReport() = default; |
465 | 34 | virtual ~NullInputReport() noexcept(true) = default; | 34 | virtual ~NullInputReport() noexcept(true) = default; |
467 | 35 | 35 | ||
468 | 36 | void received_event_from_kernel(int64_t when, int type, int code, int value); | 36 | void received_event_from_kernel(int64_t when, int type, int code, int value); |
469 | 37 | 37 | ||
470 | 38 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); | 38 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
471 | 39 | 39 | ||
472 | === modified file 'include/server/mir/input/surface.h' | |||
473 | --- include/server/mir/input/surface.h 2013-07-16 15:49:19 +0000 | |||
474 | +++ include/server/mir/input/surface.h 2013-11-28 12:22:03 +0000 | |||
475 | @@ -27,7 +27,7 @@ | |||
476 | 27 | { | 27 | { |
477 | 28 | namespace input | 28 | namespace input |
478 | 29 | { | 29 | { |
480 | 30 | class Surface | 30 | class Surface |
481 | 31 | { | 31 | { |
482 | 32 | public: | 32 | public: |
483 | 33 | virtual std::string const& name() const = 0; | 33 | virtual std::string const& name() const = 0; |
484 | @@ -36,7 +36,7 @@ | |||
485 | 36 | virtual bool contains(geometry::Point const& point) const = 0; | 36 | virtual bool contains(geometry::Point const& point) const = 0; |
486 | 37 | 37 | ||
487 | 38 | protected: | 38 | protected: |
489 | 39 | Surface() = default; | 39 | Surface() = default; |
490 | 40 | virtual ~Surface() = default; | 40 | virtual ~Surface() = default; |
491 | 41 | Surface(const Surface&) = delete; | 41 | Surface(const Surface&) = delete; |
492 | 42 | Surface& operator=(const Surface& ) = delete; | 42 | Surface& operator=(const Surface& ) = delete; |
493 | 43 | 43 | ||
494 | === modified file 'include/server/mir/logging/input_report.h' | |||
495 | --- include/server/mir/logging/input_report.h 2013-05-29 14:11:56 +0000 | |||
496 | +++ include/server/mir/logging/input_report.h 2013-11-28 12:22:03 +0000 | |||
497 | @@ -39,14 +39,14 @@ | |||
498 | 39 | public: | 39 | public: |
499 | 40 | InputReport(std::shared_ptr<Logger> const& logger); | 40 | InputReport(std::shared_ptr<Logger> const& logger); |
500 | 41 | virtual ~InputReport() noexcept(true) = default; | 41 | virtual ~InputReport() noexcept(true) = default; |
502 | 42 | 42 | ||
503 | 43 | void received_event_from_kernel(int64_t when, int type, int code, int value); | 43 | void received_event_from_kernel(int64_t when, int type, int code, int value); |
504 | 44 | 44 | ||
505 | 45 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); | 45 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
506 | 46 | void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); | 46 | void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
507 | 47 | 47 | ||
508 | 48 | void received_event_finished_signal(int src_fd, uint32_t seq_id); | 48 | void received_event_finished_signal(int src_fd, uint32_t seq_id); |
510 | 49 | 49 | ||
511 | 50 | private: | 50 | private: |
512 | 51 | char const* component(); | 51 | char const* component(); |
513 | 52 | std::shared_ptr<Logger> const logger; | 52 | std::shared_ptr<Logger> const logger; |
514 | 53 | 53 | ||
515 | === modified file 'include/server/mir/lttng/input_report.h' | |||
516 | --- include/server/mir/lttng/input_report.h 2013-06-03 12:15:44 +0000 | |||
517 | +++ include/server/mir/lttng/input_report.h 2013-11-28 12:22:03 +0000 | |||
518 | @@ -32,14 +32,14 @@ | |||
519 | 32 | public: | 32 | public: |
520 | 33 | InputReport() = default; | 33 | InputReport() = default; |
521 | 34 | virtual ~InputReport() noexcept(true) = default; | 34 | virtual ~InputReport() noexcept(true) = default; |
523 | 35 | 35 | ||
524 | 36 | void received_event_from_kernel(int64_t when, int type, int code, int value); | 36 | void received_event_from_kernel(int64_t when, int type, int code, int value); |
525 | 37 | 37 | ||
526 | 38 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); | 38 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
527 | 39 | void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); | 39 | void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
528 | 40 | 40 | ||
529 | 41 | void received_event_finished_signal(int src_fd, uint32_t seq_id); | 41 | void received_event_finished_signal(int src_fd, uint32_t seq_id); |
531 | 42 | 42 | ||
532 | 43 | private: | 43 | private: |
533 | 44 | ServerTracepointProvider tp_provider; | 44 | ServerTracepointProvider tp_provider; |
534 | 45 | }; | 45 | }; |
535 | 46 | 46 | ||
536 | === modified file 'include/server/mir/scene/input_registrar.h' | |||
537 | --- include/server/mir/scene/input_registrar.h 2013-11-20 16:22:32 +0000 | |||
538 | +++ include/server/mir/scene/input_registrar.h 2013-11-28 12:22:03 +0000 | |||
539 | @@ -41,7 +41,7 @@ | |||
540 | 41 | { | 41 | { |
541 | 42 | public: | 42 | public: |
542 | 43 | virtual ~InputRegistrar() = default; | 43 | virtual ~InputRegistrar() = default; |
544 | 44 | 44 | ||
545 | 45 | virtual void input_channel_opened(std::shared_ptr<input::InputChannel> const& opened_channel, | 45 | virtual void input_channel_opened(std::shared_ptr<input::InputChannel> const& opened_channel, |
546 | 46 | std::shared_ptr<input::Surface> const& info, | 46 | std::shared_ptr<input::Surface> const& info, |
547 | 47 | input::InputReceptionMode input_mode) = 0; | 47 | input::InputReceptionMode input_mode) = 0; |
548 | 48 | 48 | ||
549 | === modified file 'include/server/mir/shell/input_targeter.h' | |||
550 | --- include/server/mir/shell/input_targeter.h 2013-08-28 03:41:48 +0000 | |||
551 | +++ include/server/mir/shell/input_targeter.h 2013-11-28 12:22:03 +0000 | |||
552 | @@ -36,7 +36,7 @@ | |||
553 | 36 | { | 36 | { |
554 | 37 | public: | 37 | public: |
555 | 38 | virtual ~InputTargeter() = default; | 38 | virtual ~InputTargeter() = default; |
557 | 39 | 39 | ||
558 | 40 | virtual void focus_changed(std::shared_ptr<input::InputChannel const> const& focus_channel) = 0; | 40 | virtual void focus_changed(std::shared_ptr<input::InputChannel const> const& focus_channel) = 0; |
559 | 41 | virtual void focus_cleared() = 0; | 41 | virtual void focus_cleared() = 0; |
560 | 42 | 42 | ||
561 | 43 | 43 | ||
562 | === modified file 'include/server/mir/shell/session_listener.h' | |||
563 | --- include/server/mir/shell/session_listener.h 2013-08-28 03:41:48 +0000 | |||
564 | +++ include/server/mir/shell/session_listener.h 2013-11-28 12:22:03 +0000 | |||
565 | @@ -35,7 +35,7 @@ | |||
566 | 35 | virtual void stopping(std::shared_ptr<Session> const& session) = 0; | 35 | virtual void stopping(std::shared_ptr<Session> const& session) = 0; |
567 | 36 | virtual void focused(std::shared_ptr<Session> const& session) = 0; | 36 | virtual void focused(std::shared_ptr<Session> const& session) = 0; |
568 | 37 | virtual void unfocused() = 0; | 37 | virtual void unfocused() = 0; |
570 | 38 | 38 | ||
571 | 39 | virtual void surface_created(Session& session, std::shared_ptr<Surface> const& surface) = 0; | 39 | virtual void surface_created(Session& session, std::shared_ptr<Surface> const& surface) = 0; |
572 | 40 | virtual void destroying_surface(Session& session, std::shared_ptr<Surface> const& surface) = 0; | 40 | virtual void destroying_surface(Session& session, std::shared_ptr<Surface> const& surface) = 0; |
573 | 41 | 41 | ||
574 | 42 | 42 | ||
575 | === modified file 'include/server/mir/shell/surface_configurator.h' | |||
576 | --- include/server/mir/shell/surface_configurator.h 2013-07-29 22:55:20 +0000 | |||
577 | +++ include/server/mir/shell/surface_configurator.h 2013-11-28 12:22:03 +0000 | |||
578 | @@ -34,7 +34,7 @@ | |||
579 | 34 | { | 34 | { |
580 | 35 | public: | 35 | public: |
581 | 36 | virtual ~SurfaceConfigurator() = default; | 36 | virtual ~SurfaceConfigurator() = default; |
583 | 37 | 37 | ||
584 | 38 | /// Returns the selected value. | 38 | /// Returns the selected value. |
585 | 39 | virtual int select_attribute_value(Surface const& surface, MirSurfaceAttrib attrib, | 39 | virtual int select_attribute_value(Surface const& surface, MirSurfaceAttrib attrib, |
586 | 40 | int requested_value) = 0; | 40 | int requested_value) = 0; |
587 | 41 | 41 | ||
588 | === modified file 'include/server/mir/shell/surface_controller.h' | |||
589 | --- include/server/mir/shell/surface_controller.h 2013-11-21 12:34:49 +0000 | |||
590 | +++ include/server/mir/shell/surface_controller.h 2013-11-28 12:22:03 +0000 | |||
591 | @@ -24,7 +24,7 @@ | |||
592 | 24 | 24 | ||
593 | 25 | namespace mir | 25 | namespace mir |
594 | 26 | { | 26 | { |
596 | 27 | namespace scene | 27 | namespace scene |
597 | 28 | { | 28 | { |
598 | 29 | class BasicSurface; | 29 | class BasicSurface; |
599 | 30 | } | 30 | } |
600 | 31 | 31 | ||
601 | === modified file 'include/server/mir/shell/surface_creation_parameters.h' | |||
602 | --- include/server/mir/shell/surface_creation_parameters.h 2013-11-20 15:56:58 +0000 | |||
603 | +++ include/server/mir/shell/surface_creation_parameters.h 2013-11-28 12:22:03 +0000 | |||
604 | @@ -44,15 +44,15 @@ | |||
605 | 44 | SurfaceCreationParameters& of_size(geometry::Size new_size); | 44 | SurfaceCreationParameters& of_size(geometry::Size new_size); |
606 | 45 | 45 | ||
607 | 46 | SurfaceCreationParameters& of_size(geometry::Width::ValueType width, geometry::Height::ValueType height); | 46 | SurfaceCreationParameters& of_size(geometry::Width::ValueType width, geometry::Height::ValueType height); |
609 | 47 | 47 | ||
610 | 48 | SurfaceCreationParameters& of_position(geometry::Point const& top_left); | 48 | SurfaceCreationParameters& of_position(geometry::Point const& top_left); |
611 | 49 | 49 | ||
612 | 50 | SurfaceCreationParameters& of_buffer_usage(graphics::BufferUsage new_buffer_usage); | 50 | SurfaceCreationParameters& of_buffer_usage(graphics::BufferUsage new_buffer_usage); |
613 | 51 | 51 | ||
614 | 52 | SurfaceCreationParameters& of_pixel_format(geometry::PixelFormat new_pixel_format); | 52 | SurfaceCreationParameters& of_pixel_format(geometry::PixelFormat new_pixel_format); |
616 | 53 | 53 | ||
617 | 54 | SurfaceCreationParameters& of_depth(scene::DepthId const& new_depth); | 54 | SurfaceCreationParameters& of_depth(scene::DepthId const& new_depth); |
619 | 55 | 55 | ||
620 | 56 | SurfaceCreationParameters& with_input_mode(input::InputReceptionMode const& new_mode); | 56 | SurfaceCreationParameters& with_input_mode(input::InputReceptionMode const& new_mode); |
621 | 57 | 57 | ||
622 | 58 | SurfaceCreationParameters& with_output_id(graphics::DisplayConfigurationOutputId const& output_id); | 58 | SurfaceCreationParameters& with_output_id(graphics::DisplayConfigurationOutputId const& output_id); |
623 | 59 | 59 | ||
624 | === modified file 'include/shared/mir/geometry/rectangle.h' | |||
625 | --- include/shared/mir/geometry/rectangle.h 2013-11-21 03:16:21 +0000 | |||
626 | +++ include/shared/mir/geometry/rectangle.h 2013-11-28 12:22:03 +0000 | |||
627 | @@ -35,7 +35,7 @@ | |||
628 | 35 | Point top_left; | 35 | Point top_left; |
629 | 36 | Size size; | 36 | Size size; |
630 | 37 | 37 | ||
632 | 38 | /** | 38 | /** |
633 | 39 | * The bottom right boundary point of the rectangle. | 39 | * The bottom right boundary point of the rectangle. |
634 | 40 | * | 40 | * |
635 | 41 | * Note that the returned point is *not* included in the rectangle | 41 | * Note that the returned point is *not* included in the rectangle |
636 | 42 | 42 | ||
637 | === modified file 'include/shared/mir/graphics/android/android_driver_interpreter.h' | |||
638 | --- include/shared/mir/graphics/android/android_driver_interpreter.h 2013-10-15 08:53:10 +0000 | |||
639 | +++ include/shared/mir/graphics/android/android_driver_interpreter.h 2013-11-28 12:22:03 +0000 | |||
640 | @@ -36,7 +36,7 @@ | |||
641 | 36 | virtual void driver_returns_buffer(ANativeWindowBuffer*, int fence) = 0; | 36 | virtual void driver_returns_buffer(ANativeWindowBuffer*, int fence) = 0; |
642 | 37 | virtual void dispatch_driver_request_format(int format) = 0; | 37 | virtual void dispatch_driver_request_format(int format) = 0; |
643 | 38 | virtual int driver_requests_info(int key) const = 0; | 38 | virtual int driver_requests_info(int key) const = 0; |
645 | 39 | virtual void sync_to_display(bool sync) = 0; | 39 | virtual void sync_to_display(bool sync) = 0; |
646 | 40 | protected: | 40 | protected: |
647 | 41 | AndroidDriverInterpreter() {}; | 41 | AndroidDriverInterpreter() {}; |
648 | 42 | virtual ~AndroidDriverInterpreter() {}; | 42 | virtual ~AndroidDriverInterpreter() {}; |
649 | 43 | 43 | ||
650 | === modified file 'include/shared/mir/graphics/android/mir_native_window.h' | |||
651 | --- include/shared/mir/graphics/android/mir_native_window.h 2013-11-21 03:16:21 +0000 | |||
652 | +++ include/shared/mir/graphics/android/mir_native_window.h 2013-11-28 12:22:03 +0000 | |||
653 | @@ -25,7 +25,7 @@ | |||
654 | 25 | 25 | ||
655 | 26 | namespace mir | 26 | namespace mir |
656 | 27 | { | 27 | { |
658 | 28 | namespace graphics | 28 | namespace graphics |
659 | 29 | { | 29 | { |
660 | 30 | namespace android | 30 | namespace android |
661 | 31 | { | 31 | { |
662 | 32 | 32 | ||
663 | === modified file 'include/shared/mir/graphics/android/native_buffer.h' | |||
664 | --- include/shared/mir/graphics/android/native_buffer.h 2013-10-15 08:53:10 +0000 | |||
665 | +++ include/shared/mir/graphics/android/native_buffer.h 2013-11-28 12:22:03 +0000 | |||
666 | @@ -27,7 +27,7 @@ | |||
667 | 27 | namespace graphics | 27 | namespace graphics |
668 | 28 | { | 28 | { |
669 | 29 | 29 | ||
671 | 30 | class NativeBuffer | 30 | class NativeBuffer |
672 | 31 | { | 31 | { |
673 | 32 | public: | 32 | public: |
674 | 33 | virtual ~NativeBuffer() = default; | 33 | virtual ~NativeBuffer() = default; |
675 | @@ -37,7 +37,7 @@ | |||
676 | 37 | virtual android::NativeFence copy_fence() const = 0; | 37 | virtual android::NativeFence copy_fence() const = 0; |
677 | 38 | 38 | ||
678 | 39 | virtual void wait_for_content() = 0; | 39 | virtual void wait_for_content() = 0; |
680 | 40 | virtual void update_fence(android::NativeFence& fence) = 0; | 40 | virtual void update_fence(android::NativeFence& fence) = 0; |
681 | 41 | 41 | ||
682 | 42 | protected: | 42 | protected: |
683 | 43 | NativeBuffer() = default; | 43 | NativeBuffer() = default; |
684 | 44 | 44 | ||
685 | === modified file 'include/shared/mir/input/android/android_input_lexicon.h' | |||
686 | --- include/shared/mir/input/android/android_input_lexicon.h 2013-04-24 05:22:20 +0000 | |||
687 | +++ include/shared/mir/input/android/android_input_lexicon.h 2013-11-28 12:22:03 +0000 | |||
688 | @@ -36,7 +36,7 @@ | |||
689 | 36 | namespace android | 36 | namespace android |
690 | 37 | { | 37 | { |
691 | 38 | 38 | ||
693 | 39 | /// The Lexicon translates droidinput event types to MirEvent types prior to | 39 | /// The Lexicon translates droidinput event types to MirEvent types prior to |
694 | 40 | /// shell or client handling. | 40 | /// shell or client handling. |
695 | 41 | class Lexicon | 41 | class Lexicon |
696 | 42 | { | 42 | { |
697 | 43 | 43 | ||
698 | === modified file 'include/shared/mir/input/input_platform.h' | |||
699 | --- include/shared/mir/input/input_platform.h 2013-11-21 03:16:21 +0000 | |||
700 | +++ include/shared/mir/input/input_platform.h 2013-11-28 12:22:03 +0000 | |||
701 | @@ -37,7 +37,7 @@ | |||
702 | 37 | class InputPlatform | 37 | class InputPlatform |
703 | 38 | { | 38 | { |
704 | 39 | public: | 39 | public: |
706 | 40 | virtual ~InputPlatform() {}; | 40 | virtual ~InputPlatform() {}; |
707 | 41 | 41 | ||
708 | 42 | virtual std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback) = 0; | 42 | virtual std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback) = 0; |
709 | 43 | 43 | ||
710 | 44 | 44 | ||
711 | === modified file 'include/shared/mir/input/xkb_mapper.h' | |||
712 | --- include/shared/mir/input/xkb_mapper.h 2013-05-17 19:42:09 +0000 | |||
713 | +++ include/shared/mir/input/xkb_mapper.h 2013-11-28 12:22:03 +0000 | |||
714 | @@ -37,7 +37,7 @@ | |||
715 | 37 | public: | 37 | public: |
716 | 38 | XKBMapper(); | 38 | XKBMapper(); |
717 | 39 | virtual ~XKBMapper() = default; | 39 | virtual ~XKBMapper() = default; |
719 | 40 | 40 | ||
720 | 41 | void update_state_and_map_event(MirKeyEvent& key_ev); | 41 | void update_state_and_map_event(MirKeyEvent& key_ev); |
721 | 42 | 42 | ||
722 | 43 | protected: | 43 | protected: |
723 | 44 | 44 | ||
724 | === modified file 'include/shared/mir_toolkit/client_types.h' | |||
725 | --- include/shared/mir_toolkit/client_types.h 2013-11-21 03:16:21 +0000 | |||
726 | +++ include/shared/mir_toolkit/client_types.h 2013-11-28 12:22:03 +0000 | |||
727 | @@ -34,6 +34,12 @@ | |||
728 | 34 | extern "C" { | 34 | extern "C" { |
729 | 35 | #endif | 35 | #endif |
730 | 36 | 36 | ||
731 | 37 | typedef enum MirBool | ||
732 | 38 | { | ||
733 | 39 | mir_false = 0, | ||
734 | 40 | mir_true = 1 | ||
735 | 41 | } MirBool; | ||
736 | 42 | |||
737 | 37 | /* Display server connection API */ | 43 | /* Display server connection API */ |
738 | 38 | typedef void* MirEGLNativeWindowType; | 44 | typedef void* MirEGLNativeWindowType; |
739 | 39 | typedef void* MirEGLNativeDisplayType; | 45 | typedef void* MirEGLNativeDisplayType; |
740 | @@ -157,7 +163,7 @@ | |||
741 | 157 | typedef enum MirPlatformType | 163 | typedef enum MirPlatformType |
742 | 158 | { | 164 | { |
743 | 159 | mir_platform_type_gbm, | 165 | mir_platform_type_gbm, |
745 | 160 | mir_platform_type_android | 166 | mir_platform_type_android |
746 | 161 | } MirPlatformType; | 167 | } MirPlatformType; |
747 | 162 | 168 | ||
748 | 163 | typedef struct MirPlatformPackage | 169 | typedef struct MirPlatformPackage |
749 | @@ -184,7 +190,7 @@ | |||
750 | 184 | 190 | ||
751 | 185 | } MirGraphicsRegion; | 191 | } MirGraphicsRegion; |
752 | 186 | 192 | ||
754 | 187 | /** | 193 | /** |
755 | 188 | * DEPRECATED. use MirDisplayConfiguration | 194 | * DEPRECATED. use MirDisplayConfiguration |
756 | 189 | */ | 195 | */ |
757 | 190 | enum { mir_supported_pixel_format_max = 32 }; | 196 | enum { mir_supported_pixel_format_max = 32 }; |
758 | @@ -192,7 +198,7 @@ | |||
759 | 192 | { | 198 | { |
760 | 193 | uint32_t width; | 199 | uint32_t width; |
761 | 194 | uint32_t height; | 200 | uint32_t height; |
763 | 195 | 201 | ||
764 | 196 | int supported_pixel_format_items; | 202 | int supported_pixel_format_items; |
765 | 197 | MirPixelFormat supported_pixel_format[mir_supported_pixel_format_max]; | 203 | MirPixelFormat supported_pixel_format[mir_supported_pixel_format_max]; |
766 | 198 | } MirDisplayInfo; | 204 | } MirDisplayInfo; |
767 | @@ -240,7 +246,7 @@ | |||
768 | 240 | uint32_t num_modes; | 246 | uint32_t num_modes; |
769 | 241 | MirDisplayMode* modes; | 247 | MirDisplayMode* modes; |
770 | 242 | uint32_t preferred_mode; | 248 | uint32_t preferred_mode; |
772 | 243 | uint32_t current_mode; | 249 | uint32_t current_mode; |
773 | 244 | 250 | ||
774 | 245 | uint32_t num_output_formats; | 251 | uint32_t num_output_formats; |
775 | 246 | MirPixelFormat* output_formats; | 252 | MirPixelFormat* output_formats; |
776 | @@ -257,7 +263,7 @@ | |||
777 | 257 | 263 | ||
778 | 258 | uint32_t physical_width_mm; | 264 | uint32_t physical_width_mm; |
779 | 259 | uint32_t physical_height_mm; | 265 | uint32_t physical_height_mm; |
781 | 260 | 266 | ||
782 | 261 | MirPowerMode power_mode; | 267 | MirPowerMode power_mode; |
783 | 262 | } MirDisplayOutput; | 268 | } MirDisplayOutput; |
784 | 263 | 269 | ||
785 | 264 | 270 | ||
786 | === modified file 'include/shared/mir_toolkit/event.h' | |||
787 | --- include/shared/mir_toolkit/event.h 2013-11-21 03:16:21 +0000 | |||
788 | +++ include/shared/mir_toolkit/event.h 2013-11-28 12:22:03 +0000 | |||
789 | @@ -39,7 +39,8 @@ | |||
790 | 39 | { | 39 | { |
791 | 40 | mir_event_type_key, | 40 | mir_event_type_key, |
792 | 41 | mir_event_type_motion, | 41 | mir_event_type_motion, |
794 | 42 | mir_event_type_surface | 42 | mir_event_type_surface, |
795 | 43 | mir_event_type_resize | ||
796 | 43 | } MirEventType; | 44 | } MirEventType; |
797 | 44 | 45 | ||
798 | 45 | typedef enum { | 46 | typedef enum { |
799 | @@ -141,7 +142,7 @@ | |||
800 | 141 | 142 | ||
801 | 142 | int32_t device_id; | 143 | int32_t device_id; |
802 | 143 | int32_t source_id; | 144 | int32_t source_id; |
804 | 144 | /* | 145 | /* |
805 | 145 | * TODO(racarr): We would like to store this as a MirMotionAction but the android input stack | 146 | * TODO(racarr): We would like to store this as a MirMotionAction but the android input stack |
806 | 146 | * encodes some non enumerable values in it. It's convenient to keep things | 147 | * encodes some non enumerable values in it. It's convenient to keep things |
807 | 147 | * this way for now until we can drop SF/Hybris support in QtUbuntu. | 148 | * this way for now until we can drop SF/Hybris support in QtUbuntu. |
808 | @@ -194,12 +195,22 @@ | |||
809 | 194 | int value; | 195 | int value; |
810 | 195 | } MirSurfaceEvent; | 196 | } MirSurfaceEvent; |
811 | 196 | 197 | ||
812 | 198 | typedef struct | ||
813 | 199 | { | ||
814 | 200 | MirEventType type; | ||
815 | 201 | |||
816 | 202 | int surface_id; | ||
817 | 203 | int width; | ||
818 | 204 | int height; | ||
819 | 205 | } MirResizeEvent; | ||
820 | 206 | |||
821 | 197 | typedef union | 207 | typedef union |
822 | 198 | { | 208 | { |
823 | 199 | MirEventType type; | 209 | MirEventType type; |
824 | 200 | MirKeyEvent key; | 210 | MirKeyEvent key; |
825 | 201 | MirMotionEvent motion; | 211 | MirMotionEvent motion; |
826 | 202 | MirSurfaceEvent surface; | 212 | MirSurfaceEvent surface; |
827 | 213 | MirResizeEvent resize; | ||
828 | 203 | } MirEvent; | 214 | } MirEvent; |
829 | 204 | 215 | ||
830 | 205 | #ifdef __cplusplus | 216 | #ifdef __cplusplus |
831 | 206 | 217 | ||
832 | === modified file 'include/shared/mir_toolkit/mir_native_buffer.h' | |||
833 | --- include/shared/mir_toolkit/mir_native_buffer.h 2013-11-21 03:16:21 +0000 | |||
834 | +++ include/shared/mir_toolkit/mir_native_buffer.h 2013-11-28 12:22:03 +0000 | |||
835 | @@ -52,6 +52,6 @@ | |||
836 | 52 | struct ANativeWindowBuffer; | 52 | struct ANativeWindowBuffer; |
837 | 53 | typedef struct ANativeWindowBuffer MirNativeBuffer; | 53 | typedef struct ANativeWindowBuffer MirNativeBuffer; |
838 | 54 | #else | 54 | #else |
840 | 55 | typedef struct MirBufferPackage MirNativeBuffer; | 55 | typedef struct MirBufferPackage MirNativeBuffer; |
841 | 56 | #endif | 56 | #endif |
842 | 57 | #endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */ | 57 | #endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */ |
843 | 58 | 58 | ||
844 | === added file 'include/test/gmock_set_arg.h' | |||
845 | --- include/test/gmock_set_arg.h 1970-01-01 00:00:00 +0000 | |||
846 | +++ include/test/gmock_set_arg.h 2013-11-28 12:22:03 +0000 | |||
847 | @@ -0,0 +1,57 @@ | |||
848 | 1 | /* | ||
849 | 2 | * Copyright © 2013 Canonical Ltd. | ||
850 | 3 | * | ||
851 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
852 | 5 | * under the terms of the GNU General Public License version 3, | ||
853 | 6 | * as published by the Free Software Foundation. | ||
854 | 7 | * | ||
855 | 8 | * This program is distributed in the hope that it will be useful, | ||
856 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
857 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
858 | 11 | * GNU General Public License for more details. | ||
859 | 12 | * | ||
860 | 13 | * You should have received a copy of the GNU General Public License | ||
861 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
862 | 15 | * | ||
863 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
864 | 17 | */ | ||
865 | 18 | |||
866 | 19 | #ifndef GMOCK_SET_ARG_H_ | ||
867 | 20 | #define GMOCK_SET_ARG_H_ | ||
868 | 21 | |||
869 | 22 | #include <gmock/gmock.h> | ||
870 | 23 | |||
871 | 24 | namespace testing | ||
872 | 25 | { | ||
873 | 26 | namespace internal | ||
874 | 27 | { | ||
875 | 28 | template <size_t N, typename A, bool kIsProto> | ||
876 | 29 | class SetArgumentAction { | ||
877 | 30 | public: | ||
878 | 31 | // Constructs an action that sets the variable pointed to by the | ||
879 | 32 | // N-th function argument to 'value'. | ||
880 | 33 | explicit SetArgumentAction(const A& value) : value_(value) {} | ||
881 | 34 | |||
882 | 35 | template <typename Result, typename ArgumentTuple> | ||
883 | 36 | void Perform(const ArgumentTuple& args) const { | ||
884 | 37 | CompileAssertTypesEqual<void, Result>(); | ||
885 | 38 | ::std::tr1::get<N>(args) = value_; | ||
886 | 39 | } | ||
887 | 40 | |||
888 | 41 | private: | ||
889 | 42 | const A value_; | ||
890 | 43 | |||
891 | 44 | GTEST_DISALLOW_ASSIGN_(SetArgumentAction); | ||
892 | 45 | }; | ||
893 | 46 | } | ||
894 | 47 | template <size_t N, typename T> | ||
895 | 48 | PolymorphicAction< | ||
896 | 49 | internal::SetArgumentAction< | ||
897 | 50 | N, T, internal::IsAProtocolMessage<T>::value> > | ||
898 | 51 | SetArg(const T& x) { | ||
899 | 52 | return MakePolymorphicAction(internal::SetArgumentAction< | ||
900 | 53 | N, T, internal::IsAProtocolMessage<T>::value>(x)); | ||
901 | 54 | } | ||
902 | 55 | } | ||
903 | 56 | |||
904 | 57 | #endif /* GMOCK_SET_ARG_H_ */ | ||
905 | 0 | 58 | ||
906 | === modified file 'include/test/mir_test/draw/draw_pattern_checkered-inl.h' | |||
907 | --- include/test/mir_test/draw/draw_pattern_checkered-inl.h 2013-11-21 03:16:21 +0000 | |||
908 | +++ include/test/mir_test/draw/draw_pattern_checkered-inl.h 2013-11-28 12:22:03 +0000 | |||
909 | @@ -39,7 +39,7 @@ | |||
910 | 39 | { | 39 | { |
911 | 40 | int key_row = i % Rows; | 40 | int key_row = i % Rows; |
912 | 41 | int key_col = j % Cols; | 41 | int key_col = j % Cols; |
914 | 42 | uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); | 42 | uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); |
915 | 43 | *pixel = color_pattern[key_row][key_col]; | 43 | *pixel = color_pattern[key_row][key_col]; |
916 | 44 | } | 44 | } |
917 | 45 | } | 45 | } |
918 | @@ -58,7 +58,7 @@ | |||
919 | 58 | { | 58 | { |
920 | 59 | int key_row = i % Rows; | 59 | int key_row = i % Rows; |
921 | 60 | int key_col = j % Cols; | 60 | int key_col = j % Cols; |
923 | 61 | uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); | 61 | uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); |
924 | 62 | if ( *pixel != color_pattern[key_row][key_col] ) | 62 | if ( *pixel != color_pattern[key_row][key_col] ) |
925 | 63 | { | 63 | { |
926 | 64 | return false; | 64 | return false; |
927 | 65 | 65 | ||
928 | === modified file 'include/test/mir_test/fake_event_hub_input_configuration.h' | |||
929 | --- include/test/mir_test/fake_event_hub_input_configuration.h 2013-08-30 07:47:16 +0000 | |||
930 | +++ include/test/mir_test/fake_event_hub_input_configuration.h 2013-11-28 12:22:03 +0000 | |||
931 | @@ -59,7 +59,7 @@ | |||
932 | 59 | 59 | ||
933 | 60 | droidinput::sp<droidinput::EventHubInterface> the_event_hub(); | 60 | droidinput::sp<droidinput::EventHubInterface> the_event_hub(); |
934 | 61 | input::android::FakeEventHub* the_fake_event_hub(); | 61 | input::android::FakeEventHub* the_fake_event_hub(); |
936 | 62 | 62 | ||
937 | 63 | bool is_key_repeat_enabled() override { return false; } | 63 | bool is_key_repeat_enabled() override { return false; } |
938 | 64 | 64 | ||
939 | 65 | 65 | ||
940 | 66 | 66 | ||
941 | === modified file 'include/test/mir_test_doubles/mock_alloc_adaptor.h' | |||
942 | --- include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-10-15 08:53:10 +0000 | |||
943 | +++ include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-11-28 12:22:03 +0000 | |||
944 | @@ -34,7 +34,7 @@ | |||
945 | 34 | class MockAllocAdaptor : public graphics::android::GraphicAllocAdaptor | 34 | class MockAllocAdaptor : public graphics::android::GraphicAllocAdaptor |
946 | 35 | { | 35 | { |
947 | 36 | public: | 36 | public: |
949 | 37 | MOCK_METHOD3(alloc_buffer, | 37 | MOCK_METHOD3(alloc_buffer, |
950 | 38 | std::shared_ptr<graphics::NativeBuffer>(geometry::Size, geometry::PixelFormat, graphics::android::BufferUsage)); | 38 | std::shared_ptr<graphics::NativeBuffer>(geometry::Size, geometry::PixelFormat, graphics::android::BufferUsage)); |
951 | 39 | }; | 39 | }; |
952 | 40 | 40 | ||
953 | 41 | 41 | ||
954 | === modified file 'include/test/mir_test_doubles/mock_android_native_buffer.h' | |||
955 | --- include/test/mir_test_doubles/mock_android_native_buffer.h 2013-10-11 21:30:50 +0000 | |||
956 | +++ include/test/mir_test_doubles/mock_android_native_buffer.h 2013-11-28 12:22:03 +0000 | |||
957 | @@ -20,7 +20,7 @@ | |||
958 | 20 | #define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_ | 20 | #define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_ |
959 | 21 | 21 | ||
960 | 22 | #include "mir/graphics/android/native_buffer.h" | 22 | #include "mir/graphics/android/native_buffer.h" |
962 | 23 | #include <gmock/gmock.h> | 23 | #include <gmock/gmock.h> |
963 | 24 | 24 | ||
964 | 25 | namespace mir | 25 | namespace mir |
965 | 26 | { | 26 | { |
966 | 27 | 27 | ||
967 | === modified file 'include/test/mir_test_doubles/mock_android_registrar.h' | |||
968 | --- include/test/mir_test_doubles/mock_android_registrar.h 2013-06-21 22:14:10 +0000 | |||
969 | +++ include/test/mir_test_doubles/mock_android_registrar.h 2013-11-28 12:22:03 +0000 | |||
970 | @@ -36,7 +36,7 @@ | |||
971 | 36 | struct MockAndroidRegistrar : public client::android::AndroidRegistrar | 36 | struct MockAndroidRegistrar : public client::android::AndroidRegistrar |
972 | 37 | { | 37 | { |
973 | 38 | ~MockAndroidRegistrar() noexcept {} | 38 | ~MockAndroidRegistrar() noexcept {} |
975 | 39 | MOCK_CONST_METHOD1(register_buffer, | 39 | MOCK_CONST_METHOD1(register_buffer, |
976 | 40 | std::shared_ptr<const native_handle_t>(std::shared_ptr<MirBufferPackage> const&)); | 40 | std::shared_ptr<const native_handle_t>(std::shared_ptr<MirBufferPackage> const&)); |
977 | 41 | MOCK_METHOD2(secure_for_cpu, std::shared_ptr<char>(std::shared_ptr<const native_handle_t>, geometry::Rectangle)); | 41 | MOCK_METHOD2(secure_for_cpu, std::shared_ptr<char>(std::shared_ptr<const native_handle_t>, geometry::Rectangle)); |
978 | 42 | }; | 42 | }; |
979 | 43 | 43 | ||
980 | === modified file 'include/test/mir_test_doubles/mock_buffer_stream.h' | |||
981 | --- include/test/mir_test_doubles/mock_buffer_stream.h 2013-11-21 03:16:21 +0000 | |||
982 | +++ include/test/mir_test_doubles/mock_buffer_stream.h 2013-11-28 12:22:03 +0000 | |||
983 | @@ -31,7 +31,8 @@ | |||
984 | 31 | { | 31 | { |
985 | 32 | struct MockBufferStream : public compositor::BufferStream | 32 | struct MockBufferStream : public compositor::BufferStream |
986 | 33 | { | 33 | { |
988 | 34 | MOCK_METHOD0(secure_client_buffer, std::shared_ptr<graphics::Buffer>()); | 34 | MOCK_METHOD1(swap_client_buffers, void(std::shared_ptr<graphics::Buffer>&)); |
989 | 35 | MOCK_METHOD1(release_client_buffer, void(std::shared_ptr<graphics::Buffer>&)); | ||
990 | 35 | MOCK_METHOD1(lock_compositor_buffer, | 36 | MOCK_METHOD1(lock_compositor_buffer, |
991 | 36 | std::shared_ptr<graphics::Buffer>(unsigned long)); | 37 | std::shared_ptr<graphics::Buffer>(unsigned long)); |
992 | 37 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); | 38 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); |
993 | 38 | 39 | ||
994 | === modified file 'include/test/mir_test_doubles/mock_display_device.h' | |||
995 | --- include/test/mir_test_doubles/mock_display_device.h 2013-11-21 17:20:14 +0000 | |||
996 | +++ include/test/mir_test_doubles/mock_display_device.h 2013-11-28 12:22:03 +0000 | |||
997 | @@ -22,7 +22,7 @@ | |||
998 | 22 | #include "mir/graphics/buffer.h" | 22 | #include "mir/graphics/buffer.h" |
999 | 23 | #include "src/server/graphics/android/display_device.h" | 23 | #include "src/server/graphics/android/display_device.h" |
1000 | 24 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
1002 | 25 | 25 | ||
1003 | 26 | namespace mir | 26 | namespace mir |
1004 | 27 | { | 27 | { |
1005 | 28 | namespace test | 28 | namespace test |
1006 | 29 | 29 | ||
1007 | === modified file 'include/test/mir_test_doubles/mock_egl.h' | |||
1008 | --- include/test/mir_test_doubles/mock_egl.h 2013-11-21 03:16:21 +0000 | |||
1009 | +++ include/test/mir_test_doubles/mock_egl.h 2013-11-28 12:22:03 +0000 | |||
1010 | @@ -58,7 +58,6 @@ | |||
1011 | 58 | public: | 58 | public: |
1012 | 59 | MockEGL(); | 59 | MockEGL(); |
1013 | 60 | ~MockEGL(); | 60 | ~MockEGL(); |
1014 | 61 | void silence_uninteresting(); | ||
1015 | 62 | 61 | ||
1016 | 63 | typedef void (*generic_function_pointer_t)(void); | 62 | typedef void (*generic_function_pointer_t)(void); |
1017 | 64 | 63 | ||
1018 | 65 | 64 | ||
1019 | === modified file 'include/test/mir_test_doubles/mock_fb_hal_device.h' | |||
1020 | --- include/test/mir_test_doubles/mock_fb_hal_device.h 2013-11-19 22:02:08 +0000 | |||
1021 | +++ include/test/mir_test_doubles/mock_fb_hal_device.h 2013-11-28 12:22:03 +0000 | |||
1022 | @@ -52,10 +52,11 @@ | |||
1023 | 52 | {0,0,0,0,0,0,0}, | 52 | {0,0,0,0,0,0,0}, |
1024 | 53 | nullptr, nullptr,nullptr,nullptr, nullptr,nullptr, | 53 | nullptr, nullptr,nullptr,nullptr, nullptr,nullptr, |
1025 | 54 | {0,0,0,0,0,0} | 54 | {0,0,0,0,0,0} |
1027 | 55 | }) | 55 | }) |
1028 | 56 | { | 56 | { |
1029 | 57 | post = hook_post; | 57 | post = hook_post; |
1031 | 58 | setSwapInterval = hook_setSwapInterval; | 58 | setSwapInterval = hook_setSwapInterval; |
1032 | 59 | enableScreen = hook_enableScreen; | ||
1033 | 59 | } | 60 | } |
1034 | 60 | 61 | ||
1035 | 61 | MockFBHalDevice() | 62 | MockFBHalDevice() |
1036 | @@ -72,12 +73,20 @@ | |||
1037 | 72 | static int hook_setSwapInterval(struct framebuffer_device_t* mock_fb, int interval) | 73 | static int hook_setSwapInterval(struct framebuffer_device_t* mock_fb, int interval) |
1038 | 73 | { | 74 | { |
1039 | 74 | MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb); | 75 | MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb); |
1043 | 75 | return mocker->setSwapInterval_interface(mock_fb, interval); | 76 | return mocker->setSwapInterval_interface(mock_fb, interval); |
1044 | 76 | } | 77 | } |
1045 | 77 | 78 | ||
1046 | 79 | static int hook_enableScreen(struct framebuffer_device_t* mock_fb, int enable) | ||
1047 | 80 | { | ||
1048 | 81 | MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb); | ||
1049 | 82 | return mocker->enableScreen_interface(mock_fb, enable); | ||
1050 | 83 | } | ||
1051 | 84 | |||
1052 | 85 | |||
1053 | 86 | MOCK_METHOD2(enableScreen_interface, int(struct framebuffer_device_t*, int)); | ||
1054 | 78 | MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t)); | 87 | MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t)); |
1055 | 79 | MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int)); | 88 | MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int)); |
1057 | 80 | 89 | ||
1058 | 81 | hw_device_t empty_module; | 90 | hw_device_t empty_module; |
1059 | 82 | }; | 91 | }; |
1060 | 83 | 92 | ||
1061 | 84 | 93 | ||
1062 | === modified file 'include/test/mir_test_doubles/mock_frontend_surface.h' | |||
1063 | --- include/test/mir_test_doubles/mock_frontend_surface.h 2013-11-21 03:16:21 +0000 | |||
1064 | +++ include/test/mir_test_doubles/mock_frontend_surface.h 2013-11-28 12:22:03 +0000 | |||
1065 | @@ -39,7 +39,7 @@ | |||
1066 | 39 | 39 | ||
1067 | 40 | MOCK_METHOD0(destroy, void()); | 40 | MOCK_METHOD0(destroy, void()); |
1068 | 41 | MOCK_METHOD0(force_requests_to_complete, void()); | 41 | MOCK_METHOD0(force_requests_to_complete, void()); |
1070 | 42 | MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>()); | 42 | MOCK_METHOD1(swap_buffers, void(std::shared_ptr<graphics::Buffer>&)); |
1071 | 43 | 43 | ||
1072 | 44 | MOCK_CONST_METHOD0(size, geometry::Size()); | 44 | MOCK_CONST_METHOD0(size, geometry::Size()); |
1073 | 45 | MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat()); | 45 | MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat()); |
1074 | 46 | 46 | ||
1075 | === modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h' | |||
1076 | --- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2013-11-21 03:16:21 +0000 | |||
1077 | +++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2013-11-28 12:22:03 +0000 | |||
1078 | @@ -66,7 +66,7 @@ | |||
1079 | 66 | 66 | ||
1080 | 67 | void hwc_set_return_fence(int fence) | 67 | void hwc_set_return_fence(int fence) |
1081 | 68 | { | 68 | { |
1083 | 69 | fb_fence = fence; | 69 | fb_fence = fence; |
1084 | 70 | } | 70 | } |
1085 | 71 | 71 | ||
1086 | 72 | int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t** displays) | 72 | int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t** displays) |
1087 | @@ -87,7 +87,7 @@ | |||
1088 | 87 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; | 87 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; |
1089 | 88 | } | 88 | } |
1090 | 89 | 89 | ||
1092 | 90 | if (primary_display->hwLayers) | 90 | if (primary_display->numHwLayers >= 2) |
1093 | 91 | { | 91 | { |
1094 | 92 | primary_display->hwLayers[1].releaseFenceFd = fb_fence; | 92 | primary_display->hwLayers[1].releaseFenceFd = fb_fence; |
1095 | 93 | } | 93 | } |
1096 | 94 | 94 | ||
1097 | === modified file 'include/test/mir_test_doubles/mock_input_dispatcher.h' | |||
1098 | --- include/test/mir_test_doubles/mock_input_dispatcher.h 2013-05-24 18:23:48 +0000 | |||
1099 | +++ include/test/mir_test_doubles/mock_input_dispatcher.h 2013-11-28 12:22:03 +0000 | |||
1100 | @@ -45,7 +45,7 @@ | |||
1101 | 45 | MOCK_METHOD2(transferTouchFocus, bool(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputChannel> const&)); | 45 | MOCK_METHOD2(transferTouchFocus, bool(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputChannel> const&)); |
1102 | 46 | MOCK_METHOD3(registerInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputWindowHandle> const&, bool)); | 46 | MOCK_METHOD3(registerInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputWindowHandle> const&, bool)); |
1103 | 47 | MOCK_METHOD1(unregisterInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&)); | 47 | MOCK_METHOD1(unregisterInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&)); |
1105 | 48 | 48 | ||
1106 | 49 | MOCK_METHOD1(setKeyboardFocus, void(droidinput::sp<droidinput::InputWindowHandle> const&)); | 49 | MOCK_METHOD1(setKeyboardFocus, void(droidinput::sp<droidinput::InputWindowHandle> const&)); |
1107 | 50 | MOCK_METHOD1(notifyWindowRemoved, void(droidinput::sp<droidinput::InputWindowHandle> const&)); | 50 | MOCK_METHOD1(notifyWindowRemoved, void(droidinput::sp<droidinput::InputWindowHandle> const&)); |
1108 | 51 | 51 | ||
1109 | 52 | 52 | ||
1110 | === modified file 'include/test/mir_test_doubles/mock_input_surface.h' | |||
1111 | --- include/test/mir_test_doubles/mock_input_surface.h 2013-08-28 03:41:48 +0000 | |||
1112 | +++ include/test/mir_test_doubles/mock_input_surface.h 2013-11-28 12:22:03 +0000 | |||
1113 | @@ -29,7 +29,7 @@ | |||
1114 | 29 | namespace doubles | 29 | namespace doubles |
1115 | 30 | { | 30 | { |
1116 | 31 | 31 | ||
1118 | 32 | class MockInputSurface : public input::Surface | 32 | class MockInputSurface : public input::Surface |
1119 | 33 | { | 33 | { |
1120 | 34 | public: | 34 | public: |
1121 | 35 | MockInputSurface() | 35 | MockInputSurface() |
1122 | 36 | 36 | ||
1123 | === modified file 'include/test/mir_test_doubles/mock_session_listener.h' | |||
1124 | --- include/test/mir_test_doubles/mock_session_listener.h 2013-07-18 22:51:42 +0000 | |||
1125 | +++ include/test/mir_test_doubles/mock_session_listener.h 2013-11-28 12:22:03 +0000 | |||
1126 | @@ -38,7 +38,7 @@ | |||
1127 | 38 | MOCK_METHOD1(stopping, void(std::shared_ptr<shell::Session> const&)); | 38 | MOCK_METHOD1(stopping, void(std::shared_ptr<shell::Session> const&)); |
1128 | 39 | MOCK_METHOD1(focused, void(std::shared_ptr<shell::Session> const&)); | 39 | MOCK_METHOD1(focused, void(std::shared_ptr<shell::Session> const&)); |
1129 | 40 | MOCK_METHOD0(unfocused, void()); | 40 | MOCK_METHOD0(unfocused, void()); |
1131 | 41 | 41 | ||
1132 | 42 | MOCK_METHOD2(surface_created, void(shell::Session&, std::shared_ptr<shell::Surface> const&)); | 42 | MOCK_METHOD2(surface_created, void(shell::Session&, std::shared_ptr<shell::Surface> const&)); |
1133 | 43 | MOCK_METHOD2(destroying_surface, void(shell::Session&, std::shared_ptr<shell::Surface> const&)); | 43 | MOCK_METHOD2(destroying_surface, void(shell::Session&, std::shared_ptr<shell::Surface> const&)); |
1134 | 44 | }; | 44 | }; |
1135 | 45 | 45 | ||
1136 | === modified file 'include/test/mir_test_doubles/mock_shell_session.h' | |||
1137 | --- include/test/mir_test_doubles/mock_shell_session.h 2013-11-21 03:16:21 +0000 | |||
1138 | +++ include/test/mir_test_doubles/mock_shell_session.h 2013-11-28 12:22:03 +0000 | |||
1139 | @@ -46,7 +46,7 @@ | |||
1140 | 46 | 46 | ||
1141 | 47 | MOCK_METHOD0(hide, void()); | 47 | MOCK_METHOD0(hide, void()); |
1142 | 48 | MOCK_METHOD0(show, void()); | 48 | MOCK_METHOD0(show, void()); |
1144 | 49 | 49 | ||
1145 | 50 | MOCK_METHOD1(send_display_config, void(graphics::DisplayConfiguration const&)); | 50 | MOCK_METHOD1(send_display_config, void(graphics::DisplayConfiguration const&)); |
1146 | 51 | MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int)); | 51 | MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int)); |
1147 | 52 | 52 | ||
1148 | 53 | 53 | ||
1149 | === modified file 'include/test/mir_test_doubles/mock_surface_renderer.h' | |||
1150 | --- include/test/mir_test_doubles/mock_surface_renderer.h 2013-11-21 03:16:21 +0000 | |||
1151 | +++ include/test/mir_test_doubles/mock_surface_renderer.h 2013-11-28 12:22:03 +0000 | |||
1152 | @@ -18,7 +18,6 @@ | |||
1153 | 18 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ | 18 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ |
1154 | 19 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ | 19 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ |
1155 | 20 | 20 | ||
1156 | 21 | #include "mir/compositor/buffer_stream.h" | ||
1157 | 22 | #include "src/server/compositor/renderer.h" | 21 | #include "src/server/compositor/renderer.h" |
1158 | 23 | 22 | ||
1159 | 24 | #include <gmock/gmock.h> | 23 | #include <gmock/gmock.h> |
1160 | @@ -32,9 +31,8 @@ | |||
1161 | 32 | 31 | ||
1162 | 33 | struct MockSurfaceRenderer : public compositor::Renderer | 32 | struct MockSurfaceRenderer : public compositor::Renderer |
1163 | 34 | { | 33 | { |
1167 | 35 | MOCK_METHOD3(render, void( | 34 | MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&)); |
1168 | 36 | std::function<void(std::shared_ptr<void> const&)>, compositor::CompositingCriteria const&, compositor::BufferStream&)); | 35 | MOCK_CONST_METHOD0(clear, void()); |
1166 | 37 | MOCK_METHOD1(clear, void(unsigned long)); | ||
1169 | 38 | 36 | ||
1170 | 39 | ~MockSurfaceRenderer() noexcept {} | 37 | ~MockSurfaceRenderer() noexcept {} |
1171 | 40 | }; | 38 | }; |
1172 | 41 | 39 | ||
1173 | === modified file 'include/test/mir_test_doubles/stub_buffer_stream.h' | |||
1174 | --- include/test/mir_test_doubles/stub_buffer_stream.h 2013-11-21 03:16:21 +0000 | |||
1175 | +++ include/test/mir_test_doubles/stub_buffer_stream.h 2013-11-28 12:22:03 +0000 | |||
1176 | @@ -37,27 +37,30 @@ | |||
1177 | 37 | stub_client_buffer = std::make_shared<StubBuffer>(); | 37 | stub_client_buffer = std::make_shared<StubBuffer>(); |
1178 | 38 | stub_compositor_buffer = std::make_shared<StubBuffer>(); | 38 | stub_compositor_buffer = std::make_shared<StubBuffer>(); |
1179 | 39 | } | 39 | } |
1196 | 40 | std::shared_ptr<graphics::Buffer> secure_client_buffer() | 40 | void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) override |
1197 | 41 | { | 41 | { |
1198 | 42 | return stub_client_buffer; | 42 | buffer = stub_client_buffer; |
1199 | 43 | } | 43 | } |
1200 | 44 | 44 | void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) override | |
1201 | 45 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) | 45 | { |
1202 | 46 | { | 46 | buffer.reset(); |
1203 | 47 | return stub_compositor_buffer; | 47 | } |
1204 | 48 | } | 48 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override |
1205 | 49 | 49 | { | |
1206 | 50 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() | 50 | return stub_compositor_buffer; |
1207 | 51 | { | 51 | } |
1208 | 52 | return stub_compositor_buffer; | 52 | |
1209 | 53 | } | 53 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override |
1210 | 54 | 54 | { | |
1211 | 55 | geometry::PixelFormat get_stream_pixel_format() | 55 | return stub_compositor_buffer; |
1212 | 56 | } | ||
1213 | 57 | |||
1214 | 58 | geometry::PixelFormat get_stream_pixel_format() override | ||
1215 | 56 | { | 59 | { |
1216 | 57 | return geometry::PixelFormat(); | 60 | return geometry::PixelFormat(); |
1217 | 58 | } | 61 | } |
1218 | 59 | 62 | ||
1220 | 60 | geometry::Size stream_size() | 63 | geometry::Size stream_size() override |
1221 | 61 | { | 64 | { |
1222 | 62 | return geometry::Size(); | 65 | return geometry::Size(); |
1223 | 63 | } | 66 | } |
1224 | @@ -66,11 +69,11 @@ | |||
1225 | 66 | { | 69 | { |
1226 | 67 | } | 70 | } |
1227 | 68 | 71 | ||
1229 | 69 | void force_requests_to_complete() | 72 | void force_requests_to_complete() override |
1230 | 70 | { | 73 | { |
1231 | 71 | } | 74 | } |
1232 | 72 | 75 | ||
1234 | 73 | void allow_framedropping(bool) | 76 | void allow_framedropping(bool) override |
1235 | 74 | { | 77 | { |
1236 | 75 | } | 78 | } |
1237 | 76 | 79 | ||
1238 | 77 | 80 | ||
1239 | === modified file 'include/test/mir_test_doubles/stub_display_builder.h' | |||
1240 | --- include/test/mir_test_doubles/stub_display_builder.h 2013-11-19 19:11:49 +0000 | |||
1241 | +++ include/test/mir_test_doubles/stub_display_builder.h 2013-11-28 12:22:03 +0000 | |||
1242 | @@ -64,7 +64,7 @@ | |||
1243 | 64 | return std::unique_ptr<graphics::DisplayBuffer>( | 64 | return std::unique_ptr<graphics::DisplayBuffer>( |
1244 | 65 | new StubDisplayBuffer(geometry::Rectangle{{0,0},sz})); | 65 | new StubDisplayBuffer(geometry::Rectangle{{0,0},sz})); |
1245 | 66 | } | 66 | } |
1247 | 67 | 67 | ||
1248 | 68 | std::shared_ptr<graphics::android::DisplayDevice> create_display_device() | 68 | std::shared_ptr<graphics::android::DisplayDevice> create_display_device() |
1249 | 69 | { | 69 | { |
1250 | 70 | return stub_dev; | 70 | return stub_dev; |
1251 | 71 | 71 | ||
1252 | === modified file 'include/test/mir_test_doubles/stub_display_configuration.h' | |||
1253 | --- include/test/mir_test_doubles/stub_display_configuration.h 2013-11-21 03:16:21 +0000 | |||
1254 | +++ include/test/mir_test_doubles/stub_display_configuration.h 2013-11-28 12:22:03 +0000 | |||
1255 | @@ -67,7 +67,7 @@ | |||
1256 | 67 | modes.push_back(mode); | 67 | modes.push_back(mode); |
1257 | 68 | } | 68 | } |
1258 | 69 | 69 | ||
1260 | 70 | size_t mode_index = modes.size() - 1; | 70 | size_t mode_index = modes.size() - 1; |
1261 | 71 | geometry::Size physical_size{}; | 71 | geometry::Size physical_size{}; |
1262 | 72 | geometry::Point top_left{}; | 72 | geometry::Point top_left{}; |
1263 | 73 | graphics::DisplayConfigurationOutput output{ | 73 | graphics::DisplayConfigurationOutput output{ |
1264 | 74 | 74 | ||
1265 | === modified file 'include/test/mir_test_doubles/stub_display_device.h' | |||
1266 | --- include/test/mir_test_doubles/stub_display_device.h 2013-11-21 17:20:14 +0000 | |||
1267 | +++ include/test/mir_test_doubles/stub_display_device.h 2013-11-28 12:22:03 +0000 | |||
1268 | @@ -19,7 +19,7 @@ | |||
1269 | 19 | #define MIR_TEST_DOUBLES_STUB_DISPLAY_DEVICE_H_ | 19 | #define MIR_TEST_DOUBLES_STUB_DISPLAY_DEVICE_H_ |
1270 | 20 | 20 | ||
1271 | 21 | #include "src/server/graphics/android/display_device.h" | 21 | #include "src/server/graphics/android/display_device.h" |
1273 | 22 | 22 | ||
1274 | 23 | namespace mir | 23 | namespace mir |
1275 | 24 | { | 24 | { |
1276 | 25 | namespace test | 25 | namespace test |
1277 | @@ -41,7 +41,7 @@ | |||
1278 | 41 | void prepare_composition() | 41 | void prepare_composition() |
1279 | 42 | { | 42 | { |
1280 | 43 | } | 43 | } |
1282 | 44 | void gpu_render(EGLDisplay, EGLSurface) | 44 | void gpu_render(EGLDisplay, EGLSurface) |
1283 | 45 | { | 45 | { |
1284 | 46 | } | 46 | } |
1285 | 47 | void post(graphics::Buffer const&) | 47 | void post(graphics::Buffer const&) |
1286 | 48 | 48 | ||
1287 | === modified file 'include/test/mir_test_doubles/stub_driver_interpreter.h' | |||
1288 | --- include/test/mir_test_doubles/stub_driver_interpreter.h 2013-10-17 22:15:46 +0000 | |||
1289 | +++ include/test/mir_test_doubles/stub_driver_interpreter.h 2013-11-28 12:22:03 +0000 | |||
1290 | @@ -49,7 +49,7 @@ | |||
1291 | 49 | void driver_returns_buffer(ANativeWindowBuffer*, int) | 49 | void driver_returns_buffer(ANativeWindowBuffer*, int) |
1292 | 50 | { | 50 | { |
1293 | 51 | } | 51 | } |
1295 | 52 | void dispatch_driver_request_format(int) | 52 | void dispatch_driver_request_format(int) |
1296 | 53 | { | 53 | { |
1297 | 54 | } | 54 | } |
1298 | 55 | int driver_requests_info(int index) const | 55 | int driver_requests_info(int index) const |
1299 | 56 | 56 | ||
1300 | === modified file 'include/test/mir_test_doubles/stub_shell_session.h' | |||
1301 | --- include/test/mir_test_doubles/stub_shell_session.h 2013-11-21 03:16:21 +0000 | |||
1302 | +++ include/test/mir_test_doubles/stub_shell_session.h 2013-11-28 12:22:03 +0000 | |||
1303 | @@ -66,7 +66,7 @@ | |||
1304 | 66 | void take_snapshot(shell::SnapshotCallback const&) override | 66 | void take_snapshot(shell::SnapshotCallback const&) override |
1305 | 67 | { | 67 | { |
1306 | 68 | } | 68 | } |
1308 | 69 | 69 | ||
1309 | 70 | std::shared_ptr<shell::Surface> default_surface() const override | 70 | std::shared_ptr<shell::Surface> default_surface() const override |
1310 | 71 | { | 71 | { |
1311 | 72 | return std::shared_ptr<shell::Surface>(); | 72 | return std::shared_ptr<shell::Surface>(); |
1312 | 73 | 73 | ||
1313 | === removed file 'include/test/mir_test_doubles/stub_surface.h' | |||
1314 | --- include/test/mir_test_doubles/stub_surface.h 2013-11-21 03:16:21 +0000 | |||
1315 | +++ include/test/mir_test_doubles/stub_surface.h 1970-01-01 00:00:00 +0000 | |||
1316 | @@ -1,74 +0,0 @@ | |||
1317 | 1 | /* | ||
1318 | 2 | * Copyright © 2013 Canonical Ltd. | ||
1319 | 3 | * | ||
1320 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1321 | 5 | * under the terms of the GNU General Public License version 3, | ||
1322 | 6 | * as published by the Free Software Foundation. | ||
1323 | 7 | * | ||
1324 | 8 | * This program is distributed in the hope that it will be useful, | ||
1325 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1326 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1327 | 11 | * GNU General Public License for more details. | ||
1328 | 12 | * | ||
1329 | 13 | * You should have received a copy of the GNU General Public License | ||
1330 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1331 | 15 | * | ||
1332 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
1333 | 17 | */ | ||
1334 | 18 | |||
1335 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_SURFACE_H_ | ||
1336 | 20 | #define MIR_TEST_DOUBLES_STUB_SURFACE_H_ | ||
1337 | 21 | |||
1338 | 22 | #include "mir/frontend/surface.h" | ||
1339 | 23 | |||
1340 | 24 | namespace mir | ||
1341 | 25 | { | ||
1342 | 26 | namespace test | ||
1343 | 27 | { | ||
1344 | 28 | namespace doubles | ||
1345 | 29 | { | ||
1346 | 30 | |||
1347 | 31 | class StubSurface : public frontend::Surface | ||
1348 | 32 | { | ||
1349 | 33 | public: | ||
1350 | 34 | virtual ~StubSurface() = default; | ||
1351 | 35 | |||
1352 | 36 | void hide() {} | ||
1353 | 37 | void show() {} | ||
1354 | 38 | void force_requests_to_complete() {} | ||
1355 | 39 | |||
1356 | 40 | geometry::Size size() const | ||
1357 | 41 | { | ||
1358 | 42 | return geometry::Size(); | ||
1359 | 43 | } | ||
1360 | 44 | geometry::PixelFormat pixel_format() const | ||
1361 | 45 | { | ||
1362 | 46 | return geometry::PixelFormat(); | ||
1363 | 47 | } | ||
1364 | 48 | |||
1365 | 49 | std::shared_ptr<graphics::Buffer> advance_client_buffer() | ||
1366 | 50 | { | ||
1367 | 51 | return std::shared_ptr<graphics::Buffer>(); | ||
1368 | 52 | } | ||
1369 | 53 | |||
1370 | 54 | virtual int configure(MirSurfaceAttrib, int) | ||
1371 | 55 | { | ||
1372 | 56 | return 0; | ||
1373 | 57 | } | ||
1374 | 58 | |||
1375 | 59 | virtual bool supports_input() const | ||
1376 | 60 | { | ||
1377 | 61 | return false; | ||
1378 | 62 | } | ||
1379 | 63 | |||
1380 | 64 | virtual int client_input_fd() const | ||
1381 | 65 | { | ||
1382 | 66 | return 0; | ||
1383 | 67 | } | ||
1384 | 68 | }; | ||
1385 | 69 | |||
1386 | 70 | } | ||
1387 | 71 | } | ||
1388 | 72 | } // namespace mir | ||
1389 | 73 | |||
1390 | 74 | #endif // MIR_TEST_DOUBLES_STUB_SURFACE_H_ | ||
1391 | 75 | 0 | ||
1392 | === modified file 'include/test/mir_test_framework/cross_process_sync.h' | |||
1393 | --- include/test/mir_test_framework/cross_process_sync.h 2013-09-20 22:16:11 +0000 | |||
1394 | +++ include/test/mir_test_framework/cross_process_sync.h 2013-11-28 12:22:03 +0000 | |||
1395 | @@ -45,7 +45,7 @@ | |||
1396 | 45 | // Throws std::runtime_error if not successful. | 45 | // Throws std::runtime_error if not successful. |
1397 | 46 | unsigned int wait_for_signal_ready_for(const std::chrono::milliseconds& duration); | 46 | unsigned int wait_for_signal_ready_for(const std::chrono::milliseconds& duration); |
1398 | 47 | unsigned int wait_for_signal_ready_for(); | 47 | unsigned int wait_for_signal_ready_for(); |
1400 | 48 | 48 | ||
1401 | 49 | void signal_ready(); | 49 | void signal_ready(); |
1402 | 50 | unsigned int wait_for_signal_ready(); | 50 | unsigned int wait_for_signal_ready(); |
1403 | 51 | 51 | ||
1404 | 52 | 52 | ||
1405 | === modified file 'include/test/mir_test_framework/input_testing_server_configuration.h' | |||
1406 | --- include/test/mir_test_framework/input_testing_server_configuration.h 2013-11-21 03:16:21 +0000 | |||
1407 | +++ include/test/mir_test_framework/input_testing_server_configuration.h 2013-11-28 12:22:03 +0000 | |||
1408 | @@ -59,7 +59,7 @@ | |||
1409 | 59 | 59 | ||
1410 | 60 | void exec(); | 60 | void exec(); |
1411 | 61 | void on_exit(); | 61 | void on_exit(); |
1413 | 62 | 62 | ||
1414 | 63 | std::shared_ptr<mir::input::InputConfiguration> the_input_configuration() override; | 63 | std::shared_ptr<mir::input::InputConfiguration> the_input_configuration() override; |
1415 | 64 | 64 | ||
1416 | 65 | mir::input::android::FakeEventHub* fake_event_hub; | 65 | mir::input::android::FakeEventHub* fake_event_hub; |
1417 | @@ -71,7 +71,7 @@ | |||
1418 | 71 | 71 | ||
1419 | 72 | private: | 72 | private: |
1420 | 73 | std::thread input_injection_thread; | 73 | std::thread input_injection_thread; |
1422 | 74 | 74 | ||
1423 | 75 | std::shared_ptr<mir::test::doubles::FakeEventHubInputConfiguration> input_configuration; | 75 | std::shared_ptr<mir::test::doubles::FakeEventHubInputConfiguration> input_configuration; |
1424 | 76 | }; | 76 | }; |
1425 | 77 | 77 | ||
1426 | 78 | 78 | ||
1427 | === modified file 'include/test/mir_test_framework/testing_client_configuration.h' | |||
1428 | --- include/test/mir_test_framework/testing_client_configuration.h 2013-09-25 18:25:11 +0000 | |||
1429 | +++ include/test/mir_test_framework/testing_client_configuration.h 2013-11-28 12:22:03 +0000 | |||
1430 | @@ -36,7 +36,7 @@ | |||
1431 | 36 | virtual bool use_real_graphics(mir::options::Option const& options) | 36 | virtual bool use_real_graphics(mir::options::Option const& options) |
1432 | 37 | { | 37 | { |
1433 | 38 | return options.get("tests-use-real-graphics", false); | 38 | return options.get("tests-use-real-graphics", false); |
1435 | 39 | } | 39 | } |
1436 | 40 | }; | 40 | }; |
1437 | 41 | 41 | ||
1438 | 42 | } | 42 | } |
1439 | 43 | 43 | ||
1440 | === modified file 'native-compile.sh' | |||
1441 | --- native-compile.sh 2012-11-19 19:21:52 +0000 | |||
1442 | +++ native-compile.sh 2013-11-28 12:22:03 +0000 | |||
1443 | @@ -12,6 +12,6 @@ | |||
1444 | 12 | cmake --build ${BUILD_DIR} | 12 | cmake --build ${BUILD_DIR} |
1445 | 13 | 13 | ||
1446 | 14 | GTEST_OUTPUT=xml:./ | 14 | GTEST_OUTPUT=xml:./ |
1450 | 15 | ${BUILD_DIR}/bin/acceptance-tests | 15 | ${BUILD_DIR}/bin/mir_acceptance_tests |
1451 | 16 | ${BUILD_DIR}/bin/integration-tests | 16 | ${BUILD_DIR}/bin/mir_integration_tests |
1452 | 17 | ${BUILD_DIR}/bin/unit-tests | 17 | ${BUILD_DIR}/bin/mir_unit_tests |
1453 | 18 | 18 | ||
1454 | === modified file 'src/client/aging_buffer.h' | |||
1455 | --- src/client/aging_buffer.h 2013-06-14 09:00:20 +0000 | |||
1456 | +++ src/client/aging_buffer.h 2013-11-28 12:22:03 +0000 | |||
1457 | @@ -30,7 +30,6 @@ | |||
1458 | 30 | { | 30 | { |
1459 | 31 | public: | 31 | public: |
1460 | 32 | AgingBuffer(); | 32 | AgingBuffer(); |
1461 | 33 | ~AgingBuffer() noexcept {} | ||
1462 | 34 | 33 | ||
1463 | 35 | virtual uint32_t age() const; | 34 | virtual uint32_t age() const; |
1464 | 36 | virtual void increment_age(); | 35 | virtual void increment_age(); |
1465 | 37 | 36 | ||
1466 | === modified file 'src/client/android/android_client_platform.cpp' | |||
1467 | --- src/client/android/android_client_platform.cpp 2013-10-15 08:53:10 +0000 | |||
1468 | +++ src/client/android/android_client_platform.cpp 2013-11-28 12:22:03 +0000 | |||
1469 | @@ -105,9 +105,9 @@ | |||
1470 | 105 | 105 | ||
1471 | 106 | MirPlatformType mcla::AndroidClientPlatform::platform_type() const | 106 | MirPlatformType mcla::AndroidClientPlatform::platform_type() const |
1472 | 107 | { | 107 | { |
1474 | 108 | return mir_platform_type_android; | 108 | return mir_platform_type_android; |
1475 | 109 | } | 109 | } |
1477 | 110 | 110 | ||
1478 | 111 | MirNativeBuffer* mcla::AndroidClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const | 111 | MirNativeBuffer* mcla::AndroidClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const |
1479 | 112 | { | 112 | { |
1480 | 113 | return buf->anwb(); | 113 | return buf->anwb(); |
1481 | 114 | 114 | ||
1482 | === modified file 'src/client/android/android_client_platform.h' | |||
1483 | --- src/client/android/android_client_platform.h 2013-10-15 08:53:10 +0000 | |||
1484 | +++ src/client/android/android_client_platform.h 2013-11-28 12:22:03 +0000 | |||
1485 | @@ -32,7 +32,7 @@ | |||
1486 | 32 | class AndroidClientPlatform : public ClientPlatform | 32 | class AndroidClientPlatform : public ClientPlatform |
1487 | 33 | { | 33 | { |
1488 | 34 | public: | 34 | public: |
1490 | 35 | MirPlatformType platform_type() const; | 35 | MirPlatformType platform_type() const; |
1491 | 36 | std::shared_ptr<ClientBufferFactory> create_buffer_factory(); | 36 | std::shared_ptr<ClientBufferFactory> create_buffer_factory(); |
1492 | 37 | std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface); | 37 | std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface); |
1493 | 38 | std::shared_ptr<EGLNativeDisplayType> create_egl_native_display(); | 38 | std::shared_ptr<EGLNativeDisplayType> create_egl_native_display(); |
1494 | 39 | 39 | ||
1495 | === modified file 'src/client/android/android_registrar.cpp' | |||
1496 | --- src/client/android/android_registrar.cpp 2013-08-28 03:41:48 +0000 | |||
1497 | +++ src/client/android/android_registrar.cpp 2013-11-28 12:22:03 +0000 | |||
1498 | @@ -75,7 +75,7 @@ | |||
1499 | 75 | std::shared_ptr<MirBufferPackage> const& package) const | 75 | std::shared_ptr<MirBufferPackage> const& package) const |
1500 | 76 | { | 76 | { |
1501 | 77 | int native_handle_header_size = sizeof(native_handle_t); | 77 | int native_handle_header_size = sizeof(native_handle_t); |
1503 | 78 | int total_size = sizeof(int) * | 78 | int total_size = sizeof(int) * |
1504 | 79 | (package->fd_items + package->data_items + native_handle_header_size); | 79 | (package->fd_items + package->data_items + native_handle_header_size); |
1505 | 80 | native_handle_t* handle = static_cast<native_handle_t*>(::operator new(total_size)); | 80 | native_handle_t* handle = static_cast<native_handle_t*>(::operator new(total_size)); |
1506 | 81 | handle->version = native_handle_header_size; | 81 | handle->version = native_handle_header_size; |
1507 | 82 | 82 | ||
1508 | === modified file 'src/client/android/client_surface_interpreter.cpp' | |||
1509 | --- src/client/android/client_surface_interpreter.cpp 2013-11-21 03:16:21 +0000 | |||
1510 | +++ src/client/android/client_surface_interpreter.cpp 2013-11-28 12:22:03 +0000 | |||
1511 | @@ -29,7 +29,7 @@ | |||
1512 | 29 | : surface(surface), | 29 | : surface(surface), |
1513 | 30 | driver_pixel_format(-1), | 30 | driver_pixel_format(-1), |
1514 | 31 | sync_ops(std::make_shared<mga::RealSyncFileOps>()) | 31 | sync_ops(std::make_shared<mga::RealSyncFileOps>()) |
1516 | 32 | 32 | ||
1517 | 33 | { | 33 | { |
1518 | 34 | } | 34 | } |
1519 | 35 | 35 | ||
1520 | 36 | 36 | ||
1521 | === modified file 'src/client/android/client_surface_interpreter.h' | |||
1522 | --- src/client/android/client_surface_interpreter.h 2013-10-15 08:53:10 +0000 | |||
1523 | +++ src/client/android/client_surface_interpreter.h 2013-11-28 12:22:03 +0000 | |||
1524 | @@ -30,7 +30,7 @@ | |||
1525 | 30 | { | 30 | { |
1526 | 31 | class SyncFileOps; | 31 | class SyncFileOps; |
1527 | 32 | } | 32 | } |
1529 | 33 | } | 33 | } |
1530 | 34 | namespace client | 34 | namespace client |
1531 | 35 | { | 35 | { |
1532 | 36 | namespace android | 36 | namespace android |
1533 | 37 | 37 | ||
1534 | === modified file 'src/client/client_buffer.h' | |||
1535 | --- src/client/client_buffer.h 2013-10-15 08:53:10 +0000 | |||
1536 | +++ src/client/client_buffer.h 2013-11-28 12:22:03 +0000 | |||
1537 | @@ -54,6 +54,7 @@ | |||
1538 | 54 | { | 54 | { |
1539 | 55 | public: | 55 | public: |
1540 | 56 | virtual ~ClientBuffer() = default; | 56 | virtual ~ClientBuffer() = default; |
1541 | 57 | |||
1542 | 57 | virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0; | 58 | virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0; |
1543 | 58 | virtual geometry::Size size() const = 0; | 59 | virtual geometry::Size size() const = 0; |
1544 | 59 | virtual geometry::Stride stride() const = 0; | 60 | virtual geometry::Stride stride() const = 0; |
1545 | @@ -62,6 +63,11 @@ | |||
1546 | 62 | virtual void increment_age() = 0; | 63 | virtual void increment_age() = 0; |
1547 | 63 | virtual void mark_as_submitted() = 0; | 64 | virtual void mark_as_submitted() = 0; |
1548 | 64 | virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const = 0; | 65 | virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const = 0; |
1549 | 66 | |||
1550 | 67 | protected: | ||
1551 | 68 | ClientBuffer() = default; | ||
1552 | 69 | ClientBuffer(ClientBuffer const&) = delete; | ||
1553 | 70 | ClientBuffer& operator=(ClientBuffer const&) = delete; | ||
1554 | 65 | }; | 71 | }; |
1555 | 66 | 72 | ||
1556 | 67 | } | 73 | } |
1557 | 68 | 74 | ||
1558 | === modified file 'src/client/client_platform.h' | |||
1559 | --- src/client/client_platform.h 2013-10-15 08:53:10 +0000 | |||
1560 | +++ src/client/client_platform.h 2013-11-28 12:22:03 +0000 | |||
1561 | @@ -46,7 +46,7 @@ | |||
1562 | 46 | 46 | ||
1563 | 47 | virtual ~ClientPlatform() { /* TODO: make nothrow */ } | 47 | virtual ~ClientPlatform() { /* TODO: make nothrow */ } |
1564 | 48 | 48 | ||
1566 | 49 | virtual MirPlatformType platform_type() const = 0; | 49 | virtual MirPlatformType platform_type() const = 0; |
1567 | 50 | virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0; | 50 | virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0; |
1568 | 51 | virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0; | 51 | virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0; |
1569 | 52 | virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0; | 52 | virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0; |
1570 | 53 | 53 | ||
1571 | === modified file 'src/client/default_connection_configuration.cpp' | |||
1572 | --- src/client/default_connection_configuration.cpp 2013-11-21 03:16:21 +0000 | |||
1573 | +++ src/client/default_connection_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
1574 | @@ -128,7 +128,7 @@ | |||
1575 | 128 | { | 128 | { |
1576 | 129 | auto val_raw = getenv("MIR_CLIENT_INPUT_RECEIVER_REPORT"); | 129 | auto val_raw = getenv("MIR_CLIENT_INPUT_RECEIVER_REPORT"); |
1577 | 130 | std::string const val{val_raw ? val_raw : off_opt_val}; | 130 | std::string const val{val_raw ? val_raw : off_opt_val}; |
1579 | 131 | 131 | ||
1580 | 132 | if (val == log_opt_val) | 132 | if (val == log_opt_val) |
1581 | 133 | return std::make_shared<mcl::logging::InputReceiverReport>(the_logger()); | 133 | return std::make_shared<mcl::logging::InputReceiverReport>(the_logger()); |
1582 | 134 | else | 134 | else |
1583 | 135 | 135 | ||
1584 | === modified file 'src/client/display_configuration.cpp' | |||
1585 | --- src/client/display_configuration.cpp 2013-10-15 08:53:10 +0000 | |||
1586 | +++ src/client/display_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
1587 | @@ -48,8 +48,8 @@ | |||
1588 | 48 | { | 48 | { |
1589 | 49 | num_modes = num_modes_; | 49 | num_modes = num_modes_; |
1590 | 50 | modes = new MirDisplayMode[num_modes]; | 50 | modes = new MirDisplayMode[num_modes]; |
1593 | 51 | 51 | ||
1594 | 52 | num_output_formats = num_formats; | 52 | num_output_formats = num_formats; |
1595 | 53 | output_formats = new MirPixelFormat[num_formats]; | 53 | output_formats = new MirPixelFormat[num_formats]; |
1596 | 54 | } | 54 | } |
1597 | 55 | 55 | ||
1598 | @@ -77,8 +77,8 @@ | |||
1599 | 77 | for (auto i = 0u; i < output.num_modes; i++) | 77 | for (auto i = 0u; i < output.num_modes; i++) |
1600 | 78 | { | 78 | { |
1601 | 79 | auto mode = msg.mode(i); | 79 | auto mode = msg.mode(i); |
1604 | 80 | output.modes[i].horizontal_resolution = mode.horizontal_resolution(); | 80 | output.modes[i].horizontal_resolution = mode.horizontal_resolution(); |
1605 | 81 | output.modes[i].vertical_resolution = mode.vertical_resolution(); | 81 | output.modes[i].vertical_resolution = mode.vertical_resolution(); |
1606 | 82 | output.modes[i].refresh_rate = mode.refresh_rate(); | 82 | output.modes[i].refresh_rate = mode.refresh_rate(); |
1607 | 83 | } | 83 | } |
1608 | 84 | output.preferred_mode = msg.preferred_mode(); | 84 | output.preferred_mode = msg.preferred_mode(); |
1609 | @@ -161,7 +161,7 @@ | |||
1610 | 161 | { | 161 | { |
1611 | 162 | auto new_info = &new_config->outputs[i]; | 162 | auto new_info = &new_config->outputs[i]; |
1612 | 163 | MirDisplayOutput* output = outputs[i].get(); | 163 | MirDisplayOutput* output = outputs[i].get(); |
1614 | 164 | std::memcpy(new_info, output, sizeof(MirDisplayOutput)); | 164 | std::memcpy(new_info, output, sizeof(MirDisplayOutput)); |
1615 | 165 | 165 | ||
1616 | 166 | new_info->output_formats = new MirPixelFormat[new_info->num_output_formats]; | 166 | new_info->output_formats = new MirPixelFormat[new_info->num_output_formats]; |
1617 | 167 | auto format_size = sizeof(MirPixelFormat) * new_info->num_output_formats; | 167 | auto format_size = sizeof(MirPixelFormat) * new_info->num_output_formats; |
1618 | 168 | 168 | ||
1619 | === renamed file 'src/client/gbm/drm_fd_handler.h' => 'src/client/gbm/buffer_file_ops.h' | |||
1620 | --- src/client/gbm/drm_fd_handler.h 2013-04-24 05:22:20 +0000 | |||
1621 | +++ src/client/gbm/buffer_file_ops.h 2013-11-28 12:22:03 +0000 | |||
1622 | @@ -16,8 +16,8 @@ | |||
1623 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
1624 | 17 | */ | 17 | */ |
1625 | 18 | 18 | ||
1628 | 19 | #ifndef MIR_CLIENT_GBM_DRM_FD_HANDLER_ | 19 | #ifndef MIR_CLIENT_GBM_BUFFER_FILE_OPS_ |
1629 | 20 | #define MIR_CLIENT_GBM_DRM_FD_HANDLER_ | 20 | #define MIR_CLIENT_GBM_BUFFER_FILE_OPS_ |
1630 | 21 | 21 | ||
1631 | 22 | #include <sys/types.h> | 22 | #include <sys/types.h> |
1632 | 23 | 23 | ||
1633 | @@ -28,25 +28,23 @@ | |||
1634 | 28 | namespace gbm | 28 | namespace gbm |
1635 | 29 | { | 29 | { |
1636 | 30 | 30 | ||
1638 | 31 | class DRMFDHandler | 31 | class BufferFileOps |
1639 | 32 | { | 32 | { |
1640 | 33 | public: | 33 | public: |
1642 | 34 | virtual ~DRMFDHandler() {} | 34 | virtual ~BufferFileOps() = default; |
1643 | 35 | 35 | ||
1649 | 36 | virtual int ioctl(unsigned long request, void* arg) = 0; | 36 | virtual int close(int fd) const = 0; |
1650 | 37 | virtual int primeFDToHandle(int prime_fd, uint32_t *handle) = 0; | 37 | virtual void* map(int fd, off_t offset, size_t size) const = 0; |
1651 | 38 | virtual int close(int fd) = 0; | 38 | virtual void unmap(void* addr, size_t size) const = 0; |
1647 | 39 | virtual void* map(size_t size, off_t offset) = 0; | ||
1648 | 40 | virtual void unmap(void* addr, size_t size) = 0; | ||
1652 | 41 | 39 | ||
1653 | 42 | protected: | 40 | protected: |
1657 | 43 | DRMFDHandler() = default; | 41 | BufferFileOps() = default; |
1658 | 44 | DRMFDHandler(const DRMFDHandler&) = delete; | 42 | BufferFileOps(BufferFileOps const&) = delete; |
1659 | 45 | DRMFDHandler& operator=(const DRMFDHandler&) = delete; | 43 | BufferFileOps& operator=(BufferFileOps const&) = delete; |
1660 | 46 | }; | 44 | }; |
1661 | 47 | 45 | ||
1662 | 48 | } | 46 | } |
1663 | 49 | } | 47 | } |
1664 | 50 | } | 48 | } |
1665 | 51 | 49 | ||
1667 | 52 | #endif /* MIR_CLIENT_GBM_DRM_FD_HANDLER_ */ | 50 | #endif /* MIR_CLIENT_GBM_BUFFER_FILE_OPS_ */ |
1668 | 53 | 51 | ||
1669 | === modified file 'src/client/gbm/gbm_client_buffer.cpp' | |||
1670 | --- src/client/gbm/gbm_client_buffer.cpp 2013-11-21 03:16:21 +0000 | |||
1671 | +++ src/client/gbm/gbm_client_buffer.cpp 2013-11-28 12:22:03 +0000 | |||
1672 | @@ -18,15 +18,13 @@ | |||
1673 | 18 | 18 | ||
1674 | 19 | #include "mir_toolkit/mir_client_library.h" | 19 | #include "mir_toolkit/mir_client_library.h" |
1675 | 20 | #include "gbm_client_buffer.h" | 20 | #include "gbm_client_buffer.h" |
1677 | 21 | #include "drm_fd_handler.h" | 21 | #include "buffer_file_ops.h" |
1678 | 22 | 22 | ||
1679 | 23 | #include <boost/exception/errinfo_errno.hpp> | 23 | #include <boost/exception/errinfo_errno.hpp> |
1680 | 24 | #include <boost/throw_exception.hpp> | 24 | #include <boost/throw_exception.hpp> |
1681 | 25 | 25 | ||
1682 | 26 | #include <stdexcept> | 26 | #include <stdexcept> |
1683 | 27 | 27 | ||
1684 | 28 | #include <xf86drm.h> | ||
1685 | 29 | #include <string.h> | ||
1686 | 30 | #include <errno.h> | 28 | #include <errno.h> |
1687 | 31 | #include <sys/mman.h> | 29 | #include <sys/mman.h> |
1688 | 32 | 30 | ||
1689 | @@ -37,71 +35,29 @@ | |||
1690 | 37 | namespace | 35 | namespace |
1691 | 38 | { | 36 | { |
1692 | 39 | 37 | ||
1693 | 40 | struct GEMHandle | ||
1694 | 41 | { | ||
1695 | 42 | GEMHandle(std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler, | ||
1696 | 43 | int prime_fd) | ||
1697 | 44 | : drm_fd_handler{drm_fd_handler} | ||
1698 | 45 | { | ||
1699 | 46 | int ret = drm_fd_handler->primeFDToHandle(prime_fd, &handle); | ||
1700 | 47 | if (ret) | ||
1701 | 48 | { | ||
1702 | 49 | std::string msg("Failed to import PRIME fd for DRM buffer"); | ||
1703 | 50 | BOOST_THROW_EXCEPTION( | ||
1704 | 51 | boost::enable_error_info( | ||
1705 | 52 | std::runtime_error(msg)) << boost::errinfo_errno(errno)); | ||
1706 | 53 | } | ||
1707 | 54 | } | ||
1708 | 55 | |||
1709 | 56 | ~GEMHandle() | ||
1710 | 57 | { | ||
1711 | 58 | struct drm_gem_close arg; | ||
1712 | 59 | arg.handle = handle; | ||
1713 | 60 | // TODO (@raof): Error reporting? I do not believe it should be possible for this to fail, | ||
1714 | 61 | // so if it does we should probably flag it. | ||
1715 | 62 | drm_fd_handler->ioctl(DRM_IOCTL_GEM_CLOSE, &arg); | ||
1716 | 63 | } | ||
1717 | 64 | |||
1718 | 65 | std::shared_ptr<mclg::DRMFDHandler> const drm_fd_handler; | ||
1719 | 66 | uint32_t handle; | ||
1720 | 67 | }; | ||
1721 | 68 | |||
1722 | 69 | struct NullDeleter | 38 | struct NullDeleter |
1723 | 70 | { | 39 | { |
1724 | 71 | void operator()(char *) const {} | 40 | void operator()(char *) const {} |
1725 | 72 | }; | 41 | }; |
1726 | 73 | 42 | ||
1728 | 74 | struct GBMMemoryRegion : mcl::MemoryRegion | 43 | struct ShmMemoryRegion : mcl::MemoryRegion |
1729 | 75 | { | 44 | { |
1732 | 76 | GBMMemoryRegion(std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler, | 45 | ShmMemoryRegion(std::shared_ptr<mclg::BufferFileOps> const& buffer_file_ops, |
1733 | 77 | int prime_fd, geom::Size const& size_param, | 46 | int buffer_fd, geom::Size const& size_param, |
1734 | 78 | geom::Stride stride_param, geom::PixelFormat format_param) | 47 | geom::Stride stride_param, geom::PixelFormat format_param) |
1737 | 79 | : drm_fd_handler{drm_fd_handler}, | 48 | : buffer_file_ops{buffer_file_ops}, |
1736 | 80 | gem_handle{drm_fd_handler, prime_fd}, | ||
1738 | 81 | size_in_bytes{size_param.height.as_uint32_t() * stride_param.as_uint32_t()} | 49 | size_in_bytes{size_param.height.as_uint32_t() * stride_param.as_uint32_t()} |
1739 | 82 | { | 50 | { |
1740 | 51 | static off_t const map_offset = 0; | ||
1741 | 83 | width = size_param.width; | 52 | width = size_param.width; |
1742 | 84 | height = size_param.height; | 53 | height = size_param.height; |
1743 | 85 | stride = stride_param; | 54 | stride = stride_param; |
1744 | 86 | format = format_param; | 55 | format = format_param; |
1745 | 87 | 56 | ||
1760 | 88 | struct drm_mode_map_dumb map_dumb; | 57 | void* map = buffer_file_ops->map(buffer_fd, map_offset, size_in_bytes); |
1747 | 89 | memset(&map_dumb, 0, sizeof(map_dumb)); | ||
1748 | 90 | map_dumb.handle = gem_handle.handle; | ||
1749 | 91 | |||
1750 | 92 | int ret = drm_fd_handler->ioctl(DRM_IOCTL_MODE_MAP_DUMB, &map_dumb); | ||
1751 | 93 | if (ret) | ||
1752 | 94 | { | ||
1753 | 95 | std::string msg("Failed to map dumb DRM buffer"); | ||
1754 | 96 | BOOST_THROW_EXCEPTION( | ||
1755 | 97 | boost::enable_error_info( | ||
1756 | 98 | std::runtime_error(msg)) << boost::errinfo_errno(errno)); | ||
1757 | 99 | } | ||
1758 | 100 | |||
1759 | 101 | void* map = drm_fd_handler->map(size_in_bytes, map_dumb.offset); | ||
1761 | 102 | if (map == MAP_FAILED) | 58 | if (map == MAP_FAILED) |
1762 | 103 | { | 59 | { |
1764 | 104 | std::string msg("Failed to mmap DRM buffer"); | 60 | std::string msg("Failed to mmap buffer"); |
1765 | 105 | BOOST_THROW_EXCEPTION( | 61 | BOOST_THROW_EXCEPTION( |
1766 | 106 | boost::enable_error_info( | 62 | boost::enable_error_info( |
1767 | 107 | std::runtime_error(msg)) << boost::errinfo_errno(errno)); | 63 | std::runtime_error(msg)) << boost::errinfo_errno(errno)); |
1768 | @@ -110,24 +66,23 @@ | |||
1769 | 110 | vaddr = std::shared_ptr<char>(static_cast<char*>(map), NullDeleter()); | 66 | vaddr = std::shared_ptr<char>(static_cast<char*>(map), NullDeleter()); |
1770 | 111 | } | 67 | } |
1771 | 112 | 68 | ||
1773 | 113 | ~GBMMemoryRegion() | 69 | ~ShmMemoryRegion() |
1774 | 114 | { | 70 | { |
1776 | 115 | drm_fd_handler->unmap(vaddr.get(), size_in_bytes); | 71 | buffer_file_ops->unmap(vaddr.get(), size_in_bytes); |
1777 | 116 | } | 72 | } |
1778 | 117 | 73 | ||
1781 | 118 | std::shared_ptr<mclg::DRMFDHandler> const drm_fd_handler; | 74 | std::shared_ptr<mclg::BufferFileOps> const buffer_file_ops; |
1780 | 119 | GEMHandle const gem_handle; | ||
1782 | 120 | size_t const size_in_bytes; | 75 | size_t const size_in_bytes; |
1783 | 121 | }; | 76 | }; |
1784 | 122 | 77 | ||
1785 | 123 | } | 78 | } |
1786 | 124 | 79 | ||
1787 | 125 | mclg::GBMClientBuffer::GBMClientBuffer( | 80 | mclg::GBMClientBuffer::GBMClientBuffer( |
1793 | 126 | std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler, | 81 | std::shared_ptr<mclg::BufferFileOps> const& buffer_file_ops, |
1794 | 127 | std::shared_ptr<MirBufferPackage> const& package, | 82 | std::shared_ptr<MirBufferPackage> const& package, |
1795 | 128 | geom::Size size, geom::PixelFormat pf) | 83 | geom::Size size, geom::PixelFormat pf) |
1796 | 129 | : drm_fd_handler{drm_fd_handler}, | 84 | : buffer_file_ops{buffer_file_ops}, |
1797 | 130 | creation_package(std::move(package)), | 85 | creation_package{package}, |
1798 | 131 | rect({geom::Point{0, 0}, size}), | 86 | rect({geom::Point{0, 0}, size}), |
1799 | 132 | buffer_pf{pf} | 87 | buffer_pf{pf} |
1800 | 133 | { | 88 | { |
1801 | @@ -137,15 +92,15 @@ | |||
1802 | 137 | { | 92 | { |
1803 | 138 | // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does, | 93 | // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does, |
1804 | 139 | // something's seriously wrong. | 94 | // something's seriously wrong. |
1806 | 140 | drm_fd_handler->close(creation_package->fd[0]); | 95 | buffer_file_ops->close(creation_package->fd[0]); |
1807 | 141 | } | 96 | } |
1808 | 142 | 97 | ||
1809 | 143 | std::shared_ptr<mcl::MemoryRegion> mclg::GBMClientBuffer::secure_for_cpu_write() | 98 | std::shared_ptr<mcl::MemoryRegion> mclg::GBMClientBuffer::secure_for_cpu_write() |
1810 | 144 | { | 99 | { |
1812 | 145 | const int prime_fd = creation_package->fd[0]; | 100 | int const buffer_fd = creation_package->fd[0]; |
1813 | 146 | 101 | ||
1816 | 147 | return std::make_shared<GBMMemoryRegion>(drm_fd_handler, | 102 | return std::make_shared<ShmMemoryRegion>(buffer_file_ops, |
1817 | 148 | prime_fd, | 103 | buffer_fd, |
1818 | 149 | size(), | 104 | size(), |
1819 | 150 | stride(), | 105 | stride(), |
1820 | 151 | pixel_format()); | 106 | pixel_format()); |
1821 | 152 | 107 | ||
1822 | === modified file 'src/client/gbm/gbm_client_buffer.h' | |||
1823 | --- src/client/gbm/gbm_client_buffer.h 2013-11-21 03:16:21 +0000 | |||
1824 | +++ src/client/gbm/gbm_client_buffer.h 2013-11-28 12:22:03 +0000 | |||
1825 | @@ -33,17 +33,17 @@ | |||
1826 | 33 | namespace gbm | 33 | namespace gbm |
1827 | 34 | { | 34 | { |
1828 | 35 | 35 | ||
1830 | 36 | class DRMFDHandler; | 36 | class BufferFileOps; |
1831 | 37 | 37 | ||
1832 | 38 | class GBMClientBuffer : public AgingBuffer | 38 | class GBMClientBuffer : public AgingBuffer |
1833 | 39 | { | 39 | { |
1834 | 40 | public: | 40 | public: |
1836 | 41 | GBMClientBuffer(std::shared_ptr<DRMFDHandler> const& drm_fd_handler, | 41 | GBMClientBuffer(std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
1837 | 42 | std::shared_ptr<MirBufferPackage> const& buffer_package, | 42 | std::shared_ptr<MirBufferPackage> const& buffer_package, |
1838 | 43 | geometry::Size size, | 43 | geometry::Size size, |
1839 | 44 | geometry::PixelFormat pf); | 44 | geometry::PixelFormat pf); |
1840 | 45 | 45 | ||
1842 | 46 | virtual ~GBMClientBuffer() noexcept; | 46 | ~GBMClientBuffer() noexcept; |
1843 | 47 | 47 | ||
1844 | 48 | std::shared_ptr<MemoryRegion> secure_for_cpu_write(); | 48 | std::shared_ptr<MemoryRegion> secure_for_cpu_write(); |
1845 | 49 | geometry::Size size() const; | 49 | geometry::Size size() const; |
1846 | @@ -51,13 +51,11 @@ | |||
1847 | 51 | geometry::PixelFormat pixel_format() const; | 51 | geometry::PixelFormat pixel_format() const; |
1848 | 52 | std::shared_ptr<MirNativeBuffer> native_buffer_handle() const; | 52 | std::shared_ptr<MirNativeBuffer> native_buffer_handle() const; |
1849 | 53 | 53 | ||
1850 | 54 | GBMClientBuffer(const GBMClientBuffer&) = delete; | ||
1851 | 55 | GBMClientBuffer& operator=(const GBMClientBuffer&) = delete; | ||
1852 | 56 | private: | 54 | private: |
1857 | 57 | const std::shared_ptr<DRMFDHandler> drm_fd_handler; | 55 | std::shared_ptr<BufferFileOps> const buffer_file_ops; |
1858 | 58 | const std::shared_ptr<MirBufferPackage> creation_package; | 56 | std::shared_ptr<MirBufferPackage> const creation_package; |
1859 | 59 | const geometry::Rectangle rect; | 57 | geometry::Rectangle const rect; |
1860 | 60 | const geometry::PixelFormat buffer_pf; | 58 | geometry::PixelFormat const buffer_pf; |
1861 | 61 | }; | 59 | }; |
1862 | 62 | 60 | ||
1863 | 63 | } | 61 | } |
1864 | 64 | 62 | ||
1865 | === modified file 'src/client/gbm/gbm_client_buffer_factory.cpp' | |||
1866 | --- src/client/gbm/gbm_client_buffer_factory.cpp 2013-11-21 03:16:21 +0000 | |||
1867 | +++ src/client/gbm/gbm_client_buffer_factory.cpp 2013-11-28 12:22:03 +0000 | |||
1868 | @@ -24,8 +24,8 @@ | |||
1869 | 24 | namespace mclg=mir::client::gbm; | 24 | namespace mclg=mir::client::gbm; |
1870 | 25 | 25 | ||
1871 | 26 | mclg::GBMClientBufferFactory::GBMClientBufferFactory( | 26 | mclg::GBMClientBufferFactory::GBMClientBufferFactory( |
1874 | 27 | std::shared_ptr<DRMFDHandler> const& drm_fd_handler) | 27 | std::shared_ptr<BufferFileOps> const& buffer_file_ops) |
1875 | 28 | : drm_fd_handler{drm_fd_handler} | 28 | : buffer_file_ops{buffer_file_ops} |
1876 | 29 | { | 29 | { |
1877 | 30 | } | 30 | } |
1878 | 31 | 31 | ||
1879 | @@ -33,7 +33,7 @@ | |||
1880 | 33 | { | 33 | { |
1881 | 34 | (void)size; // TODO: remove this unused parameter | 34 | (void)size; // TODO: remove this unused parameter |
1882 | 35 | return std::make_shared<mclg::GBMClientBuffer>( | 35 | return std::make_shared<mclg::GBMClientBuffer>( |
1884 | 36 | drm_fd_handler, | 36 | buffer_file_ops, |
1885 | 37 | package, | 37 | package, |
1886 | 38 | geometry::Size{package->width, package->height}, | 38 | geometry::Size{package->width, package->height}, |
1887 | 39 | pf); | 39 | pf); |
1888 | 40 | 40 | ||
1889 | === modified file 'src/client/gbm/gbm_client_buffer_factory.h' | |||
1890 | --- src/client/gbm/gbm_client_buffer_factory.h 2013-04-24 05:22:20 +0000 | |||
1891 | +++ src/client/gbm/gbm_client_buffer_factory.h 2013-11-28 12:22:03 +0000 | |||
1892 | @@ -32,17 +32,17 @@ | |||
1893 | 32 | namespace gbm | 32 | namespace gbm |
1894 | 33 | { | 33 | { |
1895 | 34 | 34 | ||
1897 | 35 | class DRMFDHandler; | 35 | class BufferFileOps; |
1898 | 36 | 36 | ||
1899 | 37 | class GBMClientBufferFactory : public ClientBufferFactory | 37 | class GBMClientBufferFactory : public ClientBufferFactory |
1900 | 38 | { | 38 | { |
1901 | 39 | public: | 39 | public: |
1903 | 40 | explicit GBMClientBufferFactory(std::shared_ptr<DRMFDHandler> const& drm_fd_handler); | 40 | explicit GBMClientBufferFactory(std::shared_ptr<BufferFileOps> const& buffer_file_ops); |
1904 | 41 | 41 | ||
1905 | 42 | std::shared_ptr<ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package, | 42 | std::shared_ptr<ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package, |
1906 | 43 | geometry::Size size, geometry::PixelFormat pf); | 43 | geometry::Size size, geometry::PixelFormat pf); |
1907 | 44 | private: | 44 | private: |
1909 | 45 | std::shared_ptr<DRMFDHandler> drm_fd_handler; | 45 | std::shared_ptr<BufferFileOps> const buffer_file_ops; |
1910 | 46 | }; | 46 | }; |
1911 | 47 | 47 | ||
1912 | 48 | } | 48 | } |
1913 | 49 | 49 | ||
1914 | === modified file 'src/client/gbm/gbm_client_platform.cpp' | |||
1915 | --- src/client/gbm/gbm_client_platform.cpp 2013-10-15 08:53:10 +0000 | |||
1916 | +++ src/client/gbm/gbm_client_platform.cpp 2013-11-28 12:22:03 +0000 | |||
1917 | @@ -20,7 +20,7 @@ | |||
1918 | 20 | #include "gbm_client_platform.h" | 20 | #include "gbm_client_platform.h" |
1919 | 21 | #include "gbm_client_buffer_factory.h" | 21 | #include "gbm_client_buffer_factory.h" |
1920 | 22 | #include "mesa_native_display_container.h" | 22 | #include "mesa_native_display_container.h" |
1922 | 23 | #include "drm_fd_handler.h" | 23 | #include "buffer_file_ops.h" |
1923 | 24 | #include "gbm_native_surface.h" | 24 | #include "gbm_native_surface.h" |
1924 | 25 | #include "../mir_connection.h" | 25 | #include "../mir_connection.h" |
1925 | 26 | #include "../client_buffer_factory.h" | 26 | #include "../client_buffer_factory.h" |
1926 | @@ -37,24 +37,9 @@ | |||
1927 | 37 | namespace | 37 | namespace |
1928 | 38 | { | 38 | { |
1929 | 39 | 39 | ||
1931 | 40 | class RealDRMFDHandler : public mclg::DRMFDHandler | 40 | struct RealBufferFileOps : public mclg::BufferFileOps |
1932 | 41 | { | 41 | { |
1949 | 42 | public: | 42 | int close(int fd) const |
1934 | 43 | RealDRMFDHandler(int drm_fd) : drm_fd{drm_fd} | ||
1935 | 44 | { | ||
1936 | 45 | } | ||
1937 | 46 | |||
1938 | 47 | int ioctl(unsigned long request, void* arg) | ||
1939 | 48 | { | ||
1940 | 49 | return drmIoctl(drm_fd, request, arg); | ||
1941 | 50 | } | ||
1942 | 51 | |||
1943 | 52 | int primeFDToHandle(int prime_fd, uint32_t *handle) | ||
1944 | 53 | { | ||
1945 | 54 | return drmPrimeFDToHandle(drm_fd, prime_fd, handle); | ||
1946 | 55 | } | ||
1947 | 56 | |||
1948 | 57 | int close(int fd) | ||
1950 | 58 | { | 43 | { |
1951 | 59 | while (::close(fd) == -1) | 44 | while (::close(fd) == -1) |
1952 | 60 | { | 45 | { |
1953 | @@ -65,19 +50,16 @@ | |||
1954 | 65 | return 0; | 50 | return 0; |
1955 | 66 | } | 51 | } |
1956 | 67 | 52 | ||
1958 | 68 | void* map(size_t size, off_t offset) | 53 | void* map(int fd, off_t offset, size_t size) const |
1959 | 69 | { | 54 | { |
1962 | 70 | return mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, | 55 | return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, |
1963 | 71 | drm_fd, offset); | 56 | fd, offset); |
1964 | 72 | } | 57 | } |
1965 | 73 | 58 | ||
1967 | 74 | void unmap(void* addr, size_t size) | 59 | void unmap(void* addr, size_t size) const |
1968 | 75 | { | 60 | { |
1969 | 76 | munmap(addr, size); | 61 | munmap(addr, size); |
1970 | 77 | } | 62 | } |
1971 | 78 | |||
1972 | 79 | private: | ||
1973 | 80 | int drm_fd; | ||
1974 | 81 | }; | 63 | }; |
1975 | 82 | 64 | ||
1976 | 83 | struct NativeDisplayDeleter | 65 | struct NativeDisplayDeleter |
1977 | @@ -101,33 +83,24 @@ | |||
1978 | 101 | std::shared_ptr<mcl::ClientPlatform> | 83 | std::shared_ptr<mcl::ClientPlatform> |
1979 | 102 | mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context) | 84 | mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context) |
1980 | 103 | { | 85 | { |
1993 | 104 | MirPlatformPackage platform_package; | 86 | auto buffer_file_ops = std::make_shared<RealBufferFileOps>(); |
1994 | 105 | 87 | return std::make_shared<mclg::GBMClientPlatform>( | |
1995 | 106 | memset(&platform_package, 0, sizeof(platform_package)); | 88 | context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance()); |
1984 | 107 | context->populate(platform_package); | ||
1985 | 108 | |||
1986 | 109 | int drm_fd = -1; | ||
1987 | 110 | |||
1988 | 111 | if (platform_package.fd_items > 0) | ||
1989 | 112 | drm_fd = platform_package.fd[0]; | ||
1990 | 113 | |||
1991 | 114 | auto drm_fd_handler = std::make_shared<RealDRMFDHandler>(drm_fd); | ||
1992 | 115 | return std::make_shared<mclg::GBMClientPlatform>(context, drm_fd_handler, mcl::EGLNativeDisplayContainer::instance()); | ||
1996 | 116 | } | 89 | } |
1997 | 117 | 90 | ||
1998 | 118 | mclg::GBMClientPlatform::GBMClientPlatform( | 91 | mclg::GBMClientPlatform::GBMClientPlatform( |
1999 | 119 | ClientContext* const context, | 92 | ClientContext* const context, |
2001 | 120 | std::shared_ptr<DRMFDHandler> const& drm_fd_handler, | 93 | std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
2002 | 121 | mcl::EGLNativeDisplayContainer& display_container) | 94 | mcl::EGLNativeDisplayContainer& display_container) |
2003 | 122 | : context{context}, | 95 | : context{context}, |
2005 | 123 | drm_fd_handler{drm_fd_handler}, | 96 | buffer_file_ops{buffer_file_ops}, |
2006 | 124 | display_container(display_container) | 97 | display_container(display_container) |
2007 | 125 | { | 98 | { |
2008 | 126 | } | 99 | } |
2009 | 127 | 100 | ||
2010 | 128 | std::shared_ptr<mcl::ClientBufferFactory> mclg::GBMClientPlatform::create_buffer_factory() | 101 | std::shared_ptr<mcl::ClientBufferFactory> mclg::GBMClientPlatform::create_buffer_factory() |
2011 | 129 | { | 102 | { |
2013 | 130 | return std::make_shared<mclg::GBMClientBufferFactory>(drm_fd_handler); | 103 | return std::make_shared<mclg::GBMClientBufferFactory>(buffer_file_ops); |
2014 | 131 | } | 104 | } |
2015 | 132 | 105 | ||
2016 | 133 | namespace | 106 | namespace |
2017 | @@ -153,7 +126,7 @@ | |||
2018 | 153 | //TODO: this is awkward on both android and gbm... | 126 | //TODO: this is awkward on both android and gbm... |
2019 | 154 | auto gbm_window = new GBMNativeSurface(*client_surface); | 127 | auto gbm_window = new GBMNativeSurface(*client_surface); |
2020 | 155 | auto egl_native_window = new EGLNativeWindowType; | 128 | auto egl_native_window = new EGLNativeWindowType; |
2022 | 156 | *egl_native_window = gbm_window; | 129 | *egl_native_window = gbm_window; |
2023 | 157 | NativeWindowDeleter deleter(gbm_window); | 130 | NativeWindowDeleter deleter(gbm_window); |
2024 | 158 | return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter); | 131 | return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter); |
2025 | 159 | } | 132 | } |
2026 | @@ -169,8 +142,8 @@ | |||
2027 | 169 | 142 | ||
2028 | 170 | MirPlatformType mclg::GBMClientPlatform::platform_type() const | 143 | MirPlatformType mclg::GBMClientPlatform::platform_type() const |
2029 | 171 | { | 144 | { |
2032 | 172 | return mir_platform_type_gbm; | 145 | return mir_platform_type_gbm; |
2033 | 173 | } | 146 | } |
2034 | 174 | 147 | ||
2035 | 175 | MirNativeBuffer* mclg::GBMClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const | 148 | MirNativeBuffer* mclg::GBMClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const |
2036 | 176 | { | 149 | { |
2037 | 177 | 150 | ||
2038 | === modified file 'src/client/gbm/gbm_client_platform.h' | |||
2039 | --- src/client/gbm/gbm_client_platform.h 2013-10-15 08:53:10 +0000 | |||
2040 | +++ src/client/gbm/gbm_client_platform.h 2013-11-28 12:22:03 +0000 | |||
2041 | @@ -30,16 +30,16 @@ | |||
2042 | 30 | namespace gbm | 30 | namespace gbm |
2043 | 31 | { | 31 | { |
2044 | 32 | 32 | ||
2046 | 33 | class DRMFDHandler; | 33 | class BufferFileOps; |
2047 | 34 | 34 | ||
2048 | 35 | class GBMClientPlatform : public ClientPlatform | 35 | class GBMClientPlatform : public ClientPlatform |
2049 | 36 | { | 36 | { |
2050 | 37 | public: | 37 | public: |
2051 | 38 | GBMClientPlatform(ClientContext* const context, | 38 | GBMClientPlatform(ClientContext* const context, |
2053 | 39 | std::shared_ptr<DRMFDHandler> const& drm_fd_handler, | 39 | std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
2054 | 40 | EGLNativeDisplayContainer& display_container); | 40 | EGLNativeDisplayContainer& display_container); |
2055 | 41 | 41 | ||
2057 | 42 | MirPlatformType platform_type() const; | 42 | MirPlatformType platform_type() const; |
2058 | 43 | std::shared_ptr<ClientBufferFactory> create_buffer_factory(); | 43 | std::shared_ptr<ClientBufferFactory> create_buffer_factory(); |
2059 | 44 | std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface); | 44 | std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface); |
2060 | 45 | std::shared_ptr<EGLNativeDisplayType> create_egl_native_display(); | 45 | std::shared_ptr<EGLNativeDisplayType> create_egl_native_display(); |
2061 | @@ -47,7 +47,7 @@ | |||
2062 | 47 | 47 | ||
2063 | 48 | private: | 48 | private: |
2064 | 49 | ClientContext* const context; | 49 | ClientContext* const context; |
2066 | 50 | std::shared_ptr<DRMFDHandler> const drm_fd_handler; | 50 | std::shared_ptr<BufferFileOps> const buffer_file_ops; |
2067 | 51 | EGLNativeDisplayContainer& display_container; | 51 | EGLNativeDisplayContainer& display_container; |
2068 | 52 | }; | 52 | }; |
2069 | 53 | 53 | ||
2070 | 54 | 54 | ||
2071 | === modified file 'src/client/gbm/gbm_native_surface.cpp' | |||
2072 | --- src/client/gbm/gbm_native_surface.cpp 2013-06-28 00:25:30 +0000 | |||
2073 | +++ src/client/gbm/gbm_native_surface.cpp 2013-11-28 12:22:03 +0000 | |||
2074 | @@ -42,7 +42,7 @@ | |||
2075 | 42 | { | 42 | { |
2076 | 43 | auto s = static_cast<mclg::GBMNativeSurface*>(surface); | 43 | auto s = static_cast<mclg::GBMNativeSurface*>(surface); |
2077 | 44 | return s->set_swapinterval(interval); | 44 | return s->set_swapinterval(interval); |
2079 | 45 | } | 45 | } |
2080 | 46 | 46 | ||
2081 | 47 | static void buffer_advanced_callback(MirSurface* /* surface */, | 47 | static void buffer_advanced_callback(MirSurface* /* surface */, |
2082 | 48 | void* /* context */) | 48 | void* /* context */) |
2083 | @@ -53,9 +53,9 @@ | |||
2084 | 53 | mclg::GBMNativeSurface::GBMNativeSurface(ClientSurface& surface) | 53 | mclg::GBMNativeSurface::GBMNativeSurface(ClientSurface& surface) |
2085 | 54 | : surface(surface) | 54 | : surface(surface) |
2086 | 55 | { | 55 | { |
2090 | 56 | surface_advance_buffer = advance_buffer_static; | 56 | surface_advance_buffer = advance_buffer_static; |
2091 | 57 | surface_get_parameters = get_parameters_static; | 57 | surface_get_parameters = get_parameters_static; |
2092 | 58 | surface_set_swapinterval = set_swapinterval_static; | 58 | surface_set_swapinterval = set_swapinterval_static; |
2093 | 59 | } | 59 | } |
2094 | 60 | 60 | ||
2095 | 61 | int mclg::GBMNativeSurface::advance_buffer(MirBufferPackage* buffer_package) | 61 | int mclg::GBMNativeSurface::advance_buffer(MirBufferPackage* buffer_package) |
2096 | @@ -80,6 +80,6 @@ | |||
2097 | 80 | if ((interval < 0) || (interval > 1)) | 80 | if ((interval < 0) || (interval > 1)) |
2098 | 81 | return MIR_MESA_FALSE; | 81 | return MIR_MESA_FALSE; |
2099 | 82 | 82 | ||
2101 | 83 | mir_wait_for(surface.configure(mir_surface_attrib_swapinterval, interval)); | 83 | mir_wait_for(surface.configure(mir_surface_attrib_swapinterval, interval)); |
2102 | 84 | return MIR_MESA_TRUE; | 84 | return MIR_MESA_TRUE; |
2103 | 85 | } | 85 | } |
2104 | 86 | 86 | ||
2105 | === modified file 'src/client/logging/input_receiver_report.cpp' | |||
2106 | --- src/client/logging/input_receiver_report.cpp 2013-11-05 22:31:59 +0000 | |||
2107 | +++ src/client/logging/input_receiver_report.cpp 2013-11-28 12:22:03 +0000 | |||
2108 | @@ -118,7 +118,7 @@ | |||
2109 | 118 | std::stringstream ss; | 118 | std::stringstream ss; |
2110 | 119 | 119 | ||
2111 | 120 | ss << "Received event:" << std::endl; | 120 | ss << "Received event:" << std::endl; |
2113 | 121 | 121 | ||
2114 | 122 | format_event(ss, event); | 122 | format_event(ss, event); |
2115 | 123 | 123 | ||
2116 | 124 | logger->log<ml::Logger::debug>(ss.str(), component); | 124 | logger->log<ml::Logger::debug>(ss.str(), component); |
2117 | 125 | 125 | ||
2118 | === modified file 'src/client/mir_client_library.cpp' | |||
2119 | --- src/client/mir_client_library.cpp 2013-11-21 03:16:21 +0000 | |||
2120 | +++ src/client/mir_client_library.cpp 2013-11-28 12:22:03 +0000 | |||
2121 | @@ -176,9 +176,9 @@ | |||
2122 | 176 | return conn; | 176 | return conn; |
2123 | 177 | } | 177 | } |
2124 | 178 | 178 | ||
2126 | 179 | int mir_connection_is_valid(MirConnection * connection) | 179 | MirBool mir_connection_is_valid(MirConnection * connection) |
2127 | 180 | { | 180 | { |
2129 | 181 | return MirConnection::is_valid(connection); | 181 | return MirConnection::is_valid(connection) ? mir_true : mir_false; |
2130 | 182 | } | 182 | } |
2131 | 183 | 183 | ||
2132 | 184 | char const * mir_connection_get_error_message(MirConnection * connection) | 184 | char const * mir_connection_get_error_message(MirConnection * connection) |
2133 | @@ -266,12 +266,12 @@ | |||
2134 | 266 | 266 | ||
2135 | 267 | int mir_debug_surface_id(MirSurface * surface) | 267 | int mir_debug_surface_id(MirSurface * surface) |
2136 | 268 | { | 268 | { |
2138 | 269 | return surface->id(); | 269 | return surface->id(); |
2139 | 270 | } | 270 | } |
2140 | 271 | 271 | ||
2142 | 272 | int mir_surface_is_valid(MirSurface* surface) | 272 | MirBool mir_surface_is_valid(MirSurface* surface) |
2143 | 273 | { | 273 | { |
2145 | 274 | return surface->is_valid(); | 274 | return surface->is_valid() ? mir_true : mir_false; |
2146 | 275 | } | 275 | } |
2147 | 276 | 276 | ||
2148 | 277 | char const * mir_surface_get_error_message(MirSurface * surface) | 277 | char const * mir_surface_get_error_message(MirSurface * surface) |
2149 | 278 | 278 | ||
2150 | === modified file 'src/client/mir_connection.cpp' | |||
2151 | --- src/client/mir_connection.cpp 2013-11-21 03:16:21 +0000 | |||
2152 | +++ src/client/mir_connection.cpp 2013-11-28 12:22:03 +0000 | |||
2153 | @@ -370,7 +370,7 @@ | |||
2154 | 370 | for (auto i = 0u; i < valid_formats; i++) | 370 | for (auto i = 0u; i < valid_formats; i++) |
2155 | 371 | { | 371 | { |
2156 | 372 | formats[i] = static_cast<MirPixelFormat>(connect_result.surface_pixel_format(i)); | 372 | formats[i] = static_cast<MirPixelFormat>(connect_result.surface_pixel_format(i)); |
2158 | 373 | } | 373 | } |
2159 | 374 | } | 374 | } |
2160 | 375 | } | 375 | } |
2161 | 376 | 376 | ||
2162 | @@ -458,11 +458,11 @@ | |||
2163 | 458 | { | 458 | { |
2164 | 459 | auto output = config->outputs[i]; | 459 | auto output = config->outputs[i]; |
2165 | 460 | auto display_request = request.add_display_output(); | 460 | auto display_request = request.add_display_output(); |
2171 | 461 | display_request->set_output_id(output.output_id); | 461 | display_request->set_output_id(output.output_id); |
2172 | 462 | display_request->set_used(output.used); | 462 | display_request->set_used(output.used); |
2173 | 463 | display_request->set_current_mode(output.current_mode); | 463 | display_request->set_current_mode(output.current_mode); |
2174 | 464 | display_request->set_position_x(output.position_x); | 464 | display_request->set_position_x(output.position_x); |
2175 | 465 | display_request->set_position_y(output.position_y); | 465 | display_request->set_position_y(output.position_y); |
2176 | 466 | display_request->set_power_mode(output.power_mode); | 466 | display_request->set_power_mode(output.power_mode); |
2177 | 467 | } | 467 | } |
2178 | 468 | 468 | ||
2179 | 469 | 469 | ||
2180 | === modified file 'src/client/mir_connection.h' | |||
2181 | --- src/client/mir_connection.h 2013-11-21 03:16:21 +0000 | |||
2182 | +++ src/client/mir_connection.h 2013-11-28 12:22:03 +0000 | |||
2183 | @@ -105,7 +105,7 @@ | |||
2184 | 105 | void register_display_change_callback(mir_display_config_callback callback, void* context); | 105 | void register_display_change_callback(mir_display_config_callback callback, void* context); |
2185 | 106 | 106 | ||
2186 | 107 | void populate(MirPlatformPackage& platform_package); | 107 | void populate(MirPlatformPackage& platform_package); |
2188 | 108 | MirDisplayConfiguration* create_copy_of_display_config(); | 108 | MirDisplayConfiguration* create_copy_of_display_config(); |
2189 | 109 | void available_surface_formats(MirPixelFormat* formats, | 109 | void available_surface_formats(MirPixelFormat* formats, |
2190 | 110 | unsigned int formats_size, unsigned int& valid_formats); | 110 | unsigned int formats_size, unsigned int& valid_formats); |
2191 | 111 | 111 | ||
2192 | 112 | 112 | ||
2193 | === modified file 'src/client/mir_surface.cpp' | |||
2194 | --- src/client/mir_surface.cpp 2013-11-21 03:16:21 +0000 | |||
2195 | +++ src/client/mir_surface.cpp 2013-11-28 12:22:03 +0000 | |||
2196 | @@ -52,7 +52,7 @@ | |||
2197 | 52 | message.set_pixel_format(params.pixel_format); | 52 | message.set_pixel_format(params.pixel_format); |
2198 | 53 | message.set_buffer_usage(params.buffer_usage); | 53 | message.set_buffer_usage(params.buffer_usage); |
2199 | 54 | message.set_output_id(params.output_id); | 54 | message.set_output_id(params.output_id); |
2201 | 55 | 55 | ||
2202 | 56 | server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context)); | 56 | server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context)); |
2203 | 57 | 57 | ||
2204 | 58 | for (int i = 0; i < mir_surface_attribs; i++) | 58 | for (int i = 0; i < mir_surface_attribs; i++) |
2205 | @@ -254,7 +254,7 @@ | |||
2206 | 254 | { | 254 | { |
2207 | 255 | std::lock_guard<std::recursive_mutex> lock(mutex); | 255 | std::lock_guard<std::recursive_mutex> lock(mutex); |
2208 | 256 | 256 | ||
2210 | 257 | return buffer_depository->current_buffer_id(); | 257 | return buffer_depository->current_buffer_id(); |
2211 | 258 | } | 258 | } |
2212 | 259 | 259 | ||
2213 | 260 | void MirSurface::populate(MirBufferPackage& buffer_package) | 260 | void MirSurface::populate(MirBufferPackage& buffer_package) |
2214 | 261 | 261 | ||
2215 | === modified file 'src/client/rpc/mir_socket_rpc_channel.cpp' | |||
2216 | --- src/client/rpc/mir_socket_rpc_channel.cpp 2013-11-21 03:16:21 +0000 | |||
2217 | +++ src/client/rpc/mir_socket_rpc_channel.cpp 2013-11-28 12:22:03 +0000 | |||
2218 | @@ -415,7 +415,7 @@ | |||
2219 | 415 | { | 415 | { |
2220 | 416 | rpc_report->event_parsing_failed(event); | 416 | rpc_report->event_parsing_failed(event); |
2221 | 417 | } | 417 | } |
2223 | 418 | } | 418 | } |
2224 | 419 | } | 419 | } |
2225 | 420 | } | 420 | } |
2226 | 421 | 421 | ||
2227 | 422 | 422 | ||
2228 | === modified file 'src/client/surface_map.cpp' | |||
2229 | --- src/client/surface_map.cpp 2013-11-20 17:13:18 +0000 | |||
2230 | +++ src/client/surface_map.cpp 2013-11-28 12:22:03 +0000 | |||
2231 | @@ -42,7 +42,7 @@ | |||
2232 | 42 | ss << __PRETTY_FUNCTION__ | 42 | ss << __PRETTY_FUNCTION__ |
2233 | 43 | << "executed with non-existent surface ID " | 43 | << "executed with non-existent surface ID " |
2234 | 44 | << surface_id << ".\n"; | 44 | << surface_id << ".\n"; |
2236 | 45 | 45 | ||
2237 | 46 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | 46 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); |
2238 | 47 | } | 47 | } |
2239 | 48 | } | 48 | } |
2240 | @@ -50,11 +50,11 @@ | |||
2241 | 50 | void mcl::ConnectionSurfaceMap::insert(int const& surface_id, MirSurface* surface) | 50 | void mcl::ConnectionSurfaceMap::insert(int const& surface_id, MirSurface* surface) |
2242 | 51 | { | 51 | { |
2243 | 52 | std::unique_lock<std::mutex> lk(guard); | 52 | std::unique_lock<std::mutex> lk(guard); |
2245 | 53 | surfaces[surface_id] = surface; | 53 | surfaces[surface_id] = surface; |
2246 | 54 | } | 54 | } |
2247 | 55 | 55 | ||
2248 | 56 | void mcl::ConnectionSurfaceMap::erase(int surface_id) | 56 | void mcl::ConnectionSurfaceMap::erase(int surface_id) |
2249 | 57 | { | 57 | { |
2250 | 58 | std::unique_lock<std::mutex> lk(guard); | 58 | std::unique_lock<std::mutex> lk(guard); |
2252 | 59 | surfaces.erase(surface_id); | 59 | surfaces.erase(surface_id); |
2253 | 60 | } | 60 | } |
2254 | 61 | 61 | ||
2255 | === modified file 'src/server/asio_main_loop.cpp' | |||
2256 | --- src/server/asio_main_loop.cpp 2013-06-28 15:16:39 +0000 | |||
2257 | +++ src/server/asio_main_loop.cpp 2013-11-28 12:22:03 +0000 | |||
2258 | @@ -101,7 +101,7 @@ | |||
2259 | 101 | std::function<void(int)> handler; | 101 | std::function<void(int)> handler; |
2260 | 102 | }; | 102 | }; |
2261 | 103 | 103 | ||
2263 | 104 | /* | 104 | /* |
2264 | 105 | * We need to define an empty constructor and destructor in the .cpp file, | 105 | * We need to define an empty constructor and destructor in the .cpp file, |
2265 | 106 | * so that we can use unique_ptr to hold SignalHandler. Otherwise, users | 106 | * so that we can use unique_ptr to hold SignalHandler. Otherwise, users |
2266 | 107 | * of AsioMainLoop end up creating default constructors and destructors | 107 | * of AsioMainLoop end up creating default constructors and destructors |
2267 | 108 | 108 | ||
2268 | === modified file 'src/server/compositor/buffer_stream_surfaces.cpp' | |||
2269 | --- src/server/compositor/buffer_stream_surfaces.cpp 2013-11-21 03:16:21 +0000 | |||
2270 | +++ src/server/compositor/buffer_stream_surfaces.cpp 2013-11-28 12:22:03 +0000 | |||
2271 | @@ -49,19 +49,29 @@ | |||
2272 | 49 | return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle); | 49 | return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle); |
2273 | 50 | } | 50 | } |
2274 | 51 | 51 | ||
2278 | 52 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::secure_client_buffer() | 52 | void mc::BufferStreamSurfaces::swap_client_buffers(std::shared_ptr<mg::Buffer>& buffer) |
2279 | 53 | { | 53 | { |
2280 | 54 | return std::make_shared<mc::TemporaryClientBuffer>(buffer_bundle); | 54 | release_client_buffer(buffer); |
2281 | 55 | buffer = buffer_bundle->client_acquire(); | ||
2282 | 56 | } | ||
2283 | 57 | |||
2284 | 58 | void mc::BufferStreamSurfaces::release_client_buffer(std::shared_ptr<mg::Buffer>& buffer) | ||
2285 | 59 | { | ||
2286 | 60 | if (buffer) | ||
2287 | 61 | { | ||
2288 | 62 | buffer_bundle->client_release(buffer); | ||
2289 | 63 | buffer.reset(); | ||
2290 | 64 | } | ||
2291 | 55 | } | 65 | } |
2292 | 56 | 66 | ||
2293 | 57 | geom::PixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format() | 67 | geom::PixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format() |
2294 | 58 | { | 68 | { |
2296 | 59 | return buffer_bundle->properties().format; | 69 | return buffer_bundle->properties().format; |
2297 | 60 | } | 70 | } |
2298 | 61 | 71 | ||
2299 | 62 | geom::Size mc::BufferStreamSurfaces::stream_size() | 72 | geom::Size mc::BufferStreamSurfaces::stream_size() |
2300 | 63 | { | 73 | { |
2302 | 64 | return buffer_bundle->properties().size; | 74 | return buffer_bundle->properties().size; |
2303 | 65 | } | 75 | } |
2304 | 66 | 76 | ||
2305 | 67 | void mc::BufferStreamSurfaces::resize(geom::Size const& size) | 77 | void mc::BufferStreamSurfaces::resize(geom::Size const& size) |
2306 | 68 | 78 | ||
2307 | === modified file 'src/server/compositor/buffer_stream_surfaces.h' | |||
2308 | --- src/server/compositor/buffer_stream_surfaces.h 2013-11-21 12:34:49 +0000 | |||
2309 | +++ src/server/compositor/buffer_stream_surfaces.h 2013-11-28 12:22:03 +0000 | |||
2310 | @@ -39,17 +39,18 @@ | |||
2311 | 39 | BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper); | 39 | BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper); |
2312 | 40 | ~BufferStreamSurfaces(); | 40 | ~BufferStreamSurfaces(); |
2313 | 41 | 41 | ||
2315 | 42 | std::shared_ptr<graphics::Buffer> secure_client_buffer(); | 42 | void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) override; |
2316 | 43 | void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) override; | ||
2317 | 43 | 44 | ||
2318 | 44 | std::shared_ptr<graphics::Buffer> | 45 | std::shared_ptr<graphics::Buffer> |
2319 | 45 | lock_compositor_buffer(unsigned long frameno) override; | 46 | lock_compositor_buffer(unsigned long frameno) override; |
2320 | 46 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override; | 47 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override; |
2321 | 47 | 48 | ||
2324 | 48 | geometry::PixelFormat get_stream_pixel_format(); | 49 | geometry::PixelFormat get_stream_pixel_format() override; |
2325 | 49 | geometry::Size stream_size(); | 50 | geometry::Size stream_size() override; |
2326 | 50 | void resize(geometry::Size const& size) override; | 51 | void resize(geometry::Size const& size) override; |
2329 | 51 | void allow_framedropping(bool); | 52 | void allow_framedropping(bool) override; |
2330 | 52 | void force_requests_to_complete(); | 53 | void force_requests_to_complete() override; |
2331 | 53 | 54 | ||
2332 | 54 | protected: | 55 | protected: |
2333 | 55 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; | 56 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; |
2334 | 56 | 57 | ||
2335 | === modified file 'src/server/compositor/default_configuration.cpp' | |||
2336 | --- src/server/compositor/default_configuration.cpp 2013-11-20 15:56:58 +0000 | |||
2337 | +++ src/server/compositor/default_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
2338 | @@ -20,7 +20,6 @@ | |||
2339 | 20 | #include "buffer_stream_factory.h" | 20 | #include "buffer_stream_factory.h" |
2340 | 21 | #include "default_display_buffer_compositor_factory.h" | 21 | #include "default_display_buffer_compositor_factory.h" |
2341 | 22 | #include "multi_threaded_compositor.h" | 22 | #include "multi_threaded_compositor.h" |
2342 | 23 | #include "overlay_renderer.h" | ||
2343 | 24 | #include "gl_renderer_factory.h" | 23 | #include "gl_renderer_factory.h" |
2344 | 25 | 24 | ||
2345 | 26 | namespace mc = mir::compositor; | 25 | namespace mc = mir::compositor; |
2346 | @@ -43,7 +42,7 @@ | |||
2347 | 43 | [this]() | 42 | [this]() |
2348 | 44 | { | 43 | { |
2349 | 45 | return std::make_shared<mc::DefaultDisplayBufferCompositorFactory>( | 44 | return std::make_shared<mc::DefaultDisplayBufferCompositorFactory>( |
2351 | 46 | the_scene(), the_renderer_factory(), the_overlay_renderer()); | 45 | the_scene(), the_renderer_factory()); |
2352 | 47 | }); | 46 | }); |
2353 | 48 | } | 47 | } |
2354 | 49 | 48 | ||
2355 | @@ -59,22 +58,6 @@ | |||
2356 | 59 | }); | 58 | }); |
2357 | 60 | } | 59 | } |
2358 | 61 | 60 | ||
2359 | 62 | std::shared_ptr<mc::OverlayRenderer> | ||
2360 | 63 | mir::DefaultServerConfiguration::the_overlay_renderer() | ||
2361 | 64 | { | ||
2362 | 65 | struct NullOverlayRenderer : public mc::OverlayRenderer | ||
2363 | 66 | { | ||
2364 | 67 | virtual void render( | ||
2365 | 68 | geometry::Rectangle const&, | ||
2366 | 69 | std::function<void(std::shared_ptr<void> const&)>) {} | ||
2367 | 70 | }; | ||
2368 | 71 | return overlay_renderer( | ||
2369 | 72 | [this]() | ||
2370 | 73 | { | ||
2371 | 74 | return std::make_shared<NullOverlayRenderer>(); | ||
2372 | 75 | }); | ||
2373 | 76 | } | ||
2374 | 77 | |||
2375 | 78 | std::shared_ptr<mc::RendererFactory> mir::DefaultServerConfiguration::the_renderer_factory() | 61 | std::shared_ptr<mc::RendererFactory> mir::DefaultServerConfiguration::the_renderer_factory() |
2376 | 79 | { | 62 | { |
2377 | 80 | return renderer_factory( | 63 | return renderer_factory( |
2378 | 81 | 64 | ||
2379 | === modified file 'src/server/compositor/default_display_buffer_compositor.cpp' | |||
2380 | --- src/server/compositor/default_display_buffer_compositor.cpp 2013-11-21 03:16:21 +0000 | |||
2381 | +++ src/server/compositor/default_display_buffer_compositor.cpp 2013-11-28 12:22:03 +0000 | |||
2382 | @@ -19,7 +19,6 @@ | |||
2383 | 19 | #include "default_display_buffer_compositor.h" | 19 | #include "default_display_buffer_compositor.h" |
2384 | 20 | 20 | ||
2385 | 21 | #include "rendering_operator.h" | 21 | #include "rendering_operator.h" |
2386 | 22 | #include "overlay_renderer.h" | ||
2387 | 23 | #include "mir/compositor/scene.h" | 22 | #include "mir/compositor/scene.h" |
2388 | 24 | #include "mir/compositor/compositing_criteria.h" | 23 | #include "mir/compositor/compositing_criteria.h" |
2389 | 25 | #include "mir/graphics/display_buffer.h" | 24 | #include "mir/graphics/display_buffer.h" |
2390 | @@ -69,12 +68,10 @@ | |||
2391 | 69 | mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor( | 68 | mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor( |
2392 | 70 | mg::DisplayBuffer& display_buffer, | 69 | mg::DisplayBuffer& display_buffer, |
2393 | 71 | std::shared_ptr<mc::Scene> const& scene, | 70 | std::shared_ptr<mc::Scene> const& scene, |
2396 | 72 | std::shared_ptr<mc::Renderer> const& renderer, | 71 | std::shared_ptr<mc::Renderer> const& renderer) |
2395 | 73 | std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer) | ||
2397 | 74 | : display_buffer(display_buffer), | 72 | : display_buffer(display_buffer), |
2398 | 75 | scene{scene}, | 73 | scene{scene}, |
2399 | 76 | renderer{renderer}, | 74 | renderer{renderer}, |
2400 | 77 | overlay_renderer{overlay_renderer}, | ||
2401 | 78 | local_frameno{global_frameno} | 75 | local_frameno{global_frameno} |
2402 | 79 | { | 76 | { |
2403 | 80 | } | 77 | } |
2404 | @@ -138,11 +135,10 @@ | |||
2405 | 138 | mc::OcclusionMatch occlusion_match; | 135 | mc::OcclusionMatch occlusion_match; |
2406 | 139 | scene->reverse_for_each_if(occlusion_search, occlusion_match); | 136 | scene->reverse_for_each_if(occlusion_search, occlusion_match); |
2407 | 140 | 137 | ||
2410 | 141 | renderer->clear(local_frameno); | 138 | renderer->clear(); |
2411 | 142 | mc::RenderingOperator applicator(*renderer, save_resource); | 139 | mc::RenderingOperator applicator(*renderer, save_resource, local_frameno); |
2412 | 143 | FilterForVisibleSceneInRegion selector(view_area, occlusion_match); | 140 | FilterForVisibleSceneInRegion selector(view_area, occlusion_match); |
2413 | 144 | scene->for_each_if(selector, applicator); | 141 | scene->for_each_if(selector, applicator); |
2414 | 145 | overlay_renderer->render(view_area, save_resource); | ||
2415 | 146 | 142 | ||
2416 | 147 | display_buffer.post_update(); | 143 | display_buffer.post_update(); |
2417 | 148 | } | 144 | } |
2418 | 149 | 145 | ||
2419 | === modified file 'src/server/compositor/default_display_buffer_compositor.h' | |||
2420 | --- src/server/compositor/default_display_buffer_compositor.h 2013-10-03 03:57:28 +0000 | |||
2421 | +++ src/server/compositor/default_display_buffer_compositor.h 2013-11-28 12:22:03 +0000 | |||
2422 | @@ -33,7 +33,6 @@ | |||
2423 | 33 | 33 | ||
2424 | 34 | class Scene; | 34 | class Scene; |
2425 | 35 | class Renderer; | 35 | class Renderer; |
2426 | 36 | class OverlayRenderer; | ||
2427 | 37 | 36 | ||
2428 | 38 | class DefaultDisplayBufferCompositor : public DisplayBufferCompositor | 37 | class DefaultDisplayBufferCompositor : public DisplayBufferCompositor |
2429 | 39 | { | 38 | { |
2430 | @@ -41,8 +40,7 @@ | |||
2431 | 41 | DefaultDisplayBufferCompositor( | 40 | DefaultDisplayBufferCompositor( |
2432 | 42 | graphics::DisplayBuffer& display_buffer, | 41 | graphics::DisplayBuffer& display_buffer, |
2433 | 43 | std::shared_ptr<Scene> const& scene, | 42 | std::shared_ptr<Scene> const& scene, |
2436 | 44 | std::shared_ptr<Renderer> const& renderer, | 43 | std::shared_ptr<Renderer> const& renderer); |
2435 | 45 | std::shared_ptr<OverlayRenderer> const& overlay_renderer); | ||
2437 | 46 | 44 | ||
2438 | 47 | void composite() override; | 45 | void composite() override; |
2439 | 48 | 46 | ||
2440 | @@ -51,7 +49,6 @@ | |||
2441 | 51 | 49 | ||
2442 | 52 | std::shared_ptr<Scene> const scene; | 50 | std::shared_ptr<Scene> const scene; |
2443 | 53 | std::shared_ptr<Renderer> const renderer; | 51 | std::shared_ptr<Renderer> const renderer; |
2444 | 54 | std::shared_ptr<OverlayRenderer> const overlay_renderer; | ||
2445 | 55 | 52 | ||
2446 | 56 | unsigned long local_frameno; | 53 | unsigned long local_frameno; |
2447 | 57 | }; | 54 | }; |
2448 | 58 | 55 | ||
2449 | === modified file 'src/server/compositor/default_display_buffer_compositor_factory.cpp' | |||
2450 | --- src/server/compositor/default_display_buffer_compositor_factory.cpp 2013-11-21 03:16:21 +0000 | |||
2451 | +++ src/server/compositor/default_display_buffer_compositor_factory.cpp 2013-11-28 12:22:03 +0000 | |||
2452 | @@ -28,11 +28,9 @@ | |||
2453 | 28 | 28 | ||
2454 | 29 | mc::DefaultDisplayBufferCompositorFactory::DefaultDisplayBufferCompositorFactory( | 29 | mc::DefaultDisplayBufferCompositorFactory::DefaultDisplayBufferCompositorFactory( |
2455 | 30 | std::shared_ptr<mc::Scene> const& scene, | 30 | std::shared_ptr<mc::Scene> const& scene, |
2458 | 31 | std::shared_ptr<mc::RendererFactory> const& renderer_factory, | 31 | std::shared_ptr<mc::RendererFactory> const& renderer_factory) |
2457 | 32 | std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer) | ||
2459 | 33 | : scene{scene}, | 32 | : scene{scene}, |
2462 | 34 | renderer_factory{renderer_factory}, | 33 | renderer_factory{renderer_factory} |
2461 | 35 | overlay_renderer{overlay_renderer} | ||
2463 | 36 | { | 34 | { |
2464 | 37 | } | 35 | } |
2465 | 38 | 36 | ||
2466 | @@ -41,8 +39,6 @@ | |||
2467 | 41 | graphics::DisplayBuffer& display_buffer) | 39 | graphics::DisplayBuffer& display_buffer) |
2468 | 42 | { | 40 | { |
2469 | 43 | auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area()); | 41 | auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area()); |
2473 | 44 | auto raw = new DefaultDisplayBufferCompositor{display_buffer, scene, std::move(renderer), | 42 | auto raw = new DefaultDisplayBufferCompositor{display_buffer, scene, std::move(renderer)}; |
2471 | 45 | overlay_renderer}; | ||
2472 | 46 | |||
2474 | 47 | return std::unique_ptr<DisplayBufferCompositor>(raw); | 43 | return std::unique_ptr<DisplayBufferCompositor>(raw); |
2475 | 48 | } | 44 | } |
2476 | 49 | 45 | ||
2477 | === modified file 'src/server/compositor/default_display_buffer_compositor_factory.h' | |||
2478 | --- src/server/compositor/default_display_buffer_compositor_factory.h 2013-11-21 03:16:21 +0000 | |||
2479 | +++ src/server/compositor/default_display_buffer_compositor_factory.h 2013-11-28 12:22:03 +0000 | |||
2480 | @@ -27,7 +27,6 @@ | |||
2481 | 27 | namespace compositor | 27 | namespace compositor |
2482 | 28 | { | 28 | { |
2483 | 29 | class RendererFactory; | 29 | class RendererFactory; |
2484 | 30 | class OverlayRenderer; | ||
2485 | 31 | class Scene; | 30 | class Scene; |
2486 | 32 | 31 | ||
2487 | 33 | // TODO this is ideally an implementation class. It is only in a public header | 32 | // TODO this is ideally an implementation class. It is only in a public header |
2488 | @@ -37,15 +36,13 @@ | |||
2489 | 37 | public: | 36 | public: |
2490 | 38 | DefaultDisplayBufferCompositorFactory( | 37 | DefaultDisplayBufferCompositorFactory( |
2491 | 39 | std::shared_ptr<Scene> const& scene, | 38 | std::shared_ptr<Scene> const& scene, |
2494 | 40 | std::shared_ptr<RendererFactory> const& renderer_factory, | 39 | std::shared_ptr<RendererFactory> const& renderer_factory); |
2493 | 41 | std::shared_ptr<OverlayRenderer> const& overlay_renderer); | ||
2495 | 42 | 40 | ||
2496 | 43 | std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplayBuffer& display_buffer); | 41 | std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplayBuffer& display_buffer); |
2497 | 44 | 42 | ||
2498 | 45 | private: | 43 | private: |
2499 | 46 | std::shared_ptr<Scene> const scene; | 44 | std::shared_ptr<Scene> const scene; |
2500 | 47 | std::shared_ptr<RendererFactory> const renderer_factory; | 45 | std::shared_ptr<RendererFactory> const renderer_factory; |
2501 | 48 | std::shared_ptr<OverlayRenderer> const overlay_renderer; | ||
2502 | 49 | }; | 46 | }; |
2503 | 50 | 47 | ||
2504 | 51 | } | 48 | } |
2505 | 52 | 49 | ||
2506 | === modified file 'src/server/compositor/gl_renderer.cpp' | |||
2507 | --- src/server/compositor/gl_renderer.cpp 2013-11-21 03:16:21 +0000 | |||
2508 | +++ src/server/compositor/gl_renderer.cpp 2013-11-28 12:22:03 +0000 | |||
2509 | @@ -26,6 +26,7 @@ | |||
2510 | 26 | #include <boost/throw_exception.hpp> | 26 | #include <boost/throw_exception.hpp> |
2511 | 27 | #include <stdexcept> | 27 | #include <stdexcept> |
2512 | 28 | 28 | ||
2513 | 29 | namespace mg = mir::graphics; | ||
2514 | 29 | namespace mc = mir::compositor; | 30 | namespace mc = mir::compositor; |
2515 | 30 | namespace geom = mir::geometry; | 31 | namespace geom = mir::geometry; |
2516 | 31 | 32 | ||
2517 | @@ -235,15 +236,11 @@ | |||
2518 | 235 | } | 236 | } |
2519 | 236 | 237 | ||
2520 | 237 | mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area) | 238 | mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area) |
2521 | 238 | : frameno{0} | ||
2522 | 239 | { | 239 | { |
2523 | 240 | resources.setup(display_area); | 240 | resources.setup(display_area); |
2524 | 241 | } | 241 | } |
2525 | 242 | 242 | ||
2530 | 243 | void mc::GLRenderer::render( | 243 | void mc::GLRenderer::render(CompositingCriteria const& criteria, mg::Buffer& buffer) const |
2527 | 244 | std::function<void(std::shared_ptr<void> const&)> save_resource, | ||
2528 | 245 | CompositingCriteria const& criteria, | ||
2529 | 246 | BufferStream& stream) | ||
2531 | 247 | { | 244 | { |
2532 | 248 | glUseProgram(resources.program); | 245 | glUseProgram(resources.program); |
2533 | 249 | 246 | ||
2534 | @@ -273,9 +270,7 @@ | |||
2535 | 273 | /* Use the renderable's texture */ | 270 | /* Use the renderable's texture */ |
2536 | 274 | glBindTexture(GL_TEXTURE_2D, resources.texture); | 271 | glBindTexture(GL_TEXTURE_2D, resources.texture); |
2537 | 275 | 272 | ||
2541 | 276 | auto region_resource = stream.lock_compositor_buffer(frameno); | 273 | buffer.bind_to_texture(); |
2539 | 277 | region_resource->bind_to_texture(); | ||
2540 | 278 | save_resource(region_resource); | ||
2542 | 279 | 274 | ||
2543 | 280 | /* Draw */ | 275 | /* Draw */ |
2544 | 281 | glEnableVertexAttribArray(resources.position_attr_loc); | 276 | glEnableVertexAttribArray(resources.position_attr_loc); |
2545 | @@ -285,9 +280,7 @@ | |||
2546 | 285 | glDisableVertexAttribArray(resources.position_attr_loc); | 280 | glDisableVertexAttribArray(resources.position_attr_loc); |
2547 | 286 | } | 281 | } |
2548 | 287 | 282 | ||
2550 | 288 | void mc::GLRenderer::clear(unsigned long frame) | 283 | void mc::GLRenderer::clear() const |
2551 | 289 | { | 284 | { |
2552 | 290 | frameno = frame; | ||
2553 | 291 | glClear(GL_COLOR_BUFFER_BIT); | 285 | glClear(GL_COLOR_BUFFER_BIT); |
2554 | 292 | } | 286 | } |
2555 | 293 | |||
2556 | 294 | 287 | ||
2557 | === modified file 'src/server/compositor/gl_renderer.h' | |||
2558 | --- src/server/compositor/gl_renderer.h 2013-11-21 03:16:21 +0000 | |||
2559 | +++ src/server/compositor/gl_renderer.h 2013-11-28 12:22:03 +0000 | |||
2560 | @@ -33,10 +33,8 @@ | |||
2561 | 33 | public: | 33 | public: |
2562 | 34 | GLRenderer(geometry::Rectangle const& display_area); | 34 | GLRenderer(geometry::Rectangle const& display_area); |
2563 | 35 | 35 | ||
2568 | 36 | /* From renderer */ | 36 | void render(CompositingCriteria const& info, graphics::Buffer& buffer) const override; |
2569 | 37 | void render(std::function<void(std::shared_ptr<void> const&)> save_resource, | 37 | void clear() const override; |
2566 | 38 | CompositingCriteria const& info, BufferStream& stream); | ||
2567 | 39 | void clear(unsigned long frameno) override; | ||
2570 | 40 | 38 | ||
2571 | 41 | ~GLRenderer() noexcept {} | 39 | ~GLRenderer() noexcept {} |
2572 | 42 | 40 | ||
2573 | @@ -60,8 +58,6 @@ | |||
2574 | 60 | }; | 58 | }; |
2575 | 61 | 59 | ||
2576 | 62 | Resources resources; | 60 | Resources resources; |
2577 | 63 | |||
2578 | 64 | unsigned long frameno; | ||
2579 | 65 | }; | 61 | }; |
2580 | 66 | 62 | ||
2581 | 67 | } | 63 | } |
2582 | 68 | 64 | ||
2583 | === removed file 'src/server/compositor/overlay_renderer.h' | |||
2584 | --- src/server/compositor/overlay_renderer.h 2013-11-21 03:16:21 +0000 | |||
2585 | +++ src/server/compositor/overlay_renderer.h 1970-01-01 00:00:00 +0000 | |||
2586 | @@ -1,53 +0,0 @@ | |||
2587 | 1 | /* | ||
2588 | 2 | * Copyright © 2013 Canonical Ltd. | ||
2589 | 3 | * | ||
2590 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2591 | 5 | * under the terms of the GNU General Public License version 3, | ||
2592 | 6 | * as published by the Free Software Foundation. | ||
2593 | 7 | * | ||
2594 | 8 | * This program is distributed in the hope that it will be useful, | ||
2595 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2596 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2597 | 11 | * GNU General Public License for more details. | ||
2598 | 12 | * | ||
2599 | 13 | * You should have received a copy of the GNU General Public License | ||
2600 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2601 | 15 | * | ||
2602 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
2603 | 17 | */ | ||
2604 | 18 | |||
2605 | 19 | #ifndef MIR_COMPOSITOR_OVERLAY_RENDERER_H_ | ||
2606 | 20 | #define MIR_COMPOSITOR_OVERLAY_RENDERER_H_ | ||
2607 | 21 | |||
2608 | 22 | #include <functional> | ||
2609 | 23 | #include <memory> | ||
2610 | 24 | |||
2611 | 25 | namespace mir | ||
2612 | 26 | { | ||
2613 | 27 | namespace geometry | ||
2614 | 28 | { | ||
2615 | 29 | struct Rectangle; | ||
2616 | 30 | } | ||
2617 | 31 | |||
2618 | 32 | namespace compositor | ||
2619 | 33 | { | ||
2620 | 34 | |||
2621 | 35 | class OverlayRenderer | ||
2622 | 36 | { | ||
2623 | 37 | public: | ||
2624 | 38 | virtual ~OverlayRenderer() = default; | ||
2625 | 39 | |||
2626 | 40 | virtual void render( | ||
2627 | 41 | geometry::Rectangle const& view_area, | ||
2628 | 42 | std::function<void(std::shared_ptr<void> const&)> save_resource) = 0; | ||
2629 | 43 | |||
2630 | 44 | protected: | ||
2631 | 45 | OverlayRenderer() = default; | ||
2632 | 46 | OverlayRenderer& operator=(OverlayRenderer const&) = delete; | ||
2633 | 47 | OverlayRenderer(OverlayRenderer const&) = delete; | ||
2634 | 48 | }; | ||
2635 | 49 | |||
2636 | 50 | } | ||
2637 | 51 | } // namespace mir | ||
2638 | 52 | |||
2639 | 53 | #endif // MIR_COMPOSITOR_OVERLAY_RENDERER_H_ | ||
2640 | 54 | 0 | ||
2641 | === modified file 'src/server/compositor/renderer.h' | |||
2642 | --- src/server/compositor/renderer.h 2013-11-21 03:16:21 +0000 | |||
2643 | +++ src/server/compositor/renderer.h 2013-11-28 12:22:03 +0000 | |||
2644 | @@ -19,14 +19,14 @@ | |||
2645 | 19 | #ifndef MIR_COMPOSITOR_RENDERER_H_ | 19 | #ifndef MIR_COMPOSITOR_RENDERER_H_ |
2646 | 20 | #define MIR_COMPOSITOR_RENDERER_H_ | 20 | #define MIR_COMPOSITOR_RENDERER_H_ |
2647 | 21 | 21 | ||
2648 | 22 | #include <memory> | ||
2649 | 23 | #include <functional> | ||
2650 | 24 | |||
2651 | 25 | namespace mir | 22 | namespace mir |
2652 | 26 | { | 23 | { |
2653 | 24 | namespace graphics | ||
2654 | 25 | { | ||
2655 | 26 | class Buffer; | ||
2656 | 27 | } | ||
2657 | 27 | namespace compositor | 28 | namespace compositor |
2658 | 28 | { | 29 | { |
2659 | 29 | class BufferStream; | ||
2660 | 30 | class CompositingCriteria; | 30 | class CompositingCriteria; |
2661 | 31 | 31 | ||
2662 | 32 | class Renderer | 32 | class Renderer |
2663 | @@ -34,9 +34,8 @@ | |||
2664 | 34 | public: | 34 | public: |
2665 | 35 | virtual ~Renderer() = default; | 35 | virtual ~Renderer() = default; |
2666 | 36 | 36 | ||
2670 | 37 | virtual void clear(unsigned long frameno) = 0; | 37 | virtual void clear() const = 0; |
2671 | 38 | virtual void render(std::function<void(std::shared_ptr<void> const&)> save_resource, | 38 | virtual void render(CompositingCriteria const& info, graphics::Buffer& buffer) const = 0; |
2669 | 39 | CompositingCriteria const& info, BufferStream& stream) = 0; | ||
2672 | 40 | 39 | ||
2673 | 41 | protected: | 40 | protected: |
2674 | 42 | Renderer() = default; | 41 | Renderer() = default; |
2675 | 43 | 42 | ||
2676 | === modified file 'src/server/compositor/rendering_operator.cpp' | |||
2677 | --- src/server/compositor/rendering_operator.cpp 2013-11-21 03:16:21 +0000 | |||
2678 | +++ src/server/compositor/rendering_operator.cpp 2013-11-28 12:22:03 +0000 | |||
2679 | @@ -17,22 +17,23 @@ | |||
2680 | 17 | */ | 17 | */ |
2681 | 18 | 18 | ||
2682 | 19 | #include "rendering_operator.h" | 19 | #include "rendering_operator.h" |
2683 | 20 | #include "mir/compositor/buffer_stream.h" | ||
2684 | 20 | 21 | ||
2685 | 21 | namespace mc=mir::compositor; | 22 | namespace mc=mir::compositor; |
2686 | 22 | 23 | ||
2687 | 23 | mc::RenderingOperator::RenderingOperator( | 24 | mc::RenderingOperator::RenderingOperator( |
2688 | 24 | Renderer& renderer, | 25 | Renderer& renderer, |
2690 | 25 | std::function<void(std::shared_ptr<void> const&)> save_resource) : | 26 | std::function<void(std::shared_ptr<void> const&)> save_resource, |
2691 | 27 | unsigned long frameno) : | ||
2692 | 26 | renderer(renderer), | 28 | renderer(renderer), |
2698 | 27 | save_resource(save_resource) | 29 | save_resource(save_resource), |
2699 | 28 | { | 30 | frameno(frameno) |
2695 | 29 | } | ||
2696 | 30 | |||
2697 | 31 | mc::RenderingOperator::~RenderingOperator() | ||
2700 | 32 | { | 31 | { |
2701 | 33 | } | 32 | } |
2702 | 34 | 33 | ||
2703 | 35 | void mc::RenderingOperator::operator()(CompositingCriteria const& info, BufferStream& stream) | 34 | void mc::RenderingOperator::operator()(CompositingCriteria const& info, BufferStream& stream) |
2704 | 36 | { | 35 | { |
2706 | 37 | renderer.render(save_resource, info, stream); | 36 | auto compositor_buffer = stream.lock_compositor_buffer(frameno); |
2707 | 37 | renderer.render(info, *compositor_buffer); | ||
2708 | 38 | save_resource(compositor_buffer); | ||
2709 | 38 | } | 39 | } |
2710 | 39 | 40 | ||
2711 | === modified file 'src/server/compositor/rendering_operator.h' | |||
2712 | --- src/server/compositor/rendering_operator.h 2013-11-21 03:16:21 +0000 | |||
2713 | +++ src/server/compositor/rendering_operator.h 2013-11-28 12:22:03 +0000 | |||
2714 | @@ -32,14 +32,18 @@ | |||
2715 | 32 | class RenderingOperator : public OperatorForScene | 32 | class RenderingOperator : public OperatorForScene |
2716 | 33 | { | 33 | { |
2717 | 34 | public: | 34 | public: |
2720 | 35 | explicit RenderingOperator(Renderer& renderer, std::function<void(std::shared_ptr<void> const&)> save_resource); | 35 | explicit RenderingOperator( |
2721 | 36 | ~RenderingOperator(); | 36 | Renderer& renderer, |
2722 | 37 | std::function<void(std::shared_ptr<void> const&)> save_resource, | ||
2723 | 38 | unsigned long frameno); | ||
2724 | 39 | ~RenderingOperator() = default; | ||
2725 | 37 | 40 | ||
2726 | 38 | void operator()(CompositingCriteria const& info, BufferStream&); | 41 | void operator()(CompositingCriteria const& info, BufferStream&); |
2727 | 39 | 42 | ||
2728 | 40 | private: | 43 | private: |
2729 | 41 | Renderer& renderer; | 44 | Renderer& renderer; |
2730 | 42 | std::function<void(std::shared_ptr<void> const&)> save_resource; | 45 | std::function<void(std::shared_ptr<void> const&)> save_resource; |
2731 | 46 | unsigned long const frameno; | ||
2732 | 43 | }; | 47 | }; |
2733 | 44 | 48 | ||
2734 | 45 | } | 49 | } |
2735 | 46 | 50 | ||
2736 | === modified file 'src/server/compositor/switching_bundle.cpp' | |||
2737 | --- src/server/compositor/switching_bundle.cpp 2013-11-21 03:16:21 +0000 | |||
2738 | +++ src/server/compositor/switching_bundle.cpp 2013-11-28 12:22:03 +0000 | |||
2739 | @@ -203,7 +203,7 @@ | |||
2740 | 203 | * but always uses 50% more memory. So try to avoid it when possible. | 203 | * but always uses 50% more memory. So try to avoid it when possible. |
2741 | 204 | */ | 204 | */ |
2742 | 205 | 205 | ||
2744 | 206 | int min_free = | 206 | int min_free = |
2745 | 207 | #if 0 // FIXME: This memory optimization breaks timing tests | 207 | #if 0 // FIXME: This memory optimization breaks timing tests |
2746 | 208 | (nbuffers > 2 && !overlapping_compositors) ? nbuffers - 1 : 1; | 208 | (nbuffers > 2 && !overlapping_compositors) ? nbuffers - 1 : 1; |
2747 | 209 | #else | 209 | #else |
2748 | 210 | 210 | ||
2749 | === modified file 'src/server/compositor/switching_bundle.h' | |||
2750 | --- src/server/compositor/switching_bundle.h 2013-11-21 03:16:21 +0000 | |||
2751 | +++ src/server/compositor/switching_bundle.h 2013-11-28 12:22:03 +0000 | |||
2752 | @@ -35,7 +35,7 @@ | |||
2753 | 35 | namespace compositor | 35 | namespace compositor |
2754 | 36 | { | 36 | { |
2755 | 37 | 37 | ||
2757 | 38 | class SwitchingBundle : public BufferBundle | 38 | class SwitchingBundle : public BufferBundle |
2758 | 39 | { | 39 | { |
2759 | 40 | public: | 40 | public: |
2760 | 41 | enum {min_buffers = 1, max_buffers = 5}; | 41 | enum {min_buffers = 1, max_buffers = 5}; |
2761 | 42 | 42 | ||
2762 | === modified file 'src/server/compositor/temporary_buffers.cpp' | |||
2763 | --- src/server/compositor/temporary_buffers.cpp 2013-10-15 08:53:10 +0000 | |||
2764 | +++ src/server/compositor/temporary_buffers.cpp 2013-11-28 12:22:03 +0000 | |||
2765 | @@ -28,18 +28,6 @@ | |||
2766 | 28 | { | 28 | { |
2767 | 29 | } | 29 | } |
2768 | 30 | 30 | ||
2769 | 31 | mc::TemporaryClientBuffer::TemporaryClientBuffer(std::shared_ptr<BufferBundle> const& buffer_swapper) | ||
2770 | 32 | : TemporaryBuffer(buffer_swapper->client_acquire()), | ||
2771 | 33 | allocating_swapper(buffer_swapper) | ||
2772 | 34 | { | ||
2773 | 35 | } | ||
2774 | 36 | |||
2775 | 37 | mc::TemporaryClientBuffer::~TemporaryClientBuffer() | ||
2776 | 38 | { | ||
2777 | 39 | if (auto swapper = allocating_swapper.lock()) | ||
2778 | 40 | swapper->client_release(buffer); | ||
2779 | 41 | } | ||
2780 | 42 | |||
2781 | 43 | mc::TemporaryCompositorBuffer::TemporaryCompositorBuffer( | 31 | mc::TemporaryCompositorBuffer::TemporaryCompositorBuffer( |
2782 | 44 | std::shared_ptr<BufferBundle> const& bun, unsigned long frameno) | 32 | std::shared_ptr<BufferBundle> const& bun, unsigned long frameno) |
2783 | 45 | : TemporaryBuffer(bun->compositor_acquire(frameno)), | 33 | : TemporaryBuffer(bun->compositor_acquire(frameno)), |
2784 | 46 | 34 | ||
2785 | === modified file 'src/server/compositor/temporary_buffers.h' | |||
2786 | --- src/server/compositor/temporary_buffers.h 2013-10-15 08:53:10 +0000 | |||
2787 | +++ src/server/compositor/temporary_buffers.h 2013-11-28 12:22:03 +0000 | |||
2788 | @@ -48,16 +48,6 @@ | |||
2789 | 48 | std::shared_ptr<mg::Buffer> const buffer; | 48 | std::shared_ptr<mg::Buffer> const buffer; |
2790 | 49 | }; | 49 | }; |
2791 | 50 | 50 | ||
2792 | 51 | class TemporaryClientBuffer : public TemporaryBuffer | ||
2793 | 52 | { | ||
2794 | 53 | public: | ||
2795 | 54 | explicit TemporaryClientBuffer(std::shared_ptr<BufferBundle> const& buffer_swapper); | ||
2796 | 55 | ~TemporaryClientBuffer(); | ||
2797 | 56 | |||
2798 | 57 | private: | ||
2799 | 58 | std::weak_ptr<BufferBundle> const allocating_swapper; | ||
2800 | 59 | }; | ||
2801 | 60 | |||
2802 | 61 | class TemporaryCompositorBuffer : public TemporaryBuffer | 51 | class TemporaryCompositorBuffer : public TemporaryBuffer |
2803 | 62 | { | 52 | { |
2804 | 63 | public: | 53 | public: |
2805 | 64 | 54 | ||
2806 | === modified file 'src/server/default_server_configuration.cpp' | |||
2807 | --- src/server/default_server_configuration.cpp 2013-11-21 12:34:49 +0000 | |||
2808 | +++ src/server/default_server_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
2809 | @@ -90,7 +90,7 @@ | |||
2810 | 90 | [this]() -> std::shared_ptr<mi::InputReport> | 90 | [this]() -> std::shared_ptr<mi::InputReport> |
2811 | 91 | { | 91 | { |
2812 | 92 | auto opt = the_options()->get(input_report_opt, off_opt_value); | 92 | auto opt = the_options()->get(input_report_opt, off_opt_value); |
2814 | 93 | 93 | ||
2815 | 94 | if (opt == log_opt_value) | 94 | if (opt == log_opt_value) |
2816 | 95 | { | 95 | { |
2817 | 96 | return std::make_shared<ml::InputReport>(the_logger()); | 96 | return std::make_shared<ml::InputReport>(the_logger()); |
2818 | 97 | 97 | ||
2819 | === modified file 'src/server/frontend/event_sender.cpp' | |||
2820 | --- src/server/frontend/event_sender.cpp 2013-10-15 08:53:10 +0000 | |||
2821 | +++ src/server/frontend/event_sender.cpp 2013-11-28 12:22:03 +0000 | |||
2822 | @@ -37,7 +37,7 @@ | |||
2823 | 37 | void mfd::EventSender::handle_event(MirEvent const& e) | 37 | void mfd::EventSender::handle_event(MirEvent const& e) |
2824 | 38 | { | 38 | { |
2825 | 39 | // Limit the types of events we wish to send over protobuf, for now. | 39 | // Limit the types of events we wish to send over protobuf, for now. |
2827 | 40 | if (e.type == mir_event_type_surface) | 40 | if (e.type != mir_event_type_key && e.type != mir_event_type_motion) |
2828 | 41 | { | 41 | { |
2829 | 42 | // In future we might send multiple events, or insert them into messages | 42 | // In future we might send multiple events, or insert them into messages |
2830 | 43 | // containing other responses, but for now we send them individually. | 43 | // containing other responses, but for now we send them individually. |
2831 | 44 | 44 | ||
2832 | === modified file 'src/server/frontend/event_sender.h' | |||
2833 | --- src/server/frontend/event_sender.h 2013-08-28 03:41:48 +0000 | |||
2834 | +++ src/server/frontend/event_sender.h 2013-11-28 12:22:03 +0000 | |||
2835 | @@ -47,7 +47,7 @@ | |||
2836 | 47 | 47 | ||
2837 | 48 | std::shared_ptr<MessageSender> const sender; | 48 | std::shared_ptr<MessageSender> const sender; |
2838 | 49 | }; | 49 | }; |
2840 | 50 | 50 | ||
2841 | 51 | } | 51 | } |
2842 | 52 | } | 52 | } |
2843 | 53 | } | 53 | } |
2844 | 54 | 54 | ||
2845 | === modified file 'src/server/frontend/fd_sets.h' | |||
2846 | --- src/server/frontend/fd_sets.h 2013-09-26 19:16:26 +0000 | |||
2847 | +++ src/server/frontend/fd_sets.h 2013-11-28 12:22:03 +0000 | |||
2848 | @@ -28,6 +28,6 @@ | |||
2849 | 28 | { | 28 | { |
2850 | 29 | typedef std::initializer_list<std::vector<int32_t>> FdSets; | 29 | typedef std::initializer_list<std::vector<int32_t>> FdSets; |
2851 | 30 | } | 30 | } |
2853 | 31 | } // namespace mir | 31 | } // namespace mir |
2854 | 32 | 32 | ||
2855 | 33 | #endif // MIR_FRONTEND_FD_SETS_H_ | 33 | #endif // MIR_FRONTEND_FD_SETS_H_ |
2856 | 34 | 34 | ||
2857 | === modified file 'src/server/frontend/message_receiver.h' | |||
2858 | --- src/server/frontend/message_receiver.h 2013-08-28 03:41:48 +0000 | |||
2859 | +++ src/server/frontend/message_receiver.h 2013-11-28 12:22:03 +0000 | |||
2860 | @@ -13,7 +13,7 @@ | |||
2861 | 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
2862 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2863 | 15 | * | 15 | * |
2865 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
2866 | 17 | */ | 17 | */ |
2867 | 18 | #ifndef MIR_FRONTEND_MESSAGE_RECEIVER_H_ | 18 | #ifndef MIR_FRONTEND_MESSAGE_RECEIVER_H_ |
2868 | 19 | #define MIR_FRONTEND_MESSAGE_RECEIVER_H_ | 19 | #define MIR_FRONTEND_MESSAGE_RECEIVER_H_ |
2869 | @@ -32,7 +32,7 @@ | |||
2870 | 32 | public: | 32 | public: |
2871 | 33 | //receive message from the socket. 'handler' will be called when 'buffer' has been filled with exactly 'size' | 33 | //receive message from the socket. 'handler' will be called when 'buffer' has been filled with exactly 'size' |
2872 | 34 | typedef std::function<void(boost::system::error_code const&, size_t)> MirReadHandler; | 34 | typedef std::function<void(boost::system::error_code const&, size_t)> MirReadHandler; |
2874 | 35 | virtual void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size) = 0; | 35 | virtual void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size) = 0; |
2875 | 36 | virtual pid_t client_pid() = 0; | 36 | virtual pid_t client_pid() = 0; |
2876 | 37 | 37 | ||
2877 | 38 | protected: | 38 | protected: |
2878 | 39 | 39 | ||
2879 | === modified file 'src/server/frontend/session_mediator.cpp' | |||
2880 | --- src/server/frontend/session_mediator.cpp 2013-11-21 03:16:21 +0000 | |||
2881 | +++ src/server/frontend/session_mediator.cpp 2013-11-28 12:22:03 +0000 | |||
2882 | @@ -120,16 +120,13 @@ | |||
2883 | 120 | { | 120 | { |
2884 | 121 | auto& tracker = client_buffer_tracker[surf_id]; | 121 | auto& tracker = client_buffer_tracker[surf_id]; |
2885 | 122 | if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size); | 122 | if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size); |
2886 | 123 | |||
2887 | 124 | client_buffer_resource[surf_id].reset(); | ||
2888 | 125 | 123 | ||
2890 | 126 | auto client_buffer = surface.advance_client_buffer(); | 124 | auto& client_buffer = client_buffer_resource[surf_id]; |
2891 | 125 | surface.swap_buffers(client_buffer); | ||
2892 | 127 | auto id = client_buffer->id(); | 126 | auto id = client_buffer->id(); |
2893 | 128 | auto need_full_ipc = !tracker->client_has(id); | 127 | auto need_full_ipc = !tracker->client_has(id); |
2894 | 129 | tracker->add(id); | 128 | tracker->add(id); |
2895 | 130 | 129 | ||
2896 | 131 | client_buffer_resource[surf_id] = client_buffer; | ||
2897 | 132 | |||
2898 | 133 | return std::tie(client_buffer, need_full_ipc); | 130 | return std::tie(client_buffer, need_full_ipc); |
2899 | 134 | } | 131 | } |
2900 | 135 | 132 | ||
2901 | 136 | 133 | ||
2902 | === modified file 'src/server/frontend/session_mediator_android.cpp' | |||
2903 | --- src/server/frontend/session_mediator_android.cpp 2013-11-21 03:16:21 +0000 | |||
2904 | +++ src/server/frontend/session_mediator_android.cpp 2013-11-28 12:22:03 +0000 | |||
2905 | @@ -31,7 +31,7 @@ | |||
2906 | 31 | { | 31 | { |
2907 | 32 | { | 32 | { |
2908 | 33 | std::unique_lock<std::mutex> lock(session_mutex); | 33 | std::unique_lock<std::mutex> lock(session_mutex); |
2910 | 34 | 34 | ||
2911 | 35 | auto session = weak_session.lock(); | 35 | auto session = weak_session.lock(); |
2912 | 36 | 36 | ||
2913 | 37 | if (session.get() == nullptr) | 37 | if (session.get() == nullptr) |
2914 | 38 | 38 | ||
2915 | === modified file 'src/server/frontend/socket_messenger.cpp' | |||
2916 | --- src/server/frontend/socket_messenger.cpp 2013-10-15 08:53:10 +0000 | |||
2917 | +++ src/server/frontend/socket_messenger.cpp 2013-11-28 12:22:03 +0000 | |||
2918 | @@ -39,9 +39,9 @@ | |||
2919 | 39 | { | 39 | { |
2920 | 40 | struct ucred cr; | 40 | struct ucred cr; |
2921 | 41 | socklen_t cl = sizeof(cr); | 41 | socklen_t cl = sizeof(cr); |
2923 | 42 | 42 | ||
2924 | 43 | auto status = getsockopt(socket->native_handle(), SOL_SOCKET, SO_PEERCRED, &cr, &cl); | 43 | auto status = getsockopt(socket->native_handle(), SOL_SOCKET, SO_PEERCRED, &cr, &cl); |
2926 | 44 | 44 | ||
2927 | 45 | if (status) | 45 | if (status) |
2928 | 46 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to query client socket credentials")); | 46 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to query client socket credentials")); |
2929 | 47 | return cr.pid; | 47 | return cr.pid; |
2930 | @@ -60,7 +60,7 @@ | |||
2931 | 60 | static_cast<unsigned char>((size >> 8) & 0xff), | 60 | static_cast<unsigned char>((size >> 8) & 0xff), |
2932 | 61 | static_cast<unsigned char>((size >> 0) & 0xff) | 61 | static_cast<unsigned char>((size >> 0) & 0xff) |
2933 | 62 | }; | 62 | }; |
2935 | 63 | 63 | ||
2936 | 64 | std::unique_lock<std::mutex> lg(message_lock); | 64 | std::unique_lock<std::mutex> lg(message_lock); |
2937 | 65 | 65 | ||
2938 | 66 | whole_message.resize(sizeof header_bytes + size); | 66 | whole_message.resize(sizeof header_bytes + size); |
2939 | @@ -126,4 +126,4 @@ | |||
2940 | 126 | buffer, | 126 | buffer, |
2941 | 127 | boost::asio::transfer_exactly(size), | 127 | boost::asio::transfer_exactly(size), |
2942 | 128 | handler); | 128 | handler); |
2944 | 129 | } | 129 | } |
2945 | 130 | 130 | ||
2946 | === modified file 'src/server/frontend/socket_messenger.h' | |||
2947 | --- src/server/frontend/socket_messenger.h 2013-10-15 08:53:10 +0000 | |||
2948 | +++ src/server/frontend/socket_messenger.h 2013-11-28 12:22:03 +0000 | |||
2949 | @@ -16,8 +16,8 @@ | |||
2950 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
2951 | 17 | */ | 17 | */ |
2952 | 18 | 18 | ||
2955 | 19 | #ifndef MIR_FRONTEND_SOCKET_MESSENGER_H_ | 19 | #ifndef MIR_FRONTEND_SOCKET_MESSENGER_H_ |
2956 | 20 | #define MIR_FRONTEND_SOCKET_MESSENGER_H_ | 20 | #define MIR_FRONTEND_SOCKET_MESSENGER_H_ |
2957 | 21 | #include "message_sender.h" | 21 | #include "message_sender.h" |
2958 | 22 | #include "message_receiver.h" | 22 | #include "message_receiver.h" |
2959 | 23 | #include <mutex> | 23 | #include <mutex> |
2960 | @@ -37,19 +37,19 @@ | |||
2961 | 37 | void send(std::string const& body); | 37 | void send(std::string const& body); |
2962 | 38 | void send(std::string const& body, FdSets const& fd_set); | 38 | void send(std::string const& body, FdSets const& fd_set); |
2963 | 39 | 39 | ||
2965 | 40 | void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size); | 40 | void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size); |
2966 | 41 | pid_t client_pid(); | 41 | pid_t client_pid(); |
2967 | 42 | 42 | ||
2968 | 43 | private: | 43 | private: |
2969 | 44 | std::shared_ptr<boost::asio::local::stream_protocol::socket> socket; | 44 | std::shared_ptr<boost::asio::local::stream_protocol::socket> socket; |
2971 | 45 | 45 | ||
2972 | 46 | std::mutex message_lock; | 46 | std::mutex message_lock; |
2973 | 47 | std::vector<char> whole_message; | 47 | std::vector<char> whole_message; |
2975 | 48 | 48 | ||
2976 | 49 | void send_fds_locked(std::unique_lock<std::mutex> const& lock, std::vector<int32_t> const& fds); | 49 | void send_fds_locked(std::unique_lock<std::mutex> const& lock, std::vector<int32_t> const& fds); |
2977 | 50 | }; | 50 | }; |
2978 | 51 | } | 51 | } |
2979 | 52 | } | 52 | } |
2980 | 53 | } | 53 | } |
2981 | 54 | 54 | ||
2983 | 55 | #endif /* MIR_FRONTEND_SOCKET_MESSENGER_H_ */ | 55 | #endif /* MIR_FRONTEND_SOCKET_MESSENGER_H_ */ |
2984 | 56 | 56 | ||
2985 | === modified file 'src/server/frontend/socket_session.cpp' | |||
2986 | --- src/server/frontend/socket_session.cpp 2013-08-28 03:41:48 +0000 | |||
2987 | +++ src/server/frontend/socket_session.cpp 2013-11-28 12:22:03 +0000 | |||
2988 | @@ -66,7 +66,7 @@ | |||
2989 | 66 | connected_sessions->remove(id()); | 66 | connected_sessions->remove(id()); |
2990 | 67 | BOOST_THROW_EXCEPTION(std::runtime_error(error.message())); | 67 | BOOST_THROW_EXCEPTION(std::runtime_error(error.message())); |
2991 | 68 | } | 68 | } |
2993 | 69 | 69 | ||
2994 | 70 | unsigned char high_byte = message.sbumpc(); | 70 | unsigned char high_byte = message.sbumpc(); |
2995 | 71 | unsigned char low_byte = message.sbumpc(); | 71 | unsigned char low_byte = message.sbumpc(); |
2996 | 72 | size_t const body_size = (high_byte << 8) + low_byte; | 72 | size_t const body_size = (high_byte << 8) + low_byte; |
2997 | 73 | 73 | ||
2998 | === modified file 'src/server/frontend/surface.cpp' | |||
2999 | --- src/server/frontend/surface.cpp 2013-11-21 03:16:21 +0000 | |||
3000 | +++ src/server/frontend/surface.cpp 2013-11-28 12:22:03 +0000 | |||
3001 | @@ -37,9 +37,9 @@ | |||
3002 | 37 | ForwardingInternalSurface(std::shared_ptr<Surface> const& surface) : surface(surface) {} | 37 | ForwardingInternalSurface(std::shared_ptr<Surface> const& surface) : surface(surface) {} |
3003 | 38 | 38 | ||
3004 | 39 | private: | 39 | private: |
3006 | 40 | virtual std::shared_ptr<mg::Buffer> advance_client_buffer() | 40 | void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer) |
3007 | 41 | { | 41 | { |
3009 | 42 | return surface->advance_client_buffer(); | 42 | surface->swap_buffers(buffer); |
3010 | 43 | } | 43 | } |
3011 | 44 | virtual mir::geometry::Size size() const { return surface->size(); } | 44 | virtual mir::geometry::Size size() const { return surface->size(); } |
3012 | 45 | virtual MirPixelFormat pixel_format() const { return static_cast<MirPixelFormat>(surface->pixel_format()); } | 45 | virtual MirPixelFormat pixel_format() const { return static_cast<MirPixelFormat>(surface->pixel_format()); } |
3013 | 46 | 46 | ||
3014 | === modified file 'src/server/graphics/android/android_buffer_allocator.cpp' | |||
3015 | --- src/server/graphics/android/android_buffer_allocator.cpp 2013-11-21 03:16:21 +0000 | |||
3016 | +++ src/server/graphics/android/android_buffer_allocator.cpp 2013-11-28 12:22:03 +0000 | |||
3017 | @@ -106,5 +106,5 @@ | |||
3018 | 106 | case mg::BufferUsage::hardware: | 106 | case mg::BufferUsage::hardware: |
3019 | 107 | default: | 107 | default: |
3020 | 108 | return mga::BufferUsage::use_hardware; | 108 | return mga::BufferUsage::use_hardware; |
3022 | 109 | } | 109 | } |
3023 | 110 | } | 110 | } |
3024 | 111 | 111 | ||
3025 | === modified file 'src/server/graphics/android/android_display.h' | |||
3026 | --- src/server/graphics/android/android_display.h 2013-11-21 17:20:14 +0000 | |||
3027 | +++ src/server/graphics/android/android_display.h 2013-11-28 12:22:03 +0000 | |||
3028 | @@ -71,7 +71,7 @@ | |||
3029 | 71 | GLContext gl_context; | 71 | GLContext gl_context; |
3030 | 72 | std::shared_ptr<DisplayDevice> const display_device; | 72 | std::shared_ptr<DisplayDevice> const display_device; |
3031 | 73 | //we only have a primary display at the moment | 73 | //we only have a primary display at the moment |
3033 | 74 | std::unique_ptr<graphics::DisplayBuffer> const display_buffer; | 74 | std::unique_ptr<graphics::DisplayBuffer> const display_buffer; |
3034 | 75 | AndroidDisplayConfiguration current_configuration; | 75 | AndroidDisplayConfiguration current_configuration; |
3035 | 76 | }; | 76 | }; |
3036 | 77 | 77 | ||
3037 | 78 | 78 | ||
3038 | === modified file 'src/server/graphics/android/android_display_configuration.h' | |||
3039 | --- src/server/graphics/android/android_display_configuration.h 2013-09-12 23:48:21 +0000 | |||
3040 | +++ src/server/graphics/android/android_display_configuration.h 2013-11-28 12:22:03 +0000 | |||
3041 | @@ -32,7 +32,7 @@ | |||
3042 | 32 | AndroidDisplayConfiguration(geometry::Size const& display_size); | 32 | AndroidDisplayConfiguration(geometry::Size const& display_size); |
3043 | 33 | AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other); | 33 | AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other); |
3044 | 34 | AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other); | 34 | AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other); |
3046 | 35 | 35 | ||
3047 | 36 | virtual ~AndroidDisplayConfiguration() = default; | 36 | virtual ~AndroidDisplayConfiguration() = default; |
3048 | 37 | 37 | ||
3049 | 38 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const; | 38 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const; |
3050 | 39 | 39 | ||
3051 | === modified file 'src/server/graphics/android/android_platform.cpp' | |||
3052 | --- src/server/graphics/android/android_platform.cpp 2013-11-21 17:20:14 +0000 | |||
3053 | +++ src/server/graphics/android/android_platform.cpp 2013-11-28 12:22:03 +0000 | |||
3054 | @@ -77,7 +77,7 @@ | |||
3055 | 77 | auto buffer_handle = native_buffer->handle(); | 77 | auto buffer_handle = native_buffer->handle(); |
3056 | 78 | 78 | ||
3057 | 79 | int offset = 0; | 79 | int offset = 0; |
3059 | 80 | 80 | ||
3060 | 81 | for(auto i=0; i<buffer_handle->numFds; i++) | 81 | for(auto i=0; i<buffer_handle->numFds; i++) |
3061 | 82 | { | 82 | { |
3062 | 83 | packer->pack_fd(buffer_handle->data[offset++]); | 83 | packer->pack_fd(buffer_handle->data[offset++]); |
3063 | 84 | 84 | ||
3064 | === modified file 'src/server/graphics/android/buffer.cpp' | |||
3065 | --- src/server/graphics/android/buffer.cpp 2013-10-15 08:53:10 +0000 | |||
3066 | +++ src/server/graphics/android/buffer.cpp 2013-11-28 12:22:03 +0000 | |||
3067 | @@ -123,7 +123,7 @@ | |||
3068 | 123 | content_lock.unlock(); | 123 | content_lock.unlock(); |
3069 | 124 | }); | 124 | }); |
3070 | 125 | 125 | ||
3072 | 126 | //lock remains in effect until the native handle is released | 126 | //lock remains in effect until the native handle is released |
3073 | 127 | lk.release(); | 127 | lk.release(); |
3074 | 128 | return native_resource; | 128 | return native_resource; |
3075 | 129 | } | 129 | } |
3076 | 130 | 130 | ||
3077 | === modified file 'src/server/graphics/android/display_buffer.h' | |||
3078 | --- src/server/graphics/android/display_buffer.h 2013-11-18 22:44:06 +0000 | |||
3079 | +++ src/server/graphics/android/display_buffer.h 2013-11-28 12:22:03 +0000 | |||
3080 | @@ -46,7 +46,7 @@ | |||
3081 | 46 | void release_current(); | 46 | void release_current(); |
3082 | 47 | void post_update(); | 47 | void post_update(); |
3083 | 48 | bool can_bypass() const override; | 48 | bool can_bypass() const override; |
3085 | 49 | 49 | ||
3086 | 50 | private: | 50 | private: |
3087 | 51 | std::shared_ptr<FramebufferBundle> const fb_bundle; | 51 | std::shared_ptr<FramebufferBundle> const fb_bundle; |
3088 | 52 | std::shared_ptr<DisplayDevice> const display_device; | 52 | std::shared_ptr<DisplayDevice> const display_device; |
3089 | 53 | 53 | ||
3090 | === modified file 'src/server/graphics/android/display_device.h' | |||
3091 | --- src/server/graphics/android/display_device.h 2013-11-21 17:20:14 +0000 | |||
3092 | +++ src/server/graphics/android/display_device.h 2013-11-28 12:22:03 +0000 | |||
3093 | @@ -38,7 +38,7 @@ | |||
3094 | 38 | 38 | ||
3095 | 39 | virtual void mode(MirPowerMode mode) = 0; | 39 | virtual void mode(MirPowerMode mode) = 0; |
3096 | 40 | virtual void prepare_composition() = 0; | 40 | virtual void prepare_composition() = 0; |
3098 | 41 | virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0; | 41 | virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0; |
3099 | 42 | virtual void post(Buffer const& buffer) = 0; | 42 | virtual void post(Buffer const& buffer) = 0; |
3100 | 43 | 43 | ||
3101 | 44 | protected: | 44 | protected: |
3102 | 45 | 45 | ||
3103 | === modified file 'src/server/graphics/android/fb_device.cpp' | |||
3104 | --- src/server/graphics/android/fb_device.cpp 2013-11-21 17:20:14 +0000 | |||
3105 | +++ src/server/graphics/android/fb_device.cpp 2013-11-28 12:22:03 +0000 | |||
3106 | @@ -39,6 +39,8 @@ | |||
3107 | 39 | { | 39 | { |
3108 | 40 | fb_device->setSwapInterval(fb_device.get(), 1); | 40 | fb_device->setSwapInterval(fb_device.get(), 1); |
3109 | 41 | } | 41 | } |
3110 | 42 | |||
3111 | 43 | mode(mir_power_mode_on); | ||
3112 | 42 | } | 44 | } |
3113 | 43 | 45 | ||
3114 | 44 | void mga::FBDevice::prepare_composition() | 46 | void mga::FBDevice::prepare_composition() |
3115 | @@ -65,6 +67,14 @@ | |||
3116 | 65 | 67 | ||
3117 | 66 | void mga::FBDevice::mode(MirPowerMode mode) | 68 | void mga::FBDevice::mode(MirPowerMode mode) |
3118 | 67 | { | 69 | { |
3121 | 68 | // TODO: Implement | 70 | int enable = 0; |
3122 | 69 | (void) mode; | 71 | if (mode == mir_power_mode_on) |
3123 | 72 | { | ||
3124 | 73 | enable = 1; | ||
3125 | 74 | } | ||
3126 | 75 | |||
3127 | 76 | if (fb_device->enableScreen) | ||
3128 | 77 | { | ||
3129 | 78 | fb_device->enableScreen(fb_device.get(), enable); | ||
3130 | 79 | } | ||
3131 | 70 | } | 80 | } |
3132 | 71 | 81 | ||
3133 | === modified file 'src/server/graphics/android/fb_device.h' | |||
3134 | --- src/server/graphics/android/fb_device.h 2013-11-21 17:20:14 +0000 | |||
3135 | +++ src/server/graphics/android/fb_device.h 2013-11-28 12:22:03 +0000 | |||
3136 | @@ -22,7 +22,7 @@ | |||
3137 | 22 | #include "display_device.h" | 22 | #include "display_device.h" |
3138 | 23 | #include <hardware/gralloc.h> | 23 | #include <hardware/gralloc.h> |
3139 | 24 | #include <hardware/fb.h> | 24 | #include <hardware/fb.h> |
3141 | 25 | 25 | ||
3142 | 26 | namespace mir | 26 | namespace mir |
3143 | 27 | { | 27 | { |
3144 | 28 | namespace graphics | 28 | namespace graphics |
3145 | @@ -30,14 +30,14 @@ | |||
3146 | 30 | namespace android | 30 | namespace android |
3147 | 31 | { | 31 | { |
3148 | 32 | 32 | ||
3150 | 33 | class FBDevice : public DisplayDevice | 33 | class FBDevice : public DisplayDevice |
3151 | 34 | { | 34 | { |
3152 | 35 | public: | 35 | public: |
3153 | 36 | FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev); | 36 | FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev); |
3154 | 37 | 37 | ||
3155 | 38 | void mode(MirPowerMode mode); | 38 | void mode(MirPowerMode mode); |
3156 | 39 | void prepare_composition(); | 39 | void prepare_composition(); |
3158 | 40 | void gpu_render(EGLDisplay dpy, EGLSurface sur); | 40 | void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3159 | 41 | void post(Buffer const& buffer); | 41 | void post(Buffer const& buffer); |
3160 | 42 | 42 | ||
3161 | 43 | private: | 43 | private: |
3162 | 44 | 44 | ||
3163 | === modified file 'src/server/graphics/android/framebuffers.cpp' | |||
3164 | --- src/server/graphics/android/framebuffers.cpp 2013-11-21 17:20:14 +0000 | |||
3165 | +++ src/server/graphics/android/framebuffers.cpp 2013-11-28 12:22:03 +0000 | |||
3166 | @@ -55,7 +55,7 @@ | |||
3167 | 55 | { | 55 | { |
3168 | 56 | int visual_id; | 56 | int visual_id; |
3169 | 57 | eglGetConfigAttrib(egl_display, fb_egl_config, EGL_NATIVE_VISUAL_ID, &visual_id); | 57 | eglGetConfigAttrib(egl_display, fb_egl_config, EGL_NATIVE_VISUAL_ID, &visual_id); |
3171 | 58 | fb_format = mga::to_mir_format(visual_id); | 58 | fb_format = mga::to_mir_format(visual_id); |
3172 | 59 | } | 59 | } |
3173 | 60 | else | 60 | else |
3174 | 61 | { | 61 | { |
3175 | @@ -76,7 +76,7 @@ | |||
3176 | 76 | auto rc = hwc_device->getDisplayConfigs(hwc_device.get(), HWC_DISPLAY_PRIMARY, &primary_display_config, &num_configs); | 76 | auto rc = hwc_device->getDisplayConfigs(hwc_device.get(), HWC_DISPLAY_PRIMARY, &primary_display_config, &num_configs); |
3177 | 77 | if (rc != 0) | 77 | if (rc != 0) |
3178 | 78 | { | 78 | { |
3180 | 79 | BOOST_THROW_EXCEPTION(std::runtime_error("could not determine hwc display config")); | 79 | BOOST_THROW_EXCEPTION(std::runtime_error("could not determine hwc display config")); |
3181 | 80 | } | 80 | } |
3182 | 81 | static uint32_t size_request[3] = { HWC_DISPLAY_WIDTH, | 81 | static uint32_t size_request[3] = { HWC_DISPLAY_WIDTH, |
3183 | 82 | HWC_DISPLAY_HEIGHT, | 82 | HWC_DISPLAY_HEIGHT, |
3184 | @@ -94,7 +94,7 @@ | |||
3185 | 94 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, | 94 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, |
3186 | 95 | std::shared_ptr<hwc_composer_device_1> const& hwc) | 95 | std::shared_ptr<hwc_composer_device_1> const& hwc) |
3187 | 96 | : format(determine_hwc11_fb_format()), | 96 | : format(determine_hwc11_fb_format()), |
3189 | 97 | size(determine_hwc11_size(hwc)) | 97 | size(determine_hwc11_size(hwc)) |
3190 | 98 | { | 98 | { |
3191 | 99 | for(auto i = 0u; i < 2; i++) | 99 | for(auto i = 0u; i < 2; i++) |
3192 | 100 | { | 100 | { |
3193 | @@ -106,7 +106,7 @@ | |||
3194 | 106 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, | 106 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, |
3195 | 107 | std::shared_ptr<framebuffer_device_t> const& fb) | 107 | std::shared_ptr<framebuffer_device_t> const& fb) |
3196 | 108 | : format{mga::to_mir_format(fb->format)}, | 108 | : format{mga::to_mir_format(fb->format)}, |
3198 | 109 | size({fb->width, fb->height}) | 109 | size({fb->width, fb->height}) |
3199 | 110 | { | 110 | { |
3200 | 111 | //guarantee always 2 fb's allocated | 111 | //guarantee always 2 fb's allocated |
3201 | 112 | auto fb_num = static_cast<unsigned int>(fb->numFramebuffers); | 112 | auto fb_num = static_cast<unsigned int>(fb->numFramebuffers); |
3202 | @@ -154,5 +154,5 @@ | |||
3203 | 154 | 154 | ||
3204 | 155 | void mga::Framebuffers::wait_for_consumed_buffer(bool) | 155 | void mga::Framebuffers::wait_for_consumed_buffer(bool) |
3205 | 156 | { | 156 | { |
3207 | 157 | //TODO: change swapping so buffer_for_render() does not wait | 157 | //TODO: change swapping so buffer_for_render() does not wait |
3208 | 158 | } | 158 | } |
3209 | 159 | 159 | ||
3210 | === modified file 'src/server/graphics/android/gl_context.cpp' | |||
3211 | --- src/server/graphics/android/gl_context.cpp 2013-11-15 20:34:17 +0000 | |||
3212 | +++ src/server/graphics/android/gl_context.cpp 2013-11-28 12:22:03 +0000 | |||
3213 | @@ -115,7 +115,7 @@ | |||
3214 | 115 | eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)}, | 115 | eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)}, |
3215 | 116 | egl_surface{egl_display, | 116 | egl_surface{egl_display, |
3216 | 117 | eglCreatePbufferSurface(egl_display, egl_config, dummy_pbuffer_attribs)} | 117 | eglCreatePbufferSurface(egl_display, egl_config, dummy_pbuffer_attribs)} |
3218 | 118 | { | 118 | { |
3219 | 119 | report.report_egl_configuration(egl_display, egl_config); | 119 | report.report_egl_configuration(egl_display, egl_config); |
3220 | 120 | } | 120 | } |
3221 | 121 | 121 | ||
3222 | 122 | 122 | ||
3223 | === modified file 'src/server/graphics/android/hwc10_device.h' | |||
3224 | --- src/server/graphics/android/hwc10_device.h 2013-11-21 17:20:14 +0000 | |||
3225 | +++ src/server/graphics/android/hwc10_device.h 2013-11-28 12:22:03 +0000 | |||
3226 | @@ -39,7 +39,7 @@ | |||
3227 | 39 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 39 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3228 | 40 | 40 | ||
3229 | 41 | void prepare_composition(); | 41 | void prepare_composition(); |
3231 | 42 | void gpu_render(EGLDisplay dpy, EGLSurface sur); | 42 | void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3232 | 43 | void post(Buffer const& buffer); | 43 | void post(Buffer const& buffer); |
3233 | 44 | 44 | ||
3234 | 45 | private: | 45 | private: |
3235 | 46 | 46 | ||
3236 | === modified file 'src/server/graphics/android/hwc11_device.h' | |||
3237 | --- src/server/graphics/android/hwc11_device.h 2013-11-21 17:20:14 +0000 | |||
3238 | +++ src/server/graphics/android/hwc11_device.h 2013-11-28 12:22:03 +0000 | |||
3239 | @@ -43,7 +43,7 @@ | |||
3240 | 43 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 43 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3241 | 44 | 44 | ||
3242 | 45 | void prepare_composition(); | 45 | void prepare_composition(); |
3244 | 46 | void gpu_render(EGLDisplay dpy, EGLSurface sur); | 46 | void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3245 | 47 | void post(Buffer const& buffer); | 47 | void post(Buffer const& buffer); |
3246 | 48 | 48 | ||
3247 | 49 | private: | 49 | private: |
3248 | 50 | 50 | ||
3249 | === modified file 'src/server/graphics/android/hwc_common_device.cpp' | |||
3250 | --- src/server/graphics/android/hwc_common_device.cpp 2013-11-21 17:20:14 +0000 | |||
3251 | +++ src/server/graphics/android/hwc_common_device.cpp 2013-11-28 12:22:03 +0000 | |||
3252 | @@ -77,18 +77,18 @@ | |||
3253 | 77 | 77 | ||
3254 | 78 | //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off | 78 | //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off |
3255 | 79 | // are all treated like mir_power_mode_off | 79 | // are all treated like mir_power_mode_off |
3257 | 80 | if ((mode_request == mir_power_mode_suspend) || | 80 | if ((mode_request == mir_power_mode_suspend) || |
3258 | 81 | (mode_request == mir_power_mode_standby)) | 81 | (mode_request == mir_power_mode_standby)) |
3259 | 82 | { | 82 | { |
3260 | 83 | mode_request = mir_power_mode_off; | 83 | mode_request = mir_power_mode_off; |
3261 | 84 | } | 84 | } |
3262 | 85 | 85 | ||
3264 | 86 | if ((mode_request == mir_power_mode_on) && | 86 | if ((mode_request == mir_power_mode_on) && |
3265 | 87 | (current_mode == mir_power_mode_off)) | 87 | (current_mode == mir_power_mode_off)) |
3266 | 88 | { | 88 | { |
3267 | 89 | err = turn_screen_on(); | 89 | err = turn_screen_on(); |
3268 | 90 | } | 90 | } |
3270 | 91 | else if ((mode_request == mir_power_mode_off) && | 91 | else if ((mode_request == mir_power_mode_off) && |
3271 | 92 | (current_mode == mir_power_mode_on)) | 92 | (current_mode == mir_power_mode_on)) |
3272 | 93 | { | 93 | { |
3273 | 94 | err = turn_screen_off(); | 94 | err = turn_screen_off(); |
3274 | @@ -96,15 +96,15 @@ | |||
3275 | 96 | 96 | ||
3276 | 97 | if (err) | 97 | if (err) |
3277 | 98 | { | 98 | { |
3279 | 99 | std::string blanking_status_msg = "Could not " + | 99 | std::string blanking_status_msg = "Could not " + |
3280 | 100 | ((mode_request == mir_power_mode_off) ? std::string("blank") : std::string("unblank")) + " display"; | 100 | ((mode_request == mir_power_mode_off) ? std::string("blank") : std::string("unblank")) + " display"; |
3281 | 101 | BOOST_THROW_EXCEPTION( | 101 | BOOST_THROW_EXCEPTION( |
3282 | 102 | boost::enable_error_info( | 102 | boost::enable_error_info( |
3283 | 103 | std::runtime_error(blanking_status_msg)) << | 103 | std::runtime_error(blanking_status_msg)) << |
3284 | 104 | boost::errinfo_errno(-err)); | 104 | boost::errinfo_errno(-err)); |
3285 | 105 | } | 105 | } |
3288 | 106 | 106 | ||
3289 | 107 | current_mode = mode_request; | 107 | current_mode = mode_request; |
3290 | 108 | blanked_cond.notify_all(); | 108 | blanked_cond.notify_all(); |
3291 | 109 | } | 109 | } |
3292 | 110 | 110 | ||
3293 | 111 | 111 | ||
3294 | === modified file 'src/server/graphics/android/hwc_common_device.h' | |||
3295 | --- src/server/graphics/android/hwc_common_device.h 2013-11-21 17:20:14 +0000 | |||
3296 | +++ src/server/graphics/android/hwc_common_device.h 2013-11-28 12:22:03 +0000 | |||
3297 | @@ -65,7 +65,7 @@ | |||
3298 | 65 | 65 | ||
3299 | 66 | std::mutex blanked_mutex; | 66 | std::mutex blanked_mutex; |
3300 | 67 | std::condition_variable blanked_cond; | 67 | std::condition_variable blanked_cond; |
3302 | 68 | MirPowerMode current_mode; | 68 | MirPowerMode current_mode; |
3303 | 69 | }; | 69 | }; |
3304 | 70 | 70 | ||
3305 | 71 | } | 71 | } |
3306 | 72 | 72 | ||
3307 | === modified file 'src/server/graphics/android/hwc_layerlist.cpp' | |||
3308 | --- src/server/graphics/android/hwc_layerlist.cpp 2013-11-21 03:16:21 +0000 | |||
3309 | +++ src/server/graphics/android/hwc_layerlist.cpp 2013-11-28 12:22:03 +0000 | |||
3310 | @@ -28,14 +28,14 @@ | |||
3311 | 28 | 28 | ||
3312 | 29 | mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer) | 29 | mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer) |
3313 | 30 | { | 30 | { |
3315 | 31 | memcpy(this, &layer, sizeof(HWCLayer)); | 31 | memcpy(this, &layer, sizeof(HWCLayer)); |
3316 | 32 | this->visibleRegionScreen = {1, &this->visible_rect}; | 32 | this->visibleRegionScreen = {1, &this->visible_rect}; |
3318 | 33 | return *this; | 33 | return *this; |
3319 | 34 | } | 34 | } |
3320 | 35 | 35 | ||
3321 | 36 | mga::HWCLayer::HWCLayer(HWCLayer const& layer) | 36 | mga::HWCLayer::HWCLayer(HWCLayer const& layer) |
3322 | 37 | { | 37 | { |
3324 | 38 | memcpy(this, &layer, sizeof(HWCLayer)); | 38 | memcpy(this, &layer, sizeof(HWCLayer)); |
3325 | 39 | this->visibleRegionScreen = {1, &this->visible_rect}; | 39 | this->visibleRegionScreen = {1, &this->visible_rect}; |
3326 | 40 | } | 40 | } |
3327 | 41 | 41 | ||
3328 | @@ -59,6 +59,8 @@ | |||
3329 | 59 | visibleRegionScreen.numRects=1; | 59 | visibleRegionScreen.numRects=1; |
3330 | 60 | visibleRegionScreen.rects= &visible_rect; | 60 | visibleRegionScreen.rects= &visible_rect; |
3331 | 61 | handle = buffer_handle; | 61 | handle = buffer_handle; |
3332 | 62 | |||
3333 | 63 | memset(&reserved, 0, sizeof(reserved)); | ||
3334 | 62 | } | 64 | } |
3335 | 63 | 65 | ||
3336 | 64 | mga::FramebufferLayer::FramebufferLayer() | 66 | mga::FramebufferLayer::FramebufferLayer() |
3337 | @@ -92,7 +94,7 @@ | |||
3338 | 92 | auto i = 0u; | 94 | auto i = 0u; |
3339 | 93 | for(auto& layer : layer_list) | 95 | for(auto& layer : layer_list) |
3340 | 94 | { | 96 | { |
3342 | 95 | hwc_representation->hwLayers[i++] = layer; | 97 | hwc_representation->hwLayers[i++] = layer; |
3343 | 96 | } | 98 | } |
3344 | 97 | hwc_representation->numHwLayers = layer_list.size(); | 99 | hwc_representation->numHwLayers = layer_list.size(); |
3345 | 98 | hwc_representation->retireFenceFd = -1; | 100 | hwc_representation->retireFenceFd = -1; |
3346 | @@ -102,7 +104,7 @@ | |||
3347 | 102 | //these fields are deprecated in hwc1.1 and later. | 104 | //these fields are deprecated in hwc1.1 and later. |
3348 | 103 | hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF); | 105 | hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF); |
3349 | 104 | hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE); | 106 | hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE); |
3351 | 105 | 107 | ||
3352 | 106 | } | 108 | } |
3353 | 107 | 109 | ||
3354 | 108 | void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer) | 110 | void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer) |
3355 | @@ -119,7 +121,7 @@ | |||
3356 | 119 | mga::NativeFence mga::LayerList::framebuffer_fence() | 121 | mga::NativeFence mga::LayerList::framebuffer_fence() |
3357 | 120 | { | 122 | { |
3358 | 121 | auto fb_position = hwc_representation->numHwLayers - 1; | 123 | auto fb_position = hwc_representation->numHwLayers - 1; |
3360 | 122 | return hwc_representation->hwLayers[fb_position].releaseFenceFd; | 124 | return hwc_representation->hwLayers[fb_position].releaseFenceFd; |
3361 | 123 | } | 125 | } |
3362 | 124 | 126 | ||
3363 | 125 | hwc_display_contents_1_t* mga::LayerList::native_list() const | 127 | hwc_display_contents_1_t* mga::LayerList::native_list() const |
3364 | 126 | 128 | ||
3365 | === modified file 'src/server/graphics/android/hwc_vsync.cpp' | |||
3366 | --- src/server/graphics/android/hwc_vsync.cpp 2013-05-16 19:16:56 +0000 | |||
3367 | +++ src/server/graphics/android/hwc_vsync.cpp 2013-11-28 12:22:03 +0000 | |||
3368 | @@ -23,7 +23,7 @@ | |||
3369 | 23 | : vsync_occurred(false) | 23 | : vsync_occurred(false) |
3370 | 24 | { | 24 | { |
3371 | 25 | } | 25 | } |
3373 | 26 | 26 | ||
3374 | 27 | void mga::HWCVsync::wait_for_vsync() | 27 | void mga::HWCVsync::wait_for_vsync() |
3375 | 28 | { | 28 | { |
3376 | 29 | std::unique_lock<std::mutex> lk(vsync_wait_mutex); | 29 | std::unique_lock<std::mutex> lk(vsync_wait_mutex); |
3377 | 30 | 30 | ||
3378 | === modified file 'src/server/graphics/android/hwc_vsync.h' | |||
3379 | --- src/server/graphics/android/hwc_vsync.h 2013-05-16 19:04:50 +0000 | |||
3380 | +++ src/server/graphics/android/hwc_vsync.h 2013-11-28 12:22:03 +0000 | |||
3381 | @@ -34,7 +34,7 @@ | |||
3382 | 34 | { | 34 | { |
3383 | 35 | public: | 35 | public: |
3384 | 36 | HWCVsync(); | 36 | HWCVsync(); |
3386 | 37 | 37 | ||
3387 | 38 | void wait_for_vsync(); | 38 | void wait_for_vsync(); |
3388 | 39 | void notify_vsync(); | 39 | void notify_vsync(); |
3389 | 40 | private: | 40 | private: |
3390 | 41 | 41 | ||
3391 | === modified file 'src/server/graphics/android/hwc_vsync_coordinator.h' | |||
3392 | --- src/server/graphics/android/hwc_vsync_coordinator.h 2013-05-20 15:29:28 +0000 | |||
3393 | +++ src/server/graphics/android/hwc_vsync_coordinator.h 2013-11-28 12:22:03 +0000 | |||
3394 | @@ -30,7 +30,7 @@ | |||
3395 | 30 | { | 30 | { |
3396 | 31 | public: | 31 | public: |
3397 | 32 | virtual ~HWCVsyncCoordinator() = default; | 32 | virtual ~HWCVsyncCoordinator() = default; |
3399 | 33 | 33 | ||
3400 | 34 | virtual void wait_for_vsync() = 0; | 34 | virtual void wait_for_vsync() = 0; |
3401 | 35 | virtual void notify_vsync() = 0; | 35 | virtual void notify_vsync() = 0; |
3402 | 36 | 36 | ||
3403 | 37 | 37 | ||
3404 | === modified file 'src/server/graphics/android/internal_client.cpp' | |||
3405 | --- src/server/graphics/android/internal_client.cpp 2013-09-20 13:19:03 +0000 | |||
3406 | +++ src/server/graphics/android/internal_client.cpp 2013-11-28 12:22:03 +0000 | |||
3407 | @@ -37,7 +37,7 @@ | |||
3408 | 37 | if (!client_windows[surface]) | 37 | if (!client_windows[surface]) |
3409 | 38 | { | 38 | { |
3410 | 39 | auto cache = std::make_shared<mga::InterpreterCache>(); | 39 | auto cache = std::make_shared<mga::InterpreterCache>(); |
3412 | 40 | auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache); | 40 | auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache); |
3413 | 41 | client_windows[surface] = std::make_shared<mga::MirNativeWindow>(interpreter); | 41 | client_windows[surface] = std::make_shared<mga::MirNativeWindow>(interpreter); |
3414 | 42 | } | 42 | } |
3415 | 43 | 43 | ||
3416 | 44 | 44 | ||
3417 | === modified file 'src/server/graphics/android/internal_client_window.cpp' | |||
3418 | --- src/server/graphics/android/internal_client_window.cpp 2013-10-15 08:53:10 +0000 | |||
3419 | +++ src/server/graphics/android/internal_client_window.cpp 2013-11-28 12:22:03 +0000 | |||
3420 | @@ -40,7 +40,8 @@ | |||
3421 | 40 | 40 | ||
3422 | 41 | mg::NativeBuffer* mga::InternalClientWindow::driver_requests_buffer() | 41 | mg::NativeBuffer* mga::InternalClientWindow::driver_requests_buffer() |
3423 | 42 | { | 42 | { |
3425 | 43 | auto buffer = surface->advance_client_buffer(); | 43 | std::shared_ptr<graphics::Buffer> buffer; |
3426 | 44 | surface->swap_buffers(buffer); | ||
3427 | 44 | auto handle = buffer->native_buffer_handle(); | 45 | auto handle = buffer->native_buffer_handle(); |
3428 | 45 | resource_cache->store_buffer(buffer, handle); | 46 | resource_cache->store_buffer(buffer, handle); |
3429 | 46 | return handle.get(); | 47 | return handle.get(); |
3430 | @@ -74,7 +75,7 @@ | |||
3431 | 74 | case NATIVE_WINDOW_FORMAT: | 75 | case NATIVE_WINDOW_FORMAT: |
3432 | 75 | return format; | 76 | return format; |
3433 | 76 | case NATIVE_WINDOW_TRANSFORM_HINT: | 77 | case NATIVE_WINDOW_TRANSFORM_HINT: |
3435 | 77 | return 0; | 78 | return 0; |
3436 | 78 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: | 79 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: |
3437 | 79 | return 1; | 80 | return 1; |
3438 | 80 | default: | 81 | default: |
3439 | 81 | 82 | ||
3440 | === modified file 'src/server/graphics/android/internal_client_window.h' | |||
3441 | --- src/server/graphics/android/internal_client_window.h 2013-10-15 08:53:10 +0000 | |||
3442 | +++ src/server/graphics/android/internal_client_window.h 2013-11-28 12:22:03 +0000 | |||
3443 | @@ -42,7 +42,7 @@ | |||
3444 | 42 | void driver_returns_buffer(ANativeWindowBuffer*, int); | 42 | void driver_returns_buffer(ANativeWindowBuffer*, int); |
3445 | 43 | void dispatch_driver_request_format(int); | 43 | void dispatch_driver_request_format(int); |
3446 | 44 | int driver_requests_info(int) const; | 44 | int driver_requests_info(int) const; |
3448 | 45 | void sync_to_display(bool sync); | 45 | void sync_to_display(bool sync); |
3449 | 46 | 46 | ||
3450 | 47 | private: | 47 | private: |
3451 | 48 | std::shared_ptr<InternalSurface> const surface; | 48 | std::shared_ptr<InternalSurface> const surface; |
3452 | 49 | 49 | ||
3453 | === modified file 'src/server/graphics/android/interpreter_cache.cpp' | |||
3454 | --- src/server/graphics/android/interpreter_cache.cpp 2013-10-15 08:53:10 +0000 | |||
3455 | +++ src/server/graphics/android/interpreter_cache.cpp 2013-11-28 12:22:03 +0000 | |||
3456 | @@ -34,7 +34,7 @@ | |||
3457 | 34 | 34 | ||
3458 | 35 | std::shared_ptr<mg::Buffer> mga::InterpreterCache::retrieve_buffer(ANativeWindowBuffer* returned_handle) | 35 | std::shared_ptr<mg::Buffer> mga::InterpreterCache::retrieve_buffer(ANativeWindowBuffer* returned_handle) |
3459 | 36 | { | 36 | { |
3461 | 37 | auto buffer_it = buffers_in_driver.find(returned_handle); | 37 | auto buffer_it = buffers_in_driver.find(returned_handle); |
3462 | 38 | auto native_it = native_buffers.find(returned_handle); | 38 | auto native_it = native_buffers.find(returned_handle); |
3463 | 39 | 39 | ||
3464 | 40 | if ((buffer_it == buffers_in_driver.end()) || | 40 | if ((buffer_it == buffers_in_driver.end()) || |
3465 | 41 | 41 | ||
3466 | === modified file 'src/server/graphics/android/output_builder.cpp' | |||
3467 | --- src/server/graphics/android/output_builder.cpp 2013-11-21 17:20:14 +0000 | |||
3468 | +++ src/server/graphics/android/output_builder.cpp 2013-11-28 12:22:03 +0000 | |||
3469 | @@ -75,7 +75,7 @@ | |||
3470 | 75 | 75 | ||
3471 | 76 | std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device() | 76 | std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device() |
3472 | 77 | { | 77 | { |
3474 | 78 | std::shared_ptr<mga::DisplayDevice> device; | 78 | std::shared_ptr<mga::DisplayDevice> device; |
3475 | 79 | if (force_backup_display) | 79 | if (force_backup_display) |
3476 | 80 | { | 80 | { |
3477 | 81 | device = res_factory->create_fb_device(fb_native); | 81 | device = res_factory->create_fb_device(fb_native); |
3478 | @@ -104,5 +104,5 @@ | |||
3479 | 104 | { | 104 | { |
3480 | 105 | auto native_window = res_factory->create_native_window(framebuffers); | 105 | auto native_window = res_factory->create_native_window(framebuffers); |
3481 | 106 | return std::unique_ptr<mg::DisplayBuffer>( | 106 | return std::unique_ptr<mg::DisplayBuffer>( |
3483 | 107 | new DisplayBuffer(framebuffers, display_device, native_window, gl_context)); | 107 | new DisplayBuffer(framebuffers, display_device, native_window, gl_context)); |
3484 | 108 | } | 108 | } |
3485 | 109 | 109 | ||
3486 | === modified file 'src/server/graphics/android/resource_factory.cpp' | |||
3487 | --- src/server/graphics/android/resource_factory.cpp 2013-11-21 17:20:14 +0000 | |||
3488 | +++ src/server/graphics/android/resource_factory.cpp 2013-11-28 12:22:03 +0000 | |||
3489 | @@ -45,7 +45,7 @@ | |||
3490 | 45 | auto rc = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); | 45 | auto rc = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); |
3491 | 46 | if ((rc != 0) || (module == nullptr) || (framebuffer_open(module, &fbdev_raw) != 0) ) | 46 | if ((rc != 0) || (module == nullptr) || (framebuffer_open(module, &fbdev_raw) != 0) ) |
3492 | 47 | { | 47 | { |
3494 | 48 | BOOST_THROW_EXCEPTION(std::runtime_error("display factory cannot create fb display")); | 48 | BOOST_THROW_EXCEPTION(std::runtime_error("display factory cannot create fb display")); |
3495 | 49 | } | 49 | } |
3496 | 50 | 50 | ||
3497 | 51 | return std::shared_ptr<framebuffer_device_t>(fbdev_raw, | 51 | return std::shared_ptr<framebuffer_device_t>(fbdev_raw, |
3498 | @@ -65,7 +65,7 @@ | |||
3499 | 65 | module->methods->open(module, HWC_HARDWARE_COMPOSER, reinterpret_cast<hw_device_t**>(&hwc_device_raw)) || | 65 | module->methods->open(module, HWC_HARDWARE_COMPOSER, reinterpret_cast<hw_device_t**>(&hwc_device_raw)) || |
3500 | 66 | (hwc_device_raw == nullptr)) | 66 | (hwc_device_raw == nullptr)) |
3501 | 67 | { | 67 | { |
3503 | 68 | BOOST_THROW_EXCEPTION(std::runtime_error("error opening hwc hal")); | 68 | BOOST_THROW_EXCEPTION(std::runtime_error("error opening hwc hal")); |
3504 | 69 | } | 69 | } |
3505 | 70 | 70 | ||
3506 | 71 | return std::shared_ptr<hwc_composer_device_1>( | 71 | return std::shared_ptr<hwc_composer_device_1>( |
3507 | @@ -78,7 +78,7 @@ | |||
3508 | 78 | { | 78 | { |
3509 | 79 | auto cache = std::make_shared<mga::InterpreterCache>(); | 79 | auto cache = std::make_shared<mga::InterpreterCache>(); |
3510 | 80 | auto interpreter = std::make_shared<ServerRenderWindow>(fb_bundle, cache); | 80 | auto interpreter = std::make_shared<ServerRenderWindow>(fb_bundle, cache); |
3512 | 81 | return std::make_shared<MirNativeWindow>(interpreter); | 81 | return std::make_shared<MirNativeWindow>(interpreter); |
3513 | 82 | } | 82 | } |
3514 | 83 | 83 | ||
3515 | 84 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_fb_device( | 84 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_fb_device( |
3516 | 85 | 85 | ||
3517 | === modified file 'src/server/graphics/android/server_render_window.cpp' | |||
3518 | --- src/server/graphics/android/server_render_window.cpp 2013-11-21 17:20:14 +0000 | |||
3519 | +++ src/server/graphics/android/server_render_window.cpp 2013-11-28 12:22:03 +0000 | |||
3520 | @@ -77,7 +77,7 @@ | |||
3521 | 77 | case NATIVE_WINDOW_FORMAT: | 77 | case NATIVE_WINDOW_FORMAT: |
3522 | 78 | return format; | 78 | return format; |
3523 | 79 | case NATIVE_WINDOW_TRANSFORM_HINT: | 79 | case NATIVE_WINDOW_TRANSFORM_HINT: |
3525 | 80 | return 0; | 80 | return 0; |
3526 | 81 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: | 81 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: |
3527 | 82 | return 1; | 82 | return 1; |
3528 | 83 | default: | 83 | default: |
3529 | 84 | 84 | ||
3530 | === modified file 'src/server/graphics/android/server_render_window.h' | |||
3531 | --- src/server/graphics/android/server_render_window.h 2013-11-21 17:20:14 +0000 | |||
3532 | +++ src/server/graphics/android/server_render_window.h 2013-11-28 12:22:03 +0000 | |||
3533 | @@ -34,7 +34,7 @@ | |||
3534 | 34 | 34 | ||
3535 | 35 | class FramebufferBundle; | 35 | class FramebufferBundle; |
3536 | 36 | class InterpreterResourceCache; | 36 | class InterpreterResourceCache; |
3538 | 37 | class ServerRenderWindow : public AndroidDriverInterpreter | 37 | class ServerRenderWindow : public AndroidDriverInterpreter |
3539 | 38 | { | 38 | { |
3540 | 39 | public: | 39 | public: |
3541 | 40 | ServerRenderWindow(std::shared_ptr<FramebufferBundle> const& fb_bundle, | 40 | ServerRenderWindow(std::shared_ptr<FramebufferBundle> const& fb_bundle, |
3542 | @@ -50,7 +50,7 @@ | |||
3543 | 50 | std::shared_ptr<FramebufferBundle> const fb_bundle; | 50 | std::shared_ptr<FramebufferBundle> const fb_bundle; |
3544 | 51 | std::shared_ptr<InterpreterResourceCache> const resource_cache; | 51 | std::shared_ptr<InterpreterResourceCache> const resource_cache; |
3545 | 52 | int format; | 52 | int format; |
3547 | 53 | }; | 53 | }; |
3548 | 54 | 54 | ||
3549 | 55 | } | 55 | } |
3550 | 56 | } | 56 | } |
3551 | 57 | 57 | ||
3552 | === modified file 'src/server/graphics/gbm/CMakeLists.txt' | |||
3553 | --- src/server/graphics/gbm/CMakeLists.txt 2013-11-21 03:16:21 +0000 | |||
3554 | +++ src/server/graphics/gbm/CMakeLists.txt 2013-11-28 12:22:03 +0000 | |||
3555 | @@ -15,7 +15,7 @@ | |||
3556 | 15 | mirplatformgraphics SHARED | 15 | mirplatformgraphics SHARED |
3557 | 16 | 16 | ||
3558 | 17 | gbm_platform.cpp | 17 | gbm_platform.cpp |
3560 | 18 | gbm_buffer_allocator.cpp | 18 | buffer_allocator.cpp |
3561 | 19 | gbm_buffer.cpp | 19 | gbm_buffer.cpp |
3562 | 20 | gbm_cursor.cpp | 20 | gbm_cursor.cpp |
3563 | 21 | gbm_display_helpers.cpp | 21 | gbm_display_helpers.cpp |
3564 | @@ -34,6 +34,8 @@ | |||
3565 | 34 | udev_wrapper.cpp | 34 | udev_wrapper.cpp |
3566 | 35 | overlapping_output_grouping.cpp | 35 | overlapping_output_grouping.cpp |
3567 | 36 | native_gbm_platform.cpp | 36 | native_gbm_platform.cpp |
3568 | 37 | anonymous_shm_file.cpp | ||
3569 | 38 | shm_buffer.cpp | ||
3570 | 37 | ) | 39 | ) |
3571 | 38 | 40 | ||
3572 | 39 | target_link_libraries( | 41 | target_link_libraries( |
3573 | 40 | 42 | ||
3574 | === added file 'src/server/graphics/gbm/anonymous_shm_file.cpp' | |||
3575 | --- src/server/graphics/gbm/anonymous_shm_file.cpp 1970-01-01 00:00:00 +0000 | |||
3576 | +++ src/server/graphics/gbm/anonymous_shm_file.cpp 2013-11-28 12:22:03 +0000 | |||
3577 | @@ -0,0 +1,129 @@ | |||
3578 | 1 | /* | ||
3579 | 2 | * Copyright © 2013 Canonical Ltd. | ||
3580 | 3 | * | ||
3581 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3582 | 5 | * under the terms of the GNU General Public License version 3, | ||
3583 | 6 | * as published by the Free Software Foundation. | ||
3584 | 7 | * | ||
3585 | 8 | * This program is distributed in the hope that it will be useful, | ||
3586 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3587 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3588 | 11 | * GNU General Public License for more details. | ||
3589 | 12 | * | ||
3590 | 13 | * You should have received a copy of the GNU General Public License | ||
3591 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3592 | 15 | * | ||
3593 | 16 | * Authored by: | ||
3594 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
3595 | 18 | */ | ||
3596 | 19 | |||
3597 | 20 | #include "anonymous_shm_file.h" | ||
3598 | 21 | |||
3599 | 22 | #include <boost/throw_exception.hpp> | ||
3600 | 23 | #include <stdexcept> | ||
3601 | 24 | |||
3602 | 25 | #include <vector> | ||
3603 | 26 | |||
3604 | 27 | #include <cstdlib> | ||
3605 | 28 | #include <cstring> | ||
3606 | 29 | #include <sys/mman.h> | ||
3607 | 30 | #include <fcntl.h> | ||
3608 | 31 | |||
3609 | 32 | namespace mgg = mir::graphics::gbm; | ||
3610 | 33 | |||
3611 | 34 | namespace | ||
3612 | 35 | { | ||
3613 | 36 | |||
3614 | 37 | mgg::detail::FdHandle create_anonymous_file(size_t size) | ||
3615 | 38 | { | ||
3616 | 39 | char const* const tmpl = "/mir-buffer-XXXXXX"; | ||
3617 | 40 | char const* const runtime_dir = getenv("XDG_RUNTIME_DIR"); | ||
3618 | 41 | char const* const target_dir = runtime_dir ? runtime_dir : "/tmp"; | ||
3619 | 42 | |||
3620 | 43 | /* We need a mutable array for mkostemp */ | ||
3621 | 44 | std::vector<char> path(target_dir, target_dir + strlen(target_dir)); | ||
3622 | 45 | path.insert(path.end(), tmpl, tmpl + strlen(tmpl)); | ||
3623 | 46 | path.push_back('\0'); | ||
3624 | 47 | |||
3625 | 48 | mgg::detail::FdHandle fd{mkostemp(path.data(), O_CLOEXEC)}; | ||
3626 | 49 | if (unlink(path.data()) < 0) | ||
3627 | 50 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to unlink temporary file")); | ||
3628 | 51 | if (ftruncate(fd, size) < 0) | ||
3629 | 52 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to resize temporary file")); | ||
3630 | 53 | |||
3631 | 54 | return fd; | ||
3632 | 55 | } | ||
3633 | 56 | |||
3634 | 57 | } | ||
3635 | 58 | |||
3636 | 59 | /************* | ||
3637 | 60 | * FdHandle * | ||
3638 | 61 | *************/ | ||
3639 | 62 | |||
3640 | 63 | mgg::detail::FdHandle::FdHandle(int fd) | ||
3641 | 64 | : fd{fd} | ||
3642 | 65 | { | ||
3643 | 66 | if (fd < 0) | ||
3644 | 67 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create file")); | ||
3645 | 68 | } | ||
3646 | 69 | |||
3647 | 70 | mgg::detail::FdHandle::FdHandle(FdHandle&& other) | ||
3648 | 71 | : fd{other.fd} | ||
3649 | 72 | { | ||
3650 | 73 | other.fd = -1; | ||
3651 | 74 | } | ||
3652 | 75 | |||
3653 | 76 | mgg::detail::FdHandle::~FdHandle() noexcept | ||
3654 | 77 | { | ||
3655 | 78 | if (fd >= 0) | ||
3656 | 79 | close(fd); | ||
3657 | 80 | } | ||
3658 | 81 | |||
3659 | 82 | mgg::detail::FdHandle::operator int() const | ||
3660 | 83 | { | ||
3661 | 84 | return fd; | ||
3662 | 85 | } | ||
3663 | 86 | |||
3664 | 87 | /************* | ||
3665 | 88 | * MapHandle * | ||
3666 | 89 | *************/ | ||
3667 | 90 | |||
3668 | 91 | mgg::detail::MapHandle::MapHandle(int fd, size_t size) | ||
3669 | 92 | : size{size}, | ||
3670 | 93 | mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE, | ||
3671 | 94 | MAP_SHARED, fd, 0)} | ||
3672 | 95 | { | ||
3673 | 96 | if (mapping == MAP_FAILED) | ||
3674 | 97 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to map file")); | ||
3675 | 98 | } | ||
3676 | 99 | |||
3677 | 100 | mgg::detail::MapHandle::~MapHandle() noexcept | ||
3678 | 101 | { | ||
3679 | 102 | munmap(mapping, size); | ||
3680 | 103 | } | ||
3681 | 104 | |||
3682 | 105 | mgg::detail::MapHandle::operator void*() const | ||
3683 | 106 | { | ||
3684 | 107 | return mapping; | ||
3685 | 108 | |||
3686 | 109 | } | ||
3687 | 110 | |||
3688 | 111 | /******************** | ||
3689 | 112 | * AnonymousShmFile * | ||
3690 | 113 | ********************/ | ||
3691 | 114 | |||
3692 | 115 | mgg::AnonymousShmFile::AnonymousShmFile(size_t size) | ||
3693 | 116 | : fd_{create_anonymous_file(size)}, | ||
3694 | 117 | mapping{fd_, size} | ||
3695 | 118 | { | ||
3696 | 119 | } | ||
3697 | 120 | |||
3698 | 121 | void* mgg::AnonymousShmFile::base_ptr() const | ||
3699 | 122 | { | ||
3700 | 123 | return mapping; | ||
3701 | 124 | } | ||
3702 | 125 | |||
3703 | 126 | int mgg::AnonymousShmFile::fd() const | ||
3704 | 127 | { | ||
3705 | 128 | return fd_; | ||
3706 | 129 | } | ||
3707 | 0 | 130 | ||
3708 | === added file 'src/server/graphics/gbm/anonymous_shm_file.h' | |||
3709 | --- src/server/graphics/gbm/anonymous_shm_file.h 1970-01-01 00:00:00 +0000 | |||
3710 | +++ src/server/graphics/gbm/anonymous_shm_file.h 2013-11-28 12:22:03 +0000 | |||
3711 | @@ -0,0 +1,82 @@ | |||
3712 | 1 | /* | ||
3713 | 2 | * Copyright © 2013 Canonical Ltd. | ||
3714 | 3 | * | ||
3715 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3716 | 5 | * under the terms of the GNU General Public License version 3, | ||
3717 | 6 | * as published by the Free Software Foundation. | ||
3718 | 7 | * | ||
3719 | 8 | * This program is distributed in the hope that it will be useful, | ||
3720 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3721 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3722 | 11 | * GNU General Public License for more details. | ||
3723 | 12 | * | ||
3724 | 13 | * You should have received a copy of the GNU General Public License | ||
3725 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3726 | 15 | * | ||
3727 | 16 | * Authored by: | ||
3728 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
3729 | 18 | */ | ||
3730 | 19 | |||
3731 | 20 | #ifndef MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ | ||
3732 | 21 | #define MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ | ||
3733 | 22 | |||
3734 | 23 | #include "shm_file.h" | ||
3735 | 24 | |||
3736 | 25 | namespace mir | ||
3737 | 26 | { | ||
3738 | 27 | namespace graphics | ||
3739 | 28 | { | ||
3740 | 29 | namespace gbm | ||
3741 | 30 | { | ||
3742 | 31 | |||
3743 | 32 | namespace detail | ||
3744 | 33 | { | ||
3745 | 34 | class FdHandle | ||
3746 | 35 | { | ||
3747 | 36 | public: | ||
3748 | 37 | FdHandle(int fd); | ||
3749 | 38 | FdHandle(FdHandle&&); | ||
3750 | 39 | ~FdHandle() noexcept; | ||
3751 | 40 | |||
3752 | 41 | operator int() const; | ||
3753 | 42 | |||
3754 | 43 | private: | ||
3755 | 44 | FdHandle(FdHandle const&) = delete; | ||
3756 | 45 | FdHandle& operator=(FdHandle const&) = delete; | ||
3757 | 46 | int fd; | ||
3758 | 47 | }; | ||
3759 | 48 | |||
3760 | 49 | class MapHandle | ||
3761 | 50 | { | ||
3762 | 51 | public: | ||
3763 | 52 | MapHandle(int fd, size_t size); | ||
3764 | 53 | ~MapHandle() noexcept; | ||
3765 | 54 | |||
3766 | 55 | operator void*() const; | ||
3767 | 56 | |||
3768 | 57 | private: | ||
3769 | 58 | MapHandle(MapHandle const&) = delete; | ||
3770 | 59 | MapHandle& operator=(MapHandle const&) = delete; | ||
3771 | 60 | size_t const size; | ||
3772 | 61 | void* const mapping; | ||
3773 | 62 | }; | ||
3774 | 63 | } | ||
3775 | 64 | |||
3776 | 65 | class AnonymousShmFile : public ShmFile | ||
3777 | 66 | { | ||
3778 | 67 | public: | ||
3779 | 68 | AnonymousShmFile(size_t size); | ||
3780 | 69 | |||
3781 | 70 | void* base_ptr() const; | ||
3782 | 71 | int fd() const; | ||
3783 | 72 | |||
3784 | 73 | private: | ||
3785 | 74 | detail::FdHandle const fd_; | ||
3786 | 75 | detail::MapHandle const mapping; | ||
3787 | 76 | }; | ||
3788 | 77 | |||
3789 | 78 | } | ||
3790 | 79 | } | ||
3791 | 80 | } | ||
3792 | 81 | |||
3793 | 82 | #endif /* MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ */ | ||
3794 | 0 | 83 | ||
3795 | === modified file 'src/server/graphics/gbm/black_arrow.c' | |||
3796 | --- src/server/graphics/gbm/black_arrow.c 2013-06-11 08:10:28 +0000 | |||
3797 | +++ src/server/graphics/gbm/black_arrow.c 2013-11-28 12:22:03 +0000 | |||
3798 | @@ -3,7 +3,7 @@ | |||
3799 | 3 | static const struct { | 3 | static const struct { |
3800 | 4 | unsigned int width; | 4 | unsigned int width; |
3801 | 5 | unsigned int height; | 5 | unsigned int height; |
3803 | 6 | unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ | 6 | unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ |
3804 | 7 | unsigned char pixel_data[64 * 64 * 4 + 1]; | 7 | unsigned char pixel_data[64 * 64 * 4 + 1]; |
3805 | 8 | } black_arrow = { | 8 | } black_arrow = { |
3806 | 9 | 64, 64, 4, | 9 | 64, 64, 4, |
3807 | 10 | 10 | ||
3808 | === renamed file 'src/server/graphics/gbm/gbm_buffer_allocator.cpp' => 'src/server/graphics/gbm/buffer_allocator.cpp' | |||
3809 | --- src/server/graphics/gbm/gbm_buffer_allocator.cpp 2013-11-20 17:13:18 +0000 | |||
3810 | +++ src/server/graphics/gbm/buffer_allocator.cpp 2013-11-28 12:22:03 +0000 | |||
3811 | @@ -17,10 +17,12 @@ | |||
3812 | 17 | * Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | 17 | * Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
3813 | 18 | */ | 18 | */ |
3814 | 19 | 19 | ||
3816 | 20 | #include "gbm_buffer_allocator.h" | 20 | #include "buffer_allocator.h" |
3817 | 21 | #include "gbm_buffer.h" | 21 | #include "gbm_buffer.h" |
3818 | 22 | #include "gbm_platform.h" | 22 | #include "gbm_platform.h" |
3819 | 23 | #include "buffer_texture_binder.h" | 23 | #include "buffer_texture_binder.h" |
3820 | 24 | #include "anonymous_shm_file.h" | ||
3821 | 25 | #include "shm_buffer.h" | ||
3822 | 24 | #include "mir/graphics/buffer_initializer.h" | 26 | #include "mir/graphics/buffer_initializer.h" |
3823 | 25 | #include "mir/graphics/egl_extensions.h" | 27 | #include "mir/graphics/egl_extensions.h" |
3824 | 26 | #include "mir/graphics/buffer_properties.h" | 28 | #include "mir/graphics/buffer_properties.h" |
3825 | @@ -106,12 +108,12 @@ | |||
3826 | 106 | 108 | ||
3827 | 107 | } | 109 | } |
3828 | 108 | 110 | ||
3835 | 109 | mgg::GBMBufferAllocator::GBMBufferAllocator( | 111 | mgg::BufferAllocator::BufferAllocator( |
3836 | 110 | gbm_device* device, | 112 | gbm_device* device, |
3837 | 111 | const std::shared_ptr<BufferInitializer>& buffer_initializer) | 113 | const std::shared_ptr<BufferInitializer>& buffer_initializer) |
3838 | 112 | : device(device), | 114 | : device(device), |
3839 | 113 | buffer_initializer(buffer_initializer), | 115 | buffer_initializer(buffer_initializer), |
3840 | 114 | egl_extensions(std::make_shared<mg::EGLExtensions>()) | 116 | egl_extensions(std::make_shared<mg::EGLExtensions>()) |
3841 | 115 | { | 117 | { |
3842 | 116 | assert(buffer_initializer.get() != 0); | 118 | assert(buffer_initializer.get() != 0); |
3843 | 117 | 119 | ||
3844 | @@ -119,11 +121,25 @@ | |||
3845 | 119 | bypass_env = env ? env[0] != '0' : true; | 121 | bypass_env = env ? env[0] != '0' : true; |
3846 | 120 | } | 122 | } |
3847 | 121 | 123 | ||
3849 | 122 | std::shared_ptr<mg::Buffer> mgg::GBMBufferAllocator::alloc_buffer(BufferProperties const& buffer_properties) | 124 | std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_buffer( |
3850 | 125 | BufferProperties const& buffer_properties) | ||
3851 | 126 | { | ||
3852 | 127 | std::shared_ptr<mg::Buffer> buffer; | ||
3853 | 128 | |||
3854 | 129 | if (buffer_properties.usage == BufferUsage::software) | ||
3855 | 130 | buffer = alloc_software_buffer(buffer_properties); | ||
3856 | 131 | else | ||
3857 | 132 | buffer = alloc_hardware_buffer(buffer_properties); | ||
3858 | 133 | |||
3859 | 134 | return buffer; | ||
3860 | 135 | } | ||
3861 | 136 | |||
3862 | 137 | std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_hardware_buffer( | ||
3863 | 138 | BufferProperties const& buffer_properties) | ||
3864 | 123 | { | 139 | { |
3865 | 124 | uint32_t bo_flags{GBM_BO_USE_RENDERING}; | 140 | uint32_t bo_flags{GBM_BO_USE_RENDERING}; |
3866 | 125 | 141 | ||
3868 | 126 | uint32_t gbm_format = mgg::mir_format_to_gbm_format(buffer_properties.format); | 142 | uint32_t const gbm_format = mgg::mir_format_to_gbm_format(buffer_properties.format); |
3869 | 127 | 143 | ||
3870 | 128 | if (!is_pixel_format_supported(buffer_properties.format) || | 144 | if (!is_pixel_format_supported(buffer_properties.format) || |
3871 | 129 | gbm_format == mgg::invalid_gbm_format) | 145 | gbm_format == mgg::invalid_gbm_format) |
3872 | @@ -132,10 +148,6 @@ | |||
3873 | 132 | std::runtime_error("Trying to create GBM buffer with unsupported pixel format")); | 148 | std::runtime_error("Trying to create GBM buffer with unsupported pixel format")); |
3874 | 133 | } | 149 | } |
3875 | 134 | 150 | ||
3876 | 135 | /* Create the GBM buffer object */ | ||
3877 | 136 | if (buffer_properties.usage == BufferUsage::software) | ||
3878 | 137 | bo_flags |= GBM_BO_USE_WRITE; | ||
3879 | 138 | |||
3880 | 139 | /* | 151 | /* |
3881 | 140 | * Bypass is generally only beneficial to hardware buffers where the | 152 | * Bypass is generally only beneficial to hardware buffers where the |
3882 | 141 | * blitting happens on the GPU. For software buffers it is slower to blit | 153 | * blitting happens on the GPU. For software buffers it is slower to blit |
3883 | @@ -149,7 +161,6 @@ | |||
3884 | 149 | * mir_surface_state_fullscreen later when it's fully wired up. | 161 | * mir_surface_state_fullscreen later when it's fully wired up. |
3885 | 150 | */ | 162 | */ |
3886 | 151 | if (bypass_env && | 163 | if (bypass_env && |
3887 | 152 | buffer_properties.usage == BufferUsage::hardware && | ||
3888 | 153 | buffer_properties.size.width.as_uint32_t() >= 800 && | 164 | buffer_properties.size.width.as_uint32_t() >= 800 && |
3889 | 154 | buffer_properties.size.height.as_uint32_t() >= 600) | 165 | buffer_properties.size.height.as_uint32_t() >= 600) |
3890 | 155 | { | 166 | { |
3891 | @@ -172,14 +183,42 @@ | |||
3892 | 172 | new EGLImageBufferTextureBinder{bo, egl_extensions}}; | 183 | new EGLImageBufferTextureBinder{bo, egl_extensions}}; |
3893 | 173 | 184 | ||
3894 | 174 | /* Create the GBMBuffer */ | 185 | /* Create the GBMBuffer */ |
3903 | 175 | std::shared_ptr<mg::Buffer> buffer{new GBMBuffer{bo, bo_flags, std::move(texture_binder)}}; | 186 | auto const buffer = |
3904 | 176 | 187 | std::make_shared<GBMBuffer>(bo, bo_flags, std::move(texture_binder)); | |
3905 | 177 | (*buffer_initializer)(*buffer); | 188 | |
3906 | 178 | 189 | (*buffer_initializer)(*buffer); | |
3907 | 179 | return buffer; | 190 | |
3908 | 180 | } | 191 | return buffer; |
3909 | 181 | 192 | } | |
3910 | 182 | std::vector<geom::PixelFormat> mgg::GBMBufferAllocator::supported_pixel_formats() | 193 | |
3911 | 194 | std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_software_buffer( | ||
3912 | 195 | BufferProperties const& buffer_properties) | ||
3913 | 196 | { | ||
3914 | 197 | if (!is_pixel_format_supported(buffer_properties.format)) | ||
3915 | 198 | { | ||
3916 | 199 | BOOST_THROW_EXCEPTION( | ||
3917 | 200 | std::runtime_error( | ||
3918 | 201 | "Trying to create SHM buffer with unsupported pixel format")); | ||
3919 | 202 | } | ||
3920 | 203 | |||
3921 | 204 | auto const stride = geom::Stride{ | ||
3922 | 205 | geom::bytes_per_pixel(buffer_properties.format) * | ||
3923 | 206 | buffer_properties.size.width.as_uint32_t()}; | ||
3924 | 207 | size_t const size_in_bytes = | ||
3925 | 208 | stride.as_int() * buffer_properties.size.height.as_int(); | ||
3926 | 209 | auto const shm_file = | ||
3927 | 210 | std::make_shared<mgg::AnonymousShmFile>(size_in_bytes); | ||
3928 | 211 | |||
3929 | 212 | auto const buffer = | ||
3930 | 213 | std::make_shared<ShmBuffer>(shm_file, buffer_properties.size, | ||
3931 | 214 | buffer_properties.format); | ||
3932 | 215 | |||
3933 | 216 | (*buffer_initializer)(*buffer); | ||
3934 | 217 | |||
3935 | 218 | return buffer; | ||
3936 | 219 | } | ||
3937 | 220 | |||
3938 | 221 | std::vector<geom::PixelFormat> mgg::BufferAllocator::supported_pixel_formats() | ||
3939 | 183 | { | 222 | { |
3940 | 184 | static std::vector<geom::PixelFormat> const pixel_formats{ | 223 | static std::vector<geom::PixelFormat> const pixel_formats{ |
3941 | 185 | geom::PixelFormat::argb_8888, | 224 | geom::PixelFormat::argb_8888, |
3942 | @@ -189,7 +228,7 @@ | |||
3943 | 189 | return pixel_formats; | 228 | return pixel_formats; |
3944 | 190 | } | 229 | } |
3945 | 191 | 230 | ||
3947 | 192 | bool mgg::GBMBufferAllocator::is_pixel_format_supported(geom::PixelFormat format) | 231 | bool mgg::BufferAllocator::is_pixel_format_supported(geom::PixelFormat format) |
3948 | 193 | { | 232 | { |
3949 | 194 | auto formats = supported_pixel_formats(); | 233 | auto formats = supported_pixel_formats(); |
3950 | 195 | 234 | ||
3951 | 196 | 235 | ||
3952 | === renamed file 'src/server/graphics/gbm/gbm_buffer_allocator.h' => 'src/server/graphics/gbm/buffer_allocator.h' | |||
3953 | --- src/server/graphics/gbm/gbm_buffer_allocator.h 2013-09-18 14:41:59 +0000 | |||
3954 | +++ src/server/graphics/gbm/buffer_allocator.h 2013-11-28 12:22:03 +0000 | |||
3955 | @@ -16,8 +16,8 @@ | |||
3956 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
3957 | 17 | */ | 17 | */ |
3958 | 18 | 18 | ||
3961 | 19 | #ifndef MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_ | 19 | #ifndef MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_ |
3962 | 20 | #define MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_ | 20 | #define MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_ |
3963 | 21 | 21 | ||
3964 | 22 | #include "mir/graphics/graphic_buffer_allocator.h" | 22 | #include "mir/graphics/graphic_buffer_allocator.h" |
3965 | 23 | #include "mir/graphics/buffer_id.h" | 23 | #include "mir/graphics/buffer_id.h" |
3966 | @@ -38,11 +38,11 @@ | |||
3967 | 38 | 38 | ||
3968 | 39 | namespace gbm | 39 | namespace gbm |
3969 | 40 | { | 40 | { |
3971 | 41 | class GBMBufferAllocator: public graphics::GraphicBufferAllocator | 41 | class BufferAllocator: public graphics::GraphicBufferAllocator |
3972 | 42 | { | 42 | { |
3973 | 43 | public: | 43 | public: |
3976 | 44 | GBMBufferAllocator(gbm_device* device, | 44 | BufferAllocator(gbm_device* device, |
3977 | 45 | const std::shared_ptr<BufferInitializer>& buffer_initializer); | 45 | std::shared_ptr<BufferInitializer> const& buffer_initializer); |
3978 | 46 | 46 | ||
3979 | 47 | virtual std::shared_ptr<Buffer> alloc_buffer( | 47 | virtual std::shared_ptr<Buffer> alloc_buffer( |
3980 | 48 | graphics::BufferProperties const& buffer_properties); | 48 | graphics::BufferProperties const& buffer_properties); |
3981 | @@ -51,6 +51,10 @@ | |||
3982 | 51 | 51 | ||
3983 | 52 | private: | 52 | private: |
3984 | 53 | bool is_pixel_format_supported(geometry::PixelFormat format); | 53 | bool is_pixel_format_supported(geometry::PixelFormat format); |
3985 | 54 | std::shared_ptr<Buffer> alloc_hardware_buffer( | ||
3986 | 55 | graphics::BufferProperties const& buffer_properties); | ||
3987 | 56 | std::shared_ptr<Buffer> alloc_software_buffer( | ||
3988 | 57 | graphics::BufferProperties const& buffer_properties); | ||
3989 | 54 | 58 | ||
3990 | 55 | gbm_device* const device; | 59 | gbm_device* const device; |
3991 | 56 | std::shared_ptr<graphics::BufferInitializer> buffer_initializer; | 60 | std::shared_ptr<graphics::BufferInitializer> buffer_initializer; |
3992 | @@ -63,4 +67,4 @@ | |||
3993 | 63 | } | 67 | } |
3994 | 64 | } | 68 | } |
3995 | 65 | 69 | ||
3997 | 66 | #endif // MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_ | 70 | #endif // MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_ |
3998 | 67 | 71 | ||
3999 | === modified file 'src/server/graphics/gbm/gbm_buffer.cpp' | |||
4000 | --- src/server/graphics/gbm/gbm_buffer.cpp 2013-11-21 03:16:21 +0000 | |||
4001 | +++ src/server/graphics/gbm/gbm_buffer.cpp 2013-11-28 12:22:03 +0000 | |||
4002 | @@ -86,7 +86,7 @@ | |||
4003 | 86 | auto gem_handle = gbm_bo_get_handle(gbm_handle.get()).u32; | 86 | auto gem_handle = gbm_bo_get_handle(gbm_handle.get()).u32; |
4004 | 87 | auto drm_fd = gbm_device_get_fd(device); | 87 | auto drm_fd = gbm_device_get_fd(device); |
4005 | 88 | 88 | ||
4007 | 89 | auto ret = drmPrimeHandleToFD(drm_fd, gem_handle, DRM_CLOEXEC, &prime_fd); | 89 | auto ret = drmPrimeHandleToFD(drm_fd, gem_handle, DRM_CLOEXEC, &prime_fd); |
4008 | 90 | 90 | ||
4009 | 91 | if (ret) | 91 | if (ret) |
4010 | 92 | { | 92 | { |
4011 | 93 | 93 | ||
4012 | === modified file 'src/server/graphics/gbm/gbm_display_helpers.cpp' | |||
4013 | --- src/server/graphics/gbm/gbm_display_helpers.cpp 2013-11-21 03:16:21 +0000 | |||
4014 | +++ src/server/graphics/gbm/gbm_display_helpers.cpp 2013-11-28 12:22:03 +0000 | |||
4015 | @@ -182,7 +182,7 @@ | |||
4016 | 182 | } | 182 | } |
4017 | 183 | 183 | ||
4018 | 184 | int mggh::DRMHelper::open_drm_device(std::shared_ptr<UdevContext> const& udev) | 184 | int mggh::DRMHelper::open_drm_device(std::shared_ptr<UdevContext> const& udev) |
4020 | 185 | { | 185 | { |
4021 | 186 | int tmp_fd = -1; | 186 | int tmp_fd = -1; |
4022 | 187 | int error = ENODEV; //Default error is "there are no DRM devices" | 187 | int error = ENODEV; //Default error is "there are no DRM devices" |
4023 | 188 | 188 | ||
4024 | 189 | 189 | ||
4025 | === modified file 'src/server/graphics/gbm/gbm_platform.cpp' | |||
4026 | --- src/server/graphics/gbm/gbm_platform.cpp 2013-11-21 03:16:21 +0000 | |||
4027 | +++ src/server/graphics/gbm/gbm_platform.cpp 2013-11-28 12:22:03 +0000 | |||
4028 | @@ -17,7 +17,7 @@ | |||
4029 | 17 | */ | 17 | */ |
4030 | 18 | 18 | ||
4031 | 19 | #include "gbm_platform.h" | 19 | #include "gbm_platform.h" |
4033 | 20 | #include "gbm_buffer_allocator.h" | 20 | #include "buffer_allocator.h" |
4034 | 21 | #include "gbm_display.h" | 21 | #include "gbm_display.h" |
4035 | 22 | #include "internal_client.h" | 22 | #include "internal_client.h" |
4036 | 23 | #include "internal_native_display.h" | 23 | #include "internal_native_display.h" |
4037 | @@ -114,8 +114,7 @@ | |||
4038 | 114 | std::shared_ptr<mg::GraphicBufferAllocator> mgg::GBMPlatform::create_buffer_allocator( | 114 | std::shared_ptr<mg::GraphicBufferAllocator> mgg::GBMPlatform::create_buffer_allocator( |
4039 | 115 | const std::shared_ptr<mg::BufferInitializer>& buffer_initializer) | 115 | const std::shared_ptr<mg::BufferInitializer>& buffer_initializer) |
4040 | 116 | { | 116 | { |
4043 | 117 | return std::make_shared<mgg::GBMBufferAllocator>(gbm.device, | 117 | return std::make_shared<mgg::BufferAllocator>(gbm.device, buffer_initializer); |
4042 | 118 | buffer_initializer); | ||
4044 | 119 | } | 118 | } |
4045 | 120 | 119 | ||
4046 | 121 | std::shared_ptr<mg::Display> mgg::GBMPlatform::create_display( | 120 | std::shared_ptr<mg::Display> mgg::GBMPlatform::create_display( |
4047 | @@ -138,13 +137,13 @@ | |||
4048 | 138 | for(auto i=0; i<native_handle->data_items; i++) | 137 | for(auto i=0; i<native_handle->data_items; i++) |
4049 | 139 | { | 138 | { |
4050 | 140 | packer->pack_data(native_handle->data[i]); | 139 | packer->pack_data(native_handle->data[i]); |
4052 | 141 | } | 140 | } |
4053 | 142 | for(auto i=0; i<native_handle->fd_items; i++) | 141 | for(auto i=0; i<native_handle->fd_items; i++) |
4054 | 143 | { | 142 | { |
4055 | 144 | packer->pack_fd(native_handle->fd[i]); | 143 | packer->pack_fd(native_handle->fd[i]); |
4056 | 145 | } | 144 | } |
4057 | 146 | 145 | ||
4059 | 147 | packer->pack_stride(buffer->stride()); | 146 | packer->pack_stride(buffer->stride()); |
4060 | 148 | packer->pack_flags(native_handle->flags); | 147 | packer->pack_flags(native_handle->flags); |
4061 | 149 | packer->pack_size(buffer->size()); | 148 | packer->pack_size(buffer->size()); |
4062 | 150 | } | 149 | } |
4063 | @@ -157,7 +156,7 @@ | |||
4064 | 157 | std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client() | 156 | std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client() |
4065 | 158 | { | 157 | { |
4066 | 159 | if (!internal_native_display) | 158 | if (!internal_native_display) |
4068 | 160 | internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package()); | 159 | internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package()); |
4069 | 161 | internal_display_clients_present = true; | 160 | internal_display_clients_present = true; |
4070 | 162 | return std::make_shared<mgg::InternalClient>(internal_native_display); | 161 | return std::make_shared<mgg::InternalClient>(internal_native_display); |
4071 | 163 | } | 162 | } |
4072 | 164 | 163 | ||
4073 | === modified file 'src/server/graphics/gbm/gbm_platform.h' | |||
4074 | --- src/server/graphics/gbm/gbm_platform.h 2013-11-21 03:16:21 +0000 | |||
4075 | +++ src/server/graphics/gbm/gbm_platform.h 2013-11-28 12:22:03 +0000 | |||
4076 | @@ -48,7 +48,7 @@ | |||
4077 | 48 | const std::shared_ptr<BufferInitializer>& buffer_initializer); | 48 | const std::shared_ptr<BufferInitializer>& buffer_initializer); |
4078 | 49 | std::shared_ptr<Display> create_display( | 49 | std::shared_ptr<Display> create_display( |
4079 | 50 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy); | 50 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy); |
4081 | 51 | std::shared_ptr<PlatformIPCPackage> get_ipc_package(); | 51 | std::shared_ptr<PlatformIPCPackage> get_ipc_package(); |
4082 | 52 | std::shared_ptr<InternalClient> create_internal_client(); | 52 | std::shared_ptr<InternalClient> create_internal_client(); |
4083 | 53 | 53 | ||
4084 | 54 | void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const; | 54 | void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const; |
4085 | 55 | 55 | ||
4086 | === modified file 'src/server/graphics/gbm/internal_native_surface.cpp' | |||
4087 | --- src/server/graphics/gbm/internal_native_surface.cpp 2013-08-28 03:41:48 +0000 | |||
4088 | +++ src/server/graphics/gbm/internal_native_surface.cpp 2013-11-28 12:22:03 +0000 | |||
4089 | @@ -27,7 +27,7 @@ | |||
4090 | 27 | { | 27 | { |
4091 | 28 | surface_advance_buffer = advance_buffer_static; | 28 | surface_advance_buffer = advance_buffer_static; |
4092 | 29 | surface_get_parameters = get_parameters_static; | 29 | surface_get_parameters = get_parameters_static; |
4094 | 30 | surface_set_swapinterval = set_swapinterval_static; | 30 | surface_set_swapinterval = set_swapinterval_static; |
4095 | 31 | } | 31 | } |
4096 | 32 | 32 | ||
4097 | 33 | int mgg::InternalNativeSurface::advance_buffer_static( | 33 | int mgg::InternalNativeSurface::advance_buffer_static( |
4098 | @@ -39,8 +39,7 @@ | |||
4099 | 39 | 39 | ||
4100 | 40 | int mgg::InternalNativeSurface::advance_buffer(MirBufferPackage* package) | 40 | int mgg::InternalNativeSurface::advance_buffer(MirBufferPackage* package) |
4101 | 41 | { | 41 | { |
4104 | 42 | current_buffer.reset(); | 42 | surface->swap_buffers(current_buffer); |
4103 | 43 | current_buffer = surface->advance_client_buffer(); | ||
4105 | 44 | 43 | ||
4106 | 45 | auto buffer_package = current_buffer->native_buffer_handle(); | 44 | auto buffer_package = current_buffer->native_buffer_handle(); |
4107 | 46 | memcpy(package, buffer_package.get(), sizeof(MirBufferPackage)); | 45 | memcpy(package, buffer_package.get(), sizeof(MirBufferPackage)); |
4108 | 47 | 46 | ||
4109 | === modified file 'src/server/graphics/gbm/kms_output.h' | |||
4110 | --- src/server/graphics/gbm/kms_output.h 2013-09-25 07:51:32 +0000 | |||
4111 | +++ src/server/graphics/gbm/kms_output.h 2013-11-28 12:22:03 +0000 | |||
4112 | @@ -52,7 +52,7 @@ | |||
4113 | 52 | virtual void move_cursor(geometry::Point destination) = 0; | 52 | virtual void move_cursor(geometry::Point destination) = 0; |
4114 | 53 | virtual void clear_cursor() = 0; | 53 | virtual void clear_cursor() = 0; |
4115 | 54 | virtual bool has_cursor() const = 0; | 54 | virtual bool has_cursor() const = 0; |
4117 | 55 | 55 | ||
4118 | 56 | virtual void set_power_mode(MirPowerMode mode) = 0; | 56 | virtual void set_power_mode(MirPowerMode mode) = 0; |
4119 | 57 | 57 | ||
4120 | 58 | protected: | 58 | protected: |
4121 | 59 | 59 | ||
4122 | === modified file 'src/server/graphics/gbm/native_gbm_platform.cpp' | |||
4123 | --- src/server/graphics/gbm/native_gbm_platform.cpp 2013-11-21 03:16:21 +0000 | |||
4124 | +++ src/server/graphics/gbm/native_gbm_platform.cpp 2013-11-28 12:22:03 +0000 | |||
4125 | @@ -20,7 +20,7 @@ | |||
4126 | 20 | 20 | ||
4127 | 21 | #include "native_gbm_platform.h" | 21 | #include "native_gbm_platform.h" |
4128 | 22 | 22 | ||
4130 | 23 | #include "gbm_buffer_allocator.h" | 23 | #include "buffer_allocator.h" |
4131 | 24 | #include "mir/graphics/buffer_ipc_packer.h" | 24 | #include "mir/graphics/buffer_ipc_packer.h" |
4132 | 25 | #include "mir/graphics/platform_ipc_package.h" | 25 | #include "mir/graphics/platform_ipc_package.h" |
4133 | 26 | #include "mir/graphics/nested_context.h" | 26 | #include "mir/graphics/nested_context.h" |
4134 | @@ -45,7 +45,7 @@ | |||
4135 | 45 | std::shared_ptr<mg::GraphicBufferAllocator> mgg::NativeGBMPlatform::create_buffer_allocator( | 45 | std::shared_ptr<mg::GraphicBufferAllocator> mgg::NativeGBMPlatform::create_buffer_allocator( |
4136 | 46 | std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) | 46 | std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) |
4137 | 47 | { | 47 | { |
4139 | 48 | return std::make_shared<mgg::GBMBufferAllocator>(gbm.device, buffer_initializer); | 48 | return std::make_shared<mgg::BufferAllocator>(gbm.device, buffer_initializer); |
4140 | 49 | } | 49 | } |
4141 | 50 | 50 | ||
4142 | 51 | std::shared_ptr<mg::PlatformIPCPackage> mgg::NativeGBMPlatform::get_ipc_package() | 51 | std::shared_ptr<mg::PlatformIPCPackage> mgg::NativeGBMPlatform::get_ipc_package() |
4143 | 52 | 52 | ||
4144 | === modified file 'src/server/graphics/gbm/real_kms_display_configuration.cpp' | |||
4145 | --- src/server/graphics/gbm/real_kms_display_configuration.cpp 2013-09-17 18:40:01 +0000 | |||
4146 | +++ src/server/graphics/gbm/real_kms_display_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
4147 | @@ -229,7 +229,7 @@ | |||
4148 | 229 | else | 229 | else |
4149 | 230 | { | 230 | { |
4150 | 231 | auto& output = *iter; | 231 | auto& output = *iter; |
4152 | 232 | 232 | ||
4153 | 233 | output.modes = modes; | 233 | output.modes = modes; |
4154 | 234 | output.preferred_mode_index = preferred_mode_index; | 234 | output.preferred_mode_index = preferred_mode_index; |
4155 | 235 | output.physical_size_mm = physical_size; | 235 | output.physical_size_mm = physical_size; |
4156 | 236 | 236 | ||
4157 | === modified file 'src/server/graphics/gbm/real_kms_output.h' | |||
4158 | --- src/server/graphics/gbm/real_kms_output.h 2013-09-25 07:51:32 +0000 | |||
4159 | +++ src/server/graphics/gbm/real_kms_output.h 2013-11-28 12:22:03 +0000 | |||
4160 | @@ -54,7 +54,7 @@ | |||
4161 | 54 | void move_cursor(geometry::Point destination); | 54 | void move_cursor(geometry::Point destination); |
4162 | 55 | void clear_cursor(); | 55 | void clear_cursor(); |
4163 | 56 | bool has_cursor() const; | 56 | bool has_cursor() const; |
4165 | 57 | 57 | ||
4166 | 58 | void set_power_mode(MirPowerMode mode); | 58 | void set_power_mode(MirPowerMode mode); |
4167 | 59 | 59 | ||
4168 | 60 | private: | 60 | private: |
4169 | @@ -75,7 +75,7 @@ | |||
4170 | 75 | 75 | ||
4171 | 76 | MirPowerMode power_mode; | 76 | MirPowerMode power_mode; |
4172 | 77 | int dpms_enum_id; | 77 | int dpms_enum_id; |
4174 | 78 | 78 | ||
4175 | 79 | std::mutex power_mutex; | 79 | std::mutex power_mutex; |
4176 | 80 | }; | 80 | }; |
4177 | 81 | 81 | ||
4178 | 82 | 82 | ||
4179 | === added file 'src/server/graphics/gbm/shm_buffer.cpp' | |||
4180 | --- src/server/graphics/gbm/shm_buffer.cpp 1970-01-01 00:00:00 +0000 | |||
4181 | +++ src/server/graphics/gbm/shm_buffer.cpp 2013-11-28 12:22:03 +0000 | |||
4182 | @@ -0,0 +1,87 @@ | |||
4183 | 1 | /* | ||
4184 | 2 | * Copyright © 2013 Canonical Ltd. | ||
4185 | 3 | * | ||
4186 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4187 | 5 | * under the terms of the GNU General Public License version 3, | ||
4188 | 6 | * as published by the Free Software Foundation. | ||
4189 | 7 | * | ||
4190 | 8 | * This program is distributed in the hope that it will be useful, | ||
4191 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4192 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4193 | 11 | * GNU General Public License for more details. | ||
4194 | 12 | * | ||
4195 | 13 | * You should have received a copy of the GNU General Public License | ||
4196 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4197 | 15 | * | ||
4198 | 16 | * Authored by: | ||
4199 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
4200 | 18 | */ | ||
4201 | 19 | |||
4202 | 20 | #include "shm_file.h" | ||
4203 | 21 | #include "shm_buffer.h" | ||
4204 | 22 | #include "buffer_texture_binder.h" | ||
4205 | 23 | #include <GLES2/gl2.h> | ||
4206 | 24 | #include <GLES2/gl2ext.h> | ||
4207 | 25 | |||
4208 | 26 | namespace mgg = mir::graphics::gbm; | ||
4209 | 27 | namespace geom = mir::geometry; | ||
4210 | 28 | |||
4211 | 29 | mgg::ShmBuffer::ShmBuffer( | ||
4212 | 30 | std::shared_ptr<ShmFile> const& shm_file, | ||
4213 | 31 | geom::Size const& size, | ||
4214 | 32 | geom::PixelFormat const& pixel_format) | ||
4215 | 33 | : shm_file{shm_file}, | ||
4216 | 34 | size_{size}, | ||
4217 | 35 | pixel_format_{pixel_format}, | ||
4218 | 36 | stride_{geom::bytes_per_pixel(pixel_format_) * size_.width.as_uint32_t()}, | ||
4219 | 37 | pixels{shm_file->base_ptr()} | ||
4220 | 38 | { | ||
4221 | 39 | } | ||
4222 | 40 | |||
4223 | 41 | mgg::ShmBuffer::~ShmBuffer() noexcept | ||
4224 | 42 | { | ||
4225 | 43 | } | ||
4226 | 44 | |||
4227 | 45 | geom::Size mgg::ShmBuffer::size() const | ||
4228 | 46 | { | ||
4229 | 47 | return size_; | ||
4230 | 48 | } | ||
4231 | 49 | |||
4232 | 50 | geom::Stride mgg::ShmBuffer::stride() const | ||
4233 | 51 | { | ||
4234 | 52 | return stride_; | ||
4235 | 53 | } | ||
4236 | 54 | |||
4237 | 55 | geom::PixelFormat mgg::ShmBuffer::pixel_format() const | ||
4238 | 56 | { | ||
4239 | 57 | return pixel_format_; | ||
4240 | 58 | } | ||
4241 | 59 | |||
4242 | 60 | void mgg::ShmBuffer::bind_to_texture() | ||
4243 | 61 | { | ||
4244 | 62 | glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, | ||
4245 | 63 | size_.width.as_int(), size_.height.as_int(), | ||
4246 | 64 | 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, | ||
4247 | 65 | pixels); | ||
4248 | 66 | } | ||
4249 | 67 | |||
4250 | 68 | std::shared_ptr<MirNativeBuffer> mgg::ShmBuffer::native_buffer_handle() const | ||
4251 | 69 | { | ||
4252 | 70 | auto native_buffer = std::make_shared<MirNativeBuffer>(); | ||
4253 | 71 | |||
4254 | 72 | native_buffer->fd_items = 1; | ||
4255 | 73 | native_buffer->fd[0] = shm_file->fd(); | ||
4256 | 74 | native_buffer->stride = stride().as_uint32_t(); | ||
4257 | 75 | native_buffer->flags = 0; | ||
4258 | 76 | |||
4259 | 77 | auto const& dim = size(); | ||
4260 | 78 | native_buffer->width = dim.width.as_int(); | ||
4261 | 79 | native_buffer->height = dim.height.as_int(); | ||
4262 | 80 | |||
4263 | 81 | return native_buffer; | ||
4264 | 82 | } | ||
4265 | 83 | |||
4266 | 84 | bool mgg::ShmBuffer::can_bypass() const | ||
4267 | 85 | { | ||
4268 | 86 | return false; | ||
4269 | 87 | } | ||
4270 | 0 | 88 | ||
4271 | === added file 'src/server/graphics/gbm/shm_buffer.h' | |||
4272 | --- src/server/graphics/gbm/shm_buffer.h 1970-01-01 00:00:00 +0000 | |||
4273 | +++ src/server/graphics/gbm/shm_buffer.h 2013-11-28 12:22:03 +0000 | |||
4274 | @@ -0,0 +1,67 @@ | |||
4275 | 1 | /* | ||
4276 | 2 | * Copyright © 2013 Canonical Ltd. | ||
4277 | 3 | * | ||
4278 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4279 | 5 | * under the terms of the GNU General Public License version 3, | ||
4280 | 6 | * as published by the Free Software Foundation. | ||
4281 | 7 | * | ||
4282 | 8 | * This program is distributed in the hope that it will be useful, | ||
4283 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4284 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4285 | 11 | * GNU General Public License for more details. | ||
4286 | 12 | * | ||
4287 | 13 | * You should have received a copy of the GNU General Public License | ||
4288 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4289 | 15 | * | ||
4290 | 16 | * Authored by: | ||
4291 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
4292 | 18 | */ | ||
4293 | 19 | |||
4294 | 20 | #ifndef MIR_GRAPHICS_GBM_SHM_BUFFER_H_ | ||
4295 | 21 | #define MIR_GRAPHICS_GBM_SHM_BUFFER_H_ | ||
4296 | 22 | |||
4297 | 23 | #include "mir/graphics/buffer_basic.h" | ||
4298 | 24 | #include "mir/geometry/dimensions.h" | ||
4299 | 25 | #include "mir/geometry/size.h" | ||
4300 | 26 | #include "mir/geometry/pixel_format.h" | ||
4301 | 27 | |||
4302 | 28 | namespace mir | ||
4303 | 29 | { | ||
4304 | 30 | namespace graphics | ||
4305 | 31 | { | ||
4306 | 32 | namespace gbm | ||
4307 | 33 | { | ||
4308 | 34 | |||
4309 | 35 | class ShmFile; | ||
4310 | 36 | |||
4311 | 37 | class ShmBuffer : public BufferBasic | ||
4312 | 38 | { | ||
4313 | 39 | public: | ||
4314 | 40 | ShmBuffer(std::shared_ptr<ShmFile> const& shm_file, | ||
4315 | 41 | geometry::Size const& size, | ||
4316 | 42 | geometry::PixelFormat const& pixel_format); | ||
4317 | 43 | ~ShmBuffer() noexcept; | ||
4318 | 44 | |||
4319 | 45 | geometry::Size size() const; | ||
4320 | 46 | geometry::Stride stride() const; | ||
4321 | 47 | geometry::PixelFormat pixel_format() const; | ||
4322 | 48 | std::shared_ptr<MirNativeBuffer> native_buffer_handle() const; | ||
4323 | 49 | void bind_to_texture(); | ||
4324 | 50 | bool can_bypass() const; | ||
4325 | 51 | |||
4326 | 52 | private: | ||
4327 | 53 | ShmBuffer(ShmBuffer const&) = delete; | ||
4328 | 54 | ShmBuffer& operator=(ShmBuffer const&) = delete; | ||
4329 | 55 | |||
4330 | 56 | std::shared_ptr<ShmFile> const shm_file; | ||
4331 | 57 | geometry::Size const size_; | ||
4332 | 58 | geometry::PixelFormat const pixel_format_; | ||
4333 | 59 | geometry::Stride const stride_; | ||
4334 | 60 | void* const pixels; | ||
4335 | 61 | }; | ||
4336 | 62 | |||
4337 | 63 | } | ||
4338 | 64 | } | ||
4339 | 65 | } | ||
4340 | 66 | |||
4341 | 67 | #endif /* MIR_GRAPHICS_GBM_SHM_BUFFER_H_ */ | ||
4342 | 0 | 68 | ||
4343 | === added file 'src/server/graphics/gbm/shm_file.h' | |||
4344 | --- src/server/graphics/gbm/shm_file.h 1970-01-01 00:00:00 +0000 | |||
4345 | +++ src/server/graphics/gbm/shm_file.h 2013-11-28 12:22:03 +0000 | |||
4346 | @@ -0,0 +1,50 @@ | |||
4347 | 1 | /* | ||
4348 | 2 | * Copyright © 2013 Canonical Ltd. | ||
4349 | 3 | * | ||
4350 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4351 | 5 | * under the terms of the GNU General Public License version 3, | ||
4352 | 6 | * as published by the Free Software Foundation. | ||
4353 | 7 | * | ||
4354 | 8 | * This program is distributed in the hope that it will be useful, | ||
4355 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4356 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4357 | 11 | * GNU General Public License for more details. | ||
4358 | 12 | * | ||
4359 | 13 | * You should have received a copy of the GNU General Public License | ||
4360 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4361 | 15 | * | ||
4362 | 16 | * Authored by: | ||
4363 | 17 | * Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
4364 | 18 | */ | ||
4365 | 19 | |||
4366 | 20 | #ifndef MIR_GRAPHICS_GBM_SHM_FILE_H_ | ||
4367 | 21 | #define MIR_GRAPHICS_GBM_SHM_FILE_H_ | ||
4368 | 22 | |||
4369 | 23 | #include <cstddef> | ||
4370 | 24 | |||
4371 | 25 | namespace mir | ||
4372 | 26 | { | ||
4373 | 27 | namespace graphics | ||
4374 | 28 | { | ||
4375 | 29 | namespace gbm | ||
4376 | 30 | { | ||
4377 | 31 | |||
4378 | 32 | class ShmFile | ||
4379 | 33 | { | ||
4380 | 34 | public: | ||
4381 | 35 | virtual ~ShmFile() = default; | ||
4382 | 36 | |||
4383 | 37 | virtual void* base_ptr() const = 0; | ||
4384 | 38 | virtual int fd() const = 0; | ||
4385 | 39 | |||
4386 | 40 | protected: | ||
4387 | 41 | ShmFile() = default; | ||
4388 | 42 | ShmFile(ShmFile const&) = delete; | ||
4389 | 43 | ShmFile& operator=(ShmFile const&) = delete; | ||
4390 | 44 | }; | ||
4391 | 45 | |||
4392 | 46 | } | ||
4393 | 47 | } | ||
4394 | 48 | } | ||
4395 | 49 | |||
4396 | 50 | #endif /* MIR_GRAPHICS_GBM_SHM_FILE_H_ */ | ||
4397 | 0 | 51 | ||
4398 | === modified file 'src/server/graphics/gbm/udev_wrapper.cpp' | |||
4399 | --- src/server/graphics/gbm/udev_wrapper.cpp 2013-11-19 05:40:39 +0000 | |||
4400 | +++ src/server/graphics/gbm/udev_wrapper.cpp 2013-11-28 12:22:03 +0000 | |||
4401 | @@ -257,7 +257,7 @@ | |||
4402 | 257 | do | 257 | do |
4403 | 258 | { | 258 | { |
4404 | 259 | dev = udev_monitor_receive_device(const_cast<udev_monitor*>(monitor)); | 259 | dev = udev_monitor_receive_device(const_cast<udev_monitor*>(monitor)); |
4406 | 260 | if (dev != nullptr) | 260 | if (dev != nullptr) |
4407 | 261 | handler(action_to_event_type(udev_device_get_action(dev)), UdevDevice(dev)); | 261 | handler(action_to_event_type(udev_device_get_action(dev)), UdevDevice(dev)); |
4408 | 262 | } while (dev != nullptr); | 262 | } while (dev != nullptr); |
4409 | 263 | } | 263 | } |
4410 | 264 | 264 | ||
4411 | === modified file 'src/server/graphics/gbm/udev_wrapper.h' | |||
4412 | --- src/server/graphics/gbm/udev_wrapper.h 2013-11-19 05:40:39 +0000 | |||
4413 | +++ src/server/graphics/gbm/udev_wrapper.h 2013-11-28 12:22:03 +0000 | |||
4414 | @@ -84,7 +84,7 @@ | |||
4415 | 84 | void match_parent(UdevDevice const& parent); | 84 | void match_parent(UdevDevice const& parent); |
4416 | 85 | void match_sysname(std::string const& sysname); | 85 | void match_sysname(std::string const& sysname); |
4417 | 86 | 86 | ||
4419 | 87 | class iterator : | 87 | class iterator : |
4420 | 88 | public std::iterator<std::input_iterator_tag, UdevDevice> | 88 | public std::iterator<std::input_iterator_tag, UdevDevice> |
4421 | 89 | { | 89 | { |
4422 | 90 | public: | 90 | public: |
4423 | 91 | 91 | ||
4424 | === modified file 'src/server/graphics/nested/nested_display_configuration.cpp' | |||
4425 | --- src/server/graphics/nested/nested_display_configuration.cpp 2013-09-12 21:36:55 +0000 | |||
4426 | +++ src/server/graphics/nested/nested_display_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
4427 | @@ -85,7 +85,7 @@ | |||
4428 | 85 | }); | 85 | }); |
4429 | 86 | } | 86 | } |
4430 | 87 | 87 | ||
4432 | 88 | void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, | 88 | void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, |
4433 | 89 | geometry::Point top_left, size_t mode_index, MirPowerMode power_mode) | 89 | geometry::Point top_left, size_t mode_index, MirPowerMode power_mode) |
4434 | 90 | { | 90 | { |
4435 | 91 | for (auto mir_output = display_config->outputs; | 91 | for (auto mir_output = display_config->outputs; |
4436 | 92 | 92 | ||
4437 | === modified file 'src/server/graphics/offscreen/display_buffer.cpp' | |||
4438 | --- src/server/graphics/offscreen/display_buffer.cpp 2013-11-14 09:46:02 +0000 | |||
4439 | +++ src/server/graphics/offscreen/display_buffer.cpp 2013-11-28 12:22:03 +0000 | |||
4440 | @@ -33,12 +33,6 @@ | |||
4441 | 33 | namespace | 33 | namespace |
4442 | 34 | { | 34 | { |
4443 | 35 | 35 | ||
4444 | 36 | EGLint const default_egl_context_attr[] = | ||
4445 | 37 | { | ||
4446 | 38 | EGL_CONTEXT_CLIENT_VERSION, 2, | ||
4447 | 39 | EGL_NONE | ||
4448 | 40 | }; | ||
4449 | 41 | |||
4450 | 42 | class GLExtensions : public mgo::GLExtensionsBase | 36 | class GLExtensions : public mgo::GLExtensionsBase |
4451 | 43 | { | 37 | { |
4452 | 44 | public: | 38 | public: |
4453 | 45 | 39 | ||
4454 | === modified file 'src/server/input/android/android_input_application_handle.cpp' | |||
4455 | --- src/server/input/android/android_input_application_handle.cpp 2013-08-28 03:41:48 +0000 | |||
4456 | +++ src/server/input/android/android_input_application_handle.cpp 2013-11-28 12:22:03 +0000 | |||
4457 | @@ -36,7 +36,7 @@ | |||
4458 | 36 | { | 36 | { |
4459 | 37 | if (mInfo == NULL) | 37 | if (mInfo == NULL) |
4460 | 38 | mInfo = new droidinput::InputApplicationInfo; | 38 | mInfo = new droidinput::InputApplicationInfo; |
4462 | 39 | 39 | ||
4463 | 40 | mInfo->dispatchingTimeout = INT_MAX; | 40 | mInfo->dispatchingTimeout = INT_MAX; |
4464 | 41 | mInfo->name = droidinput::String8(surface->name().c_str()); | 41 | mInfo->name = droidinput::String8(surface->name().c_str()); |
4465 | 42 | 42 | ||
4466 | 43 | 43 | ||
4467 | === modified file 'src/server/input/android/android_input_channel.cpp' | |||
4468 | --- src/server/input/android/android_input_channel.cpp 2013-08-28 03:41:48 +0000 | |||
4469 | +++ src/server/input/android/android_input_channel.cpp 2013-11-28 12:22:03 +0000 | |||
4470 | @@ -27,7 +27,7 @@ | |||
4471 | 27 | 27 | ||
4472 | 28 | mia::AndroidInputChannel::AndroidInputChannel() | 28 | mia::AndroidInputChannel::AndroidInputChannel() |
4473 | 29 | { | 29 | { |
4475 | 30 | 30 | ||
4476 | 31 | droidinput::InputChannel::openInputFdPair(s_fd, c_fd); | 31 | droidinput::InputChannel::openInputFdPair(s_fd, c_fd); |
4477 | 32 | } | 32 | } |
4478 | 33 | 33 | ||
4479 | 34 | 34 | ||
4480 | === modified file 'src/server/input/android/android_input_reader_policy.cpp' | |||
4481 | --- src/server/input/android/android_input_reader_policy.cpp 2013-08-28 03:41:48 +0000 | |||
4482 | +++ src/server/input/android/android_input_reader_policy.cpp 2013-11-28 12:22:03 +0000 | |||
4483 | @@ -48,7 +48,7 @@ | |||
4484 | 48 | width, | 48 | width, |
4485 | 49 | height, | 49 | height, |
4486 | 50 | default_display_orientation); | 50 | default_display_orientation); |
4488 | 51 | 51 | ||
4489 | 52 | out_config->pointerVelocityControlParameters.acceleration = 1.0; | 52 | out_config->pointerVelocityControlParameters.acceleration = 1.0; |
4490 | 53 | } | 53 | } |
4491 | 54 | 54 | ||
4492 | 55 | 55 | ||
4493 | === modified file 'src/server/input/android/android_input_registrar.cpp' | |||
4494 | --- src/server/input/android/android_input_registrar.cpp 2013-11-20 15:56:58 +0000 | |||
4495 | +++ src/server/input/android/android_input_registrar.cpp 2013-11-28 12:22:03 +0000 | |||
4496 | @@ -59,7 +59,7 @@ | |||
4497 | 59 | 59 | ||
4498 | 60 | auto application_handle = new mia::InputApplicationHandle(surface); | 60 | auto application_handle = new mia::InputApplicationHandle(surface); |
4499 | 61 | window_handle = new mia::InputWindowHandle(application_handle, channel, surface); | 61 | window_handle = new mia::InputWindowHandle(application_handle, channel, surface); |
4501 | 62 | 62 | ||
4502 | 63 | window_handles[channel] = window_handle; | 63 | window_handles[channel] = window_handle; |
4503 | 64 | } | 64 | } |
4504 | 65 | 65 | ||
4505 | 66 | 66 | ||
4506 | === modified file 'src/server/input/android/android_input_target_enumerator.h' | |||
4507 | --- src/server/input/android/android_input_target_enumerator.h 2013-11-20 15:56:58 +0000 | |||
4508 | +++ src/server/input/android/android_input_target_enumerator.h 2013-11-28 12:22:03 +0000 | |||
4509 | @@ -52,9 +52,9 @@ | |||
4510 | 52 | explicit InputTargetEnumerator(std::shared_ptr<input::InputTargets> const& targets, | 52 | explicit InputTargetEnumerator(std::shared_ptr<input::InputTargets> const& targets, |
4511 | 53 | std::shared_ptr<WindowHandleRepository> const& repository); | 53 | std::shared_ptr<WindowHandleRepository> const& repository); |
4512 | 54 | virtual ~InputTargetEnumerator() noexcept(true); | 54 | virtual ~InputTargetEnumerator() noexcept(true); |
4514 | 55 | 55 | ||
4515 | 56 | void for_each(std::function<void(droidinput::sp<droidinput::InputWindowHandle> const&)> const& callback); | 56 | void for_each(std::function<void(droidinput::sp<droidinput::InputWindowHandle> const&)> const& callback); |
4517 | 57 | 57 | ||
4518 | 58 | private: | 58 | private: |
4519 | 59 | std::weak_ptr<input::InputTargets> const targets; | 59 | std::weak_ptr<input::InputTargets> const targets; |
4520 | 60 | std::weak_ptr<input::android::WindowHandleRepository> const repository; | 60 | std::weak_ptr<input::android::WindowHandleRepository> const repository; |
4521 | 61 | 61 | ||
4522 | === modified file 'src/server/input/android/android_input_targeter.cpp' | |||
4523 | --- src/server/input/android/android_input_targeter.cpp 2013-11-20 15:56:58 +0000 | |||
4524 | +++ src/server/input/android/android_input_targeter.cpp 2013-11-28 12:22:03 +0000 | |||
4525 | @@ -46,16 +46,16 @@ | |||
4526 | 46 | void mia::InputTargeter::focus_cleared() | 46 | void mia::InputTargeter::focus_cleared() |
4527 | 47 | { | 47 | { |
4528 | 48 | droidinput::sp<droidinput::InputWindowHandle> null_window = nullptr; | 48 | droidinput::sp<droidinput::InputWindowHandle> null_window = nullptr; |
4530 | 49 | 49 | ||
4531 | 50 | input_dispatcher->setKeyboardFocus(null_window); | 50 | input_dispatcher->setKeyboardFocus(null_window); |
4532 | 51 | } | 51 | } |
4533 | 52 | 52 | ||
4534 | 53 | void mia::InputTargeter::focus_changed(std::shared_ptr<mi::InputChannel const> const& focus_channel) | 53 | void mia::InputTargeter::focus_changed(std::shared_ptr<mi::InputChannel const> const& focus_channel) |
4535 | 54 | { | 54 | { |
4536 | 55 | auto window_handle = repository->handle_for_channel(focus_channel); | 55 | auto window_handle = repository->handle_for_channel(focus_channel); |
4538 | 56 | 56 | ||
4539 | 57 | if (window_handle == NULL) | 57 | if (window_handle == NULL) |
4540 | 58 | BOOST_THROW_EXCEPTION(std::logic_error("Attempt to set keyboard focus to an unregistered input channel")); | 58 | BOOST_THROW_EXCEPTION(std::logic_error("Attempt to set keyboard focus to an unregistered input channel")); |
4542 | 59 | 59 | ||
4543 | 60 | input_dispatcher->setKeyboardFocus(window_handle); | 60 | input_dispatcher->setKeyboardFocus(window_handle); |
4544 | 61 | } | 61 | } |
4545 | 62 | 62 | ||
4546 | === modified file 'src/server/input/android/android_input_window_handle.cpp' | |||
4547 | --- src/server/input/android/android_input_window_handle.cpp 2013-08-28 03:41:48 +0000 | |||
4548 | +++ src/server/input/android/android_input_window_handle.cpp 2013-11-28 12:22:03 +0000 | |||
4549 | @@ -76,7 +76,7 @@ | |||
4550 | 76 | mInfo->frameTop = surface_position.y.as_uint32_t(); | 76 | mInfo->frameTop = surface_position.y.as_uint32_t(); |
4551 | 77 | mInfo->frameRight = mInfo->frameLeft + surface_size.width.as_uint32_t(); | 77 | mInfo->frameRight = mInfo->frameLeft + surface_size.width.as_uint32_t(); |
4552 | 78 | mInfo->frameBottom = mInfo->frameTop + surface_size.height.as_uint32_t(); | 78 | mInfo->frameBottom = mInfo->frameTop + surface_size.height.as_uint32_t(); |
4554 | 79 | 79 | ||
4555 | 80 | mInfo->touchableRegionLeft = mInfo->frameLeft; | 80 | mInfo->touchableRegionLeft = mInfo->frameLeft; |
4556 | 81 | mInfo->touchableRegionTop = mInfo->frameTop; | 81 | mInfo->touchableRegionTop = mInfo->frameTop; |
4557 | 82 | mInfo->touchableRegionRight = mInfo->frameRight; | 82 | mInfo->touchableRegionRight = mInfo->frameRight; |
4558 | 83 | 83 | ||
4559 | === modified file 'src/server/input/android/android_window_handle_repository.h' | |||
4560 | --- src/server/input/android/android_window_handle_repository.h 2013-08-28 03:41:48 +0000 | |||
4561 | +++ src/server/input/android/android_window_handle_repository.h 2013-11-28 12:22:03 +0000 | |||
4562 | @@ -44,7 +44,7 @@ | |||
4563 | 44 | { | 44 | { |
4564 | 45 | public: | 45 | public: |
4565 | 46 | virtual ~WindowHandleRepository() = default; | 46 | virtual ~WindowHandleRepository() = default; |
4567 | 47 | 47 | ||
4568 | 48 | virtual droidinput::sp<droidinput::InputWindowHandle> handle_for_channel(std::shared_ptr<input::InputChannel const> const& channel) = 0; | 48 | virtual droidinput::sp<droidinput::InputWindowHandle> handle_for_channel(std::shared_ptr<input::InputChannel const> const& channel) = 0; |
4569 | 49 | protected: | 49 | protected: |
4570 | 50 | WindowHandleRepository() = default; | 50 | WindowHandleRepository() = default; |
4571 | 51 | 51 | ||
4572 | === modified file 'src/server/input/android/event_filter_dispatcher_policy.cpp' | |||
4573 | --- src/server/input/android/event_filter_dispatcher_policy.cpp 2013-06-06 10:03:12 +0000 | |||
4574 | +++ src/server/input/android/event_filter_dispatcher_policy.cpp 2013-11-28 12:22:03 +0000 | |||
4575 | @@ -54,7 +54,7 @@ | |||
4576 | 54 | { | 54 | { |
4577 | 55 | MirEvent mir_ev; | 55 | MirEvent mir_ev; |
4578 | 56 | mia::Lexicon::translate(input_event, mir_ev); | 56 | mia::Lexicon::translate(input_event, mir_ev); |
4580 | 57 | 57 | ||
4581 | 58 | // TODO: Use XKBMapper | 58 | // TODO: Use XKBMapper |
4582 | 59 | 59 | ||
4583 | 60 | return !event_filter->handle(mir_ev); | 60 | return !event_filter->handle(mir_ev); |
4584 | 61 | 61 | ||
4585 | === modified file 'src/server/input/null_input_configuration.cpp' | |||
4586 | --- src/server/input/null_input_configuration.cpp 2013-11-21 12:34:49 +0000 | |||
4587 | +++ src/server/input/null_input_configuration.cpp 2013-11-28 12:22:03 +0000 | |||
4588 | @@ -33,7 +33,7 @@ | |||
4589 | 33 | { | 33 | { |
4590 | 34 | NullInputRegistrar() = default; | 34 | NullInputRegistrar() = default; |
4591 | 35 | virtual ~NullInputRegistrar() noexcept(true) = default; | 35 | virtual ~NullInputRegistrar() noexcept(true) = default; |
4593 | 36 | 36 | ||
4594 | 37 | void input_channel_opened(std::shared_ptr<mi::InputChannel> const&, | 37 | void input_channel_opened(std::shared_ptr<mi::InputChannel> const&, |
4595 | 38 | std::shared_ptr<mi::Surface> const&, | 38 | std::shared_ptr<mi::Surface> const&, |
4596 | 39 | mi::InputReceptionMode /* receives_all_input */) | 39 | mi::InputReceptionMode /* receives_all_input */) |
4597 | 40 | 40 | ||
4598 | === modified file 'src/server/input/null_input_configuration.h' | |||
4599 | --- src/server/input/null_input_configuration.h 2013-11-21 12:34:49 +0000 | |||
4600 | +++ src/server/input/null_input_configuration.h 2013-11-28 12:22:03 +0000 | |||
4601 | @@ -35,7 +35,7 @@ | |||
4602 | 35 | std::shared_ptr<scene::InputRegistrar> the_input_registrar(); | 35 | std::shared_ptr<scene::InputRegistrar> the_input_registrar(); |
4603 | 36 | std::shared_ptr<shell::InputTargeter> the_input_targeter(); | 36 | std::shared_ptr<shell::InputTargeter> the_input_targeter(); |
4604 | 37 | std::shared_ptr<InputManager> the_input_manager(); | 37 | std::shared_ptr<InputManager> the_input_manager(); |
4606 | 38 | 38 | ||
4607 | 39 | void set_input_targets(std::shared_ptr<InputTargets> const& /* targets */); | 39 | void set_input_targets(std::shared_ptr<InputTargets> const& /* targets */); |
4608 | 40 | 40 | ||
4609 | 41 | protected: | 41 | protected: |
4610 | 42 | 42 | ||
4611 | === modified file 'src/server/logging/display_report.cpp' | |||
4612 | --- src/server/logging/display_report.cpp 2013-11-21 03:16:21 +0000 | |||
4613 | +++ src/server/logging/display_report.cpp 2013-11-28 12:22:03 +0000 | |||
4614 | @@ -150,5 +150,5 @@ | |||
4615 | 150 | eglGetConfigAttrib(disp, config, i.val, &value); | 150 | eglGetConfigAttrib(disp, config, i.val, &value); |
4616 | 151 | logger->log<Logger::informational>( | 151 | logger->log<Logger::informational>( |
4617 | 152 | " [" + i.name + "] : " + std::to_string(value), component()); | 152 | " [" + i.name + "] : " + std::to_string(value), component()); |
4619 | 153 | } | 153 | } |
4620 | 154 | } | 154 | } |
4621 | 155 | 155 | ||
4622 | === modified file 'src/server/logging/input_report.cpp' | |||
4623 | --- src/server/logging/input_report.cpp 2013-05-28 17:55:26 +0000 | |||
4624 | +++ src/server/logging/input_report.cpp 2013-11-28 12:22:03 +0000 | |||
4625 | @@ -92,7 +92,7 @@ | |||
4626 | 92 | } | 92 | } |
4627 | 93 | 93 | ||
4628 | 94 | 94 | ||
4630 | 95 | ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger) | 95 | ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger) |
4631 | 96 | : logger(logger) | 96 | : logger(logger) |
4632 | 97 | { | 97 | { |
4633 | 98 | } | 98 | } |
4634 | @@ -106,7 +106,7 @@ | |||
4635 | 106 | void ml::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value) | 106 | void ml::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value) |
4636 | 107 | { | 107 | { |
4637 | 108 | std::stringstream ss; | 108 | std::stringstream ss; |
4639 | 109 | 109 | ||
4640 | 110 | ss << "Received event (when, type, code, value) from kernel: " | 110 | ss << "Received event (when, type, code, value) from kernel: " |
4641 | 111 | << "(" << when << "ns, " << type << ", " << code << ", " << value << ")"; | 111 | << "(" << when << "ns, " << type << ", " << code << ", " << value << ")"; |
4642 | 112 | logger->log<Logger::informational>(ss.str(), component()); | 112 | logger->log<Logger::informational>(ss.str(), component()); |
4643 | @@ -116,7 +116,7 @@ | |||
4644 | 116 | { | 116 | { |
4645 | 117 | std::stringstream ss; | 117 | std::stringstream ss; |
4646 | 118 | 118 | ||
4648 | 119 | ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": (" | 119 | ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": (" |
4649 | 120 | << seq_id << ", " << event_time << ")"; | 120 | << seq_id << ", " << event_time << ")"; |
4650 | 121 | logger->log<Logger::informational>(ss.str(), component()); | 121 | logger->log<Logger::informational>(ss.str(), component()); |
4651 | 122 | } | 122 | } |
4652 | @@ -125,7 +125,7 @@ | |||
4653 | 125 | { | 125 | { |
4654 | 126 | std::stringstream ss; | 126 | std::stringstream ss; |
4655 | 127 | 127 | ||
4657 | 128 | ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": (" | 128 | ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": (" |
4658 | 129 | << seq_id << ", " << event_time << ")"; | 129 | << seq_id << ", " << event_time << ")"; |
4659 | 130 | logger->log<Logger::informational>(ss.str(), component()); | 130 | logger->log<Logger::informational>(ss.str(), component()); |
4660 | 131 | } | 131 | } |
4661 | @@ -133,7 +133,7 @@ | |||
4662 | 133 | void ml::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id) | 133 | void ml::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id) |
4663 | 134 | { | 134 | { |
4664 | 135 | std::stringstream ss; | 135 | std::stringstream ss; |
4666 | 136 | 136 | ||
4667 | 137 | ss << "Received event finished (seq_id) from fd " << src_fd << ": " << seq_id; | 137 | ss << "Received event finished (seq_id) from fd " << src_fd << ": " << seq_id; |
4668 | 138 | logger->log<Logger::informational>(ss.str(), component()); | 138 | logger->log<Logger::informational>(ss.str(), component()); |
4669 | 139 | } | 139 | } |
4670 | 140 | 140 | ||
4671 | === modified file 'src/server/scene/application_session.cpp' | |||
4672 | --- src/server/scene/application_session.cpp 2013-11-21 12:34:49 +0000 | |||
4673 | +++ src/server/scene/application_session.cpp 2013-11-28 12:22:03 +0000 | |||
4674 | @@ -72,9 +72,9 @@ | |||
4675 | 72 | 72 | ||
4676 | 73 | std::unique_lock<std::mutex> lock(surfaces_mutex); | 73 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
4677 | 74 | surfaces[id] = surf; | 74 | surfaces[id] = surf; |
4679 | 75 | 75 | ||
4680 | 76 | session_listener->surface_created(*this, surf); | 76 | session_listener->surface_created(*this, surf); |
4682 | 77 | 77 | ||
4683 | 78 | return id; | 78 | return id; |
4684 | 79 | } | 79 | } |
4685 | 80 | 80 | ||
4686 | @@ -114,7 +114,7 @@ | |||
4687 | 114 | { | 114 | { |
4688 | 115 | std::unique_lock<std::mutex> lock(surfaces_mutex); | 115 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
4689 | 116 | auto p = checked_find(id); | 116 | auto p = checked_find(id); |
4691 | 117 | 117 | ||
4692 | 118 | session_listener->destroying_surface(*this, p->second); | 118 | session_listener->destroying_surface(*this, p->second); |
4693 | 119 | 119 | ||
4694 | 120 | surfaces.erase(p); | 120 | surfaces.erase(p); |
4695 | 121 | 121 | ||
4696 | === modified file 'src/server/scene/basic_surface.h' | |||
4697 | --- src/server/scene/basic_surface.h 2013-11-21 12:34:49 +0000 | |||
4698 | +++ src/server/scene/basic_surface.h 2013-11-28 12:22:03 +0000 | |||
4699 | @@ -65,7 +65,7 @@ | |||
4700 | 65 | virtual geometry::PixelFormat pixel_format() const = 0; | 65 | virtual geometry::PixelFormat pixel_format() const = 0; |
4701 | 66 | 66 | ||
4702 | 67 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const = 0; | 67 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const = 0; |
4704 | 68 | virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0; | 68 | virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0; |
4705 | 69 | virtual void force_requests_to_complete() = 0; | 69 | virtual void force_requests_to_complete() = 0; |
4706 | 70 | 70 | ||
4707 | 71 | virtual bool supports_input() const = 0; | 71 | virtual bool supports_input() const = 0; |
4708 | 72 | 72 | ||
4709 | === modified file 'src/server/scene/default_session_container.cpp' | |||
4710 | --- src/server/scene/default_session_container.cpp 2013-11-21 12:34:49 +0000 | |||
4711 | +++ src/server/scene/default_session_container.cpp 2013-11-28 12:22:03 +0000 | |||
4712 | @@ -63,12 +63,12 @@ | |||
4713 | 63 | std::shared_ptr<msh::Session> ms::DefaultSessionContainer::successor_of(std::shared_ptr<msh::Session> const& session) const | 63 | std::shared_ptr<msh::Session> ms::DefaultSessionContainer::successor_of(std::shared_ptr<msh::Session> const& session) const |
4714 | 64 | { | 64 | { |
4715 | 65 | std::shared_ptr<msh::Session> result, first; | 65 | std::shared_ptr<msh::Session> result, first; |
4717 | 66 | 66 | ||
4718 | 67 | if (!session && apps.size()) | 67 | if (!session && apps.size()) |
4719 | 68 | return apps.back(); | 68 | return apps.back(); |
4720 | 69 | else if(!session) | 69 | else if(!session) |
4721 | 70 | return std::shared_ptr<msh::Session>(); | 70 | return std::shared_ptr<msh::Session>(); |
4723 | 71 | 71 | ||
4724 | 72 | for (auto it = apps.begin(); it != apps.end(); it++) | 72 | for (auto it = apps.begin(); it != apps.end(); it++) |
4725 | 73 | { | 73 | { |
4726 | 74 | if (*it == session) | 74 | if (*it == session) |
4727 | @@ -79,6 +79,6 @@ | |||
4728 | 79 | else return *successor; | 79 | else return *successor; |
4729 | 80 | } | 80 | } |
4730 | 81 | } | 81 | } |
4732 | 82 | 82 | ||
4733 | 83 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid session")); | 83 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid session")); |
4734 | 84 | } | 84 | } |
4735 | 85 | 85 | ||
4736 | === modified file 'src/server/scene/global_event_sender.cpp' | |||
4737 | --- src/server/scene/global_event_sender.cpp 2013-11-21 12:34:49 +0000 | |||
4738 | +++ src/server/scene/global_event_sender.cpp 2013-11-28 12:22:03 +0000 | |||
4739 | @@ -30,7 +30,7 @@ | |||
4740 | 30 | } | 30 | } |
4741 | 31 | 31 | ||
4742 | 32 | void ms::GlobalEventSender::handle_event(MirEvent const&) | 32 | void ms::GlobalEventSender::handle_event(MirEvent const&) |
4744 | 33 | { | 33 | { |
4745 | 34 | //TODO, no driving test cases, although messages like 'server shutdown' could go here | 34 | //TODO, no driving test cases, although messages like 'server shutdown' could go here |
4746 | 35 | } | 35 | } |
4747 | 36 | 36 | ||
4748 | 37 | 37 | ||
4749 | === modified file 'src/server/scene/mediating_display_changer.cpp' | |||
4750 | --- src/server/scene/mediating_display_changer.cpp 2013-11-21 12:34:49 +0000 | |||
4751 | +++ src/server/scene/mediating_display_changer.cpp 2013-11-28 12:22:03 +0000 | |||
4752 | @@ -129,12 +129,12 @@ | |||
4753 | 129 | conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void | 129 | conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void |
4754 | 130 | { | 130 | { |
4755 | 131 | if (!output.used) return; | 131 | if (!output.used) return; |
4757 | 132 | 132 | ||
4758 | 133 | if (output.power_mode != mir_power_mode_on) | 133 | if (output.power_mode != mir_power_mode_on) |
4759 | 134 | { | 134 | { |
4760 | 135 | switched = true; | 135 | switched = true; |
4761 | 136 | conf->configure_output(output.id, output.used, | 136 | conf->configure_output(output.id, output.used, |
4763 | 137 | output.top_left, | 137 | output.top_left, |
4764 | 138 | output.current_mode_index, | 138 | output.current_mode_index, |
4765 | 139 | mir_power_mode_on); | 139 | mir_power_mode_on); |
4766 | 140 | } | 140 | } |
4767 | 141 | 141 | ||
4768 | === modified file 'src/server/scene/mutable_surface_state.h' | |||
4769 | --- src/server/scene/mutable_surface_state.h 2013-11-21 12:34:49 +0000 | |||
4770 | +++ src/server/scene/mutable_surface_state.h 2013-11-28 12:22:03 +0000 | |||
4771 | @@ -41,7 +41,7 @@ | |||
4772 | 41 | std::vector<geometry::Rectangle> const& input_rectangles) = 0; | 41 | std::vector<geometry::Rectangle> const& input_rectangles) = 0; |
4773 | 42 | 42 | ||
4774 | 43 | protected: | 43 | protected: |
4776 | 44 | MutableSurfaceState() = default; | 44 | MutableSurfaceState() = default; |
4777 | 45 | virtual ~MutableSurfaceState() noexcept = default; | 45 | virtual ~MutableSurfaceState() noexcept = default; |
4778 | 46 | MutableSurfaceState(const MutableSurfaceState&) = delete; | 46 | MutableSurfaceState(const MutableSurfaceState&) = delete; |
4779 | 47 | MutableSurfaceState& operator=(const MutableSurfaceState& ) = delete; | 47 | MutableSurfaceState& operator=(const MutableSurfaceState& ) = delete; |
4780 | 48 | 48 | ||
4781 | === modified file 'src/server/scene/session_manager.cpp' | |||
4782 | --- src/server/scene/session_manager.cpp 2013-11-21 12:34:49 +0000 | |||
4783 | +++ src/server/scene/session_manager.cpp 2013-11-28 12:22:03 +0000 | |||
4784 | @@ -81,7 +81,7 @@ | |||
4785 | 81 | surface_factory, name, snapshot_strategy, session_listener, sender); | 81 | surface_factory, name, snapshot_strategy, session_listener, sender); |
4786 | 82 | 82 | ||
4787 | 83 | app_container->insert_session(new_session); | 83 | app_container->insert_session(new_session); |
4789 | 84 | 84 | ||
4790 | 85 | session_listener->starting(new_session); | 85 | session_listener->starting(new_session); |
4791 | 86 | 86 | ||
4792 | 87 | set_focus_to(new_session); | 87 | set_focus_to(new_session); |
4793 | 88 | 88 | ||
4794 | === modified file 'src/server/scene/surface.cpp' | |||
4795 | --- src/server/scene/surface.cpp 2013-11-21 12:34:49 +0000 | |||
4796 | +++ src/server/scene/surface.cpp 2013-11-28 12:22:03 +0000 | |||
4797 | @@ -44,8 +44,7 @@ | |||
4798 | 44 | surface_state(state), | 44 | surface_state(state), |
4799 | 45 | surface_buffer_stream(buffer_stream), | 45 | surface_buffer_stream(buffer_stream), |
4800 | 46 | server_input_channel(input_channel), | 46 | server_input_channel(input_channel), |
4803 | 47 | report(report), | 47 | report(report) |
4802 | 48 | surface_in_startup(true) | ||
4804 | 49 | { | 48 | { |
4805 | 50 | report->surface_created(this); | 49 | report->surface_created(this); |
4806 | 51 | } | 50 | } |
4807 | @@ -110,20 +109,16 @@ | |||
4808 | 110 | return surface_buffer_stream->get_stream_pixel_format(); | 109 | return surface_buffer_stream->get_stream_pixel_format(); |
4809 | 111 | } | 110 | } |
4810 | 112 | 111 | ||
4812 | 113 | std::shared_ptr<mg::Buffer> ms::Surface::advance_client_buffer() | 112 | void ms::Surface::swap_buffers(std::shared_ptr<graphics::Buffer>& buffer) |
4813 | 114 | { | 113 | { |
4826 | 115 | if (surface_in_startup) | 114 | bool const posting{!!buffer}; |
4827 | 116 | { | 115 | |
4828 | 117 | surface_in_startup = false; | 116 | surface_buffer_stream->swap_client_buffers(buffer); |
4829 | 118 | } | 117 | |
4830 | 119 | else | 118 | if (posting) |
4831 | 120 | { | 119 | { |
4832 | 121 | // TODO There is something crazy about assuming that giving out any buffer | 120 | surface_state->frame_posted(); |
4833 | 122 | // TODO after the first implies that previous buffers have been rendered. | 121 | } |
4822 | 123 | flag_for_render(); | ||
4823 | 124 | } | ||
4824 | 125 | |||
4825 | 126 | return surface_buffer_stream->secure_client_buffer(); | ||
4834 | 127 | } | 122 | } |
4835 | 128 | 123 | ||
4836 | 129 | void ms::Surface::allow_framedropping(bool allow) | 124 | void ms::Surface::allow_framedropping(bool allow) |
4837 | @@ -136,12 +131,6 @@ | |||
4838 | 136 | return surface_buffer_stream->lock_snapshot_buffer(); | 131 | return surface_buffer_stream->lock_snapshot_buffer(); |
4839 | 137 | } | 132 | } |
4840 | 138 | 133 | ||
4841 | 139 | //TODO: this is just used in example code, could be private | ||
4842 | 140 | void ms::Surface::flag_for_render() | ||
4843 | 141 | { | ||
4844 | 142 | surface_state->frame_posted(); | ||
4845 | 143 | } | ||
4846 | 144 | |||
4847 | 145 | bool ms::Surface::supports_input() const | 134 | bool ms::Surface::supports_input() const |
4848 | 146 | { | 135 | { |
4849 | 147 | if (server_input_channel) | 136 | if (server_input_channel) |
4850 | 148 | 137 | ||
4851 | === modified file 'src/server/scene/surface.h' | |||
4852 | --- src/server/scene/surface.h 2013-11-20 16:22:32 +0000 | |||
4853 | +++ src/server/scene/surface.h 2013-11-28 12:22:03 +0000 | |||
4854 | @@ -50,9 +50,8 @@ | |||
4855 | 50 | geometry::PixelFormat pixel_format() const; | 50 | geometry::PixelFormat pixel_format() const; |
4856 | 51 | 51 | ||
4857 | 52 | std::shared_ptr<graphics::Buffer> snapshot_buffer() const; | 52 | std::shared_ptr<graphics::Buffer> snapshot_buffer() const; |
4859 | 53 | std::shared_ptr<graphics::Buffer> advance_client_buffer(); | 53 | void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer); |
4860 | 54 | void force_requests_to_complete(); | 54 | void force_requests_to_complete(); |
4861 | 55 | void flag_for_render(); | ||
4862 | 56 | 55 | ||
4863 | 57 | bool supports_input() const; | 56 | bool supports_input() const; |
4864 | 58 | int client_input_fd() const; | 57 | int client_input_fd() const; |
4865 | @@ -74,7 +73,6 @@ | |||
4866 | 74 | std::shared_ptr<compositor::BufferStream> surface_buffer_stream; | 73 | std::shared_ptr<compositor::BufferStream> surface_buffer_stream; |
4867 | 75 | std::shared_ptr<input::InputChannel> const server_input_channel; | 74 | std::shared_ptr<input::InputChannel> const server_input_channel; |
4868 | 76 | std::shared_ptr<SceneReport> const report; | 75 | std::shared_ptr<SceneReport> const report; |
4869 | 77 | bool surface_in_startup; | ||
4870 | 78 | }; | 76 | }; |
4871 | 79 | } | 77 | } |
4872 | 80 | } | 78 | } |
4873 | 81 | 79 | ||
4874 | === modified file 'src/server/scene/surface_data.cpp' | |||
4875 | --- src/server/scene/surface_data.cpp 2013-11-21 12:34:49 +0000 | |||
4876 | +++ src/server/scene/surface_data.cpp 2013-11-28 12:22:03 +0000 | |||
4877 | @@ -46,7 +46,7 @@ | |||
4878 | 46 | std::unique_lock<std::mutex> lk(guard); | 46 | std::unique_lock<std::mutex> lk(guard); |
4879 | 47 | 47 | ||
4880 | 48 | auto surface_size = surface_rect.size; | 48 | auto surface_size = surface_rect.size; |
4882 | 49 | auto surface_top_left = surface_rect.top_left; | 49 | auto surface_top_left = surface_rect.top_left; |
4883 | 50 | if (transformation_dirty || transformation_size != surface_size) | 50 | if (transformation_dirty || transformation_size != surface_size) |
4884 | 51 | { | 51 | { |
4885 | 52 | const glm::vec3 top_left_vec{surface_top_left.x.as_int(), | 52 | const glm::vec3 top_left_vec{surface_top_left.x.as_int(), |
4886 | @@ -183,7 +183,7 @@ | |||
4887 | 183 | if (rectangle.contains(point)) | 183 | if (rectangle.contains(point)) |
4888 | 184 | { | 184 | { |
4889 | 185 | return true; | 185 | return true; |
4891 | 186 | } | 186 | } |
4892 | 187 | } | 187 | } |
4893 | 188 | return false; | 188 | return false; |
4894 | 189 | } | 189 | } |
4895 | 190 | 190 | ||
4896 | === modified file 'src/server/scene/surface_impl.cpp' | |||
4897 | --- src/server/scene/surface_impl.cpp 2013-11-21 12:34:49 +0000 | |||
4898 | +++ src/server/scene/surface_impl.cpp 2013-11-28 12:22:03 +0000 | |||
4899 | @@ -104,16 +104,16 @@ | |||
4900 | 104 | return surface->pixel_format(); | 104 | return surface->pixel_format(); |
4901 | 105 | } | 105 | } |
4902 | 106 | 106 | ||
4904 | 107 | std::shared_ptr<mg::Buffer> ms::SurfaceImpl::advance_client_buffer() | 107 | void ms::SurfaceImpl::swap_buffers(std::shared_ptr<graphics::Buffer>& buffer) |
4905 | 108 | { | 108 | { |
4907 | 109 | return surface->advance_client_buffer(); | 109 | surface->swap_buffers(buffer); |
4908 | 110 | } | 110 | } |
4909 | 111 | 111 | ||
4910 | 112 | void ms::SurfaceImpl::allow_framedropping(bool allow) | 112 | void ms::SurfaceImpl::allow_framedropping(bool allow) |
4911 | 113 | { | 113 | { |
4912 | 114 | surface->allow_framedropping(allow); | 114 | surface->allow_framedropping(allow); |
4913 | 115 | } | 115 | } |
4915 | 116 | 116 | ||
4916 | 117 | void ms::SurfaceImpl::with_most_recent_buffer_do( | 117 | void ms::SurfaceImpl::with_most_recent_buffer_do( |
4917 | 118 | std::function<void(mg::Buffer&)> const& exec) | 118 | std::function<void(mg::Buffer&)> const& exec) |
4918 | 119 | { | 119 | { |
4919 | @@ -247,6 +247,15 @@ | |||
4920 | 247 | void ms::SurfaceImpl::resize(geom::Size const& size) | 247 | void ms::SurfaceImpl::resize(geom::Size const& size) |
4921 | 248 | { | 248 | { |
4922 | 249 | surface->resize(size); | 249 | surface->resize(size); |
4923 | 250 | |||
4924 | 251 | MirEvent e; | ||
4925 | 252 | memset(&e, 0, sizeof e); | ||
4926 | 253 | e.type = mir_event_type_resize; | ||
4927 | 254 | e.resize.surface_id = id.as_value(); | ||
4928 | 255 | e.resize.width = size.width.as_int(); | ||
4929 | 256 | e.resize.height = size.height.as_int(); | ||
4930 | 257 | |||
4931 | 258 | event_sink->handle_event(e); | ||
4932 | 250 | } | 259 | } |
4933 | 251 | 260 | ||
4934 | 252 | void ms::SurfaceImpl::set_rotation(float degrees, glm::vec3 const& axis) | 261 | void ms::SurfaceImpl::set_rotation(float degrees, glm::vec3 const& axis) |
4935 | 253 | 262 | ||
4936 | === modified file 'src/server/scene/surface_impl.h' | |||
4937 | --- src/server/scene/surface_impl.h 2013-11-20 16:22:32 +0000 | |||
4938 | +++ src/server/scene/surface_impl.h 2013-11-28 12:22:03 +0000 | |||
4939 | @@ -72,7 +72,7 @@ | |||
4940 | 72 | 72 | ||
4941 | 73 | virtual void with_most_recent_buffer_do( | 73 | virtual void with_most_recent_buffer_do( |
4942 | 74 | std::function<void(graphics::Buffer&)> const& exec); | 74 | std::function<void(graphics::Buffer&)> const& exec); |
4944 | 75 | virtual std::shared_ptr<graphics::Buffer> advance_client_buffer(); | 75 | virtual void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer); |
4945 | 76 | 76 | ||
4946 | 77 | virtual bool supports_input() const; | 77 | virtual bool supports_input() const; |
4947 | 78 | virtual int client_input_fd() const; | 78 | virtual int client_input_fd() const; |
4948 | 79 | 79 | ||
4949 | === modified file 'src/server/scene/surface_stack.h' | |||
4950 | --- src/server/scene/surface_stack.h 2013-11-21 12:34:49 +0000 | |||
4951 | +++ src/server/scene/surface_stack.h 2013-11-28 12:22:03 +0000 | |||
4952 | @@ -72,15 +72,15 @@ | |||
4953 | 72 | virtual void reverse_for_each_if(compositor::FilterForScene& filter, | 72 | virtual void reverse_for_each_if(compositor::FilterForScene& filter, |
4954 | 73 | compositor::OperatorForScene& op); | 73 | compositor::OperatorForScene& op); |
4955 | 74 | virtual void set_change_callback(std::function<void()> const& f); | 74 | virtual void set_change_callback(std::function<void()> const& f); |
4957 | 75 | 75 | ||
4958 | 76 | // From InputTargets | 76 | // From InputTargets |
4959 | 77 | void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback); | 77 | void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback); |
4960 | 78 | 78 | ||
4962 | 79 | // From SurfaceStackModel | 79 | // From SurfaceStackModel |
4963 | 80 | virtual std::weak_ptr<BasicSurface> create_surface(const shell::SurfaceCreationParameters& params); | 80 | virtual std::weak_ptr<BasicSurface> create_surface(const shell::SurfaceCreationParameters& params); |
4964 | 81 | 81 | ||
4965 | 82 | virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface); | 82 | virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface); |
4967 | 83 | 83 | ||
4968 | 84 | virtual void raise(std::weak_ptr<BasicSurface> const& surface); | 84 | virtual void raise(std::weak_ptr<BasicSurface> const& surface); |
4969 | 85 | 85 | ||
4970 | 86 | virtual void lock(); | 86 | virtual void lock(); |
4971 | 87 | 87 | ||
4972 | === modified file 'src/server/scene/surface_state.h' | |||
4973 | --- src/server/scene/surface_state.h 2013-11-20 16:22:32 +0000 | |||
4974 | +++ src/server/scene/surface_state.h 2013-11-28 12:22:03 +0000 | |||
4975 | @@ -29,10 +29,10 @@ | |||
4976 | 29 | { | 29 | { |
4977 | 30 | 30 | ||
4978 | 31 | class SurfaceState : public compositor::CompositingCriteria, public input::Surface, | 31 | class SurfaceState : public compositor::CompositingCriteria, public input::Surface, |
4980 | 32 | public MutableSurfaceState | 32 | public MutableSurfaceState |
4981 | 33 | { | 33 | { |
4982 | 34 | protected: | 34 | protected: |
4984 | 35 | SurfaceState() = default; | 35 | SurfaceState() = default; |
4985 | 36 | virtual ~SurfaceState() = default; | 36 | virtual ~SurfaceState() = default; |
4986 | 37 | SurfaceState(const SurfaceState&) = delete; | 37 | SurfaceState(const SurfaceState&) = delete; |
4987 | 38 | SurfaceState& operator=(const SurfaceState& ) = delete; | 38 | SurfaceState& operator=(const SurfaceState& ) = delete; |
4988 | 39 | 39 | ||
4989 | === modified file 'src/server/shell/default_focus_mechanism.cpp' | |||
4990 | --- src/server/shell/default_focus_mechanism.cpp 2013-11-21 03:16:21 +0000 | |||
4991 | +++ src/server/shell/default_focus_mechanism.cpp 2013-11-28 12:22:03 +0000 | |||
4992 | @@ -41,7 +41,7 @@ | |||
4993 | 41 | input_targeter->focus_cleared(); | 41 | input_targeter->focus_cleared(); |
4994 | 42 | return; | 42 | return; |
4995 | 43 | } | 43 | } |
4997 | 44 | 44 | ||
4998 | 45 | auto surface = focus_session->default_surface(); | 45 | auto surface = focus_session->default_surface(); |
4999 | 46 | if (surface) | 46 | if (surface) |
5000 | 47 | { | 47 | { |
The diff has been truncated for viewing.