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: mp+197050@code.launchpad.net |
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 | cmake_minimum_required (VERSION 2.6) |
6 | # Create target to discover tests |
7 | |
8 | -option( |
9 | +include(CMakeDependentOption) |
10 | + |
11 | +CMAKE_DEPENDENT_OPTION( |
12 | DISABLE_GTEST_TEST_DISCOVERY |
13 | "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior" |
14 | OFF |
15 | -) |
16 | + "NOT MIR_IS_CROSS_COMPILING" |
17 | + ON) |
18 | |
19 | option( |
20 | ENABLE_MEMCHECK_OPTION |
21 | @@ -19,15 +22,22 @@ |
22 | valgrind) |
23 | |
24 | if(VALGRIND_EXECUTABLE) |
25 | - set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes") |
26 | + if(MIR_PLATFORM STREQUAL "android") |
27 | + # don't exit with an error when valgrind find errors |
28 | + #set(VALGRIND_ARGS "--error-exitcode=1") |
29 | + else() |
30 | + set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes") |
31 | + endif() |
32 | + |
33 | set(ENABLE_MEMCHECK_FLAG "--enable-memcheck") |
34 | + |
35 | else(VALGRIND_EXECUTABLE) |
36 | message("Not enabling memcheck as valgrind is missing on your system") |
37 | endif(VALGRIND_EXECUTABLE) |
38 | endif(ENABLE_MEMCHECK_OPTION) |
39 | |
40 | function (mir_discover_tests EXECUTABLE) |
41 | - if(BUILD_ANDROID OR DISABLE_GTEST_TEST_DISCOVERY) |
42 | + if(DISABLE_GTEST_TEST_DISCOVERY) |
43 | add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}") |
44 | |
45 | if (${ARGC} GREATER 1) |
46 | @@ -74,7 +84,7 @@ |
47 | |
48 | function (mir_add_memcheck_test) |
49 | if (ENABLE_MEMCHECK_OPTION) |
50 | - if(BUILD_ANDROID OR DISABLE_GTEST_TEST_DISCOVERY) |
51 | + if(DISABLE_GTEST_TEST_DISCOVERY) |
52 | 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 | else() |
54 | add_custom_target( |
55 | |
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 | usr/bin/mir_stress |
61 | +usr/bin/mir_unit_tests |
62 | +usr/bin/mir_acceptance_tests |
63 | +usr/bin/mir_integration_tests |
64 | usr/lib/*/mir/tools/libmirclientlttng.so |
65 | usr/lib/*/mir/tools/libmirserverlttng.so |
66 | |
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 | ifeq ($(DEB_HOST_ARCH),armhf) |
72 | dh_auto_configure -- \ |
73 | $(COMMON_CONFIGURE_OPTIONS) \ |
74 | - -DMIR_PLATFORM=android \ |
75 | - -DMIR_ENABLE_UNIT_TESTS=NO \ |
76 | - -DMIR_ENABLE_ACCEPTANCE_TESTS=NO \ |
77 | - -DMIR_ENABLE_INTEGRATION_TESTS=NO |
78 | + -DMIR_PLATFORM=android |
79 | else |
80 | ifeq ($(DEB_HOST_ARCH),powerpc) |
81 | dh_auto_configure -- \ |
82 | |
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 | lastcount = count; |
88 | } |
89 | |
90 | - /* This is one way to handle window resizing. But in future it would be |
91 | - better to have resize events coming from the server */ |
92 | + /* |
93 | + * Querying the surface (actually the current buffer) dimensions here is |
94 | + * the only truly safe way to be sure that the dimensions we think we |
95 | + * have are those of the buffer being rendered to. But this should be |
96 | + * improved in future; https://bugs.launchpad.net/mir/+bug/1194384 |
97 | + */ |
98 | if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width) && |
99 | eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height)) |
100 | { |
101 | @@ -102,7 +106,7 @@ |
102 | } |
103 | } |
104 | |
105 | -static void mir_eglapp_handle_input(MirSurface* surface, MirEvent const* ev, void* context) |
106 | +static void mir_eglapp_handle_event(MirSurface* surface, MirEvent const* ev, void* context) |
107 | { |
108 | (void) surface; |
109 | (void) context; |
110 | @@ -112,6 +116,17 @@ |
111 | { |
112 | running = 0; |
113 | } |
114 | + else if (ev->type == mir_event_type_resize) |
115 | + { |
116 | + /* |
117 | + * FIXME: https://bugs.launchpad.net/mir/+bug/1194384 |
118 | + * It is unsafe to set the width and height here because we're in a |
119 | + * different thread to that doing the rendering. So we either need |
120 | + * support for event queuing (directing them to another thread) or |
121 | + * full single-threaded callbacks. (LP: #1194384). |
122 | + */ |
123 | + printf("Resized to %dx%d\n", ev->resize.width, ev->resize.height); |
124 | + } |
125 | } |
126 | |
127 | static unsigned int get_bpp(MirPixelFormat pf) |
128 | @@ -172,7 +187,7 @@ |
129 | }; |
130 | MirEventDelegate delegate = |
131 | { |
132 | - mir_eglapp_handle_input, |
133 | + mir_eglapp_handle_event, |
134 | NULL |
135 | }; |
136 | EGLConfig eglconfig; |
137 | |
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 | redraw(surface, canvas); |
143 | } |
144 | } |
145 | + else if (event->type == mir_event_type_resize) |
146 | + { |
147 | + /* FIXME: https://bugs.launchpad.net/mir/+bug/1194384 |
148 | + * mir_event_type_resize will arrive in a different thread to that of |
149 | + * mir_event_type_motion, so we cannot safely redraw from this thread. |
150 | + * Either the callbacks will need to become thread-safe, or we'd have |
151 | + * to employ some non-trivial event queuing and inter-thread signals, |
152 | + * which I think is beyond the scope of this example code. |
153 | + * |
154 | + * redraw(surface, canvas); |
155 | + */ |
156 | + } |
157 | } |
158 | |
159 | static const MirDisplayOutput *find_active_output( |
160 | |
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 | mf::SurfaceId(), {}); |
166 | |
167 | /* |
168 | - * We call advance_client_buffer() twice so that the surface is |
169 | + * We call swap_buffers() twice so that the surface is |
170 | * considers the first buffer to be posted. |
171 | * (TODO There must be a better way!) |
172 | */ |
173 | - s->advance_client_buffer(); |
174 | - s->advance_client_buffer(); |
175 | + { |
176 | + std::shared_ptr<mg::Buffer> tmp; |
177 | + s->swap_buffers(tmp); |
178 | + s->swap_buffers(tmp); |
179 | + } |
180 | |
181 | /* |
182 | * Place each surface at a different starting location and give it a |
183 | |
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 | /** |
189 | * Test for a valid connection |
190 | * \param [in] connection The connection |
191 | - * \return A non-zero value if the supplied connection is |
192 | - * valid, 0 otherwise |
193 | + * \return True if the supplied connection is valid, or |
194 | + * false otherwise. |
195 | */ |
196 | -int mir_connection_is_valid(MirConnection *connection); |
197 | +MirBool mir_connection_is_valid(MirConnection *connection); |
198 | |
199 | /** |
200 | * Retrieve a text description of the last error. The returned string is owned |
201 | @@ -104,7 +104,7 @@ |
202 | void mir_connection_set_lifecycle_event_callback(MirConnection* connection, |
203 | mir_lifecycle_event_callback callback, void* context); |
204 | |
205 | -/** |
206 | +/** |
207 | * \deprecated Use mir_connection_create_display_config |
208 | */ |
209 | __attribute__((__deprecated__("Use mir_connection_create_display_config()"))) |
210 | @@ -112,8 +112,8 @@ |
211 | |
212 | /** |
213 | * Query the display |
214 | - * \warning return value must be destroyed via mir_display_config_destroy() |
215 | - * \warning may return null if connection is invalid |
216 | + * \warning return value must be destroyed via mir_display_config_destroy() |
217 | + * \warning may return null if connection is invalid |
218 | * \param [in] connection The connection |
219 | * \return structure that describes the display configuration |
220 | */ |
221 | @@ -135,7 +135,7 @@ |
222 | |
223 | /** |
224 | * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config |
225 | - * \param [in] display_configuration The display_configuration information resource to be destroyed |
226 | + * \param [in] display_configuration The display_configuration information resource to be destroyed |
227 | */ |
228 | void mir_display_config_destroy(MirDisplayConfiguration* display_configuration); |
229 | |
230 | @@ -149,7 +149,7 @@ |
231 | * |
232 | * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message. |
233 | * \param [in] connection The connection |
234 | - * \param [in] display_configuration The display_configuration to apply |
235 | + * \param [in] display_configuration The display_configuration to apply |
236 | * \return A handle that can be passed to mir_wait_for |
237 | */ |
238 | MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration); |
239 | @@ -164,10 +164,10 @@ |
240 | /** |
241 | * Get the list of possible formats that a surface can be created with. |
242 | * \param [in] connection The connection |
243 | - * \param [out] formats List of valid formats to create surfaces with |
244 | + * \param [out] formats List of valid formats to create surfaces with |
245 | * \param [in] formats_size size of formats list |
246 | * \param [out] num_valid_formats number of valid formats returned in formats |
247 | - */ |
248 | + */ |
249 | void mir_connection_get_available_surface_formats( |
250 | MirConnection* connection, MirPixelFormat* formats, |
251 | unsigned const int format_size, unsigned int *num_valid_formats); |
252 | @@ -227,10 +227,10 @@ |
253 | /** |
254 | * Test for a valid surface |
255 | * \param [in] surface The surface |
256 | - * \return A non-zero value if the supplied surface is valid, |
257 | - * 0 otherwise |
258 | + * \return True if the supplied surface is valid, or |
259 | + * false otherwise. |
260 | */ |
261 | -int mir_surface_is_valid(MirSurface *surface); |
262 | +MirBool mir_surface_is_valid(MirSurface *surface); |
263 | |
264 | /** |
265 | * Retrieve a text description of the error. The returned string is owned by |
266 | @@ -253,7 +253,7 @@ |
267 | |
268 | /** |
269 | * Get the underlying platform type so the buffer obtained in "raw" representation |
270 | - * in mir_surface_get_current_buffer() can be understood |
271 | + * in mir_surface_get_current_buffer() can be understood |
272 | * \pre The surface is valid |
273 | * \param [in] surface The surface |
274 | * \return One of mir_platform_type_android or mir_platform_type_gbm |
275 | @@ -386,12 +386,12 @@ |
276 | /** |
277 | * Set the swapinterval for mir_surface_swap_buffers. EGL users should use |
278 | * eglSwapInterval directly. |
279 | - * At the time being, only swapinterval of 0 or 1 is supported. |
280 | + * At the time being, only swapinterval of 0 or 1 is supported. |
281 | * \param [in] surface The surface to operate on |
282 | * \param [in] interval The number of vblank signals that |
283 | - * mir_surface_swap_buffers will wait for |
284 | + * mir_surface_swap_buffers will wait for |
285 | * \return A wait handle that can be passed to mir_wait_for, |
286 | - * or NULL if the interval could not be supported |
287 | + * or NULL if the interval could not be supported |
288 | */ |
289 | MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval); |
290 | |
291 | |
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 | * This is the buffer that is currently being drawn to, |
297 | * and would be returned by mir_surface_get_current_buffer. |
298 | */ |
299 | -uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface); |
300 | +uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface); |
301 | |
302 | #endif /* MIR_CLIENT_LIBRARY_DEBUG_H */ |
303 | |
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 | public: |
309 | virtual ~InternalSurface() = default; |
310 | |
311 | - virtual std::shared_ptr<Buffer> advance_client_buffer() = 0; |
312 | + virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0; |
313 | virtual geometry::Size size() const = 0; |
314 | virtual MirPixelFormat pixel_format() const = 0; |
315 | |
316 | |
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 | public: |
322 | virtual ~BufferStream() = default; |
323 | |
324 | - virtual std::shared_ptr<graphics::Buffer> secure_client_buffer() = 0; |
325 | + virtual void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) = 0; |
326 | + virtual void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) = 0; |
327 | virtual std::shared_ptr<graphics::Buffer> |
328 | lock_compositor_buffer(unsigned long frameno) = 0; |
329 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; |
330 | |
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 | namespace compositor |
336 | { |
337 | |
338 | -class CompositingCriteria |
339 | +class CompositingCriteria |
340 | { |
341 | public: |
342 | virtual float alpha() const = 0; |
343 | |
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 | class Drawer; |
349 | class DisplayBufferCompositorFactory; |
350 | class Compositor; |
351 | -class OverlayRenderer; |
352 | class RendererFactory; |
353 | } |
354 | namespace frontend |
355 | @@ -152,7 +151,6 @@ |
356 | * configurable interfaces for modifying compositor |
357 | * @{ */ |
358 | virtual std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory(); |
359 | - virtual std::shared_ptr<compositor::OverlayRenderer> the_overlay_renderer(); |
360 | /** @} */ |
361 | |
362 | /** @name compositor configuration - dependencies |
363 | @@ -279,7 +277,6 @@ |
364 | CachedPtr<shell::DisplayLayout> shell_display_layout; |
365 | CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator; |
366 | CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory; |
367 | - CachedPtr<compositor::OverlayRenderer> overlay_renderer; |
368 | CachedPtr<compositor::Compositor> compositor; |
369 | CachedPtr<logging::Logger> logger; |
370 | CachedPtr<graphics::DisplayReport> display_report; |
371 | |
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 | virtual void exception_handled(void const* mediator, int id, std::exception const& error) = 0; |
377 | |
378 | virtual void exception_handled(void const* mediator, std::exception const& error) = 0; |
379 | - |
380 | + |
381 | virtual void sent_event(void const* mediator, MirSurfaceEvent const& ev) = 0; |
382 | |
383 | private: |
384 | |
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 | void exception_handled(void const*, int, std::exception const&); |
390 | |
391 | void exception_handled(void const*, std::exception const&); |
392 | - |
393 | + |
394 | void sent_event(void const*, MirSurfaceEvent const& e); |
395 | }; |
396 | } |
397 | |
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 | { |
403 | public: |
404 | virtual ~SessionAuthorizer() {} |
405 | - |
406 | + |
407 | virtual bool connection_is_allowed(pid_t pid) = 0; |
408 | virtual bool configure_display_is_allowed(pid_t pid) = 0; |
409 | protected: |
410 | |
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 | virtual geometry::Size size() const = 0; |
416 | virtual geometry::PixelFormat pixel_format() const = 0; |
417 | |
418 | - virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0; |
419 | + virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0; |
420 | |
421 | virtual bool supports_input() const = 0; |
422 | virtual int client_input_fd() const = 0; |
423 | |
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 | virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar() = 0; |
429 | virtual std::shared_ptr<shell::InputTargeter> the_input_targeter() = 0; |
430 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; |
431 | - |
432 | + |
433 | virtual void set_input_targets(std::shared_ptr<input::InputTargets> const& targets) = 0; |
434 | |
435 | protected: |
436 | |
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 | { |
442 | public: |
443 | virtual ~InputReport() = default; |
444 | - |
445 | + |
446 | virtual void received_event_from_kernel(int64_t when, int type, int code, int value) = 0; |
447 | |
448 | virtual void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; |
449 | @@ -39,7 +39,7 @@ |
450 | virtual void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0; |
451 | |
452 | virtual void received_event_finished_signal(int src_fd, uint32_t seq_id) = 0; |
453 | - |
454 | + |
455 | protected: |
456 | InputReport() = default; |
457 | InputReport(InputReport const&) = delete; |
458 | |
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 | public: |
464 | NullInputReport() = default; |
465 | virtual ~NullInputReport() noexcept(true) = default; |
466 | - |
467 | + |
468 | void received_event_from_kernel(int64_t when, int type, int code, int value); |
469 | |
470 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
471 | |
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 | { |
477 | namespace input |
478 | { |
479 | -class Surface |
480 | +class Surface |
481 | { |
482 | public: |
483 | virtual std::string const& name() const = 0; |
484 | @@ -36,7 +36,7 @@ |
485 | virtual bool contains(geometry::Point const& point) const = 0; |
486 | |
487 | protected: |
488 | - Surface() = default; |
489 | + Surface() = default; |
490 | virtual ~Surface() = default; |
491 | Surface(const Surface&) = delete; |
492 | Surface& operator=(const Surface& ) = delete; |
493 | |
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 | public: |
499 | InputReport(std::shared_ptr<Logger> const& logger); |
500 | virtual ~InputReport() noexcept(true) = default; |
501 | - |
502 | + |
503 | void received_event_from_kernel(int64_t when, int type, int code, int value); |
504 | |
505 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
506 | void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
507 | |
508 | void received_event_finished_signal(int src_fd, uint32_t seq_id); |
509 | - |
510 | + |
511 | private: |
512 | char const* component(); |
513 | std::shared_ptr<Logger> const logger; |
514 | |
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 | public: |
520 | InputReport() = default; |
521 | virtual ~InputReport() noexcept(true) = default; |
522 | - |
523 | + |
524 | void received_event_from_kernel(int64_t when, int type, int code, int value); |
525 | |
526 | void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
527 | void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time); |
528 | |
529 | void received_event_finished_signal(int src_fd, uint32_t seq_id); |
530 | - |
531 | + |
532 | private: |
533 | ServerTracepointProvider tp_provider; |
534 | }; |
535 | |
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 | { |
541 | public: |
542 | virtual ~InputRegistrar() = default; |
543 | - |
544 | + |
545 | virtual void input_channel_opened(std::shared_ptr<input::InputChannel> const& opened_channel, |
546 | std::shared_ptr<input::Surface> const& info, |
547 | input::InputReceptionMode input_mode) = 0; |
548 | |
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 | { |
554 | public: |
555 | virtual ~InputTargeter() = default; |
556 | - |
557 | + |
558 | virtual void focus_changed(std::shared_ptr<input::InputChannel const> const& focus_channel) = 0; |
559 | virtual void focus_cleared() = 0; |
560 | |
561 | |
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 | virtual void stopping(std::shared_ptr<Session> const& session) = 0; |
567 | virtual void focused(std::shared_ptr<Session> const& session) = 0; |
568 | virtual void unfocused() = 0; |
569 | - |
570 | + |
571 | virtual void surface_created(Session& session, std::shared_ptr<Surface> const& surface) = 0; |
572 | virtual void destroying_surface(Session& session, std::shared_ptr<Surface> const& surface) = 0; |
573 | |
574 | |
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 | { |
580 | public: |
581 | virtual ~SurfaceConfigurator() = default; |
582 | - |
583 | + |
584 | /// Returns the selected value. |
585 | virtual int select_attribute_value(Surface const& surface, MirSurfaceAttrib attrib, |
586 | int requested_value) = 0; |
587 | |
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 | |
593 | namespace mir |
594 | { |
595 | -namespace scene |
596 | +namespace scene |
597 | { |
598 | class BasicSurface; |
599 | } |
600 | |
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 | SurfaceCreationParameters& of_size(geometry::Size new_size); |
606 | |
607 | SurfaceCreationParameters& of_size(geometry::Width::ValueType width, geometry::Height::ValueType height); |
608 | - |
609 | + |
610 | SurfaceCreationParameters& of_position(geometry::Point const& top_left); |
611 | |
612 | SurfaceCreationParameters& of_buffer_usage(graphics::BufferUsage new_buffer_usage); |
613 | |
614 | SurfaceCreationParameters& of_pixel_format(geometry::PixelFormat new_pixel_format); |
615 | - |
616 | + |
617 | SurfaceCreationParameters& of_depth(scene::DepthId const& new_depth); |
618 | - |
619 | + |
620 | SurfaceCreationParameters& with_input_mode(input::InputReceptionMode const& new_mode); |
621 | |
622 | SurfaceCreationParameters& with_output_id(graphics::DisplayConfigurationOutputId const& output_id); |
623 | |
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 | Point top_left; |
629 | Size size; |
630 | |
631 | - /** |
632 | + /** |
633 | * The bottom right boundary point of the rectangle. |
634 | * |
635 | * Note that the returned point is *not* included in the rectangle |
636 | |
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 | virtual void driver_returns_buffer(ANativeWindowBuffer*, int fence) = 0; |
642 | virtual void dispatch_driver_request_format(int format) = 0; |
643 | virtual int driver_requests_info(int key) const = 0; |
644 | - virtual void sync_to_display(bool sync) = 0; |
645 | + virtual void sync_to_display(bool sync) = 0; |
646 | protected: |
647 | AndroidDriverInterpreter() {}; |
648 | virtual ~AndroidDriverInterpreter() {}; |
649 | |
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 | |
655 | namespace mir |
656 | { |
657 | -namespace graphics |
658 | +namespace graphics |
659 | { |
660 | namespace android |
661 | { |
662 | |
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 | namespace graphics |
668 | { |
669 | |
670 | -class NativeBuffer |
671 | +class NativeBuffer |
672 | { |
673 | public: |
674 | virtual ~NativeBuffer() = default; |
675 | @@ -37,7 +37,7 @@ |
676 | virtual android::NativeFence copy_fence() const = 0; |
677 | |
678 | virtual void wait_for_content() = 0; |
679 | - virtual void update_fence(android::NativeFence& fence) = 0; |
680 | + virtual void update_fence(android::NativeFence& fence) = 0; |
681 | |
682 | protected: |
683 | NativeBuffer() = default; |
684 | |
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 | namespace android |
690 | { |
691 | |
692 | -/// The Lexicon translates droidinput event types to MirEvent types prior to |
693 | +/// The Lexicon translates droidinput event types to MirEvent types prior to |
694 | /// shell or client handling. |
695 | class Lexicon |
696 | { |
697 | |
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 | class InputPlatform |
703 | { |
704 | public: |
705 | - virtual ~InputPlatform() {}; |
706 | + virtual ~InputPlatform() {}; |
707 | |
708 | virtual std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback) = 0; |
709 | |
710 | |
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 | public: |
716 | XKBMapper(); |
717 | virtual ~XKBMapper() = default; |
718 | - |
719 | + |
720 | void update_state_and_map_event(MirKeyEvent& key_ev); |
721 | |
722 | protected: |
723 | |
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 | extern "C" { |
729 | #endif |
730 | |
731 | +typedef enum MirBool |
732 | +{ |
733 | + mir_false = 0, |
734 | + mir_true = 1 |
735 | +} MirBool; |
736 | + |
737 | /* Display server connection API */ |
738 | typedef void* MirEGLNativeWindowType; |
739 | typedef void* MirEGLNativeDisplayType; |
740 | @@ -157,7 +163,7 @@ |
741 | typedef enum MirPlatformType |
742 | { |
743 | mir_platform_type_gbm, |
744 | - mir_platform_type_android |
745 | + mir_platform_type_android |
746 | } MirPlatformType; |
747 | |
748 | typedef struct MirPlatformPackage |
749 | @@ -184,7 +190,7 @@ |
750 | |
751 | } MirGraphicsRegion; |
752 | |
753 | -/** |
754 | +/** |
755 | * DEPRECATED. use MirDisplayConfiguration |
756 | */ |
757 | enum { mir_supported_pixel_format_max = 32 }; |
758 | @@ -192,7 +198,7 @@ |
759 | { |
760 | uint32_t width; |
761 | uint32_t height; |
762 | - |
763 | + |
764 | int supported_pixel_format_items; |
765 | MirPixelFormat supported_pixel_format[mir_supported_pixel_format_max]; |
766 | } MirDisplayInfo; |
767 | @@ -240,7 +246,7 @@ |
768 | uint32_t num_modes; |
769 | MirDisplayMode* modes; |
770 | uint32_t preferred_mode; |
771 | - uint32_t current_mode; |
772 | + uint32_t current_mode; |
773 | |
774 | uint32_t num_output_formats; |
775 | MirPixelFormat* output_formats; |
776 | @@ -257,7 +263,7 @@ |
777 | |
778 | uint32_t physical_width_mm; |
779 | uint32_t physical_height_mm; |
780 | - |
781 | + |
782 | MirPowerMode power_mode; |
783 | } MirDisplayOutput; |
784 | |
785 | |
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 | { |
791 | mir_event_type_key, |
792 | mir_event_type_motion, |
793 | - mir_event_type_surface |
794 | + mir_event_type_surface, |
795 | + mir_event_type_resize |
796 | } MirEventType; |
797 | |
798 | typedef enum { |
799 | @@ -141,7 +142,7 @@ |
800 | |
801 | int32_t device_id; |
802 | int32_t source_id; |
803 | - /* |
804 | + /* |
805 | * TODO(racarr): We would like to store this as a MirMotionAction but the android input stack |
806 | * encodes some non enumerable values in it. It's convenient to keep things |
807 | * this way for now until we can drop SF/Hybris support in QtUbuntu. |
808 | @@ -194,12 +195,22 @@ |
809 | int value; |
810 | } MirSurfaceEvent; |
811 | |
812 | +typedef struct |
813 | +{ |
814 | + MirEventType type; |
815 | + |
816 | + int surface_id; |
817 | + int width; |
818 | + int height; |
819 | +} MirResizeEvent; |
820 | + |
821 | typedef union |
822 | { |
823 | MirEventType type; |
824 | MirKeyEvent key; |
825 | MirMotionEvent motion; |
826 | MirSurfaceEvent surface; |
827 | + MirResizeEvent resize; |
828 | } MirEvent; |
829 | |
830 | #ifdef __cplusplus |
831 | |
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 | struct ANativeWindowBuffer; |
837 | typedef struct ANativeWindowBuffer MirNativeBuffer; |
838 | #else |
839 | -typedef struct MirBufferPackage MirNativeBuffer; |
840 | +typedef struct MirBufferPackage MirNativeBuffer; |
841 | #endif |
842 | #endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */ |
843 | |
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 | +/* |
849 | + * Copyright © 2013 Canonical Ltd. |
850 | + * |
851 | + * This program is free software: you can redistribute it and/or modify it |
852 | + * under the terms of the GNU General Public License version 3, |
853 | + * as published by the Free Software Foundation. |
854 | + * |
855 | + * This program is distributed in the hope that it will be useful, |
856 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
857 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
858 | + * GNU General Public License for more details. |
859 | + * |
860 | + * You should have received a copy of the GNU General Public License |
861 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
862 | + * |
863 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
864 | + */ |
865 | + |
866 | +#ifndef GMOCK_SET_ARG_H_ |
867 | +#define GMOCK_SET_ARG_H_ |
868 | + |
869 | +#include <gmock/gmock.h> |
870 | + |
871 | +namespace testing |
872 | +{ |
873 | +namespace internal |
874 | +{ |
875 | +template <size_t N, typename A, bool kIsProto> |
876 | +class SetArgumentAction { |
877 | + public: |
878 | + // Constructs an action that sets the variable pointed to by the |
879 | + // N-th function argument to 'value'. |
880 | + explicit SetArgumentAction(const A& value) : value_(value) {} |
881 | + |
882 | + template <typename Result, typename ArgumentTuple> |
883 | + void Perform(const ArgumentTuple& args) const { |
884 | + CompileAssertTypesEqual<void, Result>(); |
885 | + ::std::tr1::get<N>(args) = value_; |
886 | + } |
887 | + |
888 | + private: |
889 | + const A value_; |
890 | + |
891 | + GTEST_DISALLOW_ASSIGN_(SetArgumentAction); |
892 | +}; |
893 | +} |
894 | +template <size_t N, typename T> |
895 | +PolymorphicAction< |
896 | + internal::SetArgumentAction< |
897 | + N, T, internal::IsAProtocolMessage<T>::value> > |
898 | +SetArg(const T& x) { |
899 | + return MakePolymorphicAction(internal::SetArgumentAction< |
900 | + N, T, internal::IsAProtocolMessage<T>::value>(x)); |
901 | +} |
902 | +} |
903 | + |
904 | +#endif /* GMOCK_SET_ARG_H_ */ |
905 | |
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 | { |
911 | int key_row = i % Rows; |
912 | int key_col = j % Cols; |
913 | - uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); |
914 | + uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); |
915 | *pixel = color_pattern[key_row][key_col]; |
916 | } |
917 | } |
918 | @@ -58,7 +58,7 @@ |
919 | { |
920 | int key_row = i % Rows; |
921 | int key_col = j % Cols; |
922 | - uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); |
923 | + uint32_t *pixel = reinterpret_cast<uint32_t*>(®ion.vaddr[j*region.stride + (i * bpp)]); |
924 | if ( *pixel != color_pattern[key_row][key_col] ) |
925 | { |
926 | return false; |
927 | |
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 | |
933 | droidinput::sp<droidinput::EventHubInterface> the_event_hub(); |
934 | input::android::FakeEventHub* the_fake_event_hub(); |
935 | - |
936 | + |
937 | bool is_key_repeat_enabled() override { return false; } |
938 | |
939 | |
940 | |
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 | class MockAllocAdaptor : public graphics::android::GraphicAllocAdaptor |
946 | { |
947 | public: |
948 | - MOCK_METHOD3(alloc_buffer, |
949 | + MOCK_METHOD3(alloc_buffer, |
950 | std::shared_ptr<graphics::NativeBuffer>(geometry::Size, geometry::PixelFormat, graphics::android::BufferUsage)); |
951 | }; |
952 | |
953 | |
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 | #define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_ |
959 | |
960 | #include "mir/graphics/android/native_buffer.h" |
961 | -#include <gmock/gmock.h> |
962 | +#include <gmock/gmock.h> |
963 | |
964 | namespace mir |
965 | { |
966 | |
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 | struct MockAndroidRegistrar : public client::android::AndroidRegistrar |
972 | { |
973 | ~MockAndroidRegistrar() noexcept {} |
974 | - MOCK_CONST_METHOD1(register_buffer, |
975 | + MOCK_CONST_METHOD1(register_buffer, |
976 | std::shared_ptr<const native_handle_t>(std::shared_ptr<MirBufferPackage> const&)); |
977 | MOCK_METHOD2(secure_for_cpu, std::shared_ptr<char>(std::shared_ptr<const native_handle_t>, geometry::Rectangle)); |
978 | }; |
979 | |
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 | { |
985 | struct MockBufferStream : public compositor::BufferStream |
986 | { |
987 | - MOCK_METHOD0(secure_client_buffer, std::shared_ptr<graphics::Buffer>()); |
988 | + MOCK_METHOD1(swap_client_buffers, void(std::shared_ptr<graphics::Buffer>&)); |
989 | + MOCK_METHOD1(release_client_buffer, void(std::shared_ptr<graphics::Buffer>&)); |
990 | MOCK_METHOD1(lock_compositor_buffer, |
991 | std::shared_ptr<graphics::Buffer>(unsigned long)); |
992 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); |
993 | |
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 | #include "mir/graphics/buffer.h" |
999 | #include "src/server/graphics/android/display_device.h" |
1000 | #include <gmock/gmock.h> |
1001 | - |
1002 | + |
1003 | namespace mir |
1004 | { |
1005 | namespace test |
1006 | |
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 | public: |
1012 | MockEGL(); |
1013 | ~MockEGL(); |
1014 | - void silence_uninteresting(); |
1015 | |
1016 | typedef void (*generic_function_pointer_t)(void); |
1017 | |
1018 | |
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 | {0,0,0,0,0,0,0}, |
1024 | nullptr, nullptr,nullptr,nullptr, nullptr,nullptr, |
1025 | {0,0,0,0,0,0} |
1026 | - }) |
1027 | + }) |
1028 | { |
1029 | post = hook_post; |
1030 | - setSwapInterval = hook_setSwapInterval; |
1031 | + setSwapInterval = hook_setSwapInterval; |
1032 | + enableScreen = hook_enableScreen; |
1033 | } |
1034 | |
1035 | MockFBHalDevice() |
1036 | @@ -72,12 +73,20 @@ |
1037 | static int hook_setSwapInterval(struct framebuffer_device_t* mock_fb, int interval) |
1038 | { |
1039 | MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb); |
1040 | - return mocker->setSwapInterval_interface(mock_fb, interval); |
1041 | - } |
1042 | - |
1043 | + return mocker->setSwapInterval_interface(mock_fb, interval); |
1044 | + } |
1045 | + |
1046 | + static int hook_enableScreen(struct framebuffer_device_t* mock_fb, int enable) |
1047 | + { |
1048 | + MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb); |
1049 | + return mocker->enableScreen_interface(mock_fb, enable); |
1050 | + } |
1051 | + |
1052 | + |
1053 | + MOCK_METHOD2(enableScreen_interface, int(struct framebuffer_device_t*, int)); |
1054 | MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t)); |
1055 | MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int)); |
1056 | - |
1057 | + |
1058 | hw_device_t empty_module; |
1059 | }; |
1060 | |
1061 | |
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 | |
1067 | MOCK_METHOD0(destroy, void()); |
1068 | MOCK_METHOD0(force_requests_to_complete, void()); |
1069 | - MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>()); |
1070 | + MOCK_METHOD1(swap_buffers, void(std::shared_ptr<graphics::Buffer>&)); |
1071 | |
1072 | MOCK_CONST_METHOD0(size, geometry::Size()); |
1073 | MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat()); |
1074 | |
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 | |
1080 | void hwc_set_return_fence(int fence) |
1081 | { |
1082 | - fb_fence = fence; |
1083 | + fb_fence = fence; |
1084 | } |
1085 | |
1086 | int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t** displays) |
1087 | @@ -87,7 +87,7 @@ |
1088 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; |
1089 | } |
1090 | |
1091 | - if (primary_display->hwLayers) |
1092 | + if (primary_display->numHwLayers >= 2) |
1093 | { |
1094 | primary_display->hwLayers[1].releaseFenceFd = fb_fence; |
1095 | } |
1096 | |
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 | MOCK_METHOD2(transferTouchFocus, bool(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputChannel> const&)); |
1102 | MOCK_METHOD3(registerInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputWindowHandle> const&, bool)); |
1103 | MOCK_METHOD1(unregisterInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&)); |
1104 | - |
1105 | + |
1106 | MOCK_METHOD1(setKeyboardFocus, void(droidinput::sp<droidinput::InputWindowHandle> const&)); |
1107 | MOCK_METHOD1(notifyWindowRemoved, void(droidinput::sp<droidinput::InputWindowHandle> const&)); |
1108 | |
1109 | |
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 | namespace doubles |
1115 | { |
1116 | |
1117 | -class MockInputSurface : public input::Surface |
1118 | +class MockInputSurface : public input::Surface |
1119 | { |
1120 | public: |
1121 | MockInputSurface() |
1122 | |
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 | MOCK_METHOD1(stopping, void(std::shared_ptr<shell::Session> const&)); |
1128 | MOCK_METHOD1(focused, void(std::shared_ptr<shell::Session> const&)); |
1129 | MOCK_METHOD0(unfocused, void()); |
1130 | - |
1131 | + |
1132 | MOCK_METHOD2(surface_created, void(shell::Session&, std::shared_ptr<shell::Surface> const&)); |
1133 | MOCK_METHOD2(destroying_surface, void(shell::Session&, std::shared_ptr<shell::Surface> const&)); |
1134 | }; |
1135 | |
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 | |
1141 | MOCK_METHOD0(hide, void()); |
1142 | MOCK_METHOD0(show, void()); |
1143 | - |
1144 | + |
1145 | MOCK_METHOD1(send_display_config, void(graphics::DisplayConfiguration const&)); |
1146 | MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int)); |
1147 | |
1148 | |
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 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ |
1154 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_ |
1155 | |
1156 | -#include "mir/compositor/buffer_stream.h" |
1157 | #include "src/server/compositor/renderer.h" |
1158 | |
1159 | #include <gmock/gmock.h> |
1160 | @@ -32,9 +31,8 @@ |
1161 | |
1162 | struct MockSurfaceRenderer : public compositor::Renderer |
1163 | { |
1164 | - MOCK_METHOD3(render, void( |
1165 | - std::function<void(std::shared_ptr<void> const&)>, compositor::CompositingCriteria const&, compositor::BufferStream&)); |
1166 | - MOCK_METHOD1(clear, void(unsigned long)); |
1167 | + MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&)); |
1168 | + MOCK_CONST_METHOD0(clear, void()); |
1169 | |
1170 | ~MockSurfaceRenderer() noexcept {} |
1171 | }; |
1172 | |
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 | stub_client_buffer = std::make_shared<StubBuffer>(); |
1178 | stub_compositor_buffer = std::make_shared<StubBuffer>(); |
1179 | } |
1180 | - std::shared_ptr<graphics::Buffer> secure_client_buffer() |
1181 | - { |
1182 | - return stub_client_buffer; |
1183 | - } |
1184 | - |
1185 | - std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) |
1186 | - { |
1187 | - return stub_compositor_buffer; |
1188 | - } |
1189 | - |
1190 | - std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() |
1191 | - { |
1192 | - return stub_compositor_buffer; |
1193 | - } |
1194 | - |
1195 | - geometry::PixelFormat get_stream_pixel_format() |
1196 | + void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) override |
1197 | + { |
1198 | + buffer = stub_client_buffer; |
1199 | + } |
1200 | + void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) override |
1201 | + { |
1202 | + buffer.reset(); |
1203 | + } |
1204 | + std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override |
1205 | + { |
1206 | + return stub_compositor_buffer; |
1207 | + } |
1208 | + |
1209 | + std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override |
1210 | + { |
1211 | + return stub_compositor_buffer; |
1212 | + } |
1213 | + |
1214 | + geometry::PixelFormat get_stream_pixel_format() override |
1215 | { |
1216 | return geometry::PixelFormat(); |
1217 | } |
1218 | |
1219 | - geometry::Size stream_size() |
1220 | + geometry::Size stream_size() override |
1221 | { |
1222 | return geometry::Size(); |
1223 | } |
1224 | @@ -66,11 +69,11 @@ |
1225 | { |
1226 | } |
1227 | |
1228 | - void force_requests_to_complete() |
1229 | + void force_requests_to_complete() override |
1230 | { |
1231 | } |
1232 | |
1233 | - void allow_framedropping(bool) |
1234 | + void allow_framedropping(bool) override |
1235 | { |
1236 | } |
1237 | |
1238 | |
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 | return std::unique_ptr<graphics::DisplayBuffer>( |
1244 | new StubDisplayBuffer(geometry::Rectangle{{0,0},sz})); |
1245 | } |
1246 | - |
1247 | + |
1248 | std::shared_ptr<graphics::android::DisplayDevice> create_display_device() |
1249 | { |
1250 | return stub_dev; |
1251 | |
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 | modes.push_back(mode); |
1257 | } |
1258 | |
1259 | - size_t mode_index = modes.size() - 1; |
1260 | + size_t mode_index = modes.size() - 1; |
1261 | geometry::Size physical_size{}; |
1262 | geometry::Point top_left{}; |
1263 | graphics::DisplayConfigurationOutput output{ |
1264 | |
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 | #define MIR_TEST_DOUBLES_STUB_DISPLAY_DEVICE_H_ |
1270 | |
1271 | #include "src/server/graphics/android/display_device.h" |
1272 | - |
1273 | + |
1274 | namespace mir |
1275 | { |
1276 | namespace test |
1277 | @@ -41,7 +41,7 @@ |
1278 | void prepare_composition() |
1279 | { |
1280 | } |
1281 | - void gpu_render(EGLDisplay, EGLSurface) |
1282 | + void gpu_render(EGLDisplay, EGLSurface) |
1283 | { |
1284 | } |
1285 | void post(graphics::Buffer const&) |
1286 | |
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 | void driver_returns_buffer(ANativeWindowBuffer*, int) |
1292 | { |
1293 | } |
1294 | - void dispatch_driver_request_format(int) |
1295 | + void dispatch_driver_request_format(int) |
1296 | { |
1297 | } |
1298 | int driver_requests_info(int index) const |
1299 | |
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 | void take_snapshot(shell::SnapshotCallback const&) override |
1305 | { |
1306 | } |
1307 | - |
1308 | + |
1309 | std::shared_ptr<shell::Surface> default_surface() const override |
1310 | { |
1311 | return std::shared_ptr<shell::Surface>(); |
1312 | |
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 | -/* |
1318 | - * Copyright © 2013 Canonical Ltd. |
1319 | - * |
1320 | - * This program is free software: you can redistribute it and/or modify it |
1321 | - * under the terms of the GNU General Public License version 3, |
1322 | - * as published by the Free Software Foundation. |
1323 | - * |
1324 | - * This program is distributed in the hope that it will be useful, |
1325 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1326 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1327 | - * GNU General Public License for more details. |
1328 | - * |
1329 | - * You should have received a copy of the GNU General Public License |
1330 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1331 | - * |
1332 | - * Authored by: Robert Carr <robert.carr@canonical.com> |
1333 | - */ |
1334 | - |
1335 | -#ifndef MIR_TEST_DOUBLES_STUB_SURFACE_H_ |
1336 | -#define MIR_TEST_DOUBLES_STUB_SURFACE_H_ |
1337 | - |
1338 | -#include "mir/frontend/surface.h" |
1339 | - |
1340 | -namespace mir |
1341 | -{ |
1342 | -namespace test |
1343 | -{ |
1344 | -namespace doubles |
1345 | -{ |
1346 | - |
1347 | -class StubSurface : public frontend::Surface |
1348 | -{ |
1349 | -public: |
1350 | - virtual ~StubSurface() = default; |
1351 | - |
1352 | - void hide() {} |
1353 | - void show() {} |
1354 | - void force_requests_to_complete() {} |
1355 | - |
1356 | - geometry::Size size() const |
1357 | - { |
1358 | - return geometry::Size(); |
1359 | - } |
1360 | - geometry::PixelFormat pixel_format() const |
1361 | - { |
1362 | - return geometry::PixelFormat(); |
1363 | - } |
1364 | - |
1365 | - std::shared_ptr<graphics::Buffer> advance_client_buffer() |
1366 | - { |
1367 | - return std::shared_ptr<graphics::Buffer>(); |
1368 | - } |
1369 | - |
1370 | - virtual int configure(MirSurfaceAttrib, int) |
1371 | - { |
1372 | - return 0; |
1373 | - } |
1374 | - |
1375 | - virtual bool supports_input() const |
1376 | - { |
1377 | - return false; |
1378 | - } |
1379 | - |
1380 | - virtual int client_input_fd() const |
1381 | - { |
1382 | - return 0; |
1383 | - } |
1384 | -}; |
1385 | - |
1386 | -} |
1387 | -} |
1388 | -} // namespace mir |
1389 | - |
1390 | -#endif // MIR_TEST_DOUBLES_STUB_SURFACE_H_ |
1391 | |
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 | // Throws std::runtime_error if not successful. |
1397 | unsigned int wait_for_signal_ready_for(const std::chrono::milliseconds& duration); |
1398 | unsigned int wait_for_signal_ready_for(); |
1399 | - |
1400 | + |
1401 | void signal_ready(); |
1402 | unsigned int wait_for_signal_ready(); |
1403 | |
1404 | |
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 | |
1410 | void exec(); |
1411 | void on_exit(); |
1412 | - |
1413 | + |
1414 | std::shared_ptr<mir::input::InputConfiguration> the_input_configuration() override; |
1415 | |
1416 | mir::input::android::FakeEventHub* fake_event_hub; |
1417 | @@ -71,7 +71,7 @@ |
1418 | |
1419 | private: |
1420 | std::thread input_injection_thread; |
1421 | - |
1422 | + |
1423 | std::shared_ptr<mir::test::doubles::FakeEventHubInputConfiguration> input_configuration; |
1424 | }; |
1425 | |
1426 | |
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 | virtual bool use_real_graphics(mir::options::Option const& options) |
1432 | { |
1433 | return options.get("tests-use-real-graphics", false); |
1434 | - } |
1435 | + } |
1436 | }; |
1437 | |
1438 | } |
1439 | |
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 | cmake --build ${BUILD_DIR} |
1445 | |
1446 | GTEST_OUTPUT=xml:./ |
1447 | -${BUILD_DIR}/bin/acceptance-tests |
1448 | -${BUILD_DIR}/bin/integration-tests |
1449 | -${BUILD_DIR}/bin/unit-tests |
1450 | +${BUILD_DIR}/bin/mir_acceptance_tests |
1451 | +${BUILD_DIR}/bin/mir_integration_tests |
1452 | +${BUILD_DIR}/bin/mir_unit_tests |
1453 | |
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 | { |
1459 | public: |
1460 | AgingBuffer(); |
1461 | - ~AgingBuffer() noexcept {} |
1462 | |
1463 | virtual uint32_t age() const; |
1464 | virtual void increment_age(); |
1465 | |
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 | |
1471 | MirPlatformType mcla::AndroidClientPlatform::platform_type() const |
1472 | { |
1473 | - return mir_platform_type_android; |
1474 | + return mir_platform_type_android; |
1475 | } |
1476 | - |
1477 | + |
1478 | MirNativeBuffer* mcla::AndroidClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const |
1479 | { |
1480 | return buf->anwb(); |
1481 | |
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 | class AndroidClientPlatform : public ClientPlatform |
1487 | { |
1488 | public: |
1489 | - MirPlatformType platform_type() const; |
1490 | + MirPlatformType platform_type() const; |
1491 | std::shared_ptr<ClientBufferFactory> create_buffer_factory(); |
1492 | std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface); |
1493 | std::shared_ptr<EGLNativeDisplayType> create_egl_native_display(); |
1494 | |
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 | std::shared_ptr<MirBufferPackage> const& package) const |
1500 | { |
1501 | int native_handle_header_size = sizeof(native_handle_t); |
1502 | - int total_size = sizeof(int) * |
1503 | + int total_size = sizeof(int) * |
1504 | (package->fd_items + package->data_items + native_handle_header_size); |
1505 | native_handle_t* handle = static_cast<native_handle_t*>(::operator new(total_size)); |
1506 | handle->version = native_handle_header_size; |
1507 | |
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 | : surface(surface), |
1513 | driver_pixel_format(-1), |
1514 | sync_ops(std::make_shared<mga::RealSyncFileOps>()) |
1515 | - |
1516 | + |
1517 | { |
1518 | } |
1519 | |
1520 | |
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 | { |
1526 | class SyncFileOps; |
1527 | } |
1528 | -} |
1529 | +} |
1530 | namespace client |
1531 | { |
1532 | namespace android |
1533 | |
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 | { |
1539 | public: |
1540 | virtual ~ClientBuffer() = default; |
1541 | + |
1542 | virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0; |
1543 | virtual geometry::Size size() const = 0; |
1544 | virtual geometry::Stride stride() const = 0; |
1545 | @@ -62,6 +63,11 @@ |
1546 | virtual void increment_age() = 0; |
1547 | virtual void mark_as_submitted() = 0; |
1548 | virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const = 0; |
1549 | + |
1550 | +protected: |
1551 | + ClientBuffer() = default; |
1552 | + ClientBuffer(ClientBuffer const&) = delete; |
1553 | + ClientBuffer& operator=(ClientBuffer const&) = delete; |
1554 | }; |
1555 | |
1556 | } |
1557 | |
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 | |
1563 | virtual ~ClientPlatform() { /* TODO: make nothrow */ } |
1564 | |
1565 | - virtual MirPlatformType platform_type() const = 0; |
1566 | + virtual MirPlatformType platform_type() const = 0; |
1567 | virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0; |
1568 | virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0; |
1569 | virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0; |
1570 | |
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 | { |
1576 | auto val_raw = getenv("MIR_CLIENT_INPUT_RECEIVER_REPORT"); |
1577 | std::string const val{val_raw ? val_raw : off_opt_val}; |
1578 | - |
1579 | + |
1580 | if (val == log_opt_val) |
1581 | return std::make_shared<mcl::logging::InputReceiverReport>(the_logger()); |
1582 | else |
1583 | |
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 | { |
1589 | num_modes = num_modes_; |
1590 | modes = new MirDisplayMode[num_modes]; |
1591 | - |
1592 | - num_output_formats = num_formats; |
1593 | + |
1594 | + num_output_formats = num_formats; |
1595 | output_formats = new MirPixelFormat[num_formats]; |
1596 | } |
1597 | |
1598 | @@ -77,8 +77,8 @@ |
1599 | for (auto i = 0u; i < output.num_modes; i++) |
1600 | { |
1601 | auto mode = msg.mode(i); |
1602 | - output.modes[i].horizontal_resolution = mode.horizontal_resolution(); |
1603 | - output.modes[i].vertical_resolution = mode.vertical_resolution(); |
1604 | + output.modes[i].horizontal_resolution = mode.horizontal_resolution(); |
1605 | + output.modes[i].vertical_resolution = mode.vertical_resolution(); |
1606 | output.modes[i].refresh_rate = mode.refresh_rate(); |
1607 | } |
1608 | output.preferred_mode = msg.preferred_mode(); |
1609 | @@ -161,7 +161,7 @@ |
1610 | { |
1611 | auto new_info = &new_config->outputs[i]; |
1612 | MirDisplayOutput* output = outputs[i].get(); |
1613 | - std::memcpy(new_info, output, sizeof(MirDisplayOutput)); |
1614 | + std::memcpy(new_info, output, sizeof(MirDisplayOutput)); |
1615 | |
1616 | new_info->output_formats = new MirPixelFormat[new_info->num_output_formats]; |
1617 | auto format_size = sizeof(MirPixelFormat) * new_info->num_output_formats; |
1618 | |
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 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
1624 | */ |
1625 | |
1626 | -#ifndef MIR_CLIENT_GBM_DRM_FD_HANDLER_ |
1627 | -#define MIR_CLIENT_GBM_DRM_FD_HANDLER_ |
1628 | +#ifndef MIR_CLIENT_GBM_BUFFER_FILE_OPS_ |
1629 | +#define MIR_CLIENT_GBM_BUFFER_FILE_OPS_ |
1630 | |
1631 | #include <sys/types.h> |
1632 | |
1633 | @@ -28,25 +28,23 @@ |
1634 | namespace gbm |
1635 | { |
1636 | |
1637 | -class DRMFDHandler |
1638 | +class BufferFileOps |
1639 | { |
1640 | public: |
1641 | - virtual ~DRMFDHandler() {} |
1642 | + virtual ~BufferFileOps() = default; |
1643 | |
1644 | - virtual int ioctl(unsigned long request, void* arg) = 0; |
1645 | - virtual int primeFDToHandle(int prime_fd, uint32_t *handle) = 0; |
1646 | - virtual int close(int fd) = 0; |
1647 | - virtual void* map(size_t size, off_t offset) = 0; |
1648 | - virtual void unmap(void* addr, size_t size) = 0; |
1649 | + virtual int close(int fd) const = 0; |
1650 | + virtual void* map(int fd, off_t offset, size_t size) const = 0; |
1651 | + virtual void unmap(void* addr, size_t size) const = 0; |
1652 | |
1653 | protected: |
1654 | - DRMFDHandler() = default; |
1655 | - DRMFDHandler(const DRMFDHandler&) = delete; |
1656 | - DRMFDHandler& operator=(const DRMFDHandler&) = delete; |
1657 | + BufferFileOps() = default; |
1658 | + BufferFileOps(BufferFileOps const&) = delete; |
1659 | + BufferFileOps& operator=(BufferFileOps const&) = delete; |
1660 | }; |
1661 | |
1662 | } |
1663 | } |
1664 | } |
1665 | |
1666 | -#endif /* MIR_CLIENT_GBM_DRM_FD_HANDLER_ */ |
1667 | +#endif /* MIR_CLIENT_GBM_BUFFER_FILE_OPS_ */ |
1668 | |
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 | |
1674 | #include "mir_toolkit/mir_client_library.h" |
1675 | #include "gbm_client_buffer.h" |
1676 | -#include "drm_fd_handler.h" |
1677 | +#include "buffer_file_ops.h" |
1678 | |
1679 | #include <boost/exception/errinfo_errno.hpp> |
1680 | #include <boost/throw_exception.hpp> |
1681 | |
1682 | #include <stdexcept> |
1683 | |
1684 | -#include <xf86drm.h> |
1685 | -#include <string.h> |
1686 | #include <errno.h> |
1687 | #include <sys/mman.h> |
1688 | |
1689 | @@ -37,71 +35,29 @@ |
1690 | namespace |
1691 | { |
1692 | |
1693 | -struct GEMHandle |
1694 | -{ |
1695 | - GEMHandle(std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler, |
1696 | - int prime_fd) |
1697 | - : drm_fd_handler{drm_fd_handler} |
1698 | - { |
1699 | - int ret = drm_fd_handler->primeFDToHandle(prime_fd, &handle); |
1700 | - if (ret) |
1701 | - { |
1702 | - std::string msg("Failed to import PRIME fd for DRM buffer"); |
1703 | - BOOST_THROW_EXCEPTION( |
1704 | - boost::enable_error_info( |
1705 | - std::runtime_error(msg)) << boost::errinfo_errno(errno)); |
1706 | - } |
1707 | - } |
1708 | - |
1709 | - ~GEMHandle() |
1710 | - { |
1711 | - struct drm_gem_close arg; |
1712 | - arg.handle = handle; |
1713 | - // TODO (@raof): Error reporting? I do not believe it should be possible for this to fail, |
1714 | - // so if it does we should probably flag it. |
1715 | - drm_fd_handler->ioctl(DRM_IOCTL_GEM_CLOSE, &arg); |
1716 | - } |
1717 | - |
1718 | - std::shared_ptr<mclg::DRMFDHandler> const drm_fd_handler; |
1719 | - uint32_t handle; |
1720 | -}; |
1721 | - |
1722 | struct NullDeleter |
1723 | { |
1724 | void operator()(char *) const {} |
1725 | }; |
1726 | |
1727 | -struct GBMMemoryRegion : mcl::MemoryRegion |
1728 | +struct ShmMemoryRegion : mcl::MemoryRegion |
1729 | { |
1730 | - GBMMemoryRegion(std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler, |
1731 | - int prime_fd, geom::Size const& size_param, |
1732 | + ShmMemoryRegion(std::shared_ptr<mclg::BufferFileOps> const& buffer_file_ops, |
1733 | + int buffer_fd, geom::Size const& size_param, |
1734 | geom::Stride stride_param, geom::PixelFormat format_param) |
1735 | - : drm_fd_handler{drm_fd_handler}, |
1736 | - gem_handle{drm_fd_handler, prime_fd}, |
1737 | + : buffer_file_ops{buffer_file_ops}, |
1738 | size_in_bytes{size_param.height.as_uint32_t() * stride_param.as_uint32_t()} |
1739 | { |
1740 | + static off_t const map_offset = 0; |
1741 | width = size_param.width; |
1742 | height = size_param.height; |
1743 | stride = stride_param; |
1744 | format = format_param; |
1745 | |
1746 | - struct drm_mode_map_dumb map_dumb; |
1747 | - memset(&map_dumb, 0, sizeof(map_dumb)); |
1748 | - map_dumb.handle = gem_handle.handle; |
1749 | - |
1750 | - int ret = drm_fd_handler->ioctl(DRM_IOCTL_MODE_MAP_DUMB, &map_dumb); |
1751 | - if (ret) |
1752 | - { |
1753 | - std::string msg("Failed to map dumb DRM buffer"); |
1754 | - BOOST_THROW_EXCEPTION( |
1755 | - boost::enable_error_info( |
1756 | - std::runtime_error(msg)) << boost::errinfo_errno(errno)); |
1757 | - } |
1758 | - |
1759 | - void* map = drm_fd_handler->map(size_in_bytes, map_dumb.offset); |
1760 | + void* map = buffer_file_ops->map(buffer_fd, map_offset, size_in_bytes); |
1761 | if (map == MAP_FAILED) |
1762 | { |
1763 | - std::string msg("Failed to mmap DRM buffer"); |
1764 | + std::string msg("Failed to mmap buffer"); |
1765 | BOOST_THROW_EXCEPTION( |
1766 | boost::enable_error_info( |
1767 | std::runtime_error(msg)) << boost::errinfo_errno(errno)); |
1768 | @@ -110,24 +66,23 @@ |
1769 | vaddr = std::shared_ptr<char>(static_cast<char*>(map), NullDeleter()); |
1770 | } |
1771 | |
1772 | - ~GBMMemoryRegion() |
1773 | + ~ShmMemoryRegion() |
1774 | { |
1775 | - drm_fd_handler->unmap(vaddr.get(), size_in_bytes); |
1776 | + buffer_file_ops->unmap(vaddr.get(), size_in_bytes); |
1777 | } |
1778 | |
1779 | - std::shared_ptr<mclg::DRMFDHandler> const drm_fd_handler; |
1780 | - GEMHandle const gem_handle; |
1781 | + std::shared_ptr<mclg::BufferFileOps> const buffer_file_ops; |
1782 | size_t const size_in_bytes; |
1783 | }; |
1784 | |
1785 | } |
1786 | |
1787 | mclg::GBMClientBuffer::GBMClientBuffer( |
1788 | - std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler, |
1789 | - std::shared_ptr<MirBufferPackage> const& package, |
1790 | - geom::Size size, geom::PixelFormat pf) |
1791 | - : drm_fd_handler{drm_fd_handler}, |
1792 | - creation_package(std::move(package)), |
1793 | + std::shared_ptr<mclg::BufferFileOps> const& buffer_file_ops, |
1794 | + std::shared_ptr<MirBufferPackage> const& package, |
1795 | + geom::Size size, geom::PixelFormat pf) |
1796 | + : buffer_file_ops{buffer_file_ops}, |
1797 | + creation_package{package}, |
1798 | rect({geom::Point{0, 0}, size}), |
1799 | buffer_pf{pf} |
1800 | { |
1801 | @@ -137,15 +92,15 @@ |
1802 | { |
1803 | // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does, |
1804 | // something's seriously wrong. |
1805 | - drm_fd_handler->close(creation_package->fd[0]); |
1806 | + buffer_file_ops->close(creation_package->fd[0]); |
1807 | } |
1808 | |
1809 | std::shared_ptr<mcl::MemoryRegion> mclg::GBMClientBuffer::secure_for_cpu_write() |
1810 | { |
1811 | - const int prime_fd = creation_package->fd[0]; |
1812 | + int const buffer_fd = creation_package->fd[0]; |
1813 | |
1814 | - return std::make_shared<GBMMemoryRegion>(drm_fd_handler, |
1815 | - prime_fd, |
1816 | + return std::make_shared<ShmMemoryRegion>(buffer_file_ops, |
1817 | + buffer_fd, |
1818 | size(), |
1819 | stride(), |
1820 | pixel_format()); |
1821 | |
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 | namespace gbm |
1827 | { |
1828 | |
1829 | -class DRMFDHandler; |
1830 | +class BufferFileOps; |
1831 | |
1832 | class GBMClientBuffer : public AgingBuffer |
1833 | { |
1834 | public: |
1835 | - GBMClientBuffer(std::shared_ptr<DRMFDHandler> const& drm_fd_handler, |
1836 | + GBMClientBuffer(std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
1837 | std::shared_ptr<MirBufferPackage> const& buffer_package, |
1838 | geometry::Size size, |
1839 | geometry::PixelFormat pf); |
1840 | |
1841 | - virtual ~GBMClientBuffer() noexcept; |
1842 | + ~GBMClientBuffer() noexcept; |
1843 | |
1844 | std::shared_ptr<MemoryRegion> secure_for_cpu_write(); |
1845 | geometry::Size size() const; |
1846 | @@ -51,13 +51,11 @@ |
1847 | geometry::PixelFormat pixel_format() const; |
1848 | std::shared_ptr<MirNativeBuffer> native_buffer_handle() const; |
1849 | |
1850 | - GBMClientBuffer(const GBMClientBuffer&) = delete; |
1851 | - GBMClientBuffer& operator=(const GBMClientBuffer&) = delete; |
1852 | private: |
1853 | - const std::shared_ptr<DRMFDHandler> drm_fd_handler; |
1854 | - const std::shared_ptr<MirBufferPackage> creation_package; |
1855 | - const geometry::Rectangle rect; |
1856 | - const geometry::PixelFormat buffer_pf; |
1857 | + std::shared_ptr<BufferFileOps> const buffer_file_ops; |
1858 | + std::shared_ptr<MirBufferPackage> const creation_package; |
1859 | + geometry::Rectangle const rect; |
1860 | + geometry::PixelFormat const buffer_pf; |
1861 | }; |
1862 | |
1863 | } |
1864 | |
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 | namespace mclg=mir::client::gbm; |
1870 | |
1871 | mclg::GBMClientBufferFactory::GBMClientBufferFactory( |
1872 | - std::shared_ptr<DRMFDHandler> const& drm_fd_handler) |
1873 | - : drm_fd_handler{drm_fd_handler} |
1874 | + std::shared_ptr<BufferFileOps> const& buffer_file_ops) |
1875 | + : buffer_file_ops{buffer_file_ops} |
1876 | { |
1877 | } |
1878 | |
1879 | @@ -33,7 +33,7 @@ |
1880 | { |
1881 | (void)size; // TODO: remove this unused parameter |
1882 | return std::make_shared<mclg::GBMClientBuffer>( |
1883 | - drm_fd_handler, |
1884 | + buffer_file_ops, |
1885 | package, |
1886 | geometry::Size{package->width, package->height}, |
1887 | pf); |
1888 | |
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 | namespace gbm |
1894 | { |
1895 | |
1896 | -class DRMFDHandler; |
1897 | +class BufferFileOps; |
1898 | |
1899 | class GBMClientBufferFactory : public ClientBufferFactory |
1900 | { |
1901 | public: |
1902 | - explicit GBMClientBufferFactory(std::shared_ptr<DRMFDHandler> const& drm_fd_handler); |
1903 | + explicit GBMClientBufferFactory(std::shared_ptr<BufferFileOps> const& buffer_file_ops); |
1904 | |
1905 | std::shared_ptr<ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package, |
1906 | geometry::Size size, geometry::PixelFormat pf); |
1907 | private: |
1908 | - std::shared_ptr<DRMFDHandler> drm_fd_handler; |
1909 | + std::shared_ptr<BufferFileOps> const buffer_file_ops; |
1910 | }; |
1911 | |
1912 | } |
1913 | |
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 | #include "gbm_client_platform.h" |
1919 | #include "gbm_client_buffer_factory.h" |
1920 | #include "mesa_native_display_container.h" |
1921 | -#include "drm_fd_handler.h" |
1922 | +#include "buffer_file_ops.h" |
1923 | #include "gbm_native_surface.h" |
1924 | #include "../mir_connection.h" |
1925 | #include "../client_buffer_factory.h" |
1926 | @@ -37,24 +37,9 @@ |
1927 | namespace |
1928 | { |
1929 | |
1930 | -class RealDRMFDHandler : public mclg::DRMFDHandler |
1931 | +struct RealBufferFileOps : public mclg::BufferFileOps |
1932 | { |
1933 | -public: |
1934 | - RealDRMFDHandler(int drm_fd) : drm_fd{drm_fd} |
1935 | - { |
1936 | - } |
1937 | - |
1938 | - int ioctl(unsigned long request, void* arg) |
1939 | - { |
1940 | - return drmIoctl(drm_fd, request, arg); |
1941 | - } |
1942 | - |
1943 | - int primeFDToHandle(int prime_fd, uint32_t *handle) |
1944 | - { |
1945 | - return drmPrimeFDToHandle(drm_fd, prime_fd, handle); |
1946 | - } |
1947 | - |
1948 | - int close(int fd) |
1949 | + int close(int fd) const |
1950 | { |
1951 | while (::close(fd) == -1) |
1952 | { |
1953 | @@ -65,19 +50,16 @@ |
1954 | return 0; |
1955 | } |
1956 | |
1957 | - void* map(size_t size, off_t offset) |
1958 | + void* map(int fd, off_t offset, size_t size) const |
1959 | { |
1960 | - return mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, |
1961 | - drm_fd, offset); |
1962 | + return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, |
1963 | + fd, offset); |
1964 | } |
1965 | |
1966 | - void unmap(void* addr, size_t size) |
1967 | + void unmap(void* addr, size_t size) const |
1968 | { |
1969 | munmap(addr, size); |
1970 | } |
1971 | - |
1972 | -private: |
1973 | - int drm_fd; |
1974 | }; |
1975 | |
1976 | struct NativeDisplayDeleter |
1977 | @@ -101,33 +83,24 @@ |
1978 | std::shared_ptr<mcl::ClientPlatform> |
1979 | mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context) |
1980 | { |
1981 | - MirPlatformPackage platform_package; |
1982 | - |
1983 | - memset(&platform_package, 0, sizeof(platform_package)); |
1984 | - context->populate(platform_package); |
1985 | - |
1986 | - int drm_fd = -1; |
1987 | - |
1988 | - if (platform_package.fd_items > 0) |
1989 | - drm_fd = platform_package.fd[0]; |
1990 | - |
1991 | - auto drm_fd_handler = std::make_shared<RealDRMFDHandler>(drm_fd); |
1992 | - return std::make_shared<mclg::GBMClientPlatform>(context, drm_fd_handler, mcl::EGLNativeDisplayContainer::instance()); |
1993 | + auto buffer_file_ops = std::make_shared<RealBufferFileOps>(); |
1994 | + return std::make_shared<mclg::GBMClientPlatform>( |
1995 | + context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance()); |
1996 | } |
1997 | |
1998 | mclg::GBMClientPlatform::GBMClientPlatform( |
1999 | ClientContext* const context, |
2000 | - std::shared_ptr<DRMFDHandler> const& drm_fd_handler, |
2001 | + std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
2002 | mcl::EGLNativeDisplayContainer& display_container) |
2003 | : context{context}, |
2004 | - drm_fd_handler{drm_fd_handler}, |
2005 | + buffer_file_ops{buffer_file_ops}, |
2006 | display_container(display_container) |
2007 | { |
2008 | } |
2009 | |
2010 | std::shared_ptr<mcl::ClientBufferFactory> mclg::GBMClientPlatform::create_buffer_factory() |
2011 | { |
2012 | - return std::make_shared<mclg::GBMClientBufferFactory>(drm_fd_handler); |
2013 | + return std::make_shared<mclg::GBMClientBufferFactory>(buffer_file_ops); |
2014 | } |
2015 | |
2016 | namespace |
2017 | @@ -153,7 +126,7 @@ |
2018 | //TODO: this is awkward on both android and gbm... |
2019 | auto gbm_window = new GBMNativeSurface(*client_surface); |
2020 | auto egl_native_window = new EGLNativeWindowType; |
2021 | - *egl_native_window = gbm_window; |
2022 | + *egl_native_window = gbm_window; |
2023 | NativeWindowDeleter deleter(gbm_window); |
2024 | return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter); |
2025 | } |
2026 | @@ -169,8 +142,8 @@ |
2027 | |
2028 | MirPlatformType mclg::GBMClientPlatform::platform_type() const |
2029 | { |
2030 | - return mir_platform_type_gbm; |
2031 | -} |
2032 | + return mir_platform_type_gbm; |
2033 | +} |
2034 | |
2035 | MirNativeBuffer* mclg::GBMClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const |
2036 | { |
2037 | |
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 | namespace gbm |
2043 | { |
2044 | |
2045 | -class DRMFDHandler; |
2046 | +class BufferFileOps; |
2047 | |
2048 | class GBMClientPlatform : public ClientPlatform |
2049 | { |
2050 | public: |
2051 | GBMClientPlatform(ClientContext* const context, |
2052 | - std::shared_ptr<DRMFDHandler> const& drm_fd_handler, |
2053 | + std::shared_ptr<BufferFileOps> const& buffer_file_ops, |
2054 | EGLNativeDisplayContainer& display_container); |
2055 | |
2056 | - MirPlatformType platform_type() const; |
2057 | + MirPlatformType platform_type() const; |
2058 | std::shared_ptr<ClientBufferFactory> create_buffer_factory(); |
2059 | std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface); |
2060 | std::shared_ptr<EGLNativeDisplayType> create_egl_native_display(); |
2061 | @@ -47,7 +47,7 @@ |
2062 | |
2063 | private: |
2064 | ClientContext* const context; |
2065 | - std::shared_ptr<DRMFDHandler> const drm_fd_handler; |
2066 | + std::shared_ptr<BufferFileOps> const buffer_file_ops; |
2067 | EGLNativeDisplayContainer& display_container; |
2068 | }; |
2069 | |
2070 | |
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 | { |
2076 | auto s = static_cast<mclg::GBMNativeSurface*>(surface); |
2077 | return s->set_swapinterval(interval); |
2078 | -} |
2079 | +} |
2080 | |
2081 | static void buffer_advanced_callback(MirSurface* /* surface */, |
2082 | void* /* context */) |
2083 | @@ -53,9 +53,9 @@ |
2084 | mclg::GBMNativeSurface::GBMNativeSurface(ClientSurface& surface) |
2085 | : surface(surface) |
2086 | { |
2087 | - surface_advance_buffer = advance_buffer_static; |
2088 | - surface_get_parameters = get_parameters_static; |
2089 | - surface_set_swapinterval = set_swapinterval_static; |
2090 | + surface_advance_buffer = advance_buffer_static; |
2091 | + surface_get_parameters = get_parameters_static; |
2092 | + surface_set_swapinterval = set_swapinterval_static; |
2093 | } |
2094 | |
2095 | int mclg::GBMNativeSurface::advance_buffer(MirBufferPackage* buffer_package) |
2096 | @@ -80,6 +80,6 @@ |
2097 | if ((interval < 0) || (interval > 1)) |
2098 | return MIR_MESA_FALSE; |
2099 | |
2100 | - mir_wait_for(surface.configure(mir_surface_attrib_swapinterval, interval)); |
2101 | + mir_wait_for(surface.configure(mir_surface_attrib_swapinterval, interval)); |
2102 | return MIR_MESA_TRUE; |
2103 | } |
2104 | |
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 | std::stringstream ss; |
2110 | |
2111 | ss << "Received event:" << std::endl; |
2112 | - |
2113 | + |
2114 | format_event(ss, event); |
2115 | |
2116 | logger->log<ml::Logger::debug>(ss.str(), component); |
2117 | |
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 | return conn; |
2123 | } |
2124 | |
2125 | -int mir_connection_is_valid(MirConnection * connection) |
2126 | +MirBool mir_connection_is_valid(MirConnection * connection) |
2127 | { |
2128 | - return MirConnection::is_valid(connection); |
2129 | + return MirConnection::is_valid(connection) ? mir_true : mir_false; |
2130 | } |
2131 | |
2132 | char const * mir_connection_get_error_message(MirConnection * connection) |
2133 | @@ -266,12 +266,12 @@ |
2134 | |
2135 | int mir_debug_surface_id(MirSurface * surface) |
2136 | { |
2137 | - return surface->id(); |
2138 | + return surface->id(); |
2139 | } |
2140 | |
2141 | -int mir_surface_is_valid(MirSurface* surface) |
2142 | +MirBool mir_surface_is_valid(MirSurface* surface) |
2143 | { |
2144 | - return surface->is_valid(); |
2145 | + return surface->is_valid() ? mir_true : mir_false; |
2146 | } |
2147 | |
2148 | char const * mir_surface_get_error_message(MirSurface * surface) |
2149 | |
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 | for (auto i = 0u; i < valid_formats; i++) |
2155 | { |
2156 | formats[i] = static_cast<MirPixelFormat>(connect_result.surface_pixel_format(i)); |
2157 | - } |
2158 | + } |
2159 | } |
2160 | } |
2161 | |
2162 | @@ -458,11 +458,11 @@ |
2163 | { |
2164 | auto output = config->outputs[i]; |
2165 | auto display_request = request.add_display_output(); |
2166 | - display_request->set_output_id(output.output_id); |
2167 | - display_request->set_used(output.used); |
2168 | - display_request->set_current_mode(output.current_mode); |
2169 | - display_request->set_position_x(output.position_x); |
2170 | - display_request->set_position_y(output.position_y); |
2171 | + display_request->set_output_id(output.output_id); |
2172 | + display_request->set_used(output.used); |
2173 | + display_request->set_current_mode(output.current_mode); |
2174 | + display_request->set_position_x(output.position_x); |
2175 | + display_request->set_position_y(output.position_y); |
2176 | display_request->set_power_mode(output.power_mode); |
2177 | } |
2178 | |
2179 | |
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 | void register_display_change_callback(mir_display_config_callback callback, void* context); |
2185 | |
2186 | void populate(MirPlatformPackage& platform_package); |
2187 | - MirDisplayConfiguration* create_copy_of_display_config(); |
2188 | + MirDisplayConfiguration* create_copy_of_display_config(); |
2189 | void available_surface_formats(MirPixelFormat* formats, |
2190 | unsigned int formats_size, unsigned int& valid_formats); |
2191 | |
2192 | |
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 | message.set_pixel_format(params.pixel_format); |
2198 | message.set_buffer_usage(params.buffer_usage); |
2199 | message.set_output_id(params.output_id); |
2200 | - |
2201 | + |
2202 | server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context)); |
2203 | |
2204 | for (int i = 0; i < mir_surface_attribs; i++) |
2205 | @@ -254,7 +254,7 @@ |
2206 | { |
2207 | std::lock_guard<std::recursive_mutex> lock(mutex); |
2208 | |
2209 | - return buffer_depository->current_buffer_id(); |
2210 | + return buffer_depository->current_buffer_id(); |
2211 | } |
2212 | |
2213 | void MirSurface::populate(MirBufferPackage& buffer_package) |
2214 | |
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 | { |
2220 | rpc_report->event_parsing_failed(event); |
2221 | } |
2222 | - } |
2223 | + } |
2224 | } |
2225 | } |
2226 | |
2227 | |
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 | ss << __PRETTY_FUNCTION__ |
2233 | << "executed with non-existent surface ID " |
2234 | << surface_id << ".\n"; |
2235 | - |
2236 | + |
2237 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); |
2238 | } |
2239 | } |
2240 | @@ -50,11 +50,11 @@ |
2241 | void mcl::ConnectionSurfaceMap::insert(int const& surface_id, MirSurface* surface) |
2242 | { |
2243 | std::unique_lock<std::mutex> lk(guard); |
2244 | - surfaces[surface_id] = surface; |
2245 | + surfaces[surface_id] = surface; |
2246 | } |
2247 | |
2248 | void mcl::ConnectionSurfaceMap::erase(int surface_id) |
2249 | { |
2250 | std::unique_lock<std::mutex> lk(guard); |
2251 | - surfaces.erase(surface_id); |
2252 | + surfaces.erase(surface_id); |
2253 | } |
2254 | |
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 | std::function<void(int)> handler; |
2260 | }; |
2261 | |
2262 | -/* |
2263 | +/* |
2264 | * We need to define an empty constructor and destructor in the .cpp file, |
2265 | * so that we can use unique_ptr to hold SignalHandler. Otherwise, users |
2266 | * of AsioMainLoop end up creating default constructors and destructors |
2267 | |
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 | return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle); |
2273 | } |
2274 | |
2275 | -std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::secure_client_buffer() |
2276 | -{ |
2277 | - return std::make_shared<mc::TemporaryClientBuffer>(buffer_bundle); |
2278 | +void mc::BufferStreamSurfaces::swap_client_buffers(std::shared_ptr<mg::Buffer>& buffer) |
2279 | +{ |
2280 | + release_client_buffer(buffer); |
2281 | + buffer = buffer_bundle->client_acquire(); |
2282 | +} |
2283 | + |
2284 | +void mc::BufferStreamSurfaces::release_client_buffer(std::shared_ptr<mg::Buffer>& buffer) |
2285 | +{ |
2286 | + if (buffer) |
2287 | + { |
2288 | + buffer_bundle->client_release(buffer); |
2289 | + buffer.reset(); |
2290 | + } |
2291 | } |
2292 | |
2293 | geom::PixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format() |
2294 | { |
2295 | - return buffer_bundle->properties().format; |
2296 | + return buffer_bundle->properties().format; |
2297 | } |
2298 | |
2299 | geom::Size mc::BufferStreamSurfaces::stream_size() |
2300 | { |
2301 | - return buffer_bundle->properties().size; |
2302 | + return buffer_bundle->properties().size; |
2303 | } |
2304 | |
2305 | void mc::BufferStreamSurfaces::resize(geom::Size const& size) |
2306 | |
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 | BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper); |
2312 | ~BufferStreamSurfaces(); |
2313 | |
2314 | - std::shared_ptr<graphics::Buffer> secure_client_buffer(); |
2315 | + void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) override; |
2316 | + void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) override; |
2317 | |
2318 | std::shared_ptr<graphics::Buffer> |
2319 | lock_compositor_buffer(unsigned long frameno) override; |
2320 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override; |
2321 | |
2322 | - geometry::PixelFormat get_stream_pixel_format(); |
2323 | - geometry::Size stream_size(); |
2324 | + geometry::PixelFormat get_stream_pixel_format() override; |
2325 | + geometry::Size stream_size() override; |
2326 | void resize(geometry::Size const& size) override; |
2327 | - void allow_framedropping(bool); |
2328 | - void force_requests_to_complete(); |
2329 | + void allow_framedropping(bool) override; |
2330 | + void force_requests_to_complete() override; |
2331 | |
2332 | protected: |
2333 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; |
2334 | |
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 | #include "buffer_stream_factory.h" |
2340 | #include "default_display_buffer_compositor_factory.h" |
2341 | #include "multi_threaded_compositor.h" |
2342 | -#include "overlay_renderer.h" |
2343 | #include "gl_renderer_factory.h" |
2344 | |
2345 | namespace mc = mir::compositor; |
2346 | @@ -43,7 +42,7 @@ |
2347 | [this]() |
2348 | { |
2349 | return std::make_shared<mc::DefaultDisplayBufferCompositorFactory>( |
2350 | - the_scene(), the_renderer_factory(), the_overlay_renderer()); |
2351 | + the_scene(), the_renderer_factory()); |
2352 | }); |
2353 | } |
2354 | |
2355 | @@ -59,22 +58,6 @@ |
2356 | }); |
2357 | } |
2358 | |
2359 | -std::shared_ptr<mc::OverlayRenderer> |
2360 | -mir::DefaultServerConfiguration::the_overlay_renderer() |
2361 | -{ |
2362 | - struct NullOverlayRenderer : public mc::OverlayRenderer |
2363 | - { |
2364 | - virtual void render( |
2365 | - geometry::Rectangle const&, |
2366 | - std::function<void(std::shared_ptr<void> const&)>) {} |
2367 | - }; |
2368 | - return overlay_renderer( |
2369 | - [this]() |
2370 | - { |
2371 | - return std::make_shared<NullOverlayRenderer>(); |
2372 | - }); |
2373 | -} |
2374 | - |
2375 | std::shared_ptr<mc::RendererFactory> mir::DefaultServerConfiguration::the_renderer_factory() |
2376 | { |
2377 | return renderer_factory( |
2378 | |
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 | #include "default_display_buffer_compositor.h" |
2384 | |
2385 | #include "rendering_operator.h" |
2386 | -#include "overlay_renderer.h" |
2387 | #include "mir/compositor/scene.h" |
2388 | #include "mir/compositor/compositing_criteria.h" |
2389 | #include "mir/graphics/display_buffer.h" |
2390 | @@ -69,12 +68,10 @@ |
2391 | mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor( |
2392 | mg::DisplayBuffer& display_buffer, |
2393 | std::shared_ptr<mc::Scene> const& scene, |
2394 | - std::shared_ptr<mc::Renderer> const& renderer, |
2395 | - std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer) |
2396 | + std::shared_ptr<mc::Renderer> const& renderer) |
2397 | : display_buffer(display_buffer), |
2398 | scene{scene}, |
2399 | renderer{renderer}, |
2400 | - overlay_renderer{overlay_renderer}, |
2401 | local_frameno{global_frameno} |
2402 | { |
2403 | } |
2404 | @@ -138,11 +135,10 @@ |
2405 | mc::OcclusionMatch occlusion_match; |
2406 | scene->reverse_for_each_if(occlusion_search, occlusion_match); |
2407 | |
2408 | - renderer->clear(local_frameno); |
2409 | - mc::RenderingOperator applicator(*renderer, save_resource); |
2410 | + renderer->clear(); |
2411 | + mc::RenderingOperator applicator(*renderer, save_resource, local_frameno); |
2412 | FilterForVisibleSceneInRegion selector(view_area, occlusion_match); |
2413 | scene->for_each_if(selector, applicator); |
2414 | - overlay_renderer->render(view_area, save_resource); |
2415 | |
2416 | display_buffer.post_update(); |
2417 | } |
2418 | |
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 | |
2424 | class Scene; |
2425 | class Renderer; |
2426 | -class OverlayRenderer; |
2427 | |
2428 | class DefaultDisplayBufferCompositor : public DisplayBufferCompositor |
2429 | { |
2430 | @@ -41,8 +40,7 @@ |
2431 | DefaultDisplayBufferCompositor( |
2432 | graphics::DisplayBuffer& display_buffer, |
2433 | std::shared_ptr<Scene> const& scene, |
2434 | - std::shared_ptr<Renderer> const& renderer, |
2435 | - std::shared_ptr<OverlayRenderer> const& overlay_renderer); |
2436 | + std::shared_ptr<Renderer> const& renderer); |
2437 | |
2438 | void composite() override; |
2439 | |
2440 | @@ -51,7 +49,6 @@ |
2441 | |
2442 | std::shared_ptr<Scene> const scene; |
2443 | std::shared_ptr<Renderer> const renderer; |
2444 | - std::shared_ptr<OverlayRenderer> const overlay_renderer; |
2445 | |
2446 | unsigned long local_frameno; |
2447 | }; |
2448 | |
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 | |
2454 | mc::DefaultDisplayBufferCompositorFactory::DefaultDisplayBufferCompositorFactory( |
2455 | std::shared_ptr<mc::Scene> const& scene, |
2456 | - std::shared_ptr<mc::RendererFactory> const& renderer_factory, |
2457 | - std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer) |
2458 | + std::shared_ptr<mc::RendererFactory> const& renderer_factory) |
2459 | : scene{scene}, |
2460 | - renderer_factory{renderer_factory}, |
2461 | - overlay_renderer{overlay_renderer} |
2462 | + renderer_factory{renderer_factory} |
2463 | { |
2464 | } |
2465 | |
2466 | @@ -41,8 +39,6 @@ |
2467 | graphics::DisplayBuffer& display_buffer) |
2468 | { |
2469 | auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area()); |
2470 | - auto raw = new DefaultDisplayBufferCompositor{display_buffer, scene, std::move(renderer), |
2471 | - overlay_renderer}; |
2472 | - |
2473 | + auto raw = new DefaultDisplayBufferCompositor{display_buffer, scene, std::move(renderer)}; |
2474 | return std::unique_ptr<DisplayBufferCompositor>(raw); |
2475 | } |
2476 | |
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 | namespace compositor |
2482 | { |
2483 | class RendererFactory; |
2484 | -class OverlayRenderer; |
2485 | class Scene; |
2486 | |
2487 | // TODO this is ideally an implementation class. It is only in a public header |
2488 | @@ -37,15 +36,13 @@ |
2489 | public: |
2490 | DefaultDisplayBufferCompositorFactory( |
2491 | std::shared_ptr<Scene> const& scene, |
2492 | - std::shared_ptr<RendererFactory> const& renderer_factory, |
2493 | - std::shared_ptr<OverlayRenderer> const& overlay_renderer); |
2494 | + std::shared_ptr<RendererFactory> const& renderer_factory); |
2495 | |
2496 | std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplayBuffer& display_buffer); |
2497 | |
2498 | private: |
2499 | std::shared_ptr<Scene> const scene; |
2500 | std::shared_ptr<RendererFactory> const renderer_factory; |
2501 | - std::shared_ptr<OverlayRenderer> const overlay_renderer; |
2502 | }; |
2503 | |
2504 | } |
2505 | |
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 | #include <boost/throw_exception.hpp> |
2511 | #include <stdexcept> |
2512 | |
2513 | +namespace mg = mir::graphics; |
2514 | namespace mc = mir::compositor; |
2515 | namespace geom = mir::geometry; |
2516 | |
2517 | @@ -235,15 +236,11 @@ |
2518 | } |
2519 | |
2520 | mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area) |
2521 | - : frameno{0} |
2522 | { |
2523 | resources.setup(display_area); |
2524 | } |
2525 | |
2526 | -void mc::GLRenderer::render( |
2527 | - std::function<void(std::shared_ptr<void> const&)> save_resource, |
2528 | - CompositingCriteria const& criteria, |
2529 | - BufferStream& stream) |
2530 | +void mc::GLRenderer::render(CompositingCriteria const& criteria, mg::Buffer& buffer) const |
2531 | { |
2532 | glUseProgram(resources.program); |
2533 | |
2534 | @@ -273,9 +270,7 @@ |
2535 | /* Use the renderable's texture */ |
2536 | glBindTexture(GL_TEXTURE_2D, resources.texture); |
2537 | |
2538 | - auto region_resource = stream.lock_compositor_buffer(frameno); |
2539 | - region_resource->bind_to_texture(); |
2540 | - save_resource(region_resource); |
2541 | + buffer.bind_to_texture(); |
2542 | |
2543 | /* Draw */ |
2544 | glEnableVertexAttribArray(resources.position_attr_loc); |
2545 | @@ -285,9 +280,7 @@ |
2546 | glDisableVertexAttribArray(resources.position_attr_loc); |
2547 | } |
2548 | |
2549 | -void mc::GLRenderer::clear(unsigned long frame) |
2550 | +void mc::GLRenderer::clear() const |
2551 | { |
2552 | - frameno = frame; |
2553 | glClear(GL_COLOR_BUFFER_BIT); |
2554 | } |
2555 | - |
2556 | |
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 | public: |
2562 | GLRenderer(geometry::Rectangle const& display_area); |
2563 | |
2564 | - /* From renderer */ |
2565 | - void render(std::function<void(std::shared_ptr<void> const&)> save_resource, |
2566 | - CompositingCriteria const& info, BufferStream& stream); |
2567 | - void clear(unsigned long frameno) override; |
2568 | + void render(CompositingCriteria const& info, graphics::Buffer& buffer) const override; |
2569 | + void clear() const override; |
2570 | |
2571 | ~GLRenderer() noexcept {} |
2572 | |
2573 | @@ -60,8 +58,6 @@ |
2574 | }; |
2575 | |
2576 | Resources resources; |
2577 | - |
2578 | - unsigned long frameno; |
2579 | }; |
2580 | |
2581 | } |
2582 | |
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 | -/* |
2588 | - * Copyright © 2013 Canonical Ltd. |
2589 | - * |
2590 | - * This program is free software: you can redistribute it and/or modify it |
2591 | - * under the terms of the GNU General Public License version 3, |
2592 | - * as published by the Free Software Foundation. |
2593 | - * |
2594 | - * This program is distributed in the hope that it will be useful, |
2595 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2596 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2597 | - * GNU General Public License for more details. |
2598 | - * |
2599 | - * You should have received a copy of the GNU General Public License |
2600 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2601 | - * |
2602 | - * Authored by: Robert Carr <robert.carr@canonical.com> |
2603 | - */ |
2604 | - |
2605 | -#ifndef MIR_COMPOSITOR_OVERLAY_RENDERER_H_ |
2606 | -#define MIR_COMPOSITOR_OVERLAY_RENDERER_H_ |
2607 | - |
2608 | -#include <functional> |
2609 | -#include <memory> |
2610 | - |
2611 | -namespace mir |
2612 | -{ |
2613 | -namespace geometry |
2614 | -{ |
2615 | -struct Rectangle; |
2616 | -} |
2617 | - |
2618 | -namespace compositor |
2619 | -{ |
2620 | - |
2621 | -class OverlayRenderer |
2622 | -{ |
2623 | -public: |
2624 | - virtual ~OverlayRenderer() = default; |
2625 | - |
2626 | - virtual void render( |
2627 | - geometry::Rectangle const& view_area, |
2628 | - std::function<void(std::shared_ptr<void> const&)> save_resource) = 0; |
2629 | - |
2630 | -protected: |
2631 | - OverlayRenderer() = default; |
2632 | - OverlayRenderer& operator=(OverlayRenderer const&) = delete; |
2633 | - OverlayRenderer(OverlayRenderer const&) = delete; |
2634 | -}; |
2635 | - |
2636 | -} |
2637 | -} // namespace mir |
2638 | - |
2639 | -#endif // MIR_COMPOSITOR_OVERLAY_RENDERER_H_ |
2640 | |
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 | #ifndef MIR_COMPOSITOR_RENDERER_H_ |
2646 | #define MIR_COMPOSITOR_RENDERER_H_ |
2647 | |
2648 | -#include <memory> |
2649 | -#include <functional> |
2650 | - |
2651 | namespace mir |
2652 | { |
2653 | +namespace graphics |
2654 | +{ |
2655 | +class Buffer; |
2656 | +} |
2657 | namespace compositor |
2658 | { |
2659 | -class BufferStream; |
2660 | class CompositingCriteria; |
2661 | |
2662 | class Renderer |
2663 | @@ -34,9 +34,8 @@ |
2664 | public: |
2665 | virtual ~Renderer() = default; |
2666 | |
2667 | - virtual void clear(unsigned long frameno) = 0; |
2668 | - virtual void render(std::function<void(std::shared_ptr<void> const&)> save_resource, |
2669 | - CompositingCriteria const& info, BufferStream& stream) = 0; |
2670 | + virtual void clear() const = 0; |
2671 | + virtual void render(CompositingCriteria const& info, graphics::Buffer& buffer) const = 0; |
2672 | |
2673 | protected: |
2674 | Renderer() = default; |
2675 | |
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 | */ |
2681 | |
2682 | #include "rendering_operator.h" |
2683 | +#include "mir/compositor/buffer_stream.h" |
2684 | |
2685 | namespace mc=mir::compositor; |
2686 | |
2687 | mc::RenderingOperator::RenderingOperator( |
2688 | Renderer& renderer, |
2689 | - std::function<void(std::shared_ptr<void> const&)> save_resource) : |
2690 | + std::function<void(std::shared_ptr<void> const&)> save_resource, |
2691 | + unsigned long frameno) : |
2692 | renderer(renderer), |
2693 | - save_resource(save_resource) |
2694 | -{ |
2695 | -} |
2696 | - |
2697 | -mc::RenderingOperator::~RenderingOperator() |
2698 | + save_resource(save_resource), |
2699 | + frameno(frameno) |
2700 | { |
2701 | } |
2702 | |
2703 | void mc::RenderingOperator::operator()(CompositingCriteria const& info, BufferStream& stream) |
2704 | { |
2705 | - renderer.render(save_resource, info, stream); |
2706 | + auto compositor_buffer = stream.lock_compositor_buffer(frameno); |
2707 | + renderer.render(info, *compositor_buffer); |
2708 | + save_resource(compositor_buffer); |
2709 | } |
2710 | |
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 | class RenderingOperator : public OperatorForScene |
2716 | { |
2717 | public: |
2718 | - explicit RenderingOperator(Renderer& renderer, std::function<void(std::shared_ptr<void> const&)> save_resource); |
2719 | - ~RenderingOperator(); |
2720 | + explicit RenderingOperator( |
2721 | + Renderer& renderer, |
2722 | + std::function<void(std::shared_ptr<void> const&)> save_resource, |
2723 | + unsigned long frameno); |
2724 | + ~RenderingOperator() = default; |
2725 | |
2726 | void operator()(CompositingCriteria const& info, BufferStream&); |
2727 | |
2728 | private: |
2729 | Renderer& renderer; |
2730 | std::function<void(std::shared_ptr<void> const&)> save_resource; |
2731 | + unsigned long const frameno; |
2732 | }; |
2733 | |
2734 | } |
2735 | |
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 | * but always uses 50% more memory. So try to avoid it when possible. |
2741 | */ |
2742 | |
2743 | - int min_free = |
2744 | + int min_free = |
2745 | #if 0 // FIXME: This memory optimization breaks timing tests |
2746 | (nbuffers > 2 && !overlapping_compositors) ? nbuffers - 1 : 1; |
2747 | #else |
2748 | |
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 | namespace compositor |
2754 | { |
2755 | |
2756 | -class SwitchingBundle : public BufferBundle |
2757 | +class SwitchingBundle : public BufferBundle |
2758 | { |
2759 | public: |
2760 | enum {min_buffers = 1, max_buffers = 5}; |
2761 | |
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 | { |
2767 | } |
2768 | |
2769 | -mc::TemporaryClientBuffer::TemporaryClientBuffer(std::shared_ptr<BufferBundle> const& buffer_swapper) |
2770 | - : TemporaryBuffer(buffer_swapper->client_acquire()), |
2771 | - allocating_swapper(buffer_swapper) |
2772 | -{ |
2773 | -} |
2774 | - |
2775 | -mc::TemporaryClientBuffer::~TemporaryClientBuffer() |
2776 | -{ |
2777 | - if (auto swapper = allocating_swapper.lock()) |
2778 | - swapper->client_release(buffer); |
2779 | -} |
2780 | - |
2781 | mc::TemporaryCompositorBuffer::TemporaryCompositorBuffer( |
2782 | std::shared_ptr<BufferBundle> const& bun, unsigned long frameno) |
2783 | : TemporaryBuffer(bun->compositor_acquire(frameno)), |
2784 | |
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 | std::shared_ptr<mg::Buffer> const buffer; |
2790 | }; |
2791 | |
2792 | -class TemporaryClientBuffer : public TemporaryBuffer |
2793 | -{ |
2794 | -public: |
2795 | - explicit TemporaryClientBuffer(std::shared_ptr<BufferBundle> const& buffer_swapper); |
2796 | - ~TemporaryClientBuffer(); |
2797 | - |
2798 | -private: |
2799 | - std::weak_ptr<BufferBundle> const allocating_swapper; |
2800 | -}; |
2801 | - |
2802 | class TemporaryCompositorBuffer : public TemporaryBuffer |
2803 | { |
2804 | public: |
2805 | |
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 | [this]() -> std::shared_ptr<mi::InputReport> |
2811 | { |
2812 | auto opt = the_options()->get(input_report_opt, off_opt_value); |
2813 | - |
2814 | + |
2815 | if (opt == log_opt_value) |
2816 | { |
2817 | return std::make_shared<ml::InputReport>(the_logger()); |
2818 | |
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 | void mfd::EventSender::handle_event(MirEvent const& e) |
2824 | { |
2825 | // Limit the types of events we wish to send over protobuf, for now. |
2826 | - if (e.type == mir_event_type_surface) |
2827 | + if (e.type != mir_event_type_key && e.type != mir_event_type_motion) |
2828 | { |
2829 | // In future we might send multiple events, or insert them into messages |
2830 | // containing other responses, but for now we send them individually. |
2831 | |
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 | |
2837 | std::shared_ptr<MessageSender> const sender; |
2838 | }; |
2839 | - |
2840 | + |
2841 | } |
2842 | } |
2843 | } |
2844 | |
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 | { |
2850 | typedef std::initializer_list<std::vector<int32_t>> FdSets; |
2851 | } |
2852 | -} // namespace mir |
2853 | +} // namespace mir |
2854 | |
2855 | #endif // MIR_FRONTEND_FD_SETS_H_ |
2856 | |
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 | * You should have received a copy of the GNU General Public License |
2862 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2863 | * |
2864 | - * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
2865 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
2866 | */ |
2867 | #ifndef MIR_FRONTEND_MESSAGE_RECEIVER_H_ |
2868 | #define MIR_FRONTEND_MESSAGE_RECEIVER_H_ |
2869 | @@ -32,7 +32,7 @@ |
2870 | public: |
2871 | //receive message from the socket. 'handler' will be called when 'buffer' has been filled with exactly 'size' |
2872 | typedef std::function<void(boost::system::error_code const&, size_t)> MirReadHandler; |
2873 | - virtual void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size) = 0; |
2874 | + virtual void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size) = 0; |
2875 | virtual pid_t client_pid() = 0; |
2876 | |
2877 | protected: |
2878 | |
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 | { |
2884 | auto& tracker = client_buffer_tracker[surf_id]; |
2885 | if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size); |
2886 | - |
2887 | - client_buffer_resource[surf_id].reset(); |
2888 | |
2889 | - auto client_buffer = surface.advance_client_buffer(); |
2890 | + auto& client_buffer = client_buffer_resource[surf_id]; |
2891 | + surface.swap_buffers(client_buffer); |
2892 | auto id = client_buffer->id(); |
2893 | auto need_full_ipc = !tracker->client_has(id); |
2894 | tracker->add(id); |
2895 | |
2896 | - client_buffer_resource[surf_id] = client_buffer; |
2897 | - |
2898 | return std::tie(client_buffer, need_full_ipc); |
2899 | } |
2900 | |
2901 | |
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 | { |
2907 | { |
2908 | std::unique_lock<std::mutex> lock(session_mutex); |
2909 | - |
2910 | + |
2911 | auto session = weak_session.lock(); |
2912 | |
2913 | if (session.get() == nullptr) |
2914 | |
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 | { |
2920 | struct ucred cr; |
2921 | socklen_t cl = sizeof(cr); |
2922 | - |
2923 | + |
2924 | auto status = getsockopt(socket->native_handle(), SOL_SOCKET, SO_PEERCRED, &cr, &cl); |
2925 | - |
2926 | + |
2927 | if (status) |
2928 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to query client socket credentials")); |
2929 | return cr.pid; |
2930 | @@ -60,7 +60,7 @@ |
2931 | static_cast<unsigned char>((size >> 8) & 0xff), |
2932 | static_cast<unsigned char>((size >> 0) & 0xff) |
2933 | }; |
2934 | - |
2935 | + |
2936 | std::unique_lock<std::mutex> lg(message_lock); |
2937 | |
2938 | whole_message.resize(sizeof header_bytes + size); |
2939 | @@ -126,4 +126,4 @@ |
2940 | buffer, |
2941 | boost::asio::transfer_exactly(size), |
2942 | handler); |
2943 | -} |
2944 | +} |
2945 | |
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 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
2951 | */ |
2952 | |
2953 | -#ifndef MIR_FRONTEND_SOCKET_MESSENGER_H_ |
2954 | -#define MIR_FRONTEND_SOCKET_MESSENGER_H_ |
2955 | +#ifndef MIR_FRONTEND_SOCKET_MESSENGER_H_ |
2956 | +#define MIR_FRONTEND_SOCKET_MESSENGER_H_ |
2957 | #include "message_sender.h" |
2958 | #include "message_receiver.h" |
2959 | #include <mutex> |
2960 | @@ -37,19 +37,19 @@ |
2961 | void send(std::string const& body); |
2962 | void send(std::string const& body, FdSets const& fd_set); |
2963 | |
2964 | - void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size); |
2965 | + void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size); |
2966 | pid_t client_pid(); |
2967 | |
2968 | private: |
2969 | std::shared_ptr<boost::asio::local::stream_protocol::socket> socket; |
2970 | - |
2971 | + |
2972 | std::mutex message_lock; |
2973 | std::vector<char> whole_message; |
2974 | - |
2975 | + |
2976 | void send_fds_locked(std::unique_lock<std::mutex> const& lock, std::vector<int32_t> const& fds); |
2977 | }; |
2978 | } |
2979 | } |
2980 | } |
2981 | |
2982 | -#endif /* MIR_FRONTEND_SOCKET_MESSENGER_H_ */ |
2983 | +#endif /* MIR_FRONTEND_SOCKET_MESSENGER_H_ */ |
2984 | |
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 | connected_sessions->remove(id()); |
2990 | BOOST_THROW_EXCEPTION(std::runtime_error(error.message())); |
2991 | } |
2992 | - |
2993 | + |
2994 | unsigned char high_byte = message.sbumpc(); |
2995 | unsigned char low_byte = message.sbumpc(); |
2996 | size_t const body_size = (high_byte << 8) + low_byte; |
2997 | |
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 | ForwardingInternalSurface(std::shared_ptr<Surface> const& surface) : surface(surface) {} |
3003 | |
3004 | private: |
3005 | - virtual std::shared_ptr<mg::Buffer> advance_client_buffer() |
3006 | + void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer) |
3007 | { |
3008 | - return surface->advance_client_buffer(); |
3009 | + surface->swap_buffers(buffer); |
3010 | } |
3011 | virtual mir::geometry::Size size() const { return surface->size(); } |
3012 | virtual MirPixelFormat pixel_format() const { return static_cast<MirPixelFormat>(surface->pixel_format()); } |
3013 | |
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 | case mg::BufferUsage::hardware: |
3019 | default: |
3020 | return mga::BufferUsage::use_hardware; |
3021 | - } |
3022 | + } |
3023 | } |
3024 | |
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 | GLContext gl_context; |
3030 | std::shared_ptr<DisplayDevice> const display_device; |
3031 | //we only have a primary display at the moment |
3032 | - std::unique_ptr<graphics::DisplayBuffer> const display_buffer; |
3033 | + std::unique_ptr<graphics::DisplayBuffer> const display_buffer; |
3034 | AndroidDisplayConfiguration current_configuration; |
3035 | }; |
3036 | |
3037 | |
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 | AndroidDisplayConfiguration(geometry::Size const& display_size); |
3043 | AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other); |
3044 | AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other); |
3045 | - |
3046 | + |
3047 | virtual ~AndroidDisplayConfiguration() = default; |
3048 | |
3049 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const; |
3050 | |
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 | auto buffer_handle = native_buffer->handle(); |
3056 | |
3057 | int offset = 0; |
3058 | - |
3059 | + |
3060 | for(auto i=0; i<buffer_handle->numFds; i++) |
3061 | { |
3062 | packer->pack_fd(buffer_handle->data[offset++]); |
3063 | |
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 | content_lock.unlock(); |
3069 | }); |
3070 | |
3071 | - //lock remains in effect until the native handle is released |
3072 | + //lock remains in effect until the native handle is released |
3073 | lk.release(); |
3074 | return native_resource; |
3075 | } |
3076 | |
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 | void release_current(); |
3082 | void post_update(); |
3083 | bool can_bypass() const override; |
3084 | - |
3085 | + |
3086 | private: |
3087 | std::shared_ptr<FramebufferBundle> const fb_bundle; |
3088 | std::shared_ptr<DisplayDevice> const display_device; |
3089 | |
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 | |
3095 | virtual void mode(MirPowerMode mode) = 0; |
3096 | virtual void prepare_composition() = 0; |
3097 | - virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0; |
3098 | + virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0; |
3099 | virtual void post(Buffer const& buffer) = 0; |
3100 | |
3101 | protected: |
3102 | |
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 | { |
3108 | fb_device->setSwapInterval(fb_device.get(), 1); |
3109 | } |
3110 | + |
3111 | + mode(mir_power_mode_on); |
3112 | } |
3113 | |
3114 | void mga::FBDevice::prepare_composition() |
3115 | @@ -65,6 +67,14 @@ |
3116 | |
3117 | void mga::FBDevice::mode(MirPowerMode mode) |
3118 | { |
3119 | - // TODO: Implement |
3120 | - (void) mode; |
3121 | + int enable = 0; |
3122 | + if (mode == mir_power_mode_on) |
3123 | + { |
3124 | + enable = 1; |
3125 | + } |
3126 | + |
3127 | + if (fb_device->enableScreen) |
3128 | + { |
3129 | + fb_device->enableScreen(fb_device.get(), enable); |
3130 | + } |
3131 | } |
3132 | |
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 | #include "display_device.h" |
3138 | #include <hardware/gralloc.h> |
3139 | #include <hardware/fb.h> |
3140 | - |
3141 | + |
3142 | namespace mir |
3143 | { |
3144 | namespace graphics |
3145 | @@ -30,14 +30,14 @@ |
3146 | namespace android |
3147 | { |
3148 | |
3149 | -class FBDevice : public DisplayDevice |
3150 | +class FBDevice : public DisplayDevice |
3151 | { |
3152 | public: |
3153 | FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev); |
3154 | |
3155 | void mode(MirPowerMode mode); |
3156 | void prepare_composition(); |
3157 | - void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3158 | + void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3159 | void post(Buffer const& buffer); |
3160 | |
3161 | private: |
3162 | |
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 | { |
3168 | int visual_id; |
3169 | eglGetConfigAttrib(egl_display, fb_egl_config, EGL_NATIVE_VISUAL_ID, &visual_id); |
3170 | - fb_format = mga::to_mir_format(visual_id); |
3171 | + fb_format = mga::to_mir_format(visual_id); |
3172 | } |
3173 | else |
3174 | { |
3175 | @@ -76,7 +76,7 @@ |
3176 | auto rc = hwc_device->getDisplayConfigs(hwc_device.get(), HWC_DISPLAY_PRIMARY, &primary_display_config, &num_configs); |
3177 | if (rc != 0) |
3178 | { |
3179 | - BOOST_THROW_EXCEPTION(std::runtime_error("could not determine hwc display config")); |
3180 | + BOOST_THROW_EXCEPTION(std::runtime_error("could not determine hwc display config")); |
3181 | } |
3182 | static uint32_t size_request[3] = { HWC_DISPLAY_WIDTH, |
3183 | HWC_DISPLAY_HEIGHT, |
3184 | @@ -94,7 +94,7 @@ |
3185 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, |
3186 | std::shared_ptr<hwc_composer_device_1> const& hwc) |
3187 | : format(determine_hwc11_fb_format()), |
3188 | - size(determine_hwc11_size(hwc)) |
3189 | + size(determine_hwc11_size(hwc)) |
3190 | { |
3191 | for(auto i = 0u; i < 2; i++) |
3192 | { |
3193 | @@ -106,7 +106,7 @@ |
3194 | std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator, |
3195 | std::shared_ptr<framebuffer_device_t> const& fb) |
3196 | : format{mga::to_mir_format(fb->format)}, |
3197 | - size({fb->width, fb->height}) |
3198 | + size({fb->width, fb->height}) |
3199 | { |
3200 | //guarantee always 2 fb's allocated |
3201 | auto fb_num = static_cast<unsigned int>(fb->numFramebuffers); |
3202 | @@ -154,5 +154,5 @@ |
3203 | |
3204 | void mga::Framebuffers::wait_for_consumed_buffer(bool) |
3205 | { |
3206 | - //TODO: change swapping so buffer_for_render() does not wait |
3207 | + //TODO: change swapping so buffer_for_render() does not wait |
3208 | } |
3209 | |
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 | eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)}, |
3215 | egl_surface{egl_display, |
3216 | eglCreatePbufferSurface(egl_display, egl_config, dummy_pbuffer_attribs)} |
3217 | -{ |
3218 | +{ |
3219 | report.report_egl_configuration(egl_display, egl_config); |
3220 | } |
3221 | |
3222 | |
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 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3228 | |
3229 | void prepare_composition(); |
3230 | - void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3231 | + void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3232 | void post(Buffer const& buffer); |
3233 | |
3234 | private: |
3235 | |
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 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3241 | |
3242 | void prepare_composition(); |
3243 | - void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3244 | + void gpu_render(EGLDisplay dpy, EGLSurface sur); |
3245 | void post(Buffer const& buffer); |
3246 | |
3247 | private: |
3248 | |
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 | |
3254 | //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off |
3255 | // are all treated like mir_power_mode_off |
3256 | - if ((mode_request == mir_power_mode_suspend) || |
3257 | + if ((mode_request == mir_power_mode_suspend) || |
3258 | (mode_request == mir_power_mode_standby)) |
3259 | { |
3260 | mode_request = mir_power_mode_off; |
3261 | } |
3262 | |
3263 | - if ((mode_request == mir_power_mode_on) && |
3264 | + if ((mode_request == mir_power_mode_on) && |
3265 | (current_mode == mir_power_mode_off)) |
3266 | { |
3267 | err = turn_screen_on(); |
3268 | } |
3269 | - else if ((mode_request == mir_power_mode_off) && |
3270 | + else if ((mode_request == mir_power_mode_off) && |
3271 | (current_mode == mir_power_mode_on)) |
3272 | { |
3273 | err = turn_screen_off(); |
3274 | @@ -96,15 +96,15 @@ |
3275 | |
3276 | if (err) |
3277 | { |
3278 | - std::string blanking_status_msg = "Could not " + |
3279 | + std::string blanking_status_msg = "Could not " + |
3280 | ((mode_request == mir_power_mode_off) ? std::string("blank") : std::string("unblank")) + " display"; |
3281 | BOOST_THROW_EXCEPTION( |
3282 | boost::enable_error_info( |
3283 | std::runtime_error(blanking_status_msg)) << |
3284 | boost::errinfo_errno(-err)); |
3285 | } |
3286 | - |
3287 | - current_mode = mode_request; |
3288 | + |
3289 | + current_mode = mode_request; |
3290 | blanked_cond.notify_all(); |
3291 | } |
3292 | |
3293 | |
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 | |
3299 | std::mutex blanked_mutex; |
3300 | std::condition_variable blanked_cond; |
3301 | - MirPowerMode current_mode; |
3302 | + MirPowerMode current_mode; |
3303 | }; |
3304 | |
3305 | } |
3306 | |
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 | |
3312 | mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer) |
3313 | { |
3314 | - memcpy(this, &layer, sizeof(HWCLayer)); |
3315 | + memcpy(this, &layer, sizeof(HWCLayer)); |
3316 | this->visibleRegionScreen = {1, &this->visible_rect}; |
3317 | - return *this; |
3318 | + return *this; |
3319 | } |
3320 | |
3321 | mga::HWCLayer::HWCLayer(HWCLayer const& layer) |
3322 | { |
3323 | - memcpy(this, &layer, sizeof(HWCLayer)); |
3324 | + memcpy(this, &layer, sizeof(HWCLayer)); |
3325 | this->visibleRegionScreen = {1, &this->visible_rect}; |
3326 | } |
3327 | |
3328 | @@ -59,6 +59,8 @@ |
3329 | visibleRegionScreen.numRects=1; |
3330 | visibleRegionScreen.rects= &visible_rect; |
3331 | handle = buffer_handle; |
3332 | + |
3333 | + memset(&reserved, 0, sizeof(reserved)); |
3334 | } |
3335 | |
3336 | mga::FramebufferLayer::FramebufferLayer() |
3337 | @@ -92,7 +94,7 @@ |
3338 | auto i = 0u; |
3339 | for(auto& layer : layer_list) |
3340 | { |
3341 | - hwc_representation->hwLayers[i++] = layer; |
3342 | + hwc_representation->hwLayers[i++] = layer; |
3343 | } |
3344 | hwc_representation->numHwLayers = layer_list.size(); |
3345 | hwc_representation->retireFenceFd = -1; |
3346 | @@ -102,7 +104,7 @@ |
3347 | //these fields are deprecated in hwc1.1 and later. |
3348 | hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF); |
3349 | hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE); |
3350 | - |
3351 | + |
3352 | } |
3353 | |
3354 | void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer) |
3355 | @@ -119,7 +121,7 @@ |
3356 | mga::NativeFence mga::LayerList::framebuffer_fence() |
3357 | { |
3358 | auto fb_position = hwc_representation->numHwLayers - 1; |
3359 | - return hwc_representation->hwLayers[fb_position].releaseFenceFd; |
3360 | + return hwc_representation->hwLayers[fb_position].releaseFenceFd; |
3361 | } |
3362 | |
3363 | hwc_display_contents_1_t* mga::LayerList::native_list() const |
3364 | |
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 | : vsync_occurred(false) |
3370 | { |
3371 | } |
3372 | - |
3373 | + |
3374 | void mga::HWCVsync::wait_for_vsync() |
3375 | { |
3376 | std::unique_lock<std::mutex> lk(vsync_wait_mutex); |
3377 | |
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 | { |
3383 | public: |
3384 | HWCVsync(); |
3385 | - |
3386 | + |
3387 | void wait_for_vsync(); |
3388 | void notify_vsync(); |
3389 | private: |
3390 | |
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 | { |
3396 | public: |
3397 | virtual ~HWCVsyncCoordinator() = default; |
3398 | - |
3399 | + |
3400 | virtual void wait_for_vsync() = 0; |
3401 | virtual void notify_vsync() = 0; |
3402 | |
3403 | |
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 | if (!client_windows[surface]) |
3409 | { |
3410 | auto cache = std::make_shared<mga::InterpreterCache>(); |
3411 | - auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache); |
3412 | + auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache); |
3413 | client_windows[surface] = std::make_shared<mga::MirNativeWindow>(interpreter); |
3414 | } |
3415 | |
3416 | |
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 | |
3422 | mg::NativeBuffer* mga::InternalClientWindow::driver_requests_buffer() |
3423 | { |
3424 | - auto buffer = surface->advance_client_buffer(); |
3425 | + std::shared_ptr<graphics::Buffer> buffer; |
3426 | + surface->swap_buffers(buffer); |
3427 | auto handle = buffer->native_buffer_handle(); |
3428 | resource_cache->store_buffer(buffer, handle); |
3429 | return handle.get(); |
3430 | @@ -74,7 +75,7 @@ |
3431 | case NATIVE_WINDOW_FORMAT: |
3432 | return format; |
3433 | case NATIVE_WINDOW_TRANSFORM_HINT: |
3434 | - return 0; |
3435 | + return 0; |
3436 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: |
3437 | return 1; |
3438 | default: |
3439 | |
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 | void driver_returns_buffer(ANativeWindowBuffer*, int); |
3445 | void dispatch_driver_request_format(int); |
3446 | int driver_requests_info(int) const; |
3447 | - void sync_to_display(bool sync); |
3448 | + void sync_to_display(bool sync); |
3449 | |
3450 | private: |
3451 | std::shared_ptr<InternalSurface> const surface; |
3452 | |
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 | |
3458 | std::shared_ptr<mg::Buffer> mga::InterpreterCache::retrieve_buffer(ANativeWindowBuffer* returned_handle) |
3459 | { |
3460 | - auto buffer_it = buffers_in_driver.find(returned_handle); |
3461 | + auto buffer_it = buffers_in_driver.find(returned_handle); |
3462 | auto native_it = native_buffers.find(returned_handle); |
3463 | |
3464 | if ((buffer_it == buffers_in_driver.end()) || |
3465 | |
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 | |
3471 | std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device() |
3472 | { |
3473 | - std::shared_ptr<mga::DisplayDevice> device; |
3474 | + std::shared_ptr<mga::DisplayDevice> device; |
3475 | if (force_backup_display) |
3476 | { |
3477 | device = res_factory->create_fb_device(fb_native); |
3478 | @@ -104,5 +104,5 @@ |
3479 | { |
3480 | auto native_window = res_factory->create_native_window(framebuffers); |
3481 | return std::unique_ptr<mg::DisplayBuffer>( |
3482 | - new DisplayBuffer(framebuffers, display_device, native_window, gl_context)); |
3483 | + new DisplayBuffer(framebuffers, display_device, native_window, gl_context)); |
3484 | } |
3485 | |
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 | auto rc = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); |
3491 | if ((rc != 0) || (module == nullptr) || (framebuffer_open(module, &fbdev_raw) != 0) ) |
3492 | { |
3493 | - BOOST_THROW_EXCEPTION(std::runtime_error("display factory cannot create fb display")); |
3494 | + BOOST_THROW_EXCEPTION(std::runtime_error("display factory cannot create fb display")); |
3495 | } |
3496 | |
3497 | return std::shared_ptr<framebuffer_device_t>(fbdev_raw, |
3498 | @@ -65,7 +65,7 @@ |
3499 | module->methods->open(module, HWC_HARDWARE_COMPOSER, reinterpret_cast<hw_device_t**>(&hwc_device_raw)) || |
3500 | (hwc_device_raw == nullptr)) |
3501 | { |
3502 | - BOOST_THROW_EXCEPTION(std::runtime_error("error opening hwc hal")); |
3503 | + BOOST_THROW_EXCEPTION(std::runtime_error("error opening hwc hal")); |
3504 | } |
3505 | |
3506 | return std::shared_ptr<hwc_composer_device_1>( |
3507 | @@ -78,7 +78,7 @@ |
3508 | { |
3509 | auto cache = std::make_shared<mga::InterpreterCache>(); |
3510 | auto interpreter = std::make_shared<ServerRenderWindow>(fb_bundle, cache); |
3511 | - return std::make_shared<MirNativeWindow>(interpreter); |
3512 | + return std::make_shared<MirNativeWindow>(interpreter); |
3513 | } |
3514 | |
3515 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_fb_device( |
3516 | |
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 | case NATIVE_WINDOW_FORMAT: |
3522 | return format; |
3523 | case NATIVE_WINDOW_TRANSFORM_HINT: |
3524 | - return 0; |
3525 | + return 0; |
3526 | case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: |
3527 | return 1; |
3528 | default: |
3529 | |
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 | |
3535 | class FramebufferBundle; |
3536 | class InterpreterResourceCache; |
3537 | -class ServerRenderWindow : public AndroidDriverInterpreter |
3538 | +class ServerRenderWindow : public AndroidDriverInterpreter |
3539 | { |
3540 | public: |
3541 | ServerRenderWindow(std::shared_ptr<FramebufferBundle> const& fb_bundle, |
3542 | @@ -50,7 +50,7 @@ |
3543 | std::shared_ptr<FramebufferBundle> const fb_bundle; |
3544 | std::shared_ptr<InterpreterResourceCache> const resource_cache; |
3545 | int format; |
3546 | -}; |
3547 | +}; |
3548 | |
3549 | } |
3550 | } |
3551 | |
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 | mirplatformgraphics SHARED |
3557 | |
3558 | gbm_platform.cpp |
3559 | - gbm_buffer_allocator.cpp |
3560 | + buffer_allocator.cpp |
3561 | gbm_buffer.cpp |
3562 | gbm_cursor.cpp |
3563 | gbm_display_helpers.cpp |
3564 | @@ -34,6 +34,8 @@ |
3565 | udev_wrapper.cpp |
3566 | overlapping_output_grouping.cpp |
3567 | native_gbm_platform.cpp |
3568 | + anonymous_shm_file.cpp |
3569 | + shm_buffer.cpp |
3570 | ) |
3571 | |
3572 | target_link_libraries( |
3573 | |
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 | +/* |
3579 | + * Copyright © 2013 Canonical Ltd. |
3580 | + * |
3581 | + * This program is free software: you can redistribute it and/or modify it |
3582 | + * under the terms of the GNU General Public License version 3, |
3583 | + * as published by the Free Software Foundation. |
3584 | + * |
3585 | + * This program is distributed in the hope that it will be useful, |
3586 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3587 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3588 | + * GNU General Public License for more details. |
3589 | + * |
3590 | + * You should have received a copy of the GNU General Public License |
3591 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3592 | + * |
3593 | + * Authored by: |
3594 | + * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
3595 | + */ |
3596 | + |
3597 | +#include "anonymous_shm_file.h" |
3598 | + |
3599 | +#include <boost/throw_exception.hpp> |
3600 | +#include <stdexcept> |
3601 | + |
3602 | +#include <vector> |
3603 | + |
3604 | +#include <cstdlib> |
3605 | +#include <cstring> |
3606 | +#include <sys/mman.h> |
3607 | +#include <fcntl.h> |
3608 | + |
3609 | +namespace mgg = mir::graphics::gbm; |
3610 | + |
3611 | +namespace |
3612 | +{ |
3613 | + |
3614 | +mgg::detail::FdHandle create_anonymous_file(size_t size) |
3615 | +{ |
3616 | + char const* const tmpl = "/mir-buffer-XXXXXX"; |
3617 | + char const* const runtime_dir = getenv("XDG_RUNTIME_DIR"); |
3618 | + char const* const target_dir = runtime_dir ? runtime_dir : "/tmp"; |
3619 | + |
3620 | + /* We need a mutable array for mkostemp */ |
3621 | + std::vector<char> path(target_dir, target_dir + strlen(target_dir)); |
3622 | + path.insert(path.end(), tmpl, tmpl + strlen(tmpl)); |
3623 | + path.push_back('\0'); |
3624 | + |
3625 | + mgg::detail::FdHandle fd{mkostemp(path.data(), O_CLOEXEC)}; |
3626 | + if (unlink(path.data()) < 0) |
3627 | + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to unlink temporary file")); |
3628 | + if (ftruncate(fd, size) < 0) |
3629 | + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to resize temporary file")); |
3630 | + |
3631 | + return fd; |
3632 | +} |
3633 | + |
3634 | +} |
3635 | + |
3636 | +/************* |
3637 | + * FdHandle * |
3638 | + *************/ |
3639 | + |
3640 | +mgg::detail::FdHandle::FdHandle(int fd) |
3641 | + : fd{fd} |
3642 | +{ |
3643 | + if (fd < 0) |
3644 | + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create file")); |
3645 | +} |
3646 | + |
3647 | +mgg::detail::FdHandle::FdHandle(FdHandle&& other) |
3648 | + : fd{other.fd} |
3649 | +{ |
3650 | + other.fd = -1; |
3651 | +} |
3652 | + |
3653 | +mgg::detail::FdHandle::~FdHandle() noexcept |
3654 | +{ |
3655 | + if (fd >= 0) |
3656 | + close(fd); |
3657 | +} |
3658 | + |
3659 | +mgg::detail::FdHandle::operator int() const |
3660 | +{ |
3661 | + return fd; |
3662 | +} |
3663 | + |
3664 | +/************* |
3665 | + * MapHandle * |
3666 | + *************/ |
3667 | + |
3668 | +mgg::detail::MapHandle::MapHandle(int fd, size_t size) |
3669 | + : size{size}, |
3670 | + mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE, |
3671 | + MAP_SHARED, fd, 0)} |
3672 | +{ |
3673 | + if (mapping == MAP_FAILED) |
3674 | + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to map file")); |
3675 | +} |
3676 | + |
3677 | +mgg::detail::MapHandle::~MapHandle() noexcept |
3678 | +{ |
3679 | + munmap(mapping, size); |
3680 | +} |
3681 | + |
3682 | +mgg::detail::MapHandle::operator void*() const |
3683 | +{ |
3684 | + return mapping; |
3685 | + |
3686 | +} |
3687 | + |
3688 | +/******************** |
3689 | + * AnonymousShmFile * |
3690 | + ********************/ |
3691 | + |
3692 | +mgg::AnonymousShmFile::AnonymousShmFile(size_t size) |
3693 | + : fd_{create_anonymous_file(size)}, |
3694 | + mapping{fd_, size} |
3695 | +{ |
3696 | +} |
3697 | + |
3698 | +void* mgg::AnonymousShmFile::base_ptr() const |
3699 | +{ |
3700 | + return mapping; |
3701 | +} |
3702 | + |
3703 | +int mgg::AnonymousShmFile::fd() const |
3704 | +{ |
3705 | + return fd_; |
3706 | +} |
3707 | |
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 | +/* |
3713 | + * Copyright © 2013 Canonical Ltd. |
3714 | + * |
3715 | + * This program is free software: you can redistribute it and/or modify it |
3716 | + * under the terms of the GNU General Public License version 3, |
3717 | + * as published by the Free Software Foundation. |
3718 | + * |
3719 | + * This program is distributed in the hope that it will be useful, |
3720 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3721 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3722 | + * GNU General Public License for more details. |
3723 | + * |
3724 | + * You should have received a copy of the GNU General Public License |
3725 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3726 | + * |
3727 | + * Authored by: |
3728 | + * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
3729 | + */ |
3730 | + |
3731 | +#ifndef MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ |
3732 | +#define MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ |
3733 | + |
3734 | +#include "shm_file.h" |
3735 | + |
3736 | +namespace mir |
3737 | +{ |
3738 | +namespace graphics |
3739 | +{ |
3740 | +namespace gbm |
3741 | +{ |
3742 | + |
3743 | +namespace detail |
3744 | +{ |
3745 | +class FdHandle |
3746 | +{ |
3747 | +public: |
3748 | + FdHandle(int fd); |
3749 | + FdHandle(FdHandle&&); |
3750 | + ~FdHandle() noexcept; |
3751 | + |
3752 | + operator int() const; |
3753 | + |
3754 | +private: |
3755 | + FdHandle(FdHandle const&) = delete; |
3756 | + FdHandle& operator=(FdHandle const&) = delete; |
3757 | + int fd; |
3758 | +}; |
3759 | + |
3760 | +class MapHandle |
3761 | +{ |
3762 | +public: |
3763 | + MapHandle(int fd, size_t size); |
3764 | + ~MapHandle() noexcept; |
3765 | + |
3766 | + operator void*() const; |
3767 | + |
3768 | +private: |
3769 | + MapHandle(MapHandle const&) = delete; |
3770 | + MapHandle& operator=(MapHandle const&) = delete; |
3771 | + size_t const size; |
3772 | + void* const mapping; |
3773 | +}; |
3774 | +} |
3775 | + |
3776 | +class AnonymousShmFile : public ShmFile |
3777 | +{ |
3778 | +public: |
3779 | + AnonymousShmFile(size_t size); |
3780 | + |
3781 | + void* base_ptr() const; |
3782 | + int fd() const; |
3783 | + |
3784 | +private: |
3785 | + detail::FdHandle const fd_; |
3786 | + detail::MapHandle const mapping; |
3787 | +}; |
3788 | + |
3789 | +} |
3790 | +} |
3791 | +} |
3792 | + |
3793 | +#endif /* MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ */ |
3794 | |
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 | static const struct { |
3800 | unsigned int width; |
3801 | unsigned int height; |
3802 | - unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ |
3803 | + unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ |
3804 | unsigned char pixel_data[64 * 64 * 4 + 1]; |
3805 | } black_arrow = { |
3806 | 64, 64, 4, |
3807 | |
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 | * Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
3813 | */ |
3814 | |
3815 | -#include "gbm_buffer_allocator.h" |
3816 | +#include "buffer_allocator.h" |
3817 | #include "gbm_buffer.h" |
3818 | #include "gbm_platform.h" |
3819 | #include "buffer_texture_binder.h" |
3820 | +#include "anonymous_shm_file.h" |
3821 | +#include "shm_buffer.h" |
3822 | #include "mir/graphics/buffer_initializer.h" |
3823 | #include "mir/graphics/egl_extensions.h" |
3824 | #include "mir/graphics/buffer_properties.h" |
3825 | @@ -106,12 +108,12 @@ |
3826 | |
3827 | } |
3828 | |
3829 | -mgg::GBMBufferAllocator::GBMBufferAllocator( |
3830 | - gbm_device* device, |
3831 | - const std::shared_ptr<BufferInitializer>& buffer_initializer) |
3832 | - : device(device), |
3833 | - buffer_initializer(buffer_initializer), |
3834 | - egl_extensions(std::make_shared<mg::EGLExtensions>()) |
3835 | +mgg::BufferAllocator::BufferAllocator( |
3836 | + gbm_device* device, |
3837 | + const std::shared_ptr<BufferInitializer>& buffer_initializer) |
3838 | + : device(device), |
3839 | + buffer_initializer(buffer_initializer), |
3840 | + egl_extensions(std::make_shared<mg::EGLExtensions>()) |
3841 | { |
3842 | assert(buffer_initializer.get() != 0); |
3843 | |
3844 | @@ -119,11 +121,25 @@ |
3845 | bypass_env = env ? env[0] != '0' : true; |
3846 | } |
3847 | |
3848 | -std::shared_ptr<mg::Buffer> mgg::GBMBufferAllocator::alloc_buffer(BufferProperties const& buffer_properties) |
3849 | +std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_buffer( |
3850 | + BufferProperties const& buffer_properties) |
3851 | +{ |
3852 | + std::shared_ptr<mg::Buffer> buffer; |
3853 | + |
3854 | + if (buffer_properties.usage == BufferUsage::software) |
3855 | + buffer = alloc_software_buffer(buffer_properties); |
3856 | + else |
3857 | + buffer = alloc_hardware_buffer(buffer_properties); |
3858 | + |
3859 | + return buffer; |
3860 | +} |
3861 | + |
3862 | +std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_hardware_buffer( |
3863 | + BufferProperties const& buffer_properties) |
3864 | { |
3865 | uint32_t bo_flags{GBM_BO_USE_RENDERING}; |
3866 | |
3867 | - uint32_t gbm_format = mgg::mir_format_to_gbm_format(buffer_properties.format); |
3868 | + uint32_t const gbm_format = mgg::mir_format_to_gbm_format(buffer_properties.format); |
3869 | |
3870 | if (!is_pixel_format_supported(buffer_properties.format) || |
3871 | gbm_format == mgg::invalid_gbm_format) |
3872 | @@ -132,10 +148,6 @@ |
3873 | std::runtime_error("Trying to create GBM buffer with unsupported pixel format")); |
3874 | } |
3875 | |
3876 | - /* Create the GBM buffer object */ |
3877 | - if (buffer_properties.usage == BufferUsage::software) |
3878 | - bo_flags |= GBM_BO_USE_WRITE; |
3879 | - |
3880 | /* |
3881 | * Bypass is generally only beneficial to hardware buffers where the |
3882 | * blitting happens on the GPU. For software buffers it is slower to blit |
3883 | @@ -149,7 +161,6 @@ |
3884 | * mir_surface_state_fullscreen later when it's fully wired up. |
3885 | */ |
3886 | if (bypass_env && |
3887 | - buffer_properties.usage == BufferUsage::hardware && |
3888 | buffer_properties.size.width.as_uint32_t() >= 800 && |
3889 | buffer_properties.size.height.as_uint32_t() >= 600) |
3890 | { |
3891 | @@ -172,14 +183,42 @@ |
3892 | new EGLImageBufferTextureBinder{bo, egl_extensions}}; |
3893 | |
3894 | /* Create the GBMBuffer */ |
3895 | - std::shared_ptr<mg::Buffer> buffer{new GBMBuffer{bo, bo_flags, std::move(texture_binder)}}; |
3896 | - |
3897 | - (*buffer_initializer)(*buffer); |
3898 | - |
3899 | - return buffer; |
3900 | -} |
3901 | - |
3902 | -std::vector<geom::PixelFormat> mgg::GBMBufferAllocator::supported_pixel_formats() |
3903 | + auto const buffer = |
3904 | + std::make_shared<GBMBuffer>(bo, bo_flags, std::move(texture_binder)); |
3905 | + |
3906 | + (*buffer_initializer)(*buffer); |
3907 | + |
3908 | + return buffer; |
3909 | +} |
3910 | + |
3911 | +std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_software_buffer( |
3912 | + BufferProperties const& buffer_properties) |
3913 | +{ |
3914 | + if (!is_pixel_format_supported(buffer_properties.format)) |
3915 | + { |
3916 | + BOOST_THROW_EXCEPTION( |
3917 | + std::runtime_error( |
3918 | + "Trying to create SHM buffer with unsupported pixel format")); |
3919 | + } |
3920 | + |
3921 | + auto const stride = geom::Stride{ |
3922 | + geom::bytes_per_pixel(buffer_properties.format) * |
3923 | + buffer_properties.size.width.as_uint32_t()}; |
3924 | + size_t const size_in_bytes = |
3925 | + stride.as_int() * buffer_properties.size.height.as_int(); |
3926 | + auto const shm_file = |
3927 | + std::make_shared<mgg::AnonymousShmFile>(size_in_bytes); |
3928 | + |
3929 | + auto const buffer = |
3930 | + std::make_shared<ShmBuffer>(shm_file, buffer_properties.size, |
3931 | + buffer_properties.format); |
3932 | + |
3933 | + (*buffer_initializer)(*buffer); |
3934 | + |
3935 | + return buffer; |
3936 | +} |
3937 | + |
3938 | +std::vector<geom::PixelFormat> mgg::BufferAllocator::supported_pixel_formats() |
3939 | { |
3940 | static std::vector<geom::PixelFormat> const pixel_formats{ |
3941 | geom::PixelFormat::argb_8888, |
3942 | @@ -189,7 +228,7 @@ |
3943 | return pixel_formats; |
3944 | } |
3945 | |
3946 | -bool mgg::GBMBufferAllocator::is_pixel_format_supported(geom::PixelFormat format) |
3947 | +bool mgg::BufferAllocator::is_pixel_format_supported(geom::PixelFormat format) |
3948 | { |
3949 | auto formats = supported_pixel_formats(); |
3950 | |
3951 | |
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 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
3957 | */ |
3958 | |
3959 | -#ifndef MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_ |
3960 | -#define MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_ |
3961 | +#ifndef MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_ |
3962 | +#define MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_ |
3963 | |
3964 | #include "mir/graphics/graphic_buffer_allocator.h" |
3965 | #include "mir/graphics/buffer_id.h" |
3966 | @@ -38,11 +38,11 @@ |
3967 | |
3968 | namespace gbm |
3969 | { |
3970 | -class GBMBufferAllocator: public graphics::GraphicBufferAllocator |
3971 | +class BufferAllocator: public graphics::GraphicBufferAllocator |
3972 | { |
3973 | public: |
3974 | - GBMBufferAllocator(gbm_device* device, |
3975 | - const std::shared_ptr<BufferInitializer>& buffer_initializer); |
3976 | + BufferAllocator(gbm_device* device, |
3977 | + std::shared_ptr<BufferInitializer> const& buffer_initializer); |
3978 | |
3979 | virtual std::shared_ptr<Buffer> alloc_buffer( |
3980 | graphics::BufferProperties const& buffer_properties); |
3981 | @@ -51,6 +51,10 @@ |
3982 | |
3983 | private: |
3984 | bool is_pixel_format_supported(geometry::PixelFormat format); |
3985 | + std::shared_ptr<Buffer> alloc_hardware_buffer( |
3986 | + graphics::BufferProperties const& buffer_properties); |
3987 | + std::shared_ptr<Buffer> alloc_software_buffer( |
3988 | + graphics::BufferProperties const& buffer_properties); |
3989 | |
3990 | gbm_device* const device; |
3991 | std::shared_ptr<graphics::BufferInitializer> buffer_initializer; |
3992 | @@ -63,4 +67,4 @@ |
3993 | } |
3994 | } |
3995 | |
3996 | -#endif // MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_ |
3997 | +#endif // MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_ |
3998 | |
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 | auto gem_handle = gbm_bo_get_handle(gbm_handle.get()).u32; |
4004 | auto drm_fd = gbm_device_get_fd(device); |
4005 | |
4006 | - auto ret = drmPrimeHandleToFD(drm_fd, gem_handle, DRM_CLOEXEC, &prime_fd); |
4007 | + auto ret = drmPrimeHandleToFD(drm_fd, gem_handle, DRM_CLOEXEC, &prime_fd); |
4008 | |
4009 | if (ret) |
4010 | { |
4011 | |
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 | } |
4017 | |
4018 | int mggh::DRMHelper::open_drm_device(std::shared_ptr<UdevContext> const& udev) |
4019 | -{ |
4020 | +{ |
4021 | int tmp_fd = -1; |
4022 | int error = ENODEV; //Default error is "there are no DRM devices" |
4023 | |
4024 | |
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 | */ |
4030 | |
4031 | #include "gbm_platform.h" |
4032 | -#include "gbm_buffer_allocator.h" |
4033 | +#include "buffer_allocator.h" |
4034 | #include "gbm_display.h" |
4035 | #include "internal_client.h" |
4036 | #include "internal_native_display.h" |
4037 | @@ -114,8 +114,7 @@ |
4038 | std::shared_ptr<mg::GraphicBufferAllocator> mgg::GBMPlatform::create_buffer_allocator( |
4039 | const std::shared_ptr<mg::BufferInitializer>& buffer_initializer) |
4040 | { |
4041 | - return std::make_shared<mgg::GBMBufferAllocator>(gbm.device, |
4042 | - buffer_initializer); |
4043 | + return std::make_shared<mgg::BufferAllocator>(gbm.device, buffer_initializer); |
4044 | } |
4045 | |
4046 | std::shared_ptr<mg::Display> mgg::GBMPlatform::create_display( |
4047 | @@ -138,13 +137,13 @@ |
4048 | for(auto i=0; i<native_handle->data_items; i++) |
4049 | { |
4050 | packer->pack_data(native_handle->data[i]); |
4051 | - } |
4052 | + } |
4053 | for(auto i=0; i<native_handle->fd_items; i++) |
4054 | { |
4055 | packer->pack_fd(native_handle->fd[i]); |
4056 | } |
4057 | |
4058 | - packer->pack_stride(buffer->stride()); |
4059 | + packer->pack_stride(buffer->stride()); |
4060 | packer->pack_flags(native_handle->flags); |
4061 | packer->pack_size(buffer->size()); |
4062 | } |
4063 | @@ -157,7 +156,7 @@ |
4064 | std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client() |
4065 | { |
4066 | if (!internal_native_display) |
4067 | - internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package()); |
4068 | + internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package()); |
4069 | internal_display_clients_present = true; |
4070 | return std::make_shared<mgg::InternalClient>(internal_native_display); |
4071 | } |
4072 | |
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 | const std::shared_ptr<BufferInitializer>& buffer_initializer); |
4078 | std::shared_ptr<Display> create_display( |
4079 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy); |
4080 | - std::shared_ptr<PlatformIPCPackage> get_ipc_package(); |
4081 | + std::shared_ptr<PlatformIPCPackage> get_ipc_package(); |
4082 | std::shared_ptr<InternalClient> create_internal_client(); |
4083 | |
4084 | void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const; |
4085 | |
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 | { |
4091 | surface_advance_buffer = advance_buffer_static; |
4092 | surface_get_parameters = get_parameters_static; |
4093 | - surface_set_swapinterval = set_swapinterval_static; |
4094 | + surface_set_swapinterval = set_swapinterval_static; |
4095 | } |
4096 | |
4097 | int mgg::InternalNativeSurface::advance_buffer_static( |
4098 | @@ -39,8 +39,7 @@ |
4099 | |
4100 | int mgg::InternalNativeSurface::advance_buffer(MirBufferPackage* package) |
4101 | { |
4102 | - current_buffer.reset(); |
4103 | - current_buffer = surface->advance_client_buffer(); |
4104 | + surface->swap_buffers(current_buffer); |
4105 | |
4106 | auto buffer_package = current_buffer->native_buffer_handle(); |
4107 | memcpy(package, buffer_package.get(), sizeof(MirBufferPackage)); |
4108 | |
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 | virtual void move_cursor(geometry::Point destination) = 0; |
4114 | virtual void clear_cursor() = 0; |
4115 | virtual bool has_cursor() const = 0; |
4116 | - |
4117 | + |
4118 | virtual void set_power_mode(MirPowerMode mode) = 0; |
4119 | |
4120 | protected: |
4121 | |
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 | |
4127 | #include "native_gbm_platform.h" |
4128 | |
4129 | -#include "gbm_buffer_allocator.h" |
4130 | +#include "buffer_allocator.h" |
4131 | #include "mir/graphics/buffer_ipc_packer.h" |
4132 | #include "mir/graphics/platform_ipc_package.h" |
4133 | #include "mir/graphics/nested_context.h" |
4134 | @@ -45,7 +45,7 @@ |
4135 | std::shared_ptr<mg::GraphicBufferAllocator> mgg::NativeGBMPlatform::create_buffer_allocator( |
4136 | std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) |
4137 | { |
4138 | - return std::make_shared<mgg::GBMBufferAllocator>(gbm.device, buffer_initializer); |
4139 | + return std::make_shared<mgg::BufferAllocator>(gbm.device, buffer_initializer); |
4140 | } |
4141 | |
4142 | std::shared_ptr<mg::PlatformIPCPackage> mgg::NativeGBMPlatform::get_ipc_package() |
4143 | |
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 | else |
4149 | { |
4150 | auto& output = *iter; |
4151 | - |
4152 | + |
4153 | output.modes = modes; |
4154 | output.preferred_mode_index = preferred_mode_index; |
4155 | output.physical_size_mm = physical_size; |
4156 | |
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 | void move_cursor(geometry::Point destination); |
4162 | void clear_cursor(); |
4163 | bool has_cursor() const; |
4164 | - |
4165 | + |
4166 | void set_power_mode(MirPowerMode mode); |
4167 | |
4168 | private: |
4169 | @@ -75,7 +75,7 @@ |
4170 | |
4171 | MirPowerMode power_mode; |
4172 | int dpms_enum_id; |
4173 | - |
4174 | + |
4175 | std::mutex power_mutex; |
4176 | }; |
4177 | |
4178 | |
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 | +/* |
4184 | + * Copyright © 2013 Canonical Ltd. |
4185 | + * |
4186 | + * This program is free software: you can redistribute it and/or modify it |
4187 | + * under the terms of the GNU General Public License version 3, |
4188 | + * as published by the Free Software Foundation. |
4189 | + * |
4190 | + * This program is distributed in the hope that it will be useful, |
4191 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4192 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4193 | + * GNU General Public License for more details. |
4194 | + * |
4195 | + * You should have received a copy of the GNU General Public License |
4196 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4197 | + * |
4198 | + * Authored by: |
4199 | + * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4200 | + */ |
4201 | + |
4202 | +#include "shm_file.h" |
4203 | +#include "shm_buffer.h" |
4204 | +#include "buffer_texture_binder.h" |
4205 | +#include <GLES2/gl2.h> |
4206 | +#include <GLES2/gl2ext.h> |
4207 | + |
4208 | +namespace mgg = mir::graphics::gbm; |
4209 | +namespace geom = mir::geometry; |
4210 | + |
4211 | +mgg::ShmBuffer::ShmBuffer( |
4212 | + std::shared_ptr<ShmFile> const& shm_file, |
4213 | + geom::Size const& size, |
4214 | + geom::PixelFormat const& pixel_format) |
4215 | + : shm_file{shm_file}, |
4216 | + size_{size}, |
4217 | + pixel_format_{pixel_format}, |
4218 | + stride_{geom::bytes_per_pixel(pixel_format_) * size_.width.as_uint32_t()}, |
4219 | + pixels{shm_file->base_ptr()} |
4220 | +{ |
4221 | +} |
4222 | + |
4223 | +mgg::ShmBuffer::~ShmBuffer() noexcept |
4224 | +{ |
4225 | +} |
4226 | + |
4227 | +geom::Size mgg::ShmBuffer::size() const |
4228 | +{ |
4229 | + return size_; |
4230 | +} |
4231 | + |
4232 | +geom::Stride mgg::ShmBuffer::stride() const |
4233 | +{ |
4234 | + return stride_; |
4235 | +} |
4236 | + |
4237 | +geom::PixelFormat mgg::ShmBuffer::pixel_format() const |
4238 | +{ |
4239 | + return pixel_format_; |
4240 | +} |
4241 | + |
4242 | +void mgg::ShmBuffer::bind_to_texture() |
4243 | +{ |
4244 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, |
4245 | + size_.width.as_int(), size_.height.as_int(), |
4246 | + 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, |
4247 | + pixels); |
4248 | +} |
4249 | + |
4250 | +std::shared_ptr<MirNativeBuffer> mgg::ShmBuffer::native_buffer_handle() const |
4251 | +{ |
4252 | + auto native_buffer = std::make_shared<MirNativeBuffer>(); |
4253 | + |
4254 | + native_buffer->fd_items = 1; |
4255 | + native_buffer->fd[0] = shm_file->fd(); |
4256 | + native_buffer->stride = stride().as_uint32_t(); |
4257 | + native_buffer->flags = 0; |
4258 | + |
4259 | + auto const& dim = size(); |
4260 | + native_buffer->width = dim.width.as_int(); |
4261 | + native_buffer->height = dim.height.as_int(); |
4262 | + |
4263 | + return native_buffer; |
4264 | +} |
4265 | + |
4266 | +bool mgg::ShmBuffer::can_bypass() const |
4267 | +{ |
4268 | + return false; |
4269 | +} |
4270 | |
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 | +/* |
4276 | + * Copyright © 2013 Canonical Ltd. |
4277 | + * |
4278 | + * This program is free software: you can redistribute it and/or modify it |
4279 | + * under the terms of the GNU General Public License version 3, |
4280 | + * as published by the Free Software Foundation. |
4281 | + * |
4282 | + * This program is distributed in the hope that it will be useful, |
4283 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4284 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4285 | + * GNU General Public License for more details. |
4286 | + * |
4287 | + * You should have received a copy of the GNU General Public License |
4288 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4289 | + * |
4290 | + * Authored by: |
4291 | + * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4292 | + */ |
4293 | + |
4294 | +#ifndef MIR_GRAPHICS_GBM_SHM_BUFFER_H_ |
4295 | +#define MIR_GRAPHICS_GBM_SHM_BUFFER_H_ |
4296 | + |
4297 | +#include "mir/graphics/buffer_basic.h" |
4298 | +#include "mir/geometry/dimensions.h" |
4299 | +#include "mir/geometry/size.h" |
4300 | +#include "mir/geometry/pixel_format.h" |
4301 | + |
4302 | +namespace mir |
4303 | +{ |
4304 | +namespace graphics |
4305 | +{ |
4306 | +namespace gbm |
4307 | +{ |
4308 | + |
4309 | +class ShmFile; |
4310 | + |
4311 | +class ShmBuffer : public BufferBasic |
4312 | +{ |
4313 | +public: |
4314 | + ShmBuffer(std::shared_ptr<ShmFile> const& shm_file, |
4315 | + geometry::Size const& size, |
4316 | + geometry::PixelFormat const& pixel_format); |
4317 | + ~ShmBuffer() noexcept; |
4318 | + |
4319 | + geometry::Size size() const; |
4320 | + geometry::Stride stride() const; |
4321 | + geometry::PixelFormat pixel_format() const; |
4322 | + std::shared_ptr<MirNativeBuffer> native_buffer_handle() const; |
4323 | + void bind_to_texture(); |
4324 | + bool can_bypass() const; |
4325 | + |
4326 | +private: |
4327 | + ShmBuffer(ShmBuffer const&) = delete; |
4328 | + ShmBuffer& operator=(ShmBuffer const&) = delete; |
4329 | + |
4330 | + std::shared_ptr<ShmFile> const shm_file; |
4331 | + geometry::Size const size_; |
4332 | + geometry::PixelFormat const pixel_format_; |
4333 | + geometry::Stride const stride_; |
4334 | + void* const pixels; |
4335 | +}; |
4336 | + |
4337 | +} |
4338 | +} |
4339 | +} |
4340 | + |
4341 | +#endif /* MIR_GRAPHICS_GBM_SHM_BUFFER_H_ */ |
4342 | |
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 | +/* |
4348 | + * Copyright © 2013 Canonical Ltd. |
4349 | + * |
4350 | + * This program is free software: you can redistribute it and/or modify it |
4351 | + * under the terms of the GNU General Public License version 3, |
4352 | + * as published by the Free Software Foundation. |
4353 | + * |
4354 | + * This program is distributed in the hope that it will be useful, |
4355 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4356 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4357 | + * GNU General Public License for more details. |
4358 | + * |
4359 | + * You should have received a copy of the GNU General Public License |
4360 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4361 | + * |
4362 | + * Authored by: |
4363 | + * Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4364 | + */ |
4365 | + |
4366 | +#ifndef MIR_GRAPHICS_GBM_SHM_FILE_H_ |
4367 | +#define MIR_GRAPHICS_GBM_SHM_FILE_H_ |
4368 | + |
4369 | +#include <cstddef> |
4370 | + |
4371 | +namespace mir |
4372 | +{ |
4373 | +namespace graphics |
4374 | +{ |
4375 | +namespace gbm |
4376 | +{ |
4377 | + |
4378 | +class ShmFile |
4379 | +{ |
4380 | +public: |
4381 | + virtual ~ShmFile() = default; |
4382 | + |
4383 | + virtual void* base_ptr() const = 0; |
4384 | + virtual int fd() const = 0; |
4385 | + |
4386 | +protected: |
4387 | + ShmFile() = default; |
4388 | + ShmFile(ShmFile const&) = delete; |
4389 | + ShmFile& operator=(ShmFile const&) = delete; |
4390 | +}; |
4391 | + |
4392 | +} |
4393 | +} |
4394 | +} |
4395 | + |
4396 | +#endif /* MIR_GRAPHICS_GBM_SHM_FILE_H_ */ |
4397 | |
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 | do |
4403 | { |
4404 | dev = udev_monitor_receive_device(const_cast<udev_monitor*>(monitor)); |
4405 | - if (dev != nullptr) |
4406 | + if (dev != nullptr) |
4407 | handler(action_to_event_type(udev_device_get_action(dev)), UdevDevice(dev)); |
4408 | } while (dev != nullptr); |
4409 | } |
4410 | |
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 | void match_parent(UdevDevice const& parent); |
4416 | void match_sysname(std::string const& sysname); |
4417 | |
4418 | - class iterator : |
4419 | + class iterator : |
4420 | public std::iterator<std::input_iterator_tag, UdevDevice> |
4421 | { |
4422 | public: |
4423 | |
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 | }); |
4429 | } |
4430 | |
4431 | -void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, |
4432 | +void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, |
4433 | geometry::Point top_left, size_t mode_index, MirPowerMode power_mode) |
4434 | { |
4435 | for (auto mir_output = display_config->outputs; |
4436 | |
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 | namespace |
4442 | { |
4443 | |
4444 | -EGLint const default_egl_context_attr[] = |
4445 | -{ |
4446 | - EGL_CONTEXT_CLIENT_VERSION, 2, |
4447 | - EGL_NONE |
4448 | -}; |
4449 | - |
4450 | class GLExtensions : public mgo::GLExtensionsBase |
4451 | { |
4452 | public: |
4453 | |
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 | { |
4459 | if (mInfo == NULL) |
4460 | mInfo = new droidinput::InputApplicationInfo; |
4461 | - |
4462 | + |
4463 | mInfo->dispatchingTimeout = INT_MAX; |
4464 | mInfo->name = droidinput::String8(surface->name().c_str()); |
4465 | |
4466 | |
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 | |
4472 | mia::AndroidInputChannel::AndroidInputChannel() |
4473 | { |
4474 | - |
4475 | + |
4476 | droidinput::InputChannel::openInputFdPair(s_fd, c_fd); |
4477 | } |
4478 | |
4479 | |
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 | width, |
4485 | height, |
4486 | default_display_orientation); |
4487 | - |
4488 | + |
4489 | out_config->pointerVelocityControlParameters.acceleration = 1.0; |
4490 | } |
4491 | |
4492 | |
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 | |
4498 | auto application_handle = new mia::InputApplicationHandle(surface); |
4499 | window_handle = new mia::InputWindowHandle(application_handle, channel, surface); |
4500 | - |
4501 | + |
4502 | window_handles[channel] = window_handle; |
4503 | } |
4504 | |
4505 | |
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 | explicit InputTargetEnumerator(std::shared_ptr<input::InputTargets> const& targets, |
4511 | std::shared_ptr<WindowHandleRepository> const& repository); |
4512 | virtual ~InputTargetEnumerator() noexcept(true); |
4513 | - |
4514 | + |
4515 | void for_each(std::function<void(droidinput::sp<droidinput::InputWindowHandle> const&)> const& callback); |
4516 | - |
4517 | + |
4518 | private: |
4519 | std::weak_ptr<input::InputTargets> const targets; |
4520 | std::weak_ptr<input::android::WindowHandleRepository> const repository; |
4521 | |
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 | void mia::InputTargeter::focus_cleared() |
4527 | { |
4528 | droidinput::sp<droidinput::InputWindowHandle> null_window = nullptr; |
4529 | - |
4530 | + |
4531 | input_dispatcher->setKeyboardFocus(null_window); |
4532 | } |
4533 | |
4534 | void mia::InputTargeter::focus_changed(std::shared_ptr<mi::InputChannel const> const& focus_channel) |
4535 | { |
4536 | auto window_handle = repository->handle_for_channel(focus_channel); |
4537 | - |
4538 | + |
4539 | if (window_handle == NULL) |
4540 | BOOST_THROW_EXCEPTION(std::logic_error("Attempt to set keyboard focus to an unregistered input channel")); |
4541 | - |
4542 | + |
4543 | input_dispatcher->setKeyboardFocus(window_handle); |
4544 | } |
4545 | |
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 | mInfo->frameTop = surface_position.y.as_uint32_t(); |
4551 | mInfo->frameRight = mInfo->frameLeft + surface_size.width.as_uint32_t(); |
4552 | mInfo->frameBottom = mInfo->frameTop + surface_size.height.as_uint32_t(); |
4553 | - |
4554 | + |
4555 | mInfo->touchableRegionLeft = mInfo->frameLeft; |
4556 | mInfo->touchableRegionTop = mInfo->frameTop; |
4557 | mInfo->touchableRegionRight = mInfo->frameRight; |
4558 | |
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 | { |
4564 | public: |
4565 | virtual ~WindowHandleRepository() = default; |
4566 | - |
4567 | + |
4568 | virtual droidinput::sp<droidinput::InputWindowHandle> handle_for_channel(std::shared_ptr<input::InputChannel const> const& channel) = 0; |
4569 | protected: |
4570 | WindowHandleRepository() = default; |
4571 | |
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 | { |
4577 | MirEvent mir_ev; |
4578 | mia::Lexicon::translate(input_event, mir_ev); |
4579 | - |
4580 | + |
4581 | // TODO: Use XKBMapper |
4582 | |
4583 | return !event_filter->handle(mir_ev); |
4584 | |
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 | { |
4590 | NullInputRegistrar() = default; |
4591 | virtual ~NullInputRegistrar() noexcept(true) = default; |
4592 | - |
4593 | + |
4594 | void input_channel_opened(std::shared_ptr<mi::InputChannel> const&, |
4595 | std::shared_ptr<mi::Surface> const&, |
4596 | mi::InputReceptionMode /* receives_all_input */) |
4597 | |
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 | std::shared_ptr<scene::InputRegistrar> the_input_registrar(); |
4603 | std::shared_ptr<shell::InputTargeter> the_input_targeter(); |
4604 | std::shared_ptr<InputManager> the_input_manager(); |
4605 | - |
4606 | + |
4607 | void set_input_targets(std::shared_ptr<InputTargets> const& /* targets */); |
4608 | |
4609 | protected: |
4610 | |
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 | eglGetConfigAttrib(disp, config, i.val, &value); |
4616 | logger->log<Logger::informational>( |
4617 | " [" + i.name + "] : " + std::to_string(value), component()); |
4618 | - } |
4619 | + } |
4620 | } |
4621 | |
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 | } |
4627 | |
4628 | |
4629 | -ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger) |
4630 | +ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger) |
4631 | : logger(logger) |
4632 | { |
4633 | } |
4634 | @@ -106,7 +106,7 @@ |
4635 | void ml::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value) |
4636 | { |
4637 | std::stringstream ss; |
4638 | - |
4639 | + |
4640 | ss << "Received event (when, type, code, value) from kernel: " |
4641 | << "(" << when << "ns, " << type << ", " << code << ", " << value << ")"; |
4642 | logger->log<Logger::informational>(ss.str(), component()); |
4643 | @@ -116,7 +116,7 @@ |
4644 | { |
4645 | std::stringstream ss; |
4646 | |
4647 | - ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": (" |
4648 | + ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": (" |
4649 | << seq_id << ", " << event_time << ")"; |
4650 | logger->log<Logger::informational>(ss.str(), component()); |
4651 | } |
4652 | @@ -125,7 +125,7 @@ |
4653 | { |
4654 | std::stringstream ss; |
4655 | |
4656 | - ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": (" |
4657 | + ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": (" |
4658 | << seq_id << ", " << event_time << ")"; |
4659 | logger->log<Logger::informational>(ss.str(), component()); |
4660 | } |
4661 | @@ -133,7 +133,7 @@ |
4662 | void ml::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id) |
4663 | { |
4664 | std::stringstream ss; |
4665 | - |
4666 | + |
4667 | ss << "Received event finished (seq_id) from fd " << src_fd << ": " << seq_id; |
4668 | logger->log<Logger::informational>(ss.str(), component()); |
4669 | } |
4670 | |
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 | |
4676 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
4677 | surfaces[id] = surf; |
4678 | - |
4679 | + |
4680 | session_listener->surface_created(*this, surf); |
4681 | - |
4682 | + |
4683 | return id; |
4684 | } |
4685 | |
4686 | @@ -114,7 +114,7 @@ |
4687 | { |
4688 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
4689 | auto p = checked_find(id); |
4690 | - |
4691 | + |
4692 | session_listener->destroying_surface(*this, p->second); |
4693 | |
4694 | surfaces.erase(p); |
4695 | |
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 | virtual geometry::PixelFormat pixel_format() const = 0; |
4701 | |
4702 | virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const = 0; |
4703 | - virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0; |
4704 | + virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0; |
4705 | virtual void force_requests_to_complete() = 0; |
4706 | |
4707 | virtual bool supports_input() const = 0; |
4708 | |
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 | std::shared_ptr<msh::Session> ms::DefaultSessionContainer::successor_of(std::shared_ptr<msh::Session> const& session) const |
4714 | { |
4715 | std::shared_ptr<msh::Session> result, first; |
4716 | - |
4717 | + |
4718 | if (!session && apps.size()) |
4719 | return apps.back(); |
4720 | else if(!session) |
4721 | return std::shared_ptr<msh::Session>(); |
4722 | - |
4723 | + |
4724 | for (auto it = apps.begin(); it != apps.end(); it++) |
4725 | { |
4726 | if (*it == session) |
4727 | @@ -79,6 +79,6 @@ |
4728 | else return *successor; |
4729 | } |
4730 | } |
4731 | - |
4732 | + |
4733 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid session")); |
4734 | } |
4735 | |
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 | } |
4741 | |
4742 | void ms::GlobalEventSender::handle_event(MirEvent const&) |
4743 | -{ |
4744 | +{ |
4745 | //TODO, no driving test cases, although messages like 'server shutdown' could go here |
4746 | } |
4747 | |
4748 | |
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 | conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void |
4754 | { |
4755 | if (!output.used) return; |
4756 | - |
4757 | + |
4758 | if (output.power_mode != mir_power_mode_on) |
4759 | { |
4760 | switched = true; |
4761 | conf->configure_output(output.id, output.used, |
4762 | - output.top_left, |
4763 | + output.top_left, |
4764 | output.current_mode_index, |
4765 | mir_power_mode_on); |
4766 | } |
4767 | |
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 | std::vector<geometry::Rectangle> const& input_rectangles) = 0; |
4773 | |
4774 | protected: |
4775 | - MutableSurfaceState() = default; |
4776 | + MutableSurfaceState() = default; |
4777 | virtual ~MutableSurfaceState() noexcept = default; |
4778 | MutableSurfaceState(const MutableSurfaceState&) = delete; |
4779 | MutableSurfaceState& operator=(const MutableSurfaceState& ) = delete; |
4780 | |
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 | surface_factory, name, snapshot_strategy, session_listener, sender); |
4786 | |
4787 | app_container->insert_session(new_session); |
4788 | - |
4789 | + |
4790 | session_listener->starting(new_session); |
4791 | |
4792 | set_focus_to(new_session); |
4793 | |
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 | surface_state(state), |
4799 | surface_buffer_stream(buffer_stream), |
4800 | server_input_channel(input_channel), |
4801 | - report(report), |
4802 | - surface_in_startup(true) |
4803 | + report(report) |
4804 | { |
4805 | report->surface_created(this); |
4806 | } |
4807 | @@ -110,20 +109,16 @@ |
4808 | return surface_buffer_stream->get_stream_pixel_format(); |
4809 | } |
4810 | |
4811 | -std::shared_ptr<mg::Buffer> ms::Surface::advance_client_buffer() |
4812 | +void ms::Surface::swap_buffers(std::shared_ptr<graphics::Buffer>& buffer) |
4813 | { |
4814 | - if (surface_in_startup) |
4815 | - { |
4816 | - surface_in_startup = false; |
4817 | - } |
4818 | - else |
4819 | - { |
4820 | - // TODO There is something crazy about assuming that giving out any buffer |
4821 | - // TODO after the first implies that previous buffers have been rendered. |
4822 | - flag_for_render(); |
4823 | - } |
4824 | - |
4825 | - return surface_buffer_stream->secure_client_buffer(); |
4826 | + bool const posting{!!buffer}; |
4827 | + |
4828 | + surface_buffer_stream->swap_client_buffers(buffer); |
4829 | + |
4830 | + if (posting) |
4831 | + { |
4832 | + surface_state->frame_posted(); |
4833 | + } |
4834 | } |
4835 | |
4836 | void ms::Surface::allow_framedropping(bool allow) |
4837 | @@ -136,12 +131,6 @@ |
4838 | return surface_buffer_stream->lock_snapshot_buffer(); |
4839 | } |
4840 | |
4841 | -//TODO: this is just used in example code, could be private |
4842 | -void ms::Surface::flag_for_render() |
4843 | -{ |
4844 | - surface_state->frame_posted(); |
4845 | -} |
4846 | - |
4847 | bool ms::Surface::supports_input() const |
4848 | { |
4849 | if (server_input_channel) |
4850 | |
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 | geometry::PixelFormat pixel_format() const; |
4856 | |
4857 | std::shared_ptr<graphics::Buffer> snapshot_buffer() const; |
4858 | - std::shared_ptr<graphics::Buffer> advance_client_buffer(); |
4859 | + void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer); |
4860 | void force_requests_to_complete(); |
4861 | - void flag_for_render(); |
4862 | |
4863 | bool supports_input() const; |
4864 | int client_input_fd() const; |
4865 | @@ -74,7 +73,6 @@ |
4866 | std::shared_ptr<compositor::BufferStream> surface_buffer_stream; |
4867 | std::shared_ptr<input::InputChannel> const server_input_channel; |
4868 | std::shared_ptr<SceneReport> const report; |
4869 | - bool surface_in_startup; |
4870 | }; |
4871 | } |
4872 | } |
4873 | |
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 | std::unique_lock<std::mutex> lk(guard); |
4879 | |
4880 | auto surface_size = surface_rect.size; |
4881 | - auto surface_top_left = surface_rect.top_left; |
4882 | + auto surface_top_left = surface_rect.top_left; |
4883 | if (transformation_dirty || transformation_size != surface_size) |
4884 | { |
4885 | const glm::vec3 top_left_vec{surface_top_left.x.as_int(), |
4886 | @@ -183,7 +183,7 @@ |
4887 | if (rectangle.contains(point)) |
4888 | { |
4889 | return true; |
4890 | - } |
4891 | + } |
4892 | } |
4893 | return false; |
4894 | } |
4895 | |
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 | return surface->pixel_format(); |
4901 | } |
4902 | |
4903 | -std::shared_ptr<mg::Buffer> ms::SurfaceImpl::advance_client_buffer() |
4904 | +void ms::SurfaceImpl::swap_buffers(std::shared_ptr<graphics::Buffer>& buffer) |
4905 | { |
4906 | - return surface->advance_client_buffer(); |
4907 | + surface->swap_buffers(buffer); |
4908 | } |
4909 | |
4910 | void ms::SurfaceImpl::allow_framedropping(bool allow) |
4911 | { |
4912 | surface->allow_framedropping(allow); |
4913 | } |
4914 | - |
4915 | + |
4916 | void ms::SurfaceImpl::with_most_recent_buffer_do( |
4917 | std::function<void(mg::Buffer&)> const& exec) |
4918 | { |
4919 | @@ -247,6 +247,15 @@ |
4920 | void ms::SurfaceImpl::resize(geom::Size const& size) |
4921 | { |
4922 | surface->resize(size); |
4923 | + |
4924 | + MirEvent e; |
4925 | + memset(&e, 0, sizeof e); |
4926 | + e.type = mir_event_type_resize; |
4927 | + e.resize.surface_id = id.as_value(); |
4928 | + e.resize.width = size.width.as_int(); |
4929 | + e.resize.height = size.height.as_int(); |
4930 | + |
4931 | + event_sink->handle_event(e); |
4932 | } |
4933 | |
4934 | void ms::SurfaceImpl::set_rotation(float degrees, glm::vec3 const& axis) |
4935 | |
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 | |
4941 | virtual void with_most_recent_buffer_do( |
4942 | std::function<void(graphics::Buffer&)> const& exec); |
4943 | - virtual std::shared_ptr<graphics::Buffer> advance_client_buffer(); |
4944 | + virtual void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer); |
4945 | |
4946 | virtual bool supports_input() const; |
4947 | virtual int client_input_fd() const; |
4948 | |
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 | virtual void reverse_for_each_if(compositor::FilterForScene& filter, |
4954 | compositor::OperatorForScene& op); |
4955 | virtual void set_change_callback(std::function<void()> const& f); |
4956 | - |
4957 | + |
4958 | // From InputTargets |
4959 | void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback); |
4960 | |
4961 | - // From SurfaceStackModel |
4962 | + // From SurfaceStackModel |
4963 | virtual std::weak_ptr<BasicSurface> create_surface(const shell::SurfaceCreationParameters& params); |
4964 | |
4965 | virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface); |
4966 | - |
4967 | + |
4968 | virtual void raise(std::weak_ptr<BasicSurface> const& surface); |
4969 | |
4970 | virtual void lock(); |
4971 | |
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 | { |
4977 | |
4978 | class SurfaceState : public compositor::CompositingCriteria, public input::Surface, |
4979 | - public MutableSurfaceState |
4980 | + public MutableSurfaceState |
4981 | { |
4982 | protected: |
4983 | - SurfaceState() = default; |
4984 | + SurfaceState() = default; |
4985 | virtual ~SurfaceState() = default; |
4986 | SurfaceState(const SurfaceState&) = delete; |
4987 | SurfaceState& operator=(const SurfaceState& ) = delete; |
4988 | |
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 | input_targeter->focus_cleared(); |
4994 | return; |
4995 | } |
4996 | - |
4997 | + |
4998 | auto surface = focus_session->default_surface(); |
4999 | if (surface) |
5000 | { |
The diff has been truncated for viewing.