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