Merge lp:~mir-team/mir/trunk-0.1.8 into lp:mir/0.1
- trunk-0.1.8
- Merge into trusty
Status: | Merged |
---|---|
Merged at revision: | 1183 |
Proposed branch: | lp:~mir-team/mir/trunk-0.1.8 |
Merge into: | lp:mir/0.1 |
Diff against target: |
16448 lines (+6002/-3362) 277 files modified
3rd_party/android-input/android/CMakeLists.txt (+2/-0) 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+46/-92) 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+6/-5) CMakeLists.txt (+1/-1) benchmarks/android-input/CMakeLists.txt (+3/-1) cmake/MirCommon.cmake (+15/-4) cmake/src/mir/CMakeLists.txt (+5/-0) cmake/src/mir/fail_on_success.sh (+8/-0) cmake/src/mir/mir_discover_gtest_tests.cpp (+15/-2) debian/changelog (+66/-0) debian/control (+3/-3) debian/libmirserver18.install (+1/-1) deploy-and-test.sh (+21/-0) examples/demo-shell/demo_renderer.cpp (+271/-0) examples/demo-shell/demo_renderer.h (+15/-0) examples/render_overlays.cpp (+9/-7) examples/render_surfaces.cpp (+19/-7) include/platform/mir/graphics/display_buffer.h (+2/-3) include/platform/mir/graphics/gl_config.h (+54/-0) include/platform/mir/graphics/platform.h (+8/-1) include/platform/mir/graphics/renderable.h (+20/-13) include/platform/mir/options/default_configuration.h (+1/-0) include/platform/mir/shared_library_loader.h (+28/-0) include/server/mir/compositor/buffer_stream.h (+1/-1) include/server/mir/compositor/gl_renderer.h (+27/-4) include/server/mir/compositor/renderer.h (+2/-2) include/server/mir/compositor/scene.h (+7/-4) include/server/mir/default_server_configuration.h (+12/-8) include/server/mir/frontend/display_changer.h (+0/-1) include/server/mir/frontend/session_authorizer.h (+3/-1) include/server/mir/input/surface.h (+1/-1) include/server/mir/scene/surface.h (+59/-0) include/server/mir/scene/surface_configurator.h (+4/-4) include/server/mir/scene/surface_coordinator.h (+17/-12) include/server/mir/scene/surface_event_source.h (+49/-0) include/server/mir/scene/surface_factory.h (+14/-14) include/server/mir/scene/surface_observer.h (+45/-0) include/server/mir/scene/surface_ranker.h (+2/-2) include/server/mir/shell/surface.h (+1/-3) include/server/mir/shell/surface_factory.h (+6/-8) include/shared/mir/geometry/length.h (+102/-0) include/test/mir_test_doubles/fake_renderable.h (+5/-5) include/test/mir_test_doubles/mock_buffer_bundle.h (+1/-1) include/test/mir_test_doubles/mock_buffer_stream.h (+1/-1) include/test/mir_test_doubles/mock_display_buffer.h (+1/-1) include/test/mir_test_doubles/mock_display_changer.h (+0/-1) include/test/mir_test_doubles/mock_display_device.h (+1/-1) include/test/mir_test_doubles/mock_egl.h (+27/-0) include/test/mir_test_doubles/mock_gl_config.h (+43/-0) include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+0/-105) include/test/mir_test_doubles/mock_hwc_device_wrapper.h (+42/-0) include/test/mir_test_doubles/mock_input_surface.h (+2/-2) include/test/mir_test_doubles/mock_renderable.h (+12/-3) include/test/mir_test_doubles/mock_scene.h (+6/-2) include/test/mir_test_doubles/mock_surface.h (+14/-12) include/test/mir_test_doubles/mock_surface_configurator.h (+4/-4) include/test/mir_test_doubles/mock_surface_factory.h (+4/-3) include/test/mir_test_doubles/mock_surface_ranker.h (+2/-2) include/test/mir_test_doubles/null_display_buffer.h (+1/-1) include/test/mir_test_doubles/null_display_changer.h (+0/-3) include/test/mir_test_doubles/null_platform.h (+2/-1) include/test/mir_test_doubles/null_surface_configurator.h (+4/-4) include/test/mir_test_doubles/stub_buffer_stream.h (+1/-1) include/test/mir_test_doubles/stub_display_builder.h (+1/-1) include/test/mir_test_doubles/stub_display_device.h (+1/-1) include/test/mir_test_doubles/stub_gl_config.h (+43/-0) include/test/mir_test_doubles/stub_ipc_factory.h (+1/-1) include/test/mir_test_doubles/stub_renderable.h (+2/-2) include/test/mir_test_doubles/stub_session_authorizer.h (+4/-0) include/test/mir_test_doubles/stub_surface_builder.h (+0/-69) include/test/mir_test_doubles/stub_surface_ranker.h (+0/-44) include/test/mir_test_framework/declarative_placement_strategy.h (+64/-0) include/test/mir_test_framework/udev_environment.h (+1/-0) src/client/default_connection_configuration.cpp (+1/-1) src/client/lttng/input_receiver_report_tp.h (+1/-0) src/client/lttng/rpc_report_tp.h (+1/-0) src/client/mir_client_library.cpp (+11/-2) src/client/rpc/mir_basic_rpc_channel.cpp (+3/-3) src/client/rpc/mir_basic_rpc_channel.h (+4/-3) src/client/rpc/mir_socket_rpc_channel.cpp (+41/-32) src/client/rpc/mir_socket_rpc_channel.h (+3/-1) src/platform/CMakeLists.txt (+2/-1) src/platform/graphics/android/CMakeLists.txt (+4/-0) src/platform/graphics/android/android_display.cpp (+2/-1) src/platform/graphics/android/android_display.h (+2/-0) src/platform/graphics/android/android_platform.cpp (+37/-4) src/platform/graphics/android/android_platform.h (+2/-1) src/platform/graphics/android/display_buffer.cpp (+1/-1) src/platform/graphics/android/display_buffer.h (+1/-1) src/platform/graphics/android/display_device.h (+1/-1) src/platform/graphics/android/fb_device.cpp (+1/-1) src/platform/graphics/android/fb_device.h (+1/-1) src/platform/graphics/android/gl_context.cpp (+17/-10) src/platform/graphics/android/gl_context.h (+4/-1) src/platform/graphics/android/hwc_common_device.cpp (+2/-2) src/platform/graphics/android/hwc_common_device.h (+2/-1) src/platform/graphics/android/hwc_device.cpp (+2/-1) src/platform/graphics/android/hwc_device.h (+2/-15) src/platform/graphics/android/hwc_fb_device.cpp (+12/-17) src/platform/graphics/android/hwc_fb_device.h (+5/-1) src/platform/graphics/android/hwc_formatted_logger.cpp (+177/-0) src/platform/graphics/android/hwc_formatted_logger.h (+41/-0) src/platform/graphics/android/hwc_layerlist.cpp (+4/-4) src/platform/graphics/android/hwc_layerlist.h (+2/-2) src/platform/graphics/android/hwc_logger.h (+46/-0) src/platform/graphics/android/hwc_wrapper.h (+47/-0) src/platform/graphics/android/real_hwc_wrapper.cpp (+11/-2) src/platform/graphics/android/real_hwc_wrapper.h (+6/-3) src/platform/graphics/android/resource_factory.cpp (+35/-2) src/platform/graphics/android/resource_factory.h (+4/-0) src/platform/graphics/mesa/CMakeLists.txt (+1/-0) src/platform/graphics/mesa/display.cpp (+13/-3) src/platform/graphics/mesa/display.h (+5/-2) src/platform/graphics/mesa/display_buffer.cpp (+3/-1) src/platform/graphics/mesa/display_buffer.h (+3/-1) src/platform/graphics/mesa/display_helpers.cpp (+15/-3) src/platform/graphics/mesa/display_helpers.h (+5/-5) src/platform/graphics/mesa/platform.cpp (+11/-1) src/platform/graphics/mesa/platform.h (+2/-1) src/platform/options/default_configuration.cpp (+32/-3) src/platform/shared_library_loader.cpp (+38/-0) src/server/CMakeLists.txt (+1/-1) src/server/compositor/buffer_bundle.h (+13/-1) src/server/compositor/buffer_stream_surfaces.cpp (+2/-2) src/server/compositor/buffer_stream_surfaces.h (+1/-1) src/server/compositor/bypass.cpp (+6/-1) src/server/compositor/default_display_buffer_compositor.cpp (+32/-57) src/server/compositor/default_display_buffer_compositor.h (+1/-2) src/server/compositor/gl_renderer.cpp (+68/-22) src/server/compositor/occlusion.cpp (+28/-16) src/server/compositor/occlusion.h (+2/-24) src/server/compositor/rendering_operator.cpp (+5/-11) src/server/compositor/rendering_operator.h (+3/-7) src/server/compositor/screencast_display_buffer.cpp (+1/-1) src/server/compositor/screencast_display_buffer.h (+1/-1) src/server/compositor/switching_bundle.cpp (+6/-3) src/server/compositor/switching_bundle.h (+3/-4) src/server/compositor/temporary_buffers.cpp (+2/-2) src/server/compositor/temporary_buffers.h (+1/-1) src/server/default_server_configuration.cpp (+11/-6) src/server/frontend/CMakeLists.txt (+1/-0) src/server/frontend/default_configuration.cpp (+23/-7) src/server/frontend/event_sender.cpp (+1/-1) src/server/frontend/message_receiver.h (+3/-1) src/server/frontend/message_sender.h (+2/-2) src/server/frontend/protobuf_ipc_factory.h (+1/-2) src/server/frontend/protobuf_responder.cpp (+9/-8) src/server/frontend/protobuf_responder.h (+1/-1) src/server/frontend/protobuf_session_creator.cpp (+1/-2) src/server/frontend/session_mediator.cpp (+0/-6) src/server/frontend/socket_messenger.cpp (+29/-14) src/server/frontend/socket_messenger.h (+4/-3) src/server/frontend/socket_session.cpp (+16/-9) src/server/frontend/socket_session.h (+3/-2) src/server/frontend/unauthorized_display_changer.cpp (+0/-5) src/server/frontend/unauthorized_display_changer.h (+0/-2) src/server/frontend/unauthorized_screencast.cpp (+46/-0) src/server/frontend/unauthorized_screencast.h (+44/-0) src/server/graphics/default_configuration.cpp (+20/-21) src/server/graphics/nested/nested_display.cpp (+11/-4) src/server/graphics/nested/nested_display.h (+6/-2) src/server/graphics/nested/nested_output.cpp (+1/-1) src/server/graphics/nested/nested_output.h (+1/-1) src/server/graphics/nested/nested_platform.cpp (+5/-2) src/server/graphics/nested/nested_platform.h (+2/-1) src/server/graphics/offscreen/display_buffer.cpp (+1/-1) src/server/graphics/offscreen/display_buffer.h (+1/-1) src/server/mirserver.pc.in (+1/-1) src/server/scene/CMakeLists.txt (+1/-2) src/server/scene/application_session.cpp (+10/-2) src/server/scene/basic_surface.cpp (+193/-27) src/server/scene/basic_surface.h (+73/-26) src/server/scene/default_configuration.cpp (+18/-27) src/server/scene/gl_pixel_buffer.cpp (+7/-0) src/server/scene/mediating_display_changer.cpp (+0/-23) src/server/scene/mediating_display_changer.h (+0/-2) src/server/scene/mutable_surface_state.h (+0/-52) src/server/scene/surface_allocator.cpp (+8/-4) src/server/scene/surface_allocator.h (+8/-4) src/server/scene/surface_controller.cpp (+23/-13) src/server/scene/surface_controller.h (+16/-15) src/server/scene/surface_event_source.cpp (+62/-0) src/server/scene/surface_impl.cpp (+0/-273) src/server/scene/surface_impl.h (+0/-114) src/server/scene/surface_source.cpp (+0/-47) src/server/scene/surface_source.h (+0/-64) src/server/scene/surface_stack.cpp (+23/-34) src/server/scene/surface_stack.h (+19/-19) src/server/scene/surface_stack_model.h (+13/-6) src/server/shell/default_configuration.cpp (+1/-1) src/server/shell/default_focus_mechanism.cpp (+3/-1) src/server/shell/organising_surface_factory.cpp (+29/-10) src/server/shell/organising_surface_factory.h (+9/-6) src/shared/sharedlibrary/CMakeLists.txt (+5/-0) tests/CMakeLists.txt (+3/-10) tests/acceptance-tests/test_client_authorization.cpp (+3/-0) tests/acceptance-tests/test_client_input.cpp (+33/-70) tests/acceptance-tests/test_client_screencast.cpp (+50/-0) tests/acceptance-tests/test_display_configuration.cpp (+5/-4) tests/acceptance-tests/test_protobuf.cpp (+5/-0) tests/acceptance-tests/test_server_disconnect.cpp (+2/-0) tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+6/-6) tests/acceptance-tests/test_surfaces_with_output_id.cpp (+7/-1) tests/integration-tests/compositor/test_buffer_stream.cpp (+21/-21) tests/integration-tests/compositor/test_swapping_swappers.cpp (+2/-4) tests/integration-tests/graphics/android/test_display_integration.cpp (+9/-6) tests/integration-tests/graphics/android/test_internal_client.cpp (+7/-7) tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+4/-1) tests/integration-tests/test_display_info.cpp (+2/-1) tests/integration-tests/test_session_manager.cpp (+1/-1) tests/integration-tests/test_surfaceloop.cpp (+4/-2) tests/integration-tests/test_swapinterval.cpp (+1/-1) tests/mir_test_framework/CMakeLists.txt (+10/-11) tests/mir_test_framework/declarative_placement_strategy.cpp (+58/-0) tests/mir_test_framework/stubbed_server_configuration.cpp (+2/-1) tests/mir_test_framework/udev_environment.cpp (+22/-2) tests/mir_test_framework/udev_recordings/bluetooth-magic-trackpad.ioctl (+21/-0) tests/mir_test_framework/udev_recordings/bluetooth-magic-trackpad.umockdev (+222/-0) tests/mir_test_framework/udev_recordings/laptop-keyboard.ioctl (+12/-0) tests/mir_test_framework/udev_recordings/laptop-keyboard.umockdev (+74/-0) tests/mir_test_framework/udev_recordings/synaptics-touchpad.ioctl (+29/-0) tests/mir_test_framework/udev_recordings/synaptics-touchpad.umockdev (+65/-0) tests/mir_test_framework/udev_recordings/usb-keyboard.ioctl (+13/-0) tests/mir_test_framework/udev_recordings/usb-keyboard.umockdev (+244/-0) tests/mir_test_framework/udev_recordings/usb-mouse.ioctl (+14/-0) tests/mir_test_framework/udev_recordings/usb-mouse.umockdev (+240/-0) tests/mir_test_framework/using_stub_client_platform.cpp (+11/-2) tests/unit-tests/CMakeLists.txt (+5/-14) tests/unit-tests/android_input/CMakeLists.txt (+1/-0) tests/unit-tests/android_input/test_eventhub.cpp (+125/-0) tests/unit-tests/client/test_mir_connection.cpp (+6/-0) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+348/-444) tests/unit-tests/compositor/test_gl_renderer.cpp (+21/-2) tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+5/-2) tests/unit-tests/compositor/test_occlusion.cpp (+123/-81) tests/unit-tests/compositor/test_rendering_operator.cpp (+15/-15) tests/unit-tests/compositor/test_switching_bundle.cpp (+69/-51) tests/unit-tests/frontend/test_event_sender.cpp (+7/-7) tests/unit-tests/frontend/test_session_mediator.cpp (+4/-5) tests/unit-tests/frontend/test_socket_session.cpp (+43/-14) tests/unit-tests/geometry/CMakeLists.txt (+1/-0) tests/unit-tests/geometry/test-length.cpp (+124/-0) tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/android/hwc_struct_helpers.h (+8/-0) tests/unit-tests/graphics/android/test_android_fb.cpp (+64/-31) tests/unit-tests/graphics/android/test_hwc_common_device.cpp (+3/-1) tests/unit-tests/graphics/android/test_hwc_device.cpp (+5/-9) tests/unit-tests/graphics/android/test_hwc_display.cpp (+6/-1) tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+44/-74) tests/unit-tests/graphics/android/test_hwc_logger.cpp (+132/-0) tests/unit-tests/graphics/android/test_hwc_wrapper.cpp (+28/-7) tests/unit-tests/graphics/android/test_output_builder.cpp (+4/-1) tests/unit-tests/graphics/android/test_resource_factory.cpp (+5/-4) tests/unit-tests/graphics/mesa/test_display.cpp (+41/-8) tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+12/-0) tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+4/-2) tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+7/-4) tests/unit-tests/graphics/mesa/test_internal_native_display.cpp (+0/-4) tests/unit-tests/graphics/mesa/test_internal_native_surface.cpp (+0/-3) tests/unit-tests/graphics/nested/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/nested/test_nested_display.cpp (+27/-0) tests/unit-tests/graphics/test_display.cpp (+4/-2) tests/unit-tests/input/android/test_android_input_application_handle.cpp (+1/-1) tests/unit-tests/input/android/test_android_input_registrar.cpp (+2/-3) tests/unit-tests/input/android/test_android_input_window_handle.cpp (+18/-11) tests/unit-tests/scene/test_application_session.cpp (+12/-14) tests/unit-tests/scene/test_basic_surface.cpp (+124/-106) tests/unit-tests/scene/test_default_focus_mechanism.cpp (+23/-40) tests/unit-tests/scene/test_gl_pixel_buffer.cpp (+10/-0) tests/unit-tests/scene/test_session_manager.cpp (+19/-17) tests/unit-tests/scene/test_surface.cpp (+73/-31) tests/unit-tests/scene/test_surface_controller.cpp (+36/-14) tests/unit-tests/scene/test_surface_impl.cpp (+117/-209) tests/unit-tests/scene/test_surface_stack.cpp (+143/-317) tests/unit-tests/shell/test_organising_surface_factory.cpp (+24/-16) tools/valgrind_suppressions_armhf (+30/-0) tools/valgrind_suppressions_generic (+7/-0) |
To merge this branch: | bzr merge lp:~mir-team/mir/trunk-0.1.8 |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Daniel van Vugt | Approve | ||
kevin gunn (community) | Approve | ||
Review via email: mp+213790@code.launchpad.net |
Commit message
New upstream Mir release 0.1.8 (development-branch r1523), plus changelog
additions.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
There is arguably one important fix missing from the 0.1.8 release. That is bug 1301040. We might want to add it in here...
Kevin DuBois (kdub) wrote : | # |
Yes, the fix for that lp:~mterry/mir/missing-links (in the landing queue at time of this comment) should make it into this release. (would be caught during the silo build)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1185
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
kevin gunn (kgunn72) wrote : | # |
there is one more we should cherry pick for https:/
which is proposed to be solved by https:/
kevin gunn (kgunn72) wrote : | # |
Did you test your feature/code change/bug fix ? what device(s) ?
yes - n4, desktop
Did you break mir server API or ABI and have the relevant bumps to .so and debian docs been made ?
yes, server ABI only, bumps have been made
Did you break mir client API or ABI and have you followed up with the known clients & announced on mir-devel mailing list ?
yes, server only, unity-mir/server updates made
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1186
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) wrote : | # |
Changelog entry missing for latest commit.
Daniel van Vugt (vanvugt) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1187
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file '3rd_party/android-input/android/CMakeLists.txt' | |||
2 | --- 3rd_party/android-input/android/CMakeLists.txt 2014-03-06 06:05:17 +0000 | |||
3 | +++ 3rd_party/android-input/android/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
4 | @@ -7,6 +7,7 @@ | |||
5 | 7 | system/extras/ext4_utils | 7 | system/extras/ext4_utils |
6 | 8 | 8 | ||
7 | 9 | ${PROJECT_SOURCE_DIR}/include/server | 9 | ${PROJECT_SOURCE_DIR}/include/server |
8 | 10 | ${PROJECT_SOURCE_DIR}/include/platform | ||
9 | 10 | ) | 11 | ) |
10 | 11 | 12 | ||
11 | 12 | add_definitions( | 13 | add_definitions( |
12 | @@ -64,6 +65,7 @@ | |||
13 | 64 | target_link_libraries( | 65 | target_link_libraries( |
14 | 65 | android-input | 66 | android-input |
15 | 66 | 67 | ||
16 | 68 | mirplatform | ||
17 | 67 | ${Boost_LIBRARIES} | 69 | ${Boost_LIBRARIES} |
18 | 68 | ) | 70 | ) |
19 | 69 | 71 | ||
20 | 70 | 72 | ||
21 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp' | |||
22 | --- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-10-03 05:12:59 +0000 | |||
23 | +++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2014-04-07 13:29:13 +0000 | |||
24 | @@ -205,34 +205,34 @@ | |||
25 | 205 | 205 | ||
26 | 206 | // --- EventHub --- | 206 | // --- EventHub --- |
27 | 207 | 207 | ||
29 | 208 | const uint32_t EventHub::EPOLL_ID_INOTIFY; | 208 | const uint32_t EventHub::EPOLL_ID_UDEV; |
30 | 209 | const uint32_t EventHub::EPOLL_ID_WAKE; | 209 | const uint32_t EventHub::EPOLL_ID_WAKE; |
31 | 210 | const int EventHub::EPOLL_SIZE_HINT; | 210 | const int EventHub::EPOLL_SIZE_HINT; |
32 | 211 | const int EventHub::EPOLL_MAX_EVENTS; | 211 | const int EventHub::EPOLL_MAX_EVENTS; |
33 | 212 | 212 | ||
34 | 213 | EventHub::EventHub(std::shared_ptr<mi::InputReport> const& input_report) : | 213 | EventHub::EventHub(std::shared_ptr<mi::InputReport> const& input_report) : |
35 | 214 | input_report(input_report), | 214 | input_report(input_report), |
36 | 215 | device_listener{mir::udev::Context()}, | ||
37 | 215 | mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1), | 216 | mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1), |
38 | 216 | mOpeningDevices(0), mClosingDevices(0), | 217 | mOpeningDevices(0), mClosingDevices(0), |
39 | 217 | mNeedToSendFinishedDeviceScan(false), | 218 | mNeedToSendFinishedDeviceScan(false), |
40 | 218 | mNeedToReopenDevices(false), mNeedToScanDevices(true), | 219 | mNeedToReopenDevices(false), mNeedToScanDevices(true), |
42 | 219 | mPendingEventCount(0), mPendingEventIndex(0), mPendingINotify(false) { | 220 | mPendingEventCount(0), mPendingEventIndex(0), mPendingUdevEvent(false) { |
43 | 220 | acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID); | 221 | acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID); |
44 | 221 | 222 | ||
45 | 222 | mEpollFd = epoll_create(EPOLL_SIZE_HINT); | 223 | mEpollFd = epoll_create(EPOLL_SIZE_HINT); |
46 | 223 | LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno); | 224 | LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno); |
47 | 224 | 225 | ||
52 | 225 | mINotifyFd = inotify_init(); | 226 | device_listener.filter_by_subsystem("input"); |
53 | 226 | int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE | IN_ATTRIB); | 227 | device_listener.enable(); |
54 | 227 | LOG_ALWAYS_FATAL_IF(result < 0, "Could not register INotify for %s. errno=%d", | 228 | |
51 | 228 | DEVICE_PATH, errno); | ||
55 | 229 | 229 | ||
56 | 230 | struct epoll_event eventItem; | 230 | struct epoll_event eventItem; |
57 | 231 | memset(&eventItem, 0, sizeof(eventItem)); | 231 | memset(&eventItem, 0, sizeof(eventItem)); |
58 | 232 | eventItem.events = EPOLLIN; | 232 | eventItem.events = EPOLLIN; |
62 | 233 | eventItem.data.u32 = EPOLL_ID_INOTIFY; | 233 | eventItem.data.u32 = EPOLL_ID_UDEV; |
63 | 234 | result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mINotifyFd, &eventItem); | 234 | int result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, device_listener.fd(), &eventItem); |
64 | 235 | LOG_ALWAYS_FATAL_IF(result != 0, "Could not add INotify to epoll instance. errno=%d", errno); | 235 | LOG_ALWAYS_FATAL_IF(result != 0, "Could not add Udev monitor to epoll instance. errno=%d", errno); |
65 | 236 | 236 | ||
66 | 237 | int wakeFds[2]; | 237 | int wakeFds[2]; |
67 | 238 | result = pipe(wakeFds); | 238 | result = pipe(wakeFds); |
68 | @@ -265,7 +265,6 @@ | |||
69 | 265 | } | 265 | } |
70 | 266 | 266 | ||
71 | 267 | ::close(mEpollFd); | 267 | ::close(mEpollFd); |
72 | 268 | ::close(mINotifyFd); | ||
73 | 269 | ::close(mWakeReadPipeFd); | 268 | ::close(mWakeReadPipeFd); |
74 | 270 | ::close(mWakeWritePipeFd); | 269 | ::close(mWakeWritePipeFd); |
75 | 271 | 270 | ||
76 | @@ -730,9 +729,9 @@ | |||
77 | 730 | bool deviceChanged = false; | 729 | bool deviceChanged = false; |
78 | 731 | while (mPendingEventIndex < mPendingEventCount) { | 730 | while (mPendingEventIndex < mPendingEventCount) { |
79 | 732 | const struct epoll_event& eventItem = mPendingEventItems[mPendingEventIndex++]; | 731 | const struct epoll_event& eventItem = mPendingEventItems[mPendingEventIndex++]; |
81 | 733 | if (eventItem.data.u32 == EPOLL_ID_INOTIFY) { | 732 | if (eventItem.data.u32 == EPOLL_ID_UDEV) { |
82 | 734 | if (eventItem.events & EPOLLIN) { | 733 | if (eventItem.events & EPOLLIN) { |
84 | 735 | mPendingINotify = true; | 734 | mPendingUdevEvent = true; |
85 | 736 | } else { | 735 | } else { |
86 | 737 | ALOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events); | 736 | ALOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events); |
87 | 738 | } | 737 | } |
88 | @@ -839,9 +838,9 @@ | |||
89 | 839 | // readNotify() will modify the list of devices so this must be done after | 838 | // readNotify() will modify the list of devices so this must be done after |
90 | 840 | // processing all other events to ensure that we read all remaining events | 839 | // processing all other events to ensure that we read all remaining events |
91 | 841 | // before closing the devices. | 840 | // before closing the devices. |
95 | 842 | if (mPendingINotify && mPendingEventIndex >= mPendingEventCount) { | 841 | if (mPendingUdevEvent && mPendingEventIndex >= mPendingEventCount) { |
96 | 843 | mPendingINotify = false; | 842 | mPendingUdevEvent = false; |
97 | 844 | readNotifyLocked(); | 843 | handleUdevEventsLocked(); |
98 | 845 | deviceChanged = true; | 844 | deviceChanged = true; |
99 | 846 | } | 845 | } |
100 | 847 | 846 | ||
101 | @@ -916,15 +915,44 @@ | |||
102 | 916 | } | 915 | } |
103 | 917 | 916 | ||
104 | 918 | void EventHub::scanDevicesLocked() { | 917 | void EventHub::scanDevicesLocked() { |
108 | 919 | status_t res = scanDirLocked(DEVICE_PATH); | 918 | mir::udev::Enumerator input_enumerator{std::make_shared<mir::udev::Context>()}; |
109 | 920 | if(res < 0) { | 919 | |
110 | 921 | ALOGE("scan dir failed for %s\n", DEVICE_PATH); | 920 | input_enumerator.match_subsystem("input"); |
111 | 921 | input_enumerator.scan_devices(); | ||
112 | 922 | |||
113 | 923 | for (auto& device : input_enumerator) | ||
114 | 924 | { | ||
115 | 925 | if (device.devnode() != nullptr) | ||
116 | 926 | { | ||
117 | 927 | openDeviceLocked(device.devnode()); | ||
118 | 928 | } | ||
119 | 922 | } | 929 | } |
120 | 930 | |||
121 | 923 | if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) { | 931 | if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) { |
122 | 924 | createVirtualKeyboardLocked(); | 932 | createVirtualKeyboardLocked(); |
123 | 925 | } | 933 | } |
124 | 926 | } | 934 | } |
125 | 927 | 935 | ||
126 | 936 | void EventHub::handleUdevEventsLocked() | ||
127 | 937 | { | ||
128 | 938 | device_listener.process_events([this](mir::udev::Monitor::EventType type, mir::udev::Device const& dev){ | ||
129 | 939 | if (type == mir::udev::Monitor::ADDED) | ||
130 | 940 | { | ||
131 | 941 | if (dev.devnode() != nullptr) | ||
132 | 942 | { | ||
133 | 943 | openDeviceLocked(dev.devnode()); | ||
134 | 944 | } | ||
135 | 945 | } | ||
136 | 946 | else if (type == mir::udev::Monitor::REMOVED) | ||
137 | 947 | { | ||
138 | 948 | if (dev.devnode() != nullptr) | ||
139 | 949 | { | ||
140 | 950 | closeDeviceByPathLocked(dev.devnode()); | ||
141 | 951 | } | ||
142 | 952 | } | ||
143 | 953 | }); | ||
144 | 954 | } | ||
145 | 955 | |||
146 | 928 | // ---------------------------------------------------------------------------- | 956 | // ---------------------------------------------------------------------------- |
147 | 929 | 957 | ||
148 | 930 | static bool containsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex) { | 958 | static bool containsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex) { |
149 | @@ -1391,80 +1419,6 @@ | |||
150 | 1391 | } | 1419 | } |
151 | 1392 | } | 1420 | } |
152 | 1393 | 1421 | ||
153 | 1394 | status_t EventHub::readNotifyLocked() { | ||
154 | 1395 | int res; | ||
155 | 1396 | char devname[PATH_MAX]; | ||
156 | 1397 | char *filename; | ||
157 | 1398 | char event_buf[512]; | ||
158 | 1399 | int event_size; | ||
159 | 1400 | int event_pos = 0; | ||
160 | 1401 | struct inotify_event *event; | ||
161 | 1402 | |||
162 | 1403 | ALOGV("EventHub::readNotify nfd: %d\n", mINotifyFd); | ||
163 | 1404 | res = read(mINotifyFd, event_buf, sizeof(event_buf)); | ||
164 | 1405 | if(res < (int)sizeof(*event)) { | ||
165 | 1406 | if(errno == EINTR) | ||
166 | 1407 | return 0; | ||
167 | 1408 | ALOGW("could not get event, %s\n", strerror(errno)); | ||
168 | 1409 | return -1; | ||
169 | 1410 | } | ||
170 | 1411 | //printf("got %d bytes of event information\n", res); | ||
171 | 1412 | |||
172 | 1413 | strcpy(devname, DEVICE_PATH); | ||
173 | 1414 | filename = devname + strlen(devname); | ||
174 | 1415 | *filename++ = '/'; | ||
175 | 1416 | |||
176 | 1417 | while(res >= (int)sizeof(*event)) { | ||
177 | 1418 | event = (struct inotify_event *)(event_buf + event_pos); | ||
178 | 1419 | //printf("%d: %08x \"%s\"\n", event->wd, event->mask, event->len ? event->name : ""); | ||
179 | 1420 | if(event->len) { | ||
180 | 1421 | strcpy(filename, event->name); | ||
181 | 1422 | if(event->mask & IN_CREATE) { | ||
182 | 1423 | openDeviceLocked(devname); | ||
183 | 1424 | } else if (event->mask & IN_ATTRIB) { | ||
184 | 1425 | Device* device = getDeviceByPathLocked(devname); | ||
185 | 1426 | if (!device) { | ||
186 | 1427 | ALOGI("Retry opening device file %s", devname); | ||
187 | 1428 | // file permissions might have changed, making the device readable now | ||
188 | 1429 | // let's retry opening it | ||
189 | 1430 | openDeviceLocked(devname); | ||
190 | 1431 | } | ||
191 | 1432 | } else { | ||
192 | 1433 | ALOGI("Removing device '%s' due to inotify event\n", devname); | ||
193 | 1434 | closeDeviceByPathLocked(devname); | ||
194 | 1435 | } | ||
195 | 1436 | } | ||
196 | 1437 | event_size = sizeof(*event) + event->len; | ||
197 | 1438 | res -= event_size; | ||
198 | 1439 | event_pos += event_size; | ||
199 | 1440 | } | ||
200 | 1441 | return 0; | ||
201 | 1442 | } | ||
202 | 1443 | |||
203 | 1444 | status_t EventHub::scanDirLocked(const char *dirname) | ||
204 | 1445 | { | ||
205 | 1446 | char devname[PATH_MAX]; | ||
206 | 1447 | char *filename; | ||
207 | 1448 | DIR *dir; | ||
208 | 1449 | struct dirent *de; | ||
209 | 1450 | dir = opendir(dirname); | ||
210 | 1451 | if(dir == NULL) | ||
211 | 1452 | return -1; | ||
212 | 1453 | strcpy(devname, dirname); | ||
213 | 1454 | filename = devname + strlen(devname); | ||
214 | 1455 | *filename++ = '/'; | ||
215 | 1456 | while((de = readdir(dir))) { | ||
216 | 1457 | if(de->d_name[0] == '.' && | ||
217 | 1458 | (de->d_name[1] == '\0' || | ||
218 | 1459 | (de->d_name[1] == '.' && de->d_name[2] == '\0'))) | ||
219 | 1460 | continue; | ||
220 | 1461 | strcpy(filename, de->d_name); | ||
221 | 1462 | openDeviceLocked(devname); | ||
222 | 1463 | } | ||
223 | 1464 | closedir(dir); | ||
224 | 1465 | return 0; | ||
225 | 1466 | } | ||
226 | 1467 | |||
227 | 1468 | void EventHub::requestReopenDevices() { | 1422 | void EventHub::requestReopenDevices() { |
228 | 1469 | ALOGV("requestReopenDevices() called"); | 1423 | ALOGV("requestReopenDevices() called"); |
229 | 1470 | 1424 | ||
230 | 1471 | 1425 | ||
231 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h' | |||
232 | --- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-10-03 05:12:59 +0000 | |||
233 | +++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2014-04-07 13:29:13 +0000 | |||
234 | @@ -18,6 +18,8 @@ | |||
235 | 18 | #ifndef _RUNTIME_EVENT_HUB_H | 18 | #ifndef _RUNTIME_EVENT_HUB_H |
236 | 19 | #define _RUNTIME_EVENT_HUB_H | 19 | #define _RUNTIME_EVENT_HUB_H |
237 | 20 | 20 | ||
238 | 21 | #include "mir/udev/wrapper.h" | ||
239 | 22 | |||
240 | 21 | #include <androidfw/Input.h> | 23 | #include <androidfw/Input.h> |
241 | 22 | #include <androidfw/InputDevice.h> | 24 | #include <androidfw/InputDevice.h> |
242 | 23 | #include <androidfw/Keyboard.h> | 25 | #include <androidfw/Keyboard.h> |
243 | @@ -366,9 +368,8 @@ | |||
244 | 366 | void closeDeviceLocked(Device* device); | 368 | void closeDeviceLocked(Device* device); |
245 | 367 | void closeAllDevicesLocked(); | 369 | void closeAllDevicesLocked(); |
246 | 368 | 370 | ||
247 | 369 | status_t scanDirLocked(const char *dirname); | ||
248 | 370 | void scanDevicesLocked(); | 371 | void scanDevicesLocked(); |
250 | 371 | status_t readNotifyLocked(); | 372 | void handleUdevEventsLocked(); |
251 | 372 | 373 | ||
252 | 373 | Device* getDeviceLocked(int32_t deviceId) const; | 374 | Device* getDeviceLocked(int32_t deviceId) const; |
253 | 374 | Device* getDeviceByPathLocked(const char* devicePath) const; | 375 | Device* getDeviceByPathLocked(const char* devicePath) const; |
254 | @@ -407,12 +408,12 @@ | |||
255 | 407 | Vector<String8> mExcludedDevices; | 408 | Vector<String8> mExcludedDevices; |
256 | 408 | 409 | ||
257 | 409 | int mEpollFd; | 410 | int mEpollFd; |
259 | 410 | int mINotifyFd; | 411 | mir::udev::Monitor device_listener; |
260 | 411 | int mWakeReadPipeFd; | 412 | int mWakeReadPipeFd; |
261 | 412 | int mWakeWritePipeFd; | 413 | int mWakeWritePipeFd; |
262 | 413 | 414 | ||
263 | 414 | // Ids used for epoll notifications not associated with devices. | 415 | // Ids used for epoll notifications not associated with devices. |
265 | 415 | static const uint32_t EPOLL_ID_INOTIFY = 0x80000001; | 416 | static const uint32_t EPOLL_ID_UDEV = 0x80000001; |
266 | 416 | static const uint32_t EPOLL_ID_WAKE = 0x80000002; | 417 | static const uint32_t EPOLL_ID_WAKE = 0x80000002; |
267 | 417 | 418 | ||
268 | 418 | // Epoll FD list size hint. | 419 | // Epoll FD list size hint. |
269 | @@ -425,7 +426,7 @@ | |||
270 | 425 | struct epoll_event mPendingEventItems[EPOLL_MAX_EVENTS]; | 426 | struct epoll_event mPendingEventItems[EPOLL_MAX_EVENTS]; |
271 | 426 | size_t mPendingEventCount; | 427 | size_t mPendingEventCount; |
272 | 427 | size_t mPendingEventIndex; | 428 | size_t mPendingEventIndex; |
274 | 428 | bool mPendingINotify; | 429 | bool mPendingUdevEvent; |
275 | 429 | }; | 430 | }; |
276 | 430 | 431 | ||
277 | 431 | // Made available to test | 432 | // Made available to test |
278 | 432 | 433 | ||
279 | === modified file 'CMakeLists.txt' | |||
280 | --- CMakeLists.txt 2014-03-06 06:05:17 +0000 | |||
281 | +++ CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
282 | @@ -28,7 +28,7 @@ | |||
283 | 28 | 28 | ||
284 | 29 | set(MIR_VERSION_MAJOR 0) | 29 | set(MIR_VERSION_MAJOR 0) |
285 | 30 | set(MIR_VERSION_MINOR 1) | 30 | set(MIR_VERSION_MINOR 1) |
287 | 31 | set(MIR_VERSION_PATCH 7) | 31 | set(MIR_VERSION_PATCH 8) |
288 | 32 | 32 | ||
289 | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
290 | 34 | execute_process( | 34 | execute_process( |
291 | 35 | 35 | ||
292 | === modified file 'benchmarks/android-input/CMakeLists.txt' | |||
293 | --- benchmarks/android-input/CMakeLists.txt 2013-10-15 10:10:05 +0000 | |||
294 | +++ benchmarks/android-input/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
295 | @@ -5,7 +5,9 @@ | |||
296 | 5 | ) | 5 | ) |
297 | 6 | 6 | ||
298 | 7 | include_directories( | 7 | include_directories( |
300 | 8 | ${Mir_SOURCE_DIR}/include/test) | 8 | ${Mir_SOURCE_DIR}/include/test |
301 | 9 | ${Mir_SOURCE_DIR}/include/platform | ||
302 | 10 | ) | ||
303 | 9 | 11 | ||
304 | 10 | add_executable(input-reader-perf ${SOURCES}) | 12 | add_executable(input-reader-perf ${SOURCES}) |
305 | 11 | 13 | ||
306 | 12 | 14 | ||
307 | === modified file 'cmake/MirCommon.cmake' | |||
308 | --- cmake/MirCommon.cmake 2014-03-06 06:05:17 +0000 | |||
309 | +++ cmake/MirCommon.cmake 2014-04-07 13:29:13 +0000 | |||
310 | @@ -22,8 +22,10 @@ | |||
311 | 22 | valgrind) | 22 | valgrind) |
312 | 23 | 23 | ||
313 | 24 | if(VALGRIND_EXECUTABLE) | 24 | if(VALGRIND_EXECUTABLE) |
315 | 25 | set(VALGRIND_ARGS "--error-exitcode=1" "--trace-children=yes") | 25 | set(VALGRIND_ARGS "--error-exitcode=1" "--trace-children=yes" "--leak-check=full" "--show-leak-kinds=definite" "--errors-for-leak-kinds=definite") |
316 | 26 | set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic") | ||
317 | 26 | set(DISCOVER_FLAGS "--enable-memcheck") | 27 | set(DISCOVER_FLAGS "--enable-memcheck") |
318 | 28 | set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic") | ||
319 | 27 | if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf") | 29 | if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf") |
320 | 28 | set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf") | 30 | set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf") |
321 | 29 | set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf") | 31 | set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf") |
322 | @@ -35,10 +37,11 @@ | |||
323 | 35 | 37 | ||
324 | 36 | function (mir_discover_tests EXECUTABLE) | 38 | function (mir_discover_tests EXECUTABLE) |
325 | 37 | if(DISABLE_GTEST_TEST_DISCOVERY) | 39 | if(DISABLE_GTEST_TEST_DISCOVERY) |
328 | 38 | add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}") | 40 | add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} "--gtest_filter=-*DeathTest.*") |
329 | 39 | 41 | add_test(${EXECUTABLE}_death_tests ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} "--gtest_filter=*DeathTest.*") | |
330 | 40 | if (${ARGC} GREATER 1) | 42 | if (${ARGC} GREATER 1) |
331 | 41 | set_property(TEST ${EXECUTABLE} PROPERTY ENVIRONMENT ${ARGN}) | 43 | set_property(TEST ${EXECUTABLE} PROPERTY ENVIRONMENT ${ARGN}) |
332 | 44 | set_property(TEST ${EXECUTABLE}_death_tests PROPERTY ENVIRONMENT ${ARGN}) | ||
333 | 42 | endif() | 45 | endif() |
334 | 43 | else() | 46 | else() |
335 | 44 | set(CHECK_TEST_DISCOVERY_TARGET_NAME "check_discover_tests_in_${EXECUTABLE}") | 47 | set(CHECK_TEST_DISCOVERY_TARGET_NAME "check_discover_tests_in_${EXECUTABLE}") |
336 | @@ -82,7 +85,15 @@ | |||
337 | 82 | function (mir_add_memcheck_test) | 85 | function (mir_add_memcheck_test) |
338 | 83 | if (ENABLE_MEMCHECK_OPTION) | 86 | if (ENABLE_MEMCHECK_OPTION) |
339 | 84 | if(DISABLE_GTEST_TEST_DISCOVERY) | 87 | if(DISABLE_GTEST_TEST_DISCOVERY) |
341 | 85 | 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_custom_target( |
342 | 89 | memcheck_test ALL | ||
343 | 90 | ) | ||
344 | 91 | ADD_TEST("memcheck-test" ${CMAKE_BINARY_DIR}/mir_gtest/fail_on_success.sh ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error) | ||
345 | 92 | add_dependencies( | ||
346 | 93 | memcheck_test | ||
347 | 94 | |||
348 | 95 | mir_test_memory_error | ||
349 | 96 | ) | ||
350 | 86 | else() | 97 | else() |
351 | 87 | add_custom_target( | 98 | add_custom_target( |
352 | 88 | memcheck_test ALL | 99 | memcheck_test ALL |
353 | 89 | 100 | ||
354 | === modified file 'cmake/src/mir/CMakeLists.txt' | |||
355 | --- cmake/src/mir/CMakeLists.txt 2013-03-13 04:54:15 +0000 | |||
356 | +++ cmake/src/mir/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
357 | @@ -17,3 +17,8 @@ | |||
358 | 17 | mir_test_memory_error PROPERTIES | 17 | mir_test_memory_error PROPERTIES |
359 | 18 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/mir_gtest | 18 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/mir_gtest |
360 | 19 | ) | 19 | ) |
361 | 20 | |||
362 | 21 | file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/fail_on_success.sh | ||
363 | 22 | DESTINATION ${CMAKE_BINARY_DIR}/mir_gtest | ||
364 | 23 | USE_SOURCE_PERMISSIONS | ||
365 | 24 | ) | ||
366 | 20 | 25 | ||
367 | === added file 'cmake/src/mir/fail_on_success.sh' | |||
368 | --- cmake/src/mir/fail_on_success.sh 1970-01-01 00:00:00 +0000 | |||
369 | +++ cmake/src/mir/fail_on_success.sh 2014-04-07 13:29:13 +0000 | |||
370 | @@ -0,0 +1,8 @@ | |||
371 | 1 | #!/bin/sh | ||
372 | 2 | |||
373 | 3 | $@ | ||
374 | 4 | |||
375 | 5 | if [ $? -eq 0 ] ; then | ||
376 | 6 | exit 1; | ||
377 | 7 | fi | ||
378 | 8 | exit 0; | ||
379 | 0 | 9 | ||
380 | === modified file 'cmake/src/mir/mir_discover_gtest_tests.cpp' | |||
381 | --- cmake/src/mir/mir_discover_gtest_tests.cpp 2014-03-06 06:05:17 +0000 | |||
382 | +++ cmake/src/mir/mir_discover_gtest_tests.cpp 2014-04-07 13:29:13 +0000 | |||
383 | @@ -234,6 +234,18 @@ | |||
384 | 234 | } | 234 | } |
385 | 235 | } | 235 | } |
386 | 236 | 236 | ||
387 | 237 | bool is_death_test(string const& test) | ||
388 | 238 | { | ||
389 | 239 | // precondition: test will match Foo.* | ||
390 | 240 | // assumption: death tests will match FooDeathTest.* | ||
391 | 241 | bool death_test = false; | ||
392 | 242 | if (test.size() > strlen("DeathTest.*")) | ||
393 | 243 | death_test = test.substr(test.size() - strlen("DeathTest.*"), | ||
394 | 244 | strlen("DeathTest")) == "DeathTest"; | ||
395 | 245 | |||
396 | 246 | return death_test; | ||
397 | 247 | } | ||
398 | 248 | |||
399 | 237 | int main (int argc, char **argv) | 249 | int main (int argc, char **argv) |
400 | 238 | { | 250 | { |
401 | 239 | int output_width = get_output_width(); | 251 | int output_width = get_output_width(); |
402 | @@ -291,8 +303,9 @@ | |||
403 | 291 | snprintf( | 303 | snprintf( |
404 | 292 | cmd_line, | 304 | cmd_line, |
405 | 293 | sizeof(cmd_line), | 305 | sizeof(cmd_line), |
408 | 294 | config.enable_memcheck ? memcheck_cmd_line_pattern(config.suppressions).c_str() : | 306 | (config.enable_memcheck && !is_death_test(*test)) ? |
409 | 295 | ordinary_cmd_line_pattern().c_str(), | 307 | memcheck_cmd_line_pattern(config.suppressions).c_str() : |
410 | 308 | ordinary_cmd_line_pattern().c_str(), | ||
411 | 296 | test_suite.c_str(), | 309 | test_suite.c_str(), |
412 | 297 | elide_string_left(*test, output_width/2).c_str(), | 310 | elide_string_left(*test, output_width/2).c_str(), |
413 | 298 | config.executable, | 311 | config.executable, |
414 | 299 | 312 | ||
415 | === modified file 'debian/changelog' | |||
416 | --- debian/changelog 2014-03-18 18:38:01 +0000 | |||
417 | +++ debian/changelog 2014-04-07 13:29:13 +0000 | |||
418 | @@ -1,3 +1,69 @@ | |||
419 | 1 | mir (0.1.8-0ubuntu1) UNRELEASED; urgency=medium | ||
420 | 2 | |||
421 | 3 | * New upstream release 0.1.8 (https://launchpad.net/mir/+milestone/0.1.8) | ||
422 | 4 | - mirclient ABI unchanged, still at 7. Clients do not need rebuilding. | ||
423 | 5 | - mirserver ABI bumped to 18. Shells need rebuilding. | ||
424 | 6 | - Server API changes affecting shells: | ||
425 | 7 | . GLRenderer::tessellate() changed syntax. | ||
426 | 8 | . graphics::Platform::create_display() has a new parameter allowing you | ||
427 | 9 | to customize the compositor's (E)GL configutation. | ||
428 | 10 | . Renderable::buffer(unsigned long frameno) is now: | ||
429 | 11 | Renderable::buffer(void const* user_id). See below. | ||
430 | 12 | . Renderable::should_be_rendered_in() is replaced by a more natural: | ||
431 | 13 | Renderable::visble() | ||
432 | 14 | . input::Surface::name() returns by value instead of reference now, | ||
433 | 15 | to ensure future thread safety. | ||
434 | 16 | - Switched EventHub device enumeration and hotplug to Udev. NOTE! This | ||
435 | 17 | means mir_test_* can't run natively on touch devices any more without | ||
436 | 18 | some setup first: | ||
437 | 19 | sudo mount -o remount,rw / | ||
438 | 20 | sudo apt-get update | ||
439 | 21 | sudo apt-get install -y umockdev | ||
440 | 22 | umockdev-run -- bin/mir_unit_tests | ||
441 | 23 | - Added logging for HWC events. | ||
442 | 24 | - Continued consolidation of Surface classes toward a simpler architecture. | ||
443 | 25 | - Introduced "RenderableList" as the way to sample the Scene contents, | ||
444 | 26 | and started using that in the default compositor. | ||
445 | 27 | - Introduced physical length units and conversion (geometry::Length) in | ||
446 | 28 | preparation for arbitrary DPI rendering. | ||
447 | 29 | - Added some decorations to demo-shell; shadows and basic title bars, all | ||
448 | 30 | anti-aliased and high-DPI scalable. | ||
449 | 31 | - Multi-monitor frame sync has been redesigned to eliminate the need for | ||
450 | 32 | frame number tracking. | ||
451 | 33 | - Bugs (and enhancements) resolved: | ||
452 | 34 | . [enhancement] Please move input detection to libudev (LP: #1237784) | ||
453 | 35 | . [enhancement] Add a clamping resize mode to GLRenderer (LP: #1259887) | ||
454 | 36 | . [regression] Intermittent loss of multimonitor frame sync | ||
455 | 37 | (LP: #1290306) | ||
456 | 38 | . [enhancement] Make GL config options configurable (LP: #1290780) | ||
457 | 39 | . memcheck-test doesn't test anything when DISABLED_GTEST_DISCOVERY is | ||
458 | 40 | enabled (LP: #1291876) | ||
459 | 41 | . "Error opening DRM device" is always followed by "Unknown error -(some | ||
460 | 42 | negative number)" (LP: #1292384) | ||
461 | 43 | . Rendering/composition gets stopped early (LP: #1293896) | ||
462 | 44 | . Ubuntu Touch Settings and terminal apps are not rendering correctly on | ||
463 | 45 | rotate. (LP: #1294048) | ||
464 | 46 | . [regression] Apps are much slower to open (LP: #1294051) | ||
465 | 47 | . Settings app opens to a blank screen unless given enough time to render | ||
466 | 48 | or the app is touched (LP: #1294053) | ||
467 | 49 | . TestClientInput/DemoPrivateProtobuf memory leak is causing regular CI | ||
468 | 50 | test failures (LP: #1295231) | ||
469 | 51 | . OSK touch events "fall through" and hit surface behind them | ||
470 | 52 | (LP: #1297878) | ||
471 | 53 | . [enhancement] add a test for composite of last client post | ||
472 | 54 | (LP: #1298596) | ||
473 | 55 | . [regression] Surfaces vanish as soon as their edges touch the edge of | ||
474 | 56 | screen (LP: #1301115) | ||
475 | 57 | * Cherry-picked from future release 0.1.9: | ||
476 | 58 | - Bug fix: mirplatformgraphics does not have boost program options in its | ||
477 | 59 | symbol table (LP: #1301040) | ||
478 | 60 | - Bug fix: unity8 crashed with SIGSEGV in glDeleteTextures() from | ||
479 | 61 | mir::scene::GLPixelBuffer::~GLPixelBuffer() from | ||
480 | 62 | mir::scene::ThreadedSnapshotStrategy::~ThreadedSnapshotStrategy() | ||
481 | 63 | (LP: #1256360) | ||
482 | 64 | |||
483 | 65 | -- Daniel van Vugt <daniel.van.vugt@canonical.com> Thu, 20 Mar 2014 14:05:25 +0800 | ||
484 | 66 | |||
485 | 1 | mir (0.1.7+14.04.20140318-0ubuntu1) trusty; urgency=low | 67 | mir (0.1.7+14.04.20140318-0ubuntu1) trusty; urgency=low |
486 | 2 | 68 | ||
487 | 3 | [ Alberto Aguirre ] | 69 | [ Alberto Aguirre ] |
488 | 4 | 70 | ||
489 | === modified file 'debian/control' | |||
490 | --- debian/control 2014-03-17 07:35:22 +0000 | |||
491 | +++ debian/control 2014-04-07 13:29:13 +0000 | |||
492 | @@ -31,7 +31,7 @@ | |||
493 | 31 | libgoogle-glog-dev, | 31 | libgoogle-glog-dev, |
494 | 32 | liblttng-ust-dev, | 32 | liblttng-ust-dev, |
495 | 33 | libxkbcommon-dev, | 33 | libxkbcommon-dev, |
497 | 34 | libumockdev-dev, | 34 | libumockdev-dev (>= 0.6), |
498 | 35 | umockdev, | 35 | umockdev, |
499 | 36 | libudev-dev, | 36 | libudev-dev, |
500 | 37 | google-mock (>= 1.6.0+svn437), | 37 | google-mock (>= 1.6.0+svn437), |
501 | @@ -70,7 +70,7 @@ | |||
502 | 70 | . | 70 | . |
503 | 71 | Contains the protocol's definition files. | 71 | Contains the protocol's definition files. |
504 | 72 | 72 | ||
506 | 73 | Package: libmirserver17 | 73 | Package: libmirserver18 |
507 | 74 | Section: libs | 74 | Section: libs |
508 | 75 | Architecture: i386 amd64 armhf arm64 | 75 | Architecture: i386 amd64 armhf arm64 |
509 | 76 | Multi-Arch: same | 76 | Multi-Arch: same |
510 | @@ -148,7 +148,7 @@ | |||
511 | 148 | Architecture: i386 amd64 armhf arm64 | 148 | Architecture: i386 amd64 armhf arm64 |
512 | 149 | Multi-Arch: same | 149 | Multi-Arch: same |
513 | 150 | Pre-Depends: ${misc:Pre-Depends} | 150 | Pre-Depends: ${misc:Pre-Depends} |
515 | 151 | Depends: libmirserver17 (= ${binary:Version}), | 151 | Depends: libmirserver18 (= ${binary:Version}), |
516 | 152 | libmirprotobuf-dev (= ${binary:Version}), | 152 | libmirprotobuf-dev (= ${binary:Version}), |
517 | 153 | mircommon-dev (= ${binary:Version}), | 153 | mircommon-dev (= ${binary:Version}), |
518 | 154 | libglm-dev, | 154 | libglm-dev, |
519 | 155 | 155 | ||
520 | === renamed file 'debian/libmirserver17.install' => 'debian/libmirserver18.install' | |||
521 | --- debian/libmirserver17.install 2014-03-12 06:41:13 +0000 | |||
522 | +++ debian/libmirserver18.install 2014-04-07 13:29:13 +0000 | |||
523 | @@ -1,1 +1,1 @@ | |||
525 | 1 | usr/lib/*/libmirserver.so.17 | 1 | usr/lib/*/libmirserver.so.18 |
526 | 2 | 2 | ||
527 | === added file 'deploy-and-test.sh' | |||
528 | --- deploy-and-test.sh 1970-01-01 00:00:00 +0000 | |||
529 | +++ deploy-and-test.sh 2014-04-07 13:29:13 +0000 | |||
530 | @@ -0,0 +1,21 @@ | |||
531 | 1 | #!/bin/sh | ||
532 | 2 | |||
533 | 3 | if [ ! -d build-android-arm ] ; then | ||
534 | 4 | echo "Built tree not found in $(pwd)/build-android-arm" | ||
535 | 5 | exit 1 | ||
536 | 6 | fi | ||
537 | 7 | |||
538 | 8 | # Unpack umockdev requirements | ||
539 | 9 | ( cd build-android-arm ; | ||
540 | 10 | apt-get download umockdev:armhf libumockdev0:armhf ; | ||
541 | 11 | dpkg -x umockdev_*armhf*.deb . ; | ||
542 | 12 | dpkg -x libumockdev0_*armhf*.deb . | ||
543 | 13 | ) | ||
544 | 14 | |||
545 | 15 | adb push build-android-arm/bin /home/phablet/mir/bin | ||
546 | 16 | adb push build-android-arm/lib /home/phablet/mir/lib | ||
547 | 17 | adb push build-android-arm/usr /home/phablet/mir/usr | ||
548 | 18 | |||
549 | 19 | adb shell "LD_LIBRARY_PATH=/home/phablet/mir/usr/lib/arm-linux-gnueabihf/:/home/phablet/mir/lib PATH=$PATH:/home/phablet/mir/usr/bin bash -c \"cd /home/phablet/mir/usr/bin ; umockdev-run /home/phablet/mir/bin/mir_unit_tests\"" | ||
550 | 20 | adb shell "LD_LIBRARY_PATH=/home/phablet/mir/usr/lib/arm-linux-gnueabihf/:/home/phablet/mir/lib PATH=$PATH:/home/phablet/mir/usr/bin bash -c \"cd /home/phablet/mir/usr/bin ; umockdev-run /home/phablet/mir/bin/mir_integration_tests\"" | ||
551 | 21 | adb shell "LD_LIBRARY_PATH=/home/phablet/mir/usr/lib/arm-linux-gnueabihf/:/home/phablet/mir/lib PATH=$PATH:/home/phablet/mir/usr/bin bash -c \"cd /home/phablet/mir/usr/bin ; umockdev-run /home/phablet/mir/bin/mir_acceptance_tests\"" | ||
552 | 0 | 22 | ||
553 | === modified file 'examples/demo-shell/demo_renderer.cpp' | |||
554 | --- examples/demo-shell/demo_renderer.cpp 2014-03-05 04:13:32 +0000 | |||
555 | +++ examples/demo-shell/demo_renderer.cpp 2014-04-07 13:29:13 +0000 | |||
556 | @@ -17,13 +17,131 @@ | |||
557 | 17 | */ | 17 | */ |
558 | 18 | 18 | ||
559 | 19 | #include "demo_renderer.h" | 19 | #include "demo_renderer.h" |
560 | 20 | #include <mir/graphics/renderable.h> | ||
561 | 21 | #include <cmath> | ||
562 | 20 | 22 | ||
563 | 21 | using namespace mir; | 23 | using namespace mir; |
564 | 22 | using namespace mir::examples; | 24 | using namespace mir::examples; |
565 | 23 | 25 | ||
566 | 26 | namespace | ||
567 | 27 | { | ||
568 | 28 | |||
569 | 29 | float penumbra_curve(float x) | ||
570 | 30 | { | ||
571 | 31 | return 1.0f - std::sin(x * M_PI / 2.0f); | ||
572 | 32 | } | ||
573 | 33 | |||
574 | 34 | GLuint generate_shadow_corner_texture(float opacity) | ||
575 | 35 | { | ||
576 | 36 | struct Texel | ||
577 | 37 | { | ||
578 | 38 | GLubyte luminance; | ||
579 | 39 | GLubyte alpha; | ||
580 | 40 | }; | ||
581 | 41 | |||
582 | 42 | int const width = 256; | ||
583 | 43 | Texel image[width][width]; | ||
584 | 44 | |||
585 | 45 | int const max = width - 1; | ||
586 | 46 | for (int y = 0; y < width; ++y) | ||
587 | 47 | { | ||
588 | 48 | float curve_y = opacity * 255.0f * | ||
589 | 49 | penumbra_curve(static_cast<float>(y) / max); | ||
590 | 50 | for (int x = 0; x < width; ++x) | ||
591 | 51 | { | ||
592 | 52 | Texel *t = &image[y][x]; | ||
593 | 53 | t->luminance = 0; | ||
594 | 54 | t->alpha = curve_y * penumbra_curve(static_cast<float>(x) / max); | ||
595 | 55 | } | ||
596 | 56 | } | ||
597 | 57 | |||
598 | 58 | GLuint corner; | ||
599 | 59 | glGenTextures(1, &corner); | ||
600 | 60 | glBindTexture(GL_TEXTURE_2D, corner); | ||
601 | 61 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||
602 | 62 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
603 | 63 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
604 | 64 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
605 | 65 | glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, | ||
606 | 66 | width, width, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, | ||
607 | 67 | image); | ||
608 | 68 | |||
609 | 69 | return corner; | ||
610 | 70 | } | ||
611 | 71 | |||
612 | 72 | GLuint generate_frame_corner_texture() | ||
613 | 73 | { | ||
614 | 74 | struct Texel | ||
615 | 75 | { | ||
616 | 76 | GLubyte r, g, b, a; | ||
617 | 77 | }; | ||
618 | 78 | |||
619 | 79 | int const width = 256; | ||
620 | 80 | Texel image[width][width]; | ||
621 | 81 | |||
622 | 82 | int cx = width / 2; | ||
623 | 83 | int cy = width / 2; | ||
624 | 84 | int radius_sqr = cx * cx; | ||
625 | 85 | |||
626 | 86 | for (int y = 0; y < width; ++y) | ||
627 | 87 | { | ||
628 | 88 | for (int x = 0; x < width; ++x) | ||
629 | 89 | { | ||
630 | 90 | GLubyte lum = 128; | ||
631 | 91 | GLubyte alpha = 255; | ||
632 | 92 | |||
633 | 93 | // Cut out the corner in a circular shape. | ||
634 | 94 | if (x < cx && y < cy) | ||
635 | 95 | { | ||
636 | 96 | int dx = cx - x; | ||
637 | 97 | int dy = cy - y; | ||
638 | 98 | if (dx * dx + dy * dy >= radius_sqr) | ||
639 | 99 | alpha = 0; | ||
640 | 100 | } | ||
641 | 101 | |||
642 | 102 | // Set gradient | ||
643 | 103 | if (y < cy) | ||
644 | 104 | { | ||
645 | 105 | float brighten = (1.0f - (static_cast<float>(y) / cy)); | ||
646 | 106 | if (x < cx) | ||
647 | 107 | brighten *= std::sin(x * M_PI / width); | ||
648 | 108 | |||
649 | 109 | lum += (255 - lum) * brighten; | ||
650 | 110 | } | ||
651 | 111 | |||
652 | 112 | image[y][x] = {lum, lum, lum, alpha}; | ||
653 | 113 | } | ||
654 | 114 | } | ||
655 | 115 | |||
656 | 116 | GLuint corner; | ||
657 | 117 | glGenTextures(1, &corner); | ||
658 | 118 | glBindTexture(GL_TEXTURE_2D, corner); | ||
659 | 119 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, | ||
660 | 120 | GL_LINEAR_MIPMAP_LINEAR); | ||
661 | 121 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
662 | 122 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
663 | 123 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
664 | 124 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, | ||
665 | 125 | width, width, 0, GL_RGBA, GL_UNSIGNED_BYTE, | ||
666 | 126 | image); | ||
667 | 127 | glGenerateMipmap(GL_TEXTURE_2D); // Antialiasing please | ||
668 | 128 | |||
669 | 129 | return corner; | ||
670 | 130 | } | ||
671 | 131 | |||
672 | 132 | } // namespace | ||
673 | 133 | |||
674 | 24 | DemoRenderer::DemoRenderer(geometry::Rectangle const& display_area) | 134 | DemoRenderer::DemoRenderer(geometry::Rectangle const& display_area) |
675 | 25 | : GLRenderer(display_area) | 135 | : GLRenderer(display_area) |
676 | 26 | { | 136 | { |
677 | 137 | shadow_corner_tex = generate_shadow_corner_texture(0.4f); | ||
678 | 138 | titlebar_corner_tex = generate_frame_corner_texture(); | ||
679 | 139 | } | ||
680 | 140 | |||
681 | 141 | DemoRenderer::~DemoRenderer() | ||
682 | 142 | { | ||
683 | 143 | glDeleteTextures(1, &shadow_corner_tex); | ||
684 | 144 | glDeleteTextures(1, &titlebar_corner_tex); | ||
685 | 27 | } | 145 | } |
686 | 28 | 146 | ||
687 | 29 | void DemoRenderer::begin() const | 147 | void DemoRenderer::begin() const |
688 | @@ -31,3 +149,156 @@ | |||
689 | 31 | glClearColor(0.2f, 0.2f, 0.2f, 1.0f); | 149 | glClearColor(0.2f, 0.2f, 0.2f, 1.0f); |
690 | 32 | glClear(GL_COLOR_BUFFER_BIT); | 150 | glClear(GL_COLOR_BUFFER_BIT); |
691 | 33 | } | 151 | } |
692 | 152 | |||
693 | 153 | void DemoRenderer::tessellate(std::vector<Primitive>& primitives, | ||
694 | 154 | graphics::Renderable const& renderable, | ||
695 | 155 | geometry::Size const& buf_size) const | ||
696 | 156 | { | ||
697 | 157 | GLRenderer::tessellate(primitives, renderable, buf_size); | ||
698 | 158 | tessellate_shadow(primitives, renderable, 80.0f); | ||
699 | 159 | tessellate_frame(primitives, renderable, 30.0f); | ||
700 | 160 | } | ||
701 | 161 | |||
702 | 162 | void DemoRenderer::tessellate_shadow(std::vector<Primitive>& primitives, | ||
703 | 163 | graphics::Renderable const& renderable, | ||
704 | 164 | float radius) const | ||
705 | 165 | { | ||
706 | 166 | auto const& rect = renderable.screen_position(); | ||
707 | 167 | GLfloat left = rect.top_left.x.as_int(); | ||
708 | 168 | GLfloat right = left + rect.size.width.as_int(); | ||
709 | 169 | GLfloat top = rect.top_left.y.as_int(); | ||
710 | 170 | GLfloat bottom = top + rect.size.height.as_int(); | ||
711 | 171 | |||
712 | 172 | auto n = primitives.size(); | ||
713 | 173 | primitives.resize(n + 8); | ||
714 | 174 | |||
715 | 175 | GLfloat rightr = right + radius; | ||
716 | 176 | GLfloat leftr = left - radius; | ||
717 | 177 | GLfloat topr = top - radius; | ||
718 | 178 | GLfloat bottomr = bottom + radius; | ||
719 | 179 | |||
720 | 180 | auto& right_shadow = primitives[n++]; | ||
721 | 181 | right_shadow.tex_id = shadow_corner_tex; | ||
722 | 182 | right_shadow.type = GL_TRIANGLE_FAN; | ||
723 | 183 | right_shadow.vertices.resize(4); | ||
724 | 184 | right_shadow.vertices[0] = {{right, top, 0.0f}, {0.0f, 0.0f}}; | ||
725 | 185 | right_shadow.vertices[1] = {{rightr, top, 0.0f}, {1.0f, 0.0f}}; | ||
726 | 186 | right_shadow.vertices[2] = {{rightr, bottom, 0.0f}, {1.0f, 0.0f}}; | ||
727 | 187 | right_shadow.vertices[3] = {{right, bottom, 0.0f}, {0.0f, 0.0f}}; | ||
728 | 188 | |||
729 | 189 | auto& left_shadow = primitives[n++]; | ||
730 | 190 | left_shadow.tex_id = shadow_corner_tex; | ||
731 | 191 | left_shadow.type = GL_TRIANGLE_FAN; | ||
732 | 192 | left_shadow.vertices.resize(4); | ||
733 | 193 | left_shadow.vertices[0] = {{leftr, top, 0.0f}, {1.0f, 0.0f}}; | ||
734 | 194 | left_shadow.vertices[1] = {{left, top, 0.0f}, {0.0f, 0.0f}}; | ||
735 | 195 | left_shadow.vertices[2] = {{left, bottom, 0.0f}, {0.0f, 0.0f}}; | ||
736 | 196 | left_shadow.vertices[3] = {{leftr, bottom, 0.0f}, {1.0f, 0.0f}}; | ||
737 | 197 | |||
738 | 198 | auto& top_shadow = primitives[n++]; | ||
739 | 199 | top_shadow.tex_id = shadow_corner_tex; | ||
740 | 200 | top_shadow.type = GL_TRIANGLE_FAN; | ||
741 | 201 | top_shadow.vertices.resize(4); | ||
742 | 202 | top_shadow.vertices[0] = {{left, topr, 0.0f}, {1.0f, 0.0f}}; | ||
743 | 203 | top_shadow.vertices[1] = {{right, topr, 0.0f}, {1.0f, 0.0f}}; | ||
744 | 204 | top_shadow.vertices[2] = {{right, top, 0.0f}, {0.0f, 0.0f}}; | ||
745 | 205 | top_shadow.vertices[3] = {{left, top, 0.0f}, {0.0f, 0.0f}}; | ||
746 | 206 | |||
747 | 207 | auto& bottom_shadow = primitives[n++]; | ||
748 | 208 | bottom_shadow.tex_id = shadow_corner_tex; | ||
749 | 209 | bottom_shadow.type = GL_TRIANGLE_FAN; | ||
750 | 210 | bottom_shadow.vertices.resize(4); | ||
751 | 211 | bottom_shadow.vertices[0] = {{left, bottom, 0.0f}, {0.0f, 0.0f}}; | ||
752 | 212 | bottom_shadow.vertices[1] = {{right, bottom, 0.0f}, {0.0f, 0.0f}}; | ||
753 | 213 | bottom_shadow.vertices[2] = {{right, bottomr, 0.0f}, {1.0f, 0.0f}}; | ||
754 | 214 | bottom_shadow.vertices[3] = {{left, bottomr, 0.0f}, {1.0f, 0.0f}}; | ||
755 | 215 | |||
756 | 216 | auto& tr_shadow = primitives[n++]; | ||
757 | 217 | tr_shadow.tex_id = shadow_corner_tex; | ||
758 | 218 | tr_shadow.type = GL_TRIANGLE_FAN; | ||
759 | 219 | tr_shadow.vertices.resize(4); | ||
760 | 220 | tr_shadow.vertices[0] = {{right, top, 0.0f}, {0.0f, 0.0f}}; | ||
761 | 221 | tr_shadow.vertices[1] = {{right, topr, 0.0f}, {1.0f, 0.0f}}; | ||
762 | 222 | tr_shadow.vertices[2] = {{rightr, topr, 0.0f}, {1.0f, 1.0f}}; | ||
763 | 223 | tr_shadow.vertices[3] = {{rightr, top, 0.0f}, {0.0f, 1.0f}}; | ||
764 | 224 | |||
765 | 225 | auto& br_shadow = primitives[n++]; | ||
766 | 226 | br_shadow.tex_id = shadow_corner_tex; | ||
767 | 227 | br_shadow.type = GL_TRIANGLE_FAN; | ||
768 | 228 | br_shadow.vertices.resize(4); | ||
769 | 229 | br_shadow.vertices[0] = {{right, bottom, 0.0f}, {0.0f, 0.0f}}; | ||
770 | 230 | br_shadow.vertices[1] = {{rightr, bottom, 0.0f}, {1.0f, 0.0f}}; | ||
771 | 231 | br_shadow.vertices[2] = {{rightr, bottomr, 0.0f}, {1.0f, 1.0f}}; | ||
772 | 232 | br_shadow.vertices[3] = {{right, bottomr, 0.0f}, {0.0f, 1.0f}}; | ||
773 | 233 | |||
774 | 234 | auto& bl_shadow = primitives[n++]; | ||
775 | 235 | bl_shadow.tex_id = shadow_corner_tex; | ||
776 | 236 | bl_shadow.type = GL_TRIANGLE_FAN; | ||
777 | 237 | bl_shadow.vertices.resize(4); | ||
778 | 238 | bl_shadow.vertices[0] = {{left, bottom, 0.0f}, {0.0f, 0.0f}}; | ||
779 | 239 | bl_shadow.vertices[1] = {{left, bottomr, 0.0f}, {1.0f, 0.0f}}; | ||
780 | 240 | bl_shadow.vertices[2] = {{leftr, bottomr, 0.0f}, {1.0f, 1.0f}}; | ||
781 | 241 | bl_shadow.vertices[3] = {{leftr, bottom, 0.0f}, {0.0f, 1.0f}}; | ||
782 | 242 | |||
783 | 243 | auto& tl_shadow = primitives[n++]; | ||
784 | 244 | tl_shadow.tex_id = shadow_corner_tex; | ||
785 | 245 | tl_shadow.type = GL_TRIANGLE_FAN; | ||
786 | 246 | tl_shadow.vertices.resize(4); | ||
787 | 247 | tl_shadow.vertices[0] = {{left, top, 0.0f}, {0.0f, 0.0f}}; | ||
788 | 248 | tl_shadow.vertices[1] = {{leftr, top, 0.0f}, {1.0f, 0.0f}}; | ||
789 | 249 | tl_shadow.vertices[2] = {{leftr, topr, 0.0f}, {1.0f, 1.0f}}; | ||
790 | 250 | tl_shadow.vertices[3] = {{left, topr, 0.0f}, {0.0f, 1.0f}}; | ||
791 | 251 | |||
792 | 252 | // Shadows always need blending... | ||
793 | 253 | glEnable(GL_BLEND); | ||
794 | 254 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
795 | 255 | } | ||
796 | 256 | |||
797 | 257 | void DemoRenderer::tessellate_frame(std::vector<Primitive>& primitives, | ||
798 | 258 | graphics::Renderable const& renderable, | ||
799 | 259 | float titlebar_height) const | ||
800 | 260 | { | ||
801 | 261 | auto const& rect = renderable.screen_position(); | ||
802 | 262 | GLfloat left = rect.top_left.x.as_int(); | ||
803 | 263 | GLfloat right = left + rect.size.width.as_int(); | ||
804 | 264 | GLfloat top = rect.top_left.y.as_int(); | ||
805 | 265 | |||
806 | 266 | auto n = primitives.size(); | ||
807 | 267 | primitives.resize(n + 3); | ||
808 | 268 | |||
809 | 269 | GLfloat htop = top - titlebar_height; | ||
810 | 270 | GLfloat inleft = left + titlebar_height; // Square proportions for corners | ||
811 | 271 | GLfloat inright = right - titlebar_height; | ||
812 | 272 | |||
813 | 273 | GLfloat mid = (left + right) / 2.0f; | ||
814 | 274 | if (inleft > mid) inleft = mid; | ||
815 | 275 | if (inright < mid) inright = mid; | ||
816 | 276 | |||
817 | 277 | auto& top_left_corner = primitives[n++]; | ||
818 | 278 | top_left_corner.tex_id = titlebar_corner_tex; | ||
819 | 279 | top_left_corner.type = GL_TRIANGLE_FAN; | ||
820 | 280 | top_left_corner.vertices.resize(4); | ||
821 | 281 | top_left_corner.vertices[0] = {{left, htop, 0.0f}, {0.0f, 0.0f}}; | ||
822 | 282 | top_left_corner.vertices[1] = {{inleft, htop, 0.0f}, {1.0f, 0.0f}}; | ||
823 | 283 | top_left_corner.vertices[2] = {{inleft, top, 0.0f}, {1.0f, 1.0f}}; | ||
824 | 284 | top_left_corner.vertices[3] = {{left, top, 0.0f}, {0.0f, 1.0f}}; | ||
825 | 285 | |||
826 | 286 | auto& top_right_corner = primitives[n++]; | ||
827 | 287 | top_right_corner.tex_id = titlebar_corner_tex; | ||
828 | 288 | top_right_corner.type = GL_TRIANGLE_FAN; | ||
829 | 289 | top_right_corner.vertices.resize(4); | ||
830 | 290 | top_right_corner.vertices[0] = {{inright, htop, 0.0f}, {1.0f, 0.0f}}; | ||
831 | 291 | top_right_corner.vertices[1] = {{right, htop, 0.0f}, {0.0f, 0.0f}}; | ||
832 | 292 | top_right_corner.vertices[2] = {{right, top, 0.0f}, {0.0f, 1.0f}}; | ||
833 | 293 | top_right_corner.vertices[3] = {{inright, top, 0.0f}, {1.0f, 1.0f}}; | ||
834 | 294 | |||
835 | 295 | auto& titlebar = primitives[n++]; | ||
836 | 296 | titlebar.tex_id = titlebar_corner_tex; | ||
837 | 297 | titlebar.type = GL_TRIANGLE_FAN; | ||
838 | 298 | titlebar.vertices.resize(4); | ||
839 | 299 | titlebar.vertices[0] = {{inleft, htop, 0.0f}, {1.0f, 0.0f}}; | ||
840 | 300 | titlebar.vertices[1] = {{inright, htop, 0.0f}, {1.0f, 0.0f}}; | ||
841 | 301 | titlebar.vertices[2] = {{inright, top, 0.0f}, {1.0f, 1.0f}}; | ||
842 | 302 | titlebar.vertices[3] = {{inleft, top, 0.0f}, {1.0f, 1.0f}}; | ||
843 | 303 | } | ||
844 | 304 | |||
845 | 34 | 305 | ||
846 | === modified file 'examples/demo-shell/demo_renderer.h' | |||
847 | --- examples/demo-shell/demo_renderer.h 2014-02-14 09:58:06 +0000 | |||
848 | +++ examples/demo-shell/demo_renderer.h 2014-04-07 13:29:13 +0000 | |||
849 | @@ -30,7 +30,22 @@ | |||
850 | 30 | { | 30 | { |
851 | 31 | public: | 31 | public: |
852 | 32 | DemoRenderer(geometry::Rectangle const& display_area); | 32 | DemoRenderer(geometry::Rectangle const& display_area); |
853 | 33 | ~DemoRenderer(); | ||
854 | 34 | |||
855 | 33 | void begin() const override; | 35 | void begin() const override; |
856 | 36 | void tessellate(std::vector<Primitive>& primitives, | ||
857 | 37 | graphics::Renderable const& renderable, | ||
858 | 38 | geometry::Size const& buf_size) const override; | ||
859 | 39 | void tessellate_shadow(std::vector<Primitive>& primitives, | ||
860 | 40 | graphics::Renderable const& renderable, | ||
861 | 41 | float radius) const; | ||
862 | 42 | void tessellate_frame(std::vector<Primitive>& primitives, | ||
863 | 43 | graphics::Renderable const& renderable, | ||
864 | 44 | float titlebar_height) const; | ||
865 | 45 | |||
866 | 46 | private: | ||
867 | 47 | GLuint shadow_corner_tex; | ||
868 | 48 | GLuint titlebar_corner_tex; | ||
869 | 34 | }; | 49 | }; |
870 | 35 | 50 | ||
871 | 36 | } // namespace examples | 51 | } // namespace examples |
872 | 37 | 52 | ||
873 | === modified file 'examples/render_overlays.cpp' | |||
874 | --- examples/render_overlays.cpp 2014-03-17 07:35:22 +0000 | |||
875 | +++ examples/render_overlays.cpp 2014-04-07 13:29:13 +0000 | |||
876 | @@ -105,17 +105,17 @@ | |||
877 | 105 | { | 105 | { |
878 | 106 | } | 106 | } |
879 | 107 | 107 | ||
881 | 108 | std::shared_ptr<mg::Buffer> buffer(unsigned long) const override | 108 | std::shared_ptr<mg::Buffer> buffer(void const*) const override |
882 | 109 | { | 109 | { |
883 | 110 | return client->last_rendered(); | 110 | return client->last_rendered(); |
884 | 111 | } | 111 | } |
885 | 112 | 112 | ||
887 | 113 | bool alpha_enabled() const | 113 | bool alpha_enabled() const override |
888 | 114 | { | 114 | { |
889 | 115 | return false; | 115 | return false; |
890 | 116 | } | 116 | } |
891 | 117 | 117 | ||
893 | 118 | geom::Rectangle screen_position() const | 118 | geom::Rectangle screen_position() const override |
894 | 119 | { | 119 | { |
895 | 120 | return position; | 120 | return position; |
896 | 121 | } | 121 | } |
897 | @@ -130,14 +130,14 @@ | |||
898 | 130 | return trans; | 130 | return trans; |
899 | 131 | } | 131 | } |
900 | 132 | 132 | ||
902 | 133 | bool shaped() const | 133 | bool shaped() const override |
903 | 134 | { | 134 | { |
904 | 135 | return false; | 135 | return false; |
905 | 136 | } | 136 | } |
906 | 137 | 137 | ||
908 | 138 | bool should_be_rendered_in(geom::Rectangle const& rect) const override | 138 | bool visible() const override |
909 | 139 | { | 139 | { |
911 | 140 | return rect.overlaps(position); | 140 | return true; |
912 | 141 | } | 141 | } |
913 | 142 | 142 | ||
914 | 143 | int buffers_ready_for_compositor() const override | 143 | int buffers_ready_for_compositor() const override |
915 | @@ -168,7 +168,9 @@ | |||
916 | 168 | mir::DefaultServerConfiguration conf{argc, argv}; | 168 | mir::DefaultServerConfiguration conf{argc, argv}; |
917 | 169 | 169 | ||
918 | 170 | auto platform = conf.the_graphics_platform(); | 170 | auto platform = conf.the_graphics_platform(); |
920 | 171 | auto display = platform->create_display(conf.the_display_configuration_policy()); | 171 | auto display = platform->create_display( |
921 | 172 | conf.the_display_configuration_policy(), | ||
922 | 173 | conf.the_gl_config()); | ||
923 | 172 | auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer()); | 174 | auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer()); |
924 | 173 | 175 | ||
925 | 174 | mg::BufferProperties buffer_properties{ | 176 | mg::BufferProperties buffer_properties{ |
926 | 175 | 177 | ||
927 | === modified file 'examples/render_surfaces.cpp' | |||
928 | --- examples/render_surfaces.cpp 2014-03-11 04:03:54 +0000 | |||
929 | +++ examples/render_surfaces.cpp 2014-04-07 13:29:13 +0000 | |||
930 | @@ -31,7 +31,8 @@ | |||
931 | 31 | #include "mir/graphics/display_buffer.h" | 31 | #include "mir/graphics/display_buffer.h" |
932 | 32 | #include "mir/graphics/gl_context.h" | 32 | #include "mir/graphics/gl_context.h" |
933 | 33 | #include "mir/shell/surface_factory.h" | 33 | #include "mir/shell/surface_factory.h" |
935 | 34 | #include "mir/shell/surface.h" | 34 | #include "mir/scene/surface.h" |
936 | 35 | #include "mir/scene/surface_coordinator.h" | ||
937 | 35 | #include "mir/run_mir.h" | 36 | #include "mir/run_mir.h" |
938 | 36 | #include "mir/report_exception.h" | 37 | #include "mir/report_exception.h" |
939 | 37 | #include "mir/raii.h" | 38 | #include "mir/raii.h" |
940 | @@ -41,6 +42,9 @@ | |||
941 | 41 | #include "image_renderer.h" | 42 | #include "image_renderer.h" |
942 | 42 | #include "server_configuration.h" | 43 | #include "server_configuration.h" |
943 | 43 | 44 | ||
944 | 45 | #define GLM_FORCE_RADIANS | ||
945 | 46 | #include <glm/gtc/matrix_transform.hpp> | ||
946 | 47 | |||
947 | 44 | #include <thread> | 48 | #include <thread> |
948 | 45 | #include <atomic> | 49 | #include <atomic> |
949 | 46 | #include <chrono> | 50 | #include <chrono> |
950 | @@ -90,6 +94,7 @@ | |||
951 | 90 | std::weak_ptr<mg::Cursor> cursor; | 94 | std::weak_ptr<mg::Cursor> cursor; |
952 | 91 | static const uint32_t bg_color = 0x00000000; | 95 | static const uint32_t bg_color = 0x00000000; |
953 | 92 | static const uint32_t fg_color = 0xffdd4814; | 96 | static const uint32_t fg_color = 0xffdd4814; |
954 | 97 | static const float min_alpha = 0.3f; | ||
955 | 93 | 98 | ||
956 | 94 | void update_cursor(uint32_t bg_color, uint32_t fg_color) | 99 | void update_cursor(uint32_t bg_color, uint32_t fg_color) |
957 | 95 | { | 100 | { |
958 | @@ -233,8 +238,16 @@ | |||
959 | 233 | y = new_y; | 238 | y = new_y; |
960 | 234 | } | 239 | } |
961 | 235 | 240 | ||
964 | 236 | surface->set_rotation(total_elapsed_sec * 120.0f, rotation_axis); | 241 | glm::mat4 trans = glm::rotate(glm::mat4(1.0f), |
965 | 237 | surface->set_alpha(0.5 + 0.5 * sin(alpha_offset + 2 * M_PI * total_elapsed_sec / 3.0)); | 242 | glm::radians(total_elapsed_sec * 120.0f), |
966 | 243 | rotation_axis); | ||
967 | 244 | surface->set_transformation(trans); | ||
968 | 245 | |||
969 | 246 | float const alpha_amplitude = (1.0f - min_alpha) / 2.0f; | ||
970 | 247 | surface->set_alpha(min_alpha + alpha_amplitude + | ||
971 | 248 | alpha_amplitude * | ||
972 | 249 | sin(alpha_offset + 2 * M_PI * total_elapsed_sec / | ||
973 | 250 | 3.0)); | ||
974 | 238 | } | 251 | } |
975 | 239 | 252 | ||
976 | 240 | private: | 253 | private: |
977 | @@ -433,7 +446,7 @@ | |||
978 | 433 | std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl; | 446 | std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl; |
979 | 434 | 447 | ||
980 | 435 | auto const display = the_display(); | 448 | auto const display = the_display(); |
982 | 436 | auto const surface_factory = the_scene_surface_factory(); | 449 | auto const surface_coordinator = the_surface_coordinator(); |
983 | 437 | /* TODO: Get proper configuration */ | 450 | /* TODO: Get proper configuration */ |
984 | 438 | geom::Rectangles view_area; | 451 | geom::Rectangles view_area; |
985 | 439 | display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db) | 452 | display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db) |
986 | @@ -452,12 +465,11 @@ | |||
987 | 452 | int i = 0; | 465 | int i = 0; |
988 | 453 | for (auto& m : moveables) | 466 | for (auto& m : moveables) |
989 | 454 | { | 467 | { |
992 | 455 | auto const s = surface_factory->create_surface( | 468 | auto const s = surface_coordinator->add_surface( |
991 | 456 | nullptr, | ||
993 | 457 | msh::a_surface().of_size(surface_size) | 469 | msh::a_surface().of_size(surface_size) |
994 | 458 | .of_pixel_format(surface_pf) | 470 | .of_pixel_format(surface_pf) |
995 | 459 | .of_buffer_usage(mg::BufferUsage::hardware), | 471 | .of_buffer_usage(mg::BufferUsage::hardware), |
997 | 460 | mf::SurfaceId(), {}); | 472 | {}); |
998 | 461 | 473 | ||
999 | 462 | /* | 474 | /* |
1000 | 463 | * We call swap_buffers() twice so that the surface is | 475 | * We call swap_buffers() twice so that the surface is |
1001 | 464 | 476 | ||
1002 | === modified file 'include/platform/mir/graphics/display_buffer.h' | |||
1003 | --- include/platform/mir/graphics/display_buffer.h 2014-03-06 06:05:17 +0000 | |||
1004 | +++ include/platform/mir/graphics/display_buffer.h 2014-04-07 13:29:13 +0000 | |||
1005 | @@ -20,11 +20,11 @@ | |||
1006 | 20 | #define MIR_GRAPHICS_DISPLAY_BUFFER_H_ | 20 | #define MIR_GRAPHICS_DISPLAY_BUFFER_H_ |
1007 | 21 | 21 | ||
1008 | 22 | #include <mir/geometry/rectangle.h> | 22 | #include <mir/geometry/rectangle.h> |
1009 | 23 | #include <mir/graphics/renderable.h> | ||
1010 | 23 | #include <mir_toolkit/common.h> | 24 | #include <mir_toolkit/common.h> |
1011 | 24 | 25 | ||
1012 | 25 | #include <memory> | 26 | #include <memory> |
1013 | 26 | #include <functional> | 27 | #include <functional> |
1014 | 27 | #include <list> | ||
1015 | 28 | 28 | ||
1016 | 29 | namespace mir | 29 | namespace mir |
1017 | 30 | { | 30 | { |
1018 | @@ -32,7 +32,6 @@ | |||
1019 | 32 | { | 32 | { |
1020 | 33 | 33 | ||
1021 | 34 | class Buffer; | 34 | class Buffer; |
1022 | 35 | class Renderable; | ||
1023 | 36 | 35 | ||
1024 | 37 | /** | 36 | /** |
1025 | 38 | * Interface to an output framebuffer. | 37 | * Interface to an output framebuffer. |
1026 | @@ -57,7 +56,7 @@ | |||
1027 | 57 | that Renderable via OpenGL, or via another method. If the Renderable is to be rendered | 56 | that Renderable via OpenGL, or via another method. If the Renderable is to be rendered |
1028 | 58 | via OpenGL, render_fn will be invoked on that Renderable. */ | 57 | via OpenGL, render_fn will be invoked on that Renderable. */ |
1029 | 59 | virtual void render_and_post_update( | 58 | virtual void render_and_post_update( |
1031 | 60 | std::list<std::shared_ptr<Renderable>> const& renderlist, | 59 | RenderableList const& renderlist, |
1032 | 61 | std::function<void(Renderable const&)> const& render_fn) = 0; | 60 | std::function<void(Renderable const&)> const& render_fn) = 0; |
1033 | 62 | 61 | ||
1034 | 63 | /** to be deprecated */ | 62 | /** to be deprecated */ |
1035 | 64 | 63 | ||
1036 | === added file 'include/platform/mir/graphics/gl_config.h' | |||
1037 | --- include/platform/mir/graphics/gl_config.h 1970-01-01 00:00:00 +0000 | |||
1038 | +++ include/platform/mir/graphics/gl_config.h 2014-04-07 13:29:13 +0000 | |||
1039 | @@ -0,0 +1,54 @@ | |||
1040 | 1 | /* | ||
1041 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1042 | 3 | * | ||
1043 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1044 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
1045 | 6 | * as published by the Free Software Foundation. | ||
1046 | 7 | * | ||
1047 | 8 | * This program is distributed in the hope that it will be useful, | ||
1048 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1049 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1050 | 11 | * GNU Lesser General Public License for more details. | ||
1051 | 12 | * | ||
1052 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1053 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1054 | 15 | * | ||
1055 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
1056 | 17 | */ | ||
1057 | 18 | |||
1058 | 19 | #ifndef MIR_GRAPHICS_GL_CONFIG_H_ | ||
1059 | 20 | #define MIR_GRAPHICS_GL_CONFIG_H_ | ||
1060 | 21 | |||
1061 | 22 | namespace mir | ||
1062 | 23 | { | ||
1063 | 24 | namespace graphics | ||
1064 | 25 | { | ||
1065 | 26 | |||
1066 | 27 | /** | ||
1067 | 28 | * Interface for customizing aspects of the GL config used by the server. | ||
1068 | 29 | */ | ||
1069 | 30 | class GLConfig | ||
1070 | 31 | { | ||
1071 | 32 | public: | ||
1072 | 33 | virtual ~GLConfig() = default; | ||
1073 | 34 | |||
1074 | 35 | /** | ||
1075 | 36 | * Gets the bits to use for each pixel in the depth buffer. | ||
1076 | 37 | */ | ||
1077 | 38 | virtual int depth_buffer_bits() const = 0; | ||
1078 | 39 | |||
1079 | 40 | /** | ||
1080 | 41 | * Gets the bits to use for each pixel in the stencil buffer. | ||
1081 | 42 | */ | ||
1082 | 43 | virtual int stencil_buffer_bits() const = 0; | ||
1083 | 44 | |||
1084 | 45 | protected: | ||
1085 | 46 | GLConfig() = default; | ||
1086 | 47 | GLConfig(GLConfig const&) = delete; | ||
1087 | 48 | GLConfig& operator=(GLConfig const&) = delete; | ||
1088 | 49 | }; | ||
1089 | 50 | |||
1090 | 51 | } | ||
1091 | 52 | } | ||
1092 | 53 | |||
1093 | 54 | #endif /* MIR_GRAPHICS_GL_CONFIG_H_ */ | ||
1094 | 0 | 55 | ||
1095 | === modified file 'include/platform/mir/graphics/platform.h' | |||
1096 | --- include/platform/mir/graphics/platform.h 2014-03-06 06:05:17 +0000 | |||
1097 | +++ include/platform/mir/graphics/platform.h 2014-04-07 13:29:13 +0000 | |||
1098 | @@ -22,6 +22,7 @@ | |||
1099 | 22 | 22 | ||
1100 | 23 | #include "basic_platform.h" | 23 | #include "basic_platform.h" |
1101 | 24 | 24 | ||
1102 | 25 | #include <boost/program_options/options_description.hpp> | ||
1103 | 25 | #include <memory> | 26 | #include <memory> |
1104 | 26 | 27 | ||
1105 | 27 | namespace mir | 28 | namespace mir |
1106 | @@ -48,6 +49,7 @@ | |||
1107 | 48 | class DisplayReport; | 49 | class DisplayReport; |
1108 | 49 | class DisplayConfigurationPolicy; | 50 | class DisplayConfigurationPolicy; |
1109 | 50 | class GraphicBufferAllocator; | 51 | class GraphicBufferAllocator; |
1110 | 52 | class GLConfig; | ||
1111 | 51 | 53 | ||
1112 | 52 | /** | 54 | /** |
1113 | 53 | * \defgroup platform_enablement Mir platform enablement | 55 | * \defgroup platform_enablement Mir platform enablement |
1114 | @@ -81,7 +83,8 @@ | |||
1115 | 81 | * Creates the display subsystem. | 83 | * Creates the display subsystem. |
1116 | 82 | */ | 84 | */ |
1117 | 83 | virtual std::shared_ptr<Display> create_display( | 85 | virtual std::shared_ptr<Display> create_display( |
1119 | 84 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy) = 0; | 86 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, |
1120 | 87 | std::shared_ptr<GLConfig> const& gl_config) = 0; | ||
1121 | 85 | 88 | ||
1122 | 86 | /** | 89 | /** |
1123 | 87 | * Gets the IPC package for the platform. | 90 | * Gets the IPC package for the platform. |
1124 | @@ -119,6 +122,10 @@ | |||
1125 | 119 | */ | 122 | */ |
1126 | 120 | extern "C" typedef std::shared_ptr<Platform>(*CreatePlatform)(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); | 123 | extern "C" typedef std::shared_ptr<Platform>(*CreatePlatform)(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); |
1127 | 121 | extern "C" std::shared_ptr<Platform> create_platform (std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); | 124 | extern "C" std::shared_ptr<Platform> create_platform (std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); |
1128 | 125 | extern "C" typedef void(*AddPlatformOptions)( | ||
1129 | 126 | boost::program_options::options_description& config); | ||
1130 | 127 | extern "C" void add_platform_options( | ||
1131 | 128 | boost::program_options::options_description& config); | ||
1132 | 122 | } | 129 | } |
1133 | 123 | } | 130 | } |
1134 | 124 | 131 | ||
1135 | 125 | 132 | ||
1136 | === modified file 'include/platform/mir/graphics/renderable.h' | |||
1137 | --- include/platform/mir/graphics/renderable.h 2014-03-17 07:35:22 +0000 | |||
1138 | +++ include/platform/mir/graphics/renderable.h 2014-04-07 13:29:13 +0000 | |||
1139 | @@ -22,6 +22,7 @@ | |||
1140 | 22 | #include <mir/geometry/rectangle.h> | 22 | #include <mir/geometry/rectangle.h> |
1141 | 23 | #include <glm/glm.hpp> | 23 | #include <glm/glm.hpp> |
1142 | 24 | #include <memory> | 24 | #include <memory> |
1143 | 25 | #include <list> | ||
1144 | 25 | 26 | ||
1145 | 26 | namespace mir | 27 | namespace mir |
1146 | 27 | { | 28 | { |
1147 | @@ -35,19 +36,15 @@ | |||
1148 | 35 | /** | 36 | /** |
1149 | 36 | * Return the next buffer that should be composited/rendered. | 37 | * Return the next buffer that should be composited/rendered. |
1150 | 37 | * | 38 | * |
1162 | 38 | * \param [in] frameno The frameno parameter is important for | 39 | * \param [in] user_id An arbitrary unique identifier used to distinguish |
1163 | 39 | * multi-monitor platforms. Calls with the same frameno | 40 | * separate threads/monitors/components which need |
1164 | 40 | * will get the same buffer returned. This ensures that | 41 | * to concurrently receive the same buffer. Calling |
1165 | 41 | * a surface visible on multiple outputs does not get | 42 | * with the same user_id will return a new (different) |
1166 | 42 | * its buffers consumed any faster than the refresh | 43 | * buffer to that user each time. For consistency, |
1167 | 43 | * rate of a single monitor. Implementations may ignore | 44 | * all callers need to determine their user_id in the |
1168 | 44 | * the value of frameno on single-monitor platforms | 45 | * same way (e.g. always use "this" pointer). |
1158 | 45 | * only. The caller should always ensure the frameno | ||
1159 | 46 | * is different to the previous frame. The exact value | ||
1160 | 47 | * of frameno is not important but a large range of | ||
1161 | 48 | * values is recommended. | ||
1169 | 49 | */ | 46 | */ |
1171 | 50 | virtual std::shared_ptr<Buffer> buffer(unsigned long frameno) const = 0; | 47 | virtual std::shared_ptr<Buffer> buffer(void const* user_id) const = 0; |
1172 | 51 | 48 | ||
1173 | 52 | virtual bool alpha_enabled() const = 0; | 49 | virtual bool alpha_enabled() const = 0; |
1174 | 53 | virtual geometry::Rectangle screen_position() const = 0; | 50 | virtual geometry::Rectangle screen_position() const = 0; |
1175 | @@ -69,7 +66,14 @@ | |||
1176 | 69 | * the surface itself). | 66 | * the surface itself). |
1177 | 70 | */ | 67 | */ |
1178 | 71 | virtual glm::mat4 transformation() const = 0; | 68 | virtual glm::mat4 transformation() const = 0; |
1180 | 72 | virtual bool should_be_rendered_in(geometry::Rectangle const& rect) const = 0; | 69 | |
1181 | 70 | /** | ||
1182 | 71 | * TODO: Its a bit questionable that we have this member function, why not | ||
1183 | 72 | * just trim the renderable from the RenderableList? Its convenient | ||
1184 | 73 | * to have this function temporarily while refactoring --kdub | ||
1185 | 74 | */ | ||
1186 | 75 | virtual bool visible() const = 0; | ||
1187 | 76 | |||
1188 | 73 | virtual bool shaped() const = 0; // meaning the pixel format has alpha | 77 | virtual bool shaped() const = 0; // meaning the pixel format has alpha |
1189 | 74 | virtual int buffers_ready_for_compositor() const = 0; | 78 | virtual int buffers_ready_for_compositor() const = 0; |
1190 | 75 | 79 | ||
1191 | @@ -80,6 +84,9 @@ | |||
1192 | 80 | Renderable& operator=(Renderable const&) = delete; | 84 | Renderable& operator=(Renderable const&) = delete; |
1193 | 81 | }; | 85 | }; |
1194 | 82 | 86 | ||
1195 | 87 | // XXX Would performance be better with a vector? | ||
1196 | 88 | typedef std::list<std::shared_ptr<Renderable>> RenderableList; | ||
1197 | 89 | |||
1198 | 83 | } | 90 | } |
1199 | 84 | } | 91 | } |
1200 | 85 | 92 | ||
1201 | 86 | 93 | ||
1202 | === modified file 'include/platform/mir/options/default_configuration.h' | |||
1203 | --- include/platform/mir/options/default_configuration.h 2014-03-17 07:35:22 +0000 | |||
1204 | +++ include/platform/mir/options/default_configuration.h 2014-04-07 13:29:13 +0000 | |||
1205 | @@ -37,6 +37,7 @@ | |||
1206 | 37 | boost::program_options::options_description_easy_init add_options(); | 37 | boost::program_options::options_description_easy_init add_options(); |
1207 | 38 | 38 | ||
1208 | 39 | private: | 39 | private: |
1209 | 40 | void add_platform_options(); | ||
1210 | 40 | // accessed via the base interface, when access to add_options() has been "lost" | 41 | // accessed via the base interface, when access to add_options() has been "lost" |
1211 | 41 | std::shared_ptr<options::Option> the_options() const override; | 42 | std::shared_ptr<options::Option> the_options() const override; |
1212 | 42 | 43 | ||
1213 | 43 | 44 | ||
1214 | === added file 'include/platform/mir/shared_library_loader.h' | |||
1215 | --- include/platform/mir/shared_library_loader.h 1970-01-01 00:00:00 +0000 | |||
1216 | +++ include/platform/mir/shared_library_loader.h 2014-04-07 13:29:13 +0000 | |||
1217 | @@ -0,0 +1,28 @@ | |||
1218 | 1 | /* | ||
1219 | 2 | * Copyright © 2013 Canonical Ltd. | ||
1220 | 3 | * | ||
1221 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1222 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
1223 | 6 | * as published by the Free Software Foundation. | ||
1224 | 7 | * | ||
1225 | 8 | * This program is distributed in the hope that it will be useful, | ||
1226 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1227 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1228 | 11 | * GNU Lesser General Public License for more details. | ||
1229 | 12 | * | ||
1230 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1231 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1232 | 15 | * | ||
1233 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
1234 | 17 | */ | ||
1235 | 18 | |||
1236 | 19 | #ifndef MIR_SHARED_LIBRARY_LOADER_H_ | ||
1237 | 20 | #define MIR_SHARED_LIBRARY_LOADER_H_ | ||
1238 | 21 | |||
1239 | 22 | #include <string> | ||
1240 | 23 | namespace mir | ||
1241 | 24 | { | ||
1242 | 25 | class SharedLibrary; | ||
1243 | 26 | SharedLibrary const* load_library(std::string const& libname); | ||
1244 | 27 | } | ||
1245 | 28 | #endif | ||
1246 | 0 | 29 | ||
1247 | === modified file 'include/server/mir/compositor/buffer_stream.h' | |||
1248 | --- include/server/mir/compositor/buffer_stream.h 2014-03-07 03:15:55 +0000 | |||
1249 | +++ include/server/mir/compositor/buffer_stream.h 2014-04-07 13:29:13 +0000 | |||
1250 | @@ -43,7 +43,7 @@ | |||
1251 | 43 | 43 | ||
1252 | 44 | virtual void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0; | 44 | virtual void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0; |
1253 | 45 | virtual std::shared_ptr<graphics::Buffer> | 45 | virtual std::shared_ptr<graphics::Buffer> |
1255 | 46 | lock_compositor_buffer(unsigned long frameno) = 0; | 46 | lock_compositor_buffer(void const* user_id) = 0; |
1256 | 47 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; | 47 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; |
1257 | 48 | virtual MirPixelFormat get_stream_pixel_format() = 0; | 48 | virtual MirPixelFormat get_stream_pixel_format() = 0; |
1258 | 49 | virtual geometry::Size stream_size() = 0; | 49 | virtual geometry::Size stream_size() = 0; |
1259 | 50 | 50 | ||
1260 | === modified file 'include/server/mir/compositor/gl_renderer.h' | |||
1261 | --- include/server/mir/compositor/gl_renderer.h 2014-03-17 07:35:22 +0000 | |||
1262 | +++ include/server/mir/compositor/gl_renderer.h 2014-04-07 13:29:13 +0000 | |||
1263 | @@ -54,14 +54,27 @@ | |||
1264 | 54 | GLfloat texcoord[2]; | 54 | GLfloat texcoord[2]; |
1265 | 55 | }; | 55 | }; |
1266 | 56 | 56 | ||
1267 | 57 | struct Primitive | ||
1268 | 58 | { | ||
1269 | 59 | GLenum type; // GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES etc | ||
1270 | 60 | GLuint tex_id; // GL texture ID (or 0 to represent the surface itself) | ||
1271 | 61 | std::vector<Vertex> vertices; | ||
1272 | 62 | }; | ||
1273 | 63 | |||
1274 | 57 | /** | 64 | /** |
1275 | 58 | * tessellate defines the list of triangles that will be used to render | 65 | * tessellate defines the list of triangles that will be used to render |
1276 | 59 | * the surface. By default it just returns 4 vertices for a rectangle. | 66 | * the surface. By default it just returns 4 vertices for a rectangle. |
1277 | 60 | * However you can override its behaviour to tessellate more finely and | 67 | * However you can override its behaviour to tessellate more finely and |
1278 | 61 | * deform freely for effects like wobbly windows. | 68 | * deform freely for effects like wobbly windows. |
1279 | 62 | * | 69 | * |
1282 | 63 | * \returns The mode to be passed to glDrawArrays, e.g. GL_TRIANGLE_STRIP, | 70 | * \param [in,out] primitives The list of rendering primitives to be |
1283 | 64 | * GL_TRIANGLE_FAN or GL_TRIANGLES. | 71 | * grown and/or modified. |
1284 | 72 | * \param [in] renderable The renderable surface being tessellated. | ||
1285 | 73 | * \param [in] buf_size The dimensions of the buffer being rendered, | ||
1286 | 74 | * which can be particularly useful in | ||
1287 | 75 | * calculating texcoords for a surface being | ||
1288 | 76 | * actively resized (as the buf_size doesn't | ||
1289 | 77 | * yet match renderable.size()). | ||
1290 | 65 | * | 78 | * |
1291 | 66 | * \note The cohesion of this function to GLRenderer is quite loose and it | 79 | * \note The cohesion of this function to GLRenderer is quite loose and it |
1292 | 67 | * does not strictly need to reside here. | 80 | * does not strictly need to reside here. |
1293 | @@ -69,8 +82,18 @@ | |||
1294 | 69 | * the only OpenGL-specific class in the display server, and | 82 | * the only OpenGL-specific class in the display server, and |
1295 | 70 | * tessellation is very much OpenGL-specific. | 83 | * tessellation is very much OpenGL-specific. |
1296 | 71 | */ | 84 | */ |
1299 | 72 | virtual GLenum tessellate(graphics::Renderable const& renderable, | 85 | virtual void tessellate(std::vector<Primitive>& primitives, |
1300 | 73 | std::vector<Vertex>& vertices) const; | 86 | graphics::Renderable const& renderable, |
1301 | 87 | geometry::Size const& buf_size) const; | ||
1302 | 88 | |||
1303 | 89 | /** | ||
1304 | 90 | * Load the texture for a surface any which way you like. The default | ||
1305 | 91 | * implementation does so with efficient GPU-side caching built in. | ||
1306 | 92 | * | ||
1307 | 93 | * \returns The OpenGL texture name for the surface. | ||
1308 | 94 | */ | ||
1309 | 95 | virtual GLuint load_texture(graphics::Renderable const& renderable, | ||
1310 | 96 | graphics::Buffer& buffer) const; | ||
1311 | 74 | 97 | ||
1312 | 75 | private: | 98 | private: |
1313 | 76 | GLuint vertex_shader; | 99 | GLuint vertex_shader; |
1314 | 77 | 100 | ||
1315 | === modified file 'include/server/mir/compositor/renderer.h' | |||
1316 | --- include/server/mir/compositor/renderer.h 2014-03-17 07:35:22 +0000 | |||
1317 | +++ include/server/mir/compositor/renderer.h 2014-04-07 13:29:13 +0000 | |||
1318 | @@ -40,8 +40,8 @@ | |||
1319 | 40 | virtual void set_rotation(float degrees) = 0; | 40 | virtual void set_rotation(float degrees) = 0; |
1320 | 41 | virtual void begin() const = 0; | 41 | virtual void begin() const = 0; |
1321 | 42 | 42 | ||
1324 | 43 | // XXX The buffer parameter here could now be replaced with a "frameno" | 43 | // XXX The buffer parameter here could now be replaced with |
1325 | 44 | // instead, and use renderable.buffer(frameno). Is that better? | 44 | // renderable::buffer(). |
1326 | 45 | virtual void render(graphics::Renderable const& renderable, | 45 | virtual void render(graphics::Renderable const& renderable, |
1327 | 46 | graphics::Buffer& buffer) const = 0; | 46 | graphics::Buffer& buffer) const = 0; |
1328 | 47 | virtual void end() const = 0; | 47 | virtual void end() const = 0; |
1329 | 48 | 48 | ||
1330 | === modified file 'include/server/mir/compositor/scene.h' | |||
1331 | --- include/server/mir/compositor/scene.h 2014-03-17 07:35:22 +0000 | |||
1332 | +++ include/server/mir/compositor/scene.h 2014-04-07 13:29:13 +0000 | |||
1333 | @@ -20,6 +20,7 @@ | |||
1334 | 20 | #define MIR_COMPOSITOR_SCENE_H_ | 20 | #define MIR_COMPOSITOR_SCENE_H_ |
1335 | 21 | 21 | ||
1336 | 22 | #include "mir/geometry/forward.h" | 22 | #include "mir/geometry/forward.h" |
1337 | 23 | #include "mir/graphics/renderable.h" | ||
1338 | 23 | 24 | ||
1339 | 24 | #include <memory> | 25 | #include <memory> |
1340 | 25 | #include <functional> | 26 | #include <functional> |
1341 | @@ -62,13 +63,15 @@ | |||
1342 | 62 | public: | 63 | public: |
1343 | 63 | virtual ~Scene() {} | 64 | virtual ~Scene() {} |
1344 | 64 | 65 | ||
1345 | 66 | /** | ||
1346 | 67 | * Generate a valid list of renderables based on the current state of the Scene. | ||
1347 | 68 | * \returns a list of mg::Renderables. The list is in stacking order from back to front. | ||
1348 | 69 | */ | ||
1349 | 70 | virtual graphics::RenderableList generate_renderable_list() const = 0; | ||
1350 | 71 | |||
1351 | 65 | // Back to front; normal rendering order | 72 | // Back to front; normal rendering order |
1352 | 66 | virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0; | 73 | virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0; |
1353 | 67 | 74 | ||
1354 | 68 | // Front to back; as used when scanning for occlusions | ||
1355 | 69 | virtual void reverse_for_each_if(FilterForScene& filter, | ||
1356 | 70 | OperatorForScene& op) = 0; | ||
1357 | 71 | |||
1358 | 72 | /** | 75 | /** |
1359 | 73 | * Sets a callback to be called whenever the state of the | 76 | * Sets a callback to be called whenever the state of the |
1360 | 74 | * Scene changes. | 77 | * Scene changes. |
1361 | 75 | 78 | ||
1362 | === modified file 'include/server/mir/default_server_configuration.h' | |||
1363 | --- include/server/mir/default_server_configuration.h 2014-03-06 06:05:17 +0000 | |||
1364 | +++ include/server/mir/default_server_configuration.h 2014-04-07 13:29:13 +0000 | |||
1365 | @@ -61,7 +61,6 @@ | |||
1366 | 61 | class SessionListener; | 61 | class SessionListener; |
1367 | 62 | class FocusController; | 62 | class FocusController; |
1368 | 63 | class DisplayLayout; | 63 | class DisplayLayout; |
1369 | 64 | class SurfaceConfigurator; | ||
1370 | 65 | } | 64 | } |
1371 | 66 | namespace time | 65 | namespace time |
1372 | 67 | { | 66 | { |
1373 | @@ -69,6 +68,7 @@ | |||
1374 | 69 | } | 68 | } |
1375 | 70 | namespace scene | 69 | namespace scene |
1376 | 71 | { | 70 | { |
1377 | 71 | class SurfaceFactory; | ||
1378 | 72 | class BroadcastingSessionEventSink; | 72 | class BroadcastingSessionEventSink; |
1379 | 73 | class BufferStreamFactory; | 73 | class BufferStreamFactory; |
1380 | 74 | class MediatingDisplayChanger; | 74 | class MediatingDisplayChanger; |
1381 | @@ -78,7 +78,8 @@ | |||
1382 | 78 | class SessionEventHandlerRegister; | 78 | class SessionEventHandlerRegister; |
1383 | 79 | class SessionManager; | 79 | class SessionManager; |
1384 | 80 | class SnapshotStrategy; | 80 | class SnapshotStrategy; |
1386 | 81 | class SurfaceBuilder; | 81 | class SurfaceCoordinator; |
1387 | 82 | class SurfaceConfigurator; | ||
1388 | 82 | class SurfaceStackModel; | 83 | class SurfaceStackModel; |
1389 | 83 | class SurfaceStack; | 84 | class SurfaceStack; |
1390 | 84 | class SurfaceRanker; | 85 | class SurfaceRanker; |
1391 | @@ -93,6 +94,7 @@ | |||
1392 | 93 | class BufferInitializer; | 94 | class BufferInitializer; |
1393 | 94 | class DisplayReport; | 95 | class DisplayReport; |
1394 | 95 | class GraphicBufferAllocator; | 96 | class GraphicBufferAllocator; |
1395 | 97 | class GLConfig; | ||
1396 | 96 | namespace nested { class HostConnection; } | 98 | namespace nested { class HostConnection; } |
1397 | 97 | } | 99 | } |
1398 | 98 | namespace input | 100 | namespace input |
1399 | @@ -152,6 +154,7 @@ | |||
1400 | 152 | virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy(); | 154 | virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy(); |
1401 | 153 | virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection(); | 155 | virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection(); |
1402 | 154 | virtual std::shared_ptr<input::EventFilter> the_nested_event_filter(); | 156 | virtual std::shared_ptr<input::EventFilter> the_nested_event_filter(); |
1403 | 157 | virtual std::shared_ptr<graphics::GLConfig> the_gl_config(); | ||
1404 | 155 | /** @} */ | 158 | /** @} */ |
1405 | 156 | 159 | ||
1406 | 157 | /** @name graphics configuration - dependencies | 160 | /** @name graphics configuration - dependencies |
1407 | @@ -198,12 +201,10 @@ | |||
1408 | 198 | * configurable interfaces for modifying shell | 201 | * configurable interfaces for modifying shell |
1409 | 199 | * @{ */ | 202 | * @{ */ |
1410 | 200 | virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory(); | 203 | virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory(); |
1411 | 201 | virtual std::shared_ptr<shell::SurfaceFactory> the_scene_surface_factory(); | ||
1412 | 202 | virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter(); | 204 | virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter(); |
1413 | 203 | virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy(); | 205 | virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy(); |
1414 | 204 | virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener(); | 206 | virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener(); |
1415 | 205 | virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout(); | 207 | virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout(); |
1416 | 206 | virtual std::shared_ptr<shell::SurfaceConfigurator> the_shell_surface_configurator(); | ||
1417 | 207 | /** @} */ | 208 | /** @} */ |
1418 | 208 | 209 | ||
1419 | 209 | /** @name internal scene configuration | 210 | /** @name internal scene configuration |
1420 | @@ -216,7 +217,10 @@ | |||
1421 | 216 | virtual std::shared_ptr<scene::SessionEventSink> the_session_event_sink(); | 217 | virtual std::shared_ptr<scene::SessionEventSink> the_session_event_sink(); |
1422 | 217 | virtual std::shared_ptr<scene::SessionEventHandlerRegister> the_session_event_handler_register(); | 218 | virtual std::shared_ptr<scene::SessionEventHandlerRegister> the_session_event_handler_register(); |
1423 | 218 | virtual std::shared_ptr<scene::SurfaceStackModel> the_surface_stack_model(); | 219 | virtual std::shared_ptr<scene::SurfaceStackModel> the_surface_stack_model(); |
1425 | 219 | virtual std::shared_ptr<scene::SurfaceRanker> the_surface_ranker(); | 220 | virtual std::shared_ptr<scene::SurfaceRanker> the_surface_ranker(); |
1426 | 221 | virtual std::shared_ptr<scene::SurfaceFactory> the_surface_factory(); | ||
1427 | 222 | virtual std::shared_ptr<scene::SurfaceCoordinator>the_surface_coordinator(); | ||
1428 | 223 | virtual std::shared_ptr<scene::SurfaceConfigurator> the_surface_configurator(); | ||
1429 | 220 | /** @} */ | 224 | /** @} */ |
1430 | 221 | 225 | ||
1431 | 222 | /** @name scene configuration - dependencies | 226 | /** @name scene configuration - dependencies |
1432 | @@ -284,7 +288,7 @@ | |||
1433 | 284 | CachedPtr<scene::SceneReport> scene_report; | 288 | CachedPtr<scene::SceneReport> scene_report; |
1434 | 285 | 289 | ||
1435 | 286 | CachedPtr<shell::SurfaceFactory> shell_surface_factory; | 290 | CachedPtr<shell::SurfaceFactory> shell_surface_factory; |
1437 | 287 | CachedPtr<shell::SurfaceFactory> scene_surface_factory; | 291 | CachedPtr<scene::SurfaceFactory> surface_factory; |
1438 | 288 | CachedPtr<scene::SessionContainer> session_container; | 292 | CachedPtr<scene::SessionContainer> session_container; |
1439 | 289 | CachedPtr<shell::FocusSetter> shell_focus_setter; | 293 | CachedPtr<shell::FocusSetter> shell_focus_setter; |
1440 | 290 | CachedPtr<shell::PlacementStrategy> shell_placement_strategy; | 294 | CachedPtr<shell::PlacementStrategy> shell_placement_strategy; |
1441 | @@ -292,7 +296,7 @@ | |||
1442 | 292 | CachedPtr<scene::PixelBuffer> pixel_buffer; | 296 | CachedPtr<scene::PixelBuffer> pixel_buffer; |
1443 | 293 | CachedPtr<scene::SnapshotStrategy> snapshot_strategy; | 297 | CachedPtr<scene::SnapshotStrategy> snapshot_strategy; |
1444 | 294 | CachedPtr<shell::DisplayLayout> shell_display_layout; | 298 | CachedPtr<shell::DisplayLayout> shell_display_layout; |
1446 | 295 | CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator; | 299 | CachedPtr<scene::SurfaceConfigurator> surface_configurator; |
1447 | 296 | CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory; | 300 | CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory; |
1448 | 297 | CachedPtr<compositor::Compositor> compositor; | 301 | CachedPtr<compositor::Compositor> compositor; |
1449 | 298 | CachedPtr<compositor::CompositorReport> compositor_report; | 302 | CachedPtr<compositor::CompositorReport> compositor_report; |
1450 | @@ -304,6 +308,7 @@ | |||
1451 | 304 | CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy; | 308 | CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy; |
1452 | 305 | CachedPtr<graphics::nested::HostConnection> host_connection; | 309 | CachedPtr<graphics::nested::HostConnection> host_connection; |
1453 | 306 | CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer; | 310 | CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer; |
1454 | 311 | CachedPtr<graphics::GLConfig> gl_config; | ||
1455 | 307 | 312 | ||
1456 | 308 | private: | 313 | private: |
1457 | 309 | std::shared_ptr<options::Configuration> const configuration_options; | 314 | std::shared_ptr<options::Configuration> const configuration_options; |
1458 | @@ -321,7 +326,6 @@ | |||
1459 | 321 | std::shared_ptr<scene::BroadcastingSessionEventSink> the_broadcasting_session_event_sink(); | 326 | std::shared_ptr<scene::BroadcastingSessionEventSink> the_broadcasting_session_event_sink(); |
1460 | 322 | std::shared_ptr<input::NestedInputRelay> the_nested_input_relay(); | 327 | std::shared_ptr<input::NestedInputRelay> the_nested_input_relay(); |
1461 | 323 | std::shared_ptr<scene::SessionManager> the_session_manager(); | 328 | std::shared_ptr<scene::SessionManager> the_session_manager(); |
1462 | 324 | std::shared_ptr<scene::SurfaceBuilder> the_surface_builder(); | ||
1463 | 325 | std::shared_ptr<scene::SurfaceController> the_surface_controller(); | 329 | std::shared_ptr<scene::SurfaceController> the_surface_controller(); |
1464 | 326 | 330 | ||
1465 | 327 | auto report_factory(char const* report_opt) -> std::unique_ptr<report::ReportFactory>; | 331 | auto report_factory(char const* report_opt) -> std::unique_ptr<report::ReportFactory>; |
1466 | 328 | 332 | ||
1467 | === modified file 'include/server/mir/frontend/display_changer.h' | |||
1468 | --- include/server/mir/frontend/display_changer.h 2013-09-17 20:03:16 +0000 | |||
1469 | +++ include/server/mir/frontend/display_changer.h 2014-04-07 13:29:13 +0000 | |||
1470 | @@ -38,7 +38,6 @@ | |||
1471 | 38 | 38 | ||
1472 | 39 | virtual std::shared_ptr<graphics::DisplayConfiguration> active_configuration() = 0; | 39 | virtual std::shared_ptr<graphics::DisplayConfiguration> active_configuration() = 0; |
1473 | 40 | virtual void configure(std::shared_ptr<Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&) = 0; | 40 | virtual void configure(std::shared_ptr<Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&) = 0; |
1474 | 41 | virtual void ensure_display_powered(std::shared_ptr<Session> const& session) = 0; | ||
1475 | 42 | 41 | ||
1476 | 43 | protected: | 42 | protected: |
1477 | 44 | DisplayChanger() = default; | 43 | DisplayChanger() = default; |
1478 | 45 | 44 | ||
1479 | === modified file 'include/server/mir/frontend/session_authorizer.h' | |||
1480 | --- include/server/mir/frontend/session_authorizer.h 2014-03-06 06:05:17 +0000 | |||
1481 | +++ include/server/mir/frontend/session_authorizer.h 2014-04-07 13:29:13 +0000 | |||
1482 | @@ -29,10 +29,12 @@ | |||
1483 | 29 | class SessionAuthorizer | 29 | class SessionAuthorizer |
1484 | 30 | { | 30 | { |
1485 | 31 | public: | 31 | public: |
1487 | 32 | virtual ~SessionAuthorizer() {} | 32 | virtual ~SessionAuthorizer() = default; |
1488 | 33 | 33 | ||
1489 | 34 | virtual bool connection_is_allowed(pid_t pid) = 0; | 34 | virtual bool connection_is_allowed(pid_t pid) = 0; |
1490 | 35 | virtual bool configure_display_is_allowed(pid_t pid) = 0; | 35 | virtual bool configure_display_is_allowed(pid_t pid) = 0; |
1491 | 36 | virtual bool screencast_is_allowed(pid_t pid) = 0; | ||
1492 | 37 | |||
1493 | 36 | protected: | 38 | protected: |
1494 | 37 | SessionAuthorizer() = default; | 39 | SessionAuthorizer() = default; |
1495 | 38 | SessionAuthorizer(SessionAuthorizer const&) = delete; | 40 | SessionAuthorizer(SessionAuthorizer const&) = delete; |
1496 | 39 | 41 | ||
1497 | === modified file 'include/server/mir/input/surface.h' | |||
1498 | --- include/server/mir/input/surface.h 2014-03-06 06:05:17 +0000 | |||
1499 | +++ include/server/mir/input/surface.h 2014-04-07 13:29:13 +0000 | |||
1500 | @@ -30,7 +30,7 @@ | |||
1501 | 30 | class Surface | 30 | class Surface |
1502 | 31 | { | 31 | { |
1503 | 32 | public: | 32 | public: |
1505 | 33 | virtual std::string const& name() const = 0; | 33 | virtual std::string name() const = 0; |
1506 | 34 | virtual geometry::Point top_left() const = 0; | 34 | virtual geometry::Point top_left() const = 0; |
1507 | 35 | virtual geometry::Size size() const = 0; | 35 | virtual geometry::Size size() const = 0; |
1508 | 36 | virtual bool contains(geometry::Point const& point) const = 0; | 36 | virtual bool contains(geometry::Point const& point) const = 0; |
1509 | 37 | 37 | ||
1510 | === added file 'include/server/mir/scene/surface.h' | |||
1511 | --- include/server/mir/scene/surface.h 1970-01-01 00:00:00 +0000 | |||
1512 | +++ include/server/mir/scene/surface.h 2014-04-07 13:29:13 +0000 | |||
1513 | @@ -0,0 +1,59 @@ | |||
1514 | 1 | /* | ||
1515 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1516 | 3 | * | ||
1517 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1518 | 5 | * under the terms of the GNU General Public License version 3, | ||
1519 | 6 | * as published by the Free Software Foundation. | ||
1520 | 7 | * | ||
1521 | 8 | * This program is distributed in the hope that it will be useful, | ||
1522 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1523 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1524 | 11 | * GNU General Public License for more details. | ||
1525 | 12 | * | ||
1526 | 13 | * You should have received a copy of the GNU General Public License | ||
1527 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1528 | 15 | * | ||
1529 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
1530 | 17 | */ | ||
1531 | 18 | |||
1532 | 19 | #ifndef MIR_SCENE_SURFACE_H_ | ||
1533 | 20 | #define MIR_SCENE_SURFACE_H_ | ||
1534 | 21 | |||
1535 | 22 | #include "mir/graphics/renderable.h" | ||
1536 | 23 | #include "mir/input/surface.h" | ||
1537 | 24 | #include "mir/shell/surface.h" | ||
1538 | 25 | |||
1539 | 26 | namespace mir | ||
1540 | 27 | { | ||
1541 | 28 | namespace input { class InputChannel; } | ||
1542 | 29 | |||
1543 | 30 | namespace scene | ||
1544 | 31 | { | ||
1545 | 32 | class SurfaceObserver; | ||
1546 | 33 | |||
1547 | 34 | class Surface : | ||
1548 | 35 | public graphics::Renderable, | ||
1549 | 36 | public input::Surface, | ||
1550 | 37 | public shell::Surface | ||
1551 | 38 | { | ||
1552 | 39 | public: | ||
1553 | 40 | // resolve ambiguous member function names | ||
1554 | 41 | std::string name() const = 0; | ||
1555 | 42 | geometry::Size size() const = 0; | ||
1556 | 43 | geometry::Point top_left() const = 0; | ||
1557 | 44 | float alpha() const = 0; | ||
1558 | 45 | |||
1559 | 46 | // member functions that don't exist in base classes | ||
1560 | 47 | // TODO input_channel() and on_change() relate to | ||
1561 | 48 | // TODO adding and removing the surface from the scene and are probably not | ||
1562 | 49 | // TODO cleanest interface for this. | ||
1563 | 50 | virtual std::shared_ptr<input::InputChannel> input_channel() const = 0; | ||
1564 | 51 | virtual void on_change(std::function<void()> change_notification) = 0; | ||
1565 | 52 | |||
1566 | 53 | virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0; | ||
1567 | 54 | virtual void remove_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0; | ||
1568 | 55 | }; | ||
1569 | 56 | } | ||
1570 | 57 | } | ||
1571 | 58 | |||
1572 | 59 | #endif // MIR_SCENE_SURFACE_H_ | ||
1573 | 0 | 60 | ||
1574 | === renamed file 'include/server/mir/shell/surface_configurator.h' => 'include/server/mir/scene/surface_configurator.h' | |||
1575 | --- include/server/mir/shell/surface_configurator.h 2014-03-06 06:05:17 +0000 | |||
1576 | +++ include/server/mir/scene/surface_configurator.h 2014-04-07 13:29:13 +0000 | |||
1577 | @@ -16,8 +16,8 @@ | |||
1578 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> |
1579 | 17 | */ | 17 | */ |
1580 | 18 | 18 | ||
1583 | 19 | #ifndef MIR_SHELL_SURFACE_CONFIGURATOR_H_ | 19 | #ifndef MIR_SCENE_SURFACE_CONFIGURATOR_H_ |
1584 | 20 | #define MIR_SHELL_SURFACE_CONFIGURATOR_H_ | 20 | #define MIR_SCENE_SURFACE_CONFIGURATOR_H_ |
1585 | 21 | 21 | ||
1586 | 22 | #include "mir_toolkit/common.h" | 22 | #include "mir_toolkit/common.h" |
1587 | 23 | 23 | ||
1588 | @@ -26,7 +26,7 @@ | |||
1589 | 26 | namespace mir | 26 | namespace mir |
1590 | 27 | { | 27 | { |
1591 | 28 | 28 | ||
1593 | 29 | namespace shell | 29 | namespace scene |
1594 | 30 | { | 30 | { |
1595 | 31 | class Surface; | 31 | class Surface; |
1596 | 32 | 32 | ||
1597 | @@ -51,4 +51,4 @@ | |||
1598 | 51 | } | 51 | } |
1599 | 52 | } // namespace mir | 52 | } // namespace mir |
1600 | 53 | 53 | ||
1602 | 54 | #endif // MIR_SHELL_SURFACE_CONFIGURATOR_H_ | 54 | #endif // MIR_SCENE_SURFACE_CONFIGURATOR_H_ |
1603 | 55 | 55 | ||
1604 | === renamed file 'src/server/scene/surface_builder.h' => 'include/server/mir/scene/surface_coordinator.h' | |||
1605 | --- src/server/scene/surface_builder.h 2014-03-06 06:05:17 +0000 | |||
1606 | +++ include/server/mir/scene/surface_coordinator.h 2014-04-07 13:29:13 +0000 | |||
1607 | @@ -1,5 +1,5 @@ | |||
1608 | 1 | /* | 1 | /* |
1610 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-14 Canonical Ltd. |
1611 | 3 | * | 3 | * |
1612 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1613 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1614 | @@ -17,8 +17,10 @@ | |||
1615 | 17 | */ | 17 | */ |
1616 | 18 | 18 | ||
1617 | 19 | 19 | ||
1620 | 20 | #ifndef MIR_SCENE_SURFACE_BUILDER_H_ | 20 | #ifndef MIR_SCENE_SURFACE_COORDINATOR_H_ |
1621 | 21 | #define MIR_SCENE_SURFACE_BUILDER_H_ | 21 | #define MIR_SCENE_SURFACE_COORDINATOR_H_ |
1622 | 22 | |||
1623 | 23 | #include "mir/scene/surface_ranker.h" | ||
1624 | 22 | 24 | ||
1625 | 23 | #include <memory> | 25 | #include <memory> |
1626 | 24 | 26 | ||
1627 | @@ -31,22 +33,25 @@ | |||
1628 | 31 | 33 | ||
1629 | 32 | namespace scene | 34 | namespace scene |
1630 | 33 | { | 35 | { |
1632 | 34 | class BasicSurface; | 36 | class Surface; |
1633 | 37 | class SurfaceObserver; | ||
1634 | 35 | 38 | ||
1636 | 36 | class SurfaceBuilder | 39 | class SurfaceCoordinator : public SurfaceRanker |
1637 | 37 | { | 40 | { |
1638 | 38 | public: | 41 | public: |
1640 | 39 | virtual std::weak_ptr<BasicSurface> create_surface(shell::SurfaceCreationParameters const& params) = 0; | 42 | virtual std::shared_ptr<Surface> add_surface( |
1641 | 43 | shell::SurfaceCreationParameters const& params, | ||
1642 | 44 | std::shared_ptr<SurfaceObserver> const& observer) = 0; | ||
1643 | 40 | 45 | ||
1645 | 41 | virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface) = 0; | 46 | virtual void remove_surface(std::weak_ptr<Surface> const& surface) = 0; |
1646 | 42 | protected: | 47 | protected: |
1651 | 43 | SurfaceBuilder() = default; | 48 | SurfaceCoordinator() = default; |
1652 | 44 | virtual ~SurfaceBuilder() = default; | 49 | virtual ~SurfaceCoordinator() = default; |
1653 | 45 | SurfaceBuilder(SurfaceBuilder const&) = delete; | 50 | SurfaceCoordinator(SurfaceCoordinator const&) = delete; |
1654 | 46 | SurfaceBuilder& operator=(SurfaceBuilder const&) = delete; | 51 | SurfaceCoordinator& operator=(SurfaceCoordinator const&) = delete; |
1655 | 47 | }; | 52 | }; |
1656 | 48 | } | 53 | } |
1657 | 49 | } | 54 | } |
1658 | 50 | 55 | ||
1659 | 51 | 56 | ||
1661 | 52 | #endif /* MIR_SCENE_SURFACE_BUILDER_H_ */ | 57 | #endif /* MIR_SCENE_SURFACE_COORDINATOR_H_ */ |
1662 | 53 | 58 | ||
1663 | === added file 'include/server/mir/scene/surface_event_source.h' | |||
1664 | --- include/server/mir/scene/surface_event_source.h 1970-01-01 00:00:00 +0000 | |||
1665 | +++ include/server/mir/scene/surface_event_source.h 2014-04-07 13:29:13 +0000 | |||
1666 | @@ -0,0 +1,49 @@ | |||
1667 | 1 | /* | ||
1668 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1669 | 3 | * | ||
1670 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1671 | 5 | * under the terms of the GNU General Public License version 3, | ||
1672 | 6 | * as published by the Free Software Foundation. | ||
1673 | 7 | * | ||
1674 | 8 | * This program is distributed in the hope that it will be useful, | ||
1675 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1676 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1677 | 11 | * GNU General Public License for more details. | ||
1678 | 12 | * | ||
1679 | 13 | * You should have received a copy of the GNU General Public License | ||
1680 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1681 | 15 | * | ||
1682 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
1683 | 17 | */ | ||
1684 | 18 | |||
1685 | 19 | #ifndef MIR_SCENE_SURFACE_EVENT_SOURCE_H_ | ||
1686 | 20 | #define MIR_SCENE_SURFACE_EVENT_SOURCE_H_ | ||
1687 | 21 | |||
1688 | 22 | #include "mir/scene/surface_observer.h" | ||
1689 | 23 | #include "mir/frontend/surface_id.h" | ||
1690 | 24 | #include "mir/frontend/event_sink.h" | ||
1691 | 25 | |||
1692 | 26 | #include <memory> | ||
1693 | 27 | |||
1694 | 28 | namespace mir | ||
1695 | 29 | { | ||
1696 | 30 | namespace scene | ||
1697 | 31 | { | ||
1698 | 32 | class SurfaceEventSource : public SurfaceObserver | ||
1699 | 33 | { | ||
1700 | 34 | public: | ||
1701 | 35 | SurfaceEventSource( | ||
1702 | 36 | frontend::SurfaceId id, | ||
1703 | 37 | std::shared_ptr<frontend::EventSink> const& event_sink); | ||
1704 | 38 | |||
1705 | 39 | void attrib_change(MirSurfaceAttrib attrib, int value); | ||
1706 | 40 | void resize(geometry::Size const& size); | ||
1707 | 41 | |||
1708 | 42 | private: | ||
1709 | 43 | frontend::SurfaceId const id; | ||
1710 | 44 | std::shared_ptr<frontend::EventSink> const event_sink; | ||
1711 | 45 | }; | ||
1712 | 46 | } | ||
1713 | 47 | } | ||
1714 | 48 | |||
1715 | 49 | #endif // MIR_SCENE_SURFACE_EVENT_SOURCE_H_ | ||
1716 | 0 | 50 | ||
1717 | === renamed file 'src/server/scene/basic_surface_factory.h' => 'include/server/mir/scene/surface_factory.h' | |||
1718 | --- src/server/scene/basic_surface_factory.h 2014-03-06 06:05:17 +0000 | |||
1719 | +++ include/server/mir/scene/surface_factory.h 2014-04-07 13:29:13 +0000 | |||
1720 | @@ -1,5 +1,5 @@ | |||
1721 | 1 | /* | 1 | /* |
1723 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
1724 | 3 | * | 3 | * |
1725 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1726 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1727 | @@ -16,33 +16,33 @@ | |||
1728 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1729 | 17 | */ | 17 | */ |
1730 | 18 | 18 | ||
1733 | 19 | #ifndef MIR_SCENE_BASIC_SURFACE_FACTORY_H_ | 19 | #ifndef MIR_SCENE_SURFACE_FACTORY_H_ |
1734 | 20 | #define MIR_SCENE_BASIC_SURFACE_FACTORY_H_ | 20 | #define MIR_SCENE_SURFACE_FACTORY_H_ |
1735 | 21 | 21 | ||
1736 | 22 | #include "mir/shell/surface_creation_parameters.h" | 22 | #include "mir/shell/surface_creation_parameters.h" |
1737 | 23 | #include <memory> | 23 | #include <memory> |
1738 | 24 | #include <functional> | ||
1739 | 25 | 24 | ||
1740 | 26 | namespace mir | 25 | namespace mir |
1741 | 27 | { | 26 | { |
1742 | 28 | namespace scene | 27 | namespace scene |
1743 | 29 | { | 28 | { |
1744 | 29 | class Surface; | ||
1745 | 30 | 30 | ||
1748 | 31 | class BasicSurface; | 31 | class SurfaceFactory |
1747 | 32 | class BasicSurfaceFactory | ||
1749 | 33 | { | 32 | { |
1750 | 34 | public: | 33 | public: |
1756 | 35 | BasicSurfaceFactory() = default; | 34 | SurfaceFactory() = default; |
1757 | 36 | virtual ~BasicSurfaceFactory() = default; | 35 | virtual ~SurfaceFactory() = default; |
1758 | 37 | 36 | ||
1759 | 38 | virtual std::shared_ptr<BasicSurface> create_surface( | 37 | virtual std::shared_ptr<Surface> create_surface( |
1760 | 39 | shell::SurfaceCreationParameters const&, std::function<void()> const&) = 0; | 38 | shell::SurfaceCreationParameters const& params) = 0; |
1761 | 39 | |||
1762 | 40 | private: | 40 | private: |
1765 | 41 | BasicSurfaceFactory(const BasicSurfaceFactory&) = delete; | 41 | SurfaceFactory(const SurfaceFactory&) = delete; |
1766 | 42 | BasicSurfaceFactory& operator=(const BasicSurfaceFactory&) = delete; | 42 | SurfaceFactory& operator=(const SurfaceFactory&) = delete; |
1767 | 43 | }; | 43 | }; |
1768 | 44 | 44 | ||
1769 | 45 | } | 45 | } |
1770 | 46 | } | 46 | } |
1771 | 47 | 47 | ||
1773 | 48 | #endif /* MIR_SCENE_BASIC_SURFACE_FACTORY_H_ */ | 48 | #endif /* MIR_SCENE_SURFACE_FACTORY_H_ */ |
1774 | 49 | 49 | ||
1775 | === added file 'include/server/mir/scene/surface_observer.h' | |||
1776 | --- include/server/mir/scene/surface_observer.h 1970-01-01 00:00:00 +0000 | |||
1777 | +++ include/server/mir/scene/surface_observer.h 2014-04-07 13:29:13 +0000 | |||
1778 | @@ -0,0 +1,45 @@ | |||
1779 | 1 | /* | ||
1780 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1781 | 3 | * | ||
1782 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1783 | 5 | * under the terms of the GNU General Public License version 3, | ||
1784 | 6 | * as published by the Free Software Foundation. | ||
1785 | 7 | * | ||
1786 | 8 | * This program is distributed in the hope that it will be useful, | ||
1787 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1788 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1789 | 11 | * GNU General Public License for more details. | ||
1790 | 12 | * | ||
1791 | 13 | * You should have received a copy of the GNU General Public License | ||
1792 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1793 | 15 | * | ||
1794 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
1795 | 17 | */ | ||
1796 | 18 | |||
1797 | 19 | #ifndef MIR_SCENE_SURFACE_OBSERVER_H_ | ||
1798 | 20 | #define MIR_SCENE_SURFACE_OBSERVER_H_ | ||
1799 | 21 | |||
1800 | 22 | #include "mir/geometry/size.h" | ||
1801 | 23 | #include "mir_toolkit/common.h" | ||
1802 | 24 | |||
1803 | 25 | namespace mir | ||
1804 | 26 | { | ||
1805 | 27 | namespace scene | ||
1806 | 28 | { | ||
1807 | 29 | // Initial cut - supporting the frontend requirement, more will follow | ||
1808 | 30 | class SurfaceObserver | ||
1809 | 31 | { | ||
1810 | 32 | public: | ||
1811 | 33 | virtual void attrib_change(MirSurfaceAttrib attrib, int value) = 0; | ||
1812 | 34 | virtual void resize(geometry::Size const& size) = 0; | ||
1813 | 35 | |||
1814 | 36 | protected: | ||
1815 | 37 | SurfaceObserver() = default; | ||
1816 | 38 | virtual ~SurfaceObserver() = default; | ||
1817 | 39 | SurfaceObserver(SurfaceObserver const&) = delete; | ||
1818 | 40 | SurfaceObserver& operator=(SurfaceObserver const&) = delete; | ||
1819 | 41 | }; | ||
1820 | 42 | } | ||
1821 | 43 | } | ||
1822 | 44 | |||
1823 | 45 | #endif // MIR_SCENE_SURFACE_OBSERVER_H_ | ||
1824 | 0 | 46 | ||
1825 | === renamed file 'src/server/scene/surface_ranker.h' => 'include/server/mir/scene/surface_ranker.h' | |||
1826 | --- src/server/scene/surface_ranker.h 2014-03-06 06:05:17 +0000 | |||
1827 | +++ include/server/mir/scene/surface_ranker.h 2014-04-07 13:29:13 +0000 | |||
1828 | @@ -26,12 +26,12 @@ | |||
1829 | 26 | { | 26 | { |
1830 | 27 | namespace scene | 27 | namespace scene |
1831 | 28 | { | 28 | { |
1833 | 29 | class BasicSurface; | 29 | class Surface; |
1834 | 30 | 30 | ||
1835 | 31 | class SurfaceRanker | 31 | class SurfaceRanker |
1836 | 32 | { | 32 | { |
1837 | 33 | public: | 33 | public: |
1839 | 34 | virtual void raise(std::weak_ptr<BasicSurface> const& surface) = 0; | 34 | virtual void raise(std::weak_ptr<Surface> const& surface) = 0; |
1840 | 35 | 35 | ||
1841 | 36 | protected: | 36 | protected: |
1842 | 37 | SurfaceRanker() = default; | 37 | SurfaceRanker() = default; |
1843 | 38 | 38 | ||
1844 | === modified file 'include/server/mir/shell/surface.h' | |||
1845 | --- include/server/mir/shell/surface.h 2014-03-06 06:05:17 +0000 | |||
1846 | +++ include/server/mir/shell/surface.h 2014-04-07 13:29:13 +0000 | |||
1847 | @@ -50,10 +50,8 @@ | |||
1848 | 50 | 50 | ||
1849 | 51 | virtual void allow_framedropping(bool) = 0; | 51 | virtual void allow_framedropping(bool) = 0; |
1850 | 52 | 52 | ||
1851 | 53 | virtual void raise(std::shared_ptr<scene::SurfaceRanker> const& controller) = 0; | ||
1852 | 54 | |||
1853 | 55 | virtual void resize(geometry::Size const& size) = 0; | 53 | virtual void resize(geometry::Size const& size) = 0; |
1855 | 56 | virtual void set_rotation(float degrees, glm::vec3 const& axis) = 0; | 54 | virtual void set_transformation(glm::mat4 const& t) = 0; |
1856 | 57 | 55 | ||
1857 | 58 | virtual float alpha() const = 0; | 56 | virtual float alpha() const = 0; |
1858 | 59 | virtual void set_alpha(float alpha) = 0; | 57 | virtual void set_alpha(float alpha) = 0; |
1859 | 60 | 58 | ||
1860 | === modified file 'include/server/mir/shell/surface_factory.h' | |||
1861 | --- include/server/mir/shell/surface_factory.h 2013-08-28 03:41:48 +0000 | |||
1862 | +++ include/server/mir/shell/surface_factory.h 2014-04-07 13:29:13 +0000 | |||
1863 | @@ -1,5 +1,5 @@ | |||
1864 | 1 | /* | 1 | /* |
1866 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1867 | 3 | * | 3 | * |
1868 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1869 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1870 | @@ -19,15 +19,12 @@ | |||
1871 | 19 | #ifndef MIR_SHELL_SURFACE_FACTORY_H_ | 19 | #ifndef MIR_SHELL_SURFACE_FACTORY_H_ |
1872 | 20 | #define MIR_SHELL_SURFACE_FACTORY_H_ | 20 | #define MIR_SHELL_SURFACE_FACTORY_H_ |
1873 | 21 | 21 | ||
1874 | 22 | #include "mir/frontend/surface_id.h" | ||
1875 | 23 | #include <memory> | 22 | #include <memory> |
1876 | 24 | 23 | ||
1877 | 25 | namespace mir | 24 | namespace mir |
1878 | 26 | { | 25 | { |
1883 | 27 | namespace frontend | 26 | namespace scene { class SurfaceObserver; } |
1884 | 28 | { | 27 | |
1881 | 29 | class EventSink; | ||
1882 | 30 | } | ||
1885 | 31 | namespace shell | 28 | namespace shell |
1886 | 32 | { | 29 | { |
1887 | 33 | class Session; | 30 | class Session; |
1888 | @@ -40,8 +37,9 @@ | |||
1889 | 40 | virtual std::shared_ptr<Surface> create_surface( | 37 | virtual std::shared_ptr<Surface> create_surface( |
1890 | 41 | Session* session, | 38 | Session* session, |
1891 | 42 | SurfaceCreationParameters const& params, | 39 | SurfaceCreationParameters const& params, |
1894 | 43 | frontend::SurfaceId id, | 40 | std::shared_ptr<scene::SurfaceObserver> const& observer) = 0; |
1895 | 44 | std::shared_ptr<frontend::EventSink> const& sink) = 0; | 41 | |
1896 | 42 | virtual void destroy_surface(std::shared_ptr<Surface> const& surface) = 0; | ||
1897 | 45 | 43 | ||
1898 | 46 | protected: | 44 | protected: |
1899 | 47 | virtual ~SurfaceFactory() {} | 45 | virtual ~SurfaceFactory() {} |
1900 | 48 | 46 | ||
1901 | === added file 'include/shared/mir/geometry/length.h' | |||
1902 | --- include/shared/mir/geometry/length.h 1970-01-01 00:00:00 +0000 | |||
1903 | +++ include/shared/mir/geometry/length.h 2014-04-07 13:29:13 +0000 | |||
1904 | @@ -0,0 +1,102 @@ | |||
1905 | 1 | /* | ||
1906 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1907 | 3 | * | ||
1908 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1909 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
1910 | 6 | * as published by the Free Software Foundation. | ||
1911 | 7 | * | ||
1912 | 8 | * This program is distributed in the hope that it will be useful, | ||
1913 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1914 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1915 | 11 | * GNU Lesser General Public License for more details. | ||
1916 | 12 | * | ||
1917 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1918 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1919 | 15 | * | ||
1920 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
1921 | 17 | */ | ||
1922 | 18 | |||
1923 | 19 | #ifndef MIR_GEOMETRY_LENGTH_H_ | ||
1924 | 20 | #define MIR_GEOMETRY_LENGTH_H_ | ||
1925 | 21 | |||
1926 | 22 | namespace mir | ||
1927 | 23 | { | ||
1928 | 24 | namespace geometry | ||
1929 | 25 | { | ||
1930 | 26 | |||
1931 | 27 | /// Length represents a physical length in the real world. The number of pixels | ||
1932 | 28 | /// this equates to can then be calculated based on a given DPI. | ||
1933 | 29 | class Length | ||
1934 | 30 | { | ||
1935 | 31 | public: | ||
1936 | 32 | enum Units | ||
1937 | 33 | { | ||
1938 | 34 | micrometres = 1, | ||
1939 | 35 | millimetres = 1000, | ||
1940 | 36 | centimetres = 10000, | ||
1941 | 37 | inches = 25400 | ||
1942 | 38 | }; | ||
1943 | 39 | |||
1944 | 40 | Length() : magnitude(0) {} | ||
1945 | 41 | Length(Length const&) = default; | ||
1946 | 42 | Length& operator=(Length const&) = default; | ||
1947 | 43 | Length(float mag, Units units) : magnitude(mag * units) {} | ||
1948 | 44 | |||
1949 | 45 | float as(Units units) const | ||
1950 | 46 | { | ||
1951 | 47 | return static_cast<float>(magnitude) / units; | ||
1952 | 48 | } | ||
1953 | 49 | |||
1954 | 50 | float as_pixels(float dpi) const | ||
1955 | 51 | { | ||
1956 | 52 | return as(inches) * dpi; | ||
1957 | 53 | } | ||
1958 | 54 | |||
1959 | 55 | bool operator==(Length const& rhs) const | ||
1960 | 56 | { | ||
1961 | 57 | return magnitude == rhs.magnitude; | ||
1962 | 58 | } | ||
1963 | 59 | |||
1964 | 60 | bool operator!=(Length const& rhs) const | ||
1965 | 61 | { | ||
1966 | 62 | return magnitude != rhs.magnitude; | ||
1967 | 63 | } | ||
1968 | 64 | |||
1969 | 65 | private: | ||
1970 | 66 | float magnitude; | ||
1971 | 67 | }; | ||
1972 | 68 | |||
1973 | 69 | inline Length operator"" _mm(long double mag) | ||
1974 | 70 | { | ||
1975 | 71 | return Length(mag, Length::millimetres); | ||
1976 | 72 | } | ||
1977 | 73 | |||
1978 | 74 | inline Length operator"" _mm(unsigned long long mag) | ||
1979 | 75 | { | ||
1980 | 76 | return Length(mag, Length::millimetres); | ||
1981 | 77 | } | ||
1982 | 78 | |||
1983 | 79 | inline Length operator"" _cm(long double mag) | ||
1984 | 80 | { | ||
1985 | 81 | return Length(mag, Length::centimetres); | ||
1986 | 82 | } | ||
1987 | 83 | |||
1988 | 84 | inline Length operator"" _cm(unsigned long long mag) | ||
1989 | 85 | { | ||
1990 | 86 | return Length(mag, Length::centimetres); | ||
1991 | 87 | } | ||
1992 | 88 | |||
1993 | 89 | inline Length operator"" _in(long double mag) | ||
1994 | 90 | { | ||
1995 | 91 | return Length(mag, Length::inches); | ||
1996 | 92 | } | ||
1997 | 93 | |||
1998 | 94 | inline Length operator"" _in(unsigned long long mag) | ||
1999 | 95 | { | ||
2000 | 96 | return Length(mag, Length::inches); | ||
2001 | 97 | } | ||
2002 | 98 | |||
2003 | 99 | } // namespace geometry | ||
2004 | 100 | } // namespace mir | ||
2005 | 101 | |||
2006 | 102 | #endif // MIR_GEOMETRY_LENGTH_H_ | ||
2007 | 0 | 103 | ||
2008 | === modified file 'include/test/mir_test_doubles/fake_renderable.h' | |||
2009 | --- include/test/mir_test_doubles/fake_renderable.h 2014-03-17 07:35:22 +0000 | |||
2010 | +++ include/test/mir_test_doubles/fake_renderable.h 2014-04-07 13:29:13 +0000 | |||
2011 | @@ -42,7 +42,7 @@ | |||
2012 | 42 | : rect{{x, y}, {width, height}}, | 42 | : rect{{x, y}, {width, height}}, |
2013 | 43 | opacity(opacity), | 43 | opacity(opacity), |
2014 | 44 | rectangular(rectangular), | 44 | rectangular(rectangular), |
2016 | 45 | visible(visible), | 45 | visible_(visible), |
2017 | 46 | posted(posted) | 46 | posted(posted) |
2018 | 47 | { | 47 | { |
2019 | 48 | } | 48 | } |
2020 | @@ -57,9 +57,9 @@ | |||
2021 | 57 | return glm::mat4(); | 57 | return glm::mat4(); |
2022 | 58 | } | 58 | } |
2023 | 59 | 59 | ||
2025 | 60 | bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override | 60 | bool visible() const override |
2026 | 61 | { | 61 | { |
2028 | 62 | return visible && posted && rect.overlaps(r); | 62 | return visible_ && posted; |
2029 | 63 | } | 63 | } |
2030 | 64 | 64 | ||
2031 | 65 | bool shaped() const override | 65 | bool shaped() const override |
2032 | @@ -72,7 +72,7 @@ | |||
2033 | 72 | buf = b; | 72 | buf = b; |
2034 | 73 | } | 73 | } |
2035 | 74 | 74 | ||
2037 | 75 | std::shared_ptr<graphics::Buffer> buffer(unsigned long) const override | 75 | std::shared_ptr<graphics::Buffer> buffer(void const*) const override |
2038 | 76 | { | 76 | { |
2039 | 77 | return buf; | 77 | return buf; |
2040 | 78 | } | 78 | } |
2041 | @@ -97,7 +97,7 @@ | |||
2042 | 97 | mir::geometry::Rectangle rect; | 97 | mir::geometry::Rectangle rect; |
2043 | 98 | float opacity; | 98 | float opacity; |
2044 | 99 | bool rectangular; | 99 | bool rectangular; |
2046 | 100 | bool visible; | 100 | bool visible_; |
2047 | 101 | bool posted; | 101 | bool posted; |
2048 | 102 | }; | 102 | }; |
2049 | 103 | 103 | ||
2050 | 104 | 104 | ||
2051 | === modified file 'include/test/mir_test_doubles/mock_buffer_bundle.h' | |||
2052 | --- include/test/mir_test_doubles/mock_buffer_bundle.h 2014-03-07 03:15:55 +0000 | |||
2053 | +++ include/test/mir_test_doubles/mock_buffer_bundle.h 2014-04-07 13:29:13 +0000 | |||
2054 | @@ -39,7 +39,7 @@ | |||
2055 | 39 | 39 | ||
2056 | 40 | MOCK_METHOD1(client_acquire, void(std::function<void(graphics::Buffer*)>)); | 40 | MOCK_METHOD1(client_acquire, void(std::function<void(graphics::Buffer*)>)); |
2057 | 41 | MOCK_METHOD1(client_release, void(graphics::Buffer*)); | 41 | MOCK_METHOD1(client_release, void(graphics::Buffer*)); |
2059 | 42 | MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(unsigned long)); | 42 | MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(void const*)); |
2060 | 43 | MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&)); | 43 | MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&)); |
2061 | 44 | MOCK_METHOD0(snapshot_acquire, std::shared_ptr<graphics::Buffer>()); | 44 | MOCK_METHOD0(snapshot_acquire, std::shared_ptr<graphics::Buffer>()); |
2062 | 45 | MOCK_METHOD1(snapshot_release, void(std::shared_ptr<graphics::Buffer> const&)); | 45 | MOCK_METHOD1(snapshot_release, void(std::shared_ptr<graphics::Buffer> const&)); |
2063 | 46 | 46 | ||
2064 | === modified file 'include/test/mir_test_doubles/mock_buffer_stream.h' | |||
2065 | --- include/test/mir_test_doubles/mock_buffer_stream.h 2014-03-07 03:15:55 +0000 | |||
2066 | +++ include/test/mir_test_doubles/mock_buffer_stream.h 2014-04-07 13:29:13 +0000 | |||
2067 | @@ -33,7 +33,7 @@ | |||
2068 | 33 | { | 33 | { |
2069 | 34 | MOCK_METHOD2(swap_client_buffers, void(graphics::Buffer*, std::function<void(graphics::Buffer*)> completee)); | 34 | MOCK_METHOD2(swap_client_buffers, void(graphics::Buffer*, std::function<void(graphics::Buffer*)> completee)); |
2070 | 35 | MOCK_METHOD1(lock_compositor_buffer, | 35 | MOCK_METHOD1(lock_compositor_buffer, |
2072 | 36 | std::shared_ptr<graphics::Buffer>(unsigned long)); | 36 | std::shared_ptr<graphics::Buffer>(void const*)); |
2073 | 37 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); | 37 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); |
2074 | 38 | 38 | ||
2075 | 39 | MOCK_METHOD0(get_stream_pixel_format, MirPixelFormat()); | 39 | MOCK_METHOD0(get_stream_pixel_format, MirPixelFormat()); |
2076 | 40 | 40 | ||
2077 | === modified file 'include/test/mir_test_doubles/mock_display_buffer.h' | |||
2078 | --- include/test/mir_test_doubles/mock_display_buffer.h 2014-03-06 06:05:17 +0000 | |||
2079 | +++ include/test/mir_test_doubles/mock_display_buffer.h 2014-04-07 13:29:13 +0000 | |||
2080 | @@ -46,7 +46,7 @@ | |||
2081 | 46 | MOCK_METHOD0(release_current, void()); | 46 | MOCK_METHOD0(release_current, void()); |
2082 | 47 | MOCK_METHOD0(post_update, void()); | 47 | MOCK_METHOD0(post_update, void()); |
2083 | 48 | MOCK_CONST_METHOD0(can_bypass, bool()); | 48 | MOCK_CONST_METHOD0(can_bypass, bool()); |
2085 | 49 | MOCK_METHOD2(render_and_post_update, void(std::list<std::shared_ptr<graphics::Renderable>> const&, | 49 | MOCK_METHOD2(render_and_post_update, void(graphics::RenderableList const&, |
2086 | 50 | std::function<void(graphics::Renderable const&)> const&)); | 50 | std::function<void(graphics::Renderable const&)> const&)); |
2087 | 51 | MOCK_CONST_METHOD0(orientation, MirOrientation()); | 51 | MOCK_CONST_METHOD0(orientation, MirOrientation()); |
2088 | 52 | }; | 52 | }; |
2089 | 53 | 53 | ||
2090 | === modified file 'include/test/mir_test_doubles/mock_display_changer.h' | |||
2091 | --- include/test/mir_test_doubles/mock_display_changer.h 2013-09-17 20:03:16 +0000 | |||
2092 | +++ include/test/mir_test_doubles/mock_display_changer.h 2014-04-07 13:29:13 +0000 | |||
2093 | @@ -35,7 +35,6 @@ | |||
2094 | 35 | MOCK_METHOD0(active_configuration, std::shared_ptr<graphics::DisplayConfiguration>()); | 35 | MOCK_METHOD0(active_configuration, std::shared_ptr<graphics::DisplayConfiguration>()); |
2095 | 36 | MOCK_METHOD2(configure, | 36 | MOCK_METHOD2(configure, |
2096 | 37 | void(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&)); | 37 | void(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&)); |
2097 | 38 | MOCK_METHOD1(ensure_display_powered, void(std::shared_ptr<frontend::Session> const&)); | ||
2098 | 39 | }; | 38 | }; |
2099 | 40 | 39 | ||
2100 | 41 | } | 40 | } |
2101 | 42 | 41 | ||
2102 | === modified file 'include/test/mir_test_doubles/mock_display_device.h' | |||
2103 | --- include/test/mir_test_doubles/mock_display_device.h 2014-03-11 13:44:57 +0000 | |||
2104 | +++ include/test/mir_test_doubles/mock_display_device.h 2014-04-07 13:29:13 +0000 | |||
2105 | @@ -38,7 +38,7 @@ | |||
2106 | 38 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); | 38 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); |
2107 | 39 | MOCK_METHOD3(render_gl_and_overlays, void( | 39 | MOCK_METHOD3(render_gl_and_overlays, void( |
2108 | 40 | graphics::android::SwappingGLContext const&, | 40 | graphics::android::SwappingGLContext const&, |
2110 | 41 | std::list<std::shared_ptr<graphics::Renderable>> const&, | 41 | graphics::RenderableList const&, |
2111 | 42 | std::function<void(graphics::Renderable const&)> const&)); | 42 | std::function<void(graphics::Renderable const&)> const&)); |
2112 | 43 | MOCK_METHOD1(post, void(graphics::Buffer const&)); | 43 | MOCK_METHOD1(post, void(graphics::Buffer const&)); |
2113 | 44 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); | 44 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); |
2114 | 45 | 45 | ||
2115 | === modified file 'include/test/mir_test_doubles/mock_egl.h' | |||
2116 | --- include/test/mir_test_doubles/mock_egl.h 2014-03-06 06:05:17 +0000 | |||
2117 | +++ include/test/mir_test_doubles/mock_egl.h 2014-04-07 13:29:13 +0000 | |||
2118 | @@ -53,6 +53,33 @@ | |||
2119 | 53 | return false; | 53 | return false; |
2120 | 54 | } | 54 | } |
2121 | 55 | 55 | ||
2122 | 56 | MATCHER_P2(EGLConfigContainsAttrib, attrib, value, "") | ||
2123 | 57 | { | ||
2124 | 58 | bool attrib_position = true; | ||
2125 | 59 | bool attrib_found = false; | ||
2126 | 60 | |||
2127 | 61 | while (!attrib_position || *arg != EGL_NONE) | ||
2128 | 62 | { | ||
2129 | 63 | if (attrib_position && *arg == attrib) | ||
2130 | 64 | { | ||
2131 | 65 | attrib_found = true; | ||
2132 | 66 | } | ||
2133 | 67 | else if (!attrib_position) | ||
2134 | 68 | { | ||
2135 | 69 | if (attrib_found && *arg == value) | ||
2136 | 70 | { | ||
2137 | 71 | return true; | ||
2138 | 72 | } | ||
2139 | 73 | |||
2140 | 74 | attrib_found = false; | ||
2141 | 75 | } | ||
2142 | 76 | attrib_position = !attrib_position; | ||
2143 | 77 | ++arg; | ||
2144 | 78 | } | ||
2145 | 79 | |||
2146 | 80 | return false; | ||
2147 | 81 | } | ||
2148 | 82 | |||
2149 | 56 | class MockEGL | 83 | class MockEGL |
2150 | 57 | { | 84 | { |
2151 | 58 | public: | 85 | public: |
2152 | 59 | 86 | ||
2153 | === added file 'include/test/mir_test_doubles/mock_gl_config.h' | |||
2154 | --- include/test/mir_test_doubles/mock_gl_config.h 1970-01-01 00:00:00 +0000 | |||
2155 | +++ include/test/mir_test_doubles/mock_gl_config.h 2014-04-07 13:29:13 +0000 | |||
2156 | @@ -0,0 +1,43 @@ | |||
2157 | 1 | /* | ||
2158 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2159 | 3 | * | ||
2160 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2161 | 5 | * under the terms of the GNU General Public License version 3, | ||
2162 | 6 | * as published by the Free Software Foundation. | ||
2163 | 7 | * | ||
2164 | 8 | * This program is distributed in the hope that it will be useful, | ||
2165 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2166 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2167 | 11 | * GNU General Public License for more details. | ||
2168 | 12 | * | ||
2169 | 13 | * You should have received a copy of the GNU General Public License | ||
2170 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2171 | 15 | * | ||
2172 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
2173 | 17 | */ | ||
2174 | 18 | |||
2175 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_GL_CONFIG_H_ | ||
2176 | 20 | #define MIR_TEST_DOUBLES_MOCK_GL_CONFIG_H_ | ||
2177 | 21 | |||
2178 | 22 | #include "mir/graphics/gl_config.h" | ||
2179 | 23 | |||
2180 | 24 | #include <gmock/gmock.h> | ||
2181 | 25 | |||
2182 | 26 | namespace mir | ||
2183 | 27 | { | ||
2184 | 28 | namespace test | ||
2185 | 29 | { | ||
2186 | 30 | namespace doubles | ||
2187 | 31 | { | ||
2188 | 32 | |||
2189 | 33 | struct MockGLConfig : public graphics::GLConfig | ||
2190 | 34 | { | ||
2191 | 35 | MOCK_CONST_METHOD0(depth_buffer_bits, int()); | ||
2192 | 36 | MOCK_CONST_METHOD0(stencil_buffer_bits, int()); | ||
2193 | 37 | }; | ||
2194 | 38 | |||
2195 | 39 | } | ||
2196 | 40 | } | ||
2197 | 41 | } | ||
2198 | 42 | |||
2199 | 43 | #endif /* MIR_TEST_DOUBLES_MOCK_GL_CONFIG_H_ */ | ||
2200 | 0 | 44 | ||
2201 | === modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h' | |||
2202 | --- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-03-06 06:05:17 +0000 | |||
2203 | +++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-04-07 13:29:13 +0000 | |||
2204 | @@ -21,8 +21,6 @@ | |||
2205 | 21 | 21 | ||
2206 | 22 | #include <hardware/hwcomposer.h> | 22 | #include <hardware/hwcomposer.h> |
2207 | 23 | #include <gmock/gmock.h> | 23 | #include <gmock/gmock.h> |
2208 | 24 | #include <vector> | ||
2209 | 25 | #include <memory> | ||
2210 | 26 | 24 | ||
2211 | 27 | namespace mir | 25 | namespace mir |
2212 | 28 | { | 26 | { |
2213 | @@ -37,16 +35,6 @@ | |||
2214 | 37 | MockHWCComposerDevice1() | 35 | MockHWCComposerDevice1() |
2215 | 38 | { | 36 | { |
2216 | 39 | using namespace testing; | 37 | using namespace testing; |
2217 | 40 | |||
2218 | 41 | primary_prepare = false; | ||
2219 | 42 | primary_set = false; | ||
2220 | 43 | external_prepare = false; | ||
2221 | 44 | external_set = false; | ||
2222 | 45 | virtual_prepare = false; | ||
2223 | 46 | virtual_set = false; | ||
2224 | 47 | fb_fence = -1; | ||
2225 | 48 | retire_fence = -1; | ||
2226 | 49 | |||
2227 | 50 | common.version = HWC_DEVICE_API_VERSION_1_1; | 38 | common.version = HWC_DEVICE_API_VERSION_1_1; |
2228 | 51 | 39 | ||
2229 | 52 | registerProcs = hook_registerProcs; | 40 | registerProcs = hook_registerProcs; |
2230 | @@ -56,91 +44,6 @@ | |||
2231 | 56 | blank = hook_blank; | 44 | blank = hook_blank; |
2232 | 57 | getDisplayConfigs = hook_getDisplayConfigs; | 45 | getDisplayConfigs = hook_getDisplayConfigs; |
2233 | 58 | getDisplayAttributes = hook_getDisplayAttributes; | 46 | getDisplayAttributes = hook_getDisplayAttributes; |
2234 | 59 | |||
2235 | 60 | ON_CALL(*this, set_interface(_,_,_)) | ||
2236 | 61 | .WillByDefault(Invoke(this, &MockHWCComposerDevice1::save_last_set_arguments)); | ||
2237 | 62 | ON_CALL(*this, prepare_interface(_,_,_)) | ||
2238 | 63 | .WillByDefault(Invoke(this, &MockHWCComposerDevice1::save_last_prepare_arguments)); | ||
2239 | 64 | } | ||
2240 | 65 | |||
2241 | 66 | int save_args(hwc_display_contents_1_t* out, hwc_display_contents_1_t** in) | ||
2242 | 67 | { | ||
2243 | 68 | if ((nullptr == in) || (nullptr == *in)) | ||
2244 | 69 | return -1; | ||
2245 | 70 | |||
2246 | 71 | hwc_display_contents_1_t* primary_display = *in; | ||
2247 | 72 | memcpy(out, primary_display, sizeof(hwc_display_contents_1_t)); | ||
2248 | 73 | return 0; | ||
2249 | 74 | } | ||
2250 | 75 | |||
2251 | 76 | void hwc_set_return_fence(int fence) | ||
2252 | 77 | { | ||
2253 | 78 | fb_fence = fence; | ||
2254 | 79 | } | ||
2255 | 80 | |||
2256 | 81 | void hwc_set_retire_fence(int fence) | ||
2257 | 82 | { | ||
2258 | 83 | retire_fence = fence; | ||
2259 | 84 | } | ||
2260 | 85 | |||
2261 | 86 | int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t size, hwc_display_contents_1_t** displays) | ||
2262 | 87 | { | ||
2263 | 88 | if ((size == 0) || (!displays)) | ||
2264 | 89 | return -1; | ||
2265 | 90 | |||
2266 | 91 | switch (size) | ||
2267 | 92 | { | ||
2268 | 93 | case 3: | ||
2269 | 94 | virtual_prepare = (!!displays[2]); | ||
2270 | 95 | case 2: | ||
2271 | 96 | external_prepare = (!!displays[1]); | ||
2272 | 97 | case 1: | ||
2273 | 98 | primary_prepare = (!!displays[0]); | ||
2274 | 99 | for(auto i = 0u; i < displays[0]->numHwLayers; i++) | ||
2275 | 100 | { | ||
2276 | 101 | prepare_layerlist.push_back(displays[0]->hwLayers[i]); | ||
2277 | 102 | prepare_layerlist.back().visibleRegionScreen = {0, nullptr}; | ||
2278 | 103 | } | ||
2279 | 104 | save_args(&display0_prepare_content, displays); | ||
2280 | 105 | default: | ||
2281 | 106 | break; | ||
2282 | 107 | } | ||
2283 | 108 | return 0; | ||
2284 | 109 | } | ||
2285 | 110 | |||
2286 | 111 | int save_last_set_arguments( | ||
2287 | 112 | struct hwc_composer_device_1 *, size_t size, hwc_display_contents_1_t** displays) | ||
2288 | 113 | { | ||
2289 | 114 | |||
2290 | 115 | if ((size == 0) || (!displays)) | ||
2291 | 116 | return -1; | ||
2292 | 117 | |||
2293 | 118 | switch (size) | ||
2294 | 119 | { | ||
2295 | 120 | case 3: | ||
2296 | 121 | virtual_set = (!!displays[2]); | ||
2297 | 122 | case 2: | ||
2298 | 123 | external_set = (!!displays[1]); | ||
2299 | 124 | case 1: | ||
2300 | 125 | primary_set = (!!displays[0]); | ||
2301 | 126 | for(auto i = 0u; i < displays[0]->numHwLayers; i++) | ||
2302 | 127 | { | ||
2303 | 128 | set_layerlist.push_back(displays[0]->hwLayers[i]); | ||
2304 | 129 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; | ||
2305 | 130 | } | ||
2306 | 131 | |||
2307 | 132 | save_args(&display0_set_content, displays); | ||
2308 | 133 | |||
2309 | 134 | if (displays[0]->numHwLayers >= 2) | ||
2310 | 135 | { | ||
2311 | 136 | displays[0]->hwLayers[1].releaseFenceFd = fb_fence; | ||
2312 | 137 | displays[0]->retireFenceFd = retire_fence; | ||
2313 | 138 | } | ||
2314 | 139 | |||
2315 | 140 | default: | ||
2316 | 141 | break; | ||
2317 | 142 | } | ||
2318 | 143 | return 0; | ||
2319 | 144 | } | 47 | } |
2320 | 145 | 48 | ||
2321 | 146 | static void hook_registerProcs(struct hwc_composer_device_1* mock_hwc, hwc_procs_t const* procs) | 49 | static void hook_registerProcs(struct hwc_composer_device_1* mock_hwc, hwc_procs_t const* procs) |
2322 | @@ -188,14 +91,6 @@ | |||
2323 | 188 | MOCK_METHOD3(blank_interface, int(struct hwc_composer_device_1 *, int, int)); | 91 | MOCK_METHOD3(blank_interface, int(struct hwc_composer_device_1 *, int, int)); |
2324 | 189 | MOCK_METHOD4(getDisplayConfigs_interface, int(struct hwc_composer_device_1*, int, uint32_t*, size_t*)); | 92 | MOCK_METHOD4(getDisplayConfigs_interface, int(struct hwc_composer_device_1*, int, uint32_t*, size_t*)); |
2325 | 190 | MOCK_METHOD5(getDisplayAttributes_interface, int(struct hwc_composer_device_1*, int, uint32_t, const uint32_t*, int32_t*)); | 93 | MOCK_METHOD5(getDisplayAttributes_interface, int(struct hwc_composer_device_1*, int, uint32_t, const uint32_t*, int32_t*)); |
2326 | 191 | |||
2327 | 192 | bool primary_prepare, primary_set, external_prepare, external_set, virtual_prepare, virtual_set; | ||
2328 | 193 | hwc_display_contents_1_t display0_set_content; | ||
2329 | 194 | std::vector<hwc_layer_1> set_layerlist; | ||
2330 | 195 | std::vector<hwc_layer_1> prepare_layerlist; | ||
2331 | 196 | hwc_display_contents_1_t display0_prepare_content; | ||
2332 | 197 | int fb_fence; | ||
2333 | 198 | int retire_fence; | ||
2334 | 199 | }; | 94 | }; |
2335 | 200 | 95 | ||
2336 | 201 | } | 96 | } |
2337 | 202 | 97 | ||
2338 | === added file 'include/test/mir_test_doubles/mock_hwc_device_wrapper.h' | |||
2339 | --- include/test/mir_test_doubles/mock_hwc_device_wrapper.h 1970-01-01 00:00:00 +0000 | |||
2340 | +++ include/test/mir_test_doubles/mock_hwc_device_wrapper.h 2014-04-07 13:29:13 +0000 | |||
2341 | @@ -0,0 +1,42 @@ | |||
2342 | 1 | /* | ||
2343 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2344 | 3 | * | ||
2345 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2346 | 5 | * under the terms of the GNU General Public License version 3, | ||
2347 | 6 | * as published by the Free Software Foundation. | ||
2348 | 7 | * | ||
2349 | 8 | * This program is distributed in the hope that it will be useful, | ||
2350 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2351 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2352 | 11 | * GNU General Public License for more details. | ||
2353 | 12 | * | ||
2354 | 13 | * You should have received a copy of the GNU General Public License | ||
2355 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2356 | 15 | * | ||
2357 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
2358 | 17 | */ | ||
2359 | 18 | |||
2360 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_HWC_DEVICE_WRAPPER_H_ | ||
2361 | 20 | #define MIR_TEST_DOUBLES_MOCK_HWC_DEVICE_WRAPPER_H_ | ||
2362 | 21 | |||
2363 | 22 | #include "src/platform/graphics/android/hwc_wrapper.h" | ||
2364 | 23 | |||
2365 | 24 | #include <gmock/gmock.h> | ||
2366 | 25 | |||
2367 | 26 | namespace mir | ||
2368 | 27 | { | ||
2369 | 28 | namespace test | ||
2370 | 29 | { | ||
2371 | 30 | namespace doubles | ||
2372 | 31 | { | ||
2373 | 32 | |||
2374 | 33 | struct MockHWCDeviceWrapper : public graphics::android::HwcWrapper | ||
2375 | 34 | { | ||
2376 | 35 | MOCK_CONST_METHOD1(prepare, void(hwc_display_contents_1_t&)); | ||
2377 | 36 | MOCK_CONST_METHOD1(set, void(hwc_display_contents_1_t&)); | ||
2378 | 37 | }; | ||
2379 | 38 | |||
2380 | 39 | } | ||
2381 | 40 | } | ||
2382 | 41 | } | ||
2383 | 42 | #endif /* MIR_TEST_DOUBLES_MOCK_HWC_DEVICE_WRAPPER_H_ */ | ||
2384 | 0 | 43 | ||
2385 | === modified file 'include/test/mir_test_doubles/mock_input_surface.h' | |||
2386 | --- include/test/mir_test_doubles/mock_input_surface.h 2014-03-06 06:05:17 +0000 | |||
2387 | +++ include/test/mir_test_doubles/mock_input_surface.h 2014-04-07 13:29:13 +0000 | |||
2388 | @@ -43,12 +43,12 @@ | |||
2389 | 43 | Return(geometry::Size{})); | 43 | Return(geometry::Size{})); |
2390 | 44 | static std::string n; | 44 | static std::string n; |
2391 | 45 | ON_CALL(*this, name()) | 45 | ON_CALL(*this, name()) |
2393 | 46 | .WillByDefault(testing::ReturnRef(n)); | 46 | .WillByDefault(testing::Return(n)); |
2394 | 47 | } | 47 | } |
2395 | 48 | ~MockInputSurface() noexcept {} | 48 | ~MockInputSurface() noexcept {} |
2396 | 49 | MOCK_CONST_METHOD0(top_left, geometry::Point()); | 49 | MOCK_CONST_METHOD0(top_left, geometry::Point()); |
2397 | 50 | MOCK_CONST_METHOD0(size, geometry::Size()); | 50 | MOCK_CONST_METHOD0(size, geometry::Size()); |
2399 | 51 | MOCK_CONST_METHOD0(name, std::string const&()); | 51 | MOCK_CONST_METHOD0(name, std::string()); |
2400 | 52 | MOCK_CONST_METHOD1(contains, bool(geometry::Point const&)); | 52 | MOCK_CONST_METHOD1(contains, bool(geometry::Point const&)); |
2401 | 53 | }; | 53 | }; |
2402 | 54 | 54 | ||
2403 | 55 | 55 | ||
2404 | === modified file 'include/test/mir_test_doubles/mock_renderable.h' | |||
2405 | --- include/test/mir_test_doubles/mock_renderable.h 2014-03-17 07:35:22 +0000 | |||
2406 | +++ include/test/mir_test_doubles/mock_renderable.h 2014-04-07 13:29:13 +0000 | |||
2407 | @@ -37,15 +37,24 @@ | |||
2408 | 37 | .WillByDefault(testing::Return(geometry::Rectangle{{},{}})); | 37 | .WillByDefault(testing::Return(geometry::Rectangle{{},{}})); |
2409 | 38 | ON_CALL(*this, buffer(testing::_)) | 38 | ON_CALL(*this, buffer(testing::_)) |
2410 | 39 | .WillByDefault(testing::Return(std::make_shared<StubBuffer>())); | 39 | .WillByDefault(testing::Return(std::make_shared<StubBuffer>())); |
2411 | 40 | ON_CALL(*this, buffers_ready_for_compositor()) | ||
2412 | 41 | .WillByDefault(testing::Return(1)); | ||
2413 | 42 | ON_CALL(*this, alpha()) | ||
2414 | 43 | .WillByDefault(testing::Return(1.0f)); | ||
2415 | 44 | ON_CALL(*this, transformation()) | ||
2416 | 45 | .WillByDefault(testing::Return(glm::mat4{})); | ||
2417 | 46 | ON_CALL(*this, visible()) | ||
2418 | 47 | .WillByDefault(testing::Return(true)); | ||
2419 | 40 | } | 48 | } |
2421 | 41 | MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(unsigned long)); | 49 | |
2422 | 50 | MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(void const*)); | ||
2423 | 42 | MOCK_CONST_METHOD0(alpha_enabled, bool()); | 51 | MOCK_CONST_METHOD0(alpha_enabled, bool()); |
2424 | 43 | MOCK_CONST_METHOD0(screen_position, geometry::Rectangle()); | 52 | MOCK_CONST_METHOD0(screen_position, geometry::Rectangle()); |
2425 | 44 | MOCK_CONST_METHOD0(alpha, float()); | 53 | MOCK_CONST_METHOD0(alpha, float()); |
2426 | 45 | MOCK_CONST_METHOD0(transformation, glm::mat4()); | 54 | MOCK_CONST_METHOD0(transformation, glm::mat4()); |
2428 | 46 | MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const& rect)); | 55 | MOCK_CONST_METHOD0(visible, bool()); |
2429 | 47 | MOCK_CONST_METHOD0(shaped, bool()); | 56 | MOCK_CONST_METHOD0(shaped, bool()); |
2431 | 48 | int buffers_ready_for_compositor() const override { return 1; } | 57 | MOCK_CONST_METHOD0(buffers_ready_for_compositor, int()); |
2432 | 49 | }; | 58 | }; |
2433 | 50 | } | 59 | } |
2434 | 51 | } | 60 | } |
2435 | 52 | 61 | ||
2436 | === modified file 'include/test/mir_test_doubles/mock_scene.h' | |||
2437 | --- include/test/mir_test_doubles/mock_scene.h 2014-03-13 09:22:13 +0000 | |||
2438 | +++ include/test/mir_test_doubles/mock_scene.h 2014-04-07 13:29:13 +0000 | |||
2439 | @@ -32,10 +32,14 @@ | |||
2440 | 32 | class MockScene : public compositor::Scene | 32 | class MockScene : public compositor::Scene |
2441 | 33 | { | 33 | { |
2442 | 34 | public: | 34 | public: |
2443 | 35 | MockScene() | ||
2444 | 36 | { | ||
2445 | 37 | ON_CALL(*this, generate_renderable_list()) | ||
2446 | 38 | .WillByDefault(testing::Return(graphics::RenderableList{})); | ||
2447 | 39 | } | ||
2448 | 40 | MOCK_CONST_METHOD0(generate_renderable_list, graphics::RenderableList()); | ||
2449 | 35 | MOCK_METHOD2(for_each_if, void(compositor::FilterForScene&, | 41 | MOCK_METHOD2(for_each_if, void(compositor::FilterForScene&, |
2450 | 36 | compositor::OperatorForScene&)); | 42 | compositor::OperatorForScene&)); |
2451 | 37 | MOCK_METHOD2(reverse_for_each_if, void(compositor::FilterForScene&, | ||
2452 | 38 | compositor::OperatorForScene&)); | ||
2453 | 39 | MOCK_METHOD1(set_change_callback, void(std::function<void()> const&)); | 43 | MOCK_METHOD1(set_change_callback, void(std::function<void()> const&)); |
2454 | 40 | MOCK_METHOD0(lock, void()); | 44 | MOCK_METHOD0(lock, void()); |
2455 | 41 | MOCK_METHOD0(unlock, void()); | 45 | MOCK_METHOD0(unlock, void()); |
2456 | 42 | 46 | ||
2457 | === modified file 'include/test/mir_test_doubles/mock_surface.h' | |||
2458 | --- include/test/mir_test_doubles/mock_surface.h 2014-03-06 06:05:17 +0000 | |||
2459 | +++ include/test/mir_test_doubles/mock_surface.h 2014-04-07 13:29:13 +0000 | |||
2460 | @@ -1,5 +1,5 @@ | |||
2461 | 1 | /* | 1 | /* |
2463 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
2464 | 3 | * | 3 | * |
2465 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
2466 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
2467 | @@ -19,16 +19,11 @@ | |||
2468 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_H_ | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_H_ |
2469 | 20 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_H_ | 20 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_H_ |
2470 | 21 | 21 | ||
2476 | 22 | #include "src/server/scene/surface_impl.h" | 22 | #include "src/server/scene/basic_surface.h" |
2477 | 23 | 23 | #include "src/server/report/null_report_factory.h" | |
2473 | 24 | #include "mir/shell/surface_creation_parameters.h" | ||
2474 | 25 | #include "null_event_sink.h" | ||
2475 | 26 | #include "null_surface_configurator.h" | ||
2478 | 27 | 24 | ||
2479 | 28 | #include <gmock/gmock.h> | 25 | #include <gmock/gmock.h> |
2480 | 29 | 26 | ||
2481 | 30 | #include <memory> | ||
2482 | 31 | |||
2483 | 32 | namespace mir | 27 | namespace mir |
2484 | 33 | { | 28 | { |
2485 | 34 | namespace test | 29 | namespace test |
2486 | @@ -36,10 +31,17 @@ | |||
2487 | 36 | namespace doubles | 31 | namespace doubles |
2488 | 37 | { | 32 | { |
2489 | 38 | 33 | ||
2491 | 39 | struct MockSurface : public scene::SurfaceImpl | 34 | struct MockSurface : public scene::BasicSurface |
2492 | 40 | { | 35 | { |
2495 | 41 | MockSurface(std::shared_ptr<scene::SurfaceBuilder> const& builder) : | 36 | MockSurface() : |
2496 | 42 | scene::SurfaceImpl(builder, std::make_shared<NullSurfaceConfigurator>(), shell::a_surface(), frontend::SurfaceId{}, std::make_shared<NullEventSink>()) | 37 | scene::BasicSurface( |
2497 | 38 | {}, | ||
2498 | 39 | {{},{}}, | ||
2499 | 40 | true, | ||
2500 | 41 | {}, | ||
2501 | 42 | {}, | ||
2502 | 43 | {}, | ||
2503 | 44 | mir::report::null_scene_report()) | ||
2504 | 43 | { | 45 | { |
2505 | 44 | } | 46 | } |
2506 | 45 | 47 | ||
2507 | @@ -53,7 +55,6 @@ | |||
2508 | 53 | MOCK_METHOD0(force_requests_to_complete, void()); | 55 | MOCK_METHOD0(force_requests_to_complete, void()); |
2509 | 54 | MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>()); | 56 | MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>()); |
2510 | 55 | 57 | ||
2511 | 56 | MOCK_CONST_METHOD0(name, std::string()); | ||
2512 | 57 | MOCK_CONST_METHOD0(size, geometry::Size()); | 58 | MOCK_CONST_METHOD0(size, geometry::Size()); |
2513 | 58 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); | 59 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); |
2514 | 59 | 60 | ||
2515 | @@ -62,6 +63,7 @@ | |||
2516 | 62 | 63 | ||
2517 | 63 | MOCK_METHOD2(configure, int(MirSurfaceAttrib, int)); | 64 | MOCK_METHOD2(configure, int(MirSurfaceAttrib, int)); |
2518 | 64 | MOCK_METHOD1(take_input_focus, void(std::shared_ptr<shell::InputTargeter> const&)); | 65 | MOCK_METHOD1(take_input_focus, void(std::shared_ptr<shell::InputTargeter> const&)); |
2519 | 66 | MOCK_METHOD1(add_observer, void(std::shared_ptr<scene::SurfaceObserver> const&)); | ||
2520 | 65 | }; | 67 | }; |
2521 | 66 | 68 | ||
2522 | 67 | } | 69 | } |
2523 | 68 | 70 | ||
2524 | === modified file 'include/test/mir_test_doubles/mock_surface_configurator.h' | |||
2525 | --- include/test/mir_test_doubles/mock_surface_configurator.h 2013-07-31 23:09:53 +0000 | |||
2526 | +++ include/test/mir_test_doubles/mock_surface_configurator.h 2014-04-07 13:29:13 +0000 | |||
2527 | @@ -19,7 +19,7 @@ | |||
2528 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ |
2529 | 20 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ | 20 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ |
2530 | 21 | 21 | ||
2532 | 22 | #include "mir/shell/surface_configurator.h" | 22 | #include "mir/scene/surface_configurator.h" |
2533 | 23 | 23 | ||
2534 | 24 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
2535 | 25 | 25 | ||
2536 | @@ -30,10 +30,10 @@ | |||
2537 | 30 | namespace doubles | 30 | namespace doubles |
2538 | 31 | { | 31 | { |
2539 | 32 | 32 | ||
2541 | 33 | struct MockSurfaceConfigurator : public shell::SurfaceConfigurator | 33 | struct MockSurfaceConfigurator : public scene::SurfaceConfigurator |
2542 | 34 | { | 34 | { |
2545 | 35 | MOCK_METHOD3(select_attribute_value, int(shell::Surface const&, MirSurfaceAttrib, int)); | 35 | MOCK_METHOD3(select_attribute_value, int(scene::Surface const&, MirSurfaceAttrib, int)); |
2546 | 36 | MOCK_METHOD3(attribute_set, void(shell::Surface const&, MirSurfaceAttrib, int)); | 36 | MOCK_METHOD3(attribute_set, void(scene::Surface const&, MirSurfaceAttrib, int)); |
2547 | 37 | }; | 37 | }; |
2548 | 38 | 38 | ||
2549 | 39 | } | 39 | } |
2550 | 40 | 40 | ||
2551 | === modified file 'include/test/mir_test_doubles/mock_surface_factory.h' | |||
2552 | --- include/test/mir_test_doubles/mock_surface_factory.h 2013-08-28 03:41:48 +0000 | |||
2553 | +++ include/test/mir_test_doubles/mock_surface_factory.h 2014-04-07 13:29:13 +0000 | |||
2554 | @@ -33,11 +33,12 @@ | |||
2555 | 33 | 33 | ||
2556 | 34 | struct MockSurfaceFactory : public shell::SurfaceFactory | 34 | struct MockSurfaceFactory : public shell::SurfaceFactory |
2557 | 35 | { | 35 | { |
2559 | 36 | MOCK_METHOD4(create_surface, std::shared_ptr<shell::Surface>( | 36 | MOCK_METHOD3(create_surface, std::shared_ptr<shell::Surface>( |
2560 | 37 | shell::Session*, | 37 | shell::Session*, |
2561 | 38 | const shell::SurfaceCreationParameters&, | 38 | const shell::SurfaceCreationParameters&, |
2564 | 39 | frontend::SurfaceId, | 39 | std::shared_ptr<scene::SurfaceObserver> const&)); |
2565 | 40 | std::shared_ptr<frontend::EventSink> const&)); | 40 | |
2566 | 41 | void destroy_surface(std::shared_ptr<shell::Surface> const& /*surface*/) override {} | ||
2567 | 41 | }; | 42 | }; |
2568 | 42 | 43 | ||
2569 | 43 | } | 44 | } |
2570 | 44 | 45 | ||
2571 | === modified file 'include/test/mir_test_doubles/mock_surface_ranker.h' | |||
2572 | --- include/test/mir_test_doubles/mock_surface_ranker.h 2014-03-06 06:05:17 +0000 | |||
2573 | +++ include/test/mir_test_doubles/mock_surface_ranker.h 2014-04-07 13:29:13 +0000 | |||
2574 | @@ -20,7 +20,7 @@ | |||
2575 | 20 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_ | 20 | #ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_ |
2576 | 21 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_ | 21 | #define MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_ |
2577 | 22 | 22 | ||
2579 | 23 | #include "src/server/scene/surface_ranker.h" | 23 | #include "mir/scene/surface_ranker.h" |
2580 | 24 | 24 | ||
2581 | 25 | #include <gmock/gmock.h> | 25 | #include <gmock/gmock.h> |
2582 | 26 | 26 | ||
2583 | @@ -33,7 +33,7 @@ | |||
2584 | 33 | 33 | ||
2585 | 34 | struct MockSurfaceRanker : public scene::SurfaceRanker | 34 | struct MockSurfaceRanker : public scene::SurfaceRanker |
2586 | 35 | { | 35 | { |
2588 | 36 | MOCK_METHOD1(raise, void(std::weak_ptr<scene::BasicSurface> const&)); | 36 | MOCK_METHOD1(raise, void(std::weak_ptr<scene::Surface> const&)); |
2589 | 37 | }; | 37 | }; |
2590 | 38 | 38 | ||
2591 | 39 | } | 39 | } |
2592 | 40 | 40 | ||
2593 | === modified file 'include/test/mir_test_doubles/null_display_buffer.h' | |||
2594 | --- include/test/mir_test_doubles/null_display_buffer.h 2014-03-06 06:05:17 +0000 | |||
2595 | +++ include/test/mir_test_doubles/null_display_buffer.h 2014-04-07 13:29:13 +0000 | |||
2596 | @@ -37,7 +37,7 @@ | |||
2597 | 37 | void post_update() {} | 37 | void post_update() {} |
2598 | 38 | bool can_bypass() const override { return false; } | 38 | bool can_bypass() const override { return false; } |
2599 | 39 | void render_and_post_update( | 39 | void render_and_post_update( |
2601 | 40 | std::list<std::shared_ptr<graphics::Renderable>> const&, | 40 | graphics::RenderableList const&, |
2602 | 41 | std::function<void(graphics::Renderable const&)> const&) {} | 41 | std::function<void(graphics::Renderable const&)> const&) {} |
2603 | 42 | MirOrientation orientation() const override { return mir_orientation_normal; } | 42 | MirOrientation orientation() const override { return mir_orientation_normal; } |
2604 | 43 | }; | 43 | }; |
2605 | 44 | 44 | ||
2606 | === modified file 'include/test/mir_test_doubles/null_display_changer.h' | |||
2607 | --- include/test/mir_test_doubles/null_display_changer.h 2013-09-17 20:03:16 +0000 | |||
2608 | +++ include/test/mir_test_doubles/null_display_changer.h 2014-04-07 13:29:13 +0000 | |||
2609 | @@ -39,9 +39,6 @@ | |||
2610 | 39 | virtual void configure(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&) | 39 | virtual void configure(std::shared_ptr<frontend::Session> const&, std::shared_ptr<graphics::DisplayConfiguration> const&) |
2611 | 40 | { | 40 | { |
2612 | 41 | } | 41 | } |
2613 | 42 | virtual void ensure_display_powered(std::shared_ptr<frontend::Session> const&) | ||
2614 | 43 | { | ||
2615 | 44 | } | ||
2616 | 45 | }; | 42 | }; |
2617 | 46 | } | 43 | } |
2618 | 47 | } | 44 | } |
2619 | 48 | 45 | ||
2620 | === modified file 'include/test/mir_test_doubles/null_platform.h' | |||
2621 | --- include/test/mir_test_doubles/null_platform.h 2014-03-06 06:05:17 +0000 | |||
2622 | +++ include/test/mir_test_doubles/null_platform.h 2014-04-07 13:29:13 +0000 | |||
2623 | @@ -39,7 +39,8 @@ | |||
2624 | 39 | } | 39 | } |
2625 | 40 | 40 | ||
2626 | 41 | std::shared_ptr<graphics::Display> create_display( | 41 | std::shared_ptr<graphics::Display> create_display( |
2628 | 42 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&) | 42 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, |
2629 | 43 | std::shared_ptr<graphics::GLConfig> const&) | ||
2630 | 43 | { | 44 | { |
2631 | 44 | return std::make_shared<NullDisplay>(); | 45 | return std::make_shared<NullDisplay>(); |
2632 | 45 | } | 46 | } |
2633 | 46 | 47 | ||
2634 | === modified file 'include/test/mir_test_doubles/null_surface_configurator.h' | |||
2635 | --- include/test/mir_test_doubles/null_surface_configurator.h 2013-07-29 22:55:20 +0000 | |||
2636 | +++ include/test/mir_test_doubles/null_surface_configurator.h 2014-04-07 13:29:13 +0000 | |||
2637 | @@ -19,7 +19,7 @@ | |||
2638 | 19 | #ifndef MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ | 19 | #ifndef MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ |
2639 | 20 | #define MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ | 20 | #define MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ |
2640 | 21 | 21 | ||
2642 | 22 | #include "mir/shell/surface_configurator.h" | 22 | #include "mir/scene/surface_configurator.h" |
2643 | 23 | 23 | ||
2644 | 24 | namespace mir | 24 | namespace mir |
2645 | 25 | { | 25 | { |
2646 | @@ -28,14 +28,14 @@ | |||
2647 | 28 | namespace doubles | 28 | namespace doubles |
2648 | 29 | { | 29 | { |
2649 | 30 | 30 | ||
2651 | 31 | struct NullSurfaceConfigurator : public shell::SurfaceConfigurator | 31 | struct NullSurfaceConfigurator : public scene::SurfaceConfigurator |
2652 | 32 | { | 32 | { |
2654 | 33 | int select_attribute_value(shell::Surface const&, | 33 | int select_attribute_value(scene::Surface const&, |
2655 | 34 | MirSurfaceAttrib, int requested_value) | 34 | MirSurfaceAttrib, int requested_value) |
2656 | 35 | { | 35 | { |
2657 | 36 | return requested_value; | 36 | return requested_value; |
2658 | 37 | } | 37 | } |
2660 | 38 | void attribute_set(shell::Surface const&, | 38 | void attribute_set(scene::Surface const&, |
2661 | 39 | MirSurfaceAttrib, int) | 39 | MirSurfaceAttrib, int) |
2662 | 40 | { | 40 | { |
2663 | 41 | } | 41 | } |
2664 | 42 | 42 | ||
2665 | === modified file 'include/test/mir_test_doubles/stub_buffer_stream.h' | |||
2666 | --- include/test/mir_test_doubles/stub_buffer_stream.h 2014-03-07 03:15:55 +0000 | |||
2667 | +++ include/test/mir_test_doubles/stub_buffer_stream.h 2014-04-07 13:29:13 +0000 | |||
2668 | @@ -40,7 +40,7 @@ | |||
2669 | 40 | { | 40 | { |
2670 | 41 | complete(&stub_client_buffer); | 41 | complete(&stub_client_buffer); |
2671 | 42 | } | 42 | } |
2673 | 43 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override | 43 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(void const*) override |
2674 | 44 | { | 44 | { |
2675 | 45 | return stub_compositor_buffer; | 45 | return stub_compositor_buffer; |
2676 | 46 | } | 46 | } |
2677 | 47 | 47 | ||
2678 | === modified file 'include/test/mir_test_doubles/stub_display_builder.h' | |||
2679 | --- include/test/mir_test_doubles/stub_display_builder.h 2014-03-06 06:05:17 +0000 | |||
2680 | +++ include/test/mir_test_doubles/stub_display_builder.h 2014-04-07 13:29:13 +0000 | |||
2681 | @@ -43,7 +43,7 @@ | |||
2682 | 43 | void post_update() {} | 43 | void post_update() {} |
2683 | 44 | bool can_bypass() const override { return false; } | 44 | bool can_bypass() const override { return false; } |
2684 | 45 | void render_and_post_update( | 45 | void render_and_post_update( |
2686 | 46 | std::list<std::shared_ptr<graphics::Renderable>> const&, | 46 | graphics::RenderableList const&, |
2687 | 47 | std::function<void(graphics::Renderable const&)> const&) {} | 47 | std::function<void(graphics::Renderable const&)> const&) {} |
2688 | 48 | MirOrientation orientation() const override { return mir_orientation_normal; } | 48 | MirOrientation orientation() const override { return mir_orientation_normal; } |
2689 | 49 | void configure(graphics::DisplayConfigurationOutput const&) {} | 49 | void configure(graphics::DisplayConfigurationOutput const&) {} |
2690 | 50 | 50 | ||
2691 | === modified file 'include/test/mir_test_doubles/stub_display_device.h' | |||
2692 | --- include/test/mir_test_doubles/stub_display_device.h 2014-03-11 13:44:57 +0000 | |||
2693 | +++ include/test/mir_test_doubles/stub_display_device.h 2014-04-07 13:29:13 +0000 | |||
2694 | @@ -40,7 +40,7 @@ | |||
2695 | 40 | } | 40 | } |
2696 | 41 | void render_gl_and_overlays( | 41 | void render_gl_and_overlays( |
2697 | 42 | graphics::android::SwappingGLContext const&, | 42 | graphics::android::SwappingGLContext const&, |
2699 | 43 | std::list<std::shared_ptr<graphics::Renderable>> const&, | 43 | graphics::RenderableList const&, |
2700 | 44 | std::function<void(graphics::Renderable const&)> const&) | 44 | std::function<void(graphics::Renderable const&)> const&) |
2701 | 45 | { | 45 | { |
2702 | 46 | } | 46 | } |
2703 | 47 | 47 | ||
2704 | === added file 'include/test/mir_test_doubles/stub_gl_config.h' | |||
2705 | --- include/test/mir_test_doubles/stub_gl_config.h 1970-01-01 00:00:00 +0000 | |||
2706 | +++ include/test/mir_test_doubles/stub_gl_config.h 2014-04-07 13:29:13 +0000 | |||
2707 | @@ -0,0 +1,43 @@ | |||
2708 | 1 | /* | ||
2709 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2710 | 3 | * | ||
2711 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2712 | 5 | * under the terms of the GNU General Public License version 3, | ||
2713 | 6 | * as published by the Free Software Foundation. | ||
2714 | 7 | * | ||
2715 | 8 | * This program is distributed in the hope that it will be useful, | ||
2716 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2717 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2718 | 11 | * GNU General Public License for more details. | ||
2719 | 12 | * | ||
2720 | 13 | * You should have received a copy of the GNU General Public License | ||
2721 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2722 | 15 | * | ||
2723 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
2724 | 17 | */ | ||
2725 | 18 | |||
2726 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_GL_CONFIG_H_ | ||
2727 | 20 | #define MIR_TEST_DOUBLES_STUB_GL_CONFIG_H_ | ||
2728 | 21 | |||
2729 | 22 | #include "mir/graphics/gl_config.h" | ||
2730 | 23 | |||
2731 | 24 | #include <gmock/gmock.h> | ||
2732 | 25 | |||
2733 | 26 | namespace mir | ||
2734 | 27 | { | ||
2735 | 28 | namespace test | ||
2736 | 29 | { | ||
2737 | 30 | namespace doubles | ||
2738 | 31 | { | ||
2739 | 32 | |||
2740 | 33 | struct StubGLConfig : public graphics::GLConfig | ||
2741 | 34 | { | ||
2742 | 35 | int depth_buffer_bits() const override { return 0; } | ||
2743 | 36 | int stencil_buffer_bits() const override { return 0; } | ||
2744 | 37 | }; | ||
2745 | 38 | |||
2746 | 39 | } | ||
2747 | 40 | } | ||
2748 | 41 | } | ||
2749 | 42 | |||
2750 | 43 | #endif /* MIR_TEST_DOUBLES_STUB_GL_CONFIG_H_ */ | ||
2751 | 0 | 44 | ||
2752 | === modified file 'include/test/mir_test_doubles/stub_ipc_factory.h' | |||
2753 | --- include/test/mir_test_doubles/stub_ipc_factory.h 2014-03-06 06:05:17 +0000 | |||
2754 | +++ include/test/mir_test_doubles/stub_ipc_factory.h 2014-04-07 13:29:13 +0000 | |||
2755 | @@ -41,7 +41,7 @@ | |||
2756 | 41 | } | 41 | } |
2757 | 42 | 42 | ||
2758 | 43 | std::shared_ptr<protobuf::DisplayServer> make_ipc_server( | 43 | std::shared_ptr<protobuf::DisplayServer> make_ipc_server( |
2760 | 44 | pid_t, std::shared_ptr<frontend::EventSink> const&, bool) override | 44 | pid_t, std::shared_ptr<frontend::EventSink> const&) override |
2761 | 45 | { | 45 | { |
2762 | 46 | return server; | 46 | return server; |
2763 | 47 | } | 47 | } |
2764 | 48 | 48 | ||
2765 | === modified file 'include/test/mir_test_doubles/stub_renderable.h' | |||
2766 | --- include/test/mir_test_doubles/stub_renderable.h 2014-03-17 07:35:22 +0000 | |||
2767 | +++ include/test/mir_test_doubles/stub_renderable.h 2014-04-07 13:29:13 +0000 | |||
2768 | @@ -33,7 +33,7 @@ | |||
2769 | 33 | class StubRenderable : public graphics::Renderable | 33 | class StubRenderable : public graphics::Renderable |
2770 | 34 | { | 34 | { |
2771 | 35 | public: | 35 | public: |
2773 | 36 | std::shared_ptr<graphics::Buffer> buffer(unsigned long) const override | 36 | std::shared_ptr<graphics::Buffer> buffer(void const*) const override |
2774 | 37 | { | 37 | { |
2775 | 38 | return std::make_shared<StubBuffer>(); | 38 | return std::make_shared<StubBuffer>(); |
2776 | 39 | } | 39 | } |
2777 | @@ -53,7 +53,7 @@ | |||
2778 | 53 | { | 53 | { |
2779 | 54 | return trans; | 54 | return trans; |
2780 | 55 | } | 55 | } |
2782 | 56 | bool should_be_rendered_in(geometry::Rectangle const&) const override | 56 | bool visible() const |
2783 | 57 | { | 57 | { |
2784 | 58 | return true; | 58 | return true; |
2785 | 59 | } | 59 | } |
2786 | 60 | 60 | ||
2787 | === modified file 'include/test/mir_test_doubles/stub_session_authorizer.h' | |||
2788 | --- include/test/mir_test_doubles/stub_session_authorizer.h 2013-08-28 03:41:48 +0000 | |||
2789 | +++ include/test/mir_test_doubles/stub_session_authorizer.h 2014-04-07 13:29:13 +0000 | |||
2790 | @@ -38,6 +38,10 @@ | |||
2791 | 38 | { | 38 | { |
2792 | 39 | return true; | 39 | return true; |
2793 | 40 | } | 40 | } |
2794 | 41 | bool screencast_is_allowed(pid_t) | ||
2795 | 42 | { | ||
2796 | 43 | return true; | ||
2797 | 44 | } | ||
2798 | 41 | }; | 45 | }; |
2799 | 42 | 46 | ||
2800 | 43 | } | 47 | } |
2801 | 44 | 48 | ||
2802 | === removed file 'include/test/mir_test_doubles/stub_surface_builder.h' | |||
2803 | --- include/test/mir_test_doubles/stub_surface_builder.h 2014-03-06 06:05:17 +0000 | |||
2804 | +++ include/test/mir_test_doubles/stub_surface_builder.h 1970-01-01 00:00:00 +0000 | |||
2805 | @@ -1,69 +0,0 @@ | |||
2806 | 1 | /* | ||
2807 | 2 | * Copyright © 2013-2014 Canonical Ltd. | ||
2808 | 3 | * | ||
2809 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2810 | 5 | * under the terms of the GNU General Public License version 3, | ||
2811 | 6 | * as published by the Free Software Foundation. | ||
2812 | 7 | * | ||
2813 | 8 | * This program is distributed in the hope that it will be useful, | ||
2814 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2815 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2816 | 11 | * GNU General Public License for more details. | ||
2817 | 12 | * | ||
2818 | 13 | * You should have received a copy of the GNU General Public License | ||
2819 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2820 | 15 | * | ||
2821 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
2822 | 17 | */ | ||
2823 | 18 | |||
2824 | 19 | |||
2825 | 20 | #ifndef MIR_TEST_DOUBLES_STUB_SURFACE_BUILDER_H_ | ||
2826 | 21 | #define MIR_TEST_DOUBLES_STUB_SURFACE_BUILDER_H_ | ||
2827 | 22 | |||
2828 | 23 | #include "src/server/scene/surface_builder.h" | ||
2829 | 24 | #include "src/server/scene/basic_surface.h" | ||
2830 | 25 | #include "src/server/report/null_report_factory.h" | ||
2831 | 26 | #include "mir/shell/surface_creation_parameters.h" | ||
2832 | 27 | |||
2833 | 28 | #include "mir_test_doubles/stub_buffer_stream.h" | ||
2834 | 29 | #include <memory> | ||
2835 | 30 | namespace mir | ||
2836 | 31 | { | ||
2837 | 32 | namespace test | ||
2838 | 33 | { | ||
2839 | 34 | namespace doubles | ||
2840 | 35 | { | ||
2841 | 36 | |||
2842 | 37 | class StubSurfaceBuilder : public scene::SurfaceBuilder | ||
2843 | 38 | { | ||
2844 | 39 | public: | ||
2845 | 40 | StubSurfaceBuilder() : | ||
2846 | 41 | dummy_surface(std::make_shared<scene::BasicSurface>( | ||
2847 | 42 | std::string("stub"), | ||
2848 | 43 | geometry::Rectangle{{},{}}, | ||
2849 | 44 | [](){}, | ||
2850 | 45 | false, | ||
2851 | 46 | std::make_shared<StubBufferStream>(), | ||
2852 | 47 | std::shared_ptr<input::InputChannel>(), | ||
2853 | 48 | mir::report::null_scene_report())) | ||
2854 | 49 | { | ||
2855 | 50 | } | ||
2856 | 51 | |||
2857 | 52 | std::weak_ptr<scene::BasicSurface> create_surface(shell::SurfaceCreationParameters const&) | ||
2858 | 53 | { | ||
2859 | 54 | return dummy_surface; | ||
2860 | 55 | } | ||
2861 | 56 | |||
2862 | 57 | void destroy_surface(std::weak_ptr<scene::BasicSurface> const& ) | ||
2863 | 58 | { | ||
2864 | 59 | } | ||
2865 | 60 | |||
2866 | 61 | private: | ||
2867 | 62 | std::shared_ptr<scene::BasicSurface> dummy_surface; | ||
2868 | 63 | }; | ||
2869 | 64 | } | ||
2870 | 65 | } | ||
2871 | 66 | } | ||
2872 | 67 | |||
2873 | 68 | |||
2874 | 69 | #endif /* MIR_TEST_DOUBLES_STUB_SURFACE_BUILDER_H_ */ | ||
2875 | 70 | 0 | ||
2876 | === removed file 'include/test/mir_test_doubles/stub_surface_ranker.h' | |||
2877 | --- include/test/mir_test_doubles/stub_surface_ranker.h 2014-03-06 06:05:17 +0000 | |||
2878 | +++ include/test/mir_test_doubles/stub_surface_ranker.h 1970-01-01 00:00:00 +0000 | |||
2879 | @@ -1,44 +0,0 @@ | |||
2880 | 1 | /* | ||
2881 | 2 | * Copyright © 2013 Canonical Ltd. | ||
2882 | 3 | * | ||
2883 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2884 | 5 | * under the terms of the GNU General Public License version 3, | ||
2885 | 6 | * as published by the Free Software Foundation. | ||
2886 | 7 | * | ||
2887 | 8 | * This program is distributed in the hope that it will be useful, | ||
2888 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2889 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2890 | 11 | * GNU General Public License for more details. | ||
2891 | 12 | * | ||
2892 | 13 | * You should have received a copy of the GNU General Public License | ||
2893 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2894 | 15 | * | ||
2895 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
2896 | 17 | */ | ||
2897 | 18 | |||
2898 | 19 | |||
2899 | 20 | #ifndef MIR_TEST_DOUBLES_STUB_SURFACE_RANKER_H_ | ||
2900 | 21 | #define MIR_TEST_DOUBLES_STUB_SURFACE_RANKER_H_ | ||
2901 | 22 | |||
2902 | 23 | #include "src/server/scene/surface_ranker.h" | ||
2903 | 24 | |||
2904 | 25 | namespace mir | ||
2905 | 26 | { | ||
2906 | 27 | namespace test | ||
2907 | 28 | { | ||
2908 | 29 | namespace doubles | ||
2909 | 30 | { | ||
2910 | 31 | |||
2911 | 32 | struct StubSurfaceRanker : public scene::SurfaceRanker | ||
2912 | 33 | { | ||
2913 | 34 | void raise(std::weak_ptr<scene::BasicSurface> const&) override | ||
2914 | 35 | { | ||
2915 | 36 | } | ||
2916 | 37 | }; | ||
2917 | 38 | |||
2918 | 39 | } | ||
2919 | 40 | } | ||
2920 | 41 | } | ||
2921 | 42 | |||
2922 | 43 | |||
2923 | 44 | #endif /* MIR_TEST_DOUBLES_STUB_SURFACE_RANKER_H_ */ | ||
2924 | 45 | 0 | ||
2925 | === added file 'include/test/mir_test_framework/declarative_placement_strategy.h' | |||
2926 | --- include/test/mir_test_framework/declarative_placement_strategy.h 1970-01-01 00:00:00 +0000 | |||
2927 | +++ include/test/mir_test_framework/declarative_placement_strategy.h 2014-04-07 13:29:13 +0000 | |||
2928 | @@ -0,0 +1,64 @@ | |||
2929 | 1 | /* | ||
2930 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2931 | 3 | * | ||
2932 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2933 | 5 | * under the terms of the GNU General Public License version 3, | ||
2934 | 6 | * as published by the Free Software Foundation. | ||
2935 | 7 | * | ||
2936 | 8 | * This program is distributed in the hope that it will be useful, | ||
2937 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2938 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2939 | 11 | * GNU General Public License for more details. | ||
2940 | 12 | * | ||
2941 | 13 | * You should have received a copy of the GNU General Public License | ||
2942 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2943 | 15 | * | ||
2944 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
2945 | 17 | */ | ||
2946 | 18 | |||
2947 | 19 | #ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_ | ||
2948 | 20 | #define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_ | ||
2949 | 21 | |||
2950 | 22 | #include "mir/shell/placement_strategy.h" | ||
2951 | 23 | #include "mir/geometry/rectangle.h" | ||
2952 | 24 | #include "mir/scene/depth_id.h" | ||
2953 | 25 | |||
2954 | 26 | #include <memory> | ||
2955 | 27 | #include <map> | ||
2956 | 28 | #include <string> | ||
2957 | 29 | |||
2958 | 30 | namespace mir_test_framework | ||
2959 | 31 | { | ||
2960 | 32 | typedef std::map<std::string, mir::geometry::Rectangle> SurfaceGeometries; | ||
2961 | 33 | typedef std::map<std::string, mir::scene::DepthId> SurfaceDepths; | ||
2962 | 34 | |||
2963 | 35 | /// DeclarativePlacementStrategy is a test utility server component for specifying | ||
2964 | 36 | /// a static list of surface geometries and relative depths. Used, for example, | ||
2965 | 37 | /// in input tests where it is necessary to set up scenarios depending on | ||
2966 | 38 | /// multiple surfaces geometry and stacking. | ||
2967 | 39 | class DeclarativePlacementStrategy : public mir::shell::PlacementStrategy | ||
2968 | 40 | { | ||
2969 | 41 | public: | ||
2970 | 42 | // Placement requests will be passed through to default strategy, and then overriden if the surface appears | ||
2971 | 43 | // in the geometry or depth map. This allows for the convenience of leaving some surfaces geometries unspecified | ||
2972 | 44 | // and receiving the default behavior. | ||
2973 | 45 | DeclarativePlacementStrategy(std::shared_ptr<mir::shell::PlacementStrategy> const& default_strategy, | ||
2974 | 46 | SurfaceGeometries const& positions_by_name, SurfaceDepths const& depths_by_name); | ||
2975 | 47 | |||
2976 | 48 | virtual ~DeclarativePlacementStrategy() = default; | ||
2977 | 49 | |||
2978 | 50 | mir::shell::SurfaceCreationParameters place(mir::shell::Session const& session, mir::shell::SurfaceCreationParameters const& request_parameters) override; | ||
2979 | 51 | |||
2980 | 52 | protected: | ||
2981 | 53 | DeclarativePlacementStrategy(const DeclarativePlacementStrategy&) = delete; | ||
2982 | 54 | DeclarativePlacementStrategy& operator=(const DeclarativePlacementStrategy&) = delete; | ||
2983 | 55 | |||
2984 | 56 | private: | ||
2985 | 57 | std::shared_ptr<mir::shell::PlacementStrategy> const default_strategy; | ||
2986 | 58 | |||
2987 | 59 | SurfaceGeometries surface_geometries_by_name; | ||
2988 | 60 | SurfaceDepths surface_depths_by_name; | ||
2989 | 61 | }; | ||
2990 | 62 | } | ||
2991 | 63 | |||
2992 | 64 | #endif // MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_ | ||
2993 | 0 | 65 | ||
2994 | === modified file 'include/test/mir_test_framework/udev_environment.h' | |||
2995 | --- include/test/mir_test_framework/udev_environment.h 2014-03-06 06:05:17 +0000 | |||
2996 | +++ include/test/mir_test_framework/udev_environment.h 2014-04-07 13:29:13 +0000 | |||
2997 | @@ -56,6 +56,7 @@ | |||
2998 | 56 | void add_standard_device(std::string const& name); | 56 | void add_standard_device(std::string const& name); |
2999 | 57 | 57 | ||
3000 | 58 | UMockdevTestbed *testbed; | 58 | UMockdevTestbed *testbed; |
3001 | 59 | std::string const recordings_path; | ||
3002 | 59 | }; | 60 | }; |
3003 | 60 | 61 | ||
3004 | 61 | } | 62 | } |
3005 | 62 | 63 | ||
3006 | === modified file 'src/client/default_connection_configuration.cpp' | |||
3007 | --- src/client/default_connection_configuration.cpp 2014-03-06 06:05:17 +0000 | |||
3008 | +++ src/client/default_connection_configuration.cpp 2014-04-07 13:29:13 +0000 | |||
3009 | @@ -103,7 +103,7 @@ | |||
3010 | 103 | { | 103 | { |
3011 | 104 | auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB"); | 104 | auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB"); |
3012 | 105 | std::string const val{val_raw ? val_raw : default_platform_lib}; | 105 | std::string const val{val_raw ? val_raw : default_platform_lib}; |
3014 | 106 | auto const platform_lib = load_library(val); | 106 | auto const platform_lib = ::load_library(val); |
3015 | 107 | 107 | ||
3016 | 108 | auto const create_client_platform_factory = | 108 | auto const create_client_platform_factory = |
3017 | 109 | platform_lib->load_function<mcl::CreateClientPlatformFactory>( | 109 | platform_lib->load_function<mcl::CreateClientPlatformFactory>( |
3018 | 110 | 110 | ||
3019 | === modified file 'src/client/lttng/input_receiver_report_tp.h' | |||
3020 | --- src/client/lttng/input_receiver_report_tp.h 2014-02-03 11:44:32 +0000 | |||
3021 | +++ src/client/lttng/input_receiver_report_tp.h 2014-04-07 13:29:13 +0000 | |||
3022 | @@ -26,6 +26,7 @@ | |||
3023 | 26 | #define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_ | 26 | #define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_ |
3024 | 27 | 27 | ||
3025 | 28 | #include <lttng/tracepoint.h> | 28 | #include <lttng/tracepoint.h> |
3026 | 29 | #include <stdint.h> | ||
3027 | 29 | 30 | ||
3028 | 30 | #ifdef __clang__ | 31 | #ifdef __clang__ |
3029 | 31 | /* | 32 | /* |
3030 | 32 | 33 | ||
3031 | === modified file 'src/client/lttng/rpc_report_tp.h' | |||
3032 | --- src/client/lttng/rpc_report_tp.h 2014-03-06 06:05:17 +0000 | |||
3033 | +++ src/client/lttng/rpc_report_tp.h 2014-04-07 13:29:13 +0000 | |||
3034 | @@ -26,6 +26,7 @@ | |||
3035 | 26 | #define MIR_CLIENT_LTTNG_RPC_REPORT_TP_H_ | 26 | #define MIR_CLIENT_LTTNG_RPC_REPORT_TP_H_ |
3036 | 27 | 27 | ||
3037 | 28 | #include <lttng/tracepoint.h> | 28 | #include <lttng/tracepoint.h> |
3038 | 29 | #include <stdint.h> | ||
3039 | 29 | 30 | ||
3040 | 30 | #ifdef __clang__ | 31 | #ifdef __clang__ |
3041 | 31 | /* | 32 | /* |
3042 | 32 | 33 | ||
3043 | === modified file 'src/client/mir_client_library.cpp' | |||
3044 | --- src/client/mir_client_library.cpp 2014-03-06 06:05:17 +0000 | |||
3045 | +++ src/client/mir_client_library.cpp 2014-04-07 13:29:13 +0000 | |||
3046 | @@ -120,8 +120,17 @@ | |||
3047 | 120 | { | 120 | { |
3048 | 121 | if (!error_connections.contains(connection)) | 121 | if (!error_connections.contains(connection)) |
3049 | 122 | { | 122 | { |
3052 | 123 | auto wait_handle = connection->disconnect(); | 123 | try |
3053 | 124 | wait_handle->wait_for_all(); | 124 | { |
3054 | 125 | auto wait_handle = connection->disconnect(); | ||
3055 | 126 | wait_handle->wait_for_all(); | ||
3056 | 127 | } | ||
3057 | 128 | catch (std::exception const&) | ||
3058 | 129 | { | ||
3059 | 130 | // We're implementing a C API so no exceptions are to be | ||
3060 | 131 | // propagated. And that's OK because if disconnect() fails, | ||
3061 | 132 | // we don't care why. We're finished with the connection anyway. | ||
3062 | 133 | } | ||
3063 | 125 | } | 134 | } |
3064 | 126 | else | 135 | else |
3065 | 127 | { | 136 | { |
3066 | 128 | 137 | ||
3067 | === modified file 'src/client/rpc/mir_basic_rpc_channel.cpp' | |||
3068 | --- src/client/rpc/mir_basic_rpc_channel.cpp 2014-03-06 06:05:17 +0000 | |||
3069 | +++ src/client/rpc/mir_basic_rpc_channel.cpp 2014-04-07 13:29:13 +0000 | |||
3070 | @@ -34,7 +34,7 @@ | |||
3071 | 34 | } | 34 | } |
3072 | 35 | 35 | ||
3073 | 36 | void mclrd::PendingCallCache::save_completion_details( | 36 | void mclrd::PendingCallCache::save_completion_details( |
3075 | 37 | mir::protobuf::wire::Invocation& invoke, | 37 | mir::protobuf::wire::Invocation const& invoke, |
3076 | 38 | google::protobuf::Message* response, | 38 | google::protobuf::Message* response, |
3077 | 39 | std::shared_ptr<google::protobuf::Closure> const& complete) | 39 | std::shared_ptr<google::protobuf::Closure> const& complete) |
3078 | 40 | { | 40 | { |
3079 | @@ -102,8 +102,8 @@ | |||
3080 | 102 | 102 | ||
3081 | 103 | 103 | ||
3082 | 104 | mir::protobuf::wire::Invocation mclr::MirBasicRpcChannel::invocation_for( | 104 | mir::protobuf::wire::Invocation mclr::MirBasicRpcChannel::invocation_for( |
3085 | 105 | const google::protobuf::MethodDescriptor* method, | 105 | google::protobuf::MethodDescriptor const* method, |
3086 | 106 | const google::protobuf::Message* request) | 106 | google::protobuf::Message const* request) |
3087 | 107 | { | 107 | { |
3088 | 108 | char buffer[mir::frontend::serialization_buffer_size]; | 108 | char buffer[mir::frontend::serialization_buffer_size]; |
3089 | 109 | 109 | ||
3090 | 110 | 110 | ||
3091 | === modified file 'src/client/rpc/mir_basic_rpc_channel.h' | |||
3092 | --- src/client/rpc/mir_basic_rpc_channel.h 2014-03-06 06:05:17 +0000 | |||
3093 | +++ src/client/rpc/mir_basic_rpc_channel.h 2014-04-07 13:29:13 +0000 | |||
3094 | @@ -55,7 +55,7 @@ | |||
3095 | 55 | PendingCallCache(std::shared_ptr<RpcReport> const& rpc_report); | 55 | PendingCallCache(std::shared_ptr<RpcReport> const& rpc_report); |
3096 | 56 | 56 | ||
3097 | 57 | void save_completion_details( | 57 | void save_completion_details( |
3099 | 58 | mir::protobuf::wire::Invocation& invoke, | 58 | mir::protobuf::wire::Invocation const& invoke, |
3100 | 59 | google::protobuf::Message* response, | 59 | google::protobuf::Message* response, |
3101 | 60 | std::shared_ptr<google::protobuf::Closure> const& complete); | 60 | std::shared_ptr<google::protobuf::Closure> const& complete); |
3102 | 61 | 61 | ||
3103 | @@ -95,8 +95,9 @@ | |||
3104 | 95 | ~MirBasicRpcChannel(); | 95 | ~MirBasicRpcChannel(); |
3105 | 96 | 96 | ||
3106 | 97 | protected: | 97 | protected: |
3109 | 98 | mir::protobuf::wire::Invocation invocation_for(const google::protobuf::MethodDescriptor* method, | 98 | mir::protobuf::wire::Invocation invocation_for( |
3110 | 99 | const google::protobuf::Message* request); | 99 | google::protobuf::MethodDescriptor const* method, |
3111 | 100 | google::protobuf::Message const* request); | ||
3112 | 100 | int next_id(); | 101 | int next_id(); |
3113 | 101 | 102 | ||
3114 | 102 | private: | 103 | private: |
3115 | 103 | 104 | ||
3116 | === modified file 'src/client/rpc/mir_socket_rpc_channel.cpp' | |||
3117 | --- src/client/rpc/mir_socket_rpc_channel.cpp 2014-03-06 06:05:17 +0000 | |||
3118 | +++ src/client/rpc/mir_socket_rpc_channel.cpp 2014-04-07 13:29:13 +0000 | |||
3119 | @@ -142,8 +142,39 @@ | |||
3120 | 142 | { | 142 | { |
3121 | 143 | if (!disconnected.load()) | 143 | if (!disconnected.load()) |
3122 | 144 | { | 144 | { |
3125 | 145 | auto surface = dynamic_cast<mir::protobuf::Surface*>(response); | 145 | auto const message_type = response->GetTypeName(); |
3126 | 146 | mir::protobuf::Screencast* screencast{nullptr}; | 146 | |
3127 | 147 | mir::protobuf::Surface* surface = nullptr; | ||
3128 | 148 | mir::protobuf::Buffer* buffer = nullptr; | ||
3129 | 149 | mir::protobuf::Platform* platform = nullptr; | ||
3130 | 150 | |||
3131 | 151 | if (message_type == "mir.protobuf.Buffer") | ||
3132 | 152 | { | ||
3133 | 153 | buffer = static_cast<mir::protobuf::Buffer*>(response); | ||
3134 | 154 | } | ||
3135 | 155 | else if (message_type == "mir.protobuf.Surface") | ||
3136 | 156 | { | ||
3137 | 157 | surface = static_cast<mir::protobuf::Surface*>(response); | ||
3138 | 158 | if (surface && surface->has_buffer()) | ||
3139 | 159 | buffer = surface->mutable_buffer(); | ||
3140 | 160 | } | ||
3141 | 161 | else if (message_type == "mir.protobuf.Screencast") | ||
3142 | 162 | { | ||
3143 | 163 | auto screencast = static_cast<mir::protobuf::Screencast*>(response); | ||
3144 | 164 | if (screencast && screencast->has_buffer()) | ||
3145 | 165 | buffer = screencast->mutable_buffer(); | ||
3146 | 166 | } | ||
3147 | 167 | else if (message_type == "mir.protobuf.Platform") | ||
3148 | 168 | { | ||
3149 | 169 | platform = static_cast<mir::protobuf::Platform*>(response); | ||
3150 | 170 | } | ||
3151 | 171 | else if (message_type == "mir.protobuf.Connection") | ||
3152 | 172 | { | ||
3153 | 173 | auto connection = static_cast<mir::protobuf::Connection*>(response); | ||
3154 | 174 | if (connection && connection->has_platform()) | ||
3155 | 175 | platform = connection->mutable_platform(); | ||
3156 | 176 | } | ||
3157 | 177 | |||
3158 | 147 | if (surface) | 178 | if (surface) |
3159 | 148 | { | 179 | { |
3160 | 149 | surface->clear_fd(); | 180 | surface->clear_fd(); |
3161 | @@ -158,19 +189,6 @@ | |||
3162 | 158 | rpc_report->file_descriptors_received(*response, fds); | 189 | rpc_report->file_descriptors_received(*response, fds); |
3163 | 159 | } | 190 | } |
3164 | 160 | } | 191 | } |
3165 | 161 | else | ||
3166 | 162 | { | ||
3167 | 163 | screencast = dynamic_cast<mir::protobuf::Screencast*>(response); | ||
3168 | 164 | } | ||
3169 | 165 | |||
3170 | 166 | auto buffer = dynamic_cast<mir::protobuf::Buffer*>(response); | ||
3171 | 167 | if (!buffer) | ||
3172 | 168 | { | ||
3173 | 169 | if (surface && surface->has_buffer()) | ||
3174 | 170 | buffer = surface->mutable_buffer(); | ||
3175 | 171 | else if (screencast && screencast->has_buffer()) | ||
3176 | 172 | buffer = screencast->mutable_buffer(); | ||
3177 | 173 | } | ||
3178 | 174 | 192 | ||
3179 | 175 | if (buffer) | 193 | if (buffer) |
3180 | 176 | { | 194 | { |
3181 | @@ -187,14 +205,6 @@ | |||
3182 | 187 | } | 205 | } |
3183 | 188 | } | 206 | } |
3184 | 189 | 207 | ||
3185 | 190 | auto platform = dynamic_cast<mir::protobuf::Platform*>(response); | ||
3186 | 191 | if (!platform) | ||
3187 | 192 | { | ||
3188 | 193 | auto connection = dynamic_cast<mir::protobuf::Connection*>(response); | ||
3189 | 194 | if (connection && connection->has_platform()) | ||
3190 | 195 | platform = connection->mutable_platform(); | ||
3191 | 196 | } | ||
3192 | 197 | |||
3193 | 198 | if (platform) | 208 | if (platform) |
3194 | 199 | { | 209 | { |
3195 | 200 | platform->clear_fd(); | 210 | platform->clear_fd(); |
3196 | @@ -266,7 +276,7 @@ | |||
3197 | 266 | google::protobuf::Message* response, | 276 | google::protobuf::Message* response, |
3198 | 267 | google::protobuf::Closure* complete) | 277 | google::protobuf::Closure* complete) |
3199 | 268 | { | 278 | { |
3201 | 269 | mir::protobuf::wire::Invocation invocation = invocation_for(method, parameters); | 279 | auto const& invocation = invocation_for(method, parameters); |
3202 | 270 | 280 | ||
3203 | 271 | rpc_report->invocation_requested(invocation); | 281 | rpc_report->invocation_requested(invocation); |
3204 | 272 | 282 | ||
3205 | @@ -345,7 +355,7 @@ | |||
3206 | 345 | { | 355 | { |
3207 | 346 | const size_t body_size = read_message_header(); | 356 | const size_t body_size = read_message_header(); |
3208 | 347 | 357 | ||
3210 | 348 | result = read_message_body(body_size); | 358 | read_message_body(result, body_size); |
3211 | 349 | 359 | ||
3212 | 350 | rpc_report->result_receipt_succeeded(result); | 360 | rpc_report->result_receipt_succeeded(result); |
3213 | 351 | } | 361 | } |
3214 | @@ -431,18 +441,17 @@ | |||
3215 | 431 | return body_size; | 441 | return body_size; |
3216 | 432 | } | 442 | } |
3217 | 433 | 443 | ||
3219 | 434 | mir::protobuf::wire::Result mclr::MirSocketRpcChannel::read_message_body(const size_t body_size) | 444 | void mclr::MirSocketRpcChannel::read_message_body( |
3220 | 445 | mir::protobuf::wire::Result& result, | ||
3221 | 446 | size_t const body_size) | ||
3222 | 435 | { | 447 | { |
3223 | 436 | boost::system::error_code error; | 448 | boost::system::error_code error; |
3226 | 437 | boost::asio::streambuf message; | 449 | body_bytes.resize(body_size); |
3227 | 438 | boost::asio::read(socket, message, boost::asio::transfer_exactly(body_size), error); | 450 | boost::asio::read(socket, boost::asio::buffer(body_bytes), error); |
3228 | 439 | if (error) | 451 | if (error) |
3229 | 440 | { | 452 | { |
3230 | 441 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to read message body: " + error.message())); | 453 | BOOST_THROW_EXCEPTION(std::runtime_error("Failed to read message body: " + error.message())); |
3231 | 442 | } | 454 | } |
3232 | 443 | 455 | ||
3237 | 444 | std::istream in(&message); | 456 | result.ParseFromArray(body_bytes.data(), body_size); |
3234 | 445 | mir::protobuf::wire::Result result; | ||
3235 | 446 | result.ParseFromIstream(&in); | ||
3236 | 447 | return result; | ||
3238 | 448 | } | 457 | } |
3239 | 449 | 458 | ||
3240 | === modified file 'src/client/rpc/mir_socket_rpc_channel.h' | |||
3241 | --- src/client/rpc/mir_socket_rpc_channel.h 2014-03-06 06:05:17 +0000 | |||
3242 | +++ src/client/rpc/mir_socket_rpc_channel.h 2014-04-07 13:29:13 +0000 | |||
3243 | @@ -80,6 +80,7 @@ | |||
3244 | 80 | 80 | ||
3245 | 81 | static size_t const size_of_header = 2; | 81 | static size_t const size_of_header = 2; |
3246 | 82 | unsigned char header_bytes[size_of_header]; | 82 | unsigned char header_bytes[size_of_header]; |
3247 | 83 | std::vector<char> body_bytes; | ||
3248 | 83 | 84 | ||
3249 | 84 | void receive_file_descriptors(google::protobuf::Message* response, google::protobuf::Closure* complete); | 85 | void receive_file_descriptors(google::protobuf::Message* response, google::protobuf::Closure* complete); |
3250 | 85 | void receive_file_descriptors(std::vector<int> &fds); | 86 | void receive_file_descriptors(std::vector<int> &fds); |
3251 | @@ -92,7 +93,8 @@ | |||
3252 | 92 | 93 | ||
3253 | 93 | size_t read_message_header(); | 94 | size_t read_message_header(); |
3254 | 94 | 95 | ||
3256 | 95 | mir::protobuf::wire::Result read_message_body(const size_t body_size); | 96 | void read_message_body(mir::protobuf::wire::Result& result, |
3257 | 97 | size_t const body_size); | ||
3258 | 96 | void notify_disconnected(); | 98 | void notify_disconnected(); |
3259 | 97 | 99 | ||
3260 | 98 | std::shared_ptr<SurfaceMap> surface_map; | 100 | std::shared_ptr<SurfaceMap> surface_map; |
3261 | 99 | 101 | ||
3262 | === modified file 'src/platform/CMakeLists.txt' | |||
3263 | --- src/platform/CMakeLists.txt 2014-03-06 06:05:17 +0000 | |||
3264 | +++ src/platform/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
3265 | @@ -3,13 +3,14 @@ | |||
3266 | 3 | 3 | ||
3267 | 4 | add_library( | 4 | add_library( |
3268 | 5 | mirplatform SHARED | 5 | mirplatform SHARED |
3270 | 6 | 6 | shared_library_loader.cpp | |
3271 | 7 | udev_wrapper.cpp | 7 | udev_wrapper.cpp |
3272 | 8 | ) | 8 | ) |
3273 | 9 | 9 | ||
3274 | 10 | target_link_libraries( | 10 | target_link_libraries( |
3275 | 11 | mirplatform | 11 | mirplatform |
3276 | 12 | mirplatformgraphicscommon | 12 | mirplatformgraphicscommon |
3277 | 13 | mirsharedsharedlibrary | ||
3278 | 13 | 14 | ||
3279 | 14 | ${UDEV_LDFLAGS} ${UDEV_LIBRARIES} | 15 | ${UDEV_LDFLAGS} ${UDEV_LIBRARIES} |
3280 | 15 | ) | 16 | ) |
3281 | 16 | 17 | ||
3282 | === modified file 'src/platform/graphics/android/CMakeLists.txt' | |||
3283 | --- src/platform/graphics/android/CMakeLists.txt 2014-03-11 13:44:57 +0000 | |||
3284 | +++ src/platform/graphics/android/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
3285 | @@ -20,6 +20,7 @@ | |||
3286 | 20 | hwc_layerlist.cpp | 20 | hwc_layerlist.cpp |
3287 | 21 | hwc_layers.cpp | 21 | hwc_layers.cpp |
3288 | 22 | hwc_fb_device.cpp | 22 | hwc_fb_device.cpp |
3289 | 23 | hwc_formatted_logger.cpp | ||
3290 | 23 | hwc_device.cpp | 24 | hwc_device.cpp |
3291 | 24 | hwc_common_device.cpp | 25 | hwc_common_device.cpp |
3292 | 25 | hwc_vsync.cpp | 26 | hwc_vsync.cpp |
3293 | @@ -44,9 +45,12 @@ | |||
3294 | 44 | target_link_libraries( | 45 | target_link_libraries( |
3295 | 45 | mirplatformgraphicsandroid | 46 | mirplatformgraphicsandroid |
3296 | 46 | 47 | ||
3297 | 48 | miroptions | ||
3298 | 47 | mirplatform | 49 | mirplatform |
3299 | 48 | mirsharedandroid | 50 | mirsharedandroid |
3300 | 51 | mirsharedenv | ||
3301 | 49 | 52 | ||
3302 | 53 | ${Boost_PROGRAM_OPTIONS_LIBRARY} | ||
3303 | 50 | ${LIBHARDWARE_LIBRARIES} | 54 | ${LIBHARDWARE_LIBRARIES} |
3304 | 51 | ${EGL_LDFLAGS} ${EGL_LIBRARIES} | 55 | ${EGL_LDFLAGS} ${EGL_LIBRARIES} |
3305 | 52 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} | 56 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} |
3306 | 53 | 57 | ||
3307 | === modified file 'src/platform/graphics/android/android_display.cpp' | |||
3308 | --- src/platform/graphics/android/android_display.cpp 2014-03-17 07:35:22 +0000 | |||
3309 | +++ src/platform/graphics/android/android_display.cpp 2014-04-07 13:29:13 +0000 | |||
3310 | @@ -33,9 +33,10 @@ | |||
3311 | 33 | namespace geom=mir::geometry; | 33 | namespace geom=mir::geometry; |
3312 | 34 | 34 | ||
3313 | 35 | mga::AndroidDisplay::AndroidDisplay(std::shared_ptr<mga::DisplayBuilder> const& display_builder, | 35 | mga::AndroidDisplay::AndroidDisplay(std::shared_ptr<mga::DisplayBuilder> const& display_builder, |
3314 | 36 | std::shared_ptr<GLConfig> const& gl_config, | ||
3315 | 36 | std::shared_ptr<DisplayReport> const& display_report) | 37 | std::shared_ptr<DisplayReport> const& display_report) |
3316 | 37 | : display_builder{display_builder}, | 38 | : display_builder{display_builder}, |
3318 | 38 | gl_context{display_builder->display_format(), *display_report}, | 39 | gl_context{display_builder->display_format(), *gl_config, *display_report}, |
3319 | 39 | display_buffer{display_builder->create_display_buffer(gl_context)} | 40 | display_buffer{display_builder->create_display_buffer(gl_context)} |
3320 | 40 | { | 41 | { |
3321 | 41 | display_report->report_successful_setup_of_native_resources(); | 42 | display_report->report_successful_setup_of_native_resources(); |
3322 | 42 | 43 | ||
3323 | === modified file 'src/platform/graphics/android/android_display.h' | |||
3324 | --- src/platform/graphics/android/android_display.h 2014-03-06 06:05:17 +0000 | |||
3325 | +++ src/platform/graphics/android/android_display.h 2014-04-07 13:29:13 +0000 | |||
3326 | @@ -30,6 +30,7 @@ | |||
3327 | 30 | { | 30 | { |
3328 | 31 | 31 | ||
3329 | 32 | class DisplayReport; | 32 | class DisplayReport; |
3330 | 33 | class GLConfig; | ||
3331 | 33 | 34 | ||
3332 | 34 | namespace android | 35 | namespace android |
3333 | 35 | { | 36 | { |
3334 | @@ -41,6 +42,7 @@ | |||
3335 | 41 | { | 42 | { |
3336 | 42 | public: | 43 | public: |
3337 | 43 | explicit AndroidDisplay(std::shared_ptr<DisplayBuilder> const& display_builder, | 44 | explicit AndroidDisplay(std::shared_ptr<DisplayBuilder> const& display_builder, |
3338 | 45 | std::shared_ptr<GLConfig> const& gl_config, | ||
3339 | 44 | std::shared_ptr<DisplayReport> const& display_report); | 46 | std::shared_ptr<DisplayReport> const& display_report); |
3340 | 45 | 47 | ||
3341 | 46 | void for_each_display_buffer(std::function<void(graphics::DisplayBuffer&)> const& f); | 48 | void for_each_display_buffer(std::function<void(graphics::DisplayBuffer&)> const& f); |
3342 | 47 | 49 | ||
3343 | === modified file 'src/platform/graphics/android/android_platform.cpp' | |||
3344 | --- src/platform/graphics/android/android_platform.cpp 2014-03-06 06:05:17 +0000 | |||
3345 | +++ src/platform/graphics/android/android_platform.cpp 2014-04-07 13:29:13 +0000 | |||
3346 | @@ -31,6 +31,8 @@ | |||
3347 | 31 | #include "mir/graphics/buffer_ipc_packer.h" | 31 | #include "mir/graphics/buffer_ipc_packer.h" |
3348 | 32 | #include "mir/graphics/display_report.h" | 32 | #include "mir/graphics/display_report.h" |
3349 | 33 | #include "mir/options/option.h" | 33 | #include "mir/options/option.h" |
3350 | 34 | #include "mir/options/configuration.h" | ||
3351 | 35 | #include "mir/abnormal_exit.h" | ||
3352 | 34 | 36 | ||
3353 | 35 | #include <boost/throw_exception.hpp> | 37 | #include <boost/throw_exception.hpp> |
3354 | 36 | #include <stdexcept> | 38 | #include <stdexcept> |
3355 | @@ -40,6 +42,26 @@ | |||
3356 | 40 | namespace mf=mir::frontend; | 42 | namespace mf=mir::frontend; |
3357 | 41 | namespace mo = mir::options; | 43 | namespace mo = mir::options; |
3358 | 42 | 44 | ||
3359 | 45 | namespace | ||
3360 | 46 | { | ||
3361 | 47 | char const* const hwc_log_opt = "hwc-report"; | ||
3362 | 48 | bool should_log_hwc(mo::Option const& options) | ||
3363 | 49 | { | ||
3364 | 50 | if (!options.is_set(hwc_log_opt)) | ||
3365 | 51 | return false; | ||
3366 | 52 | |||
3367 | 53 | auto opt = options.get<std::string>(hwc_log_opt); | ||
3368 | 54 | if (opt == mo::log_opt_value) | ||
3369 | 55 | return true; | ||
3370 | 56 | else if (opt == mo::off_opt_value) | ||
3371 | 57 | return false; | ||
3372 | 58 | else | ||
3373 | 59 | throw mir::AbnormalExit( | ||
3374 | 60 | std::string("Invalid hwc-report option: " + opt + " (valid options are: \"" + | ||
3375 | 61 | mo::off_opt_value + "\" and \"" + mo::log_opt_value + "\")")); | ||
3376 | 62 | } | ||
3377 | 63 | } | ||
3378 | 64 | |||
3379 | 43 | mga::AndroidPlatform::AndroidPlatform( | 65 | mga::AndroidPlatform::AndroidPlatform( |
3380 | 44 | std::shared_ptr<mga::DisplayBuilder> const& display_builder, | 66 | std::shared_ptr<mga::DisplayBuilder> const& display_builder, |
3381 | 45 | std::shared_ptr<mg::DisplayReport> const& display_report) | 67 | std::shared_ptr<mg::DisplayReport> const& display_report) |
3382 | @@ -61,9 +83,11 @@ | |||
3383 | 61 | } | 83 | } |
3384 | 62 | 84 | ||
3385 | 63 | std::shared_ptr<mg::Display> mga::AndroidPlatform::create_display( | 85 | std::shared_ptr<mg::Display> mga::AndroidPlatform::create_display( |
3387 | 64 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&) | 86 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, |
3388 | 87 | std::shared_ptr<mg::GLConfig> const& gl_config) | ||
3389 | 65 | { | 88 | { |
3391 | 66 | return std::make_shared<mga::AndroidDisplay>(display_builder, display_report); | 89 | return std::make_shared<mga::AndroidDisplay>( |
3392 | 90 | display_builder, gl_config, display_report); | ||
3393 | 67 | } | 91 | } |
3394 | 68 | 92 | ||
3395 | 69 | std::shared_ptr<mg::PlatformIPCPackage> mga::AndroidPlatform::get_ipc_package() | 93 | std::shared_ptr<mg::PlatformIPCPackage> mga::AndroidPlatform::get_ipc_package() |
3396 | @@ -105,10 +129,10 @@ | |||
3397 | 105 | return std::make_shared<mga::InternalClient>(); | 129 | return std::make_shared<mga::InternalClient>(); |
3398 | 106 | } | 130 | } |
3399 | 107 | 131 | ||
3401 | 108 | extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& /*options*/, std::shared_ptr<DisplayReport> const& display_report) | 132 | extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& options, std::shared_ptr<DisplayReport> const& display_report) |
3402 | 109 | { | 133 | { |
3403 | 110 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); | 134 | auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>(); |
3405 | 111 | auto display_resource_factory = std::make_shared<mga::ResourceFactory>(); | 135 | auto display_resource_factory = std::make_shared<mga::ResourceFactory>(should_log_hwc(*options)); |
3406 | 112 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); | 136 | auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer); |
3407 | 113 | auto display_builder = std::make_shared<mga::OutputBuilder>( | 137 | auto display_builder = std::make_shared<mga::OutputBuilder>( |
3408 | 114 | fb_allocator, display_resource_factory, display_report); | 138 | fb_allocator, display_resource_factory, display_report); |
3409 | @@ -121,3 +145,12 @@ | |||
3410 | 121 | // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder | 145 | // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder |
3411 | 122 | return std::make_shared<mga::AndroidPlatform>(nullptr, display_report); | 146 | return std::make_shared<mga::AndroidPlatform>(nullptr, display_report); |
3412 | 123 | } | 147 | } |
3413 | 148 | |||
3414 | 149 | extern "C" void add_platform_options( | ||
3415 | 150 | boost::program_options::options_description& config) | ||
3416 | 151 | { | ||
3417 | 152 | config.add_options() | ||
3418 | 153 | (hwc_log_opt, | ||
3419 | 154 | boost::program_options::value<std::string>()->default_value(std::string{mo::off_opt_value}), | ||
3420 | 155 | "[platform-specific] How to handle the HWC logging report. [{log,off}]"); | ||
3421 | 156 | } | ||
3422 | 124 | 157 | ||
3423 | === modified file 'src/platform/graphics/android/android_platform.h' | |||
3424 | --- src/platform/graphics/android/android_platform.h 2014-03-06 06:05:17 +0000 | |||
3425 | +++ src/platform/graphics/android/android_platform.h 2014-04-07 13:29:13 +0000 | |||
3426 | @@ -44,7 +44,8 @@ | |||
3427 | 44 | std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator( | 44 | std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator( |
3428 | 45 | std::shared_ptr<BufferInitializer> const& buffer_initializer); | 45 | std::shared_ptr<BufferInitializer> const& buffer_initializer); |
3429 | 46 | std::shared_ptr<Display> create_display( | 46 | std::shared_ptr<Display> create_display( |
3431 | 47 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&); | 47 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, |
3432 | 48 | std::shared_ptr<graphics::GLConfig> const& /*gl_config*/); | ||
3433 | 48 | std::shared_ptr<PlatformIPCPackage> get_ipc_package(); | 49 | std::shared_ptr<PlatformIPCPackage> get_ipc_package(); |
3434 | 49 | std::shared_ptr<InternalClient> create_internal_client(); | 50 | std::shared_ptr<InternalClient> create_internal_client(); |
3435 | 50 | void fill_ipc_package(BufferIPCPacker* packer, graphics::Buffer const* buffer) const; | 51 | void fill_ipc_package(BufferIPCPacker* packer, graphics::Buffer const* buffer) const; |
3436 | 51 | 52 | ||
3437 | === modified file 'src/platform/graphics/android/display_buffer.cpp' | |||
3438 | --- src/platform/graphics/android/display_buffer.cpp 2014-03-11 13:44:57 +0000 | |||
3439 | +++ src/platform/graphics/android/display_buffer.cpp 2014-04-07 13:29:13 +0000 | |||
3440 | @@ -85,7 +85,7 @@ | |||
3441 | 85 | } | 85 | } |
3442 | 86 | 86 | ||
3443 | 87 | void mga::DisplayBuffer::render_and_post_update( | 87 | void mga::DisplayBuffer::render_and_post_update( |
3445 | 88 | std::list<std::shared_ptr<Renderable>> const& renderlist, | 88 | RenderableList const& renderlist, |
3446 | 89 | std::function<void(Renderable const&)> const& render_fn) | 89 | std::function<void(Renderable const&)> const& render_fn) |
3447 | 90 | { | 90 | { |
3448 | 91 | if (renderlist.empty()) | 91 | if (renderlist.empty()) |
3449 | 92 | 92 | ||
3450 | === modified file 'src/platform/graphics/android/display_buffer.h' | |||
3451 | --- src/platform/graphics/android/display_buffer.h 2014-03-11 13:44:57 +0000 | |||
3452 | +++ src/platform/graphics/android/display_buffer.h 2014-04-07 13:29:13 +0000 | |||
3453 | @@ -50,7 +50,7 @@ | |||
3454 | 50 | bool can_bypass() const override; | 50 | bool can_bypass() const override; |
3455 | 51 | 51 | ||
3456 | 52 | void render_and_post_update( | 52 | void render_and_post_update( |
3458 | 53 | std::list<std::shared_ptr<Renderable>> const& renderlist, | 53 | RenderableList const& renderlist, |
3459 | 54 | std::function<void(Renderable const&)> const& render_fn); | 54 | std::function<void(Renderable const&)> const& render_fn); |
3460 | 55 | MirOrientation orientation() const override; | 55 | MirOrientation orientation() const override; |
3461 | 56 | 56 | ||
3462 | 57 | 57 | ||
3463 | === modified file 'src/platform/graphics/android/display_device.h' | |||
3464 | --- src/platform/graphics/android/display_device.h 2014-03-11 13:44:57 +0000 | |||
3465 | +++ src/platform/graphics/android/display_device.h 2014-04-07 13:29:13 +0000 | |||
3466 | @@ -44,7 +44,7 @@ | |||
3467 | 44 | virtual void render_gl(SwappingGLContext const& context) = 0; | 44 | virtual void render_gl(SwappingGLContext const& context) = 0; |
3468 | 45 | virtual void render_gl_and_overlays( | 45 | virtual void render_gl_and_overlays( |
3469 | 46 | SwappingGLContext const& context, | 46 | SwappingGLContext const& context, |
3471 | 47 | std::list<std::shared_ptr<Renderable>> const& list, | 47 | RenderableList const& list, |
3472 | 48 | std::function<void(Renderable const&)> const& render_fn) = 0; | 48 | std::function<void(Renderable const&)> const& render_fn) = 0; |
3473 | 49 | virtual void post(Buffer const& buffer) = 0; | 49 | virtual void post(Buffer const& buffer) = 0; |
3474 | 50 | virtual bool apply_orientation(MirOrientation orientation) const = 0; | 50 | virtual bool apply_orientation(MirOrientation orientation) const = 0; |
3475 | 51 | 51 | ||
3476 | === modified file 'src/platform/graphics/android/fb_device.cpp' | |||
3477 | --- src/platform/graphics/android/fb_device.cpp 2014-03-11 13:44:57 +0000 | |||
3478 | +++ src/platform/graphics/android/fb_device.cpp 2014-04-07 13:29:13 +0000 | |||
3479 | @@ -51,7 +51,7 @@ | |||
3480 | 51 | 51 | ||
3481 | 52 | void mga::FBDevice::render_gl_and_overlays( | 52 | void mga::FBDevice::render_gl_and_overlays( |
3482 | 53 | SwappingGLContext const& context, | 53 | SwappingGLContext const& context, |
3484 | 54 | std::list<std::shared_ptr<Renderable>> const& renderables, | 54 | RenderableList const& renderables, |
3485 | 55 | std::function<void(Renderable const&)> const& render_fn) | 55 | std::function<void(Renderable const&)> const& render_fn) |
3486 | 56 | { | 56 | { |
3487 | 57 | for(auto const& renderable : renderables) | 57 | for(auto const& renderable : renderables) |
3488 | 58 | 58 | ||
3489 | === modified file 'src/platform/graphics/android/fb_device.h' | |||
3490 | --- src/platform/graphics/android/fb_device.h 2014-03-11 13:44:57 +0000 | |||
3491 | +++ src/platform/graphics/android/fb_device.h 2014-04-07 13:29:13 +0000 | |||
3492 | @@ -40,7 +40,7 @@ | |||
3493 | 40 | virtual void render_gl(SwappingGLContext const& context); | 40 | virtual void render_gl(SwappingGLContext const& context); |
3494 | 41 | virtual void render_gl_and_overlays( | 41 | virtual void render_gl_and_overlays( |
3495 | 42 | SwappingGLContext const& context, | 42 | SwappingGLContext const& context, |
3497 | 43 | std::list<std::shared_ptr<Renderable>> const& list, | 43 | RenderableList const& list, |
3498 | 44 | std::function<void(Renderable const&)> const& render_fn); | 44 | std::function<void(Renderable const&)> const& render_fn); |
3499 | 45 | void post(Buffer const& buffer); | 45 | void post(Buffer const& buffer); |
3500 | 46 | 46 | ||
3501 | 47 | 47 | ||
3502 | === modified file 'src/platform/graphics/android/gl_context.cpp' | |||
3503 | --- src/platform/graphics/android/gl_context.cpp 2014-03-12 02:46:58 +0000 | |||
3504 | +++ src/platform/graphics/android/gl_context.cpp 2014-04-07 13:29:13 +0000 | |||
3505 | @@ -19,6 +19,7 @@ | |||
3506 | 19 | #include "gl_context.h" | 19 | #include "gl_context.h" |
3507 | 20 | #include "android_format_conversion-inl.h" | 20 | #include "android_format_conversion-inl.h" |
3508 | 21 | #include "mir/graphics/display_report.h" | 21 | #include "mir/graphics/display_report.h" |
3509 | 22 | #include "mir/graphics/gl_config.h" | ||
3510 | 22 | 23 | ||
3511 | 23 | #include <algorithm> | 24 | #include <algorithm> |
3512 | 24 | #include <boost/throw_exception.hpp> | 25 | #include <boost/throw_exception.hpp> |
3513 | @@ -31,13 +32,6 @@ | |||
3514 | 31 | namespace | 32 | namespace |
3515 | 32 | { | 33 | { |
3516 | 33 | 34 | ||
3517 | 34 | static EGLint const required_egl_config_attr [] = | ||
3518 | 35 | { | ||
3519 | 36 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | ||
3520 | 37 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | ||
3521 | 38 | EGL_NONE | ||
3522 | 39 | }; | ||
3523 | 40 | |||
3524 | 41 | static EGLint const default_egl_context_attr[] = | 35 | static EGLint const default_egl_context_attr[] = |
3525 | 42 | { | 36 | { |
3526 | 43 | EGL_CONTEXT_CLIENT_VERSION, 2, | 37 | EGL_CONTEXT_CLIENT_VERSION, 2, |
3527 | @@ -69,8 +63,19 @@ | |||
3528 | 69 | 63 | ||
3529 | 70 | /* the minimum requirement is to have EGL_WINDOW_BIT and EGL_OPENGL_ES2_BIT, and to select a config | 64 | /* the minimum requirement is to have EGL_WINDOW_BIT and EGL_OPENGL_ES2_BIT, and to select a config |
3530 | 71 | whose pixel format matches that of the framebuffer. */ | 65 | whose pixel format matches that of the framebuffer. */ |
3532 | 72 | static EGLConfig select_egl_config_with_format(EGLDisplay egl_display, MirPixelFormat display_format) | 66 | EGLConfig select_egl_config_with_format( |
3533 | 67 | EGLDisplay egl_display, MirPixelFormat display_format, | ||
3534 | 68 | mg::GLConfig const& gl_config) | ||
3535 | 73 | { | 69 | { |
3536 | 70 | EGLint const required_egl_config_attr [] = | ||
3537 | 71 | { | ||
3538 | 72 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | ||
3539 | 73 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | ||
3540 | 74 | EGL_DEPTH_SIZE, gl_config.depth_buffer_bits(), | ||
3541 | 75 | EGL_STENCIL_SIZE, gl_config.stencil_buffer_bits(), | ||
3542 | 76 | EGL_NONE | ||
3543 | 77 | }; | ||
3544 | 78 | |||
3545 | 74 | int required_visual_id = mga::to_android_format(display_format); | 79 | int required_visual_id = mga::to_android_format(display_format); |
3546 | 75 | int num_potential_configs; | 80 | int num_potential_configs; |
3547 | 76 | EGLint num_match_configs; | 81 | EGLint num_match_configs; |
3548 | @@ -107,10 +112,12 @@ | |||
3549 | 107 | return eglCreateWindowSurface(disp, config, native, NULL); | 112 | return eglCreateWindowSurface(disp, config, native, NULL); |
3550 | 108 | } | 113 | } |
3551 | 109 | 114 | ||
3553 | 110 | mga::GLContext::GLContext(MirPixelFormat display_format, mg::DisplayReport& report) | 115 | mga::GLContext::GLContext(MirPixelFormat display_format, |
3554 | 116 | mg::GLConfig const& gl_config, | ||
3555 | 117 | mg::DisplayReport& report) | ||
3556 | 111 | : egl_display(create_and_initialize_display()), | 118 | : egl_display(create_and_initialize_display()), |
3557 | 112 | own_display(true), | 119 | own_display(true), |
3559 | 113 | egl_config(select_egl_config_with_format(egl_display, display_format)), | 120 | egl_config(select_egl_config_with_format(egl_display, display_format, gl_config)), |
3560 | 114 | egl_context{egl_display, | 121 | egl_context{egl_display, |
3561 | 115 | eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)}, | 122 | eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, default_egl_context_attr)}, |
3562 | 116 | egl_surface{egl_display, | 123 | egl_surface{egl_display, |
3563 | 117 | 124 | ||
3564 | === modified file 'src/platform/graphics/android/gl_context.h' | |||
3565 | --- src/platform/graphics/android/gl_context.h 2014-03-12 02:46:58 +0000 | |||
3566 | +++ src/platform/graphics/android/gl_context.h 2014-04-07 13:29:13 +0000 | |||
3567 | @@ -29,6 +29,7 @@ | |||
3568 | 29 | namespace graphics | 29 | namespace graphics |
3569 | 30 | { | 30 | { |
3570 | 31 | class DisplayReport; | 31 | class DisplayReport; |
3571 | 32 | class GLConfig; | ||
3572 | 32 | namespace android | 33 | namespace android |
3573 | 33 | { | 34 | { |
3574 | 34 | 35 | ||
3575 | @@ -53,7 +54,9 @@ | |||
3576 | 53 | { | 54 | { |
3577 | 54 | public: | 55 | public: |
3578 | 55 | //For creating a gl context | 56 | //For creating a gl context |
3580 | 56 | GLContext(MirPixelFormat display_format, DisplayReport& report); | 57 | GLContext(MirPixelFormat display_format, |
3581 | 58 | GLConfig const& gl_config, | ||
3582 | 59 | DisplayReport& report); | ||
3583 | 57 | 60 | ||
3584 | 58 | //For creating a gl context shared with another GLContext | 61 | //For creating a gl context shared with another GLContext |
3585 | 59 | GLContext(GLContext const& shared_gl_context, | 62 | GLContext(GLContext const& shared_gl_context, |
3586 | 60 | 63 | ||
3587 | === modified file 'src/platform/graphics/android/hwc_common_device.cpp' | |||
3588 | --- src/platform/graphics/android/hwc_common_device.cpp 2014-03-11 13:44:57 +0000 | |||
3589 | +++ src/platform/graphics/android/hwc_common_device.cpp 2014-04-07 13:29:13 +0000 | |||
3590 | @@ -44,8 +44,8 @@ | |||
3591 | 44 | 44 | ||
3592 | 45 | mga::HWCCommonDevice::HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 45 | mga::HWCCommonDevice::HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3593 | 46 | std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator) | 46 | std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator) |
3596 | 47 | : hwc_device(hwc_device), | 47 | : coordinator(coordinator), |
3597 | 48 | coordinator(coordinator), | 48 | hwc_device(hwc_device), |
3598 | 49 | current_mode(mir_power_mode_on) | 49 | current_mode(mir_power_mode_on) |
3599 | 50 | { | 50 | { |
3600 | 51 | callbacks.hooks.invalidate = invalidate_hook; | 51 | callbacks.hooks.invalidate = invalidate_hook; |
3601 | 52 | 52 | ||
3602 | === modified file 'src/platform/graphics/android/hwc_common_device.h' | |||
3603 | --- src/platform/graphics/android/hwc_common_device.h 2014-03-06 06:05:17 +0000 | |||
3604 | +++ src/platform/graphics/android/hwc_common_device.h 2014-04-07 13:29:13 +0000 | |||
3605 | @@ -54,7 +54,6 @@ | |||
3606 | 54 | HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 54 | HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3607 | 55 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 55 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3608 | 56 | 56 | ||
3609 | 57 | std::shared_ptr<hwc_composer_device_1> const hwc_device; | ||
3610 | 58 | std::shared_ptr<HWCVsyncCoordinator> const coordinator; | 57 | std::shared_ptr<HWCVsyncCoordinator> const coordinator; |
3611 | 59 | std::unique_lock<std::mutex> lock_unblanked(); | 58 | std::unique_lock<std::mutex> lock_unblanked(); |
3612 | 60 | 59 | ||
3613 | @@ -64,6 +63,8 @@ | |||
3614 | 64 | 63 | ||
3615 | 65 | HWCCallbacks callbacks; | 64 | HWCCallbacks callbacks; |
3616 | 66 | 65 | ||
3617 | 66 | std::shared_ptr<hwc_composer_device_1> const hwc_device; | ||
3618 | 67 | |||
3619 | 67 | std::mutex blanked_mutex; | 68 | std::mutex blanked_mutex; |
3620 | 68 | std::condition_variable blanked_cond; | 69 | std::condition_variable blanked_cond; |
3621 | 69 | MirPowerMode current_mode; | 70 | MirPowerMode current_mode; |
3622 | 70 | 71 | ||
3623 | === modified file 'src/platform/graphics/android/hwc_device.cpp' | |||
3624 | --- src/platform/graphics/android/hwc_device.cpp 2014-03-11 13:44:57 +0000 | |||
3625 | +++ src/platform/graphics/android/hwc_device.cpp 2014-04-07 13:29:13 +0000 | |||
3626 | @@ -21,6 +21,7 @@ | |||
3627 | 21 | #include "hwc_device.h" | 21 | #include "hwc_device.h" |
3628 | 22 | #include "hwc_layerlist.h" | 22 | #include "hwc_layerlist.h" |
3629 | 23 | #include "hwc_vsync_coordinator.h" | 23 | #include "hwc_vsync_coordinator.h" |
3630 | 24 | #include "hwc_wrapper.h" | ||
3631 | 24 | #include "framebuffer_bundle.h" | 25 | #include "framebuffer_bundle.h" |
3632 | 25 | #include "buffer.h" | 26 | #include "buffer.h" |
3633 | 26 | #include "mir/graphics/buffer.h" | 27 | #include "mir/graphics/buffer.h" |
3634 | @@ -89,7 +90,7 @@ | |||
3635 | 89 | 90 | ||
3636 | 90 | void mga::HwcDevice::render_gl_and_overlays( | 91 | void mga::HwcDevice::render_gl_and_overlays( |
3637 | 91 | SwappingGLContext const& context, | 92 | SwappingGLContext const& context, |
3639 | 92 | std::list<std::shared_ptr<Renderable>> const& renderables, | 93 | RenderableList const& renderables, |
3640 | 93 | std::function<void(Renderable const&)> const& render_fn) | 94 | std::function<void(Renderable const&)> const& render_fn) |
3641 | 94 | { | 95 | { |
3642 | 95 | if (!(list_needs_commit = hwc_list.update_list_and_check_if_changed(renderables, fbtarget_size))) | 96 | if (!(list_needs_commit = hwc_list.update_list_and_check_if_changed(renderables, fbtarget_size))) |
3643 | 96 | 97 | ||
3644 | === modified file 'src/platform/graphics/android/hwc_device.h' | |||
3645 | --- src/platform/graphics/android/hwc_device.h 2014-03-11 13:44:57 +0000 | |||
3646 | +++ src/platform/graphics/android/hwc_device.h 2014-04-07 13:29:13 +0000 | |||
3647 | @@ -35,20 +35,7 @@ | |||
3648 | 35 | { | 35 | { |
3649 | 36 | class HWCVsyncCoordinator; | 36 | class HWCVsyncCoordinator; |
3650 | 37 | class SyncFileOps; | 37 | class SyncFileOps; |
3665 | 38 | 38 | class HwcWrapper; | |
3652 | 39 | class HwcWrapper | ||
3653 | 40 | { | ||
3654 | 41 | public: | ||
3655 | 42 | virtual ~HwcWrapper() = default; | ||
3656 | 43 | |||
3657 | 44 | virtual void prepare(hwc_display_contents_1_t&) const = 0; | ||
3658 | 45 | virtual void set(hwc_display_contents_1_t&) const = 0; | ||
3659 | 46 | |||
3660 | 47 | protected: | ||
3661 | 48 | HwcWrapper() = default; | ||
3662 | 49 | HwcWrapper& operator=(HwcWrapper const&) = delete; | ||
3663 | 50 | HwcWrapper(HwcWrapper const&) = delete; | ||
3664 | 51 | }; | ||
3666 | 52 | 39 | ||
3667 | 53 | class HwcDevice : public HWCCommonDevice | 40 | class HwcDevice : public HWCCommonDevice |
3668 | 54 | { | 41 | { |
3669 | @@ -63,7 +50,7 @@ | |||
3670 | 63 | virtual void render_gl(SwappingGLContext const& context); | 50 | virtual void render_gl(SwappingGLContext const& context); |
3671 | 64 | virtual void render_gl_and_overlays( | 51 | virtual void render_gl_and_overlays( |
3672 | 65 | SwappingGLContext const& context, | 52 | SwappingGLContext const& context, |
3674 | 66 | std::list<std::shared_ptr<Renderable>> const& list, | 53 | RenderableList const& list, |
3675 | 67 | std::function<void(Renderable const&)> const& render_fn); | 54 | std::function<void(Renderable const&)> const& render_fn); |
3676 | 68 | void post(Buffer const& buffer); | 55 | void post(Buffer const& buffer); |
3677 | 69 | 56 | ||
3678 | 70 | 57 | ||
3679 | === modified file 'src/platform/graphics/android/hwc_fb_device.cpp' | |||
3680 | --- src/platform/graphics/android/hwc_fb_device.cpp 2014-03-11 13:44:57 +0000 | |||
3681 | +++ src/platform/graphics/android/hwc_fb_device.cpp 2014-04-07 13:29:13 +0000 | |||
3682 | @@ -21,6 +21,7 @@ | |||
3683 | 21 | #include "hwc_vsync_coordinator.h" | 21 | #include "hwc_vsync_coordinator.h" |
3684 | 22 | #include "framebuffer_bundle.h" | 22 | #include "framebuffer_bundle.h" |
3685 | 23 | #include "android_format_conversion-inl.h" | 23 | #include "android_format_conversion-inl.h" |
3686 | 24 | #include "hwc_wrapper.h" | ||
3687 | 24 | #include "mir/graphics/buffer.h" | 25 | #include "mir/graphics/buffer.h" |
3688 | 25 | #include "mir/graphics/android/native_buffer.h" | 26 | #include "mir/graphics/android/native_buffer.h" |
3689 | 26 | 27 | ||
3690 | @@ -33,9 +34,11 @@ | |||
3691 | 33 | namespace geom = mir::geometry; | 34 | namespace geom = mir::geometry; |
3692 | 34 | 35 | ||
3693 | 35 | mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 36 | mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3694 | 37 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, | ||
3695 | 36 | std::shared_ptr<framebuffer_device_t> const& fb_device, | 38 | std::shared_ptr<framebuffer_device_t> const& fb_device, |
3696 | 37 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator) | 39 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator) |
3697 | 38 | : HWCCommonDevice(hwc_device, coordinator), | 40 | : HWCCommonDevice(hwc_device, coordinator), |
3698 | 41 | hwc_wrapper(hwc_wrapper), | ||
3699 | 39 | fb_device(fb_device), | 42 | fb_device(fb_device), |
3700 | 40 | layer_list{{},1} | 43 | layer_list{{},1} |
3701 | 41 | { | 44 | { |
3702 | @@ -44,41 +47,33 @@ | |||
3703 | 44 | 47 | ||
3704 | 45 | void mga::HwcFbDevice::gpu_render() | 48 | void mga::HwcFbDevice::gpu_render() |
3705 | 46 | { | 49 | { |
3709 | 47 | auto rc = 0; | 50 | if (auto display_list = layer_list.native_list().lock()) |
3707 | 48 | auto display_list = layer_list.native_list().lock(); | ||
3708 | 49 | if (display_list) | ||
3710 | 50 | { | 51 | { |
3711 | 51 | display_list->dpy = eglGetCurrentDisplay(); | 52 | display_list->dpy = eglGetCurrentDisplay(); |
3712 | 52 | display_list->sur = eglGetCurrentSurface(EGL_DRAW); | 53 | display_list->sur = eglGetCurrentSurface(EGL_DRAW); |
3713 | 53 | 54 | ||
3714 | 54 | //set() may affect EGL state by calling eglSwapBuffers. | 55 | //set() may affect EGL state by calling eglSwapBuffers. |
3715 | 55 | //HWC 1.0 is the only version of HWC that can do this. | 56 | //HWC 1.0 is the only version of HWC that can do this. |
3718 | 56 | hwc_display_contents_1_t* displays[num_displays] {display_list.get()}; | 57 | hwc_wrapper->set(*display_list); |
3717 | 57 | rc = hwc_device->set(hwc_device.get(), num_displays, displays); | ||
3719 | 58 | } | 58 | } |
3722 | 59 | 59 | else | |
3721 | 60 | if ((rc != 0) || (!display_list)) | ||
3723 | 61 | { | 60 | { |
3724 | 62 | std::stringstream ss; | 61 | std::stringstream ss; |
3726 | 63 | ss << "error during hwc set(). rc = " << std::hex << rc; | 62 | ss << "error locking list during hwc set()"; |
3727 | 64 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | 63 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); |
3728 | 65 | } | 64 | } |
3729 | 66 | } | 65 | } |
3730 | 67 | 66 | ||
3731 | 68 | void mga::HwcFbDevice::prepare() | 67 | void mga::HwcFbDevice::prepare() |
3732 | 69 | { | 68 | { |
3736 | 70 | auto rc = 0; | 69 | if (auto display_list = layer_list.native_list().lock()) |
3734 | 71 | auto display_list = layer_list.native_list().lock(); | ||
3735 | 72 | if (display_list) | ||
3737 | 73 | { | 70 | { |
3740 | 74 | hwc_display_contents_1_t* displays[num_displays] {display_list.get()}; | 71 | hwc_wrapper->prepare(*display_list); |
3739 | 75 | rc = hwc_device->prepare(hwc_device.get(), num_displays, displays); | ||
3741 | 76 | } | 72 | } |
3744 | 77 | 73 | else | |
3743 | 78 | if ((rc != 0) || (!display_list)) | ||
3745 | 79 | { | 74 | { |
3746 | 80 | std::stringstream ss; | 75 | std::stringstream ss; |
3748 | 81 | ss << "error during hwc prepare(). rc = " << std::hex << rc; | 76 | ss << "error accessing list during hwc prepare()"; |
3749 | 82 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | 77 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); |
3750 | 83 | } | 78 | } |
3751 | 84 | } | 79 | } |
3752 | @@ -91,7 +86,7 @@ | |||
3753 | 91 | 86 | ||
3754 | 92 | void mga::HwcFbDevice::render_gl_and_overlays( | 87 | void mga::HwcFbDevice::render_gl_and_overlays( |
3755 | 93 | SwappingGLContext const&, | 88 | SwappingGLContext const&, |
3757 | 94 | std::list<std::shared_ptr<Renderable>> const& renderables, | 89 | RenderableList const& renderables, |
3758 | 95 | std::function<void(Renderable const&)> const& render_fn) | 90 | std::function<void(Renderable const&)> const& render_fn) |
3759 | 96 | { | 91 | { |
3760 | 97 | prepare(); | 92 | prepare(); |
3761 | 98 | 93 | ||
3762 | === modified file 'src/platform/graphics/android/hwc_fb_device.h' | |||
3763 | --- src/platform/graphics/android/hwc_fb_device.h 2014-03-11 13:44:57 +0000 | |||
3764 | +++ src/platform/graphics/android/hwc_fb_device.h 2014-04-07 13:29:13 +0000 | |||
3765 | @@ -30,24 +30,28 @@ | |||
3766 | 30 | { | 30 | { |
3767 | 31 | namespace android | 31 | namespace android |
3768 | 32 | { | 32 | { |
3769 | 33 | class HwcWrapper; | ||
3770 | 33 | 34 | ||
3771 | 34 | class HwcFbDevice : public HWCCommonDevice | 35 | class HwcFbDevice : public HWCCommonDevice |
3772 | 35 | { | 36 | { |
3773 | 36 | public: | 37 | public: |
3774 | 37 | HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 38 | HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3775 | 39 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, | ||
3776 | 38 | std::shared_ptr<framebuffer_device_t> const& fb_device, | 40 | std::shared_ptr<framebuffer_device_t> const& fb_device, |
3777 | 39 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 41 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3778 | 40 | 42 | ||
3779 | 41 | virtual void render_gl(SwappingGLContext const& context); | 43 | virtual void render_gl(SwappingGLContext const& context); |
3780 | 42 | virtual void render_gl_and_overlays( | 44 | virtual void render_gl_and_overlays( |
3781 | 43 | SwappingGLContext const& context, | 45 | SwappingGLContext const& context, |
3783 | 44 | std::list<std::shared_ptr<Renderable>> const& list, | 46 | RenderableList const& list, |
3784 | 45 | std::function<void(Renderable const&)> const& render_fn); | 47 | std::function<void(Renderable const&)> const& render_fn); |
3785 | 46 | void post(Buffer const& buffer); | 48 | void post(Buffer const& buffer); |
3786 | 47 | 49 | ||
3787 | 48 | private: | 50 | private: |
3788 | 49 | void prepare(); | 51 | void prepare(); |
3789 | 50 | void gpu_render(); | 52 | void gpu_render(); |
3790 | 53 | |||
3791 | 54 | std::shared_ptr<HwcWrapper> const hwc_wrapper; | ||
3792 | 51 | std::shared_ptr<framebuffer_device_t> const fb_device; | 55 | std::shared_ptr<framebuffer_device_t> const fb_device; |
3793 | 52 | static int const num_displays{1}; | 56 | static int const num_displays{1}; |
3794 | 53 | LayerList layer_list; | 57 | LayerList layer_list; |
3795 | 54 | 58 | ||
3796 | === added file 'src/platform/graphics/android/hwc_formatted_logger.cpp' | |||
3797 | --- src/platform/graphics/android/hwc_formatted_logger.cpp 1970-01-01 00:00:00 +0000 | |||
3798 | +++ src/platform/graphics/android/hwc_formatted_logger.cpp 2014-04-07 13:29:13 +0000 | |||
3799 | @@ -0,0 +1,177 @@ | |||
3800 | 1 | /* | ||
3801 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3802 | 3 | * | ||
3803 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3804 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3805 | 6 | * as published by the Free Software Foundation. | ||
3806 | 7 | * | ||
3807 | 8 | * This program is distributed in the hope that it will be useful, | ||
3808 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3809 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3810 | 11 | * GNU Lesser General Public License for more details. | ||
3811 | 12 | * | ||
3812 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3813 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3814 | 15 | * | ||
3815 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
3816 | 17 | */ | ||
3817 | 18 | |||
3818 | 19 | #include "hwc_formatted_logger.h" | ||
3819 | 20 | #include <iostream> | ||
3820 | 21 | #include <iomanip> | ||
3821 | 22 | |||
3822 | 23 | namespace mga=mir::graphics::android; | ||
3823 | 24 | |||
3824 | 25 | namespace | ||
3825 | 26 | { | ||
3826 | 27 | std::string const separator{" | "}; | ||
3827 | 28 | int const layer_num_column_size{2}; | ||
3828 | 29 | int const blending_column_size{8}; | ||
3829 | 30 | int const rotation_column_size{9}; | ||
3830 | 31 | int const rect_entry_column_size{4}; | ||
3831 | 32 | int const type_column_size{9}; | ||
3832 | 33 | |||
3833 | 34 | class StreamFormatter | ||
3834 | 35 | { | ||
3835 | 36 | public: | ||
3836 | 37 | StreamFormatter(std::ostream& str, unsigned int const width, std::ios_base::fmtflags flags) | ||
3837 | 38 | : stream(str), | ||
3838 | 39 | old_width(stream.width(width)), | ||
3839 | 40 | old_flags(stream.setf(flags,std::ios::adjustfield)) | ||
3840 | 41 | { | ||
3841 | 42 | } | ||
3842 | 43 | |||
3843 | 44 | ~StreamFormatter() | ||
3844 | 45 | { | ||
3845 | 46 | stream.setf(old_flags, std::ios::adjustfield); | ||
3846 | 47 | stream.width(old_width); | ||
3847 | 48 | } | ||
3848 | 49 | private: | ||
3849 | 50 | std::ostream& stream; | ||
3850 | 51 | unsigned int const old_width; | ||
3851 | 52 | std::ios_base::fmtflags const old_flags; | ||
3852 | 53 | }; | ||
3853 | 54 | |||
3854 | 55 | struct LayerNumber{ unsigned int const num; }; | ||
3855 | 56 | std::ostream& operator<<(std::ostream& str, LayerNumber l) | ||
3856 | 57 | { | ||
3857 | 58 | StreamFormatter stream_format(str, layer_num_column_size, std::ios_base::right); | ||
3858 | 59 | return str << l.num % 100; | ||
3859 | 60 | } | ||
3860 | 61 | |||
3861 | 62 | struct HwcRotation{ unsigned int const key; }; | ||
3862 | 63 | std::ostream& operator<<(std::ostream& str, HwcRotation rotation_key) | ||
3863 | 64 | { | ||
3864 | 65 | StreamFormatter stream_format(str, rotation_column_size, std::ios_base::left); | ||
3865 | 66 | switch(rotation_key.key) | ||
3866 | 67 | { | ||
3867 | 68 | case 0: | ||
3868 | 69 | return str << std::string{"NONE"}; | ||
3869 | 70 | case HWC_TRANSFORM_ROT_90: | ||
3870 | 71 | return str << std::string{"ROT_90"}; | ||
3871 | 72 | case HWC_TRANSFORM_ROT_180: | ||
3872 | 73 | return str << std::string{"ROT_180"}; | ||
3873 | 74 | case HWC_TRANSFORM_ROT_270: | ||
3874 | 75 | return str << std::string{"ROT_270"}; | ||
3875 | 76 | default: | ||
3876 | 77 | return str << std::string{"UNKNOWN"}; | ||
3877 | 78 | } | ||
3878 | 79 | } | ||
3879 | 80 | |||
3880 | 81 | struct HwcBlending{ int const key; }; | ||
3881 | 82 | std::ostream& operator<<(std::ostream& str, HwcBlending blending_key) | ||
3882 | 83 | { | ||
3883 | 84 | StreamFormatter stream_format(str, blending_column_size, std::ios_base::left); | ||
3884 | 85 | switch(blending_key.key) | ||
3885 | 86 | { | ||
3886 | 87 | case HWC_BLENDING_NONE: | ||
3887 | 88 | return str << std::string{"NONE"}; | ||
3888 | 89 | case HWC_BLENDING_PREMULT: | ||
3889 | 90 | return str << std::string{"PREMULT"}; | ||
3890 | 91 | case HWC_BLENDING_COVERAGE: | ||
3891 | 92 | return str << std::string{"COVERAGE"}; | ||
3892 | 93 | default: | ||
3893 | 94 | return str << std::string{"UNKNOWN"}; | ||
3894 | 95 | } | ||
3895 | 96 | } | ||
3896 | 97 | |||
3897 | 98 | struct HwcType{ int const type; unsigned int const flags; }; | ||
3898 | 99 | std::ostream& operator<<(std::ostream& str, HwcType type) | ||
3899 | 100 | { | ||
3900 | 101 | StreamFormatter stream_format(str, type_column_size, std::ios_base::left); | ||
3901 | 102 | switch(type.type) | ||
3902 | 103 | { | ||
3903 | 104 | case HWC_OVERLAY: | ||
3904 | 105 | return str << std::string{"OVERLAY"}; | ||
3905 | 106 | case HWC_FRAMEBUFFER: | ||
3906 | 107 | if (type.flags == HWC_SKIP_LAYER) | ||
3907 | 108 | return str << std::string{"FORCE_GL"}; | ||
3908 | 109 | else | ||
3909 | 110 | return str << std::string{"GL_RENDER"}; | ||
3910 | 111 | case HWC_FRAMEBUFFER_TARGET: | ||
3911 | 112 | return str << std::string{"FB_TARGET"}; | ||
3912 | 113 | default: | ||
3913 | 114 | return str << std::string{"UNKNOWN"}; | ||
3914 | 115 | } | ||
3915 | 116 | } | ||
3916 | 117 | |||
3917 | 118 | struct HwcRectMember { int member; }; | ||
3918 | 119 | std::ostream& operator<<(std::ostream& str, HwcRectMember rect) | ||
3919 | 120 | { | ||
3920 | 121 | StreamFormatter stream_format(str, rect_entry_column_size, std::ios_base::right); | ||
3921 | 122 | return str << rect.member; | ||
3922 | 123 | } | ||
3923 | 124 | |||
3924 | 125 | struct HwcRect { hwc_rect_t const& rect; }; | ||
3925 | 126 | std::ostream& operator<<(std::ostream& str, HwcRect r) | ||
3926 | 127 | { | ||
3927 | 128 | return str << "{" | ||
3928 | 129 | << HwcRectMember{r.rect.left} << "," | ||
3929 | 130 | << HwcRectMember{r.rect.top} << "," | ||
3930 | 131 | << HwcRectMember{r.rect.right} << "," | ||
3931 | 132 | << HwcRectMember{r.rect.bottom} << "}"; | ||
3932 | 133 | } | ||
3933 | 134 | } | ||
3934 | 135 | |||
3935 | 136 | void mga::HwcFormattedLogger::log_list_submitted_to_prepare(hwc_display_contents_1_t const& list) const | ||
3936 | 137 | { | ||
3937 | 138 | std::cout << "before prepare():" << std::endl | ||
3938 | 139 | << " # | pos {l,t,r,b} | crop {l,t,r,b} | transform | blending | " | ||
3939 | 140 | << std::endl; | ||
3940 | 141 | for(auto i = 0u; i < list.numHwLayers; i++) | ||
3941 | 142 | std::cout << LayerNumber{i} | ||
3942 | 143 | << separator | ||
3943 | 144 | << HwcRect{list.hwLayers[i].displayFrame} | ||
3944 | 145 | << separator | ||
3945 | 146 | << HwcRect{list.hwLayers[i].sourceCrop} | ||
3946 | 147 | << separator | ||
3947 | 148 | << HwcRotation{list.hwLayers[i].transform} | ||
3948 | 149 | << separator | ||
3949 | 150 | << HwcBlending{list.hwLayers[i].blending} | ||
3950 | 151 | << separator | ||
3951 | 152 | << std::endl; | ||
3952 | 153 | } | ||
3953 | 154 | |||
3954 | 155 | void mga::HwcFormattedLogger::log_prepare_done(hwc_display_contents_1_t const& list) const | ||
3955 | 156 | { | ||
3956 | 157 | std::cout << "after prepare():" << std::endl | ||
3957 | 158 | << " # | Type | " << std::endl; | ||
3958 | 159 | for(auto i = 0u; i < list.numHwLayers; i++) | ||
3959 | 160 | std::cout << LayerNumber{i} | ||
3960 | 161 | << separator | ||
3961 | 162 | << HwcType{list.hwLayers[i].compositionType,list.hwLayers[i].flags} | ||
3962 | 163 | << separator | ||
3963 | 164 | << std::endl; | ||
3964 | 165 | } | ||
3965 | 166 | |||
3966 | 167 | void mga::HwcFormattedLogger::log_set_list(hwc_display_contents_1_t const& list) const | ||
3967 | 168 | { | ||
3968 | 169 | std::cout << "set list():" << std::endl | ||
3969 | 170 | << " # | handle" << std::endl; | ||
3970 | 171 | |||
3971 | 172 | for(auto i = 0u; i < list.numHwLayers; i++) | ||
3972 | 173 | std::cout << LayerNumber{i} | ||
3973 | 174 | << separator | ||
3974 | 175 | << list.hwLayers[i].handle | ||
3975 | 176 | << std::endl; | ||
3976 | 177 | } | ||
3977 | 0 | 178 | ||
3978 | === added file 'src/platform/graphics/android/hwc_formatted_logger.h' | |||
3979 | --- src/platform/graphics/android/hwc_formatted_logger.h 1970-01-01 00:00:00 +0000 | |||
3980 | +++ src/platform/graphics/android/hwc_formatted_logger.h 2014-04-07 13:29:13 +0000 | |||
3981 | @@ -0,0 +1,41 @@ | |||
3982 | 1 | /* | ||
3983 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3984 | 3 | * | ||
3985 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3986 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3987 | 6 | * as published by the Free Software Foundation. | ||
3988 | 7 | * | ||
3989 | 8 | * This program is distributed in the hope that it will be useful, | ||
3990 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3991 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3992 | 11 | * GNU Lesser General Public License for more details. | ||
3993 | 12 | * | ||
3994 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3995 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3996 | 15 | * | ||
3997 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
3998 | 17 | */ | ||
3999 | 18 | |||
4000 | 19 | #ifndef MIR_GRAPHICS_ANDROID_HWC_FORMATTED_LOGGER_H_ | ||
4001 | 20 | #define MIR_GRAPHICS_ANDROID_HWC_FORMATTED_LOGGER_H_ | ||
4002 | 21 | |||
4003 | 22 | #include "hwc_logger.h" | ||
4004 | 23 | |||
4005 | 24 | namespace mir | ||
4006 | 25 | { | ||
4007 | 26 | namespace graphics | ||
4008 | 27 | { | ||
4009 | 28 | namespace android | ||
4010 | 29 | { | ||
4011 | 30 | class HwcFormattedLogger : public HwcLogger | ||
4012 | 31 | { | ||
4013 | 32 | public: | ||
4014 | 33 | HwcFormattedLogger() = default; | ||
4015 | 34 | void log_list_submitted_to_prepare(hwc_display_contents_1_t const& list) const override; | ||
4016 | 35 | void log_prepare_done(hwc_display_contents_1_t const& list) const override; | ||
4017 | 36 | void log_set_list(hwc_display_contents_1_t const& list) const override; | ||
4018 | 37 | }; | ||
4019 | 38 | } | ||
4020 | 39 | } | ||
4021 | 40 | } | ||
4022 | 41 | #endif /* MIR_GRAPHICS_ANDROID_HWC_FORMATTED_LOGGER_H_ */ | ||
4023 | 0 | 42 | ||
4024 | === modified file 'src/platform/graphics/android/hwc_layerlist.cpp' | |||
4025 | --- src/platform/graphics/android/hwc_layerlist.cpp 2014-03-17 07:35:22 +0000 | |||
4026 | +++ src/platform/graphics/android/hwc_layerlist.cpp 2014-04-07 13:29:13 +0000 | |||
4027 | @@ -52,7 +52,7 @@ | |||
4028 | 52 | } | 52 | } |
4029 | 53 | 53 | ||
4030 | 54 | bool mga::LayerList::update_list_and_check_if_changed( | 54 | bool mga::LayerList::update_list_and_check_if_changed( |
4032 | 55 | std::list<std::shared_ptr<mg::Renderable>> const& renderlist, | 55 | RenderableList const& renderlist, |
4033 | 56 | size_t additional_layers) | 56 | size_t additional_layers) |
4034 | 57 | { | 57 | { |
4035 | 58 | size_t needed_size = renderlist.size() + additional_layers; | 58 | size_t needed_size = renderlist.size() + additional_layers; |
4036 | @@ -70,7 +70,7 @@ | |||
4037 | 70 | { | 70 | { |
4038 | 71 | layers_it->set_render_parameters( | 71 | layers_it->set_render_parameters( |
4039 | 72 | renderable->screen_position(), renderable->alpha_enabled()); | 72 | renderable->screen_position(), renderable->alpha_enabled()); |
4041 | 73 | layers_it->set_buffer(*renderable->buffer(1));// TODO: remove needing to know about frameno | 73 | layers_it->set_buffer(*renderable->buffer(this)); |
4042 | 74 | any_buffer_updated |= layers_it->needs_hwc_commit(); | 74 | any_buffer_updated |= layers_it->needs_hwc_commit(); |
4043 | 75 | layers_it++; | 75 | layers_it++; |
4044 | 76 | } | 76 | } |
4045 | @@ -88,7 +88,7 @@ | |||
4046 | 88 | renderable->screen_position(), | 88 | renderable->screen_position(), |
4047 | 89 | renderable->alpha_enabled(), | 89 | renderable->alpha_enabled(), |
4048 | 90 | hwc_representation, i++)); | 90 | hwc_representation, i++)); |
4050 | 91 | new_layers.back().set_buffer(*renderable->buffer(1));// TODO: remove needing to know about frameno | 91 | new_layers.back().set_buffer(*renderable->buffer(this)); |
4051 | 92 | } | 92 | } |
4052 | 93 | 93 | ||
4053 | 94 | for(; i < needed_size; i++) | 94 | for(; i < needed_size; i++) |
4054 | @@ -137,7 +137,7 @@ | |||
4055 | 137 | } | 137 | } |
4056 | 138 | 138 | ||
4057 | 139 | mga::LayerList::LayerList( | 139 | mga::LayerList::LayerList( |
4059 | 140 | std::list<std::shared_ptr<mg::Renderable>> const& renderlist, | 140 | RenderableList const& renderlist, |
4060 | 141 | size_t additional_layers) | 141 | size_t additional_layers) |
4061 | 142 | { | 142 | { |
4062 | 143 | update_list_and_check_if_changed(renderlist, additional_layers); | 143 | update_list_and_check_if_changed(renderlist, additional_layers); |
4063 | 144 | 144 | ||
4064 | === modified file 'src/platform/graphics/android/hwc_layerlist.h' | |||
4065 | --- src/platform/graphics/android/hwc_layerlist.h 2014-03-11 13:44:57 +0000 | |||
4066 | +++ src/platform/graphics/android/hwc_layerlist.h 2014-04-07 13:29:13 +0000 | |||
4067 | @@ -48,9 +48,9 @@ | |||
4068 | 48 | class LayerList | 48 | class LayerList |
4069 | 49 | { | 49 | { |
4070 | 50 | public: | 50 | public: |
4072 | 51 | LayerList(std::list<std::shared_ptr<Renderable>> const& renderlist, size_t additional_layers); | 51 | LayerList(RenderableList const& renderlist, size_t additional_layers); |
4073 | 52 | bool update_list_and_check_if_changed( | 52 | bool update_list_and_check_if_changed( |
4075 | 53 | std::list<std::shared_ptr<Renderable>> const& renderlist, | 53 | RenderableList const& renderlist, |
4076 | 54 | size_t additional_layers); | 54 | size_t additional_layers); |
4077 | 55 | 55 | ||
4078 | 56 | std::list<HWCLayer>::iterator begin(); | 56 | std::list<HWCLayer>::iterator begin(); |
4079 | 57 | 57 | ||
4080 | === added file 'src/platform/graphics/android/hwc_logger.h' | |||
4081 | --- src/platform/graphics/android/hwc_logger.h 1970-01-01 00:00:00 +0000 | |||
4082 | +++ src/platform/graphics/android/hwc_logger.h 2014-04-07 13:29:13 +0000 | |||
4083 | @@ -0,0 +1,46 @@ | |||
4084 | 1 | /* | ||
4085 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4086 | 3 | * | ||
4087 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4088 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4089 | 6 | * as published by the Free Software Foundation. | ||
4090 | 7 | * | ||
4091 | 8 | * This program is distributed in the hope that it will be useful, | ||
4092 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4093 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4094 | 11 | * GNU Lesser General Public License for more details. | ||
4095 | 12 | * | ||
4096 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4097 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4098 | 15 | * | ||
4099 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
4100 | 17 | */ | ||
4101 | 18 | |||
4102 | 19 | #ifndef MIR_GRAPHICS_ANDROID_HWC_LOGGER_H_ | ||
4103 | 20 | #define MIR_GRAPHICS_ANDROID_HWC_LOGGER_H_ | ||
4104 | 21 | |||
4105 | 22 | #include <hardware/hwcomposer.h> | ||
4106 | 23 | |||
4107 | 24 | namespace mir | ||
4108 | 25 | { | ||
4109 | 26 | namespace graphics | ||
4110 | 27 | { | ||
4111 | 28 | namespace android | ||
4112 | 29 | { | ||
4113 | 30 | class HwcLogger | ||
4114 | 31 | { | ||
4115 | 32 | public: | ||
4116 | 33 | virtual ~HwcLogger() = default; | ||
4117 | 34 | |||
4118 | 35 | virtual void log_list_submitted_to_prepare(hwc_display_contents_1_t const& list) const = 0; | ||
4119 | 36 | virtual void log_prepare_done(hwc_display_contents_1_t const& list) const = 0; | ||
4120 | 37 | virtual void log_set_list(hwc_display_contents_1_t const& list) const = 0; | ||
4121 | 38 | protected: | ||
4122 | 39 | HwcLogger() = default; | ||
4123 | 40 | HwcLogger& operator=(HwcLogger const&) = delete; | ||
4124 | 41 | HwcLogger(HwcLogger const&) = delete; | ||
4125 | 42 | }; | ||
4126 | 43 | } | ||
4127 | 44 | } | ||
4128 | 45 | } | ||
4129 | 46 | #endif /* MIR_GRAPHICS_ANDROID_HWC_LOGGER_H_ */ | ||
4130 | 0 | 47 | ||
4131 | === added file 'src/platform/graphics/android/hwc_wrapper.h' | |||
4132 | --- src/platform/graphics/android/hwc_wrapper.h 1970-01-01 00:00:00 +0000 | |||
4133 | +++ src/platform/graphics/android/hwc_wrapper.h 2014-04-07 13:29:13 +0000 | |||
4134 | @@ -0,0 +1,47 @@ | |||
4135 | 1 | /* | ||
4136 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4137 | 3 | * | ||
4138 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4139 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4140 | 6 | * as published by the Free Software Foundation. | ||
4141 | 7 | * | ||
4142 | 8 | * This program is distributed in the hope that it will be useful, | ||
4143 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4144 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4145 | 11 | * GNU Lesser General Public License for more details. | ||
4146 | 12 | * | ||
4147 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4148 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4149 | 15 | * | ||
4150 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
4151 | 17 | */ | ||
4152 | 18 | |||
4153 | 19 | #ifndef MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_ | ||
4154 | 20 | #define MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_ | ||
4155 | 21 | |||
4156 | 22 | #include <hardware/hwcomposer.h> | ||
4157 | 23 | |||
4158 | 24 | namespace mir | ||
4159 | 25 | { | ||
4160 | 26 | namespace graphics | ||
4161 | 27 | { | ||
4162 | 28 | namespace android | ||
4163 | 29 | { | ||
4164 | 30 | class HwcWrapper | ||
4165 | 31 | { | ||
4166 | 32 | public: | ||
4167 | 33 | virtual ~HwcWrapper() = default; | ||
4168 | 34 | |||
4169 | 35 | virtual void prepare(hwc_display_contents_1_t&) const = 0; | ||
4170 | 36 | virtual void set(hwc_display_contents_1_t&) const = 0; | ||
4171 | 37 | |||
4172 | 38 | protected: | ||
4173 | 39 | HwcWrapper() = default; | ||
4174 | 40 | HwcWrapper& operator=(HwcWrapper const&) = delete; | ||
4175 | 41 | HwcWrapper(HwcWrapper const&) = delete; | ||
4176 | 42 | }; | ||
4177 | 43 | } | ||
4178 | 44 | } | ||
4179 | 45 | } | ||
4180 | 46 | |||
4181 | 47 | #endif /* MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_ */ | ||
4182 | 0 | 48 | ||
4183 | === modified file 'src/platform/graphics/android/real_hwc_wrapper.cpp' | |||
4184 | --- src/platform/graphics/android/real_hwc_wrapper.cpp 2014-02-26 22:22:15 +0000 | |||
4185 | +++ src/platform/graphics/android/real_hwc_wrapper.cpp 2014-04-07 13:29:13 +0000 | |||
4186 | @@ -17,14 +17,18 @@ | |||
4187 | 17 | */ | 17 | */ |
4188 | 18 | 18 | ||
4189 | 19 | #include "real_hwc_wrapper.h" | 19 | #include "real_hwc_wrapper.h" |
4190 | 20 | #include "hwc_logger.h" | ||
4191 | 20 | #include <boost/throw_exception.hpp> | 21 | #include <boost/throw_exception.hpp> |
4192 | 21 | #include <stdexcept> | 22 | #include <stdexcept> |
4193 | 22 | #include <sstream> | 23 | #include <sstream> |
4194 | 23 | 24 | ||
4195 | 24 | namespace mga=mir::graphics::android; | 25 | namespace mga=mir::graphics::android; |
4196 | 25 | 26 | ||
4199 | 26 | mga::RealHwcWrapper::RealHwcWrapper(std::shared_ptr<hwc_composer_device_1> const& hwc_device) | 27 | mga::RealHwcWrapper::RealHwcWrapper( |
4200 | 27 | : hwc_device(hwc_device) | 28 | std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
4201 | 29 | std::shared_ptr<mga::HwcLogger> const& logger) | ||
4202 | 30 | : hwc_device(hwc_device), | ||
4203 | 31 | logger(logger) | ||
4204 | 28 | { | 32 | { |
4205 | 29 | } | 33 | } |
4206 | 30 | 34 | ||
4207 | @@ -33,17 +37,22 @@ | |||
4208 | 33 | //note, although we only have a primary display right now, | 37 | //note, although we only have a primary display right now, |
4209 | 34 | // set the external and virtual displays to null as some drivers check for that | 38 | // set the external and virtual displays to null as some drivers check for that |
4210 | 35 | hwc_display_contents_1_t* displays[num_displays] {&display_list, nullptr, nullptr}; | 39 | hwc_display_contents_1_t* displays[num_displays] {&display_list, nullptr, nullptr}; |
4211 | 40 | |||
4212 | 41 | logger->log_list_submitted_to_prepare(display_list); | ||
4213 | 36 | if (auto rc = hwc_device->prepare(hwc_device.get(), 1, displays)) | 42 | if (auto rc = hwc_device->prepare(hwc_device.get(), 1, displays)) |
4214 | 37 | { | 43 | { |
4215 | 38 | std::stringstream ss; | 44 | std::stringstream ss; |
4216 | 39 | ss << "error during hwc prepare(). rc = " << std::hex << rc; | 45 | ss << "error during hwc prepare(). rc = " << std::hex << rc; |
4217 | 40 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | 46 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); |
4218 | 41 | } | 47 | } |
4219 | 48 | logger->log_prepare_done(display_list); | ||
4220 | 42 | } | 49 | } |
4221 | 43 | 50 | ||
4222 | 44 | void mga::RealHwcWrapper::set(hwc_display_contents_1_t& display_list) const | 51 | void mga::RealHwcWrapper::set(hwc_display_contents_1_t& display_list) const |
4223 | 45 | { | 52 | { |
4224 | 46 | hwc_display_contents_1_t* displays[num_displays] {&display_list, nullptr, nullptr}; | 53 | hwc_display_contents_1_t* displays[num_displays] {&display_list, nullptr, nullptr}; |
4225 | 54 | |||
4226 | 55 | logger->log_set_list(display_list); | ||
4227 | 47 | if (auto rc = hwc_device->set(hwc_device.get(), 1, displays)) | 56 | if (auto rc = hwc_device->set(hwc_device.get(), 1, displays)) |
4228 | 48 | { | 57 | { |
4229 | 49 | std::stringstream ss; | 58 | std::stringstream ss; |
4230 | 50 | 59 | ||
4231 | === modified file 'src/platform/graphics/android/real_hwc_wrapper.h' | |||
4232 | --- src/platform/graphics/android/real_hwc_wrapper.h 2014-02-20 22:20:34 +0000 | |||
4233 | +++ src/platform/graphics/android/real_hwc_wrapper.h 2014-04-07 13:29:13 +0000 | |||
4234 | @@ -19,7 +19,7 @@ | |||
4235 | 19 | #ifndef MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ | 19 | #ifndef MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ |
4236 | 20 | #define MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ | 20 | #define MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ |
4237 | 21 | 21 | ||
4239 | 22 | #include "hwc_device.h" | 22 | #include "hwc_wrapper.h" |
4240 | 23 | #include <memory> | 23 | #include <memory> |
4241 | 24 | #include <hardware/hwcomposer.h> | 24 | #include <hardware/hwcomposer.h> |
4242 | 25 | 25 | ||
4243 | @@ -29,17 +29,20 @@ | |||
4244 | 29 | { | 29 | { |
4245 | 30 | namespace android | 30 | namespace android |
4246 | 31 | { | 31 | { |
4248 | 32 | 32 | class HwcLogger; | |
4249 | 33 | class RealHwcWrapper : public HwcWrapper | 33 | class RealHwcWrapper : public HwcWrapper |
4250 | 34 | { | 34 | { |
4251 | 35 | public: | 35 | public: |
4253 | 36 | RealHwcWrapper(std::shared_ptr<hwc_composer_device_1> const& hwc_device); | 36 | RealHwcWrapper( |
4254 | 37 | std::shared_ptr<hwc_composer_device_1> const& hwc_device, | ||
4255 | 38 | std::shared_ptr<HwcLogger> const& logger); | ||
4256 | 37 | 39 | ||
4257 | 38 | void prepare(hwc_display_contents_1_t&) const override; | 40 | void prepare(hwc_display_contents_1_t&) const override; |
4258 | 39 | void set(hwc_display_contents_1_t&) const override; | 41 | void set(hwc_display_contents_1_t&) const override; |
4259 | 40 | private: | 42 | private: |
4260 | 41 | static size_t const num_displays{3}; //primary, external, virtual | 43 | static size_t const num_displays{3}; //primary, external, virtual |
4261 | 42 | std::shared_ptr<hwc_composer_device_1> const hwc_device; | 44 | std::shared_ptr<hwc_composer_device_1> const hwc_device; |
4262 | 45 | std::shared_ptr<HwcLogger> const logger; | ||
4263 | 43 | }; | 46 | }; |
4264 | 44 | 47 | ||
4265 | 45 | } | 48 | } |
4266 | 46 | 49 | ||
4267 | === modified file 'src/platform/graphics/android/resource_factory.cpp' | |||
4268 | --- src/platform/graphics/android/resource_factory.cpp 2014-03-11 13:44:57 +0000 | |||
4269 | +++ src/platform/graphics/android/resource_factory.cpp 2014-04-07 13:29:13 +0000 | |||
4270 | @@ -31,6 +31,7 @@ | |||
4271 | 31 | #include "hwc_vsync.h" | 31 | #include "hwc_vsync.h" |
4272 | 32 | #include "android_display.h" | 32 | #include "android_display.h" |
4273 | 33 | #include "real_hwc_wrapper.h" | 33 | #include "real_hwc_wrapper.h" |
4274 | 34 | #include "hwc_formatted_logger.h" | ||
4275 | 34 | 35 | ||
4276 | 35 | #include <boost/throw_exception.hpp> | 36 | #include <boost/throw_exception.hpp> |
4277 | 36 | #include <stdexcept> | 37 | #include <stdexcept> |
4278 | @@ -39,6 +40,11 @@ | |||
4279 | 39 | namespace mg = mir::graphics; | 40 | namespace mg = mir::graphics; |
4280 | 40 | namespace mga=mir::graphics::android; | 41 | namespace mga=mir::graphics::android; |
4281 | 41 | 42 | ||
4282 | 43 | mga::ResourceFactory::ResourceFactory(bool should_log_hwc) | ||
4283 | 44 | : should_log_hwc{should_log_hwc} | ||
4284 | 45 | { | ||
4285 | 46 | } | ||
4286 | 47 | |||
4287 | 42 | std::shared_ptr<framebuffer_device_t> mga::ResourceFactory::create_fb_native_device() const | 48 | std::shared_ptr<framebuffer_device_t> mga::ResourceFactory::create_fb_native_device() const |
4288 | 43 | { | 49 | { |
4289 | 44 | hw_module_t const* module; | 50 | hw_module_t const* module; |
4290 | @@ -89,12 +95,37 @@ | |||
4291 | 89 | return std::make_shared<mga::FBDevice>(fb_native_device); | 95 | return std::make_shared<mga::FBDevice>(fb_native_device); |
4292 | 90 | } | 96 | } |
4293 | 91 | 97 | ||
4294 | 98 | namespace | ||
4295 | 99 | { | ||
4296 | 100 | struct NullHwcLogger : public mga::HwcLogger | ||
4297 | 101 | { | ||
4298 | 102 | void log_list_submitted_to_prepare(hwc_display_contents_1_t const&) const override | ||
4299 | 103 | { | ||
4300 | 104 | } | ||
4301 | 105 | void log_prepare_done(hwc_display_contents_1_t const&) const override | ||
4302 | 106 | { | ||
4303 | 107 | } | ||
4304 | 108 | void log_set_list(hwc_display_contents_1_t const&) const override | ||
4305 | 109 | { | ||
4306 | 110 | } | ||
4307 | 111 | }; | ||
4308 | 112 | |||
4309 | 113 | std::shared_ptr<mga::HwcLogger> make_logger(bool should_log) | ||
4310 | 114 | { | ||
4311 | 115 | if (should_log) | ||
4312 | 116 | return std::make_shared<mga::HwcFormattedLogger>(); | ||
4313 | 117 | else | ||
4314 | 118 | return std::make_shared<NullHwcLogger>(); | ||
4315 | 119 | } | ||
4316 | 120 | |||
4317 | 121 | } | ||
4318 | 122 | |||
4319 | 92 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_device( | 123 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_device( |
4320 | 93 | std::shared_ptr<hwc_composer_device_1> const& hwc_native_device) const | 124 | std::shared_ptr<hwc_composer_device_1> const& hwc_native_device) const |
4321 | 94 | { | 125 | { |
4322 | 95 | auto syncer = std::make_shared<mga::HWCVsync>(); | 126 | auto syncer = std::make_shared<mga::HWCVsync>(); |
4323 | 96 | auto file_ops = std::make_shared<mga::RealSyncFileOps>(); | 127 | auto file_ops = std::make_shared<mga::RealSyncFileOps>(); |
4325 | 97 | auto wrapper = std::make_shared<mga::RealHwcWrapper>(hwc_native_device); | 128 | auto wrapper = std::make_shared<mga::RealHwcWrapper>(hwc_native_device, make_logger(should_log_hwc)); |
4326 | 98 | return std::make_shared<mga::HwcDevice>(hwc_native_device, wrapper, syncer, file_ops); | 129 | return std::make_shared<mga::HwcDevice>(hwc_native_device, wrapper, syncer, file_ops); |
4327 | 99 | } | 130 | } |
4328 | 100 | 131 | ||
4329 | @@ -103,5 +134,7 @@ | |||
4330 | 103 | std::shared_ptr<framebuffer_device_t> const& fb_native_device) const | 134 | std::shared_ptr<framebuffer_device_t> const& fb_native_device) const |
4331 | 104 | { | 135 | { |
4332 | 105 | auto syncer = std::make_shared<mga::HWCVsync>(); | 136 | auto syncer = std::make_shared<mga::HWCVsync>(); |
4334 | 106 | return std::make_shared<mga::HwcFbDevice>(hwc_native_device, fb_native_device, syncer); | 137 | auto logger = std::make_shared<NullHwcLogger>(); |
4335 | 138 | auto wrapper = std::make_shared<mga::RealHwcWrapper>(hwc_native_device, make_logger(should_log_hwc)); | ||
4336 | 139 | return std::make_shared<mga::HwcFbDevice>(hwc_native_device, wrapper, fb_native_device, syncer); | ||
4337 | 107 | } | 140 | } |
4338 | 108 | 141 | ||
4339 | === modified file 'src/platform/graphics/android/resource_factory.h' | |||
4340 | --- src/platform/graphics/android/resource_factory.h 2014-03-06 06:05:17 +0000 | |||
4341 | +++ src/platform/graphics/android/resource_factory.h 2014-04-07 13:29:13 +0000 | |||
4342 | @@ -31,6 +31,8 @@ | |||
4343 | 31 | class ResourceFactory : public DisplayResourceFactory | 31 | class ResourceFactory : public DisplayResourceFactory |
4344 | 32 | { | 32 | { |
4345 | 33 | public: | 33 | public: |
4346 | 34 | ResourceFactory(bool should_log_hwc); | ||
4347 | 35 | |||
4348 | 34 | //native allocations | 36 | //native allocations |
4349 | 35 | std::shared_ptr<hwc_composer_device_1> create_hwc_native_device() const; | 37 | std::shared_ptr<hwc_composer_device_1> create_hwc_native_device() const; |
4350 | 36 | std::shared_ptr<framebuffer_device_t> create_fb_native_device() const; | 38 | std::shared_ptr<framebuffer_device_t> create_fb_native_device() const; |
4351 | @@ -46,6 +48,8 @@ | |||
4352 | 46 | 48 | ||
4353 | 47 | std::shared_ptr<ANativeWindow> create_native_window( | 49 | std::shared_ptr<ANativeWindow> create_native_window( |
4354 | 48 | std::shared_ptr<FramebufferBundle> const& fb_bundle) const; | 50 | std::shared_ptr<FramebufferBundle> const& fb_bundle) const; |
4355 | 51 | private: | ||
4356 | 52 | bool const should_log_hwc; | ||
4357 | 49 | }; | 53 | }; |
4358 | 50 | 54 | ||
4359 | 51 | } | 55 | } |
4360 | 52 | 56 | ||
4361 | === modified file 'src/platform/graphics/mesa/CMakeLists.txt' | |||
4362 | --- src/platform/graphics/mesa/CMakeLists.txt 2014-03-10 03:02:32 +0000 | |||
4363 | +++ src/platform/graphics/mesa/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
4364 | @@ -47,6 +47,7 @@ | |||
4365 | 47 | mirplatformgraphicsmesa | 47 | mirplatformgraphicsmesa |
4366 | 48 | mirplatform | 48 | mirplatform |
4367 | 49 | 49 | ||
4368 | 50 | ${Boost_PROGRAM_OPTIONS_LIBRARY} | ||
4369 | 50 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} | 51 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
4370 | 51 | ${GBM_LDFLAGS} ${GBM_LIBRARIES} | 52 | ${GBM_LDFLAGS} ${GBM_LIBRARIES} |
4371 | 52 | ${EGL_LDFLAGS} ${EGL_LIBRARIES} | 53 | ${EGL_LDFLAGS} ${EGL_LIBRARIES} |
4372 | 53 | 54 | ||
4373 | === modified file 'src/platform/graphics/mesa/display.cpp' | |||
4374 | --- src/platform/graphics/mesa/display.cpp 2014-03-17 07:35:22 +0000 | |||
4375 | +++ src/platform/graphics/mesa/display.cpp 2014-04-07 13:29:13 +0000 | |||
4376 | @@ -54,7 +54,10 @@ | |||
4377 | 54 | class GBMGLContext : public mg::GLContext | 54 | class GBMGLContext : public mg::GLContext |
4378 | 55 | { | 55 | { |
4379 | 56 | public: | 56 | public: |
4381 | 57 | GBMGLContext(mgm::helpers::GBMHelper const& gbm, EGLContext shared_context) | 57 | GBMGLContext(mgm::helpers::GBMHelper const& gbm, |
4382 | 58 | mg::GLConfig const& gl_config, | ||
4383 | 59 | EGLContext shared_context) | ||
4384 | 60 | : egl{gl_config} | ||
4385 | 58 | { | 61 | { |
4386 | 59 | egl.setup(gbm, shared_context); | 62 | egl.setup(gbm, shared_context); |
4387 | 60 | } | 63 | } |
4388 | @@ -77,13 +80,16 @@ | |||
4389 | 77 | 80 | ||
4390 | 78 | mgm::Display::Display(std::shared_ptr<Platform> const& platform, | 81 | mgm::Display::Display(std::shared_ptr<Platform> const& platform, |
4391 | 79 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, | 82 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, |
4392 | 83 | std::shared_ptr<GLConfig> const& gl_config, | ||
4393 | 80 | std::shared_ptr<DisplayReport> const& listener) | 84 | std::shared_ptr<DisplayReport> const& listener) |
4394 | 81 | : platform(platform), | 85 | : platform(platform), |
4395 | 82 | listener(listener), | 86 | listener(listener), |
4396 | 83 | monitor(mir::udev::Context()), | 87 | monitor(mir::udev::Context()), |
4397 | 88 | shared_egl{*gl_config}, | ||
4398 | 84 | output_container{platform->drm.fd, | 89 | output_container{platform->drm.fd, |
4399 | 85 | std::make_shared<KMSPageFlipper>(platform->drm.fd)}, | 90 | std::make_shared<KMSPageFlipper>(platform->drm.fd)}, |
4401 | 86 | current_display_configuration{platform->drm.fd} | 91 | current_display_configuration{platform->drm.fd}, |
4402 | 92 | gl_config{gl_config} | ||
4403 | 87 | { | 93 | { |
4404 | 88 | platform->vt->set_graphics_mode(); | 94 | platform->vt->set_graphics_mode(); |
4405 | 89 | 95 | ||
4406 | @@ -203,6 +209,7 @@ | |||
4407 | 203 | std::move(surface), | 209 | std::move(surface), |
4408 | 204 | bounding_rect, | 210 | bounding_rect, |
4409 | 205 | orientation, | 211 | orientation, |
4410 | 212 | *gl_config, | ||
4411 | 206 | shared_egl.context()}}; | 213 | shared_egl.context()}}; |
4412 | 207 | 214 | ||
4413 | 208 | display_buffers_new.push_back(std::move(db)); | 215 | display_buffers_new.push_back(std::move(db)); |
4414 | @@ -320,7 +327,10 @@ | |||
4415 | 320 | std::unique_ptr<mg::GLContext> mgm::Display::create_gl_context() | 327 | std::unique_ptr<mg::GLContext> mgm::Display::create_gl_context() |
4416 | 321 | { | 328 | { |
4417 | 322 | return std::unique_ptr<GBMGLContext>{ | 329 | return std::unique_ptr<GBMGLContext>{ |
4419 | 323 | new GBMGLContext{platform->gbm, shared_egl.context()}}; | 330 | new GBMGLContext{ |
4420 | 331 | platform->gbm, | ||
4421 | 332 | *gl_config, | ||
4422 | 333 | shared_egl.context()}}; | ||
4423 | 324 | } | 334 | } |
4424 | 325 | 335 | ||
4425 | 326 | void mgm::Display::clear_connected_unused_outputs() | 336 | void mgm::Display::clear_connected_unused_outputs() |
4426 | 327 | 337 | ||
4427 | === modified file 'src/platform/graphics/mesa/display.h' | |||
4428 | --- src/platform/graphics/mesa/display.h 2014-03-06 06:05:17 +0000 | |||
4429 | +++ src/platform/graphics/mesa/display.h 2014-04-07 13:29:13 +0000 | |||
4430 | @@ -41,6 +41,7 @@ | |||
4431 | 41 | class DisplayBuffer; | 41 | class DisplayBuffer; |
4432 | 42 | class DisplayConfigurationPolicy; | 42 | class DisplayConfigurationPolicy; |
4433 | 43 | class EventHandlerRegister; | 43 | class EventHandlerRegister; |
4434 | 44 | class GLConfig; | ||
4435 | 44 | 45 | ||
4436 | 45 | namespace mesa | 46 | namespace mesa |
4437 | 46 | { | 47 | { |
4438 | @@ -54,8 +55,9 @@ | |||
4439 | 54 | { | 55 | { |
4440 | 55 | public: | 56 | public: |
4441 | 56 | Display(std::shared_ptr<Platform> const& platform, | 57 | Display(std::shared_ptr<Platform> const& platform, |
4444 | 57 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, | 58 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, |
4445 | 58 | std::shared_ptr<DisplayReport> const& listener); | 59 | std::shared_ptr<GLConfig> const& gl_config, |
4446 | 60 | std::shared_ptr<DisplayReport> const& listener); | ||
4447 | 59 | ~Display(); | 61 | ~Display(); |
4448 | 60 | 62 | ||
4449 | 61 | geometry::Rectangle view_area() const; | 63 | geometry::Rectangle view_area() const; |
4450 | @@ -92,6 +94,7 @@ | |||
4451 | 92 | RealKMSOutputContainer output_container; | 94 | RealKMSOutputContainer output_container; |
4452 | 93 | mutable RealKMSDisplayConfiguration current_display_configuration; | 95 | mutable RealKMSDisplayConfiguration current_display_configuration; |
4453 | 94 | std::shared_ptr<Cursor> cursor; | 96 | std::shared_ptr<Cursor> cursor; |
4454 | 97 | std::shared_ptr<GLConfig> const gl_config; | ||
4455 | 95 | }; | 98 | }; |
4456 | 96 | 99 | ||
4457 | 97 | } | 100 | } |
4458 | 98 | 101 | ||
4459 | === modified file 'src/platform/graphics/mesa/display_buffer.cpp' | |||
4460 | --- src/platform/graphics/mesa/display_buffer.cpp 2014-03-06 06:05:17 +0000 | |||
4461 | +++ src/platform/graphics/mesa/display_buffer.cpp 2014-04-07 13:29:13 +0000 | |||
4462 | @@ -101,6 +101,7 @@ | |||
4463 | 101 | GBMSurfaceUPtr surface_gbm_param, | 101 | GBMSurfaceUPtr surface_gbm_param, |
4464 | 102 | geom::Rectangle const& area, | 102 | geom::Rectangle const& area, |
4465 | 103 | MirOrientation rot, | 103 | MirOrientation rot, |
4466 | 104 | GLConfig const& gl_config, | ||
4467 | 104 | EGLContext shared_context) | 105 | EGLContext shared_context) |
4468 | 105 | : last_flipped_bufobj{nullptr}, | 106 | : last_flipped_bufobj{nullptr}, |
4469 | 106 | scheduled_bufobj{nullptr}, | 107 | scheduled_bufobj{nullptr}, |
4470 | @@ -109,6 +110,7 @@ | |||
4471 | 109 | drm(platform->drm), | 110 | drm(platform->drm), |
4472 | 110 | outputs(outputs), | 111 | outputs(outputs), |
4473 | 111 | surface_gbm{std::move(surface_gbm_param)}, | 112 | surface_gbm{std::move(surface_gbm_param)}, |
4474 | 113 | egl{gl_config}, | ||
4475 | 112 | area(area), | 114 | area(area), |
4476 | 113 | rotation(rot), | 115 | rotation(rot), |
4477 | 114 | needs_set_crtc{false}, | 116 | needs_set_crtc{false}, |
4478 | @@ -196,7 +198,7 @@ | |||
4479 | 196 | } | 198 | } |
4480 | 197 | 199 | ||
4481 | 198 | void mgm::DisplayBuffer::render_and_post_update( | 200 | void mgm::DisplayBuffer::render_and_post_update( |
4483 | 199 | std::list<std::shared_ptr<Renderable>> const&, | 201 | RenderableList const&, |
4484 | 200 | std::function<void(Renderable const&)> const&) | 202 | std::function<void(Renderable const&)> const&) |
4485 | 201 | { | 203 | { |
4486 | 202 | post_update(nullptr); | 204 | post_update(nullptr); |
4487 | 203 | 205 | ||
4488 | === modified file 'src/platform/graphics/mesa/display_buffer.h' | |||
4489 | --- src/platform/graphics/mesa/display_buffer.h 2014-03-06 06:05:17 +0000 | |||
4490 | +++ src/platform/graphics/mesa/display_buffer.h 2014-04-07 13:29:13 +0000 | |||
4491 | @@ -32,6 +32,7 @@ | |||
4492 | 32 | { | 32 | { |
4493 | 33 | 33 | ||
4494 | 34 | class DisplayReport; | 34 | class DisplayReport; |
4495 | 35 | class GLConfig; | ||
4496 | 35 | 36 | ||
4497 | 36 | namespace mesa | 37 | namespace mesa |
4498 | 37 | { | 38 | { |
4499 | @@ -49,6 +50,7 @@ | |||
4500 | 49 | GBMSurfaceUPtr surface_gbm, | 50 | GBMSurfaceUPtr surface_gbm, |
4501 | 50 | geometry::Rectangle const& area, | 51 | geometry::Rectangle const& area, |
4502 | 51 | MirOrientation rot, | 52 | MirOrientation rot, |
4503 | 53 | GLConfig const& gl_config, | ||
4504 | 52 | EGLContext shared_context); | 54 | EGLContext shared_context); |
4505 | 53 | ~DisplayBuffer(); | 55 | ~DisplayBuffer(); |
4506 | 54 | 56 | ||
4507 | @@ -59,7 +61,7 @@ | |||
4508 | 59 | 61 | ||
4509 | 60 | bool can_bypass() const override; | 62 | bool can_bypass() const override; |
4510 | 61 | void post_update(std::shared_ptr<graphics::Buffer> bypass_buf) override; | 63 | void post_update(std::shared_ptr<graphics::Buffer> bypass_buf) override; |
4512 | 62 | void render_and_post_update(std::list<std::shared_ptr<Renderable>> const& renderlist, | 64 | void render_and_post_update(RenderableList const& renderlist, |
4513 | 63 | std::function<void(Renderable const&)> const& render_fn); | 65 | std::function<void(Renderable const&)> const& render_fn); |
4514 | 64 | MirOrientation orientation() const override; | 66 | MirOrientation orientation() const override; |
4515 | 65 | void schedule_set_crtc(); | 67 | void schedule_set_crtc(); |
4516 | 66 | 68 | ||
4517 | === modified file 'src/platform/graphics/mesa/display_helpers.cpp' | |||
4518 | --- src/platform/graphics/mesa/display_helpers.cpp 2014-03-12 02:46:58 +0000 | |||
4519 | +++ src/platform/graphics/mesa/display_helpers.cpp 2014-04-07 13:29:13 +0000 | |||
4520 | @@ -19,6 +19,7 @@ | |||
4521 | 19 | #include "display_helpers.h" | 19 | #include "display_helpers.h" |
4522 | 20 | #include "drm_close_threadsafe.h" | 20 | #include "drm_close_threadsafe.h" |
4523 | 21 | 21 | ||
4524 | 22 | #include "mir/graphics/gl_config.h" | ||
4525 | 22 | #include "mir/udev/wrapper.h" | 23 | #include "mir/udev/wrapper.h" |
4526 | 23 | 24 | ||
4527 | 24 | #include <boost/exception/errinfo_errno.hpp> | 25 | #include <boost/exception/errinfo_errno.hpp> |
4528 | @@ -219,7 +220,7 @@ | |||
4529 | 219 | sv.drm_dd_major = -1; /* Don't care */ | 220 | sv.drm_dd_major = -1; /* Don't care */ |
4530 | 220 | sv.drm_dd_minor = -1; /* Don't care */ | 221 | sv.drm_dd_minor = -1; /* Don't care */ |
4531 | 221 | 222 | ||
4533 | 222 | if ((error = drmSetInterfaceVersion(tmp_fd, &sv))) | 223 | if ((error = -drmSetInterfaceVersion(tmp_fd, &sv))) |
4534 | 223 | { | 224 | { |
4535 | 224 | close(tmp_fd); | 225 | close(tmp_fd); |
4536 | 225 | tmp_fd = -1; | 226 | tmp_fd = -1; |
4537 | @@ -238,7 +239,7 @@ | |||
4538 | 238 | { | 239 | { |
4539 | 239 | BOOST_THROW_EXCEPTION( | 240 | BOOST_THROW_EXCEPTION( |
4540 | 240 | boost::enable_error_info( | 241 | boost::enable_error_info( |
4542 | 241 | std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(-error)); | 242 | std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(error)); |
4543 | 242 | } | 243 | } |
4544 | 243 | 244 | ||
4545 | 244 | return tmp_fd; | 245 | return tmp_fd; |
4546 | @@ -295,6 +296,15 @@ | |||
4547 | 295 | * EGLHelper * | 296 | * EGLHelper * |
4548 | 296 | *************/ | 297 | *************/ |
4549 | 297 | 298 | ||
4550 | 299 | mgmh::EGLHelper::EGLHelper(GLConfig const& gl_config) | ||
4551 | 300 | : depth_buffer_bits{gl_config.depth_buffer_bits()}, | ||
4552 | 301 | stencil_buffer_bits{gl_config.stencil_buffer_bits()}, | ||
4553 | 302 | egl_display{EGL_NO_DISPLAY}, egl_config{0}, | ||
4554 | 303 | egl_context{EGL_NO_CONTEXT}, egl_surface{EGL_NO_SURFACE}, | ||
4555 | 304 | should_terminate_egl{false} | ||
4556 | 305 | { | ||
4557 | 306 | } | ||
4558 | 307 | |||
4559 | 298 | void mgmh::EGLHelper::setup(GBMHelper const& gbm) | 308 | void mgmh::EGLHelper::setup(GBMHelper const& gbm) |
4560 | 299 | { | 309 | { |
4561 | 300 | static const EGLint context_attr[] = { | 310 | static const EGLint context_attr[] = { |
4562 | @@ -378,12 +388,14 @@ | |||
4563 | 378 | 388 | ||
4564 | 379 | void mgmh::EGLHelper::setup_internal(GBMHelper const& gbm, bool initialize) | 389 | void mgmh::EGLHelper::setup_internal(GBMHelper const& gbm, bool initialize) |
4565 | 380 | { | 390 | { |
4567 | 381 | static const EGLint config_attr[] = { | 391 | EGLint const config_attr[] = { |
4568 | 382 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | 392 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, |
4569 | 383 | EGL_RED_SIZE, 8, | 393 | EGL_RED_SIZE, 8, |
4570 | 384 | EGL_GREEN_SIZE, 8, | 394 | EGL_GREEN_SIZE, 8, |
4571 | 385 | EGL_BLUE_SIZE, 8, | 395 | EGL_BLUE_SIZE, 8, |
4572 | 386 | EGL_ALPHA_SIZE, 0, | 396 | EGL_ALPHA_SIZE, 0, |
4573 | 397 | EGL_DEPTH_SIZE, depth_buffer_bits, | ||
4574 | 398 | EGL_STENCIL_SIZE, stencil_buffer_bits, | ||
4575 | 387 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | 399 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
4576 | 388 | EGL_NONE | 400 | EGL_NONE |
4577 | 389 | }; | 401 | }; |
4578 | 390 | 402 | ||
4579 | === modified file 'src/platform/graphics/mesa/display_helpers.h' | |||
4580 | --- src/platform/graphics/mesa/display_helpers.h 2014-03-12 02:46:58 +0000 | |||
4581 | +++ src/platform/graphics/mesa/display_helpers.h 2014-04-07 13:29:13 +0000 | |||
4582 | @@ -37,6 +37,8 @@ | |||
4583 | 37 | { | 37 | { |
4584 | 38 | namespace graphics | 38 | namespace graphics |
4585 | 39 | { | 39 | { |
4586 | 40 | class GLConfig; | ||
4587 | 41 | |||
4588 | 40 | namespace mesa | 42 | namespace mesa |
4589 | 41 | { | 43 | { |
4590 | 42 | 44 | ||
4591 | @@ -92,11 +94,7 @@ | |||
4592 | 92 | class EGLHelper | 94 | class EGLHelper |
4593 | 93 | { | 95 | { |
4594 | 94 | public: | 96 | public: |
4600 | 95 | EGLHelper() | 97 | EGLHelper(GLConfig const& gl_config); |
4596 | 96 | : egl_display{EGL_NO_DISPLAY}, egl_config{0}, | ||
4597 | 97 | egl_context{EGL_NO_CONTEXT}, egl_surface{EGL_NO_SURFACE}, | ||
4598 | 98 | should_terminate_egl{false} {} | ||
4599 | 99 | |||
4601 | 100 | ~EGLHelper() noexcept; | 98 | ~EGLHelper() noexcept; |
4602 | 101 | 99 | ||
4603 | 102 | EGLHelper(const EGLHelper&) = delete; | 100 | EGLHelper(const EGLHelper&) = delete; |
4604 | @@ -117,6 +115,8 @@ | |||
4605 | 117 | private: | 115 | private: |
4606 | 118 | void setup_internal(GBMHelper const& gbm, bool initialize); | 116 | void setup_internal(GBMHelper const& gbm, bool initialize); |
4607 | 119 | 117 | ||
4608 | 118 | EGLint const depth_buffer_bits; | ||
4609 | 119 | EGLint const stencil_buffer_bits; | ||
4610 | 120 | EGLDisplay egl_display; | 120 | EGLDisplay egl_display; |
4611 | 121 | EGLConfig egl_config; | 121 | EGLConfig egl_config; |
4612 | 122 | EGLContext egl_context; | 122 | EGLContext egl_context; |
4613 | 123 | 123 | ||
4614 | === modified file 'src/platform/graphics/mesa/platform.cpp' | |||
4615 | --- src/platform/graphics/mesa/platform.cpp 2014-03-13 07:47:55 +0000 | |||
4616 | +++ src/platform/graphics/mesa/platform.cpp 2014-04-07 13:29:13 +0000 | |||
4617 | @@ -147,11 +147,13 @@ | |||
4618 | 147 | } | 147 | } |
4619 | 148 | 148 | ||
4620 | 149 | std::shared_ptr<mg::Display> mgm::Platform::create_display( | 149 | std::shared_ptr<mg::Display> mgm::Platform::create_display( |
4622 | 150 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy) | 150 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, |
4623 | 151 | std::shared_ptr<GLConfig> const& gl_config) | ||
4624 | 151 | { | 152 | { |
4625 | 152 | return std::make_shared<mgm::Display>( | 153 | return std::make_shared<mgm::Display>( |
4626 | 153 | this->shared_from_this(), | 154 | this->shared_from_this(), |
4627 | 154 | initial_conf_policy, | 155 | initial_conf_policy, |
4628 | 156 | gl_config, | ||
4629 | 155 | listener); | 157 | listener); |
4630 | 156 | } | 158 | } |
4631 | 157 | 159 | ||
4632 | @@ -219,3 +221,11 @@ | |||
4633 | 219 | return (display == mgm::NativePlatform::internal_native_display().get()); | 221 | return (display == mgm::NativePlatform::internal_native_display().get()); |
4634 | 220 | return 0; | 222 | return 0; |
4635 | 221 | } | 223 | } |
4636 | 224 | |||
4637 | 225 | extern "C" void add_platform_options(boost::program_options::options_description& config) | ||
4638 | 226 | { | ||
4639 | 227 | config.add_options() | ||
4640 | 228 | ("vt", | ||
4641 | 229 | boost::program_options::value<int>()->default_value(0), | ||
4642 | 230 | "[platform-specific] VT to run on or 0 to use current."); | ||
4643 | 231 | } | ||
4644 | 222 | 232 | ||
4645 | === modified file 'src/platform/graphics/mesa/platform.h' | |||
4646 | --- src/platform/graphics/mesa/platform.h 2014-03-06 06:05:17 +0000 | |||
4647 | +++ src/platform/graphics/mesa/platform.h 2014-04-07 13:29:13 +0000 | |||
4648 | @@ -47,7 +47,8 @@ | |||
4649 | 47 | std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator( | 47 | std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator( |
4650 | 48 | const std::shared_ptr<BufferInitializer>& buffer_initializer); | 48 | const std::shared_ptr<BufferInitializer>& buffer_initializer); |
4651 | 49 | std::shared_ptr<graphics::Display> create_display( | 49 | std::shared_ptr<graphics::Display> create_display( |
4653 | 50 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy); | 50 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, |
4654 | 51 | std::shared_ptr<GLConfig> const& gl_config); | ||
4655 | 51 | std::shared_ptr<PlatformIPCPackage> get_ipc_package(); | 52 | std::shared_ptr<PlatformIPCPackage> get_ipc_package(); |
4656 | 52 | std::shared_ptr<InternalClient> create_internal_client(); | 53 | std::shared_ptr<InternalClient> create_internal_client(); |
4657 | 53 | 54 | ||
4658 | 54 | 55 | ||
4659 | === modified file 'src/platform/options/default_configuration.cpp' | |||
4660 | --- src/platform/options/default_configuration.cpp 2014-03-17 07:35:22 +0000 | |||
4661 | +++ src/platform/options/default_configuration.cpp 2014-04-07 13:29:13 +0000 | |||
4662 | @@ -16,7 +16,10 @@ | |||
4663 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
4664 | 17 | */ | 17 | */ |
4665 | 18 | 18 | ||
4666 | 19 | #include "mir/shared_library.h" | ||
4667 | 20 | #include "mir/shared_library_loader.h" | ||
4668 | 19 | #include "mir/options/default_configuration.h" | 21 | #include "mir/options/default_configuration.h" |
4669 | 22 | #include "mir/graphics/platform.h" | ||
4670 | 20 | #include "mir/default_configuration.h" | 23 | #include "mir/default_configuration.h" |
4671 | 21 | #include "mir/abnormal_exit.h" | 24 | #include "mir/abnormal_exit.h" |
4672 | 22 | 25 | ||
4673 | @@ -114,9 +117,35 @@ | |||
4674 | 114 | (name_opt, po::value<std::string>(), | 117 | (name_opt, po::value<std::string>(), |
4675 | 115 | "When nested, the name Mir uses when registering with the host.") | 118 | "When nested, the name Mir uses when registering with the host.") |
4676 | 116 | (offscreen_opt, | 119 | (offscreen_opt, |
4680 | 117 | "Render to offscreen buffers instead of the real outputs.") | 120 | "Render to offscreen buffers instead of the real outputs."); |
4681 | 118 | ("vt", po::value<int>()->default_value(0), // TODO this not applicable on all graphics platforms | 121 | |
4682 | 119 | "VT to run on or 0 to use current."); | 122 | add_platform_options(); |
4683 | 123 | } | ||
4684 | 124 | |||
4685 | 125 | void mo::DefaultConfiguration::add_platform_options() | ||
4686 | 126 | { | ||
4687 | 127 | namespace po = boost::program_options; | ||
4688 | 128 | po::options_description program_options; | ||
4689 | 129 | program_options.add_options() | ||
4690 | 130 | (platform_graphics_lib, | ||
4691 | 131 | po::value<std::string>()->default_value(default_platform_graphics_lib), ""); | ||
4692 | 132 | mo::ProgramOption options; | ||
4693 | 133 | options.parse_arguments(program_options, argc, argv); | ||
4694 | 134 | |||
4695 | 135 | std::string graphics_libname; | ||
4696 | 136 | auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB"); | ||
4697 | 137 | if (!options.is_set(platform_graphics_lib) && env_libname) | ||
4698 | 138 | { | ||
4699 | 139 | graphics_libname = std::string{env_libname}; | ||
4700 | 140 | } | ||
4701 | 141 | else | ||
4702 | 142 | { | ||
4703 | 143 | graphics_libname = options.get<std::string>(platform_graphics_lib); | ||
4704 | 144 | } | ||
4705 | 145 | |||
4706 | 146 | auto graphics_lib = load_library(graphics_libname); | ||
4707 | 147 | auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options")); | ||
4708 | 148 | add_platform_options(*this->program_options); | ||
4709 | 120 | } | 149 | } |
4710 | 121 | 150 | ||
4711 | 122 | boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options() | 151 | boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options() |
4712 | 123 | 152 | ||
4713 | === added file 'src/platform/shared_library_loader.cpp' | |||
4714 | --- src/platform/shared_library_loader.cpp 1970-01-01 00:00:00 +0000 | |||
4715 | +++ src/platform/shared_library_loader.cpp 2014-04-07 13:29:13 +0000 | |||
4716 | @@ -0,0 +1,38 @@ | |||
4717 | 1 | /* | ||
4718 | 2 | * Copyright © 2013 Canonical Ltd. | ||
4719 | 3 | * | ||
4720 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4721 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4722 | 6 | * as published by the Free Software Foundation. | ||
4723 | 7 | * | ||
4724 | 8 | * This program is distributed in the hope that it will be useful, | ||
4725 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4726 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4727 | 11 | * GNU Lesser General Public License for more details. | ||
4728 | 12 | * | ||
4729 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4730 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4731 | 15 | * | ||
4732 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
4733 | 17 | */ | ||
4734 | 18 | |||
4735 | 19 | #include "mir/shared_library_loader.h" | ||
4736 | 20 | #include "mir/shared_library.h" | ||
4737 | 21 | #include <memory> | ||
4738 | 22 | #include <map> | ||
4739 | 23 | |||
4740 | 24 | mir::SharedLibrary const* mir::load_library(std::string const& libname) | ||
4741 | 25 | { | ||
4742 | 26 | // There's no point in loading twice, and it isn't safe to unload... | ||
4743 | 27 | static std::map<std::string, std::shared_ptr<mir::SharedLibrary>> libraries_cache; | ||
4744 | 28 | |||
4745 | 29 | if (auto& ptr = libraries_cache[libname]) | ||
4746 | 30 | { | ||
4747 | 31 | return ptr.get(); | ||
4748 | 32 | } | ||
4749 | 33 | else | ||
4750 | 34 | { | ||
4751 | 35 | ptr = std::make_shared<mir::SharedLibrary>(libname); | ||
4752 | 36 | return ptr.get(); | ||
4753 | 37 | } | ||
4754 | 38 | } | ||
4755 | 0 | 39 | ||
4756 | === modified file 'src/server/CMakeLists.txt' | |||
4757 | --- src/server/CMakeLists.txt 2014-03-12 06:41:13 +0000 | |||
4758 | +++ src/server/CMakeLists.txt 2014-04-07 13:29:13 +0000 | |||
4759 | @@ -94,7 +94,7 @@ | |||
4760 | 94 | ) | 94 | ) |
4761 | 95 | endif() | 95 | endif() |
4762 | 96 | 96 | ||
4764 | 97 | set(MIRSERVER_ABI 17) | 97 | set(MIRSERVER_ABI 18) |
4765 | 98 | 98 | ||
4766 | 99 | set_target_properties( | 99 | set_target_properties( |
4767 | 100 | mirserver | 100 | mirserver |
4768 | 101 | 101 | ||
4769 | === modified file 'src/server/compositor/buffer_bundle.h' | |||
4770 | --- src/server/compositor/buffer_bundle.h 2014-03-07 03:15:55 +0000 | |||
4771 | +++ src/server/compositor/buffer_bundle.h 2014-04-07 13:29:13 +0000 | |||
4772 | @@ -36,8 +36,20 @@ | |||
4773 | 36 | virtual ~BufferBundle() noexcept {} | 36 | virtual ~BufferBundle() noexcept {} |
4774 | 37 | virtual void client_acquire(std::function<void(graphics::Buffer* buffer)> complete) = 0; | 37 | virtual void client_acquire(std::function<void(graphics::Buffer* buffer)> complete) = 0; |
4775 | 38 | virtual void client_release(graphics::Buffer*) = 0; | 38 | virtual void client_release(graphics::Buffer*) = 0; |
4776 | 39 | |||
4777 | 40 | /** | ||
4778 | 41 | * Acquire the next buffer that's ready to display/composite. | ||
4779 | 42 | * | ||
4780 | 43 | * \param [in] user_id A unique identifier of who is going to use the | ||
4781 | 44 | * buffer, to ensure that separate users representing | ||
4782 | 45 | * separate monitors who need the same frame will get | ||
4783 | 46 | * the same buffer. However consecutive calls for the | ||
4784 | 47 | * same user will get different buffers. To avoid | ||
4785 | 48 | * collisions, all callers should determine user_id | ||
4786 | 49 | * in the same way (e.g. always use "this" pointer). | ||
4787 | 50 | */ | ||
4788 | 39 | virtual std::shared_ptr<graphics::Buffer> | 51 | virtual std::shared_ptr<graphics::Buffer> |
4790 | 40 | compositor_acquire(unsigned long frameno) = 0; | 52 | compositor_acquire(void const* user_id) = 0; |
4791 | 41 | virtual void compositor_release(std::shared_ptr<graphics::Buffer> const&) = 0; | 53 | virtual void compositor_release(std::shared_ptr<graphics::Buffer> const&) = 0; |
4792 | 42 | virtual std::shared_ptr<graphics::Buffer> snapshot_acquire() = 0; | 54 | virtual std::shared_ptr<graphics::Buffer> snapshot_acquire() = 0; |
4793 | 43 | virtual void snapshot_release(std::shared_ptr<graphics::Buffer> const&) = 0; | 55 | virtual void snapshot_release(std::shared_ptr<graphics::Buffer> const&) = 0; |
4794 | 44 | 56 | ||
4795 | === modified file 'src/server/compositor/buffer_stream_surfaces.cpp' | |||
4796 | --- src/server/compositor/buffer_stream_surfaces.cpp 2014-03-07 03:15:55 +0000 | |||
4797 | +++ src/server/compositor/buffer_stream_surfaces.cpp 2014-04-07 13:29:13 +0000 | |||
4798 | @@ -38,10 +38,10 @@ | |||
4799 | 38 | } | 38 | } |
4800 | 39 | 39 | ||
4801 | 40 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_compositor_buffer( | 40 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_compositor_buffer( |
4803 | 41 | unsigned long frameno) | 41 | void const* user_id) |
4804 | 42 | { | 42 | { |
4805 | 43 | return std::make_shared<mc::TemporaryCompositorBuffer>( | 43 | return std::make_shared<mc::TemporaryCompositorBuffer>( |
4807 | 44 | buffer_bundle, frameno); | 44 | buffer_bundle, user_id); |
4808 | 45 | } | 45 | } |
4809 | 46 | 46 | ||
4810 | 47 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_snapshot_buffer() | 47 | std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_snapshot_buffer() |
4811 | 48 | 48 | ||
4812 | === modified file 'src/server/compositor/buffer_stream_surfaces.h' | |||
4813 | --- src/server/compositor/buffer_stream_surfaces.h 2014-03-07 03:15:55 +0000 | |||
4814 | +++ src/server/compositor/buffer_stream_surfaces.h 2014-04-07 13:29:13 +0000 | |||
4815 | @@ -42,7 +42,7 @@ | |||
4816 | 42 | void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override; | 42 | void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) override; |
4817 | 43 | 43 | ||
4818 | 44 | std::shared_ptr<graphics::Buffer> | 44 | std::shared_ptr<graphics::Buffer> |
4820 | 45 | lock_compositor_buffer(unsigned long frameno) override; | 45 | lock_compositor_buffer(void const* user_id) override; |
4821 | 46 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override; | 46 | std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override; |
4822 | 47 | 47 | ||
4823 | 48 | MirPixelFormat get_stream_pixel_format() override; | 48 | MirPixelFormat get_stream_pixel_format() override; |
4824 | 49 | 49 | ||
4825 | === modified file 'src/server/compositor/bypass.cpp' | |||
4826 | --- src/server/compositor/bypass.cpp 2014-03-17 07:35:22 +0000 | |||
4827 | +++ src/server/compositor/bypass.cpp 2014-04-07 13:29:13 +0000 | |||
4828 | @@ -44,9 +44,14 @@ | |||
4829 | 44 | 44 | ||
4830 | 45 | auto const& view_area = display_buffer.view_area(); | 45 | auto const& view_area = display_buffer.view_area(); |
4831 | 46 | 46 | ||
4832 | 47 | //TODO: remove this check, why are we getting a non visible renderable | ||
4833 | 48 | // in the list of surfaces? | ||
4834 | 49 | if (!renderable.visible()) | ||
4835 | 50 | return false; | ||
4836 | 51 | |||
4837 | 47 | // Not weirdly transformed but also not on this monitor? Don't care... | 52 | // Not weirdly transformed but also not on this monitor? Don't care... |
4838 | 48 | // This will also check the surface is not hidden and has been posted. | 53 | // This will also check the surface is not hidden and has been posted. |
4840 | 49 | if (!renderable.should_be_rendered_in(view_area)) | 54 | if (!view_area.contains(renderable.screen_position())) |
4841 | 50 | return false; | 55 | return false; |
4842 | 51 | 56 | ||
4843 | 52 | topmost_fits = false; | 57 | topmost_fits = false; |
4844 | 53 | 58 | ||
4845 | === modified file 'src/server/compositor/default_display_buffer_compositor.cpp' | |||
4846 | --- src/server/compositor/default_display_buffer_compositor.cpp 2014-03-17 07:35:22 +0000 | |||
4847 | +++ src/server/compositor/default_display_buffer_compositor.cpp 2014-04-07 13:29:13 +0000 | |||
4848 | @@ -29,41 +29,35 @@ | |||
4849 | 29 | #include "occlusion.h" | 29 | #include "occlusion.h" |
4850 | 30 | #include <mutex> | 30 | #include <mutex> |
4851 | 31 | #include <cstdlib> | 31 | #include <cstdlib> |
4853 | 32 | #include <vector> | 32 | #include <algorithm> |
4854 | 33 | 33 | ||
4855 | 34 | namespace mc = mir::compositor; | 34 | namespace mc = mir::compositor; |
4856 | 35 | namespace mg = mir::graphics; | 35 | namespace mg = mir::graphics; |
4857 | 36 | 36 | ||
4858 | 37 | //TODO remove VisibilityFilter once we don't need filters/operators for rendering | ||
4859 | 37 | namespace | 38 | namespace |
4860 | 38 | { | 39 | { |
4863 | 39 | 40 | struct VisibilityFilter : public mc::FilterForScene | |
4862 | 40 | struct FilterForVisibleSceneInRegion : public mc::FilterForScene | ||
4864 | 41 | { | 41 | { |
4870 | 42 | FilterForVisibleSceneInRegion( | 42 | public: |
4871 | 43 | mir::geometry::Rectangle const& enclosing_region, | 43 | VisibilityFilter( |
4872 | 44 | mc::OcclusionMatch const& occlusions) | 44 | mg::RenderableList const& renderable_list) |
4873 | 45 | : enclosing_region(enclosing_region), | 45 | : list(renderable_list) |
4869 | 46 | occlusions(occlusions) | ||
4874 | 47 | { | 46 | { |
4875 | 48 | } | 47 | } |
4876 | 48 | |||
4877 | 49 | bool operator()(mg::Renderable const& r) | 49 | bool operator()(mg::Renderable const& r) |
4878 | 50 | { | 50 | { |
4881 | 51 | return r.should_be_rendered_in(enclosing_region) && | 51 | auto matcher = [&r](std::shared_ptr<mg::Renderable> const& renderable) |
4882 | 52 | !occlusions.occluded(r); | 52 | { |
4883 | 53 | return (renderable.get() == &r); | ||
4884 | 54 | }; | ||
4885 | 55 | return (std::find_if(list.begin(), list.end(), matcher) != list.end()); | ||
4886 | 53 | } | 56 | } |
4887 | 54 | 57 | ||
4890 | 55 | mir::geometry::Rectangle const& enclosing_region; | 58 | private: |
4891 | 56 | mc::OcclusionMatch const& occlusions; | 59 | mg::RenderableList const& list; |
4892 | 57 | }; | 60 | }; |
4893 | 58 | |||
4894 | 59 | std::mutex global_frameno_lock; | ||
4895 | 60 | unsigned long global_frameno = 0; | ||
4896 | 61 | |||
4897 | 62 | bool wrapped_greater_or_equal(unsigned long a, unsigned long b) | ||
4898 | 63 | { | ||
4899 | 64 | return (a - b) < (~0UL / 2UL); | ||
4900 | 65 | } | ||
4901 | 66 | |||
4902 | 67 | } | 61 | } |
4903 | 68 | 62 | ||
4904 | 69 | mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor( | 63 | mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor( |
4905 | @@ -75,29 +69,14 @@ | |||
4906 | 75 | scene{scene}, | 69 | scene{scene}, |
4907 | 76 | renderer{renderer}, | 70 | renderer{renderer}, |
4908 | 77 | report{report}, | 71 | report{report}, |
4910 | 78 | local_frameno{global_frameno} | 72 | last_pass_rendered_anything{false} |
4911 | 79 | { | 73 | { |
4912 | 80 | } | 74 | } |
4913 | 81 | 75 | ||
4914 | 82 | |||
4915 | 83 | bool mc::DefaultDisplayBufferCompositor::composite() | 76 | bool mc::DefaultDisplayBufferCompositor::composite() |
4916 | 84 | { | 77 | { |
4917 | 85 | report->began_frame(this); | 78 | report->began_frame(this); |
4918 | 86 | 79 | ||
4919 | 87 | /* | ||
4920 | 88 | * Increment frame counts for each tick of the fastest instance of | ||
4921 | 89 | * DefaultDisplayBufferCompositor. This means for the fastest refresh | ||
4922 | 90 | * rate of all attached outputs. | ||
4923 | 91 | */ | ||
4924 | 92 | local_frameno++; | ||
4925 | 93 | { | ||
4926 | 94 | std::lock_guard<std::mutex> lock(global_frameno_lock); | ||
4927 | 95 | if (wrapped_greater_or_equal(local_frameno, global_frameno)) | ||
4928 | 96 | global_frameno = local_frameno; | ||
4929 | 97 | else | ||
4930 | 98 | local_frameno = global_frameno; | ||
4931 | 99 | } | ||
4932 | 100 | |||
4933 | 101 | static bool const bypass_env{[] | 80 | static bool const bypass_env{[] |
4934 | 102 | { | 81 | { |
4935 | 103 | auto const env = getenv("MIR_BYPASS"); | 82 | auto const env = getenv("MIR_BYPASS"); |
4936 | @@ -123,8 +102,13 @@ | |||
4937 | 123 | 102 | ||
4938 | 124 | if (filter.fullscreen_on_top()) | 103 | if (filter.fullscreen_on_top()) |
4939 | 125 | { | 104 | { |
4942 | 126 | auto bypass_buf = | 105 | /* |
4943 | 127 | match.topmost_fullscreen()->buffer(local_frameno); | 106 | * Notice the user_id we pass to buffer() here has to be |
4944 | 107 | * different to the one used in the Renderer. This is in case | ||
4945 | 108 | * the below if() fails we want to complete the frame using the | ||
4946 | 109 | * same buffer (different user_id required). | ||
4947 | 110 | */ | ||
4948 | 111 | auto bypass_buf = match.topmost_fullscreen()->buffer(this); | ||
4949 | 128 | 112 | ||
4950 | 129 | if (bypass_buf->can_bypass()) | 113 | if (bypass_buf->can_bypass()) |
4951 | 130 | { | 114 | { |
4952 | @@ -140,41 +124,32 @@ | |||
4953 | 140 | 124 | ||
4954 | 141 | if (!bypassed) | 125 | if (!bypassed) |
4955 | 142 | { | 126 | { |
4956 | 143 | // preserves buffers used in rendering until after post_update() | ||
4957 | 144 | std::vector<std::shared_ptr<void>> saved_resources; | ||
4958 | 145 | auto save_resource = [&](std::shared_ptr<void> const& r) | ||
4959 | 146 | { | ||
4960 | 147 | saved_resources.push_back(r); | ||
4961 | 148 | }; | ||
4962 | 149 | |||
4963 | 150 | display_buffer.make_current(); | 127 | display_buffer.make_current(); |
4964 | 151 | 128 | ||
4965 | 152 | auto const& view_area = display_buffer.view_area(); | 129 | auto const& view_area = display_buffer.view_area(); |
4966 | 130 | auto renderable_list = scene->generate_renderable_list(); | ||
4967 | 131 | mc::filter_occlusions_from(renderable_list, view_area); | ||
4968 | 153 | 132 | ||
4972 | 154 | mc::OcclusionFilter occlusion_search(view_area); | 133 | for(auto const& renderable : renderable_list) |
4973 | 155 | mc::OcclusionMatch occlusion_match; | 134 | uncomposited_buffers |= (renderable->buffers_ready_for_compositor() > 1); |
4971 | 156 | scene->reverse_for_each_if(occlusion_search, occlusion_match); | ||
4974 | 157 | 135 | ||
4975 | 158 | renderer->set_rotation(display_buffer.orientation()); | 136 | renderer->set_rotation(display_buffer.orientation()); |
4976 | 159 | renderer->begin(); | 137 | renderer->begin(); |
4979 | 160 | mc::RenderingOperator applicator(*renderer, save_resource, local_frameno, uncomposited_buffers); | 138 | mc::RenderingOperator applicator(*renderer); |
4980 | 161 | FilterForVisibleSceneInRegion selector(view_area, occlusion_match); | 139 | VisibilityFilter selector(renderable_list); |
4981 | 162 | scene->for_each_if(selector, applicator); | 140 | scene->for_each_if(selector, applicator); |
4982 | 163 | renderer->end(); | 141 | renderer->end(); |
4983 | 164 | 142 | ||
4984 | 165 | display_buffer.post_update(); | 143 | display_buffer.post_update(); |
4985 | 166 | 144 | ||
4986 | 167 | // This is a frig to avoid lp:1286190 | 145 | // This is a frig to avoid lp:1286190 |
4991 | 168 | if (size_of_last_pass) | 146 | if (last_pass_rendered_anything && renderable_list.empty()) |
4992 | 169 | { | 147 | uncomposited_buffers = true; |
4989 | 170 | uncomposited_buffers |= saved_resources.empty(); | ||
4990 | 171 | } | ||
4993 | 172 | 148 | ||
4995 | 173 | size_of_last_pass = saved_resources.size(); | 149 | last_pass_rendered_anything = !renderable_list.empty(); |
4996 | 174 | // End of frig | 150 | // End of frig |
4997 | 175 | } | 151 | } |
4998 | 176 | 152 | ||
4999 | 177 | report->finished_frame(bypassed, this); | 153 | report->finished_frame(bypassed, this); |
5000 | 178 | return uncomposited_buffers; | 154 | return uncomposited_buffers; |
PASSED: Continuous integration, rev:1184 jenkins. qa.ubuntu. com/job/ mir-ci/ 1652/ jenkins. qa.ubuntu. com/job/ mir-android- trusty- i386-build/ 1455 jenkins. qa.ubuntu. com/job/ mir-clang- trusty- amd64-build/ 1453 jenkins. qa.ubuntu. com/job/ mir-trusty- amd64-ci/ 50 jenkins. qa.ubuntu. com/job/ mir-trusty- amd64-ci/ 50/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-trusty- armhf-ci/ 50 jenkins. qa.ubuntu. com/job/ mir-trusty- armhf-ci/ 50/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/1652/ rebuild
http://