Mir

Merge lp:~afrantzis/mir/build-options-for-tests into lp:mir/0.1

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
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
=== modified file 'cmake/MirCommon.cmake'
--- cmake/MirCommon.cmake 2013-08-28 03:41:48 +0000
+++ cmake/MirCommon.cmake 2013-11-28 12:22:03 +0000
@@ -1,11 +1,14 @@
1cmake_minimum_required (VERSION 2.6)1cmake_minimum_required (VERSION 2.6)
2# Create target to discover tests2# Create target to discover tests
33
4option(4include(CMakeDependentOption)
5
6CMAKE_DEPENDENT_OPTION(
5 DISABLE_GTEST_TEST_DISCOVERY7 DISABLE_GTEST_TEST_DISCOVERY
6 "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior"8 "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior"
7 OFF9 OFF
8)10 "NOT MIR_IS_CROSS_COMPILING"
11 ON)
912
10option(13option(
11 ENABLE_MEMCHECK_OPTION14 ENABLE_MEMCHECK_OPTION
@@ -19,15 +22,22 @@
19 valgrind)22 valgrind)
2023
21 if(VALGRIND_EXECUTABLE)24 if(VALGRIND_EXECUTABLE)
22 set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes")25 if(MIR_PLATFORM STREQUAL "android")
26 # don't exit with an error when valgrind find errors
27 #set(VALGRIND_ARGS "--error-exitcode=1")
28 else()
29 set(VALGRIND_ARGS "--error-exitcode=1 --trace-children=yes")
30 endif()
31
23 set(ENABLE_MEMCHECK_FLAG "--enable-memcheck")32 set(ENABLE_MEMCHECK_FLAG "--enable-memcheck")
33
24 else(VALGRIND_EXECUTABLE)34 else(VALGRIND_EXECUTABLE)
25 message("Not enabling memcheck as valgrind is missing on your system")35 message("Not enabling memcheck as valgrind is missing on your system")
26 endif(VALGRIND_EXECUTABLE)36 endif(VALGRIND_EXECUTABLE)
27endif(ENABLE_MEMCHECK_OPTION)37endif(ENABLE_MEMCHECK_OPTION)
2838
29function (mir_discover_tests EXECUTABLE)39function (mir_discover_tests EXECUTABLE)
30 if(BUILD_ANDROID OR DISABLE_GTEST_TEST_DISCOVERY)40 if(DISABLE_GTEST_TEST_DISCOVERY)
31 add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}")41 add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}")
3242
33 if (${ARGC} GREATER 1)43 if (${ARGC} GREATER 1)
@@ -74,7 +84,7 @@
7484
75function (mir_add_memcheck_test)85function (mir_add_memcheck_test)
76 if (ENABLE_MEMCHECK_OPTION)86 if (ENABLE_MEMCHECK_OPTION)
77 if(BUILD_ANDROID OR DISABLE_GTEST_TEST_DISCOVERY)87 if(DISABLE_GTEST_TEST_DISCOVERY)
78 ADD_TEST("memcheck-test" "sh" "-c" "${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error; if [ $? != 0 ]; then exit 0; else exit 1; fi")88 ADD_TEST("memcheck-test" "sh" "-c" "${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error; if [ $? != 0 ]; then exit 0; else exit 1; fi")
79 else()89 else()
80 add_custom_target(90 add_custom_target(
8191
=== modified file 'debian/mir-test-tools.install'
--- debian/mir-test-tools.install 2013-08-28 03:41:48 +0000
+++ debian/mir-test-tools.install 2013-11-28 12:22:03 +0000
@@ -1,3 +1,6 @@
1usr/bin/mir_stress1usr/bin/mir_stress
2usr/bin/mir_unit_tests
3usr/bin/mir_acceptance_tests
4usr/bin/mir_integration_tests
2usr/lib/*/mir/tools/libmirclientlttng.so5usr/lib/*/mir/tools/libmirclientlttng.so
3usr/lib/*/mir/tools/libmirserverlttng.so6usr/lib/*/mir/tools/libmirserverlttng.so
47
=== modified file 'debian/rules'
--- debian/rules 2013-11-21 03:16:21 +0000
+++ debian/rules 2013-11-28 12:22:03 +0000
@@ -21,10 +21,7 @@
21ifeq ($(DEB_HOST_ARCH),armhf)21ifeq ($(DEB_HOST_ARCH),armhf)
22 dh_auto_configure -- \22 dh_auto_configure -- \
23 $(COMMON_CONFIGURE_OPTIONS) \23 $(COMMON_CONFIGURE_OPTIONS) \
24 -DMIR_PLATFORM=android \24 -DMIR_PLATFORM=android
25 -DMIR_ENABLE_UNIT_TESTS=NO \
26 -DMIR_ENABLE_ACCEPTANCE_TESTS=NO \
27 -DMIR_ENABLE_INTEGRATION_TESTS=NO
28else25else
29ifeq ($(DEB_HOST_ARCH),powerpc)26ifeq ($(DEB_HOST_ARCH),powerpc)
30 dh_auto_configure -- \27 dh_auto_configure -- \
3128
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2013-11-21 03:16:21 +0000
+++ examples/eglapp.c 2013-11-28 12:22:03 +0000
@@ -93,8 +93,12 @@
93 lastcount = count;93 lastcount = count;
94 }94 }
9595
96 /* This is one way to handle window resizing. But in future it would be96 /*
97 better to have resize events coming from the server */97 * Querying the surface (actually the current buffer) dimensions here is
98 * the only truly safe way to be sure that the dimensions we think we
99 * have are those of the buffer being rendered to. But this should be
100 * improved in future; https://bugs.launchpad.net/mir/+bug/1194384
101 */
98 if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width) &&102 if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width) &&
99 eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height))103 eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height))
100 {104 {
@@ -102,7 +106,7 @@
102 }106 }
103}107}
104108
105static void mir_eglapp_handle_input(MirSurface* surface, MirEvent const* ev, void* context)109static void mir_eglapp_handle_event(MirSurface* surface, MirEvent const* ev, void* context)
106{110{
107 (void) surface;111 (void) surface;
108 (void) context;112 (void) context;
@@ -112,6 +116,17 @@
112 {116 {
113 running = 0;117 running = 0;
114 }118 }
119 else if (ev->type == mir_event_type_resize)
120 {
121 /*
122 * FIXME: https://bugs.launchpad.net/mir/+bug/1194384
123 * It is unsafe to set the width and height here because we're in a
124 * different thread to that doing the rendering. So we either need
125 * support for event queuing (directing them to another thread) or
126 * full single-threaded callbacks. (LP: #1194384).
127 */
128 printf("Resized to %dx%d\n", ev->resize.width, ev->resize.height);
129 }
115}130}
116131
117static unsigned int get_bpp(MirPixelFormat pf)132static unsigned int get_bpp(MirPixelFormat pf)
@@ -172,7 +187,7 @@
172 };187 };
173 MirEventDelegate delegate = 188 MirEventDelegate delegate =
174 {189 {
175 mir_eglapp_handle_input,190 mir_eglapp_handle_event,
176 NULL191 NULL
177 };192 };
178 EGLConfig eglconfig;193 EGLConfig eglconfig;
179194
=== modified file 'examples/fingerpaint.c'
--- examples/fingerpaint.c 2013-09-19 13:24:22 +0000
+++ examples/fingerpaint.c 2013-11-28 12:22:03 +0000
@@ -247,6 +247,18 @@
247 redraw(surface, canvas);247 redraw(surface, canvas);
248 }248 }
249 }249 }
250 else if (event->type == mir_event_type_resize)
251 {
252 /* FIXME: https://bugs.launchpad.net/mir/+bug/1194384
253 * mir_event_type_resize will arrive in a different thread to that of
254 * mir_event_type_motion, so we cannot safely redraw from this thread.
255 * Either the callbacks will need to become thread-safe, or we'd have
256 * to employ some non-trivial event queuing and inter-thread signals,
257 * which I think is beyond the scope of this example code.
258 *
259 * redraw(surface, canvas);
260 */
261 }
250}262}
251263
252static const MirDisplayOutput *find_active_output(264static const MirDisplayOutput *find_active_output(
253265
=== modified file 'examples/render_surfaces.cpp'
--- examples/render_surfaces.cpp 2013-11-21 12:34:49 +0000
+++ examples/render_surfaces.cpp 2013-11-28 12:22:03 +0000
@@ -414,12 +414,15 @@
414 mf::SurfaceId(), {});414 mf::SurfaceId(), {});
415415
416 /*416 /*
417 * We call advance_client_buffer() twice so that the surface is417 * We call swap_buffers() twice so that the surface is
418 * considers the first buffer to be posted.418 * considers the first buffer to be posted.
419 * (TODO There must be a better way!)419 * (TODO There must be a better way!)
420 */420 */
421 s->advance_client_buffer();421 {
422 s->advance_client_buffer();422 std::shared_ptr<mg::Buffer> tmp;
423 s->swap_buffers(tmp);
424 s->swap_buffers(tmp);
425 }
423426
424 /*427 /*
425 * Place each surface at a different starting location and give it a428 * Place each surface at a different starting location and give it a
426429
=== modified file 'include/client/mir_toolkit/mir_client_library.h'
--- include/client/mir_toolkit/mir_client_library.h 2013-11-21 12:34:49 +0000
+++ include/client/mir_toolkit/mir_client_library.h 2013-11-28 12:22:03 +0000
@@ -66,10 +66,10 @@
66/**66/**
67 * Test for a valid connection67 * Test for a valid connection
68 * \param [in] connection The connection68 * \param [in] connection The connection
69 * \return A non-zero value if the supplied connection is69 * \return True if the supplied connection is valid, or
70 * valid, 0 otherwise70 * false otherwise.
71 */71 */
72int mir_connection_is_valid(MirConnection *connection);72MirBool mir_connection_is_valid(MirConnection *connection);
7373
74/**74/**
75 * Retrieve a text description of the last error. The returned string is owned75 * Retrieve a text description of the last error. The returned string is owned
@@ -104,7 +104,7 @@
104void mir_connection_set_lifecycle_event_callback(MirConnection* connection,104void mir_connection_set_lifecycle_event_callback(MirConnection* connection,
105 mir_lifecycle_event_callback callback, void* context);105 mir_lifecycle_event_callback callback, void* context);
106106
107/** 107/**
108 * \deprecated Use mir_connection_create_display_config108 * \deprecated Use mir_connection_create_display_config
109 */109 */
110__attribute__((__deprecated__("Use mir_connection_create_display_config()")))110__attribute__((__deprecated__("Use mir_connection_create_display_config()")))
@@ -112,8 +112,8 @@
112112
113/**113/**
114 * Query the display114 * Query the display
115 * \warning return value must be destroyed via mir_display_config_destroy() 115 * \warning return value must be destroyed via mir_display_config_destroy()
116 * \warning may return null if connection is invalid 116 * \warning may return null if connection is invalid
117 * \param [in] connection The connection117 * \param [in] connection The connection
118 * \return structure that describes the display configuration118 * \return structure that describes the display configuration
119 */119 */
@@ -135,7 +135,7 @@
135135
136/**136/**
137 * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config137 * Destroy the DisplayConfiguration resource acquired from mir_connection_create_display_config
138 * \param [in] display_configuration The display_configuration information resource to be destroyed 138 * \param [in] display_configuration The display_configuration information resource to be destroyed
139 */139 */
140void mir_display_config_destroy(MirDisplayConfiguration* display_configuration);140void mir_display_config_destroy(MirDisplayConfiguration* display_configuration);
141141
@@ -149,7 +149,7 @@
149 *149 *
150 * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message.150 * \warning This request may be denied. Check that the request succeeded with mir_connection_get_error_message.
151 * \param [in] connection The connection151 * \param [in] connection The connection
152 * \param [in] display_configuration The display_configuration to apply 152 * \param [in] display_configuration The display_configuration to apply
153 * \return A handle that can be passed to mir_wait_for153 * \return A handle that can be passed to mir_wait_for
154 */154 */
155MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration);155MirWaitHandle* mir_connection_apply_display_config(MirConnection *connection, MirDisplayConfiguration* display_configuration);
@@ -164,10 +164,10 @@
164/**164/**
165 * Get the list of possible formats that a surface can be created with.165 * Get the list of possible formats that a surface can be created with.
166 * \param [in] connection The connection166 * \param [in] connection The connection
167 * \param [out] formats List of valid formats to create surfaces with 167 * \param [out] formats List of valid formats to create surfaces with
168 * \param [in] formats_size size of formats list168 * \param [in] formats_size size of formats list
169 * \param [out] num_valid_formats number of valid formats returned in formats169 * \param [out] num_valid_formats number of valid formats returned in formats
170 */ 170 */
171void mir_connection_get_available_surface_formats(171void mir_connection_get_available_surface_formats(
172 MirConnection* connection, MirPixelFormat* formats,172 MirConnection* connection, MirPixelFormat* formats,
173 unsigned const int format_size, unsigned int *num_valid_formats);173 unsigned const int format_size, unsigned int *num_valid_formats);
@@ -227,10 +227,10 @@
227/**227/**
228 * Test for a valid surface228 * Test for a valid surface
229 * \param [in] surface The surface229 * \param [in] surface The surface
230 * \return A non-zero value if the supplied surface is valid,230 * \return True if the supplied surface is valid, or
231 * 0 otherwise231 * false otherwise.
232 */232 */
233int mir_surface_is_valid(MirSurface *surface);233MirBool mir_surface_is_valid(MirSurface *surface);
234234
235/**235/**
236 * Retrieve a text description of the error. The returned string is owned by236 * Retrieve a text description of the error. The returned string is owned by
@@ -253,7 +253,7 @@
253253
254/**254/**
255 * Get the underlying platform type so the buffer obtained in "raw" representation255 * Get the underlying platform type so the buffer obtained in "raw" representation
256 * in mir_surface_get_current_buffer() can be understood 256 * in mir_surface_get_current_buffer() can be understood
257 * \pre The surface is valid257 * \pre The surface is valid
258 * \param [in] surface The surface258 * \param [in] surface The surface
259 * \return One of mir_platform_type_android or mir_platform_type_gbm259 * \return One of mir_platform_type_android or mir_platform_type_gbm
@@ -386,12 +386,12 @@
386/**386/**
387 * Set the swapinterval for mir_surface_swap_buffers. EGL users should use387 * Set the swapinterval for mir_surface_swap_buffers. EGL users should use
388 * eglSwapInterval directly.388 * eglSwapInterval directly.
389 * At the time being, only swapinterval of 0 or 1 is supported. 389 * At the time being, only swapinterval of 0 or 1 is supported.
390 * \param [in] surface The surface to operate on390 * \param [in] surface The surface to operate on
391 * \param [in] interval The number of vblank signals that391 * \param [in] interval The number of vblank signals that
392 * mir_surface_swap_buffers will wait for 392 * mir_surface_swap_buffers will wait for
393 * \return A wait handle that can be passed to mir_wait_for,393 * \return A wait handle that can be passed to mir_wait_for,
394 * or NULL if the interval could not be supported 394 * or NULL if the interval could not be supported
395 */395 */
396MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval);396MirWaitHandle* mir_surface_set_swapinterval(MirSurface* surface, int interval);
397397
398398
=== modified file 'include/client/mir_toolkit/mir_client_library_debug.h'
--- include/client/mir_toolkit/mir_client_library_debug.h 2013-09-11 20:57:29 +0000
+++ include/client/mir_toolkit/mir_client_library_debug.h 2013-11-28 12:22:03 +0000
@@ -38,6 +38,6 @@
38 * This is the buffer that is currently being drawn to,38 * This is the buffer that is currently being drawn to,
39 * and would be returned by mir_surface_get_current_buffer.39 * and would be returned by mir_surface_get_current_buffer.
40 */40 */
41uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface); 41uint32_t mir_debug_surface_current_buffer_id(MirSurface *surface);
4242
43#endif /* MIR_CLIENT_LIBRARY_DEBUG_H */43#endif /* MIR_CLIENT_LIBRARY_DEBUG_H */
4444
=== modified file 'include/platform/mir/graphics/internal_surface.h'
--- include/platform/mir/graphics/internal_surface.h 2013-08-28 03:41:48 +0000
+++ include/platform/mir/graphics/internal_surface.h 2013-11-28 12:22:03 +0000
@@ -35,7 +35,7 @@
35public:35public:
36 virtual ~InternalSurface() = default;36 virtual ~InternalSurface() = default;
3737
38 virtual std::shared_ptr<Buffer> advance_client_buffer() = 0;38 virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0;
39 virtual geometry::Size size() const = 0;39 virtual geometry::Size size() const = 0;
40 virtual MirPixelFormat pixel_format() const = 0;40 virtual MirPixelFormat pixel_format() const = 0;
4141
4242
=== modified file 'include/server/mir/compositor/buffer_stream.h'
--- include/server/mir/compositor/buffer_stream.h 2013-11-21 03:16:21 +0000
+++ include/server/mir/compositor/buffer_stream.h 2013-11-28 12:22:03 +0000
@@ -41,7 +41,8 @@
41public:41public:
42 virtual ~BufferStream() = default;42 virtual ~BufferStream() = default;
4343
44 virtual std::shared_ptr<graphics::Buffer> secure_client_buffer() = 0;44 virtual void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) = 0;
45 virtual void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) = 0;
45 virtual std::shared_ptr<graphics::Buffer>46 virtual std::shared_ptr<graphics::Buffer>
46 lock_compositor_buffer(unsigned long frameno) = 0;47 lock_compositor_buffer(unsigned long frameno) = 0;
47 virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0;48 virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0;
4849
=== modified file 'include/server/mir/compositor/compositing_criteria.h'
--- include/server/mir/compositor/compositing_criteria.h 2013-10-07 07:56:05 +0000
+++ include/server/mir/compositor/compositing_criteria.h 2013-11-28 12:22:03 +0000
@@ -30,7 +30,7 @@
30namespace compositor30namespace compositor
31{31{
3232
33class CompositingCriteria 33class CompositingCriteria
34{34{
35public:35public:
36 virtual float alpha() const = 0;36 virtual float alpha() const = 0;
3737
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2013-11-21 12:34:49 +0000
+++ include/server/mir/default_server_configuration.h 2013-11-28 12:22:03 +0000
@@ -35,7 +35,6 @@
35class Drawer;35class Drawer;
36class DisplayBufferCompositorFactory;36class DisplayBufferCompositorFactory;
37class Compositor;37class Compositor;
38class OverlayRenderer;
39class RendererFactory;38class RendererFactory;
40}39}
41namespace frontend40namespace frontend
@@ -152,7 +151,6 @@
152 * configurable interfaces for modifying compositor151 * configurable interfaces for modifying compositor
153 * @{ */152 * @{ */
154 virtual std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory();153 virtual std::shared_ptr<compositor::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory();
155 virtual std::shared_ptr<compositor::OverlayRenderer> the_overlay_renderer();
156 /** @} */154 /** @} */
157155
158 /** @name compositor configuration - dependencies156 /** @name compositor configuration - dependencies
@@ -279,7 +277,6 @@
279 CachedPtr<shell::DisplayLayout> shell_display_layout;277 CachedPtr<shell::DisplayLayout> shell_display_layout;
280 CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator;278 CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator;
281 CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;279 CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;
282 CachedPtr<compositor::OverlayRenderer> overlay_renderer;
283 CachedPtr<compositor::Compositor> compositor;280 CachedPtr<compositor::Compositor> compositor;
284 CachedPtr<logging::Logger> logger;281 CachedPtr<logging::Logger> logger;
285 CachedPtr<graphics::DisplayReport> display_report;282 CachedPtr<graphics::DisplayReport> display_report;
286283
=== modified file 'include/server/mir/frontend/message_processor_report.h'
--- include/server/mir/frontend/message_processor_report.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/frontend/message_processor_report.h 2013-11-28 12:22:03 +0000
@@ -44,7 +44,7 @@
44 virtual void exception_handled(void const* mediator, int id, std::exception const& error) = 0;44 virtual void exception_handled(void const* mediator, int id, std::exception const& error) = 0;
4545
46 virtual void exception_handled(void const* mediator, std::exception const& error) = 0;46 virtual void exception_handled(void const* mediator, std::exception const& error) = 0;
47 47
48 virtual void sent_event(void const* mediator, MirSurfaceEvent const& ev) = 0;48 virtual void sent_event(void const* mediator, MirSurfaceEvent const& ev) = 0;
4949
50private:50private:
5151
=== modified file 'include/server/mir/frontend/null_message_processor_report.h'
--- include/server/mir/frontend/null_message_processor_report.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/frontend/null_message_processor_report.h 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36 void exception_handled(void const*, int, std::exception const&);36 void exception_handled(void const*, int, std::exception const&);
3737
38 void exception_handled(void const*, std::exception const&);38 void exception_handled(void const*, std::exception const&);
39 39
40 void sent_event(void const*, MirSurfaceEvent const& e);40 void sent_event(void const*, MirSurfaceEvent const& e);
41};41};
42}42}
4343
=== modified file 'include/server/mir/frontend/session_authorizer.h'
--- include/server/mir/frontend/session_authorizer.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/frontend/session_authorizer.h 2013-11-28 12:22:03 +0000
@@ -30,7 +30,7 @@
30{30{
31public:31public:
32 virtual ~SessionAuthorizer() {}32 virtual ~SessionAuthorizer() {}
33 33
34 virtual bool connection_is_allowed(pid_t pid) = 0;34 virtual bool connection_is_allowed(pid_t pid) = 0;
35 virtual bool configure_display_is_allowed(pid_t pid) = 0;35 virtual bool configure_display_is_allowed(pid_t pid) = 0;
36protected:36protected:
3737
=== modified file 'include/server/mir/frontend/surface.h'
--- include/server/mir/frontend/surface.h 2013-11-21 03:16:21 +0000
+++ include/server/mir/frontend/surface.h 2013-11-28 12:22:03 +0000
@@ -57,7 +57,7 @@
57 virtual geometry::Size size() const = 0;57 virtual geometry::Size size() const = 0;
58 virtual geometry::PixelFormat pixel_format() const = 0;58 virtual geometry::PixelFormat pixel_format() const = 0;
5959
60 virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0;60 virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0;
6161
62 virtual bool supports_input() const = 0;62 virtual bool supports_input() const = 0;
63 virtual int client_input_fd() const = 0;63 virtual int client_input_fd() const = 0;
6464
=== modified file 'include/server/mir/input/input_configuration.h'
--- include/server/mir/input/input_configuration.h 2013-11-20 15:56:58 +0000
+++ include/server/mir/input/input_configuration.h 2013-11-28 12:22:03 +0000
@@ -44,7 +44,7 @@
44 virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar() = 0;44 virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar() = 0;
45 virtual std::shared_ptr<shell::InputTargeter> the_input_targeter() = 0;45 virtual std::shared_ptr<shell::InputTargeter> the_input_targeter() = 0;
46 virtual std::shared_ptr<input::InputManager> the_input_manager() = 0;46 virtual std::shared_ptr<input::InputManager> the_input_manager() = 0;
47 47
48 virtual void set_input_targets(std::shared_ptr<input::InputTargets> const& targets) = 0;48 virtual void set_input_targets(std::shared_ptr<input::InputTargets> const& targets) = 0;
4949
50protected:50protected:
5151
=== modified file 'include/server/mir/input/input_report.h'
--- include/server/mir/input/input_report.h 2013-05-29 14:11:56 +0000
+++ include/server/mir/input/input_report.h 2013-11-28 12:22:03 +0000
@@ -31,7 +31,7 @@
31{31{
32public:32public:
33 virtual ~InputReport() = default;33 virtual ~InputReport() = default;
34 34
35 virtual void received_event_from_kernel(int64_t when, int type, int code, int value) = 0;35 virtual void received_event_from_kernel(int64_t when, int type, int code, int value) = 0;
3636
37 virtual void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0;37 virtual void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0;
@@ -39,7 +39,7 @@
39 virtual void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0;39 virtual void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time) = 0;
4040
41 virtual void received_event_finished_signal(int src_fd, uint32_t seq_id) = 0;41 virtual void received_event_finished_signal(int src_fd, uint32_t seq_id) = 0;
42 42
43protected:43protected:
44 InputReport() = default;44 InputReport() = default;
45 InputReport(InputReport const&) = delete;45 InputReport(InputReport const&) = delete;
4646
=== modified file 'include/server/mir/input/null_input_report.h'
--- include/server/mir/input/null_input_report.h 2013-05-29 14:11:56 +0000
+++ include/server/mir/input/null_input_report.h 2013-11-28 12:22:03 +0000
@@ -32,7 +32,7 @@
32public:32public:
33 NullInputReport() = default;33 NullInputReport() = default;
34 virtual ~NullInputReport() noexcept(true) = default;34 virtual ~NullInputReport() noexcept(true) = default;
35 35
36 void received_event_from_kernel(int64_t when, int type, int code, int value);36 void received_event_from_kernel(int64_t when, int type, int code, int value);
3737
38 void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time);38 void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time);
3939
=== modified file 'include/server/mir/input/surface.h'
--- include/server/mir/input/surface.h 2013-07-16 15:49:19 +0000
+++ include/server/mir/input/surface.h 2013-11-28 12:22:03 +0000
@@ -27,7 +27,7 @@
27{27{
28namespace input28namespace input
29{29{
30class Surface 30class Surface
31{31{
32public:32public:
33 virtual std::string const& name() const = 0;33 virtual std::string const& name() const = 0;
@@ -36,7 +36,7 @@
36 virtual bool contains(geometry::Point const& point) const = 0;36 virtual bool contains(geometry::Point const& point) const = 0;
3737
38protected:38protected:
39 Surface() = default; 39 Surface() = default;
40 virtual ~Surface() = default;40 virtual ~Surface() = default;
41 Surface(const Surface&) = delete;41 Surface(const Surface&) = delete;
42 Surface& operator=(const Surface& ) = delete;42 Surface& operator=(const Surface& ) = delete;
4343
=== modified file 'include/server/mir/logging/input_report.h'
--- include/server/mir/logging/input_report.h 2013-05-29 14:11:56 +0000
+++ include/server/mir/logging/input_report.h 2013-11-28 12:22:03 +0000
@@ -39,14 +39,14 @@
39public:39public:
40 InputReport(std::shared_ptr<Logger> const& logger);40 InputReport(std::shared_ptr<Logger> const& logger);
41 virtual ~InputReport() noexcept(true) = default;41 virtual ~InputReport() noexcept(true) = default;
42 42
43 void received_event_from_kernel(int64_t when, int type, int code, int value);43 void received_event_from_kernel(int64_t when, int type, int code, int value);
4444
45 void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time);45 void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time);
46 void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time);46 void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time);
4747
48 void received_event_finished_signal(int src_fd, uint32_t seq_id);48 void received_event_finished_signal(int src_fd, uint32_t seq_id);
49 49
50private:50private:
51 char const* component();51 char const* component();
52 std::shared_ptr<Logger> const logger;52 std::shared_ptr<Logger> const logger;
5353
=== modified file 'include/server/mir/lttng/input_report.h'
--- include/server/mir/lttng/input_report.h 2013-06-03 12:15:44 +0000
+++ include/server/mir/lttng/input_report.h 2013-11-28 12:22:03 +0000
@@ -32,14 +32,14 @@
32public:32public:
33 InputReport() = default;33 InputReport() = default;
34 virtual ~InputReport() noexcept(true) = default;34 virtual ~InputReport() noexcept(true) = default;
35 35
36 void received_event_from_kernel(int64_t when, int type, int code, int value);36 void received_event_from_kernel(int64_t when, int type, int code, int value);
3737
38 void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time);38 void published_key_event(int dest_fd, uint32_t seq_id, int64_t event_time);
39 void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time);39 void published_motion_event(int dest_fd, uint32_t seq_id, int64_t event_time);
4040
41 void received_event_finished_signal(int src_fd, uint32_t seq_id);41 void received_event_finished_signal(int src_fd, uint32_t seq_id);
42 42
43private:43private:
44 ServerTracepointProvider tp_provider;44 ServerTracepointProvider tp_provider;
45};45};
4646
=== modified file 'include/server/mir/scene/input_registrar.h'
--- include/server/mir/scene/input_registrar.h 2013-11-20 16:22:32 +0000
+++ include/server/mir/scene/input_registrar.h 2013-11-28 12:22:03 +0000
@@ -41,7 +41,7 @@
41{41{
42public:42public:
43 virtual ~InputRegistrar() = default;43 virtual ~InputRegistrar() = default;
44 44
45 virtual void input_channel_opened(std::shared_ptr<input::InputChannel> const& opened_channel,45 virtual void input_channel_opened(std::shared_ptr<input::InputChannel> const& opened_channel,
46 std::shared_ptr<input::Surface> const& info,46 std::shared_ptr<input::Surface> const& info,
47 input::InputReceptionMode input_mode) = 0;47 input::InputReceptionMode input_mode) = 0;
4848
=== modified file 'include/server/mir/shell/input_targeter.h'
--- include/server/mir/shell/input_targeter.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/shell/input_targeter.h 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36{36{
37public:37public:
38 virtual ~InputTargeter() = default;38 virtual ~InputTargeter() = default;
39 39
40 virtual void focus_changed(std::shared_ptr<input::InputChannel const> const& focus_channel) = 0;40 virtual void focus_changed(std::shared_ptr<input::InputChannel const> const& focus_channel) = 0;
41 virtual void focus_cleared() = 0;41 virtual void focus_cleared() = 0;
4242
4343
=== modified file 'include/server/mir/shell/session_listener.h'
--- include/server/mir/shell/session_listener.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/shell/session_listener.h 2013-11-28 12:22:03 +0000
@@ -35,7 +35,7 @@
35 virtual void stopping(std::shared_ptr<Session> const& session) = 0;35 virtual void stopping(std::shared_ptr<Session> const& session) = 0;
36 virtual void focused(std::shared_ptr<Session> const& session) = 0;36 virtual void focused(std::shared_ptr<Session> const& session) = 0;
37 virtual void unfocused() = 0;37 virtual void unfocused() = 0;
38 38
39 virtual void surface_created(Session& session, std::shared_ptr<Surface> const& surface) = 0;39 virtual void surface_created(Session& session, std::shared_ptr<Surface> const& surface) = 0;
40 virtual void destroying_surface(Session& session, std::shared_ptr<Surface> const& surface) = 0;40 virtual void destroying_surface(Session& session, std::shared_ptr<Surface> const& surface) = 0;
4141
4242
=== modified file 'include/server/mir/shell/surface_configurator.h'
--- include/server/mir/shell/surface_configurator.h 2013-07-29 22:55:20 +0000
+++ include/server/mir/shell/surface_configurator.h 2013-11-28 12:22:03 +0000
@@ -34,7 +34,7 @@
34{34{
35public:35public:
36 virtual ~SurfaceConfigurator() = default;36 virtual ~SurfaceConfigurator() = default;
37 37
38 /// Returns the selected value.38 /// Returns the selected value.
39 virtual int select_attribute_value(Surface const& surface, MirSurfaceAttrib attrib,39 virtual int select_attribute_value(Surface const& surface, MirSurfaceAttrib attrib,
40 int requested_value) = 0;40 int requested_value) = 0;
4141
=== modified file 'include/server/mir/shell/surface_controller.h'
--- include/server/mir/shell/surface_controller.h 2013-11-21 12:34:49 +0000
+++ include/server/mir/shell/surface_controller.h 2013-11-28 12:22:03 +0000
@@ -24,7 +24,7 @@
2424
25namespace mir25namespace mir
26{26{
27namespace scene 27namespace scene
28{28{
29class BasicSurface;29class BasicSurface;
30}30}
3131
=== modified file 'include/server/mir/shell/surface_creation_parameters.h'
--- include/server/mir/shell/surface_creation_parameters.h 2013-11-20 15:56:58 +0000
+++ include/server/mir/shell/surface_creation_parameters.h 2013-11-28 12:22:03 +0000
@@ -44,15 +44,15 @@
44 SurfaceCreationParameters& of_size(geometry::Size new_size);44 SurfaceCreationParameters& of_size(geometry::Size new_size);
4545
46 SurfaceCreationParameters& of_size(geometry::Width::ValueType width, geometry::Height::ValueType height);46 SurfaceCreationParameters& of_size(geometry::Width::ValueType width, geometry::Height::ValueType height);
47 47
48 SurfaceCreationParameters& of_position(geometry::Point const& top_left);48 SurfaceCreationParameters& of_position(geometry::Point const& top_left);
4949
50 SurfaceCreationParameters& of_buffer_usage(graphics::BufferUsage new_buffer_usage);50 SurfaceCreationParameters& of_buffer_usage(graphics::BufferUsage new_buffer_usage);
5151
52 SurfaceCreationParameters& of_pixel_format(geometry::PixelFormat new_pixel_format);52 SurfaceCreationParameters& of_pixel_format(geometry::PixelFormat new_pixel_format);
53 53
54 SurfaceCreationParameters& of_depth(scene::DepthId const& new_depth);54 SurfaceCreationParameters& of_depth(scene::DepthId const& new_depth);
55 55
56 SurfaceCreationParameters& with_input_mode(input::InputReceptionMode const& new_mode);56 SurfaceCreationParameters& with_input_mode(input::InputReceptionMode const& new_mode);
5757
58 SurfaceCreationParameters& with_output_id(graphics::DisplayConfigurationOutputId const& output_id);58 SurfaceCreationParameters& with_output_id(graphics::DisplayConfigurationOutputId const& output_id);
5959
=== modified file 'include/shared/mir/geometry/rectangle.h'
--- include/shared/mir/geometry/rectangle.h 2013-11-21 03:16:21 +0000
+++ include/shared/mir/geometry/rectangle.h 2013-11-28 12:22:03 +0000
@@ -35,7 +35,7 @@
35 Point top_left;35 Point top_left;
36 Size size;36 Size size;
3737
38 /** 38 /**
39 * The bottom right boundary point of the rectangle.39 * The bottom right boundary point of the rectangle.
40 *40 *
41 * Note that the returned point is *not* included in the rectangle41 * Note that the returned point is *not* included in the rectangle
4242
=== modified file 'include/shared/mir/graphics/android/android_driver_interpreter.h'
--- include/shared/mir/graphics/android/android_driver_interpreter.h 2013-10-15 08:53:10 +0000
+++ include/shared/mir/graphics/android/android_driver_interpreter.h 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36 virtual void driver_returns_buffer(ANativeWindowBuffer*, int fence) = 0;36 virtual void driver_returns_buffer(ANativeWindowBuffer*, int fence) = 0;
37 virtual void dispatch_driver_request_format(int format) = 0;37 virtual void dispatch_driver_request_format(int format) = 0;
38 virtual int driver_requests_info(int key) const = 0;38 virtual int driver_requests_info(int key) const = 0;
39 virtual void sync_to_display(bool sync) = 0; 39 virtual void sync_to_display(bool sync) = 0;
40protected:40protected:
41 AndroidDriverInterpreter() {};41 AndroidDriverInterpreter() {};
42 virtual ~AndroidDriverInterpreter() {};42 virtual ~AndroidDriverInterpreter() {};
4343
=== modified file 'include/shared/mir/graphics/android/mir_native_window.h'
--- include/shared/mir/graphics/android/mir_native_window.h 2013-11-21 03:16:21 +0000
+++ include/shared/mir/graphics/android/mir_native_window.h 2013-11-28 12:22:03 +0000
@@ -25,7 +25,7 @@
2525
26namespace mir26namespace mir
27{27{
28namespace graphics 28namespace graphics
29{29{
30namespace android30namespace android
31{31{
3232
=== modified file 'include/shared/mir/graphics/android/native_buffer.h'
--- include/shared/mir/graphics/android/native_buffer.h 2013-10-15 08:53:10 +0000
+++ include/shared/mir/graphics/android/native_buffer.h 2013-11-28 12:22:03 +0000
@@ -27,7 +27,7 @@
27namespace graphics27namespace graphics
28{28{
2929
30class NativeBuffer 30class NativeBuffer
31{31{
32public:32public:
33 virtual ~NativeBuffer() = default;33 virtual ~NativeBuffer() = default;
@@ -37,7 +37,7 @@
37 virtual android::NativeFence copy_fence() const = 0;37 virtual android::NativeFence copy_fence() const = 0;
3838
39 virtual void wait_for_content() = 0;39 virtual void wait_for_content() = 0;
40 virtual void update_fence(android::NativeFence& fence) = 0; 40 virtual void update_fence(android::NativeFence& fence) = 0;
4141
42protected:42protected:
43 NativeBuffer() = default;43 NativeBuffer() = default;
4444
=== modified file 'include/shared/mir/input/android/android_input_lexicon.h'
--- include/shared/mir/input/android/android_input_lexicon.h 2013-04-24 05:22:20 +0000
+++ include/shared/mir/input/android/android_input_lexicon.h 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36namespace android36namespace android
37{37{
3838
39/// The Lexicon translates droidinput event types to MirEvent types prior to 39/// The Lexicon translates droidinput event types to MirEvent types prior to
40/// shell or client handling.40/// shell or client handling.
41class Lexicon41class Lexicon
42{42{
4343
=== modified file 'include/shared/mir/input/input_platform.h'
--- include/shared/mir/input/input_platform.h 2013-11-21 03:16:21 +0000
+++ include/shared/mir/input/input_platform.h 2013-11-28 12:22:03 +0000
@@ -37,7 +37,7 @@
37class InputPlatform37class InputPlatform
38{38{
39public:39public:
40 virtual ~InputPlatform() {}; 40 virtual ~InputPlatform() {};
4141
42 virtual std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback) = 0;42 virtual std::shared_ptr<InputReceiverThread> create_input_thread(int fd, std::function<void(MirEvent *)> const& callback) = 0;
4343
4444
=== modified file 'include/shared/mir/input/xkb_mapper.h'
--- include/shared/mir/input/xkb_mapper.h 2013-05-17 19:42:09 +0000
+++ include/shared/mir/input/xkb_mapper.h 2013-11-28 12:22:03 +0000
@@ -37,7 +37,7 @@
37public:37public:
38 XKBMapper();38 XKBMapper();
39 virtual ~XKBMapper() = default;39 virtual ~XKBMapper() = default;
40 40
41 void update_state_and_map_event(MirKeyEvent& key_ev);41 void update_state_and_map_event(MirKeyEvent& key_ev);
4242
43protected:43protected:
4444
=== modified file 'include/shared/mir_toolkit/client_types.h'
--- include/shared/mir_toolkit/client_types.h 2013-11-21 03:16:21 +0000
+++ include/shared/mir_toolkit/client_types.h 2013-11-28 12:22:03 +0000
@@ -34,6 +34,12 @@
34extern "C" {34extern "C" {
35#endif35#endif
3636
37typedef enum MirBool
38{
39 mir_false = 0,
40 mir_true = 1
41} MirBool;
42
37/* Display server connection API */43/* Display server connection API */
38typedef void* MirEGLNativeWindowType;44typedef void* MirEGLNativeWindowType;
39typedef void* MirEGLNativeDisplayType;45typedef void* MirEGLNativeDisplayType;
@@ -157,7 +163,7 @@
157typedef enum MirPlatformType163typedef enum MirPlatformType
158{164{
159 mir_platform_type_gbm,165 mir_platform_type_gbm,
160 mir_platform_type_android 166 mir_platform_type_android
161} MirPlatformType;167} MirPlatformType;
162168
163typedef struct MirPlatformPackage169typedef struct MirPlatformPackage
@@ -184,7 +190,7 @@
184190
185} MirGraphicsRegion;191} MirGraphicsRegion;
186192
187/** 193/**
188 * DEPRECATED. use MirDisplayConfiguration194 * DEPRECATED. use MirDisplayConfiguration
189 */195 */
190enum { mir_supported_pixel_format_max = 32 };196enum { mir_supported_pixel_format_max = 32 };
@@ -192,7 +198,7 @@
192{198{
193 uint32_t width;199 uint32_t width;
194 uint32_t height;200 uint32_t height;
195 201
196 int supported_pixel_format_items;202 int supported_pixel_format_items;
197 MirPixelFormat supported_pixel_format[mir_supported_pixel_format_max];203 MirPixelFormat supported_pixel_format[mir_supported_pixel_format_max];
198} MirDisplayInfo;204} MirDisplayInfo;
@@ -240,7 +246,7 @@
240 uint32_t num_modes;246 uint32_t num_modes;
241 MirDisplayMode* modes;247 MirDisplayMode* modes;
242 uint32_t preferred_mode;248 uint32_t preferred_mode;
243 uint32_t current_mode; 249 uint32_t current_mode;
244250
245 uint32_t num_output_formats;251 uint32_t num_output_formats;
246 MirPixelFormat* output_formats;252 MirPixelFormat* output_formats;
@@ -257,7 +263,7 @@
257263
258 uint32_t physical_width_mm;264 uint32_t physical_width_mm;
259 uint32_t physical_height_mm;265 uint32_t physical_height_mm;
260 266
261 MirPowerMode power_mode;267 MirPowerMode power_mode;
262} MirDisplayOutput;268} MirDisplayOutput;
263269
264270
=== modified file 'include/shared/mir_toolkit/event.h'
--- include/shared/mir_toolkit/event.h 2013-11-21 03:16:21 +0000
+++ include/shared/mir_toolkit/event.h 2013-11-28 12:22:03 +0000
@@ -39,7 +39,8 @@
39{39{
40 mir_event_type_key,40 mir_event_type_key,
41 mir_event_type_motion,41 mir_event_type_motion,
42 mir_event_type_surface42 mir_event_type_surface,
43 mir_event_type_resize
43} MirEventType;44} MirEventType;
4445
45typedef enum {46typedef enum {
@@ -141,7 +142,7 @@
141142
142 int32_t device_id;143 int32_t device_id;
143 int32_t source_id;144 int32_t source_id;
144 /* 145 /*
145 * TODO(racarr): We would like to store this as a MirMotionAction but the android input stack146 * TODO(racarr): We would like to store this as a MirMotionAction but the android input stack
146 * encodes some non enumerable values in it. It's convenient to keep things147 * encodes some non enumerable values in it. It's convenient to keep things
147 * this way for now until we can drop SF/Hybris support in QtUbuntu.148 * this way for now until we can drop SF/Hybris support in QtUbuntu.
@@ -194,12 +195,22 @@
194 int value;195 int value;
195} MirSurfaceEvent;196} MirSurfaceEvent;
196197
198typedef struct
199{
200 MirEventType type;
201
202 int surface_id;
203 int width;
204 int height;
205} MirResizeEvent;
206
197typedef union207typedef union
198{208{
199 MirEventType type;209 MirEventType type;
200 MirKeyEvent key;210 MirKeyEvent key;
201 MirMotionEvent motion;211 MirMotionEvent motion;
202 MirSurfaceEvent surface;212 MirSurfaceEvent surface;
213 MirResizeEvent resize;
203} MirEvent;214} MirEvent;
204215
205#ifdef __cplusplus216#ifdef __cplusplus
206217
=== modified file 'include/shared/mir_toolkit/mir_native_buffer.h'
--- include/shared/mir_toolkit/mir_native_buffer.h 2013-11-21 03:16:21 +0000
+++ include/shared/mir_toolkit/mir_native_buffer.h 2013-11-28 12:22:03 +0000
@@ -52,6 +52,6 @@
52struct ANativeWindowBuffer;52struct ANativeWindowBuffer;
53typedef struct ANativeWindowBuffer MirNativeBuffer;53typedef struct ANativeWindowBuffer MirNativeBuffer;
54#else54#else
55typedef struct MirBufferPackage MirNativeBuffer; 55typedef struct MirBufferPackage MirNativeBuffer;
56#endif56#endif
57#endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */57#endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */
5858
=== added file 'include/test/gmock_set_arg.h'
--- include/test/gmock_set_arg.h 1970-01-01 00:00:00 +0000
+++ include/test/gmock_set_arg.h 2013-11-28 12:22:03 +0000
@@ -0,0 +1,57 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef GMOCK_SET_ARG_H_
20#define GMOCK_SET_ARG_H_
21
22#include <gmock/gmock.h>
23
24namespace testing
25{
26namespace internal
27{
28template <size_t N, typename A, bool kIsProto>
29class SetArgumentAction {
30 public:
31 // Constructs an action that sets the variable pointed to by the
32 // N-th function argument to 'value'.
33 explicit SetArgumentAction(const A& value) : value_(value) {}
34
35 template <typename Result, typename ArgumentTuple>
36 void Perform(const ArgumentTuple& args) const {
37 CompileAssertTypesEqual<void, Result>();
38 ::std::tr1::get<N>(args) = value_;
39 }
40
41 private:
42 const A value_;
43
44 GTEST_DISALLOW_ASSIGN_(SetArgumentAction);
45};
46}
47template <size_t N, typename T>
48PolymorphicAction<
49 internal::SetArgumentAction<
50 N, T, internal::IsAProtocolMessage<T>::value> >
51SetArg(const T& x) {
52 return MakePolymorphicAction(internal::SetArgumentAction<
53 N, T, internal::IsAProtocolMessage<T>::value>(x));
54}
55}
56
57#endif /* GMOCK_SET_ARG_H_ */
058
=== modified file 'include/test/mir_test/draw/draw_pattern_checkered-inl.h'
--- include/test/mir_test/draw/draw_pattern_checkered-inl.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test/draw/draw_pattern_checkered-inl.h 2013-11-28 12:22:03 +0000
@@ -39,7 +39,7 @@
39 {39 {
40 int key_row = i % Rows;40 int key_row = i % Rows;
41 int key_col = j % Cols;41 int key_col = j % Cols;
42 uint32_t *pixel = reinterpret_cast<uint32_t*>(&region.vaddr[j*region.stride + (i * bpp)]); 42 uint32_t *pixel = reinterpret_cast<uint32_t*>(&region.vaddr[j*region.stride + (i * bpp)]);
43 *pixel = color_pattern[key_row][key_col];43 *pixel = color_pattern[key_row][key_col];
44 }44 }
45 }45 }
@@ -58,7 +58,7 @@
58 {58 {
59 int key_row = i % Rows;59 int key_row = i % Rows;
60 int key_col = j % Cols;60 int key_col = j % Cols;
61 uint32_t *pixel = reinterpret_cast<uint32_t*>(&region.vaddr[j*region.stride + (i * bpp)]); 61 uint32_t *pixel = reinterpret_cast<uint32_t*>(&region.vaddr[j*region.stride + (i * bpp)]);
62 if ( *pixel != color_pattern[key_row][key_col] )62 if ( *pixel != color_pattern[key_row][key_col] )
63 {63 {
64 return false;64 return false;
6565
=== modified file 'include/test/mir_test/fake_event_hub_input_configuration.h'
--- include/test/mir_test/fake_event_hub_input_configuration.h 2013-08-30 07:47:16 +0000
+++ include/test/mir_test/fake_event_hub_input_configuration.h 2013-11-28 12:22:03 +0000
@@ -59,7 +59,7 @@
5959
60 droidinput::sp<droidinput::EventHubInterface> the_event_hub();60 droidinput::sp<droidinput::EventHubInterface> the_event_hub();
61 input::android::FakeEventHub* the_fake_event_hub();61 input::android::FakeEventHub* the_fake_event_hub();
62 62
63 bool is_key_repeat_enabled() override { return false; }63 bool is_key_repeat_enabled() override { return false; }
6464
6565
6666
=== modified file 'include/test/mir_test_doubles/mock_alloc_adaptor.h'
--- include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-10-15 08:53:10 +0000
+++ include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-11-28 12:22:03 +0000
@@ -34,7 +34,7 @@
34class MockAllocAdaptor : public graphics::android::GraphicAllocAdaptor34class MockAllocAdaptor : public graphics::android::GraphicAllocAdaptor
35{35{
36public:36public:
37 MOCK_METHOD3(alloc_buffer, 37 MOCK_METHOD3(alloc_buffer,
38 std::shared_ptr<graphics::NativeBuffer>(geometry::Size, geometry::PixelFormat, graphics::android::BufferUsage));38 std::shared_ptr<graphics::NativeBuffer>(geometry::Size, geometry::PixelFormat, graphics::android::BufferUsage));
39};39};
4040
4141
=== modified file 'include/test/mir_test_doubles/mock_android_native_buffer.h'
--- include/test/mir_test_doubles/mock_android_native_buffer.h 2013-10-11 21:30:50 +0000
+++ include/test/mir_test_doubles/mock_android_native_buffer.h 2013-11-28 12:22:03 +0000
@@ -20,7 +20,7 @@
20#define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_20#define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_
2121
22#include "mir/graphics/android/native_buffer.h"22#include "mir/graphics/android/native_buffer.h"
23#include <gmock/gmock.h> 23#include <gmock/gmock.h>
2424
25namespace mir25namespace mir
26{26{
2727
=== modified file 'include/test/mir_test_doubles/mock_android_registrar.h'
--- include/test/mir_test_doubles/mock_android_registrar.h 2013-06-21 22:14:10 +0000
+++ include/test/mir_test_doubles/mock_android_registrar.h 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36struct MockAndroidRegistrar : public client::android::AndroidRegistrar36struct MockAndroidRegistrar : public client::android::AndroidRegistrar
37{37{
38 ~MockAndroidRegistrar() noexcept {}38 ~MockAndroidRegistrar() noexcept {}
39 MOCK_CONST_METHOD1(register_buffer, 39 MOCK_CONST_METHOD1(register_buffer,
40 std::shared_ptr<const native_handle_t>(std::shared_ptr<MirBufferPackage> const&));40 std::shared_ptr<const native_handle_t>(std::shared_ptr<MirBufferPackage> const&));
41 MOCK_METHOD2(secure_for_cpu, std::shared_ptr<char>(std::shared_ptr<const native_handle_t>, geometry::Rectangle));41 MOCK_METHOD2(secure_for_cpu, std::shared_ptr<char>(std::shared_ptr<const native_handle_t>, geometry::Rectangle));
42};42};
4343
=== modified file 'include/test/mir_test_doubles/mock_buffer_stream.h'
--- include/test/mir_test_doubles/mock_buffer_stream.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/mock_buffer_stream.h 2013-11-28 12:22:03 +0000
@@ -31,7 +31,8 @@
31{31{
32struct MockBufferStream : public compositor::BufferStream32struct MockBufferStream : public compositor::BufferStream
33{33{
34 MOCK_METHOD0(secure_client_buffer, std::shared_ptr<graphics::Buffer>());34 MOCK_METHOD1(swap_client_buffers, void(std::shared_ptr<graphics::Buffer>&));
35 MOCK_METHOD1(release_client_buffer, void(std::shared_ptr<graphics::Buffer>&));
35 MOCK_METHOD1(lock_compositor_buffer,36 MOCK_METHOD1(lock_compositor_buffer,
36 std::shared_ptr<graphics::Buffer>(unsigned long));37 std::shared_ptr<graphics::Buffer>(unsigned long));
37 MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>());38 MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>());
3839
=== modified file 'include/test/mir_test_doubles/mock_display_device.h'
--- include/test/mir_test_doubles/mock_display_device.h 2013-11-21 17:20:14 +0000
+++ include/test/mir_test_doubles/mock_display_device.h 2013-11-28 12:22:03 +0000
@@ -22,7 +22,7 @@
22#include "mir/graphics/buffer.h"22#include "mir/graphics/buffer.h"
23#include "src/server/graphics/android/display_device.h"23#include "src/server/graphics/android/display_device.h"
24#include <gmock/gmock.h>24#include <gmock/gmock.h>
25 25
26namespace mir26namespace mir
27{27{
28namespace test28namespace test
2929
=== modified file 'include/test/mir_test_doubles/mock_egl.h'
--- include/test/mir_test_doubles/mock_egl.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/mock_egl.h 2013-11-28 12:22:03 +0000
@@ -58,7 +58,6 @@
58public:58public:
59 MockEGL();59 MockEGL();
60 ~MockEGL();60 ~MockEGL();
61 void silence_uninteresting();
6261
63 typedef void (*generic_function_pointer_t)(void);62 typedef void (*generic_function_pointer_t)(void);
6463
6564
=== modified file 'include/test/mir_test_doubles/mock_fb_hal_device.h'
--- include/test/mir_test_doubles/mock_fb_hal_device.h 2013-11-19 22:02:08 +0000
+++ include/test/mir_test_doubles/mock_fb_hal_device.h 2013-11-28 12:22:03 +0000
@@ -52,10 +52,11 @@
52 {0,0,0,0,0,0,0},52 {0,0,0,0,0,0,0},
53 nullptr, nullptr,nullptr,nullptr, nullptr,nullptr,53 nullptr, nullptr,nullptr,nullptr, nullptr,nullptr,
54 {0,0,0,0,0,0}54 {0,0,0,0,0,0}
55 }) 55 })
56 {56 {
57 post = hook_post;57 post = hook_post;
58 setSwapInterval = hook_setSwapInterval; 58 setSwapInterval = hook_setSwapInterval;
59 enableScreen = hook_enableScreen;
59 }60 }
6061
61 MockFBHalDevice()62 MockFBHalDevice()
@@ -72,12 +73,20 @@
72 static int hook_setSwapInterval(struct framebuffer_device_t* mock_fb, int interval)73 static int hook_setSwapInterval(struct framebuffer_device_t* mock_fb, int interval)
73 {74 {
74 MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb);75 MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb);
75 return mocker->setSwapInterval_interface(mock_fb, interval); 76 return mocker->setSwapInterval_interface(mock_fb, interval);
76 }77 }
7778
79 static int hook_enableScreen(struct framebuffer_device_t* mock_fb, int enable)
80 {
81 MockFBHalDevice* mocker = static_cast<MockFBHalDevice*>(mock_fb);
82 return mocker->enableScreen_interface(mock_fb, enable);
83 }
84
85
86 MOCK_METHOD2(enableScreen_interface, int(struct framebuffer_device_t*, int));
78 MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t));87 MOCK_METHOD2(post_interface, int(struct framebuffer_device_t*, buffer_handle_t));
79 MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int));88 MOCK_METHOD2(setSwapInterval_interface, int(struct framebuffer_device_t*, int));
80 89
81 hw_device_t empty_module;90 hw_device_t empty_module;
82};91};
8392
8493
=== modified file 'include/test/mir_test_doubles/mock_frontend_surface.h'
--- include/test/mir_test_doubles/mock_frontend_surface.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/mock_frontend_surface.h 2013-11-28 12:22:03 +0000
@@ -39,7 +39,7 @@
3939
40 MOCK_METHOD0(destroy, void());40 MOCK_METHOD0(destroy, void());
41 MOCK_METHOD0(force_requests_to_complete, void());41 MOCK_METHOD0(force_requests_to_complete, void());
42 MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>());42 MOCK_METHOD1(swap_buffers, void(std::shared_ptr<graphics::Buffer>&));
4343
44 MOCK_CONST_METHOD0(size, geometry::Size());44 MOCK_CONST_METHOD0(size, geometry::Size());
45 MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());45 MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());
4646
=== modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h'
--- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2013-11-28 12:22:03 +0000
@@ -66,7 +66,7 @@
6666
67 void hwc_set_return_fence(int fence)67 void hwc_set_return_fence(int fence)
68 {68 {
69 fb_fence = fence; 69 fb_fence = fence;
70 }70 }
7171
72 int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t** displays)72 int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t, hwc_display_contents_1_t** displays)
@@ -87,7 +87,7 @@
87 set_layerlist.back().visibleRegionScreen = {0, nullptr};87 set_layerlist.back().visibleRegionScreen = {0, nullptr};
88 }88 }
8989
90 if (primary_display->hwLayers)90 if (primary_display->numHwLayers >= 2)
91 {91 {
92 primary_display->hwLayers[1].releaseFenceFd = fb_fence;92 primary_display->hwLayers[1].releaseFenceFd = fb_fence;
93 }93 }
9494
=== modified file 'include/test/mir_test_doubles/mock_input_dispatcher.h'
--- include/test/mir_test_doubles/mock_input_dispatcher.h 2013-05-24 18:23:48 +0000
+++ include/test/mir_test_doubles/mock_input_dispatcher.h 2013-11-28 12:22:03 +0000
@@ -45,7 +45,7 @@
45 MOCK_METHOD2(transferTouchFocus, bool(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputChannel> const&));45 MOCK_METHOD2(transferTouchFocus, bool(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputChannel> const&));
46 MOCK_METHOD3(registerInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputWindowHandle> const&, bool));46 MOCK_METHOD3(registerInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&, droidinput::sp<droidinput::InputWindowHandle> const&, bool));
47 MOCK_METHOD1(unregisterInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&));47 MOCK_METHOD1(unregisterInputChannel, droidinput::status_t(droidinput::sp<droidinput::InputChannel> const&));
48 48
49 MOCK_METHOD1(setKeyboardFocus, void(droidinput::sp<droidinput::InputWindowHandle> const&));49 MOCK_METHOD1(setKeyboardFocus, void(droidinput::sp<droidinput::InputWindowHandle> const&));
50 MOCK_METHOD1(notifyWindowRemoved, void(droidinput::sp<droidinput::InputWindowHandle> const&));50 MOCK_METHOD1(notifyWindowRemoved, void(droidinput::sp<droidinput::InputWindowHandle> const&));
5151
5252
=== modified file 'include/test/mir_test_doubles/mock_input_surface.h'
--- include/test/mir_test_doubles/mock_input_surface.h 2013-08-28 03:41:48 +0000
+++ include/test/mir_test_doubles/mock_input_surface.h 2013-11-28 12:22:03 +0000
@@ -29,7 +29,7 @@
29namespace doubles29namespace doubles
30{30{
3131
32class MockInputSurface : public input::Surface 32class MockInputSurface : public input::Surface
33{33{
34public:34public:
35 MockInputSurface()35 MockInputSurface()
3636
=== modified file 'include/test/mir_test_doubles/mock_session_listener.h'
--- include/test/mir_test_doubles/mock_session_listener.h 2013-07-18 22:51:42 +0000
+++ include/test/mir_test_doubles/mock_session_listener.h 2013-11-28 12:22:03 +0000
@@ -38,7 +38,7 @@
38 MOCK_METHOD1(stopping, void(std::shared_ptr<shell::Session> const&));38 MOCK_METHOD1(stopping, void(std::shared_ptr<shell::Session> const&));
39 MOCK_METHOD1(focused, void(std::shared_ptr<shell::Session> const&));39 MOCK_METHOD1(focused, void(std::shared_ptr<shell::Session> const&));
40 MOCK_METHOD0(unfocused, void());40 MOCK_METHOD0(unfocused, void());
41 41
42 MOCK_METHOD2(surface_created, void(shell::Session&, std::shared_ptr<shell::Surface> const&));42 MOCK_METHOD2(surface_created, void(shell::Session&, std::shared_ptr<shell::Surface> const&));
43 MOCK_METHOD2(destroying_surface, void(shell::Session&, std::shared_ptr<shell::Surface> const&));43 MOCK_METHOD2(destroying_surface, void(shell::Session&, std::shared_ptr<shell::Surface> const&));
44};44};
4545
=== modified file 'include/test/mir_test_doubles/mock_shell_session.h'
--- include/test/mir_test_doubles/mock_shell_session.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/mock_shell_session.h 2013-11-28 12:22:03 +0000
@@ -46,7 +46,7 @@
4646
47 MOCK_METHOD0(hide, void());47 MOCK_METHOD0(hide, void());
48 MOCK_METHOD0(show, void());48 MOCK_METHOD0(show, void());
49 49
50 MOCK_METHOD1(send_display_config, void(graphics::DisplayConfiguration const&));50 MOCK_METHOD1(send_display_config, void(graphics::DisplayConfiguration const&));
51 MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int));51 MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int));
5252
5353
=== modified file 'include/test/mir_test_doubles/mock_surface_renderer.h'
--- include/test/mir_test_doubles/mock_surface_renderer.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/mock_surface_renderer.h 2013-11-28 12:22:03 +0000
@@ -18,7 +18,6 @@
18#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_18#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_
19#define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_19#define MIR_TEST_DOUBLES_MOCK_SURFACE_RENDERER_H_
2020
21#include "mir/compositor/buffer_stream.h"
22#include "src/server/compositor/renderer.h"21#include "src/server/compositor/renderer.h"
2322
24#include <gmock/gmock.h>23#include <gmock/gmock.h>
@@ -32,9 +31,8 @@
3231
33struct MockSurfaceRenderer : public compositor::Renderer32struct MockSurfaceRenderer : public compositor::Renderer
34{33{
35 MOCK_METHOD3(render, void(34 MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&));
36 std::function<void(std::shared_ptr<void> const&)>, compositor::CompositingCriteria const&, compositor::BufferStream&));35 MOCK_CONST_METHOD0(clear, void());
37 MOCK_METHOD1(clear, void(unsigned long));
3836
39 ~MockSurfaceRenderer() noexcept {}37 ~MockSurfaceRenderer() noexcept {}
40};38};
4139
=== modified file 'include/test/mir_test_doubles/stub_buffer_stream.h'
--- include/test/mir_test_doubles/stub_buffer_stream.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/stub_buffer_stream.h 2013-11-28 12:22:03 +0000
@@ -37,27 +37,30 @@
37 stub_client_buffer = std::make_shared<StubBuffer>();37 stub_client_buffer = std::make_shared<StubBuffer>();
38 stub_compositor_buffer = std::make_shared<StubBuffer>();38 stub_compositor_buffer = std::make_shared<StubBuffer>();
39 }39 }
40 std::shared_ptr<graphics::Buffer> secure_client_buffer()40 void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) override
41 {41 {
42 return stub_client_buffer;42 buffer = stub_client_buffer;
43 }43 }
4444 void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) override
45 std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long)45 {
46 {46 buffer.reset();
47 return stub_compositor_buffer;47 }
48 }48 std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override
4949 {
50 std::shared_ptr<graphics::Buffer> lock_snapshot_buffer()50 return stub_compositor_buffer;
51 {51 }
52 return stub_compositor_buffer;52
53 }53 std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override
5454 {
55 geometry::PixelFormat get_stream_pixel_format()55 return stub_compositor_buffer;
56 }
57
58 geometry::PixelFormat get_stream_pixel_format() override
56 {59 {
57 return geometry::PixelFormat();60 return geometry::PixelFormat();
58 }61 }
5962
60 geometry::Size stream_size()63 geometry::Size stream_size() override
61 {64 {
62 return geometry::Size();65 return geometry::Size();
63 }66 }
@@ -66,11 +69,11 @@
66 {69 {
67 }70 }
6871
69 void force_requests_to_complete()72 void force_requests_to_complete() override
70 {73 {
71 }74 }
7275
73 void allow_framedropping(bool)76 void allow_framedropping(bool) override
74 {77 {
75 }78 }
7679
7780
=== modified file 'include/test/mir_test_doubles/stub_display_builder.h'
--- include/test/mir_test_doubles/stub_display_builder.h 2013-11-19 19:11:49 +0000
+++ include/test/mir_test_doubles/stub_display_builder.h 2013-11-28 12:22:03 +0000
@@ -64,7 +64,7 @@
64 return std::unique_ptr<graphics::DisplayBuffer>(64 return std::unique_ptr<graphics::DisplayBuffer>(
65 new StubDisplayBuffer(geometry::Rectangle{{0,0},sz}));65 new StubDisplayBuffer(geometry::Rectangle{{0,0},sz}));
66 }66 }
67 67
68 std::shared_ptr<graphics::android::DisplayDevice> create_display_device()68 std::shared_ptr<graphics::android::DisplayDevice> create_display_device()
69 {69 {
70 return stub_dev;70 return stub_dev;
7171
=== modified file 'include/test/mir_test_doubles/stub_display_configuration.h'
--- include/test/mir_test_doubles/stub_display_configuration.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/stub_display_configuration.h 2013-11-28 12:22:03 +0000
@@ -67,7 +67,7 @@
67 modes.push_back(mode);67 modes.push_back(mode);
68 }68 }
6969
70 size_t mode_index = modes.size() - 1; 70 size_t mode_index = modes.size() - 1;
71 geometry::Size physical_size{};71 geometry::Size physical_size{};
72 geometry::Point top_left{};72 geometry::Point top_left{};
73 graphics::DisplayConfigurationOutput output{73 graphics::DisplayConfigurationOutput output{
7474
=== modified file 'include/test/mir_test_doubles/stub_display_device.h'
--- include/test/mir_test_doubles/stub_display_device.h 2013-11-21 17:20:14 +0000
+++ include/test/mir_test_doubles/stub_display_device.h 2013-11-28 12:22:03 +0000
@@ -19,7 +19,7 @@
19#define MIR_TEST_DOUBLES_STUB_DISPLAY_DEVICE_H_19#define MIR_TEST_DOUBLES_STUB_DISPLAY_DEVICE_H_
2020
21#include "src/server/graphics/android/display_device.h"21#include "src/server/graphics/android/display_device.h"
22 22
23namespace mir23namespace mir
24{24{
25namespace test25namespace test
@@ -41,7 +41,7 @@
41 void prepare_composition()41 void prepare_composition()
42 {42 {
43 }43 }
44 void gpu_render(EGLDisplay, EGLSurface) 44 void gpu_render(EGLDisplay, EGLSurface)
45 {45 {
46 }46 }
47 void post(graphics::Buffer const&)47 void post(graphics::Buffer const&)
4848
=== modified file 'include/test/mir_test_doubles/stub_driver_interpreter.h'
--- include/test/mir_test_doubles/stub_driver_interpreter.h 2013-10-17 22:15:46 +0000
+++ include/test/mir_test_doubles/stub_driver_interpreter.h 2013-11-28 12:22:03 +0000
@@ -49,7 +49,7 @@
49 void driver_returns_buffer(ANativeWindowBuffer*, int)49 void driver_returns_buffer(ANativeWindowBuffer*, int)
50 {50 {
51 }51 }
52 void dispatch_driver_request_format(int) 52 void dispatch_driver_request_format(int)
53 {53 {
54 }54 }
55 int driver_requests_info(int index) const55 int driver_requests_info(int index) const
5656
=== modified file 'include/test/mir_test_doubles/stub_shell_session.h'
--- include/test/mir_test_doubles/stub_shell_session.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/stub_shell_session.h 2013-11-28 12:22:03 +0000
@@ -66,7 +66,7 @@
66 void take_snapshot(shell::SnapshotCallback const&) override66 void take_snapshot(shell::SnapshotCallback const&) override
67 {67 {
68 }68 }
69 69
70 std::shared_ptr<shell::Surface> default_surface() const override70 std::shared_ptr<shell::Surface> default_surface() const override
71 {71 {
72 return std::shared_ptr<shell::Surface>();72 return std::shared_ptr<shell::Surface>();
7373
=== removed file 'include/test/mir_test_doubles/stub_surface.h'
--- include/test/mir_test_doubles/stub_surface.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_doubles/stub_surface.h 1970-01-01 00:00:00 +0000
@@ -1,74 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_STUB_SURFACE_H_
20#define MIR_TEST_DOUBLES_STUB_SURFACE_H_
21
22#include "mir/frontend/surface.h"
23
24namespace mir
25{
26namespace test
27{
28namespace doubles
29{
30
31class StubSurface : public frontend::Surface
32{
33public:
34 virtual ~StubSurface() = default;
35
36 void hide() {}
37 void show() {}
38 void force_requests_to_complete() {}
39
40 geometry::Size size() const
41 {
42 return geometry::Size();
43 }
44 geometry::PixelFormat pixel_format() const
45 {
46 return geometry::PixelFormat();
47 }
48
49 std::shared_ptr<graphics::Buffer> advance_client_buffer()
50 {
51 return std::shared_ptr<graphics::Buffer>();
52 }
53
54 virtual int configure(MirSurfaceAttrib, int)
55 {
56 return 0;
57 }
58
59 virtual bool supports_input() const
60 {
61 return false;
62 }
63
64 virtual int client_input_fd() const
65 {
66 return 0;
67 }
68};
69
70}
71}
72} // namespace mir
73
74#endif // MIR_TEST_DOUBLES_STUB_SURFACE_H_
750
=== modified file 'include/test/mir_test_framework/cross_process_sync.h'
--- include/test/mir_test_framework/cross_process_sync.h 2013-09-20 22:16:11 +0000
+++ include/test/mir_test_framework/cross_process_sync.h 2013-11-28 12:22:03 +0000
@@ -45,7 +45,7 @@
45 // Throws std::runtime_error if not successful.45 // Throws std::runtime_error if not successful.
46 unsigned int wait_for_signal_ready_for(const std::chrono::milliseconds& duration);46 unsigned int wait_for_signal_ready_for(const std::chrono::milliseconds& duration);
47 unsigned int wait_for_signal_ready_for();47 unsigned int wait_for_signal_ready_for();
48 48
49 void signal_ready();49 void signal_ready();
50 unsigned int wait_for_signal_ready();50 unsigned int wait_for_signal_ready();
5151
5252
=== modified file 'include/test/mir_test_framework/input_testing_server_configuration.h'
--- include/test/mir_test_framework/input_testing_server_configuration.h 2013-11-21 03:16:21 +0000
+++ include/test/mir_test_framework/input_testing_server_configuration.h 2013-11-28 12:22:03 +0000
@@ -59,7 +59,7 @@
5959
60 void exec();60 void exec();
61 void on_exit();61 void on_exit();
62 62
63 std::shared_ptr<mir::input::InputConfiguration> the_input_configuration() override;63 std::shared_ptr<mir::input::InputConfiguration> the_input_configuration() override;
6464
65 mir::input::android::FakeEventHub* fake_event_hub;65 mir::input::android::FakeEventHub* fake_event_hub;
@@ -71,7 +71,7 @@
7171
72private:72private:
73 std::thread input_injection_thread;73 std::thread input_injection_thread;
74 74
75 std::shared_ptr<mir::test::doubles::FakeEventHubInputConfiguration> input_configuration;75 std::shared_ptr<mir::test::doubles::FakeEventHubInputConfiguration> input_configuration;
76};76};
7777
7878
=== modified file 'include/test/mir_test_framework/testing_client_configuration.h'
--- include/test/mir_test_framework/testing_client_configuration.h 2013-09-25 18:25:11 +0000
+++ include/test/mir_test_framework/testing_client_configuration.h 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36 virtual bool use_real_graphics(mir::options::Option const& options)36 virtual bool use_real_graphics(mir::options::Option const& options)
37 {37 {
38 return options.get("tests-use-real-graphics", false);38 return options.get("tests-use-real-graphics", false);
39 } 39 }
40};40};
4141
42}42}
4343
=== modified file 'native-compile.sh'
--- native-compile.sh 2012-11-19 19:21:52 +0000
+++ native-compile.sh 2013-11-28 12:22:03 +0000
@@ -12,6 +12,6 @@
12cmake --build ${BUILD_DIR}12cmake --build ${BUILD_DIR}
1313
14GTEST_OUTPUT=xml:./14GTEST_OUTPUT=xml:./
15${BUILD_DIR}/bin/acceptance-tests15${BUILD_DIR}/bin/mir_acceptance_tests
16${BUILD_DIR}/bin/integration-tests16${BUILD_DIR}/bin/mir_integration_tests
17${BUILD_DIR}/bin/unit-tests17${BUILD_DIR}/bin/mir_unit_tests
1818
=== modified file 'src/client/aging_buffer.h'
--- src/client/aging_buffer.h 2013-06-14 09:00:20 +0000
+++ src/client/aging_buffer.h 2013-11-28 12:22:03 +0000
@@ -30,7 +30,6 @@
30{30{
31public:31public:
32 AgingBuffer();32 AgingBuffer();
33 ~AgingBuffer() noexcept {}
3433
35 virtual uint32_t age() const;34 virtual uint32_t age() const;
36 virtual void increment_age();35 virtual void increment_age();
3736
=== modified file 'src/client/android/android_client_platform.cpp'
--- src/client/android/android_client_platform.cpp 2013-10-15 08:53:10 +0000
+++ src/client/android/android_client_platform.cpp 2013-11-28 12:22:03 +0000
@@ -105,9 +105,9 @@
105105
106MirPlatformType mcla::AndroidClientPlatform::platform_type() const106MirPlatformType mcla::AndroidClientPlatform::platform_type() const
107{107{
108 return mir_platform_type_android; 108 return mir_platform_type_android;
109}109}
110 110
111MirNativeBuffer* mcla::AndroidClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const111MirNativeBuffer* mcla::AndroidClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const
112{112{
113 return buf->anwb();113 return buf->anwb();
114114
=== modified file 'src/client/android/android_client_platform.h'
--- src/client/android/android_client_platform.h 2013-10-15 08:53:10 +0000
+++ src/client/android/android_client_platform.h 2013-11-28 12:22:03 +0000
@@ -32,7 +32,7 @@
32class AndroidClientPlatform : public ClientPlatform32class AndroidClientPlatform : public ClientPlatform
33{33{
34public:34public:
35 MirPlatformType platform_type() const; 35 MirPlatformType platform_type() const;
36 std::shared_ptr<ClientBufferFactory> create_buffer_factory();36 std::shared_ptr<ClientBufferFactory> create_buffer_factory();
37 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);37 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);
38 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();38 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
3939
=== modified file 'src/client/android/android_registrar.cpp'
--- src/client/android/android_registrar.cpp 2013-08-28 03:41:48 +0000
+++ src/client/android/android_registrar.cpp 2013-11-28 12:22:03 +0000
@@ -75,7 +75,7 @@
75 std::shared_ptr<MirBufferPackage> const& package) const75 std::shared_ptr<MirBufferPackage> const& package) const
76{76{
77 int native_handle_header_size = sizeof(native_handle_t);77 int native_handle_header_size = sizeof(native_handle_t);
78 int total_size = sizeof(int) * 78 int total_size = sizeof(int) *
79 (package->fd_items + package->data_items + native_handle_header_size);79 (package->fd_items + package->data_items + native_handle_header_size);
80 native_handle_t* handle = static_cast<native_handle_t*>(::operator new(total_size));80 native_handle_t* handle = static_cast<native_handle_t*>(::operator new(total_size));
81 handle->version = native_handle_header_size;81 handle->version = native_handle_header_size;
8282
=== modified file 'src/client/android/client_surface_interpreter.cpp'
--- src/client/android/client_surface_interpreter.cpp 2013-11-21 03:16:21 +0000
+++ src/client/android/client_surface_interpreter.cpp 2013-11-28 12:22:03 +0000
@@ -29,7 +29,7 @@
29 : surface(surface),29 : surface(surface),
30 driver_pixel_format(-1),30 driver_pixel_format(-1),
31 sync_ops(std::make_shared<mga::RealSyncFileOps>())31 sync_ops(std::make_shared<mga::RealSyncFileOps>())
32 32
33{33{
34}34}
3535
3636
=== modified file 'src/client/android/client_surface_interpreter.h'
--- src/client/android/client_surface_interpreter.h 2013-10-15 08:53:10 +0000
+++ src/client/android/client_surface_interpreter.h 2013-11-28 12:22:03 +0000
@@ -30,7 +30,7 @@
30{30{
31class SyncFileOps;31class SyncFileOps;
32}32}
33} 33}
34namespace client34namespace client
35{35{
36namespace android36namespace android
3737
=== modified file 'src/client/client_buffer.h'
--- src/client/client_buffer.h 2013-10-15 08:53:10 +0000
+++ src/client/client_buffer.h 2013-11-28 12:22:03 +0000
@@ -54,6 +54,7 @@
54{54{
55public:55public:
56 virtual ~ClientBuffer() = default;56 virtual ~ClientBuffer() = default;
57
57 virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;58 virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;
58 virtual geometry::Size size() const = 0;59 virtual geometry::Size size() const = 0;
59 virtual geometry::Stride stride() const = 0;60 virtual geometry::Stride stride() const = 0;
@@ -62,6 +63,11 @@
62 virtual void increment_age() = 0;63 virtual void increment_age() = 0;
63 virtual void mark_as_submitted() = 0;64 virtual void mark_as_submitted() = 0;
64 virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const = 0;65 virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const = 0;
66
67protected:
68 ClientBuffer() = default;
69 ClientBuffer(ClientBuffer const&) = delete;
70 ClientBuffer& operator=(ClientBuffer const&) = delete;
65};71};
6672
67}73}
6874
=== modified file 'src/client/client_platform.h'
--- src/client/client_platform.h 2013-10-15 08:53:10 +0000
+++ src/client/client_platform.h 2013-11-28 12:22:03 +0000
@@ -46,7 +46,7 @@
4646
47 virtual ~ClientPlatform() { /* TODO: make nothrow */ }47 virtual ~ClientPlatform() { /* TODO: make nothrow */ }
4848
49 virtual MirPlatformType platform_type() const = 0; 49 virtual MirPlatformType platform_type() const = 0;
50 virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0;50 virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0;
51 virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0;51 virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0;
52 virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0;52 virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0;
5353
=== modified file 'src/client/default_connection_configuration.cpp'
--- src/client/default_connection_configuration.cpp 2013-11-21 03:16:21 +0000
+++ src/client/default_connection_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -128,7 +128,7 @@
128 {128 {
129 auto val_raw = getenv("MIR_CLIENT_INPUT_RECEIVER_REPORT");129 auto val_raw = getenv("MIR_CLIENT_INPUT_RECEIVER_REPORT");
130 std::string const val{val_raw ? val_raw : off_opt_val};130 std::string const val{val_raw ? val_raw : off_opt_val};
131 131
132 if (val == log_opt_val)132 if (val == log_opt_val)
133 return std::make_shared<mcl::logging::InputReceiverReport>(the_logger());133 return std::make_shared<mcl::logging::InputReceiverReport>(the_logger());
134 else134 else
135135
=== modified file 'src/client/display_configuration.cpp'
--- src/client/display_configuration.cpp 2013-10-15 08:53:10 +0000
+++ src/client/display_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -48,8 +48,8 @@
48{48{
49 num_modes = num_modes_;49 num_modes = num_modes_;
50 modes = new MirDisplayMode[num_modes];50 modes = new MirDisplayMode[num_modes];
51 51
52 num_output_formats = num_formats; 52 num_output_formats = num_formats;
53 output_formats = new MirPixelFormat[num_formats];53 output_formats = new MirPixelFormat[num_formats];
54}54}
5555
@@ -77,8 +77,8 @@
77 for (auto i = 0u; i < output.num_modes; i++)77 for (auto i = 0u; i < output.num_modes; i++)
78 {78 {
79 auto mode = msg.mode(i);79 auto mode = msg.mode(i);
80 output.modes[i].horizontal_resolution = mode.horizontal_resolution(); 80 output.modes[i].horizontal_resolution = mode.horizontal_resolution();
81 output.modes[i].vertical_resolution = mode.vertical_resolution(); 81 output.modes[i].vertical_resolution = mode.vertical_resolution();
82 output.modes[i].refresh_rate = mode.refresh_rate();82 output.modes[i].refresh_rate = mode.refresh_rate();
83 }83 }
84 output.preferred_mode = msg.preferred_mode();84 output.preferred_mode = msg.preferred_mode();
@@ -161,7 +161,7 @@
161 {161 {
162 auto new_info = &new_config->outputs[i];162 auto new_info = &new_config->outputs[i];
163 MirDisplayOutput* output = outputs[i].get();163 MirDisplayOutput* output = outputs[i].get();
164 std::memcpy(new_info, output, sizeof(MirDisplayOutput)); 164 std::memcpy(new_info, output, sizeof(MirDisplayOutput));
165165
166 new_info->output_formats = new MirPixelFormat[new_info->num_output_formats];166 new_info->output_formats = new MirPixelFormat[new_info->num_output_formats];
167 auto format_size = sizeof(MirPixelFormat) * new_info->num_output_formats;167 auto format_size = sizeof(MirPixelFormat) * new_info->num_output_formats;
168168
=== renamed file 'src/client/gbm/drm_fd_handler.h' => 'src/client/gbm/buffer_file_ops.h'
--- src/client/gbm/drm_fd_handler.h 2013-04-24 05:22:20 +0000
+++ src/client/gbm/buffer_file_ops.h 2013-11-28 12:22:03 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */17 */
1818
19#ifndef MIR_CLIENT_GBM_DRM_FD_HANDLER_19#ifndef MIR_CLIENT_GBM_BUFFER_FILE_OPS_
20#define MIR_CLIENT_GBM_DRM_FD_HANDLER_20#define MIR_CLIENT_GBM_BUFFER_FILE_OPS_
2121
22#include <sys/types.h>22#include <sys/types.h>
2323
@@ -28,25 +28,23 @@
28namespace gbm28namespace gbm
29{29{
3030
31class DRMFDHandler31class BufferFileOps
32{32{
33public:33public:
34 virtual ~DRMFDHandler() {}34 virtual ~BufferFileOps() = default;
3535
36 virtual int ioctl(unsigned long request, void* arg) = 0;36 virtual int close(int fd) const = 0;
37 virtual int primeFDToHandle(int prime_fd, uint32_t *handle) = 0;37 virtual void* map(int fd, off_t offset, size_t size) const = 0;
38 virtual int close(int fd) = 0;38 virtual void unmap(void* addr, size_t size) const = 0;
39 virtual void* map(size_t size, off_t offset) = 0;
40 virtual void unmap(void* addr, size_t size) = 0;
4139
42protected:40protected:
43 DRMFDHandler() = default;41 BufferFileOps() = default;
44 DRMFDHandler(const DRMFDHandler&) = delete;42 BufferFileOps(BufferFileOps const&) = delete;
45 DRMFDHandler& operator=(const DRMFDHandler&) = delete;43 BufferFileOps& operator=(BufferFileOps const&) = delete;
46};44};
4745
48}46}
49}47}
50}48}
5149
52#endif /* MIR_CLIENT_GBM_DRM_FD_HANDLER_ */50#endif /* MIR_CLIENT_GBM_BUFFER_FILE_OPS_ */
5351
=== modified file 'src/client/gbm/gbm_client_buffer.cpp'
--- src/client/gbm/gbm_client_buffer.cpp 2013-11-21 03:16:21 +0000
+++ src/client/gbm/gbm_client_buffer.cpp 2013-11-28 12:22:03 +0000
@@ -18,15 +18,13 @@
1818
19#include "mir_toolkit/mir_client_library.h"19#include "mir_toolkit/mir_client_library.h"
20#include "gbm_client_buffer.h"20#include "gbm_client_buffer.h"
21#include "drm_fd_handler.h"21#include "buffer_file_ops.h"
2222
23#include <boost/exception/errinfo_errno.hpp>23#include <boost/exception/errinfo_errno.hpp>
24#include <boost/throw_exception.hpp>24#include <boost/throw_exception.hpp>
2525
26#include <stdexcept>26#include <stdexcept>
2727
28#include <xf86drm.h>
29#include <string.h>
30#include <errno.h>28#include <errno.h>
31#include <sys/mman.h>29#include <sys/mman.h>
3230
@@ -37,71 +35,29 @@
37namespace35namespace
38{36{
3937
40struct GEMHandle
41{
42 GEMHandle(std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler,
43 int prime_fd)
44 : drm_fd_handler{drm_fd_handler}
45 {
46 int ret = drm_fd_handler->primeFDToHandle(prime_fd, &handle);
47 if (ret)
48 {
49 std::string msg("Failed to import PRIME fd for DRM buffer");
50 BOOST_THROW_EXCEPTION(
51 boost::enable_error_info(
52 std::runtime_error(msg)) << boost::errinfo_errno(errno));
53 }
54 }
55
56 ~GEMHandle()
57 {
58 struct drm_gem_close arg;
59 arg.handle = handle;
60 // TODO (@raof): Error reporting? I do not believe it should be possible for this to fail,
61 // so if it does we should probably flag it.
62 drm_fd_handler->ioctl(DRM_IOCTL_GEM_CLOSE, &arg);
63 }
64
65 std::shared_ptr<mclg::DRMFDHandler> const drm_fd_handler;
66 uint32_t handle;
67};
68
69struct NullDeleter38struct NullDeleter
70{39{
71 void operator()(char *) const {}40 void operator()(char *) const {}
72};41};
7342
74struct GBMMemoryRegion : mcl::MemoryRegion43struct ShmMemoryRegion : mcl::MemoryRegion
75{44{
76 GBMMemoryRegion(std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler,45 ShmMemoryRegion(std::shared_ptr<mclg::BufferFileOps> const& buffer_file_ops,
77 int prime_fd, geom::Size const& size_param,46 int buffer_fd, geom::Size const& size_param,
78 geom::Stride stride_param, geom::PixelFormat format_param)47 geom::Stride stride_param, geom::PixelFormat format_param)
79 : drm_fd_handler{drm_fd_handler},48 : buffer_file_ops{buffer_file_ops},
80 gem_handle{drm_fd_handler, prime_fd},
81 size_in_bytes{size_param.height.as_uint32_t() * stride_param.as_uint32_t()}49 size_in_bytes{size_param.height.as_uint32_t() * stride_param.as_uint32_t()}
82 {50 {
51 static off_t const map_offset = 0;
83 width = size_param.width;52 width = size_param.width;
84 height = size_param.height;53 height = size_param.height;
85 stride = stride_param;54 stride = stride_param;
86 format = format_param;55 format = format_param;
8756
88 struct drm_mode_map_dumb map_dumb;57 void* map = buffer_file_ops->map(buffer_fd, map_offset, size_in_bytes);
89 memset(&map_dumb, 0, sizeof(map_dumb));
90 map_dumb.handle = gem_handle.handle;
91
92 int ret = drm_fd_handler->ioctl(DRM_IOCTL_MODE_MAP_DUMB, &map_dumb);
93 if (ret)
94 {
95 std::string msg("Failed to map dumb DRM buffer");
96 BOOST_THROW_EXCEPTION(
97 boost::enable_error_info(
98 std::runtime_error(msg)) << boost::errinfo_errno(errno));
99 }
100
101 void* map = drm_fd_handler->map(size_in_bytes, map_dumb.offset);
102 if (map == MAP_FAILED)58 if (map == MAP_FAILED)
103 {59 {
104 std::string msg("Failed to mmap DRM buffer");60 std::string msg("Failed to mmap buffer");
105 BOOST_THROW_EXCEPTION(61 BOOST_THROW_EXCEPTION(
106 boost::enable_error_info(62 boost::enable_error_info(
107 std::runtime_error(msg)) << boost::errinfo_errno(errno));63 std::runtime_error(msg)) << boost::errinfo_errno(errno));
@@ -110,24 +66,23 @@
110 vaddr = std::shared_ptr<char>(static_cast<char*>(map), NullDeleter());66 vaddr = std::shared_ptr<char>(static_cast<char*>(map), NullDeleter());
111 }67 }
11268
113 ~GBMMemoryRegion()69 ~ShmMemoryRegion()
114 {70 {
115 drm_fd_handler->unmap(vaddr.get(), size_in_bytes);71 buffer_file_ops->unmap(vaddr.get(), size_in_bytes);
116 }72 }
11773
118 std::shared_ptr<mclg::DRMFDHandler> const drm_fd_handler;74 std::shared_ptr<mclg::BufferFileOps> const buffer_file_ops;
119 GEMHandle const gem_handle;
120 size_t const size_in_bytes;75 size_t const size_in_bytes;
121};76};
12277
123}78}
12479
125mclg::GBMClientBuffer::GBMClientBuffer(80mclg::GBMClientBuffer::GBMClientBuffer(
126 std::shared_ptr<mclg::DRMFDHandler> const& drm_fd_handler,81 std::shared_ptr<mclg::BufferFileOps> const& buffer_file_ops,
127 std::shared_ptr<MirBufferPackage> const& package,82 std::shared_ptr<MirBufferPackage> const& package,
128 geom::Size size, geom::PixelFormat pf)83 geom::Size size, geom::PixelFormat pf)
129 : drm_fd_handler{drm_fd_handler},84 : buffer_file_ops{buffer_file_ops},
130 creation_package(std::move(package)),85 creation_package{package},
131 rect({geom::Point{0, 0}, size}),86 rect({geom::Point{0, 0}, size}),
132 buffer_pf{pf}87 buffer_pf{pf}
133{88{
@@ -137,15 +92,15 @@
137{92{
138 // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does,93 // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does,
139 // something's seriously wrong.94 // something's seriously wrong.
140 drm_fd_handler->close(creation_package->fd[0]);95 buffer_file_ops->close(creation_package->fd[0]);
141}96}
14297
143std::shared_ptr<mcl::MemoryRegion> mclg::GBMClientBuffer::secure_for_cpu_write()98std::shared_ptr<mcl::MemoryRegion> mclg::GBMClientBuffer::secure_for_cpu_write()
144{99{
145 const int prime_fd = creation_package->fd[0];100 int const buffer_fd = creation_package->fd[0];
146101
147 return std::make_shared<GBMMemoryRegion>(drm_fd_handler,102 return std::make_shared<ShmMemoryRegion>(buffer_file_ops,
148 prime_fd,103 buffer_fd,
149 size(),104 size(),
150 stride(),105 stride(),
151 pixel_format());106 pixel_format());
152107
=== modified file 'src/client/gbm/gbm_client_buffer.h'
--- src/client/gbm/gbm_client_buffer.h 2013-11-21 03:16:21 +0000
+++ src/client/gbm/gbm_client_buffer.h 2013-11-28 12:22:03 +0000
@@ -33,17 +33,17 @@
33namespace gbm33namespace gbm
34{34{
3535
36class DRMFDHandler;36class BufferFileOps;
3737
38class GBMClientBuffer : public AgingBuffer38class GBMClientBuffer : public AgingBuffer
39{39{
40public:40public:
41 GBMClientBuffer(std::shared_ptr<DRMFDHandler> const& drm_fd_handler,41 GBMClientBuffer(std::shared_ptr<BufferFileOps> const& buffer_file_ops,
42 std::shared_ptr<MirBufferPackage> const& buffer_package,42 std::shared_ptr<MirBufferPackage> const& buffer_package,
43 geometry::Size size,43 geometry::Size size,
44 geometry::PixelFormat pf);44 geometry::PixelFormat pf);
4545
46 virtual ~GBMClientBuffer() noexcept;46 ~GBMClientBuffer() noexcept;
4747
48 std::shared_ptr<MemoryRegion> secure_for_cpu_write();48 std::shared_ptr<MemoryRegion> secure_for_cpu_write();
49 geometry::Size size() const;49 geometry::Size size() const;
@@ -51,13 +51,11 @@
51 geometry::PixelFormat pixel_format() const;51 geometry::PixelFormat pixel_format() const;
52 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;52 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
5353
54 GBMClientBuffer(const GBMClientBuffer&) = delete;
55 GBMClientBuffer& operator=(const GBMClientBuffer&) = delete;
56private:54private:
57 const std::shared_ptr<DRMFDHandler> drm_fd_handler;55 std::shared_ptr<BufferFileOps> const buffer_file_ops;
58 const std::shared_ptr<MirBufferPackage> creation_package;56 std::shared_ptr<MirBufferPackage> const creation_package;
59 const geometry::Rectangle rect;57 geometry::Rectangle const rect;
60 const geometry::PixelFormat buffer_pf;58 geometry::PixelFormat const buffer_pf;
61};59};
6260
63}61}
6462
=== modified file 'src/client/gbm/gbm_client_buffer_factory.cpp'
--- src/client/gbm/gbm_client_buffer_factory.cpp 2013-11-21 03:16:21 +0000
+++ src/client/gbm/gbm_client_buffer_factory.cpp 2013-11-28 12:22:03 +0000
@@ -24,8 +24,8 @@
24namespace mclg=mir::client::gbm;24namespace mclg=mir::client::gbm;
2525
26mclg::GBMClientBufferFactory::GBMClientBufferFactory(26mclg::GBMClientBufferFactory::GBMClientBufferFactory(
27 std::shared_ptr<DRMFDHandler> const& drm_fd_handler)27 std::shared_ptr<BufferFileOps> const& buffer_file_ops)
28 : drm_fd_handler{drm_fd_handler}28 : buffer_file_ops{buffer_file_ops}
29{29{
30}30}
3131
@@ -33,7 +33,7 @@
33{33{
34 (void)size; // TODO: remove this unused parameter34 (void)size; // TODO: remove this unused parameter
35 return std::make_shared<mclg::GBMClientBuffer>(35 return std::make_shared<mclg::GBMClientBuffer>(
36 drm_fd_handler,36 buffer_file_ops,
37 package,37 package,
38 geometry::Size{package->width, package->height},38 geometry::Size{package->width, package->height},
39 pf);39 pf);
4040
=== modified file 'src/client/gbm/gbm_client_buffer_factory.h'
--- src/client/gbm/gbm_client_buffer_factory.h 2013-04-24 05:22:20 +0000
+++ src/client/gbm/gbm_client_buffer_factory.h 2013-11-28 12:22:03 +0000
@@ -32,17 +32,17 @@
32namespace gbm32namespace gbm
33{33{
3434
35class DRMFDHandler;35class BufferFileOps;
3636
37class GBMClientBufferFactory : public ClientBufferFactory37class GBMClientBufferFactory : public ClientBufferFactory
38{38{
39public:39public:
40 explicit GBMClientBufferFactory(std::shared_ptr<DRMFDHandler> const& drm_fd_handler);40 explicit GBMClientBufferFactory(std::shared_ptr<BufferFileOps> const& buffer_file_ops);
4141
42 std::shared_ptr<ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package,42 std::shared_ptr<ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package,
43 geometry::Size size, geometry::PixelFormat pf);43 geometry::Size size, geometry::PixelFormat pf);
44private:44private:
45 std::shared_ptr<DRMFDHandler> drm_fd_handler;45 std::shared_ptr<BufferFileOps> const buffer_file_ops;
46};46};
4747
48}48}
4949
=== modified file 'src/client/gbm/gbm_client_platform.cpp'
--- src/client/gbm/gbm_client_platform.cpp 2013-10-15 08:53:10 +0000
+++ src/client/gbm/gbm_client_platform.cpp 2013-11-28 12:22:03 +0000
@@ -20,7 +20,7 @@
20#include "gbm_client_platform.h"20#include "gbm_client_platform.h"
21#include "gbm_client_buffer_factory.h"21#include "gbm_client_buffer_factory.h"
22#include "mesa_native_display_container.h"22#include "mesa_native_display_container.h"
23#include "drm_fd_handler.h"23#include "buffer_file_ops.h"
24#include "gbm_native_surface.h"24#include "gbm_native_surface.h"
25#include "../mir_connection.h"25#include "../mir_connection.h"
26#include "../client_buffer_factory.h"26#include "../client_buffer_factory.h"
@@ -37,24 +37,9 @@
37namespace37namespace
38{38{
3939
40class RealDRMFDHandler : public mclg::DRMFDHandler40struct RealBufferFileOps : public mclg::BufferFileOps
41{41{
42public:42 int close(int fd) const
43 RealDRMFDHandler(int drm_fd) : drm_fd{drm_fd}
44 {
45 }
46
47 int ioctl(unsigned long request, void* arg)
48 {
49 return drmIoctl(drm_fd, request, arg);
50 }
51
52 int primeFDToHandle(int prime_fd, uint32_t *handle)
53 {
54 return drmPrimeFDToHandle(drm_fd, prime_fd, handle);
55 }
56
57 int close(int fd)
58 {43 {
59 while (::close(fd) == -1)44 while (::close(fd) == -1)
60 {45 {
@@ -65,19 +50,16 @@
65 return 0;50 return 0;
66 }51 }
6752
68 void* map(size_t size, off_t offset)53 void* map(int fd, off_t offset, size_t size) const
69 {54 {
70 return mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED,55 return mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,
71 drm_fd, offset);56 fd, offset);
72 }57 }
7358
74 void unmap(void* addr, size_t size)59 void unmap(void* addr, size_t size) const
75 {60 {
76 munmap(addr, size);61 munmap(addr, size);
77 }62 }
78
79private:
80 int drm_fd;
81};63};
8264
83struct NativeDisplayDeleter65struct NativeDisplayDeleter
@@ -101,33 +83,24 @@
101std::shared_ptr<mcl::ClientPlatform>83std::shared_ptr<mcl::ClientPlatform>
102mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context)84mcl::NativeClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
103{85{
104 MirPlatformPackage platform_package;86 auto buffer_file_ops = std::make_shared<RealBufferFileOps>();
10587 return std::make_shared<mclg::GBMClientPlatform>(
106 memset(&platform_package, 0, sizeof(platform_package));88 context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());
107 context->populate(platform_package);
108
109 int drm_fd = -1;
110
111 if (platform_package.fd_items > 0)
112 drm_fd = platform_package.fd[0];
113
114 auto drm_fd_handler = std::make_shared<RealDRMFDHandler>(drm_fd);
115 return std::make_shared<mclg::GBMClientPlatform>(context, drm_fd_handler, mcl::EGLNativeDisplayContainer::instance());
116}89}
11790
118mclg::GBMClientPlatform::GBMClientPlatform(91mclg::GBMClientPlatform::GBMClientPlatform(
119 ClientContext* const context,92 ClientContext* const context,
120 std::shared_ptr<DRMFDHandler> const& drm_fd_handler,93 std::shared_ptr<BufferFileOps> const& buffer_file_ops,
121 mcl::EGLNativeDisplayContainer& display_container)94 mcl::EGLNativeDisplayContainer& display_container)
122 : context{context},95 : context{context},
123 drm_fd_handler{drm_fd_handler},96 buffer_file_ops{buffer_file_ops},
124 display_container(display_container)97 display_container(display_container)
125{98{
126}99}
127100
128std::shared_ptr<mcl::ClientBufferFactory> mclg::GBMClientPlatform::create_buffer_factory()101std::shared_ptr<mcl::ClientBufferFactory> mclg::GBMClientPlatform::create_buffer_factory()
129{102{
130 return std::make_shared<mclg::GBMClientBufferFactory>(drm_fd_handler);103 return std::make_shared<mclg::GBMClientBufferFactory>(buffer_file_ops);
131}104}
132105
133namespace106namespace
@@ -153,7 +126,7 @@
153 //TODO: this is awkward on both android and gbm...126 //TODO: this is awkward on both android and gbm...
154 auto gbm_window = new GBMNativeSurface(*client_surface);127 auto gbm_window = new GBMNativeSurface(*client_surface);
155 auto egl_native_window = new EGLNativeWindowType;128 auto egl_native_window = new EGLNativeWindowType;
156 *egl_native_window = gbm_window; 129 *egl_native_window = gbm_window;
157 NativeWindowDeleter deleter(gbm_window);130 NativeWindowDeleter deleter(gbm_window);
158 return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);131 return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);
159}132}
@@ -169,8 +142,8 @@
169142
170MirPlatformType mclg::GBMClientPlatform::platform_type() const143MirPlatformType mclg::GBMClientPlatform::platform_type() const
171{144{
172 return mir_platform_type_gbm; 145 return mir_platform_type_gbm;
173} 146}
174147
175MirNativeBuffer* mclg::GBMClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const148MirNativeBuffer* mclg::GBMClientPlatform::convert_native_buffer(graphics::NativeBuffer* buf) const
176{149{
177150
=== modified file 'src/client/gbm/gbm_client_platform.h'
--- src/client/gbm/gbm_client_platform.h 2013-10-15 08:53:10 +0000
+++ src/client/gbm/gbm_client_platform.h 2013-11-28 12:22:03 +0000
@@ -30,16 +30,16 @@
30namespace gbm30namespace gbm
31{31{
3232
33class DRMFDHandler;33class BufferFileOps;
3434
35class GBMClientPlatform : public ClientPlatform35class GBMClientPlatform : public ClientPlatform
36{36{
37public:37public:
38 GBMClientPlatform(ClientContext* const context,38 GBMClientPlatform(ClientContext* const context,
39 std::shared_ptr<DRMFDHandler> const& drm_fd_handler,39 std::shared_ptr<BufferFileOps> const& buffer_file_ops,
40 EGLNativeDisplayContainer& display_container);40 EGLNativeDisplayContainer& display_container);
4141
42 MirPlatformType platform_type() const; 42 MirPlatformType platform_type() const;
43 std::shared_ptr<ClientBufferFactory> create_buffer_factory();43 std::shared_ptr<ClientBufferFactory> create_buffer_factory();
44 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);44 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);
45 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();45 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
@@ -47,7 +47,7 @@
4747
48private:48private:
49 ClientContext* const context;49 ClientContext* const context;
50 std::shared_ptr<DRMFDHandler> const drm_fd_handler;50 std::shared_ptr<BufferFileOps> const buffer_file_ops;
51 EGLNativeDisplayContainer& display_container;51 EGLNativeDisplayContainer& display_container;
52};52};
5353
5454
=== modified file 'src/client/gbm/gbm_native_surface.cpp'
--- src/client/gbm/gbm_native_surface.cpp 2013-06-28 00:25:30 +0000
+++ src/client/gbm/gbm_native_surface.cpp 2013-11-28 12:22:03 +0000
@@ -42,7 +42,7 @@
42{42{
43 auto s = static_cast<mclg::GBMNativeSurface*>(surface);43 auto s = static_cast<mclg::GBMNativeSurface*>(surface);
44 return s->set_swapinterval(interval);44 return s->set_swapinterval(interval);
45} 45}
4646
47static void buffer_advanced_callback(MirSurface* /* surface */,47static void buffer_advanced_callback(MirSurface* /* surface */,
48 void* /* context */)48 void* /* context */)
@@ -53,9 +53,9 @@
53mclg::GBMNativeSurface::GBMNativeSurface(ClientSurface& surface)53mclg::GBMNativeSurface::GBMNativeSurface(ClientSurface& surface)
54 : surface(surface)54 : surface(surface)
55{55{
56 surface_advance_buffer = advance_buffer_static; 56 surface_advance_buffer = advance_buffer_static;
57 surface_get_parameters = get_parameters_static; 57 surface_get_parameters = get_parameters_static;
58 surface_set_swapinterval = set_swapinterval_static; 58 surface_set_swapinterval = set_swapinterval_static;
59}59}
6060
61int mclg::GBMNativeSurface::advance_buffer(MirBufferPackage* buffer_package)61int mclg::GBMNativeSurface::advance_buffer(MirBufferPackage* buffer_package)
@@ -80,6 +80,6 @@
80 if ((interval < 0) || (interval > 1))80 if ((interval < 0) || (interval > 1))
81 return MIR_MESA_FALSE;81 return MIR_MESA_FALSE;
8282
83 mir_wait_for(surface.configure(mir_surface_attrib_swapinterval, interval)); 83 mir_wait_for(surface.configure(mir_surface_attrib_swapinterval, interval));
84 return MIR_MESA_TRUE;84 return MIR_MESA_TRUE;
85}85}
8686
=== modified file 'src/client/logging/input_receiver_report.cpp'
--- src/client/logging/input_receiver_report.cpp 2013-11-05 22:31:59 +0000
+++ src/client/logging/input_receiver_report.cpp 2013-11-28 12:22:03 +0000
@@ -118,7 +118,7 @@
118 std::stringstream ss;118 std::stringstream ss;
119119
120 ss << "Received event:" << std::endl;120 ss << "Received event:" << std::endl;
121 121
122 format_event(ss, event);122 format_event(ss, event);
123123
124 logger->log<ml::Logger::debug>(ss.str(), component);124 logger->log<ml::Logger::debug>(ss.str(), component);
125125
=== modified file 'src/client/mir_client_library.cpp'
--- src/client/mir_client_library.cpp 2013-11-21 03:16:21 +0000
+++ src/client/mir_client_library.cpp 2013-11-28 12:22:03 +0000
@@ -176,9 +176,9 @@
176 return conn;176 return conn;
177}177}
178178
179int mir_connection_is_valid(MirConnection * connection)179MirBool mir_connection_is_valid(MirConnection * connection)
180{180{
181 return MirConnection::is_valid(connection);181 return MirConnection::is_valid(connection) ? mir_true : mir_false;
182}182}
183183
184char const * mir_connection_get_error_message(MirConnection * connection)184char const * mir_connection_get_error_message(MirConnection * connection)
@@ -266,12 +266,12 @@
266266
267int mir_debug_surface_id(MirSurface * surface)267int mir_debug_surface_id(MirSurface * surface)
268{268{
269 return surface->id(); 269 return surface->id();
270}270}
271271
272int mir_surface_is_valid(MirSurface* surface)272MirBool mir_surface_is_valid(MirSurface* surface)
273{273{
274 return surface->is_valid();274 return surface->is_valid() ? mir_true : mir_false;
275}275}
276276
277char const * mir_surface_get_error_message(MirSurface * surface)277char const * mir_surface_get_error_message(MirSurface * surface)
278278
=== modified file 'src/client/mir_connection.cpp'
--- src/client/mir_connection.cpp 2013-11-21 03:16:21 +0000
+++ src/client/mir_connection.cpp 2013-11-28 12:22:03 +0000
@@ -370,7 +370,7 @@
370 for (auto i = 0u; i < valid_formats; i++)370 for (auto i = 0u; i < valid_formats; i++)
371 {371 {
372 formats[i] = static_cast<MirPixelFormat>(connect_result.surface_pixel_format(i));372 formats[i] = static_cast<MirPixelFormat>(connect_result.surface_pixel_format(i));
373 } 373 }
374 }374 }
375}375}
376376
@@ -458,11 +458,11 @@
458 {458 {
459 auto output = config->outputs[i];459 auto output = config->outputs[i];
460 auto display_request = request.add_display_output();460 auto display_request = request.add_display_output();
461 display_request->set_output_id(output.output_id); 461 display_request->set_output_id(output.output_id);
462 display_request->set_used(output.used); 462 display_request->set_used(output.used);
463 display_request->set_current_mode(output.current_mode); 463 display_request->set_current_mode(output.current_mode);
464 display_request->set_position_x(output.position_x); 464 display_request->set_position_x(output.position_x);
465 display_request->set_position_y(output.position_y); 465 display_request->set_position_y(output.position_y);
466 display_request->set_power_mode(output.power_mode);466 display_request->set_power_mode(output.power_mode);
467 }467 }
468468
469469
=== modified file 'src/client/mir_connection.h'
--- src/client/mir_connection.h 2013-11-21 03:16:21 +0000
+++ src/client/mir_connection.h 2013-11-28 12:22:03 +0000
@@ -105,7 +105,7 @@
105 void register_display_change_callback(mir_display_config_callback callback, void* context);105 void register_display_change_callback(mir_display_config_callback callback, void* context);
106106
107 void populate(MirPlatformPackage& platform_package);107 void populate(MirPlatformPackage& platform_package);
108 MirDisplayConfiguration* create_copy_of_display_config(); 108 MirDisplayConfiguration* create_copy_of_display_config();
109 void available_surface_formats(MirPixelFormat* formats,109 void available_surface_formats(MirPixelFormat* formats,
110 unsigned int formats_size, unsigned int& valid_formats);110 unsigned int formats_size, unsigned int& valid_formats);
111111
112112
=== modified file 'src/client/mir_surface.cpp'
--- src/client/mir_surface.cpp 2013-11-21 03:16:21 +0000
+++ src/client/mir_surface.cpp 2013-11-28 12:22:03 +0000
@@ -52,7 +52,7 @@
52 message.set_pixel_format(params.pixel_format);52 message.set_pixel_format(params.pixel_format);
53 message.set_buffer_usage(params.buffer_usage);53 message.set_buffer_usage(params.buffer_usage);
54 message.set_output_id(params.output_id);54 message.set_output_id(params.output_id);
55 55
56 server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context));56 server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context));
5757
58 for (int i = 0; i < mir_surface_attribs; i++)58 for (int i = 0; i < mir_surface_attribs; i++)
@@ -254,7 +254,7 @@
254{254{
255 std::lock_guard<std::recursive_mutex> lock(mutex);255 std::lock_guard<std::recursive_mutex> lock(mutex);
256256
257 return buffer_depository->current_buffer_id(); 257 return buffer_depository->current_buffer_id();
258}258}
259259
260void MirSurface::populate(MirBufferPackage& buffer_package)260void MirSurface::populate(MirBufferPackage& buffer_package)
261261
=== modified file 'src/client/rpc/mir_socket_rpc_channel.cpp'
--- src/client/rpc/mir_socket_rpc_channel.cpp 2013-11-21 03:16:21 +0000
+++ src/client/rpc/mir_socket_rpc_channel.cpp 2013-11-28 12:22:03 +0000
@@ -415,7 +415,7 @@
415 {415 {
416 rpc_report->event_parsing_failed(event);416 rpc_report->event_parsing_failed(event);
417 }417 }
418 } 418 }
419 }419 }
420}420}
421421
422422
=== modified file 'src/client/surface_map.cpp'
--- src/client/surface_map.cpp 2013-11-20 17:13:18 +0000
+++ src/client/surface_map.cpp 2013-11-28 12:22:03 +0000
@@ -42,7 +42,7 @@
42 ss << __PRETTY_FUNCTION__42 ss << __PRETTY_FUNCTION__
43 << "executed with non-existent surface ID "43 << "executed with non-existent surface ID "
44 << surface_id << ".\n";44 << surface_id << ".\n";
45 45
46 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));46 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));
47 }47 }
48}48}
@@ -50,11 +50,11 @@
50void mcl::ConnectionSurfaceMap::insert(int const& surface_id, MirSurface* surface)50void mcl::ConnectionSurfaceMap::insert(int const& surface_id, MirSurface* surface)
51{51{
52 std::unique_lock<std::mutex> lk(guard);52 std::unique_lock<std::mutex> lk(guard);
53 surfaces[surface_id] = surface; 53 surfaces[surface_id] = surface;
54}54}
5555
56void mcl::ConnectionSurfaceMap::erase(int surface_id)56void mcl::ConnectionSurfaceMap::erase(int surface_id)
57{57{
58 std::unique_lock<std::mutex> lk(guard);58 std::unique_lock<std::mutex> lk(guard);
59 surfaces.erase(surface_id); 59 surfaces.erase(surface_id);
60}60}
6161
=== modified file 'src/server/asio_main_loop.cpp'
--- src/server/asio_main_loop.cpp 2013-06-28 15:16:39 +0000
+++ src/server/asio_main_loop.cpp 2013-11-28 12:22:03 +0000
@@ -101,7 +101,7 @@
101 std::function<void(int)> handler;101 std::function<void(int)> handler;
102};102};
103103
104/* 104/*
105 * We need to define an empty constructor and destructor in the .cpp file,105 * We need to define an empty constructor and destructor in the .cpp file,
106 * so that we can use unique_ptr to hold SignalHandler. Otherwise, users106 * so that we can use unique_ptr to hold SignalHandler. Otherwise, users
107 * of AsioMainLoop end up creating default constructors and destructors107 * of AsioMainLoop end up creating default constructors and destructors
108108
=== modified file 'src/server/compositor/buffer_stream_surfaces.cpp'
--- src/server/compositor/buffer_stream_surfaces.cpp 2013-11-21 03:16:21 +0000
+++ src/server/compositor/buffer_stream_surfaces.cpp 2013-11-28 12:22:03 +0000
@@ -49,19 +49,29 @@
49 return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle);49 return std::make_shared<mc::TemporarySnapshotBuffer>(buffer_bundle);
50}50}
5151
52std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::secure_client_buffer()52void mc::BufferStreamSurfaces::swap_client_buffers(std::shared_ptr<mg::Buffer>& buffer)
53{53{
54 return std::make_shared<mc::TemporaryClientBuffer>(buffer_bundle);54 release_client_buffer(buffer);
55 buffer = buffer_bundle->client_acquire();
56}
57
58void mc::BufferStreamSurfaces::release_client_buffer(std::shared_ptr<mg::Buffer>& buffer)
59{
60 if (buffer)
61 {
62 buffer_bundle->client_release(buffer);
63 buffer.reset();
64 }
55}65}
5666
57geom::PixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format()67geom::PixelFormat mc::BufferStreamSurfaces::get_stream_pixel_format()
58{68{
59 return buffer_bundle->properties().format; 69 return buffer_bundle->properties().format;
60}70}
6171
62geom::Size mc::BufferStreamSurfaces::stream_size()72geom::Size mc::BufferStreamSurfaces::stream_size()
63{73{
64 return buffer_bundle->properties().size; 74 return buffer_bundle->properties().size;
65}75}
6676
67void mc::BufferStreamSurfaces::resize(geom::Size const& size)77void mc::BufferStreamSurfaces::resize(geom::Size const& size)
6878
=== modified file 'src/server/compositor/buffer_stream_surfaces.h'
--- src/server/compositor/buffer_stream_surfaces.h 2013-11-21 12:34:49 +0000
+++ src/server/compositor/buffer_stream_surfaces.h 2013-11-28 12:22:03 +0000
@@ -39,17 +39,18 @@
39 BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper);39 BufferStreamSurfaces(std::shared_ptr<BufferBundle> const& swapper);
40 ~BufferStreamSurfaces();40 ~BufferStreamSurfaces();
4141
42 std::shared_ptr<graphics::Buffer> secure_client_buffer();42 void swap_client_buffers(std::shared_ptr<graphics::Buffer>& buffer) override;
43 void release_client_buffer(std::shared_ptr<graphics::Buffer>& buffer) override;
4344
44 std::shared_ptr<graphics::Buffer>45 std::shared_ptr<graphics::Buffer>
45 lock_compositor_buffer(unsigned long frameno) override;46 lock_compositor_buffer(unsigned long frameno) override;
46 std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override;47 std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override;
4748
48 geometry::PixelFormat get_stream_pixel_format();49 geometry::PixelFormat get_stream_pixel_format() override;
49 geometry::Size stream_size();50 geometry::Size stream_size() override;
50 void resize(geometry::Size const& size) override;51 void resize(geometry::Size const& size) override;
51 void allow_framedropping(bool);52 void allow_framedropping(bool) override;
52 void force_requests_to_complete();53 void force_requests_to_complete() override;
5354
54protected:55protected:
55 BufferStreamSurfaces(const BufferStreamSurfaces&) = delete;56 BufferStreamSurfaces(const BufferStreamSurfaces&) = delete;
5657
=== modified file 'src/server/compositor/default_configuration.cpp'
--- src/server/compositor/default_configuration.cpp 2013-11-20 15:56:58 +0000
+++ src/server/compositor/default_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -20,7 +20,6 @@
20#include "buffer_stream_factory.h"20#include "buffer_stream_factory.h"
21#include "default_display_buffer_compositor_factory.h"21#include "default_display_buffer_compositor_factory.h"
22#include "multi_threaded_compositor.h"22#include "multi_threaded_compositor.h"
23#include "overlay_renderer.h"
24#include "gl_renderer_factory.h"23#include "gl_renderer_factory.h"
2524
26namespace mc = mir::compositor;25namespace mc = mir::compositor;
@@ -43,7 +42,7 @@
43 [this]()42 [this]()
44 {43 {
45 return std::make_shared<mc::DefaultDisplayBufferCompositorFactory>(44 return std::make_shared<mc::DefaultDisplayBufferCompositorFactory>(
46 the_scene(), the_renderer_factory(), the_overlay_renderer());45 the_scene(), the_renderer_factory());
47 });46 });
48}47}
4948
@@ -59,22 +58,6 @@
59 });58 });
60}59}
6160
62std::shared_ptr<mc::OverlayRenderer>
63mir::DefaultServerConfiguration::the_overlay_renderer()
64{
65 struct NullOverlayRenderer : public mc::OverlayRenderer
66 {
67 virtual void render(
68 geometry::Rectangle const&,
69 std::function<void(std::shared_ptr<void> const&)>) {}
70 };
71 return overlay_renderer(
72 [this]()
73 {
74 return std::make_shared<NullOverlayRenderer>();
75 });
76}
77
78std::shared_ptr<mc::RendererFactory> mir::DefaultServerConfiguration::the_renderer_factory()61std::shared_ptr<mc::RendererFactory> mir::DefaultServerConfiguration::the_renderer_factory()
79{62{
80 return renderer_factory(63 return renderer_factory(
8164
=== modified file 'src/server/compositor/default_display_buffer_compositor.cpp'
--- src/server/compositor/default_display_buffer_compositor.cpp 2013-11-21 03:16:21 +0000
+++ src/server/compositor/default_display_buffer_compositor.cpp 2013-11-28 12:22:03 +0000
@@ -19,7 +19,6 @@
19#include "default_display_buffer_compositor.h"19#include "default_display_buffer_compositor.h"
2020
21#include "rendering_operator.h"21#include "rendering_operator.h"
22#include "overlay_renderer.h"
23#include "mir/compositor/scene.h"22#include "mir/compositor/scene.h"
24#include "mir/compositor/compositing_criteria.h"23#include "mir/compositor/compositing_criteria.h"
25#include "mir/graphics/display_buffer.h"24#include "mir/graphics/display_buffer.h"
@@ -69,12 +68,10 @@
69mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor(68mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor(
70 mg::DisplayBuffer& display_buffer,69 mg::DisplayBuffer& display_buffer,
71 std::shared_ptr<mc::Scene> const& scene,70 std::shared_ptr<mc::Scene> const& scene,
72 std::shared_ptr<mc::Renderer> const& renderer,71 std::shared_ptr<mc::Renderer> const& renderer)
73 std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer)
74 : display_buffer(display_buffer),72 : display_buffer(display_buffer),
75 scene{scene},73 scene{scene},
76 renderer{renderer},74 renderer{renderer},
77 overlay_renderer{overlay_renderer},
78 local_frameno{global_frameno}75 local_frameno{global_frameno}
79{76{
80}77}
@@ -138,11 +135,10 @@
138 mc::OcclusionMatch occlusion_match;135 mc::OcclusionMatch occlusion_match;
139 scene->reverse_for_each_if(occlusion_search, occlusion_match);136 scene->reverse_for_each_if(occlusion_search, occlusion_match);
140137
141 renderer->clear(local_frameno);138 renderer->clear();
142 mc::RenderingOperator applicator(*renderer, save_resource);139 mc::RenderingOperator applicator(*renderer, save_resource, local_frameno);
143 FilterForVisibleSceneInRegion selector(view_area, occlusion_match);140 FilterForVisibleSceneInRegion selector(view_area, occlusion_match);
144 scene->for_each_if(selector, applicator);141 scene->for_each_if(selector, applicator);
145 overlay_renderer->render(view_area, save_resource);
146142
147 display_buffer.post_update();143 display_buffer.post_update();
148 }144 }
149145
=== modified file 'src/server/compositor/default_display_buffer_compositor.h'
--- src/server/compositor/default_display_buffer_compositor.h 2013-10-03 03:57:28 +0000
+++ src/server/compositor/default_display_buffer_compositor.h 2013-11-28 12:22:03 +0000
@@ -33,7 +33,6 @@
3333
34class Scene;34class Scene;
35class Renderer;35class Renderer;
36class OverlayRenderer;
3736
38class DefaultDisplayBufferCompositor : public DisplayBufferCompositor37class DefaultDisplayBufferCompositor : public DisplayBufferCompositor
39{38{
@@ -41,8 +40,7 @@
41 DefaultDisplayBufferCompositor(40 DefaultDisplayBufferCompositor(
42 graphics::DisplayBuffer& display_buffer,41 graphics::DisplayBuffer& display_buffer,
43 std::shared_ptr<Scene> const& scene,42 std::shared_ptr<Scene> const& scene,
44 std::shared_ptr<Renderer> const& renderer,43 std::shared_ptr<Renderer> const& renderer);
45 std::shared_ptr<OverlayRenderer> const& overlay_renderer);
4644
47 void composite() override;45 void composite() override;
4846
@@ -51,7 +49,6 @@
5149
52 std::shared_ptr<Scene> const scene;50 std::shared_ptr<Scene> const scene;
53 std::shared_ptr<Renderer> const renderer;51 std::shared_ptr<Renderer> const renderer;
54 std::shared_ptr<OverlayRenderer> const overlay_renderer;
5552
56 unsigned long local_frameno;53 unsigned long local_frameno;
57};54};
5855
=== modified file 'src/server/compositor/default_display_buffer_compositor_factory.cpp'
--- src/server/compositor/default_display_buffer_compositor_factory.cpp 2013-11-21 03:16:21 +0000
+++ src/server/compositor/default_display_buffer_compositor_factory.cpp 2013-11-28 12:22:03 +0000
@@ -28,11 +28,9 @@
2828
29mc::DefaultDisplayBufferCompositorFactory::DefaultDisplayBufferCompositorFactory(29mc::DefaultDisplayBufferCompositorFactory::DefaultDisplayBufferCompositorFactory(
30 std::shared_ptr<mc::Scene> const& scene,30 std::shared_ptr<mc::Scene> const& scene,
31 std::shared_ptr<mc::RendererFactory> const& renderer_factory,31 std::shared_ptr<mc::RendererFactory> const& renderer_factory)
32 std::shared_ptr<mc::OverlayRenderer> const& overlay_renderer)
33 : scene{scene},32 : scene{scene},
34 renderer_factory{renderer_factory},33 renderer_factory{renderer_factory}
35 overlay_renderer{overlay_renderer}
36{34{
37}35}
3836
@@ -41,8 +39,6 @@
41 graphics::DisplayBuffer& display_buffer)39 graphics::DisplayBuffer& display_buffer)
42{40{
43 auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area());41 auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area());
44 auto raw = new DefaultDisplayBufferCompositor{display_buffer, scene, std::move(renderer),42 auto raw = new DefaultDisplayBufferCompositor{display_buffer, scene, std::move(renderer)};
45 overlay_renderer};
46
47 return std::unique_ptr<DisplayBufferCompositor>(raw);43 return std::unique_ptr<DisplayBufferCompositor>(raw);
48}44}
4945
=== modified file 'src/server/compositor/default_display_buffer_compositor_factory.h'
--- src/server/compositor/default_display_buffer_compositor_factory.h 2013-11-21 03:16:21 +0000
+++ src/server/compositor/default_display_buffer_compositor_factory.h 2013-11-28 12:22:03 +0000
@@ -27,7 +27,6 @@
27namespace compositor27namespace compositor
28{28{
29class RendererFactory;29class RendererFactory;
30class OverlayRenderer;
31class Scene;30class Scene;
3231
33// TODO this is ideally an implementation class. It is only in a public header32// TODO this is ideally an implementation class. It is only in a public header
@@ -37,15 +36,13 @@
37public:36public:
38 DefaultDisplayBufferCompositorFactory(37 DefaultDisplayBufferCompositorFactory(
39 std::shared_ptr<Scene> const& scene,38 std::shared_ptr<Scene> const& scene,
40 std::shared_ptr<RendererFactory> const& renderer_factory,39 std::shared_ptr<RendererFactory> const& renderer_factory);
41 std::shared_ptr<OverlayRenderer> const& overlay_renderer);
4240
43 std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplayBuffer& display_buffer);41 std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplayBuffer& display_buffer);
4442
45private:43private:
46 std::shared_ptr<Scene> const scene;44 std::shared_ptr<Scene> const scene;
47 std::shared_ptr<RendererFactory> const renderer_factory;45 std::shared_ptr<RendererFactory> const renderer_factory;
48 std::shared_ptr<OverlayRenderer> const overlay_renderer;
49};46};
5047
51}48}
5249
=== modified file 'src/server/compositor/gl_renderer.cpp'
--- src/server/compositor/gl_renderer.cpp 2013-11-21 03:16:21 +0000
+++ src/server/compositor/gl_renderer.cpp 2013-11-28 12:22:03 +0000
@@ -26,6 +26,7 @@
26#include <boost/throw_exception.hpp>26#include <boost/throw_exception.hpp>
27#include <stdexcept>27#include <stdexcept>
2828
29namespace mg = mir::graphics;
29namespace mc = mir::compositor;30namespace mc = mir::compositor;
30namespace geom = mir::geometry;31namespace geom = mir::geometry;
3132
@@ -235,15 +236,11 @@
235}236}
236237
237mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area)238mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area)
238 : frameno{0}
239{239{
240 resources.setup(display_area);240 resources.setup(display_area);
241}241}
242242
243void mc::GLRenderer::render(243void mc::GLRenderer::render(CompositingCriteria const& criteria, mg::Buffer& buffer) const
244 std::function<void(std::shared_ptr<void> const&)> save_resource,
245 CompositingCriteria const& criteria,
246 BufferStream& stream)
247{244{
248 glUseProgram(resources.program);245 glUseProgram(resources.program);
249246
@@ -273,9 +270,7 @@
273 /* Use the renderable's texture */270 /* Use the renderable's texture */
274 glBindTexture(GL_TEXTURE_2D, resources.texture);271 glBindTexture(GL_TEXTURE_2D, resources.texture);
275272
276 auto region_resource = stream.lock_compositor_buffer(frameno);273 buffer.bind_to_texture();
277 region_resource->bind_to_texture();
278 save_resource(region_resource);
279274
280 /* Draw */275 /* Draw */
281 glEnableVertexAttribArray(resources.position_attr_loc);276 glEnableVertexAttribArray(resources.position_attr_loc);
@@ -285,9 +280,7 @@
285 glDisableVertexAttribArray(resources.position_attr_loc);280 glDisableVertexAttribArray(resources.position_attr_loc);
286}281}
287282
288void mc::GLRenderer::clear(unsigned long frame)283void mc::GLRenderer::clear() const
289{284{
290 frameno = frame;
291 glClear(GL_COLOR_BUFFER_BIT);285 glClear(GL_COLOR_BUFFER_BIT);
292}286}
293
294287
=== modified file 'src/server/compositor/gl_renderer.h'
--- src/server/compositor/gl_renderer.h 2013-11-21 03:16:21 +0000
+++ src/server/compositor/gl_renderer.h 2013-11-28 12:22:03 +0000
@@ -33,10 +33,8 @@
33public:33public:
34 GLRenderer(geometry::Rectangle const& display_area);34 GLRenderer(geometry::Rectangle const& display_area);
3535
36 /* From renderer */36 void render(CompositingCriteria const& info, graphics::Buffer& buffer) const override;
37 void render(std::function<void(std::shared_ptr<void> const&)> save_resource,37 void clear() const override;
38 CompositingCriteria const& info, BufferStream& stream);
39 void clear(unsigned long frameno) override;
4038
41 ~GLRenderer() noexcept {}39 ~GLRenderer() noexcept {}
4240
@@ -60,8 +58,6 @@
60 };58 };
6159
62 Resources resources;60 Resources resources;
63
64 unsigned long frameno;
65};61};
6662
67}63}
6864
=== removed file 'src/server/compositor/overlay_renderer.h'
--- src/server/compositor/overlay_renderer.h 2013-11-21 03:16:21 +0000
+++ src/server/compositor/overlay_renderer.h 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_COMPOSITOR_OVERLAY_RENDERER_H_
20#define MIR_COMPOSITOR_OVERLAY_RENDERER_H_
21
22#include <functional>
23#include <memory>
24
25namespace mir
26{
27namespace geometry
28{
29struct Rectangle;
30}
31
32namespace compositor
33{
34
35class OverlayRenderer
36{
37public:
38 virtual ~OverlayRenderer() = default;
39
40 virtual void render(
41 geometry::Rectangle const& view_area,
42 std::function<void(std::shared_ptr<void> const&)> save_resource) = 0;
43
44protected:
45 OverlayRenderer() = default;
46 OverlayRenderer& operator=(OverlayRenderer const&) = delete;
47 OverlayRenderer(OverlayRenderer const&) = delete;
48};
49
50}
51} // namespace mir
52
53#endif // MIR_COMPOSITOR_OVERLAY_RENDERER_H_
540
=== modified file 'src/server/compositor/renderer.h'
--- src/server/compositor/renderer.h 2013-11-21 03:16:21 +0000
+++ src/server/compositor/renderer.h 2013-11-28 12:22:03 +0000
@@ -19,14 +19,14 @@
19#ifndef MIR_COMPOSITOR_RENDERER_H_19#ifndef MIR_COMPOSITOR_RENDERER_H_
20#define MIR_COMPOSITOR_RENDERER_H_20#define MIR_COMPOSITOR_RENDERER_H_
2121
22#include <memory>
23#include <functional>
24
25namespace mir22namespace mir
26{23{
24namespace graphics
25{
26class Buffer;
27}
27namespace compositor28namespace compositor
28{29{
29class BufferStream;
30class CompositingCriteria;30class CompositingCriteria;
3131
32class Renderer32class Renderer
@@ -34,9 +34,8 @@
34public:34public:
35 virtual ~Renderer() = default;35 virtual ~Renderer() = default;
3636
37 virtual void clear(unsigned long frameno) = 0;37 virtual void clear() const = 0;
38 virtual void render(std::function<void(std::shared_ptr<void> const&)> save_resource,38 virtual void render(CompositingCriteria const& info, graphics::Buffer& buffer) const = 0;
39 CompositingCriteria const& info, BufferStream& stream) = 0;
4039
41protected:40protected:
42 Renderer() = default;41 Renderer() = default;
4342
=== modified file 'src/server/compositor/rendering_operator.cpp'
--- src/server/compositor/rendering_operator.cpp 2013-11-21 03:16:21 +0000
+++ src/server/compositor/rendering_operator.cpp 2013-11-28 12:22:03 +0000
@@ -17,22 +17,23 @@
17 */17 */
1818
19#include "rendering_operator.h"19#include "rendering_operator.h"
20#include "mir/compositor/buffer_stream.h"
2021
21namespace mc=mir::compositor;22namespace mc=mir::compositor;
2223
23mc::RenderingOperator::RenderingOperator(24mc::RenderingOperator::RenderingOperator(
24 Renderer& renderer,25 Renderer& renderer,
25 std::function<void(std::shared_ptr<void> const&)> save_resource) :26 std::function<void(std::shared_ptr<void> const&)> save_resource,
27 unsigned long frameno) :
26 renderer(renderer),28 renderer(renderer),
27 save_resource(save_resource)29 save_resource(save_resource),
28{30 frameno(frameno)
29}
30
31mc::RenderingOperator::~RenderingOperator()
32{31{
33}32}
3433
35void mc::RenderingOperator::operator()(CompositingCriteria const& info, BufferStream& stream)34void mc::RenderingOperator::operator()(CompositingCriteria const& info, BufferStream& stream)
36{35{
37 renderer.render(save_resource, info, stream);36 auto compositor_buffer = stream.lock_compositor_buffer(frameno);
37 renderer.render(info, *compositor_buffer);
38 save_resource(compositor_buffer);
38}39}
3940
=== modified file 'src/server/compositor/rendering_operator.h'
--- src/server/compositor/rendering_operator.h 2013-11-21 03:16:21 +0000
+++ src/server/compositor/rendering_operator.h 2013-11-28 12:22:03 +0000
@@ -32,14 +32,18 @@
32class RenderingOperator : public OperatorForScene32class RenderingOperator : public OperatorForScene
33{33{
34public:34public:
35 explicit RenderingOperator(Renderer& renderer, std::function<void(std::shared_ptr<void> const&)> save_resource);35 explicit RenderingOperator(
36 ~RenderingOperator();36 Renderer& renderer,
37 std::function<void(std::shared_ptr<void> const&)> save_resource,
38 unsigned long frameno);
39 ~RenderingOperator() = default;
3740
38 void operator()(CompositingCriteria const& info, BufferStream&);41 void operator()(CompositingCriteria const& info, BufferStream&);
3942
40private:43private:
41 Renderer& renderer;44 Renderer& renderer;
42 std::function<void(std::shared_ptr<void> const&)> save_resource;45 std::function<void(std::shared_ptr<void> const&)> save_resource;
46 unsigned long const frameno;
43};47};
4448
45}49}
4650
=== modified file 'src/server/compositor/switching_bundle.cpp'
--- src/server/compositor/switching_bundle.cpp 2013-11-21 03:16:21 +0000
+++ src/server/compositor/switching_bundle.cpp 2013-11-28 12:22:03 +0000
@@ -203,7 +203,7 @@
203 * but always uses 50% more memory. So try to avoid it when possible.203 * but always uses 50% more memory. So try to avoid it when possible.
204 */204 */
205205
206 int min_free = 206 int min_free =
207#if 0 // FIXME: This memory optimization breaks timing tests207#if 0 // FIXME: This memory optimization breaks timing tests
208 (nbuffers > 2 && !overlapping_compositors) ? nbuffers - 1 : 1;208 (nbuffers > 2 && !overlapping_compositors) ? nbuffers - 1 : 1;
209#else209#else
210210
=== modified file 'src/server/compositor/switching_bundle.h'
--- src/server/compositor/switching_bundle.h 2013-11-21 03:16:21 +0000
+++ src/server/compositor/switching_bundle.h 2013-11-28 12:22:03 +0000
@@ -35,7 +35,7 @@
35namespace compositor35namespace compositor
36{36{
3737
38class SwitchingBundle : public BufferBundle 38class SwitchingBundle : public BufferBundle
39{39{
40public:40public:
41 enum {min_buffers = 1, max_buffers = 5};41 enum {min_buffers = 1, max_buffers = 5};
4242
=== modified file 'src/server/compositor/temporary_buffers.cpp'
--- src/server/compositor/temporary_buffers.cpp 2013-10-15 08:53:10 +0000
+++ src/server/compositor/temporary_buffers.cpp 2013-11-28 12:22:03 +0000
@@ -28,18 +28,6 @@
28{28{
29}29}
3030
31mc::TemporaryClientBuffer::TemporaryClientBuffer(std::shared_ptr<BufferBundle> const& buffer_swapper)
32 : TemporaryBuffer(buffer_swapper->client_acquire()),
33 allocating_swapper(buffer_swapper)
34{
35}
36
37mc::TemporaryClientBuffer::~TemporaryClientBuffer()
38{
39 if (auto swapper = allocating_swapper.lock())
40 swapper->client_release(buffer);
41}
42
43mc::TemporaryCompositorBuffer::TemporaryCompositorBuffer(31mc::TemporaryCompositorBuffer::TemporaryCompositorBuffer(
44 std::shared_ptr<BufferBundle> const& bun, unsigned long frameno)32 std::shared_ptr<BufferBundle> const& bun, unsigned long frameno)
45 : TemporaryBuffer(bun->compositor_acquire(frameno)),33 : TemporaryBuffer(bun->compositor_acquire(frameno)),
4634
=== modified file 'src/server/compositor/temporary_buffers.h'
--- src/server/compositor/temporary_buffers.h 2013-10-15 08:53:10 +0000
+++ src/server/compositor/temporary_buffers.h 2013-11-28 12:22:03 +0000
@@ -48,16 +48,6 @@
48 std::shared_ptr<mg::Buffer> const buffer;48 std::shared_ptr<mg::Buffer> const buffer;
49};49};
5050
51class TemporaryClientBuffer : public TemporaryBuffer
52{
53public:
54 explicit TemporaryClientBuffer(std::shared_ptr<BufferBundle> const& buffer_swapper);
55 ~TemporaryClientBuffer();
56
57private:
58 std::weak_ptr<BufferBundle> const allocating_swapper;
59};
60
61class TemporaryCompositorBuffer : public TemporaryBuffer51class TemporaryCompositorBuffer : public TemporaryBuffer
62{52{
63public:53public:
6454
=== modified file 'src/server/default_server_configuration.cpp'
--- src/server/default_server_configuration.cpp 2013-11-21 12:34:49 +0000
+++ src/server/default_server_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -90,7 +90,7 @@
90 [this]() -> std::shared_ptr<mi::InputReport>90 [this]() -> std::shared_ptr<mi::InputReport>
91 {91 {
92 auto opt = the_options()->get(input_report_opt, off_opt_value);92 auto opt = the_options()->get(input_report_opt, off_opt_value);
93 93
94 if (opt == log_opt_value)94 if (opt == log_opt_value)
95 {95 {
96 return std::make_shared<ml::InputReport>(the_logger());96 return std::make_shared<ml::InputReport>(the_logger());
9797
=== modified file 'src/server/frontend/event_sender.cpp'
--- src/server/frontend/event_sender.cpp 2013-10-15 08:53:10 +0000
+++ src/server/frontend/event_sender.cpp 2013-11-28 12:22:03 +0000
@@ -37,7 +37,7 @@
37void mfd::EventSender::handle_event(MirEvent const& e)37void mfd::EventSender::handle_event(MirEvent const& e)
38{38{
39 // Limit the types of events we wish to send over protobuf, for now.39 // Limit the types of events we wish to send over protobuf, for now.
40 if (e.type == mir_event_type_surface)40 if (e.type != mir_event_type_key && e.type != mir_event_type_motion)
41 {41 {
42 // In future we might send multiple events, or insert them into messages42 // In future we might send multiple events, or insert them into messages
43 // containing other responses, but for now we send them individually.43 // containing other responses, but for now we send them individually.
4444
=== modified file 'src/server/frontend/event_sender.h'
--- src/server/frontend/event_sender.h 2013-08-28 03:41:48 +0000
+++ src/server/frontend/event_sender.h 2013-11-28 12:22:03 +0000
@@ -47,7 +47,7 @@
4747
48 std::shared_ptr<MessageSender> const sender;48 std::shared_ptr<MessageSender> const sender;
49};49};
50 50
51}51}
52}52}
53}53}
5454
=== modified file 'src/server/frontend/fd_sets.h'
--- src/server/frontend/fd_sets.h 2013-09-26 19:16:26 +0000
+++ src/server/frontend/fd_sets.h 2013-11-28 12:22:03 +0000
@@ -28,6 +28,6 @@
28{28{
29typedef std::initializer_list<std::vector<int32_t>> FdSets;29typedef std::initializer_list<std::vector<int32_t>> FdSets;
30}30}
31} // namespace mir 31} // namespace mir
3232
33#endif // MIR_FRONTEND_FD_SETS_H_33#endif // MIR_FRONTEND_FD_SETS_H_
3434
=== modified file 'src/server/frontend/message_receiver.h'
--- src/server/frontend/message_receiver.h 2013-08-28 03:41:48 +0000
+++ src/server/frontend/message_receiver.h 2013-11-28 12:22:03 +0000
@@ -13,7 +13,7 @@
13 * You should have received a copy of the GNU General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com> 16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
18#ifndef MIR_FRONTEND_MESSAGE_RECEIVER_H_18#ifndef MIR_FRONTEND_MESSAGE_RECEIVER_H_
19#define MIR_FRONTEND_MESSAGE_RECEIVER_H_19#define MIR_FRONTEND_MESSAGE_RECEIVER_H_
@@ -32,7 +32,7 @@
32public:32public:
33 //receive message from the socket. 'handler' will be called when 'buffer' has been filled with exactly 'size'33 //receive message from the socket. 'handler' will be called when 'buffer' has been filled with exactly 'size'
34 typedef std::function<void(boost::system::error_code const&, size_t)> MirReadHandler;34 typedef std::function<void(boost::system::error_code const&, size_t)> MirReadHandler;
35 virtual void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size) = 0; 35 virtual void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size) = 0;
36 virtual pid_t client_pid() = 0;36 virtual pid_t client_pid() = 0;
3737
38protected:38protected:
3939
=== modified file 'src/server/frontend/session_mediator.cpp'
--- src/server/frontend/session_mediator.cpp 2013-11-21 03:16:21 +0000
+++ src/server/frontend/session_mediator.cpp 2013-11-28 12:22:03 +0000
@@ -120,16 +120,13 @@
120{120{
121 auto& tracker = client_buffer_tracker[surf_id];121 auto& tracker = client_buffer_tracker[surf_id];
122 if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size);122 if (!tracker) tracker = std::make_shared<ClientBufferTracker>(client_buffer_cache_size);
123
124 client_buffer_resource[surf_id].reset();
125123
126 auto client_buffer = surface.advance_client_buffer();124 auto& client_buffer = client_buffer_resource[surf_id];
125 surface.swap_buffers(client_buffer);
127 auto id = client_buffer->id();126 auto id = client_buffer->id();
128 auto need_full_ipc = !tracker->client_has(id);127 auto need_full_ipc = !tracker->client_has(id);
129 tracker->add(id);128 tracker->add(id);
130129
131 client_buffer_resource[surf_id] = client_buffer;
132
133 return std::tie(client_buffer, need_full_ipc);130 return std::tie(client_buffer, need_full_ipc);
134}131}
135132
136133
=== modified file 'src/server/frontend/session_mediator_android.cpp'
--- src/server/frontend/session_mediator_android.cpp 2013-11-21 03:16:21 +0000
+++ src/server/frontend/session_mediator_android.cpp 2013-11-28 12:22:03 +0000
@@ -31,7 +31,7 @@
31{31{
32 {32 {
33 std::unique_lock<std::mutex> lock(session_mutex);33 std::unique_lock<std::mutex> lock(session_mutex);
34 34
35 auto session = weak_session.lock();35 auto session = weak_session.lock();
3636
37 if (session.get() == nullptr)37 if (session.get() == nullptr)
3838
=== modified file 'src/server/frontend/socket_messenger.cpp'
--- src/server/frontend/socket_messenger.cpp 2013-10-15 08:53:10 +0000
+++ src/server/frontend/socket_messenger.cpp 2013-11-28 12:22:03 +0000
@@ -39,9 +39,9 @@
39{39{
40 struct ucred cr;40 struct ucred cr;
41 socklen_t cl = sizeof(cr);41 socklen_t cl = sizeof(cr);
42 42
43 auto status = getsockopt(socket->native_handle(), SOL_SOCKET, SO_PEERCRED, &cr, &cl);43 auto status = getsockopt(socket->native_handle(), SOL_SOCKET, SO_PEERCRED, &cr, &cl);
44 44
45 if (status)45 if (status)
46 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to query client socket credentials"));46 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to query client socket credentials"));
47 return cr.pid;47 return cr.pid;
@@ -60,7 +60,7 @@
60 static_cast<unsigned char>((size >> 8) & 0xff),60 static_cast<unsigned char>((size >> 8) & 0xff),
61 static_cast<unsigned char>((size >> 0) & 0xff)61 static_cast<unsigned char>((size >> 0) & 0xff)
62 };62 };
63 63
64 std::unique_lock<std::mutex> lg(message_lock);64 std::unique_lock<std::mutex> lg(message_lock);
6565
66 whole_message.resize(sizeof header_bytes + size);66 whole_message.resize(sizeof header_bytes + size);
@@ -126,4 +126,4 @@
126 buffer,126 buffer,
127 boost::asio::transfer_exactly(size),127 boost::asio::transfer_exactly(size),
128 handler);128 handler);
129} 129}
130130
=== modified file 'src/server/frontend/socket_messenger.h'
--- src/server/frontend/socket_messenger.h 2013-10-15 08:53:10 +0000
+++ src/server/frontend/socket_messenger.h 2013-11-28 12:22:03 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#ifndef MIR_FRONTEND_SOCKET_MESSENGER_H_ 19#ifndef MIR_FRONTEND_SOCKET_MESSENGER_H_
20#define MIR_FRONTEND_SOCKET_MESSENGER_H_ 20#define MIR_FRONTEND_SOCKET_MESSENGER_H_
21#include "message_sender.h"21#include "message_sender.h"
22#include "message_receiver.h"22#include "message_receiver.h"
23#include <mutex>23#include <mutex>
@@ -37,19 +37,19 @@
37 void send(std::string const& body);37 void send(std::string const& body);
38 void send(std::string const& body, FdSets const& fd_set);38 void send(std::string const& body, FdSets const& fd_set);
3939
40 void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size); 40 void async_receive_msg(MirReadHandler const& handler, boost::asio::streambuf& buffer, size_t size);
41 pid_t client_pid();41 pid_t client_pid();
4242
43private:43private:
44 std::shared_ptr<boost::asio::local::stream_protocol::socket> socket;44 std::shared_ptr<boost::asio::local::stream_protocol::socket> socket;
45 45
46 std::mutex message_lock;46 std::mutex message_lock;
47 std::vector<char> whole_message;47 std::vector<char> whole_message;
48 48
49 void send_fds_locked(std::unique_lock<std::mutex> const& lock, std::vector<int32_t> const& fds);49 void send_fds_locked(std::unique_lock<std::mutex> const& lock, std::vector<int32_t> const& fds);
50};50};
51}51}
52}52}
53}53}
5454
55#endif /* MIR_FRONTEND_SOCKET_MESSENGER_H_ */ 55#endif /* MIR_FRONTEND_SOCKET_MESSENGER_H_ */
5656
=== modified file 'src/server/frontend/socket_session.cpp'
--- src/server/frontend/socket_session.cpp 2013-08-28 03:41:48 +0000
+++ src/server/frontend/socket_session.cpp 2013-11-28 12:22:03 +0000
@@ -66,7 +66,7 @@
66 connected_sessions->remove(id());66 connected_sessions->remove(id());
67 BOOST_THROW_EXCEPTION(std::runtime_error(error.message()));67 BOOST_THROW_EXCEPTION(std::runtime_error(error.message()));
68 }68 }
69 69
70 unsigned char high_byte = message.sbumpc();70 unsigned char high_byte = message.sbumpc();
71 unsigned char low_byte = message.sbumpc();71 unsigned char low_byte = message.sbumpc();
72 size_t const body_size = (high_byte << 8) + low_byte;72 size_t const body_size = (high_byte << 8) + low_byte;
7373
=== modified file 'src/server/frontend/surface.cpp'
--- src/server/frontend/surface.cpp 2013-11-21 03:16:21 +0000
+++ src/server/frontend/surface.cpp 2013-11-28 12:22:03 +0000
@@ -37,9 +37,9 @@
37 ForwardingInternalSurface(std::shared_ptr<Surface> const& surface) : surface(surface) {}37 ForwardingInternalSurface(std::shared_ptr<Surface> const& surface) : surface(surface) {}
3838
39 private:39 private:
40 virtual std::shared_ptr<mg::Buffer> advance_client_buffer()40 void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer)
41 {41 {
42 return surface->advance_client_buffer();42 surface->swap_buffers(buffer);
43 }43 }
44 virtual mir::geometry::Size size() const { return surface->size(); }44 virtual mir::geometry::Size size() const { return surface->size(); }
45 virtual MirPixelFormat pixel_format() const { return static_cast<MirPixelFormat>(surface->pixel_format()); }45 virtual MirPixelFormat pixel_format() const { return static_cast<MirPixelFormat>(surface->pixel_format()); }
4646
=== modified file 'src/server/graphics/android/android_buffer_allocator.cpp'
--- src/server/graphics/android/android_buffer_allocator.cpp 2013-11-21 03:16:21 +0000
+++ src/server/graphics/android/android_buffer_allocator.cpp 2013-11-28 12:22:03 +0000
@@ -106,5 +106,5 @@
106 case mg::BufferUsage::hardware:106 case mg::BufferUsage::hardware:
107 default:107 default:
108 return mga::BufferUsage::use_hardware;108 return mga::BufferUsage::use_hardware;
109 } 109 }
110}110}
111111
=== modified file 'src/server/graphics/android/android_display.h'
--- src/server/graphics/android/android_display.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/android_display.h 2013-11-28 12:22:03 +0000
@@ -71,7 +71,7 @@
71 GLContext gl_context;71 GLContext gl_context;
72 std::shared_ptr<DisplayDevice> const display_device;72 std::shared_ptr<DisplayDevice> const display_device;
73 //we only have a primary display at the moment73 //we only have a primary display at the moment
74 std::unique_ptr<graphics::DisplayBuffer> const display_buffer; 74 std::unique_ptr<graphics::DisplayBuffer> const display_buffer;
75 AndroidDisplayConfiguration current_configuration;75 AndroidDisplayConfiguration current_configuration;
76};76};
7777
7878
=== modified file 'src/server/graphics/android/android_display_configuration.h'
--- src/server/graphics/android/android_display_configuration.h 2013-09-12 23:48:21 +0000
+++ src/server/graphics/android/android_display_configuration.h 2013-11-28 12:22:03 +0000
@@ -32,7 +32,7 @@
32 AndroidDisplayConfiguration(geometry::Size const& display_size);32 AndroidDisplayConfiguration(geometry::Size const& display_size);
33 AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other);33 AndroidDisplayConfiguration(AndroidDisplayConfiguration const& other);
34 AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other);34 AndroidDisplayConfiguration& operator=(AndroidDisplayConfiguration const& other);
35 35
36 virtual ~AndroidDisplayConfiguration() = default;36 virtual ~AndroidDisplayConfiguration() = default;
3737
38 void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const;38 void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const;
3939
=== modified file 'src/server/graphics/android/android_platform.cpp'
--- src/server/graphics/android/android_platform.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/android_platform.cpp 2013-11-28 12:22:03 +0000
@@ -77,7 +77,7 @@
77 auto buffer_handle = native_buffer->handle();77 auto buffer_handle = native_buffer->handle();
7878
79 int offset = 0;79 int offset = 0;
80 80
81 for(auto i=0; i<buffer_handle->numFds; i++)81 for(auto i=0; i<buffer_handle->numFds; i++)
82 {82 {
83 packer->pack_fd(buffer_handle->data[offset++]);83 packer->pack_fd(buffer_handle->data[offset++]);
8484
=== modified file 'src/server/graphics/android/buffer.cpp'
--- src/server/graphics/android/buffer.cpp 2013-10-15 08:53:10 +0000
+++ src/server/graphics/android/buffer.cpp 2013-11-28 12:22:03 +0000
@@ -123,7 +123,7 @@
123 content_lock.unlock();123 content_lock.unlock();
124 });124 });
125125
126 //lock remains in effect until the native handle is released 126 //lock remains in effect until the native handle is released
127 lk.release();127 lk.release();
128 return native_resource;128 return native_resource;
129}129}
130130
=== modified file 'src/server/graphics/android/display_buffer.h'
--- src/server/graphics/android/display_buffer.h 2013-11-18 22:44:06 +0000
+++ src/server/graphics/android/display_buffer.h 2013-11-28 12:22:03 +0000
@@ -46,7 +46,7 @@
46 void release_current();46 void release_current();
47 void post_update();47 void post_update();
48 bool can_bypass() const override;48 bool can_bypass() const override;
49 49
50private:50private:
51 std::shared_ptr<FramebufferBundle> const fb_bundle;51 std::shared_ptr<FramebufferBundle> const fb_bundle;
52 std::shared_ptr<DisplayDevice> const display_device;52 std::shared_ptr<DisplayDevice> const display_device;
5353
=== modified file 'src/server/graphics/android/display_device.h'
--- src/server/graphics/android/display_device.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/display_device.h 2013-11-28 12:22:03 +0000
@@ -38,7 +38,7 @@
3838
39 virtual void mode(MirPowerMode mode) = 0;39 virtual void mode(MirPowerMode mode) = 0;
40 virtual void prepare_composition() = 0;40 virtual void prepare_composition() = 0;
41 virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0; 41 virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0;
42 virtual void post(Buffer const& buffer) = 0;42 virtual void post(Buffer const& buffer) = 0;
4343
44protected:44protected:
4545
=== modified file 'src/server/graphics/android/fb_device.cpp'
--- src/server/graphics/android/fb_device.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/fb_device.cpp 2013-11-28 12:22:03 +0000
@@ -39,6 +39,8 @@
39 {39 {
40 fb_device->setSwapInterval(fb_device.get(), 1);40 fb_device->setSwapInterval(fb_device.get(), 1);
41 }41 }
42
43 mode(mir_power_mode_on);
42}44}
4345
44void mga::FBDevice::prepare_composition()46void mga::FBDevice::prepare_composition()
@@ -65,6 +67,14 @@
6567
66void mga::FBDevice::mode(MirPowerMode mode)68void mga::FBDevice::mode(MirPowerMode mode)
67{69{
68 // TODO: Implement70 int enable = 0;
69 (void) mode;71 if (mode == mir_power_mode_on)
72 {
73 enable = 1;
74 }
75
76 if (fb_device->enableScreen)
77 {
78 fb_device->enableScreen(fb_device.get(), enable);
79 }
70}80}
7181
=== modified file 'src/server/graphics/android/fb_device.h'
--- src/server/graphics/android/fb_device.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/fb_device.h 2013-11-28 12:22:03 +0000
@@ -22,7 +22,7 @@
22#include "display_device.h"22#include "display_device.h"
23#include <hardware/gralloc.h>23#include <hardware/gralloc.h>
24#include <hardware/fb.h>24#include <hardware/fb.h>
25 25
26namespace mir26namespace mir
27{27{
28namespace graphics28namespace graphics
@@ -30,14 +30,14 @@
30namespace android30namespace android
31{31{
3232
33class FBDevice : public DisplayDevice 33class FBDevice : public DisplayDevice
34{34{
35public:35public:
36 FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev);36 FBDevice(std::shared_ptr<framebuffer_device_t> const& fbdev);
3737
38 void mode(MirPowerMode mode);38 void mode(MirPowerMode mode);
39 void prepare_composition();39 void prepare_composition();
40 void gpu_render(EGLDisplay dpy, EGLSurface sur); 40 void gpu_render(EGLDisplay dpy, EGLSurface sur);
41 void post(Buffer const& buffer);41 void post(Buffer const& buffer);
4242
43private:43private:
4444
=== modified file 'src/server/graphics/android/framebuffers.cpp'
--- src/server/graphics/android/framebuffers.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/framebuffers.cpp 2013-11-28 12:22:03 +0000
@@ -55,7 +55,7 @@
55 {55 {
56 int visual_id;56 int visual_id;
57 eglGetConfigAttrib(egl_display, fb_egl_config, EGL_NATIVE_VISUAL_ID, &visual_id);57 eglGetConfigAttrib(egl_display, fb_egl_config, EGL_NATIVE_VISUAL_ID, &visual_id);
58 fb_format = mga::to_mir_format(visual_id); 58 fb_format = mga::to_mir_format(visual_id);
59 }59 }
60 else60 else
61 {61 {
@@ -76,7 +76,7 @@
76 auto rc = hwc_device->getDisplayConfigs(hwc_device.get(), HWC_DISPLAY_PRIMARY, &primary_display_config, &num_configs);76 auto rc = hwc_device->getDisplayConfigs(hwc_device.get(), HWC_DISPLAY_PRIMARY, &primary_display_config, &num_configs);
77 if (rc != 0)77 if (rc != 0)
78 {78 {
79 BOOST_THROW_EXCEPTION(std::runtime_error("could not determine hwc display config")); 79 BOOST_THROW_EXCEPTION(std::runtime_error("could not determine hwc display config"));
80 }80 }
81 static uint32_t size_request[3] = { HWC_DISPLAY_WIDTH,81 static uint32_t size_request[3] = { HWC_DISPLAY_WIDTH,
82 HWC_DISPLAY_HEIGHT,82 HWC_DISPLAY_HEIGHT,
@@ -94,7 +94,7 @@
94 std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator,94 std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator,
95 std::shared_ptr<hwc_composer_device_1> const& hwc)95 std::shared_ptr<hwc_composer_device_1> const& hwc)
96 : format(determine_hwc11_fb_format()),96 : format(determine_hwc11_fb_format()),
97 size(determine_hwc11_size(hwc)) 97 size(determine_hwc11_size(hwc))
98{98{
99 for(auto i = 0u; i < 2; i++)99 for(auto i = 0u; i < 2; i++)
100 {100 {
@@ -106,7 +106,7 @@
106 std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator,106 std::shared_ptr<mga::GraphicBufferAllocator> const& buffer_allocator,
107 std::shared_ptr<framebuffer_device_t> const& fb)107 std::shared_ptr<framebuffer_device_t> const& fb)
108 : format{mga::to_mir_format(fb->format)},108 : format{mga::to_mir_format(fb->format)},
109 size({fb->width, fb->height}) 109 size({fb->width, fb->height})
110{110{
111 //guarantee always 2 fb's allocated111 //guarantee always 2 fb's allocated
112 auto fb_num = static_cast<unsigned int>(fb->numFramebuffers);112 auto fb_num = static_cast<unsigned int>(fb->numFramebuffers);
@@ -154,5 +154,5 @@
154154
155void mga::Framebuffers::wait_for_consumed_buffer(bool)155void mga::Framebuffers::wait_for_consumed_buffer(bool)
156{156{
157 //TODO: change swapping so buffer_for_render() does not wait 157 //TODO: change swapping so buffer_for_render() does not wait
158}158}
159159
=== modified file 'src/server/graphics/android/gl_context.cpp'
--- src/server/graphics/android/gl_context.cpp 2013-11-15 20:34:17 +0000
+++ src/server/graphics/android/gl_context.cpp 2013-11-28 12:22:03 +0000
@@ -115,7 +115,7 @@
115 eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)},115 eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)},
116 egl_surface{egl_display,116 egl_surface{egl_display,
117 eglCreatePbufferSurface(egl_display, egl_config, dummy_pbuffer_attribs)}117 eglCreatePbufferSurface(egl_display, egl_config, dummy_pbuffer_attribs)}
118{ 118{
119 report.report_egl_configuration(egl_display, egl_config);119 report.report_egl_configuration(egl_display, egl_config);
120}120}
121121
122122
=== modified file 'src/server/graphics/android/hwc10_device.h'
--- src/server/graphics/android/hwc10_device.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/hwc10_device.h 2013-11-28 12:22:03 +0000
@@ -39,7 +39,7 @@
39 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);39 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);
4040
41 void prepare_composition();41 void prepare_composition();
42 void gpu_render(EGLDisplay dpy, EGLSurface sur); 42 void gpu_render(EGLDisplay dpy, EGLSurface sur);
43 void post(Buffer const& buffer);43 void post(Buffer const& buffer);
4444
45private:45private:
4646
=== modified file 'src/server/graphics/android/hwc11_device.h'
--- src/server/graphics/android/hwc11_device.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/hwc11_device.h 2013-11-28 12:22:03 +0000
@@ -43,7 +43,7 @@
43 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);43 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);
4444
45 void prepare_composition();45 void prepare_composition();
46 void gpu_render(EGLDisplay dpy, EGLSurface sur); 46 void gpu_render(EGLDisplay dpy, EGLSurface sur);
47 void post(Buffer const& buffer);47 void post(Buffer const& buffer);
4848
49private:49private:
5050
=== modified file 'src/server/graphics/android/hwc_common_device.cpp'
--- src/server/graphics/android/hwc_common_device.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/hwc_common_device.cpp 2013-11-28 12:22:03 +0000
@@ -77,18 +77,18 @@
7777
78 //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off78 //note: mir_power_mode_standby, mir_power_mode_suspend, mir_power_mode_off
79 // are all treated like mir_power_mode_off79 // are all treated like mir_power_mode_off
80 if ((mode_request == mir_power_mode_suspend) || 80 if ((mode_request == mir_power_mode_suspend) ||
81 (mode_request == mir_power_mode_standby))81 (mode_request == mir_power_mode_standby))
82 {82 {
83 mode_request = mir_power_mode_off;83 mode_request = mir_power_mode_off;
84 }84 }
8585
86 if ((mode_request == mir_power_mode_on) && 86 if ((mode_request == mir_power_mode_on) &&
87 (current_mode == mir_power_mode_off))87 (current_mode == mir_power_mode_off))
88 {88 {
89 err = turn_screen_on();89 err = turn_screen_on();
90 }90 }
91 else if ((mode_request == mir_power_mode_off) && 91 else if ((mode_request == mir_power_mode_off) &&
92 (current_mode == mir_power_mode_on))92 (current_mode == mir_power_mode_on))
93 {93 {
94 err = turn_screen_off();94 err = turn_screen_off();
@@ -96,15 +96,15 @@
9696
97 if (err)97 if (err)
98 {98 {
99 std::string blanking_status_msg = "Could not " + 99 std::string blanking_status_msg = "Could not " +
100 ((mode_request == mir_power_mode_off) ? std::string("blank") : std::string("unblank")) + " display";100 ((mode_request == mir_power_mode_off) ? std::string("blank") : std::string("unblank")) + " display";
101 BOOST_THROW_EXCEPTION(101 BOOST_THROW_EXCEPTION(
102 boost::enable_error_info(102 boost::enable_error_info(
103 std::runtime_error(blanking_status_msg)) <<103 std::runtime_error(blanking_status_msg)) <<
104 boost::errinfo_errno(-err));104 boost::errinfo_errno(-err));
105 }105 }
106 106
107 current_mode = mode_request; 107 current_mode = mode_request;
108 blanked_cond.notify_all();108 blanked_cond.notify_all();
109}109}
110110
111111
=== modified file 'src/server/graphics/android/hwc_common_device.h'
--- src/server/graphics/android/hwc_common_device.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/hwc_common_device.h 2013-11-28 12:22:03 +0000
@@ -65,7 +65,7 @@
6565
66 std::mutex blanked_mutex;66 std::mutex blanked_mutex;
67 std::condition_variable blanked_cond;67 std::condition_variable blanked_cond;
68 MirPowerMode current_mode; 68 MirPowerMode current_mode;
69};69};
7070
71}71}
7272
=== modified file 'src/server/graphics/android/hwc_layerlist.cpp'
--- src/server/graphics/android/hwc_layerlist.cpp 2013-11-21 03:16:21 +0000
+++ src/server/graphics/android/hwc_layerlist.cpp 2013-11-28 12:22:03 +0000
@@ -28,14 +28,14 @@
2828
29mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer)29mga::HWCLayer& mga::HWCLayer::operator=(HWCLayer const& layer)
30{30{
31 memcpy(this, &layer, sizeof(HWCLayer)); 31 memcpy(this, &layer, sizeof(HWCLayer));
32 this->visibleRegionScreen = {1, &this->visible_rect};32 this->visibleRegionScreen = {1, &this->visible_rect};
33 return *this; 33 return *this;
34}34}
3535
36mga::HWCLayer::HWCLayer(HWCLayer const& layer)36mga::HWCLayer::HWCLayer(HWCLayer const& layer)
37{37{
38 memcpy(this, &layer, sizeof(HWCLayer)); 38 memcpy(this, &layer, sizeof(HWCLayer));
39 this->visibleRegionScreen = {1, &this->visible_rect};39 this->visibleRegionScreen = {1, &this->visible_rect};
40}40}
4141
@@ -59,6 +59,8 @@
59 visibleRegionScreen.numRects=1;59 visibleRegionScreen.numRects=1;
60 visibleRegionScreen.rects= &visible_rect;60 visibleRegionScreen.rects= &visible_rect;
61 handle = buffer_handle;61 handle = buffer_handle;
62
63 memset(&reserved, 0, sizeof(reserved));
62}64}
6365
64mga::FramebufferLayer::FramebufferLayer()66mga::FramebufferLayer::FramebufferLayer()
@@ -92,7 +94,7 @@
92 auto i = 0u;94 auto i = 0u;
93 for(auto& layer : layer_list)95 for(auto& layer : layer_list)
94 {96 {
95 hwc_representation->hwLayers[i++] = layer; 97 hwc_representation->hwLayers[i++] = layer;
96 }98 }
97 hwc_representation->numHwLayers = layer_list.size();99 hwc_representation->numHwLayers = layer_list.size();
98 hwc_representation->retireFenceFd = -1;100 hwc_representation->retireFenceFd = -1;
@@ -102,7 +104,7 @@
102 //these fields are deprecated in hwc1.1 and later.104 //these fields are deprecated in hwc1.1 and later.
103 hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF);105 hwc_representation->dpy = reinterpret_cast<void*>(0xDECAF);
104 hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE);106 hwc_representation->sur = reinterpret_cast<void*>(0xC0FFEE);
105 107
106}108}
107109
108void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer)110void mga::LayerList::set_fb_target(std::shared_ptr<NativeBuffer> const& native_buffer)
@@ -119,7 +121,7 @@
119mga::NativeFence mga::LayerList::framebuffer_fence()121mga::NativeFence mga::LayerList::framebuffer_fence()
120{122{
121 auto fb_position = hwc_representation->numHwLayers - 1;123 auto fb_position = hwc_representation->numHwLayers - 1;
122 return hwc_representation->hwLayers[fb_position].releaseFenceFd; 124 return hwc_representation->hwLayers[fb_position].releaseFenceFd;
123}125}
124126
125hwc_display_contents_1_t* mga::LayerList::native_list() const127hwc_display_contents_1_t* mga::LayerList::native_list() const
126128
=== modified file 'src/server/graphics/android/hwc_vsync.cpp'
--- src/server/graphics/android/hwc_vsync.cpp 2013-05-16 19:16:56 +0000
+++ src/server/graphics/android/hwc_vsync.cpp 2013-11-28 12:22:03 +0000
@@ -23,7 +23,7 @@
23 : vsync_occurred(false)23 : vsync_occurred(false)
24{24{
25}25}
26 26
27void mga::HWCVsync::wait_for_vsync()27void mga::HWCVsync::wait_for_vsync()
28{28{
29 std::unique_lock<std::mutex> lk(vsync_wait_mutex);29 std::unique_lock<std::mutex> lk(vsync_wait_mutex);
3030
=== modified file 'src/server/graphics/android/hwc_vsync.h'
--- src/server/graphics/android/hwc_vsync.h 2013-05-16 19:04:50 +0000
+++ src/server/graphics/android/hwc_vsync.h 2013-11-28 12:22:03 +0000
@@ -34,7 +34,7 @@
34{34{
35public:35public:
36 HWCVsync();36 HWCVsync();
37 37
38 void wait_for_vsync();38 void wait_for_vsync();
39 void notify_vsync();39 void notify_vsync();
40private:40private:
4141
=== modified file 'src/server/graphics/android/hwc_vsync_coordinator.h'
--- src/server/graphics/android/hwc_vsync_coordinator.h 2013-05-20 15:29:28 +0000
+++ src/server/graphics/android/hwc_vsync_coordinator.h 2013-11-28 12:22:03 +0000
@@ -30,7 +30,7 @@
30{30{
31public:31public:
32 virtual ~HWCVsyncCoordinator() = default;32 virtual ~HWCVsyncCoordinator() = default;
33 33
34 virtual void wait_for_vsync() = 0;34 virtual void wait_for_vsync() = 0;
35 virtual void notify_vsync() = 0;35 virtual void notify_vsync() = 0;
3636
3737
=== modified file 'src/server/graphics/android/internal_client.cpp'
--- src/server/graphics/android/internal_client.cpp 2013-09-20 13:19:03 +0000
+++ src/server/graphics/android/internal_client.cpp 2013-11-28 12:22:03 +0000
@@ -37,7 +37,7 @@
37 if (!client_windows[surface])37 if (!client_windows[surface])
38 {38 {
39 auto cache = std::make_shared<mga::InterpreterCache>();39 auto cache = std::make_shared<mga::InterpreterCache>();
40 auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache); 40 auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache);
41 client_windows[surface] = std::make_shared<mga::MirNativeWindow>(interpreter);41 client_windows[surface] = std::make_shared<mga::MirNativeWindow>(interpreter);
42 }42 }
4343
4444
=== modified file 'src/server/graphics/android/internal_client_window.cpp'
--- src/server/graphics/android/internal_client_window.cpp 2013-10-15 08:53:10 +0000
+++ src/server/graphics/android/internal_client_window.cpp 2013-11-28 12:22:03 +0000
@@ -40,7 +40,8 @@
4040
41mg::NativeBuffer* mga::InternalClientWindow::driver_requests_buffer()41mg::NativeBuffer* mga::InternalClientWindow::driver_requests_buffer()
42{42{
43 auto buffer = surface->advance_client_buffer();43 std::shared_ptr<graphics::Buffer> buffer;
44 surface->swap_buffers(buffer);
44 auto handle = buffer->native_buffer_handle();45 auto handle = buffer->native_buffer_handle();
45 resource_cache->store_buffer(buffer, handle);46 resource_cache->store_buffer(buffer, handle);
46 return handle.get();47 return handle.get();
@@ -74,7 +75,7 @@
74 case NATIVE_WINDOW_FORMAT:75 case NATIVE_WINDOW_FORMAT:
75 return format;76 return format;
76 case NATIVE_WINDOW_TRANSFORM_HINT:77 case NATIVE_WINDOW_TRANSFORM_HINT:
77 return 0; 78 return 0;
78 case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:79 case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
79 return 1;80 return 1;
80 default:81 default:
8182
=== modified file 'src/server/graphics/android/internal_client_window.h'
--- src/server/graphics/android/internal_client_window.h 2013-10-15 08:53:10 +0000
+++ src/server/graphics/android/internal_client_window.h 2013-11-28 12:22:03 +0000
@@ -42,7 +42,7 @@
42 void driver_returns_buffer(ANativeWindowBuffer*, int);42 void driver_returns_buffer(ANativeWindowBuffer*, int);
43 void dispatch_driver_request_format(int);43 void dispatch_driver_request_format(int);
44 int driver_requests_info(int) const;44 int driver_requests_info(int) const;
45 void sync_to_display(bool sync); 45 void sync_to_display(bool sync);
4646
47private:47private:
48 std::shared_ptr<InternalSurface> const surface;48 std::shared_ptr<InternalSurface> const surface;
4949
=== modified file 'src/server/graphics/android/interpreter_cache.cpp'
--- src/server/graphics/android/interpreter_cache.cpp 2013-10-15 08:53:10 +0000
+++ src/server/graphics/android/interpreter_cache.cpp 2013-11-28 12:22:03 +0000
@@ -34,7 +34,7 @@
3434
35std::shared_ptr<mg::Buffer> mga::InterpreterCache::retrieve_buffer(ANativeWindowBuffer* returned_handle)35std::shared_ptr<mg::Buffer> mga::InterpreterCache::retrieve_buffer(ANativeWindowBuffer* returned_handle)
36{36{
37 auto buffer_it = buffers_in_driver.find(returned_handle); 37 auto buffer_it = buffers_in_driver.find(returned_handle);
38 auto native_it = native_buffers.find(returned_handle);38 auto native_it = native_buffers.find(returned_handle);
3939
40 if ((buffer_it == buffers_in_driver.end()) ||40 if ((buffer_it == buffers_in_driver.end()) ||
4141
=== modified file 'src/server/graphics/android/output_builder.cpp'
--- src/server/graphics/android/output_builder.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/output_builder.cpp 2013-11-28 12:22:03 +0000
@@ -75,7 +75,7 @@
7575
76std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device()76std::shared_ptr<mga::DisplayDevice> mga::OutputBuilder::create_display_device()
77{77{
78 std::shared_ptr<mga::DisplayDevice> device; 78 std::shared_ptr<mga::DisplayDevice> device;
79 if (force_backup_display)79 if (force_backup_display)
80 {80 {
81 device = res_factory->create_fb_device(fb_native);81 device = res_factory->create_fb_device(fb_native);
@@ -104,5 +104,5 @@
104{104{
105 auto native_window = res_factory->create_native_window(framebuffers);105 auto native_window = res_factory->create_native_window(framebuffers);
106 return std::unique_ptr<mg::DisplayBuffer>(106 return std::unique_ptr<mg::DisplayBuffer>(
107 new DisplayBuffer(framebuffers, display_device, native_window, gl_context)); 107 new DisplayBuffer(framebuffers, display_device, native_window, gl_context));
108}108}
109109
=== modified file 'src/server/graphics/android/resource_factory.cpp'
--- src/server/graphics/android/resource_factory.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/resource_factory.cpp 2013-11-28 12:22:03 +0000
@@ -45,7 +45,7 @@
45 auto rc = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);45 auto rc = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
46 if ((rc != 0) || (module == nullptr) || (framebuffer_open(module, &fbdev_raw) != 0) )46 if ((rc != 0) || (module == nullptr) || (framebuffer_open(module, &fbdev_raw) != 0) )
47 {47 {
48 BOOST_THROW_EXCEPTION(std::runtime_error("display factory cannot create fb display")); 48 BOOST_THROW_EXCEPTION(std::runtime_error("display factory cannot create fb display"));
49 }49 }
5050
51 return std::shared_ptr<framebuffer_device_t>(fbdev_raw,51 return std::shared_ptr<framebuffer_device_t>(fbdev_raw,
@@ -65,7 +65,7 @@
65 module->methods->open(module, HWC_HARDWARE_COMPOSER, reinterpret_cast<hw_device_t**>(&hwc_device_raw)) ||65 module->methods->open(module, HWC_HARDWARE_COMPOSER, reinterpret_cast<hw_device_t**>(&hwc_device_raw)) ||
66 (hwc_device_raw == nullptr))66 (hwc_device_raw == nullptr))
67 {67 {
68 BOOST_THROW_EXCEPTION(std::runtime_error("error opening hwc hal")); 68 BOOST_THROW_EXCEPTION(std::runtime_error("error opening hwc hal"));
69 }69 }
7070
71 return std::shared_ptr<hwc_composer_device_1>(71 return std::shared_ptr<hwc_composer_device_1>(
@@ -78,7 +78,7 @@
78{78{
79 auto cache = std::make_shared<mga::InterpreterCache>();79 auto cache = std::make_shared<mga::InterpreterCache>();
80 auto interpreter = std::make_shared<ServerRenderWindow>(fb_bundle, cache);80 auto interpreter = std::make_shared<ServerRenderWindow>(fb_bundle, cache);
81 return std::make_shared<MirNativeWindow>(interpreter); 81 return std::make_shared<MirNativeWindow>(interpreter);
82}82}
8383
84std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_fb_device(84std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_fb_device(
8585
=== modified file 'src/server/graphics/android/server_render_window.cpp'
--- src/server/graphics/android/server_render_window.cpp 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/server_render_window.cpp 2013-11-28 12:22:03 +0000
@@ -77,7 +77,7 @@
77 case NATIVE_WINDOW_FORMAT:77 case NATIVE_WINDOW_FORMAT:
78 return format;78 return format;
79 case NATIVE_WINDOW_TRANSFORM_HINT:79 case NATIVE_WINDOW_TRANSFORM_HINT:
80 return 0; 80 return 0;
81 case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:81 case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
82 return 1;82 return 1;
83 default:83 default:
8484
=== modified file 'src/server/graphics/android/server_render_window.h'
--- src/server/graphics/android/server_render_window.h 2013-11-21 17:20:14 +0000
+++ src/server/graphics/android/server_render_window.h 2013-11-28 12:22:03 +0000
@@ -34,7 +34,7 @@
3434
35class FramebufferBundle;35class FramebufferBundle;
36class InterpreterResourceCache;36class InterpreterResourceCache;
37class ServerRenderWindow : public AndroidDriverInterpreter 37class ServerRenderWindow : public AndroidDriverInterpreter
38{38{
39public:39public:
40 ServerRenderWindow(std::shared_ptr<FramebufferBundle> const& fb_bundle,40 ServerRenderWindow(std::shared_ptr<FramebufferBundle> const& fb_bundle,
@@ -50,7 +50,7 @@
50 std::shared_ptr<FramebufferBundle> const fb_bundle;50 std::shared_ptr<FramebufferBundle> const fb_bundle;
51 std::shared_ptr<InterpreterResourceCache> const resource_cache;51 std::shared_ptr<InterpreterResourceCache> const resource_cache;
52 int format;52 int format;
53}; 53};
5454
55}55}
56}56}
5757
=== modified file 'src/server/graphics/gbm/CMakeLists.txt'
--- src/server/graphics/gbm/CMakeLists.txt 2013-11-21 03:16:21 +0000
+++ src/server/graphics/gbm/CMakeLists.txt 2013-11-28 12:22:03 +0000
@@ -15,7 +15,7 @@
15 mirplatformgraphics SHARED15 mirplatformgraphics SHARED
1616
17 gbm_platform.cpp17 gbm_platform.cpp
18 gbm_buffer_allocator.cpp18 buffer_allocator.cpp
19 gbm_buffer.cpp19 gbm_buffer.cpp
20 gbm_cursor.cpp20 gbm_cursor.cpp
21 gbm_display_helpers.cpp21 gbm_display_helpers.cpp
@@ -34,6 +34,8 @@
34 udev_wrapper.cpp34 udev_wrapper.cpp
35 overlapping_output_grouping.cpp35 overlapping_output_grouping.cpp
36 native_gbm_platform.cpp36 native_gbm_platform.cpp
37 anonymous_shm_file.cpp
38 shm_buffer.cpp
37)39)
3840
39target_link_libraries(41target_link_libraries(
4042
=== added file 'src/server/graphics/gbm/anonymous_shm_file.cpp'
--- src/server/graphics/gbm/anonymous_shm_file.cpp 1970-01-01 00:00:00 +0000
+++ src/server/graphics/gbm/anonymous_shm_file.cpp 2013-11-28 12:22:03 +0000
@@ -0,0 +1,129 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */
19
20#include "anonymous_shm_file.h"
21
22#include <boost/throw_exception.hpp>
23#include <stdexcept>
24
25#include <vector>
26
27#include <cstdlib>
28#include <cstring>
29#include <sys/mman.h>
30#include <fcntl.h>
31
32namespace mgg = mir::graphics::gbm;
33
34namespace
35{
36
37mgg::detail::FdHandle create_anonymous_file(size_t size)
38{
39 char const* const tmpl = "/mir-buffer-XXXXXX";
40 char const* const runtime_dir = getenv("XDG_RUNTIME_DIR");
41 char const* const target_dir = runtime_dir ? runtime_dir : "/tmp";
42
43 /* We need a mutable array for mkostemp */
44 std::vector<char> path(target_dir, target_dir + strlen(target_dir));
45 path.insert(path.end(), tmpl, tmpl + strlen(tmpl));
46 path.push_back('\0');
47
48 mgg::detail::FdHandle fd{mkostemp(path.data(), O_CLOEXEC)};
49 if (unlink(path.data()) < 0)
50 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to unlink temporary file"));
51 if (ftruncate(fd, size) < 0)
52 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to resize temporary file"));
53
54 return fd;
55}
56
57}
58
59/*************
60 * FdHandle *
61 *************/
62
63mgg::detail::FdHandle::FdHandle(int fd)
64 : fd{fd}
65{
66 if (fd < 0)
67 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create file"));
68}
69
70mgg::detail::FdHandle::FdHandle(FdHandle&& other)
71 : fd{other.fd}
72{
73 other.fd = -1;
74}
75
76mgg::detail::FdHandle::~FdHandle() noexcept
77{
78 if (fd >= 0)
79 close(fd);
80}
81
82mgg::detail::FdHandle::operator int() const
83{
84 return fd;
85}
86
87/*************
88 * MapHandle *
89 *************/
90
91mgg::detail::MapHandle::MapHandle(int fd, size_t size)
92 : size{size},
93 mapping{mmap(nullptr, size, PROT_READ|PROT_WRITE,
94 MAP_SHARED, fd, 0)}
95{
96 if (mapping == MAP_FAILED)
97 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to map file"));
98}
99
100mgg::detail::MapHandle::~MapHandle() noexcept
101{
102 munmap(mapping, size);
103}
104
105mgg::detail::MapHandle::operator void*() const
106{
107 return mapping;
108
109}
110
111/********************
112 * AnonymousShmFile *
113 ********************/
114
115mgg::AnonymousShmFile::AnonymousShmFile(size_t size)
116 : fd_{create_anonymous_file(size)},
117 mapping{fd_, size}
118{
119}
120
121void* mgg::AnonymousShmFile::base_ptr() const
122{
123 return mapping;
124}
125
126int mgg::AnonymousShmFile::fd() const
127{
128 return fd_;
129}
0130
=== added file 'src/server/graphics/gbm/anonymous_shm_file.h'
--- src/server/graphics/gbm/anonymous_shm_file.h 1970-01-01 00:00:00 +0000
+++ src/server/graphics/gbm/anonymous_shm_file.h 2013-11-28 12:22:03 +0000
@@ -0,0 +1,82 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */
19
20#ifndef MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_
21#define MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_
22
23#include "shm_file.h"
24
25namespace mir
26{
27namespace graphics
28{
29namespace gbm
30{
31
32namespace detail
33{
34class FdHandle
35{
36public:
37 FdHandle(int fd);
38 FdHandle(FdHandle&&);
39 ~FdHandle() noexcept;
40
41 operator int() const;
42
43private:
44 FdHandle(FdHandle const&) = delete;
45 FdHandle& operator=(FdHandle const&) = delete;
46 int fd;
47};
48
49class MapHandle
50{
51public:
52 MapHandle(int fd, size_t size);
53 ~MapHandle() noexcept;
54
55 operator void*() const;
56
57private:
58 MapHandle(MapHandle const&) = delete;
59 MapHandle& operator=(MapHandle const&) = delete;
60 size_t const size;
61 void* const mapping;
62};
63}
64
65class AnonymousShmFile : public ShmFile
66{
67public:
68 AnonymousShmFile(size_t size);
69
70 void* base_ptr() const;
71 int fd() const;
72
73private:
74 detail::FdHandle const fd_;
75 detail::MapHandle const mapping;
76};
77
78}
79}
80}
81
82#endif /* MIR_GRAPHICS_GBM_ANONYMOUS_SHM_FILE_H_ */
083
=== modified file 'src/server/graphics/gbm/black_arrow.c'
--- src/server/graphics/gbm/black_arrow.c 2013-06-11 08:10:28 +0000
+++ src/server/graphics/gbm/black_arrow.c 2013-11-28 12:22:03 +0000
@@ -3,7 +3,7 @@
3static const struct {3static const struct {
4 unsigned int width;4 unsigned int width;
5 unsigned int height;5 unsigned int height;
6 unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ 6 unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
7 unsigned char pixel_data[64 * 64 * 4 + 1];7 unsigned char pixel_data[64 * 64 * 4 + 1];
8} black_arrow = {8} black_arrow = {
9 64, 64, 4,9 64, 64, 4,
1010
=== renamed file 'src/server/graphics/gbm/gbm_buffer_allocator.cpp' => 'src/server/graphics/gbm/buffer_allocator.cpp'
--- src/server/graphics/gbm/gbm_buffer_allocator.cpp 2013-11-20 17:13:18 +0000
+++ src/server/graphics/gbm/buffer_allocator.cpp 2013-11-28 12:22:03 +0000
@@ -17,10 +17,12 @@
17 * Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>17 * Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
18 */18 */
1919
20#include "gbm_buffer_allocator.h"20#include "buffer_allocator.h"
21#include "gbm_buffer.h"21#include "gbm_buffer.h"
22#include "gbm_platform.h"22#include "gbm_platform.h"
23#include "buffer_texture_binder.h"23#include "buffer_texture_binder.h"
24#include "anonymous_shm_file.h"
25#include "shm_buffer.h"
24#include "mir/graphics/buffer_initializer.h"26#include "mir/graphics/buffer_initializer.h"
25#include "mir/graphics/egl_extensions.h"27#include "mir/graphics/egl_extensions.h"
26#include "mir/graphics/buffer_properties.h"28#include "mir/graphics/buffer_properties.h"
@@ -106,12 +108,12 @@
106108
107}109}
108110
109mgg::GBMBufferAllocator::GBMBufferAllocator(111mgg::BufferAllocator::BufferAllocator(
110 gbm_device* device,112 gbm_device* device,
111 const std::shared_ptr<BufferInitializer>& buffer_initializer)113 const std::shared_ptr<BufferInitializer>& buffer_initializer)
112 : device(device),114 : device(device),
113 buffer_initializer(buffer_initializer),115 buffer_initializer(buffer_initializer),
114 egl_extensions(std::make_shared<mg::EGLExtensions>())116 egl_extensions(std::make_shared<mg::EGLExtensions>())
115{117{
116 assert(buffer_initializer.get() != 0);118 assert(buffer_initializer.get() != 0);
117119
@@ -119,11 +121,25 @@
119 bypass_env = env ? env[0] != '0' : true;121 bypass_env = env ? env[0] != '0' : true;
120}122}
121123
122std::shared_ptr<mg::Buffer> mgg::GBMBufferAllocator::alloc_buffer(BufferProperties const& buffer_properties)124std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_buffer(
125 BufferProperties const& buffer_properties)
126{
127 std::shared_ptr<mg::Buffer> buffer;
128
129 if (buffer_properties.usage == BufferUsage::software)
130 buffer = alloc_software_buffer(buffer_properties);
131 else
132 buffer = alloc_hardware_buffer(buffer_properties);
133
134 return buffer;
135}
136
137std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_hardware_buffer(
138 BufferProperties const& buffer_properties)
123{139{
124 uint32_t bo_flags{GBM_BO_USE_RENDERING};140 uint32_t bo_flags{GBM_BO_USE_RENDERING};
125141
126 uint32_t gbm_format = mgg::mir_format_to_gbm_format(buffer_properties.format);142 uint32_t const gbm_format = mgg::mir_format_to_gbm_format(buffer_properties.format);
127143
128 if (!is_pixel_format_supported(buffer_properties.format) ||144 if (!is_pixel_format_supported(buffer_properties.format) ||
129 gbm_format == mgg::invalid_gbm_format)145 gbm_format == mgg::invalid_gbm_format)
@@ -132,10 +148,6 @@
132 std::runtime_error("Trying to create GBM buffer with unsupported pixel format"));148 std::runtime_error("Trying to create GBM buffer with unsupported pixel format"));
133 }149 }
134150
135 /* Create the GBM buffer object */
136 if (buffer_properties.usage == BufferUsage::software)
137 bo_flags |= GBM_BO_USE_WRITE;
138
139 /*151 /*
140 * Bypass is generally only beneficial to hardware buffers where the152 * Bypass is generally only beneficial to hardware buffers where the
141 * blitting happens on the GPU. For software buffers it is slower to blit153 * blitting happens on the GPU. For software buffers it is slower to blit
@@ -149,7 +161,6 @@
149 * mir_surface_state_fullscreen later when it's fully wired up.161 * mir_surface_state_fullscreen later when it's fully wired up.
150 */162 */
151 if (bypass_env &&163 if (bypass_env &&
152 buffer_properties.usage == BufferUsage::hardware &&
153 buffer_properties.size.width.as_uint32_t() >= 800 &&164 buffer_properties.size.width.as_uint32_t() >= 800 &&
154 buffer_properties.size.height.as_uint32_t() >= 600)165 buffer_properties.size.height.as_uint32_t() >= 600)
155 {166 {
@@ -172,14 +183,42 @@
172 new EGLImageBufferTextureBinder{bo, egl_extensions}};183 new EGLImageBufferTextureBinder{bo, egl_extensions}};
173184
174 /* Create the GBMBuffer */185 /* Create the GBMBuffer */
175 std::shared_ptr<mg::Buffer> buffer{new GBMBuffer{bo, bo_flags, std::move(texture_binder)}};186 auto const buffer =
176187 std::make_shared<GBMBuffer>(bo, bo_flags, std::move(texture_binder));
177 (*buffer_initializer)(*buffer);188
178189 (*buffer_initializer)(*buffer);
179 return buffer;190
180}191 return buffer;
181192}
182std::vector<geom::PixelFormat> mgg::GBMBufferAllocator::supported_pixel_formats()193
194std::shared_ptr<mg::Buffer> mgg::BufferAllocator::alloc_software_buffer(
195 BufferProperties const& buffer_properties)
196{
197 if (!is_pixel_format_supported(buffer_properties.format))
198 {
199 BOOST_THROW_EXCEPTION(
200 std::runtime_error(
201 "Trying to create SHM buffer with unsupported pixel format"));
202 }
203
204 auto const stride = geom::Stride{
205 geom::bytes_per_pixel(buffer_properties.format) *
206 buffer_properties.size.width.as_uint32_t()};
207 size_t const size_in_bytes =
208 stride.as_int() * buffer_properties.size.height.as_int();
209 auto const shm_file =
210 std::make_shared<mgg::AnonymousShmFile>(size_in_bytes);
211
212 auto const buffer =
213 std::make_shared<ShmBuffer>(shm_file, buffer_properties.size,
214 buffer_properties.format);
215
216 (*buffer_initializer)(*buffer);
217
218 return buffer;
219}
220
221std::vector<geom::PixelFormat> mgg::BufferAllocator::supported_pixel_formats()
183{222{
184 static std::vector<geom::PixelFormat> const pixel_formats{223 static std::vector<geom::PixelFormat> const pixel_formats{
185 geom::PixelFormat::argb_8888,224 geom::PixelFormat::argb_8888,
@@ -189,7 +228,7 @@
189 return pixel_formats;228 return pixel_formats;
190}229}
191230
192bool mgg::GBMBufferAllocator::is_pixel_format_supported(geom::PixelFormat format)231bool mgg::BufferAllocator::is_pixel_format_supported(geom::PixelFormat format)
193{232{
194 auto formats = supported_pixel_formats();233 auto formats = supported_pixel_formats();
195234
196235
=== renamed file 'src/server/graphics/gbm/gbm_buffer_allocator.h' => 'src/server/graphics/gbm/buffer_allocator.h'
--- src/server/graphics/gbm/gbm_buffer_allocator.h 2013-09-18 14:41:59 +0000
+++ src/server/graphics/gbm/buffer_allocator.h 2013-11-28 12:22:03 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */17 */
1818
19#ifndef MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_19#ifndef MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_
20#define MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_20#define MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_
2121
22#include "mir/graphics/graphic_buffer_allocator.h"22#include "mir/graphics/graphic_buffer_allocator.h"
23#include "mir/graphics/buffer_id.h"23#include "mir/graphics/buffer_id.h"
@@ -38,11 +38,11 @@
3838
39namespace gbm39namespace gbm
40{40{
41class GBMBufferAllocator: public graphics::GraphicBufferAllocator41class BufferAllocator: public graphics::GraphicBufferAllocator
42{42{
43public:43public:
44 GBMBufferAllocator(gbm_device* device,44 BufferAllocator(gbm_device* device,
45 const std::shared_ptr<BufferInitializer>& buffer_initializer);45 std::shared_ptr<BufferInitializer> const& buffer_initializer);
4646
47 virtual std::shared_ptr<Buffer> alloc_buffer(47 virtual std::shared_ptr<Buffer> alloc_buffer(
48 graphics::BufferProperties const& buffer_properties);48 graphics::BufferProperties const& buffer_properties);
@@ -51,6 +51,10 @@
5151
52private:52private:
53 bool is_pixel_format_supported(geometry::PixelFormat format);53 bool is_pixel_format_supported(geometry::PixelFormat format);
54 std::shared_ptr<Buffer> alloc_hardware_buffer(
55 graphics::BufferProperties const& buffer_properties);
56 std::shared_ptr<Buffer> alloc_software_buffer(
57 graphics::BufferProperties const& buffer_properties);
5458
55 gbm_device* const device;59 gbm_device* const device;
56 std::shared_ptr<graphics::BufferInitializer> buffer_initializer;60 std::shared_ptr<graphics::BufferInitializer> buffer_initializer;
@@ -63,4 +67,4 @@
63}67}
64}68}
6569
66#endif // MIR_PLATFORM_GBM_GBM_BUFFER_ALLOCATOR_H_70#endif // MIR_PLATFORM_GBM_BUFFER_ALLOCATOR_H_
6771
=== modified file 'src/server/graphics/gbm/gbm_buffer.cpp'
--- src/server/graphics/gbm/gbm_buffer.cpp 2013-11-21 03:16:21 +0000
+++ src/server/graphics/gbm/gbm_buffer.cpp 2013-11-28 12:22:03 +0000
@@ -86,7 +86,7 @@
86 auto gem_handle = gbm_bo_get_handle(gbm_handle.get()).u32;86 auto gem_handle = gbm_bo_get_handle(gbm_handle.get()).u32;
87 auto drm_fd = gbm_device_get_fd(device);87 auto drm_fd = gbm_device_get_fd(device);
8888
89 auto ret = drmPrimeHandleToFD(drm_fd, gem_handle, DRM_CLOEXEC, &prime_fd); 89 auto ret = drmPrimeHandleToFD(drm_fd, gem_handle, DRM_CLOEXEC, &prime_fd);
9090
91 if (ret)91 if (ret)
92 {92 {
9393
=== modified file 'src/server/graphics/gbm/gbm_display_helpers.cpp'
--- src/server/graphics/gbm/gbm_display_helpers.cpp 2013-11-21 03:16:21 +0000
+++ src/server/graphics/gbm/gbm_display_helpers.cpp 2013-11-28 12:22:03 +0000
@@ -182,7 +182,7 @@
182}182}
183183
184int mggh::DRMHelper::open_drm_device(std::shared_ptr<UdevContext> const& udev)184int mggh::DRMHelper::open_drm_device(std::shared_ptr<UdevContext> const& udev)
185{ 185{
186 int tmp_fd = -1;186 int tmp_fd = -1;
187 int error = ENODEV; //Default error is "there are no DRM devices"187 int error = ENODEV; //Default error is "there are no DRM devices"
188188
189189
=== modified file 'src/server/graphics/gbm/gbm_platform.cpp'
--- src/server/graphics/gbm/gbm_platform.cpp 2013-11-21 03:16:21 +0000
+++ src/server/graphics/gbm/gbm_platform.cpp 2013-11-28 12:22:03 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "gbm_platform.h"19#include "gbm_platform.h"
20#include "gbm_buffer_allocator.h"20#include "buffer_allocator.h"
21#include "gbm_display.h"21#include "gbm_display.h"
22#include "internal_client.h"22#include "internal_client.h"
23#include "internal_native_display.h"23#include "internal_native_display.h"
@@ -114,8 +114,7 @@
114std::shared_ptr<mg::GraphicBufferAllocator> mgg::GBMPlatform::create_buffer_allocator(114std::shared_ptr<mg::GraphicBufferAllocator> mgg::GBMPlatform::create_buffer_allocator(
115 const std::shared_ptr<mg::BufferInitializer>& buffer_initializer)115 const std::shared_ptr<mg::BufferInitializer>& buffer_initializer)
116{116{
117 return std::make_shared<mgg::GBMBufferAllocator>(gbm.device,117 return std::make_shared<mgg::BufferAllocator>(gbm.device, buffer_initializer);
118 buffer_initializer);
119}118}
120119
121std::shared_ptr<mg::Display> mgg::GBMPlatform::create_display(120std::shared_ptr<mg::Display> mgg::GBMPlatform::create_display(
@@ -138,13 +137,13 @@
138 for(auto i=0; i<native_handle->data_items; i++)137 for(auto i=0; i<native_handle->data_items; i++)
139 {138 {
140 packer->pack_data(native_handle->data[i]);139 packer->pack_data(native_handle->data[i]);
141 } 140 }
142 for(auto i=0; i<native_handle->fd_items; i++)141 for(auto i=0; i<native_handle->fd_items; i++)
143 {142 {
144 packer->pack_fd(native_handle->fd[i]);143 packer->pack_fd(native_handle->fd[i]);
145 }144 }
146145
147 packer->pack_stride(buffer->stride()); 146 packer->pack_stride(buffer->stride());
148 packer->pack_flags(native_handle->flags);147 packer->pack_flags(native_handle->flags);
149 packer->pack_size(buffer->size());148 packer->pack_size(buffer->size());
150}149}
@@ -157,7 +156,7 @@
157std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client()156std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client()
158{157{
159 if (!internal_native_display)158 if (!internal_native_display)
160 internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package()); 159 internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package());
161 internal_display_clients_present = true;160 internal_display_clients_present = true;
162 return std::make_shared<mgg::InternalClient>(internal_native_display);161 return std::make_shared<mgg::InternalClient>(internal_native_display);
163}162}
164163
=== modified file 'src/server/graphics/gbm/gbm_platform.h'
--- src/server/graphics/gbm/gbm_platform.h 2013-11-21 03:16:21 +0000
+++ src/server/graphics/gbm/gbm_platform.h 2013-11-28 12:22:03 +0000
@@ -48,7 +48,7 @@
48 const std::shared_ptr<BufferInitializer>& buffer_initializer);48 const std::shared_ptr<BufferInitializer>& buffer_initializer);
49 std::shared_ptr<Display> create_display(49 std::shared_ptr<Display> create_display(
50 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy);50 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy);
51 std::shared_ptr<PlatformIPCPackage> get_ipc_package(); 51 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
52 std::shared_ptr<InternalClient> create_internal_client();52 std::shared_ptr<InternalClient> create_internal_client();
5353
54 void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const;54 void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const;
5555
=== modified file 'src/server/graphics/gbm/internal_native_surface.cpp'
--- src/server/graphics/gbm/internal_native_surface.cpp 2013-08-28 03:41:48 +0000
+++ src/server/graphics/gbm/internal_native_surface.cpp 2013-11-28 12:22:03 +0000
@@ -27,7 +27,7 @@
27{27{
28 surface_advance_buffer = advance_buffer_static;28 surface_advance_buffer = advance_buffer_static;
29 surface_get_parameters = get_parameters_static;29 surface_get_parameters = get_parameters_static;
30 surface_set_swapinterval = set_swapinterval_static; 30 surface_set_swapinterval = set_swapinterval_static;
31}31}
3232
33int mgg::InternalNativeSurface::advance_buffer_static(33int mgg::InternalNativeSurface::advance_buffer_static(
@@ -39,8 +39,7 @@
3939
40int mgg::InternalNativeSurface::advance_buffer(MirBufferPackage* package)40int mgg::InternalNativeSurface::advance_buffer(MirBufferPackage* package)
41{41{
42 current_buffer.reset();42 surface->swap_buffers(current_buffer);
43 current_buffer = surface->advance_client_buffer();
4443
45 auto buffer_package = current_buffer->native_buffer_handle();44 auto buffer_package = current_buffer->native_buffer_handle();
46 memcpy(package, buffer_package.get(), sizeof(MirBufferPackage));45 memcpy(package, buffer_package.get(), sizeof(MirBufferPackage));
4746
=== modified file 'src/server/graphics/gbm/kms_output.h'
--- src/server/graphics/gbm/kms_output.h 2013-09-25 07:51:32 +0000
+++ src/server/graphics/gbm/kms_output.h 2013-11-28 12:22:03 +0000
@@ -52,7 +52,7 @@
52 virtual void move_cursor(geometry::Point destination) = 0;52 virtual void move_cursor(geometry::Point destination) = 0;
53 virtual void clear_cursor() = 0;53 virtual void clear_cursor() = 0;
54 virtual bool has_cursor() const = 0;54 virtual bool has_cursor() const = 0;
55 55
56 virtual void set_power_mode(MirPowerMode mode) = 0;56 virtual void set_power_mode(MirPowerMode mode) = 0;
5757
58protected:58protected:
5959
=== modified file 'src/server/graphics/gbm/native_gbm_platform.cpp'
--- src/server/graphics/gbm/native_gbm_platform.cpp 2013-11-21 03:16:21 +0000
+++ src/server/graphics/gbm/native_gbm_platform.cpp 2013-11-28 12:22:03 +0000
@@ -20,7 +20,7 @@
2020
21#include "native_gbm_platform.h"21#include "native_gbm_platform.h"
2222
23#include "gbm_buffer_allocator.h"23#include "buffer_allocator.h"
24#include "mir/graphics/buffer_ipc_packer.h"24#include "mir/graphics/buffer_ipc_packer.h"
25#include "mir/graphics/platform_ipc_package.h"25#include "mir/graphics/platform_ipc_package.h"
26#include "mir/graphics/nested_context.h"26#include "mir/graphics/nested_context.h"
@@ -45,7 +45,7 @@
45std::shared_ptr<mg::GraphicBufferAllocator> mgg::NativeGBMPlatform::create_buffer_allocator(45std::shared_ptr<mg::GraphicBufferAllocator> mgg::NativeGBMPlatform::create_buffer_allocator(
46 std::shared_ptr<mg::BufferInitializer> const& buffer_initializer)46 std::shared_ptr<mg::BufferInitializer> const& buffer_initializer)
47{47{
48 return std::make_shared<mgg::GBMBufferAllocator>(gbm.device, buffer_initializer);48 return std::make_shared<mgg::BufferAllocator>(gbm.device, buffer_initializer);
49}49}
5050
51std::shared_ptr<mg::PlatformIPCPackage> mgg::NativeGBMPlatform::get_ipc_package()51std::shared_ptr<mg::PlatformIPCPackage> mgg::NativeGBMPlatform::get_ipc_package()
5252
=== modified file 'src/server/graphics/gbm/real_kms_display_configuration.cpp'
--- src/server/graphics/gbm/real_kms_display_configuration.cpp 2013-09-17 18:40:01 +0000
+++ src/server/graphics/gbm/real_kms_display_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -229,7 +229,7 @@
229 else229 else
230 {230 {
231 auto& output = *iter;231 auto& output = *iter;
232 232
233 output.modes = modes;233 output.modes = modes;
234 output.preferred_mode_index = preferred_mode_index;234 output.preferred_mode_index = preferred_mode_index;
235 output.physical_size_mm = physical_size;235 output.physical_size_mm = physical_size;
236236
=== modified file 'src/server/graphics/gbm/real_kms_output.h'
--- src/server/graphics/gbm/real_kms_output.h 2013-09-25 07:51:32 +0000
+++ src/server/graphics/gbm/real_kms_output.h 2013-11-28 12:22:03 +0000
@@ -54,7 +54,7 @@
54 void move_cursor(geometry::Point destination);54 void move_cursor(geometry::Point destination);
55 void clear_cursor();55 void clear_cursor();
56 bool has_cursor() const;56 bool has_cursor() const;
57 57
58 void set_power_mode(MirPowerMode mode);58 void set_power_mode(MirPowerMode mode);
5959
60private:60private:
@@ -75,7 +75,7 @@
7575
76 MirPowerMode power_mode;76 MirPowerMode power_mode;
77 int dpms_enum_id;77 int dpms_enum_id;
78 78
79 std::mutex power_mutex;79 std::mutex power_mutex;
80};80};
8181
8282
=== added file 'src/server/graphics/gbm/shm_buffer.cpp'
--- src/server/graphics/gbm/shm_buffer.cpp 1970-01-01 00:00:00 +0000
+++ src/server/graphics/gbm/shm_buffer.cpp 2013-11-28 12:22:03 +0000
@@ -0,0 +1,87 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */
19
20#include "shm_file.h"
21#include "shm_buffer.h"
22#include "buffer_texture_binder.h"
23#include <GLES2/gl2.h>
24#include <GLES2/gl2ext.h>
25
26namespace mgg = mir::graphics::gbm;
27namespace geom = mir::geometry;
28
29mgg::ShmBuffer::ShmBuffer(
30 std::shared_ptr<ShmFile> const& shm_file,
31 geom::Size const& size,
32 geom::PixelFormat const& pixel_format)
33 : shm_file{shm_file},
34 size_{size},
35 pixel_format_{pixel_format},
36 stride_{geom::bytes_per_pixel(pixel_format_) * size_.width.as_uint32_t()},
37 pixels{shm_file->base_ptr()}
38{
39}
40
41mgg::ShmBuffer::~ShmBuffer() noexcept
42{
43}
44
45geom::Size mgg::ShmBuffer::size() const
46{
47 return size_;
48}
49
50geom::Stride mgg::ShmBuffer::stride() const
51{
52 return stride_;
53}
54
55geom::PixelFormat mgg::ShmBuffer::pixel_format() const
56{
57 return pixel_format_;
58}
59
60void mgg::ShmBuffer::bind_to_texture()
61{
62 glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
63 size_.width.as_int(), size_.height.as_int(),
64 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
65 pixels);
66}
67
68std::shared_ptr<MirNativeBuffer> mgg::ShmBuffer::native_buffer_handle() const
69{
70 auto native_buffer = std::make_shared<MirNativeBuffer>();
71
72 native_buffer->fd_items = 1;
73 native_buffer->fd[0] = shm_file->fd();
74 native_buffer->stride = stride().as_uint32_t();
75 native_buffer->flags = 0;
76
77 auto const& dim = size();
78 native_buffer->width = dim.width.as_int();
79 native_buffer->height = dim.height.as_int();
80
81 return native_buffer;
82}
83
84bool mgg::ShmBuffer::can_bypass() const
85{
86 return false;
87}
088
=== added file 'src/server/graphics/gbm/shm_buffer.h'
--- src/server/graphics/gbm/shm_buffer.h 1970-01-01 00:00:00 +0000
+++ src/server/graphics/gbm/shm_buffer.h 2013-11-28 12:22:03 +0000
@@ -0,0 +1,67 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */
19
20#ifndef MIR_GRAPHICS_GBM_SHM_BUFFER_H_
21#define MIR_GRAPHICS_GBM_SHM_BUFFER_H_
22
23#include "mir/graphics/buffer_basic.h"
24#include "mir/geometry/dimensions.h"
25#include "mir/geometry/size.h"
26#include "mir/geometry/pixel_format.h"
27
28namespace mir
29{
30namespace graphics
31{
32namespace gbm
33{
34
35class ShmFile;
36
37class ShmBuffer : public BufferBasic
38{
39public:
40 ShmBuffer(std::shared_ptr<ShmFile> const& shm_file,
41 geometry::Size const& size,
42 geometry::PixelFormat const& pixel_format);
43 ~ShmBuffer() noexcept;
44
45 geometry::Size size() const;
46 geometry::Stride stride() const;
47 geometry::PixelFormat pixel_format() const;
48 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
49 void bind_to_texture();
50 bool can_bypass() const;
51
52private:
53 ShmBuffer(ShmBuffer const&) = delete;
54 ShmBuffer& operator=(ShmBuffer const&) = delete;
55
56 std::shared_ptr<ShmFile> const shm_file;
57 geometry::Size const size_;
58 geometry::PixelFormat const pixel_format_;
59 geometry::Stride const stride_;
60 void* const pixels;
61};
62
63}
64}
65}
66
67#endif /* MIR_GRAPHICS_GBM_SHM_BUFFER_H_ */
068
=== added file 'src/server/graphics/gbm/shm_file.h'
--- src/server/graphics/gbm/shm_file.h 1970-01-01 00:00:00 +0000
+++ src/server/graphics/gbm/shm_file.h 2013-11-28 12:22:03 +0000
@@ -0,0 +1,50 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18 */
19
20#ifndef MIR_GRAPHICS_GBM_SHM_FILE_H_
21#define MIR_GRAPHICS_GBM_SHM_FILE_H_
22
23#include <cstddef>
24
25namespace mir
26{
27namespace graphics
28{
29namespace gbm
30{
31
32class ShmFile
33{
34public:
35 virtual ~ShmFile() = default;
36
37 virtual void* base_ptr() const = 0;
38 virtual int fd() const = 0;
39
40protected:
41 ShmFile() = default;
42 ShmFile(ShmFile const&) = delete;
43 ShmFile& operator=(ShmFile const&) = delete;
44};
45
46}
47}
48}
49
50#endif /* MIR_GRAPHICS_GBM_SHM_FILE_H_ */
051
=== modified file 'src/server/graphics/gbm/udev_wrapper.cpp'
--- src/server/graphics/gbm/udev_wrapper.cpp 2013-11-19 05:40:39 +0000
+++ src/server/graphics/gbm/udev_wrapper.cpp 2013-11-28 12:22:03 +0000
@@ -257,7 +257,7 @@
257 do257 do
258 {258 {
259 dev = udev_monitor_receive_device(const_cast<udev_monitor*>(monitor));259 dev = udev_monitor_receive_device(const_cast<udev_monitor*>(monitor));
260 if (dev != nullptr) 260 if (dev != nullptr)
261 handler(action_to_event_type(udev_device_get_action(dev)), UdevDevice(dev));261 handler(action_to_event_type(udev_device_get_action(dev)), UdevDevice(dev));
262 } while (dev != nullptr);262 } while (dev != nullptr);
263}263}
264264
=== modified file 'src/server/graphics/gbm/udev_wrapper.h'
--- src/server/graphics/gbm/udev_wrapper.h 2013-11-19 05:40:39 +0000
+++ src/server/graphics/gbm/udev_wrapper.h 2013-11-28 12:22:03 +0000
@@ -84,7 +84,7 @@
84 void match_parent(UdevDevice const& parent);84 void match_parent(UdevDevice const& parent);
85 void match_sysname(std::string const& sysname);85 void match_sysname(std::string const& sysname);
8686
87 class iterator : 87 class iterator :
88 public std::iterator<std::input_iterator_tag, UdevDevice>88 public std::iterator<std::input_iterator_tag, UdevDevice>
89 {89 {
90 public:90 public:
9191
=== modified file 'src/server/graphics/nested/nested_display_configuration.cpp'
--- src/server/graphics/nested/nested_display_configuration.cpp 2013-09-12 21:36:55 +0000
+++ src/server/graphics/nested/nested_display_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -85,7 +85,7 @@
85 });85 });
86}86}
8787
88void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used, 88void mgn::NestedDisplayConfiguration::configure_output(DisplayConfigurationOutputId id, bool used,
89 geometry::Point top_left, size_t mode_index, MirPowerMode power_mode)89 geometry::Point top_left, size_t mode_index, MirPowerMode power_mode)
90{90{
91 for (auto mir_output = display_config->outputs;91 for (auto mir_output = display_config->outputs;
9292
=== modified file 'src/server/graphics/offscreen/display_buffer.cpp'
--- src/server/graphics/offscreen/display_buffer.cpp 2013-11-14 09:46:02 +0000
+++ src/server/graphics/offscreen/display_buffer.cpp 2013-11-28 12:22:03 +0000
@@ -33,12 +33,6 @@
33namespace33namespace
34{34{
3535
36EGLint const default_egl_context_attr[] =
37{
38 EGL_CONTEXT_CLIENT_VERSION, 2,
39 EGL_NONE
40};
41
42class GLExtensions : public mgo::GLExtensionsBase36class GLExtensions : public mgo::GLExtensionsBase
43{37{
44public:38public:
4539
=== modified file 'src/server/input/android/android_input_application_handle.cpp'
--- src/server/input/android/android_input_application_handle.cpp 2013-08-28 03:41:48 +0000
+++ src/server/input/android/android_input_application_handle.cpp 2013-11-28 12:22:03 +0000
@@ -36,7 +36,7 @@
36{36{
37 if (mInfo == NULL)37 if (mInfo == NULL)
38 mInfo = new droidinput::InputApplicationInfo;38 mInfo = new droidinput::InputApplicationInfo;
39 39
40 mInfo->dispatchingTimeout = INT_MAX;40 mInfo->dispatchingTimeout = INT_MAX;
41 mInfo->name = droidinput::String8(surface->name().c_str());41 mInfo->name = droidinput::String8(surface->name().c_str());
4242
4343
=== modified file 'src/server/input/android/android_input_channel.cpp'
--- src/server/input/android/android_input_channel.cpp 2013-08-28 03:41:48 +0000
+++ src/server/input/android/android_input_channel.cpp 2013-11-28 12:22:03 +0000
@@ -27,7 +27,7 @@
2727
28mia::AndroidInputChannel::AndroidInputChannel()28mia::AndroidInputChannel::AndroidInputChannel()
29{29{
30 30
31 droidinput::InputChannel::openInputFdPair(s_fd, c_fd);31 droidinput::InputChannel::openInputFdPair(s_fd, c_fd);
32}32}
3333
3434
=== modified file 'src/server/input/android/android_input_reader_policy.cpp'
--- src/server/input/android/android_input_reader_policy.cpp 2013-08-28 03:41:48 +0000
+++ src/server/input/android/android_input_reader_policy.cpp 2013-11-28 12:22:03 +0000
@@ -48,7 +48,7 @@
48 width,48 width,
49 height,49 height,
50 default_display_orientation);50 default_display_orientation);
51 51
52 out_config->pointerVelocityControlParameters.acceleration = 1.0;52 out_config->pointerVelocityControlParameters.acceleration = 1.0;
53}53}
5454
5555
=== modified file 'src/server/input/android/android_input_registrar.cpp'
--- src/server/input/android/android_input_registrar.cpp 2013-11-20 15:56:58 +0000
+++ src/server/input/android/android_input_registrar.cpp 2013-11-28 12:22:03 +0000
@@ -59,7 +59,7 @@
5959
60 auto application_handle = new mia::InputApplicationHandle(surface);60 auto application_handle = new mia::InputApplicationHandle(surface);
61 window_handle = new mia::InputWindowHandle(application_handle, channel, surface);61 window_handle = new mia::InputWindowHandle(application_handle, channel, surface);
62 62
63 window_handles[channel] = window_handle;63 window_handles[channel] = window_handle;
64 }64 }
6565
6666
=== modified file 'src/server/input/android/android_input_target_enumerator.h'
--- src/server/input/android/android_input_target_enumerator.h 2013-11-20 15:56:58 +0000
+++ src/server/input/android/android_input_target_enumerator.h 2013-11-28 12:22:03 +0000
@@ -52,9 +52,9 @@
52 explicit InputTargetEnumerator(std::shared_ptr<input::InputTargets> const& targets,52 explicit InputTargetEnumerator(std::shared_ptr<input::InputTargets> const& targets,
53 std::shared_ptr<WindowHandleRepository> const& repository);53 std::shared_ptr<WindowHandleRepository> const& repository);
54 virtual ~InputTargetEnumerator() noexcept(true);54 virtual ~InputTargetEnumerator() noexcept(true);
55 55
56 void for_each(std::function<void(droidinput::sp<droidinput::InputWindowHandle> const&)> const& callback);56 void for_each(std::function<void(droidinput::sp<droidinput::InputWindowHandle> const&)> const& callback);
57 57
58private:58private:
59 std::weak_ptr<input::InputTargets> const targets;59 std::weak_ptr<input::InputTargets> const targets;
60 std::weak_ptr<input::android::WindowHandleRepository> const repository;60 std::weak_ptr<input::android::WindowHandleRepository> const repository;
6161
=== modified file 'src/server/input/android/android_input_targeter.cpp'
--- src/server/input/android/android_input_targeter.cpp 2013-11-20 15:56:58 +0000
+++ src/server/input/android/android_input_targeter.cpp 2013-11-28 12:22:03 +0000
@@ -46,16 +46,16 @@
46void mia::InputTargeter::focus_cleared()46void mia::InputTargeter::focus_cleared()
47{47{
48 droidinput::sp<droidinput::InputWindowHandle> null_window = nullptr;48 droidinput::sp<droidinput::InputWindowHandle> null_window = nullptr;
49 49
50 input_dispatcher->setKeyboardFocus(null_window);50 input_dispatcher->setKeyboardFocus(null_window);
51}51}
5252
53void mia::InputTargeter::focus_changed(std::shared_ptr<mi::InputChannel const> const& focus_channel)53void mia::InputTargeter::focus_changed(std::shared_ptr<mi::InputChannel const> const& focus_channel)
54{54{
55 auto window_handle = repository->handle_for_channel(focus_channel);55 auto window_handle = repository->handle_for_channel(focus_channel);
56 56
57 if (window_handle == NULL)57 if (window_handle == NULL)
58 BOOST_THROW_EXCEPTION(std::logic_error("Attempt to set keyboard focus to an unregistered input channel"));58 BOOST_THROW_EXCEPTION(std::logic_error("Attempt to set keyboard focus to an unregistered input channel"));
59 59
60 input_dispatcher->setKeyboardFocus(window_handle);60 input_dispatcher->setKeyboardFocus(window_handle);
61}61}
6262
=== modified file 'src/server/input/android/android_input_window_handle.cpp'
--- src/server/input/android/android_input_window_handle.cpp 2013-08-28 03:41:48 +0000
+++ src/server/input/android/android_input_window_handle.cpp 2013-11-28 12:22:03 +0000
@@ -76,7 +76,7 @@
76 mInfo->frameTop = surface_position.y.as_uint32_t();76 mInfo->frameTop = surface_position.y.as_uint32_t();
77 mInfo->frameRight = mInfo->frameLeft + surface_size.width.as_uint32_t();77 mInfo->frameRight = mInfo->frameLeft + surface_size.width.as_uint32_t();
78 mInfo->frameBottom = mInfo->frameTop + surface_size.height.as_uint32_t();78 mInfo->frameBottom = mInfo->frameTop + surface_size.height.as_uint32_t();
79 79
80 mInfo->touchableRegionLeft = mInfo->frameLeft;80 mInfo->touchableRegionLeft = mInfo->frameLeft;
81 mInfo->touchableRegionTop = mInfo->frameTop;81 mInfo->touchableRegionTop = mInfo->frameTop;
82 mInfo->touchableRegionRight = mInfo->frameRight;82 mInfo->touchableRegionRight = mInfo->frameRight;
8383
=== modified file 'src/server/input/android/android_window_handle_repository.h'
--- src/server/input/android/android_window_handle_repository.h 2013-08-28 03:41:48 +0000
+++ src/server/input/android/android_window_handle_repository.h 2013-11-28 12:22:03 +0000
@@ -44,7 +44,7 @@
44{44{
45public:45public:
46 virtual ~WindowHandleRepository() = default;46 virtual ~WindowHandleRepository() = default;
47 47
48 virtual droidinput::sp<droidinput::InputWindowHandle> handle_for_channel(std::shared_ptr<input::InputChannel const> const& channel) = 0;48 virtual droidinput::sp<droidinput::InputWindowHandle> handle_for_channel(std::shared_ptr<input::InputChannel const> const& channel) = 0;
49protected:49protected:
50 WindowHandleRepository() = default;50 WindowHandleRepository() = default;
5151
=== modified file 'src/server/input/android/event_filter_dispatcher_policy.cpp'
--- src/server/input/android/event_filter_dispatcher_policy.cpp 2013-06-06 10:03:12 +0000
+++ src/server/input/android/event_filter_dispatcher_policy.cpp 2013-11-28 12:22:03 +0000
@@ -54,7 +54,7 @@
54{54{
55 MirEvent mir_ev;55 MirEvent mir_ev;
56 mia::Lexicon::translate(input_event, mir_ev);56 mia::Lexicon::translate(input_event, mir_ev);
57 57
58 // TODO: Use XKBMapper58 // TODO: Use XKBMapper
5959
60 return !event_filter->handle(mir_ev);60 return !event_filter->handle(mir_ev);
6161
=== modified file 'src/server/input/null_input_configuration.cpp'
--- src/server/input/null_input_configuration.cpp 2013-11-21 12:34:49 +0000
+++ src/server/input/null_input_configuration.cpp 2013-11-28 12:22:03 +0000
@@ -33,7 +33,7 @@
33{33{
34 NullInputRegistrar() = default;34 NullInputRegistrar() = default;
35 virtual ~NullInputRegistrar() noexcept(true) = default;35 virtual ~NullInputRegistrar() noexcept(true) = default;
36 36
37 void input_channel_opened(std::shared_ptr<mi::InputChannel> const&,37 void input_channel_opened(std::shared_ptr<mi::InputChannel> const&,
38 std::shared_ptr<mi::Surface> const&,38 std::shared_ptr<mi::Surface> const&,
39 mi::InputReceptionMode /* receives_all_input */)39 mi::InputReceptionMode /* receives_all_input */)
4040
=== modified file 'src/server/input/null_input_configuration.h'
--- src/server/input/null_input_configuration.h 2013-11-21 12:34:49 +0000
+++ src/server/input/null_input_configuration.h 2013-11-28 12:22:03 +0000
@@ -35,7 +35,7 @@
35 std::shared_ptr<scene::InputRegistrar> the_input_registrar();35 std::shared_ptr<scene::InputRegistrar> the_input_registrar();
36 std::shared_ptr<shell::InputTargeter> the_input_targeter();36 std::shared_ptr<shell::InputTargeter> the_input_targeter();
37 std::shared_ptr<InputManager> the_input_manager();37 std::shared_ptr<InputManager> the_input_manager();
38 38
39 void set_input_targets(std::shared_ptr<InputTargets> const& /* targets */);39 void set_input_targets(std::shared_ptr<InputTargets> const& /* targets */);
4040
41protected:41protected:
4242
=== modified file 'src/server/logging/display_report.cpp'
--- src/server/logging/display_report.cpp 2013-11-21 03:16:21 +0000
+++ src/server/logging/display_report.cpp 2013-11-28 12:22:03 +0000
@@ -150,5 +150,5 @@
150 eglGetConfigAttrib(disp, config, i.val, &value);150 eglGetConfigAttrib(disp, config, i.val, &value);
151 logger->log<Logger::informational>(151 logger->log<Logger::informational>(
152 " [" + i.name + "] : " + std::to_string(value), component());152 " [" + i.name + "] : " + std::to_string(value), component());
153 } 153 }
154}154}
155155
=== modified file 'src/server/logging/input_report.cpp'
--- src/server/logging/input_report.cpp 2013-05-28 17:55:26 +0000
+++ src/server/logging/input_report.cpp 2013-11-28 12:22:03 +0000
@@ -92,7 +92,7 @@
92}92}
9393
9494
95ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger) 95ml::InputReport::InputReport(const std::shared_ptr<Logger>& logger)
96 : logger(logger)96 : logger(logger)
97{97{
98}98}
@@ -106,7 +106,7 @@
106void ml::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value)106void ml::InputReport::received_event_from_kernel(int64_t when, int type, int code, int value)
107{107{
108 std::stringstream ss;108 std::stringstream ss;
109 109
110 ss << "Received event (when, type, code, value) from kernel: "110 ss << "Received event (when, type, code, value) from kernel: "
111 << "(" << when << "ns, " << type << ", " << code << ", " << value << ")";111 << "(" << when << "ns, " << type << ", " << code << ", " << value << ")";
112 logger->log<Logger::informational>(ss.str(), component());112 logger->log<Logger::informational>(ss.str(), component());
@@ -116,7 +116,7 @@
116{116{
117 std::stringstream ss;117 std::stringstream ss;
118118
119 ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": (" 119 ss << "Published key event (seq_id, event_time) to fd " << dest_fd << ": ("
120 << seq_id << ", " << event_time << ")";120 << seq_id << ", " << event_time << ")";
121 logger->log<Logger::informational>(ss.str(), component());121 logger->log<Logger::informational>(ss.str(), component());
122}122}
@@ -125,7 +125,7 @@
125{125{
126 std::stringstream ss;126 std::stringstream ss;
127127
128 ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": (" 128 ss << "Published motion event (seq_id, event_time) to fd " << dest_fd << ": ("
129 << seq_id << ", " << event_time << ")";129 << seq_id << ", " << event_time << ")";
130 logger->log<Logger::informational>(ss.str(), component());130 logger->log<Logger::informational>(ss.str(), component());
131}131}
@@ -133,7 +133,7 @@
133void ml::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id)133void ml::InputReport::received_event_finished_signal(int src_fd, uint32_t seq_id)
134{134{
135 std::stringstream ss;135 std::stringstream ss;
136 136
137 ss << "Received event finished (seq_id) from fd " << src_fd << ": " << seq_id;137 ss << "Received event finished (seq_id) from fd " << src_fd << ": " << seq_id;
138 logger->log<Logger::informational>(ss.str(), component());138 logger->log<Logger::informational>(ss.str(), component());
139}139}
140140
=== modified file 'src/server/scene/application_session.cpp'
--- src/server/scene/application_session.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/application_session.cpp 2013-11-28 12:22:03 +0000
@@ -72,9 +72,9 @@
7272
73 std::unique_lock<std::mutex> lock(surfaces_mutex);73 std::unique_lock<std::mutex> lock(surfaces_mutex);
74 surfaces[id] = surf;74 surfaces[id] = surf;
75 75
76 session_listener->surface_created(*this, surf);76 session_listener->surface_created(*this, surf);
77 77
78 return id;78 return id;
79}79}
8080
@@ -114,7 +114,7 @@
114{114{
115 std::unique_lock<std::mutex> lock(surfaces_mutex);115 std::unique_lock<std::mutex> lock(surfaces_mutex);
116 auto p = checked_find(id);116 auto p = checked_find(id);
117 117
118 session_listener->destroying_surface(*this, p->second);118 session_listener->destroying_surface(*this, p->second);
119119
120 surfaces.erase(p);120 surfaces.erase(p);
121121
=== modified file 'src/server/scene/basic_surface.h'
--- src/server/scene/basic_surface.h 2013-11-21 12:34:49 +0000
+++ src/server/scene/basic_surface.h 2013-11-28 12:22:03 +0000
@@ -65,7 +65,7 @@
65 virtual geometry::PixelFormat pixel_format() const = 0;65 virtual geometry::PixelFormat pixel_format() const = 0;
6666
67 virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const = 0;67 virtual std::shared_ptr<graphics::Buffer> snapshot_buffer() const = 0;
68 virtual std::shared_ptr<graphics::Buffer> advance_client_buffer() = 0;68 virtual void swap_buffers(std::shared_ptr<graphics::Buffer>&) = 0;
69 virtual void force_requests_to_complete() = 0;69 virtual void force_requests_to_complete() = 0;
7070
71 virtual bool supports_input() const = 0;71 virtual bool supports_input() const = 0;
7272
=== modified file 'src/server/scene/default_session_container.cpp'
--- src/server/scene/default_session_container.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/default_session_container.cpp 2013-11-28 12:22:03 +0000
@@ -63,12 +63,12 @@
63std::shared_ptr<msh::Session> ms::DefaultSessionContainer::successor_of(std::shared_ptr<msh::Session> const& session) const63std::shared_ptr<msh::Session> ms::DefaultSessionContainer::successor_of(std::shared_ptr<msh::Session> const& session) const
64{64{
65 std::shared_ptr<msh::Session> result, first;65 std::shared_ptr<msh::Session> result, first;
66 66
67 if (!session && apps.size())67 if (!session && apps.size())
68 return apps.back();68 return apps.back();
69 else if(!session)69 else if(!session)
70 return std::shared_ptr<msh::Session>();70 return std::shared_ptr<msh::Session>();
71 71
72 for (auto it = apps.begin(); it != apps.end(); it++)72 for (auto it = apps.begin(); it != apps.end(); it++)
73 {73 {
74 if (*it == session)74 if (*it == session)
@@ -79,6 +79,6 @@
79 else return *successor;79 else return *successor;
80 }80 }
81 }81 }
82 82
83 BOOST_THROW_EXCEPTION(std::logic_error("Invalid session"));83 BOOST_THROW_EXCEPTION(std::logic_error("Invalid session"));
84}84}
8585
=== modified file 'src/server/scene/global_event_sender.cpp'
--- src/server/scene/global_event_sender.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/global_event_sender.cpp 2013-11-28 12:22:03 +0000
@@ -30,7 +30,7 @@
30}30}
3131
32void ms::GlobalEventSender::handle_event(MirEvent const&)32void ms::GlobalEventSender::handle_event(MirEvent const&)
33{ 33{
34 //TODO, no driving test cases, although messages like 'server shutdown' could go here34 //TODO, no driving test cases, although messages like 'server shutdown' could go here
35}35}
3636
3737
=== modified file 'src/server/scene/mediating_display_changer.cpp'
--- src/server/scene/mediating_display_changer.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/mediating_display_changer.cpp 2013-11-28 12:22:03 +0000
@@ -129,12 +129,12 @@
129 conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void129 conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void
130 {130 {
131 if (!output.used) return;131 if (!output.used) return;
132 132
133 if (output.power_mode != mir_power_mode_on)133 if (output.power_mode != mir_power_mode_on)
134 {134 {
135 switched = true;135 switched = true;
136 conf->configure_output(output.id, output.used,136 conf->configure_output(output.id, output.used,
137 output.top_left, 137 output.top_left,
138 output.current_mode_index,138 output.current_mode_index,
139 mir_power_mode_on);139 mir_power_mode_on);
140 }140 }
141141
=== modified file 'src/server/scene/mutable_surface_state.h'
--- src/server/scene/mutable_surface_state.h 2013-11-21 12:34:49 +0000
+++ src/server/scene/mutable_surface_state.h 2013-11-28 12:22:03 +0000
@@ -41,7 +41,7 @@
41 std::vector<geometry::Rectangle> const& input_rectangles) = 0;41 std::vector<geometry::Rectangle> const& input_rectangles) = 0;
4242
43protected:43protected:
44 MutableSurfaceState() = default; 44 MutableSurfaceState() = default;
45 virtual ~MutableSurfaceState() noexcept = default;45 virtual ~MutableSurfaceState() noexcept = default;
46 MutableSurfaceState(const MutableSurfaceState&) = delete;46 MutableSurfaceState(const MutableSurfaceState&) = delete;
47 MutableSurfaceState& operator=(const MutableSurfaceState& ) = delete;47 MutableSurfaceState& operator=(const MutableSurfaceState& ) = delete;
4848
=== modified file 'src/server/scene/session_manager.cpp'
--- src/server/scene/session_manager.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/session_manager.cpp 2013-11-28 12:22:03 +0000
@@ -81,7 +81,7 @@
81 surface_factory, name, snapshot_strategy, session_listener, sender);81 surface_factory, name, snapshot_strategy, session_listener, sender);
8282
83 app_container->insert_session(new_session);83 app_container->insert_session(new_session);
84 84
85 session_listener->starting(new_session);85 session_listener->starting(new_session);
8686
87 set_focus_to(new_session);87 set_focus_to(new_session);
8888
=== modified file 'src/server/scene/surface.cpp'
--- src/server/scene/surface.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/surface.cpp 2013-11-28 12:22:03 +0000
@@ -44,8 +44,7 @@
44 surface_state(state),44 surface_state(state),
45 surface_buffer_stream(buffer_stream),45 surface_buffer_stream(buffer_stream),
46 server_input_channel(input_channel),46 server_input_channel(input_channel),
47 report(report),47 report(report)
48 surface_in_startup(true)
49{48{
50 report->surface_created(this);49 report->surface_created(this);
51}50}
@@ -110,20 +109,16 @@
110 return surface_buffer_stream->get_stream_pixel_format();109 return surface_buffer_stream->get_stream_pixel_format();
111}110}
112111
113std::shared_ptr<mg::Buffer> ms::Surface::advance_client_buffer()112void ms::Surface::swap_buffers(std::shared_ptr<graphics::Buffer>& buffer)
114{113{
115 if (surface_in_startup)114 bool const posting{!!buffer};
116 {115
117 surface_in_startup = false;116 surface_buffer_stream->swap_client_buffers(buffer);
118 }117
119 else118 if (posting)
120 {119 {
121 // TODO There is something crazy about assuming that giving out any buffer120 surface_state->frame_posted();
122 // TODO after the first implies that previous buffers have been rendered.121 }
123 flag_for_render();
124 }
125
126 return surface_buffer_stream->secure_client_buffer();
127}122}
128123
129void ms::Surface::allow_framedropping(bool allow)124void ms::Surface::allow_framedropping(bool allow)
@@ -136,12 +131,6 @@
136 return surface_buffer_stream->lock_snapshot_buffer();131 return surface_buffer_stream->lock_snapshot_buffer();
137}132}
138133
139//TODO: this is just used in example code, could be private
140void ms::Surface::flag_for_render()
141{
142 surface_state->frame_posted();
143}
144
145bool ms::Surface::supports_input() const134bool ms::Surface::supports_input() const
146{135{
147 if (server_input_channel)136 if (server_input_channel)
148137
=== modified file 'src/server/scene/surface.h'
--- src/server/scene/surface.h 2013-11-20 16:22:32 +0000
+++ src/server/scene/surface.h 2013-11-28 12:22:03 +0000
@@ -50,9 +50,8 @@
50 geometry::PixelFormat pixel_format() const;50 geometry::PixelFormat pixel_format() const;
5151
52 std::shared_ptr<graphics::Buffer> snapshot_buffer() const;52 std::shared_ptr<graphics::Buffer> snapshot_buffer() const;
53 std::shared_ptr<graphics::Buffer> advance_client_buffer();53 void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer);
54 void force_requests_to_complete();54 void force_requests_to_complete();
55 void flag_for_render();
5655
57 bool supports_input() const;56 bool supports_input() const;
58 int client_input_fd() const;57 int client_input_fd() const;
@@ -74,7 +73,6 @@
74 std::shared_ptr<compositor::BufferStream> surface_buffer_stream;73 std::shared_ptr<compositor::BufferStream> surface_buffer_stream;
75 std::shared_ptr<input::InputChannel> const server_input_channel;74 std::shared_ptr<input::InputChannel> const server_input_channel;
76 std::shared_ptr<SceneReport> const report;75 std::shared_ptr<SceneReport> const report;
77 bool surface_in_startup;
78};76};
79}77}
80}78}
8179
=== modified file 'src/server/scene/surface_data.cpp'
--- src/server/scene/surface_data.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/surface_data.cpp 2013-11-28 12:22:03 +0000
@@ -46,7 +46,7 @@
46 std::unique_lock<std::mutex> lk(guard);46 std::unique_lock<std::mutex> lk(guard);
4747
48 auto surface_size = surface_rect.size;48 auto surface_size = surface_rect.size;
49 auto surface_top_left = surface_rect.top_left; 49 auto surface_top_left = surface_rect.top_left;
50 if (transformation_dirty || transformation_size != surface_size)50 if (transformation_dirty || transformation_size != surface_size)
51 {51 {
52 const glm::vec3 top_left_vec{surface_top_left.x.as_int(),52 const glm::vec3 top_left_vec{surface_top_left.x.as_int(),
@@ -183,7 +183,7 @@
183 if (rectangle.contains(point))183 if (rectangle.contains(point))
184 {184 {
185 return true;185 return true;
186 } 186 }
187 }187 }
188 return false;188 return false;
189}189}
190190
=== modified file 'src/server/scene/surface_impl.cpp'
--- src/server/scene/surface_impl.cpp 2013-11-21 12:34:49 +0000
+++ src/server/scene/surface_impl.cpp 2013-11-28 12:22:03 +0000
@@ -104,16 +104,16 @@
104 return surface->pixel_format();104 return surface->pixel_format();
105}105}
106106
107std::shared_ptr<mg::Buffer> ms::SurfaceImpl::advance_client_buffer()107void ms::SurfaceImpl::swap_buffers(std::shared_ptr<graphics::Buffer>& buffer)
108{108{
109 return surface->advance_client_buffer();109 surface->swap_buffers(buffer);
110}110}
111111
112void ms::SurfaceImpl::allow_framedropping(bool allow)112void ms::SurfaceImpl::allow_framedropping(bool allow)
113{113{
114 surface->allow_framedropping(allow);114 surface->allow_framedropping(allow);
115}115}
116 116
117void ms::SurfaceImpl::with_most_recent_buffer_do(117void ms::SurfaceImpl::with_most_recent_buffer_do(
118 std::function<void(mg::Buffer&)> const& exec)118 std::function<void(mg::Buffer&)> const& exec)
119{119{
@@ -247,6 +247,15 @@
247void ms::SurfaceImpl::resize(geom::Size const& size)247void ms::SurfaceImpl::resize(geom::Size const& size)
248{248{
249 surface->resize(size);249 surface->resize(size);
250
251 MirEvent e;
252 memset(&e, 0, sizeof e);
253 e.type = mir_event_type_resize;
254 e.resize.surface_id = id.as_value();
255 e.resize.width = size.width.as_int();
256 e.resize.height = size.height.as_int();
257
258 event_sink->handle_event(e);
250}259}
251260
252void ms::SurfaceImpl::set_rotation(float degrees, glm::vec3 const& axis)261void ms::SurfaceImpl::set_rotation(float degrees, glm::vec3 const& axis)
253262
=== modified file 'src/server/scene/surface_impl.h'
--- src/server/scene/surface_impl.h 2013-11-20 16:22:32 +0000
+++ src/server/scene/surface_impl.h 2013-11-28 12:22:03 +0000
@@ -72,7 +72,7 @@
7272
73 virtual void with_most_recent_buffer_do(73 virtual void with_most_recent_buffer_do(
74 std::function<void(graphics::Buffer&)> const& exec);74 std::function<void(graphics::Buffer&)> const& exec);
75 virtual std::shared_ptr<graphics::Buffer> advance_client_buffer();75 virtual void swap_buffers(std::shared_ptr<graphics::Buffer>& buffer);
7676
77 virtual bool supports_input() const;77 virtual bool supports_input() const;
78 virtual int client_input_fd() const;78 virtual int client_input_fd() const;
7979
=== modified file 'src/server/scene/surface_stack.h'
--- src/server/scene/surface_stack.h 2013-11-21 12:34:49 +0000
+++ src/server/scene/surface_stack.h 2013-11-28 12:22:03 +0000
@@ -72,15 +72,15 @@
72 virtual void reverse_for_each_if(compositor::FilterForScene& filter,72 virtual void reverse_for_each_if(compositor::FilterForScene& filter,
73 compositor::OperatorForScene& op);73 compositor::OperatorForScene& op);
74 virtual void set_change_callback(std::function<void()> const& f);74 virtual void set_change_callback(std::function<void()> const& f);
75 75
76 // From InputTargets76 // From InputTargets
77 void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback);77 void for_each(std::function<void(std::shared_ptr<input::InputChannel> const&)> const& callback);
7878
79 // From SurfaceStackModel 79 // From SurfaceStackModel
80 virtual std::weak_ptr<BasicSurface> create_surface(const shell::SurfaceCreationParameters& params);80 virtual std::weak_ptr<BasicSurface> create_surface(const shell::SurfaceCreationParameters& params);
8181
82 virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface);82 virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface);
83 83
84 virtual void raise(std::weak_ptr<BasicSurface> const& surface);84 virtual void raise(std::weak_ptr<BasicSurface> const& surface);
8585
86 virtual void lock();86 virtual void lock();
8787
=== modified file 'src/server/scene/surface_state.h'
--- src/server/scene/surface_state.h 2013-11-20 16:22:32 +0000
+++ src/server/scene/surface_state.h 2013-11-28 12:22:03 +0000
@@ -29,10 +29,10 @@
29{29{
3030
31class SurfaceState : public compositor::CompositingCriteria, public input::Surface,31class SurfaceState : public compositor::CompositingCriteria, public input::Surface,
32 public MutableSurfaceState 32 public MutableSurfaceState
33{33{
34protected:34protected:
35 SurfaceState() = default; 35 SurfaceState() = default;
36 virtual ~SurfaceState() = default;36 virtual ~SurfaceState() = default;
37 SurfaceState(const SurfaceState&) = delete;37 SurfaceState(const SurfaceState&) = delete;
38 SurfaceState& operator=(const SurfaceState& ) = delete;38 SurfaceState& operator=(const SurfaceState& ) = delete;
3939
=== modified file 'src/server/shell/default_focus_mechanism.cpp'
--- src/server/shell/default_focus_mechanism.cpp 2013-11-21 03:16:21 +0000
+++ src/server/shell/default_focus_mechanism.cpp 2013-11-28 12:22:03 +0000
@@ -41,7 +41,7 @@
41 input_targeter->focus_cleared();41 input_targeter->focus_cleared();
42 return;42 return;
43 }43 }
44 44
45 auto surface = focus_session->default_surface();45 auto surface = focus_session->default_surface();
46 if (surface)46 if (surface)
47 {47 {
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches