Mir

Merge lp:~mir-team/mir/trunk-0.1.8 into lp:mir/0.1

Proposed by Daniel van Vugt
Status: Merged
Merged at revision: 1183
Proposed branch: lp:~mir-team/mir/trunk-0.1.8
Merge into: lp:mir/0.1
Diff against target: 16448 lines (+6002/-3362)
277 files modified
3rd_party/android-input/android/CMakeLists.txt (+2/-0)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+46/-92)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+6/-5)
CMakeLists.txt (+1/-1)
benchmarks/android-input/CMakeLists.txt (+3/-1)
cmake/MirCommon.cmake (+15/-4)
cmake/src/mir/CMakeLists.txt (+5/-0)
cmake/src/mir/fail_on_success.sh (+8/-0)
cmake/src/mir/mir_discover_gtest_tests.cpp (+15/-2)
debian/changelog (+66/-0)
debian/control (+3/-3)
debian/libmirserver18.install (+1/-1)
deploy-and-test.sh (+21/-0)
examples/demo-shell/demo_renderer.cpp (+271/-0)
examples/demo-shell/demo_renderer.h (+15/-0)
examples/render_overlays.cpp (+9/-7)
examples/render_surfaces.cpp (+19/-7)
include/platform/mir/graphics/display_buffer.h (+2/-3)
include/platform/mir/graphics/gl_config.h (+54/-0)
include/platform/mir/graphics/platform.h (+8/-1)
include/platform/mir/graphics/renderable.h (+20/-13)
include/platform/mir/options/default_configuration.h (+1/-0)
include/platform/mir/shared_library_loader.h (+28/-0)
include/server/mir/compositor/buffer_stream.h (+1/-1)
include/server/mir/compositor/gl_renderer.h (+27/-4)
include/server/mir/compositor/renderer.h (+2/-2)
include/server/mir/compositor/scene.h (+7/-4)
include/server/mir/default_server_configuration.h (+12/-8)
include/server/mir/frontend/display_changer.h (+0/-1)
include/server/mir/frontend/session_authorizer.h (+3/-1)
include/server/mir/input/surface.h (+1/-1)
include/server/mir/scene/surface.h (+59/-0)
include/server/mir/scene/surface_configurator.h (+4/-4)
include/server/mir/scene/surface_coordinator.h (+17/-12)
include/server/mir/scene/surface_event_source.h (+49/-0)
include/server/mir/scene/surface_factory.h (+14/-14)
include/server/mir/scene/surface_observer.h (+45/-0)
include/server/mir/scene/surface_ranker.h (+2/-2)
include/server/mir/shell/surface.h (+1/-3)
include/server/mir/shell/surface_factory.h (+6/-8)
include/shared/mir/geometry/length.h (+102/-0)
include/test/mir_test_doubles/fake_renderable.h (+5/-5)
include/test/mir_test_doubles/mock_buffer_bundle.h (+1/-1)
include/test/mir_test_doubles/mock_buffer_stream.h (+1/-1)
include/test/mir_test_doubles/mock_display_buffer.h (+1/-1)
include/test/mir_test_doubles/mock_display_changer.h (+0/-1)
include/test/mir_test_doubles/mock_display_device.h (+1/-1)
include/test/mir_test_doubles/mock_egl.h (+27/-0)
include/test/mir_test_doubles/mock_gl_config.h (+43/-0)
include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+0/-105)
include/test/mir_test_doubles/mock_hwc_device_wrapper.h (+42/-0)
include/test/mir_test_doubles/mock_input_surface.h (+2/-2)
include/test/mir_test_doubles/mock_renderable.h (+12/-3)
include/test/mir_test_doubles/mock_scene.h (+6/-2)
include/test/mir_test_doubles/mock_surface.h (+14/-12)
include/test/mir_test_doubles/mock_surface_configurator.h (+4/-4)
include/test/mir_test_doubles/mock_surface_factory.h (+4/-3)
include/test/mir_test_doubles/mock_surface_ranker.h (+2/-2)
include/test/mir_test_doubles/null_display_buffer.h (+1/-1)
include/test/mir_test_doubles/null_display_changer.h (+0/-3)
include/test/mir_test_doubles/null_platform.h (+2/-1)
include/test/mir_test_doubles/null_surface_configurator.h (+4/-4)
include/test/mir_test_doubles/stub_buffer_stream.h (+1/-1)
include/test/mir_test_doubles/stub_display_builder.h (+1/-1)
include/test/mir_test_doubles/stub_display_device.h (+1/-1)
include/test/mir_test_doubles/stub_gl_config.h (+43/-0)
include/test/mir_test_doubles/stub_ipc_factory.h (+1/-1)
include/test/mir_test_doubles/stub_renderable.h (+2/-2)
include/test/mir_test_doubles/stub_session_authorizer.h (+4/-0)
include/test/mir_test_doubles/stub_surface_builder.h (+0/-69)
include/test/mir_test_doubles/stub_surface_ranker.h (+0/-44)
include/test/mir_test_framework/declarative_placement_strategy.h (+64/-0)
include/test/mir_test_framework/udev_environment.h (+1/-0)
src/client/default_connection_configuration.cpp (+1/-1)
src/client/lttng/input_receiver_report_tp.h (+1/-0)
src/client/lttng/rpc_report_tp.h (+1/-0)
src/client/mir_client_library.cpp (+11/-2)
src/client/rpc/mir_basic_rpc_channel.cpp (+3/-3)
src/client/rpc/mir_basic_rpc_channel.h (+4/-3)
src/client/rpc/mir_socket_rpc_channel.cpp (+41/-32)
src/client/rpc/mir_socket_rpc_channel.h (+3/-1)
src/platform/CMakeLists.txt (+2/-1)
src/platform/graphics/android/CMakeLists.txt (+4/-0)
src/platform/graphics/android/android_display.cpp (+2/-1)
src/platform/graphics/android/android_display.h (+2/-0)
src/platform/graphics/android/android_platform.cpp (+37/-4)
src/platform/graphics/android/android_platform.h (+2/-1)
src/platform/graphics/android/display_buffer.cpp (+1/-1)
src/platform/graphics/android/display_buffer.h (+1/-1)
src/platform/graphics/android/display_device.h (+1/-1)
src/platform/graphics/android/fb_device.cpp (+1/-1)
src/platform/graphics/android/fb_device.h (+1/-1)
src/platform/graphics/android/gl_context.cpp (+17/-10)
src/platform/graphics/android/gl_context.h (+4/-1)
src/platform/graphics/android/hwc_common_device.cpp (+2/-2)
src/platform/graphics/android/hwc_common_device.h (+2/-1)
src/platform/graphics/android/hwc_device.cpp (+2/-1)
src/platform/graphics/android/hwc_device.h (+2/-15)
src/platform/graphics/android/hwc_fb_device.cpp (+12/-17)
src/platform/graphics/android/hwc_fb_device.h (+5/-1)
src/platform/graphics/android/hwc_formatted_logger.cpp (+177/-0)
src/platform/graphics/android/hwc_formatted_logger.h (+41/-0)
src/platform/graphics/android/hwc_layerlist.cpp (+4/-4)
src/platform/graphics/android/hwc_layerlist.h (+2/-2)
src/platform/graphics/android/hwc_logger.h (+46/-0)
src/platform/graphics/android/hwc_wrapper.h (+47/-0)
src/platform/graphics/android/real_hwc_wrapper.cpp (+11/-2)
src/platform/graphics/android/real_hwc_wrapper.h (+6/-3)
src/platform/graphics/android/resource_factory.cpp (+35/-2)
src/platform/graphics/android/resource_factory.h (+4/-0)
src/platform/graphics/mesa/CMakeLists.txt (+1/-0)
src/platform/graphics/mesa/display.cpp (+13/-3)
src/platform/graphics/mesa/display.h (+5/-2)
src/platform/graphics/mesa/display_buffer.cpp (+3/-1)
src/platform/graphics/mesa/display_buffer.h (+3/-1)
src/platform/graphics/mesa/display_helpers.cpp (+15/-3)
src/platform/graphics/mesa/display_helpers.h (+5/-5)
src/platform/graphics/mesa/platform.cpp (+11/-1)
src/platform/graphics/mesa/platform.h (+2/-1)
src/platform/options/default_configuration.cpp (+32/-3)
src/platform/shared_library_loader.cpp (+38/-0)
src/server/CMakeLists.txt (+1/-1)
src/server/compositor/buffer_bundle.h (+13/-1)
src/server/compositor/buffer_stream_surfaces.cpp (+2/-2)
src/server/compositor/buffer_stream_surfaces.h (+1/-1)
src/server/compositor/bypass.cpp (+6/-1)
src/server/compositor/default_display_buffer_compositor.cpp (+32/-57)
src/server/compositor/default_display_buffer_compositor.h (+1/-2)
src/server/compositor/gl_renderer.cpp (+68/-22)
src/server/compositor/occlusion.cpp (+28/-16)
src/server/compositor/occlusion.h (+2/-24)
src/server/compositor/rendering_operator.cpp (+5/-11)
src/server/compositor/rendering_operator.h (+3/-7)
src/server/compositor/screencast_display_buffer.cpp (+1/-1)
src/server/compositor/screencast_display_buffer.h (+1/-1)
src/server/compositor/switching_bundle.cpp (+6/-3)
src/server/compositor/switching_bundle.h (+3/-4)
src/server/compositor/temporary_buffers.cpp (+2/-2)
src/server/compositor/temporary_buffers.h (+1/-1)
src/server/default_server_configuration.cpp (+11/-6)
src/server/frontend/CMakeLists.txt (+1/-0)
src/server/frontend/default_configuration.cpp (+23/-7)
src/server/frontend/event_sender.cpp (+1/-1)
src/server/frontend/message_receiver.h (+3/-1)
src/server/frontend/message_sender.h (+2/-2)
src/server/frontend/protobuf_ipc_factory.h (+1/-2)
src/server/frontend/protobuf_responder.cpp (+9/-8)
src/server/frontend/protobuf_responder.h (+1/-1)
src/server/frontend/protobuf_session_creator.cpp (+1/-2)
src/server/frontend/session_mediator.cpp (+0/-6)
src/server/frontend/socket_messenger.cpp (+29/-14)
src/server/frontend/socket_messenger.h (+4/-3)
src/server/frontend/socket_session.cpp (+16/-9)
src/server/frontend/socket_session.h (+3/-2)
src/server/frontend/unauthorized_display_changer.cpp (+0/-5)
src/server/frontend/unauthorized_display_changer.h (+0/-2)
src/server/frontend/unauthorized_screencast.cpp (+46/-0)
src/server/frontend/unauthorized_screencast.h (+44/-0)
src/server/graphics/default_configuration.cpp (+20/-21)
src/server/graphics/nested/nested_display.cpp (+11/-4)
src/server/graphics/nested/nested_display.h (+6/-2)
src/server/graphics/nested/nested_output.cpp (+1/-1)
src/server/graphics/nested/nested_output.h (+1/-1)
src/server/graphics/nested/nested_platform.cpp (+5/-2)
src/server/graphics/nested/nested_platform.h (+2/-1)
src/server/graphics/offscreen/display_buffer.cpp (+1/-1)
src/server/graphics/offscreen/display_buffer.h (+1/-1)
src/server/mirserver.pc.in (+1/-1)
src/server/scene/CMakeLists.txt (+1/-2)
src/server/scene/application_session.cpp (+10/-2)
src/server/scene/basic_surface.cpp (+193/-27)
src/server/scene/basic_surface.h (+73/-26)
src/server/scene/default_configuration.cpp (+18/-27)
src/server/scene/gl_pixel_buffer.cpp (+7/-0)
src/server/scene/mediating_display_changer.cpp (+0/-23)
src/server/scene/mediating_display_changer.h (+0/-2)
src/server/scene/mutable_surface_state.h (+0/-52)
src/server/scene/surface_allocator.cpp (+8/-4)
src/server/scene/surface_allocator.h (+8/-4)
src/server/scene/surface_controller.cpp (+23/-13)
src/server/scene/surface_controller.h (+16/-15)
src/server/scene/surface_event_source.cpp (+62/-0)
src/server/scene/surface_impl.cpp (+0/-273)
src/server/scene/surface_impl.h (+0/-114)
src/server/scene/surface_source.cpp (+0/-47)
src/server/scene/surface_source.h (+0/-64)
src/server/scene/surface_stack.cpp (+23/-34)
src/server/scene/surface_stack.h (+19/-19)
src/server/scene/surface_stack_model.h (+13/-6)
src/server/shell/default_configuration.cpp (+1/-1)
src/server/shell/default_focus_mechanism.cpp (+3/-1)
src/server/shell/organising_surface_factory.cpp (+29/-10)
src/server/shell/organising_surface_factory.h (+9/-6)
src/shared/sharedlibrary/CMakeLists.txt (+5/-0)
tests/CMakeLists.txt (+3/-10)
tests/acceptance-tests/test_client_authorization.cpp (+3/-0)
tests/acceptance-tests/test_client_input.cpp (+33/-70)
tests/acceptance-tests/test_client_screencast.cpp (+50/-0)
tests/acceptance-tests/test_display_configuration.cpp (+5/-4)
tests/acceptance-tests/test_protobuf.cpp (+5/-0)
tests/acceptance-tests/test_server_disconnect.cpp (+2/-0)
tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+6/-6)
tests/acceptance-tests/test_surfaces_with_output_id.cpp (+7/-1)
tests/integration-tests/compositor/test_buffer_stream.cpp (+21/-21)
tests/integration-tests/compositor/test_swapping_swappers.cpp (+2/-4)
tests/integration-tests/graphics/android/test_display_integration.cpp (+9/-6)
tests/integration-tests/graphics/android/test_internal_client.cpp (+7/-7)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+4/-1)
tests/integration-tests/test_display_info.cpp (+2/-1)
tests/integration-tests/test_session_manager.cpp (+1/-1)
tests/integration-tests/test_surfaceloop.cpp (+4/-2)
tests/integration-tests/test_swapinterval.cpp (+1/-1)
tests/mir_test_framework/CMakeLists.txt (+10/-11)
tests/mir_test_framework/declarative_placement_strategy.cpp (+58/-0)
tests/mir_test_framework/stubbed_server_configuration.cpp (+2/-1)
tests/mir_test_framework/udev_environment.cpp (+22/-2)
tests/mir_test_framework/udev_recordings/bluetooth-magic-trackpad.ioctl (+21/-0)
tests/mir_test_framework/udev_recordings/bluetooth-magic-trackpad.umockdev (+222/-0)
tests/mir_test_framework/udev_recordings/laptop-keyboard.ioctl (+12/-0)
tests/mir_test_framework/udev_recordings/laptop-keyboard.umockdev (+74/-0)
tests/mir_test_framework/udev_recordings/synaptics-touchpad.ioctl (+29/-0)
tests/mir_test_framework/udev_recordings/synaptics-touchpad.umockdev (+65/-0)
tests/mir_test_framework/udev_recordings/usb-keyboard.ioctl (+13/-0)
tests/mir_test_framework/udev_recordings/usb-keyboard.umockdev (+244/-0)
tests/mir_test_framework/udev_recordings/usb-mouse.ioctl (+14/-0)
tests/mir_test_framework/udev_recordings/usb-mouse.umockdev (+240/-0)
tests/mir_test_framework/using_stub_client_platform.cpp (+11/-2)
tests/unit-tests/CMakeLists.txt (+5/-14)
tests/unit-tests/android_input/CMakeLists.txt (+1/-0)
tests/unit-tests/android_input/test_eventhub.cpp (+125/-0)
tests/unit-tests/client/test_mir_connection.cpp (+6/-0)
tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+348/-444)
tests/unit-tests/compositor/test_gl_renderer.cpp (+21/-2)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+5/-2)
tests/unit-tests/compositor/test_occlusion.cpp (+123/-81)
tests/unit-tests/compositor/test_rendering_operator.cpp (+15/-15)
tests/unit-tests/compositor/test_switching_bundle.cpp (+69/-51)
tests/unit-tests/frontend/test_event_sender.cpp (+7/-7)
tests/unit-tests/frontend/test_session_mediator.cpp (+4/-5)
tests/unit-tests/frontend/test_socket_session.cpp (+43/-14)
tests/unit-tests/geometry/CMakeLists.txt (+1/-0)
tests/unit-tests/geometry/test-length.cpp (+124/-0)
tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/hwc_struct_helpers.h (+8/-0)
tests/unit-tests/graphics/android/test_android_fb.cpp (+64/-31)
tests/unit-tests/graphics/android/test_hwc_common_device.cpp (+3/-1)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+5/-9)
tests/unit-tests/graphics/android/test_hwc_display.cpp (+6/-1)
tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+44/-74)
tests/unit-tests/graphics/android/test_hwc_logger.cpp (+132/-0)
tests/unit-tests/graphics/android/test_hwc_wrapper.cpp (+28/-7)
tests/unit-tests/graphics/android/test_output_builder.cpp (+4/-1)
tests/unit-tests/graphics/android/test_resource_factory.cpp (+5/-4)
tests/unit-tests/graphics/mesa/test_display.cpp (+41/-8)
tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+12/-0)
tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+4/-2)
tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+7/-4)
tests/unit-tests/graphics/mesa/test_internal_native_display.cpp (+0/-4)
tests/unit-tests/graphics/mesa/test_internal_native_surface.cpp (+0/-3)
tests/unit-tests/graphics/nested/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/nested/test_nested_display.cpp (+27/-0)
tests/unit-tests/graphics/test_display.cpp (+4/-2)
tests/unit-tests/input/android/test_android_input_application_handle.cpp (+1/-1)
tests/unit-tests/input/android/test_android_input_registrar.cpp (+2/-3)
tests/unit-tests/input/android/test_android_input_window_handle.cpp (+18/-11)
tests/unit-tests/scene/test_application_session.cpp (+12/-14)
tests/unit-tests/scene/test_basic_surface.cpp (+124/-106)
tests/unit-tests/scene/test_default_focus_mechanism.cpp (+23/-40)
tests/unit-tests/scene/test_gl_pixel_buffer.cpp (+10/-0)
tests/unit-tests/scene/test_session_manager.cpp (+19/-17)
tests/unit-tests/scene/test_surface.cpp (+73/-31)
tests/unit-tests/scene/test_surface_controller.cpp (+36/-14)
tests/unit-tests/scene/test_surface_impl.cpp (+117/-209)
tests/unit-tests/scene/test_surface_stack.cpp (+143/-317)
tests/unit-tests/shell/test_organising_surface_factory.cpp (+24/-16)
tools/valgrind_suppressions_armhf (+30/-0)
tools/valgrind_suppressions_generic (+7/-0)
To merge this branch: bzr merge lp:~mir-team/mir/trunk-0.1.8
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Daniel van Vugt Approve
kevin gunn (community) Approve
Review via email: mp+213790@code.launchpad.net

Commit message

New upstream Mir release 0.1.8 (development-branch r1523), plus changelog
additions.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

There is arguably one important fix missing from the 0.1.8 release. That is bug 1301040. We might want to add it in here...

Revision history for this message
Kevin DuBois (kdub) wrote :

Yes, the fix for that lp:~mterry/mir/missing-links (in the landing queue at time of this comment) should make it into this release. (would be caught during the silo build)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
kevin gunn (kgunn72) wrote :

there is one more we should cherry pick for https://bugs.launchpad.net/mir/+bug/1256360
which is proposed to be solved by https://code.launchpad.net/~albaguirre/mir/fix-1256360/+merge/214355

review: Needs Fixing
Revision history for this message
kevin gunn (kgunn72) wrote :

Did you test your feature/code change/bug fix ? what device(s) ?
yes - n4, desktop

Did you break mir server API or ABI and have the relevant bumps to .so and debian docs been made ?
yes, server ABI only, bumps have been made

Did you break mir client API or ABI and have you followed up with the known clients & announced on mir-devel mailing list ?
yes, server only, unity-mir/server updates made

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Changelog entry missing for latest commit.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '3rd_party/android-input/android/CMakeLists.txt'
--- 3rd_party/android-input/android/CMakeLists.txt 2014-03-06 06:05:17 +0000
+++ 3rd_party/android-input/android/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -7,6 +7,7 @@
7 system/extras/ext4_utils7 system/extras/ext4_utils
88
9 ${PROJECT_SOURCE_DIR}/include/server9 ${PROJECT_SOURCE_DIR}/include/server
10 ${PROJECT_SOURCE_DIR}/include/platform
10)11)
1112
12add_definitions(13add_definitions(
@@ -64,6 +65,7 @@
64target_link_libraries(65target_link_libraries(
65 android-input66 android-input
6667
68 mirplatform
67 ${Boost_LIBRARIES}69 ${Boost_LIBRARIES}
68)70)
6971
7072
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2013-10-03 05:12:59 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2014-04-07 13:29:13 +0000
@@ -205,34 +205,34 @@
205205
206// --- EventHub ---206// --- EventHub ---
207207
208const uint32_t EventHub::EPOLL_ID_INOTIFY;208const uint32_t EventHub::EPOLL_ID_UDEV;
209const uint32_t EventHub::EPOLL_ID_WAKE;209const uint32_t EventHub::EPOLL_ID_WAKE;
210const int EventHub::EPOLL_SIZE_HINT;210const int EventHub::EPOLL_SIZE_HINT;
211const int EventHub::EPOLL_MAX_EVENTS;211const int EventHub::EPOLL_MAX_EVENTS;
212212
213EventHub::EventHub(std::shared_ptr<mi::InputReport> const& input_report) :213EventHub::EventHub(std::shared_ptr<mi::InputReport> const& input_report) :
214 input_report(input_report),214 input_report(input_report),
215 device_listener{mir::udev::Context()},
215 mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1),216 mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1),
216 mOpeningDevices(0), mClosingDevices(0),217 mOpeningDevices(0), mClosingDevices(0),
217 mNeedToSendFinishedDeviceScan(false),218 mNeedToSendFinishedDeviceScan(false),
218 mNeedToReopenDevices(false), mNeedToScanDevices(true),219 mNeedToReopenDevices(false), mNeedToScanDevices(true),
219 mPendingEventCount(0), mPendingEventIndex(0), mPendingINotify(false) {220 mPendingEventCount(0), mPendingEventIndex(0), mPendingUdevEvent(false) {
220 acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);221 acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);
221222
222 mEpollFd = epoll_create(EPOLL_SIZE_HINT);223 mEpollFd = epoll_create(EPOLL_SIZE_HINT);
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);
224225
225 mINotifyFd = inotify_init();226 device_listener.filter_by_subsystem("input");
226 int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE | IN_ATTRIB);227 device_listener.enable();
227 LOG_ALWAYS_FATAL_IF(result < 0, "Could not register INotify for %s. errno=%d",228
228 DEVICE_PATH, errno);
229229
230 struct epoll_event eventItem;230 struct epoll_event eventItem;
231 memset(&eventItem, 0, sizeof(eventItem));231 memset(&eventItem, 0, sizeof(eventItem));
232 eventItem.events = EPOLLIN;232 eventItem.events = EPOLLIN;
233 eventItem.data.u32 = EPOLL_ID_INOTIFY;233 eventItem.data.u32 = EPOLL_ID_UDEV;
234 result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mINotifyFd, &eventItem);234 int result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, device_listener.fd(), &eventItem);
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);
236236
237 int wakeFds[2];237 int wakeFds[2];
238 result = pipe(wakeFds);238 result = pipe(wakeFds);
@@ -265,7 +265,6 @@
265 }265 }
266266
267 ::close(mEpollFd);267 ::close(mEpollFd);
268 ::close(mINotifyFd);
269 ::close(mWakeReadPipeFd);268 ::close(mWakeReadPipeFd);
270 ::close(mWakeWritePipeFd);269 ::close(mWakeWritePipeFd);
271270
@@ -730,9 +729,9 @@
730 bool deviceChanged = false;729 bool deviceChanged = false;
731 while (mPendingEventIndex < mPendingEventCount) {730 while (mPendingEventIndex < mPendingEventCount) {
732 const struct epoll_event& eventItem = mPendingEventItems[mPendingEventIndex++];731 const struct epoll_event& eventItem = mPendingEventItems[mPendingEventIndex++];
733 if (eventItem.data.u32 == EPOLL_ID_INOTIFY) {732 if (eventItem.data.u32 == EPOLL_ID_UDEV) {
734 if (eventItem.events & EPOLLIN) {733 if (eventItem.events & EPOLLIN) {
735 mPendingINotify = true;734 mPendingUdevEvent = true;
736 } else {735 } else {
737 ALOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events);736 ALOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events);
738 }737 }
@@ -839,9 +838,9 @@
839 // readNotify() will modify the list of devices so this must be done after838 // readNotify() will modify the list of devices so this must be done after
840 // processing all other events to ensure that we read all remaining events839 // processing all other events to ensure that we read all remaining events
841 // before closing the devices.840 // before closing the devices.
842 if (mPendingINotify && mPendingEventIndex >= mPendingEventCount) {841 if (mPendingUdevEvent && mPendingEventIndex >= mPendingEventCount) {
843 mPendingINotify = false;842 mPendingUdevEvent = false;
844 readNotifyLocked();843 handleUdevEventsLocked();
845 deviceChanged = true;844 deviceChanged = true;
846 }845 }
847846
@@ -916,15 +915,44 @@
916}915}
917916
918void EventHub::scanDevicesLocked() {917void EventHub::scanDevicesLocked() {
919 status_t res = scanDirLocked(DEVICE_PATH);918 mir::udev::Enumerator input_enumerator{std::make_shared<mir::udev::Context>()};
920 if(res < 0) {919
921 ALOGE("scan dir failed for %s\n", DEVICE_PATH);920 input_enumerator.match_subsystem("input");
921 input_enumerator.scan_devices();
922
923 for (auto& device : input_enumerator)
924 {
925 if (device.devnode() != nullptr)
926 {
927 openDeviceLocked(device.devnode());
928 }
922 }929 }
930
923 if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) {931 if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) {
924 createVirtualKeyboardLocked();932 createVirtualKeyboardLocked();
925 }933 }
926}934}
927935
936void EventHub::handleUdevEventsLocked()
937{
938 device_listener.process_events([this](mir::udev::Monitor::EventType type, mir::udev::Device const& dev){
939 if (type == mir::udev::Monitor::ADDED)
940 {
941 if (dev.devnode() != nullptr)
942 {
943 openDeviceLocked(dev.devnode());
944 }
945 }
946 else if (type == mir::udev::Monitor::REMOVED)
947 {
948 if (dev.devnode() != nullptr)
949 {
950 closeDeviceByPathLocked(dev.devnode());
951 }
952 }
953 });
954}
955
928// ----------------------------------------------------------------------------956// ----------------------------------------------------------------------------
929957
930static bool containsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex) {958static bool containsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex) {
@@ -1391,80 +1419,6 @@
1391 }1419 }
1392}1420}
13931421
1394status_t EventHub::readNotifyLocked() {
1395 int res;
1396 char devname[PATH_MAX];
1397 char *filename;
1398 char event_buf[512];
1399 int event_size;
1400 int event_pos = 0;
1401 struct inotify_event *event;
1402
1403 ALOGV("EventHub::readNotify nfd: %d\n", mINotifyFd);
1404 res = read(mINotifyFd, event_buf, sizeof(event_buf));
1405 if(res < (int)sizeof(*event)) {
1406 if(errno == EINTR)
1407 return 0;
1408 ALOGW("could not get event, %s\n", strerror(errno));
1409 return -1;
1410 }
1411 //printf("got %d bytes of event information\n", res);
1412
1413 strcpy(devname, DEVICE_PATH);
1414 filename = devname + strlen(devname);
1415 *filename++ = '/';
1416
1417 while(res >= (int)sizeof(*event)) {
1418 event = (struct inotify_event *)(event_buf + event_pos);
1419 //printf("%d: %08x \"%s\"\n", event->wd, event->mask, event->len ? event->name : "");
1420 if(event->len) {
1421 strcpy(filename, event->name);
1422 if(event->mask & IN_CREATE) {
1423 openDeviceLocked(devname);
1424 } else if (event->mask & IN_ATTRIB) {
1425 Device* device = getDeviceByPathLocked(devname);
1426 if (!device) {
1427 ALOGI("Retry opening device file %s", devname);
1428 // file permissions might have changed, making the device readable now
1429 // let's retry opening it
1430 openDeviceLocked(devname);
1431 }
1432 } else {
1433 ALOGI("Removing device '%s' due to inotify event\n", devname);
1434 closeDeviceByPathLocked(devname);
1435 }
1436 }
1437 event_size = sizeof(*event) + event->len;
1438 res -= event_size;
1439 event_pos += event_size;
1440 }
1441 return 0;
1442}
1443
1444status_t EventHub::scanDirLocked(const char *dirname)
1445{
1446 char devname[PATH_MAX];
1447 char *filename;
1448 DIR *dir;
1449 struct dirent *de;
1450 dir = opendir(dirname);
1451 if(dir == NULL)
1452 return -1;
1453 strcpy(devname, dirname);
1454 filename = devname + strlen(devname);
1455 *filename++ = '/';
1456 while((de = readdir(dir))) {
1457 if(de->d_name[0] == '.' &&
1458 (de->d_name[1] == '\0' ||
1459 (de->d_name[1] == '.' && de->d_name[2] == '\0')))
1460 continue;
1461 strcpy(filename, de->d_name);
1462 openDeviceLocked(devname);
1463 }
1464 closedir(dir);
1465 return 0;
1466}
1467
1468void EventHub::requestReopenDevices() {1422void EventHub::requestReopenDevices() {
1469 ALOGV("requestReopenDevices() called");1423 ALOGV("requestReopenDevices() called");
14701424
14711425
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2013-10-03 05:12:59 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2014-04-07 13:29:13 +0000
@@ -18,6 +18,8 @@
18#ifndef _RUNTIME_EVENT_HUB_H18#ifndef _RUNTIME_EVENT_HUB_H
19#define _RUNTIME_EVENT_HUB_H19#define _RUNTIME_EVENT_HUB_H
2020
21#include "mir/udev/wrapper.h"
22
21#include <androidfw/Input.h>23#include <androidfw/Input.h>
22#include <androidfw/InputDevice.h>24#include <androidfw/InputDevice.h>
23#include <androidfw/Keyboard.h>25#include <androidfw/Keyboard.h>
@@ -366,9 +368,8 @@
366 void closeDeviceLocked(Device* device);368 void closeDeviceLocked(Device* device);
367 void closeAllDevicesLocked();369 void closeAllDevicesLocked();
368370
369 status_t scanDirLocked(const char *dirname);
370 void scanDevicesLocked();371 void scanDevicesLocked();
371 status_t readNotifyLocked();372 void handleUdevEventsLocked();
372373
373 Device* getDeviceLocked(int32_t deviceId) const;374 Device* getDeviceLocked(int32_t deviceId) const;
374 Device* getDeviceByPathLocked(const char* devicePath) const;375 Device* getDeviceByPathLocked(const char* devicePath) const;
@@ -407,12 +408,12 @@
407 Vector<String8> mExcludedDevices;408 Vector<String8> mExcludedDevices;
408409
409 int mEpollFd;410 int mEpollFd;
410 int mINotifyFd;411 mir::udev::Monitor device_listener;
411 int mWakeReadPipeFd;412 int mWakeReadPipeFd;
412 int mWakeWritePipeFd;413 int mWakeWritePipeFd;
413414
414 // Ids used for epoll notifications not associated with devices.415 // Ids used for epoll notifications not associated with devices.
415 static const uint32_t EPOLL_ID_INOTIFY = 0x80000001;416 static const uint32_t EPOLL_ID_UDEV = 0x80000001;
416 static const uint32_t EPOLL_ID_WAKE = 0x80000002;417 static const uint32_t EPOLL_ID_WAKE = 0x80000002;
417418
418 // Epoll FD list size hint.419 // Epoll FD list size hint.
@@ -425,7 +426,7 @@
425 struct epoll_event mPendingEventItems[EPOLL_MAX_EVENTS];426 struct epoll_event mPendingEventItems[EPOLL_MAX_EVENTS];
426 size_t mPendingEventCount;427 size_t mPendingEventCount;
427 size_t mPendingEventIndex;428 size_t mPendingEventIndex;
428 bool mPendingINotify;429 bool mPendingUdevEvent;
429};430};
430431
431// Made available to test432// Made available to test
432433
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-03-06 06:05:17 +0000
+++ CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -28,7 +28,7 @@
2828
29set(MIR_VERSION_MAJOR 0)29set(MIR_VERSION_MAJOR 0)
30set(MIR_VERSION_MINOR 1)30set(MIR_VERSION_MINOR 1)
31set(MIR_VERSION_PATCH 7)31set(MIR_VERSION_PATCH 8)
3232
33set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)33set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
34execute_process(34execute_process(
3535
=== modified file 'benchmarks/android-input/CMakeLists.txt'
--- benchmarks/android-input/CMakeLists.txt 2013-10-15 10:10:05 +0000
+++ benchmarks/android-input/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -5,7 +5,9 @@
5 )5 )
66
7include_directories(7include_directories(
8 ${Mir_SOURCE_DIR}/include/test)8 ${Mir_SOURCE_DIR}/include/test
9 ${Mir_SOURCE_DIR}/include/platform
10)
911
10add_executable(input-reader-perf ${SOURCES})12add_executable(input-reader-perf ${SOURCES})
1113
1214
=== modified file 'cmake/MirCommon.cmake'
--- cmake/MirCommon.cmake 2014-03-06 06:05:17 +0000
+++ cmake/MirCommon.cmake 2014-04-07 13:29:13 +0000
@@ -22,8 +22,10 @@
22 valgrind)22 valgrind)
2323
24 if(VALGRIND_EXECUTABLE)24 if(VALGRIND_EXECUTABLE)
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")
26 set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic")
26 set(DISCOVER_FLAGS "--enable-memcheck")27 set(DISCOVER_FLAGS "--enable-memcheck")
28 set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic")
27 if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf")29 if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf")
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")
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")
@@ -35,10 +37,11 @@
3537
36function (mir_discover_tests EXECUTABLE)38function (mir_discover_tests EXECUTABLE)
37 if(DISABLE_GTEST_TEST_DISCOVERY)39 if(DISABLE_GTEST_TEST_DISCOVERY)
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.*")
3941 add_test(${EXECUTABLE}_death_tests ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} "--gtest_filter=*DeathTest.*")
40 if (${ARGC} GREATER 1)42 if (${ARGC} GREATER 1)
41 set_property(TEST ${EXECUTABLE} PROPERTY ENVIRONMENT ${ARGN})43 set_property(TEST ${EXECUTABLE} PROPERTY ENVIRONMENT ${ARGN})
44 set_property(TEST ${EXECUTABLE}_death_tests PROPERTY ENVIRONMENT ${ARGN})
42 endif()45 endif()
43 else()46 else()
44 set(CHECK_TEST_DISCOVERY_TARGET_NAME "check_discover_tests_in_${EXECUTABLE}")47 set(CHECK_TEST_DISCOVERY_TARGET_NAME "check_discover_tests_in_${EXECUTABLE}")
@@ -82,7 +85,15 @@
82function (mir_add_memcheck_test)85function (mir_add_memcheck_test)
83 if (ENABLE_MEMCHECK_OPTION)86 if (ENABLE_MEMCHECK_OPTION)
84 if(DISABLE_GTEST_TEST_DISCOVERY)87 if(DISABLE_GTEST_TEST_DISCOVERY)
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(
89 memcheck_test ALL
90 )
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)
92 add_dependencies(
93 memcheck_test
94
95 mir_test_memory_error
96 )
86 else()97 else()
87 add_custom_target(98 add_custom_target(
88 memcheck_test ALL99 memcheck_test ALL
89100
=== modified file 'cmake/src/mir/CMakeLists.txt'
--- cmake/src/mir/CMakeLists.txt 2013-03-13 04:54:15 +0000
+++ cmake/src/mir/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -17,3 +17,8 @@
17 mir_test_memory_error PROPERTIES17 mir_test_memory_error PROPERTIES
18 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/mir_gtest18 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/mir_gtest
19)19)
20
21file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/fail_on_success.sh
22 DESTINATION ${CMAKE_BINARY_DIR}/mir_gtest
23 USE_SOURCE_PERMISSIONS
24)
2025
=== added file 'cmake/src/mir/fail_on_success.sh'
--- cmake/src/mir/fail_on_success.sh 1970-01-01 00:00:00 +0000
+++ cmake/src/mir/fail_on_success.sh 2014-04-07 13:29:13 +0000
@@ -0,0 +1,8 @@
1#!/bin/sh
2
3$@
4
5if [ $? -eq 0 ] ; then
6 exit 1;
7fi
8exit 0;
09
=== modified file 'cmake/src/mir/mir_discover_gtest_tests.cpp'
--- cmake/src/mir/mir_discover_gtest_tests.cpp 2014-03-06 06:05:17 +0000
+++ cmake/src/mir/mir_discover_gtest_tests.cpp 2014-04-07 13:29:13 +0000
@@ -234,6 +234,18 @@
234}234}
235}235}
236236
237bool is_death_test(string const& test)
238{
239 // precondition: test will match Foo.*
240 // assumption: death tests will match FooDeathTest.*
241 bool death_test = false;
242 if (test.size() > strlen("DeathTest.*"))
243 death_test = test.substr(test.size() - strlen("DeathTest.*"),
244 strlen("DeathTest")) == "DeathTest";
245
246 return death_test;
247}
248
237int main (int argc, char **argv)249int main (int argc, char **argv)
238{250{
239 int output_width = get_output_width();251 int output_width = get_output_width();
@@ -291,8 +303,9 @@
291 snprintf(303 snprintf(
292 cmd_line,304 cmd_line,
293 sizeof(cmd_line),305 sizeof(cmd_line),
294 config.enable_memcheck ? memcheck_cmd_line_pattern(config.suppressions).c_str() :306 (config.enable_memcheck && !is_death_test(*test)) ?
295 ordinary_cmd_line_pattern().c_str(),307 memcheck_cmd_line_pattern(config.suppressions).c_str() :
308 ordinary_cmd_line_pattern().c_str(),
296 test_suite.c_str(),309 test_suite.c_str(),
297 elide_string_left(*test, output_width/2).c_str(),310 elide_string_left(*test, output_width/2).c_str(),
298 config.executable,311 config.executable,
299312
=== modified file 'debian/changelog'
--- debian/changelog 2014-03-18 18:38:01 +0000
+++ debian/changelog 2014-04-07 13:29:13 +0000
@@ -1,3 +1,69 @@
1mir (0.1.8-0ubuntu1) UNRELEASED; urgency=medium
2
3 * New upstream release 0.1.8 (https://launchpad.net/mir/+milestone/0.1.8)
4 - mirclient ABI unchanged, still at 7. Clients do not need rebuilding.
5 - mirserver ABI bumped to 18. Shells need rebuilding.
6 - Server API changes affecting shells:
7 . GLRenderer::tessellate() changed syntax.
8 . graphics::Platform::create_display() has a new parameter allowing you
9 to customize the compositor's (E)GL configutation.
10 . Renderable::buffer(unsigned long frameno) is now:
11 Renderable::buffer(void const* user_id). See below.
12 . Renderable::should_be_rendered_in() is replaced by a more natural:
13 Renderable::visble()
14 . input::Surface::name() returns by value instead of reference now,
15 to ensure future thread safety.
16 - Switched EventHub device enumeration and hotplug to Udev. NOTE! This
17 means mir_test_* can't run natively on touch devices any more without
18 some setup first:
19 sudo mount -o remount,rw /
20 sudo apt-get update
21 sudo apt-get install -y umockdev
22 umockdev-run -- bin/mir_unit_tests
23 - Added logging for HWC events.
24 - Continued consolidation of Surface classes toward a simpler architecture.
25 - Introduced "RenderableList" as the way to sample the Scene contents,
26 and started using that in the default compositor.
27 - Introduced physical length units and conversion (geometry::Length) in
28 preparation for arbitrary DPI rendering.
29 - Added some decorations to demo-shell; shadows and basic title bars, all
30 anti-aliased and high-DPI scalable.
31 - Multi-monitor frame sync has been redesigned to eliminate the need for
32 frame number tracking.
33 - Bugs (and enhancements) resolved:
34 . [enhancement] Please move input detection to libudev (LP: #1237784)
35 . [enhancement] Add a clamping resize mode to GLRenderer (LP: #1259887)
36 . [regression] Intermittent loss of multimonitor frame sync
37 (LP: #1290306)
38 . [enhancement] Make GL config options configurable (LP: #1290780)
39 . memcheck-test doesn't test anything when DISABLED_GTEST_DISCOVERY is
40 enabled (LP: #1291876)
41 . "Error opening DRM device" is always followed by "Unknown error -(some
42 negative number)" (LP: #1292384)
43 . Rendering/composition gets stopped early (LP: #1293896)
44 . Ubuntu Touch Settings and terminal apps are not rendering correctly on
45 rotate. (LP: #1294048)
46 . [regression] Apps are much slower to open (LP: #1294051)
47 . Settings app opens to a blank screen unless given enough time to render
48 or the app is touched (LP: #1294053)
49 . TestClientInput/DemoPrivateProtobuf memory leak is causing regular CI
50 test failures (LP: #1295231)
51 . OSK touch events "fall through" and hit surface behind them
52 (LP: #1297878)
53 . [enhancement] add a test for composite of last client post
54 (LP: #1298596)
55 . [regression] Surfaces vanish as soon as their edges touch the edge of
56 screen (LP: #1301115)
57 * Cherry-picked from future release 0.1.9:
58 - Bug fix: mirplatformgraphics does not have boost program options in its
59 symbol table (LP: #1301040)
60 - Bug fix: unity8 crashed with SIGSEGV in glDeleteTextures() from
61 mir::scene::GLPixelBuffer::~GLPixelBuffer() from
62 mir::scene::ThreadedSnapshotStrategy::~ThreadedSnapshotStrategy()
63 (LP: #1256360)
64
65 -- Daniel van Vugt <daniel.van.vugt@canonical.com> Thu, 20 Mar 2014 14:05:25 +0800
66
1mir (0.1.7+14.04.20140318-0ubuntu1) trusty; urgency=low67mir (0.1.7+14.04.20140318-0ubuntu1) trusty; urgency=low
268
3 [ Alberto Aguirre ]69 [ Alberto Aguirre ]
470
=== modified file 'debian/control'
--- debian/control 2014-03-17 07:35:22 +0000
+++ debian/control 2014-04-07 13:29:13 +0000
@@ -31,7 +31,7 @@
31 libgoogle-glog-dev,31 libgoogle-glog-dev,
32 liblttng-ust-dev,32 liblttng-ust-dev,
33 libxkbcommon-dev,33 libxkbcommon-dev,
34 libumockdev-dev,34 libumockdev-dev (>= 0.6),
35 umockdev,35 umockdev,
36 libudev-dev,36 libudev-dev,
37 google-mock (>= 1.6.0+svn437),37 google-mock (>= 1.6.0+svn437),
@@ -70,7 +70,7 @@
70 .70 .
71 Contains the protocol's definition files.71 Contains the protocol's definition files.
7272
73Package: libmirserver1773Package: libmirserver18
74Section: libs74Section: libs
75Architecture: i386 amd64 armhf arm6475Architecture: i386 amd64 armhf arm64
76Multi-Arch: same76Multi-Arch: same
@@ -148,7 +148,7 @@
148Architecture: i386 amd64 armhf arm64148Architecture: i386 amd64 armhf arm64
149Multi-Arch: same149Multi-Arch: same
150Pre-Depends: ${misc:Pre-Depends}150Pre-Depends: ${misc:Pre-Depends}
151Depends: libmirserver17 (= ${binary:Version}),151Depends: libmirserver18 (= ${binary:Version}),
152 libmirprotobuf-dev (= ${binary:Version}),152 libmirprotobuf-dev (= ${binary:Version}),
153 mircommon-dev (= ${binary:Version}),153 mircommon-dev (= ${binary:Version}),
154 libglm-dev,154 libglm-dev,
155155
=== renamed file 'debian/libmirserver17.install' => 'debian/libmirserver18.install'
--- debian/libmirserver17.install 2014-03-12 06:41:13 +0000
+++ debian/libmirserver18.install 2014-04-07 13:29:13 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/libmirserver.so.171usr/lib/*/libmirserver.so.18
22
=== added file 'deploy-and-test.sh'
--- deploy-and-test.sh 1970-01-01 00:00:00 +0000
+++ deploy-and-test.sh 2014-04-07 13:29:13 +0000
@@ -0,0 +1,21 @@
1#!/bin/sh
2
3if [ ! -d build-android-arm ] ; then
4 echo "Built tree not found in $(pwd)/build-android-arm"
5 exit 1
6fi
7
8# Unpack umockdev requirements
9( cd build-android-arm ;
10 apt-get download umockdev:armhf libumockdev0:armhf ;
11 dpkg -x umockdev_*armhf*.deb . ;
12 dpkg -x libumockdev0_*armhf*.deb .
13)
14
15adb push build-android-arm/bin /home/phablet/mir/bin
16adb push build-android-arm/lib /home/phablet/mir/lib
17adb push build-android-arm/usr /home/phablet/mir/usr
18
19adb 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\""
20adb 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\""
21adb 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\""
022
=== modified file 'examples/demo-shell/demo_renderer.cpp'
--- examples/demo-shell/demo_renderer.cpp 2014-03-05 04:13:32 +0000
+++ examples/demo-shell/demo_renderer.cpp 2014-04-07 13:29:13 +0000
@@ -17,13 +17,131 @@
17 */17 */
1818
19#include "demo_renderer.h"19#include "demo_renderer.h"
20#include <mir/graphics/renderable.h>
21#include <cmath>
2022
21using namespace mir;23using namespace mir;
22using namespace mir::examples;24using namespace mir::examples;
2325
26namespace
27{
28
29float penumbra_curve(float x)
30{
31 return 1.0f - std::sin(x * M_PI / 2.0f);
32}
33
34GLuint generate_shadow_corner_texture(float opacity)
35{
36 struct Texel
37 {
38 GLubyte luminance;
39 GLubyte alpha;
40 };
41
42 int const width = 256;
43 Texel image[width][width];
44
45 int const max = width - 1;
46 for (int y = 0; y < width; ++y)
47 {
48 float curve_y = opacity * 255.0f *
49 penumbra_curve(static_cast<float>(y) / max);
50 for (int x = 0; x < width; ++x)
51 {
52 Texel *t = &image[y][x];
53 t->luminance = 0;
54 t->alpha = curve_y * penumbra_curve(static_cast<float>(x) / max);
55 }
56 }
57
58 GLuint corner;
59 glGenTextures(1, &corner);
60 glBindTexture(GL_TEXTURE_2D, corner);
61 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
62 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
63 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
64 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
65 glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA,
66 width, width, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
67 image);
68
69 return corner;
70}
71
72GLuint generate_frame_corner_texture()
73{
74 struct Texel
75 {
76 GLubyte r, g, b, a;
77 };
78
79 int const width = 256;
80 Texel image[width][width];
81
82 int cx = width / 2;
83 int cy = width / 2;
84 int radius_sqr = cx * cx;
85
86 for (int y = 0; y < width; ++y)
87 {
88 for (int x = 0; x < width; ++x)
89 {
90 GLubyte lum = 128;
91 GLubyte alpha = 255;
92
93 // Cut out the corner in a circular shape.
94 if (x < cx && y < cy)
95 {
96 int dx = cx - x;
97 int dy = cy - y;
98 if (dx * dx + dy * dy >= radius_sqr)
99 alpha = 0;
100 }
101
102 // Set gradient
103 if (y < cy)
104 {
105 float brighten = (1.0f - (static_cast<float>(y) / cy));
106 if (x < cx)
107 brighten *= std::sin(x * M_PI / width);
108
109 lum += (255 - lum) * brighten;
110 }
111
112 image[y][x] = {lum, lum, lum, alpha};
113 }
114 }
115
116 GLuint corner;
117 glGenTextures(1, &corner);
118 glBindTexture(GL_TEXTURE_2D, corner);
119 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
120 GL_LINEAR_MIPMAP_LINEAR);
121 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
122 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
123 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
124 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
125 width, width, 0, GL_RGBA, GL_UNSIGNED_BYTE,
126 image);
127 glGenerateMipmap(GL_TEXTURE_2D); // Antialiasing please
128
129 return corner;
130}
131
132} // namespace
133
24DemoRenderer::DemoRenderer(geometry::Rectangle const& display_area)134DemoRenderer::DemoRenderer(geometry::Rectangle const& display_area)
25 : GLRenderer(display_area)135 : GLRenderer(display_area)
26{136{
137 shadow_corner_tex = generate_shadow_corner_texture(0.4f);
138 titlebar_corner_tex = generate_frame_corner_texture();
139}
140
141DemoRenderer::~DemoRenderer()
142{
143 glDeleteTextures(1, &shadow_corner_tex);
144 glDeleteTextures(1, &titlebar_corner_tex);
27}145}
28146
29void DemoRenderer::begin() const147void DemoRenderer::begin() const
@@ -31,3 +149,156 @@
31 glClearColor(0.2f, 0.2f, 0.2f, 1.0f);149 glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
32 glClear(GL_COLOR_BUFFER_BIT);150 glClear(GL_COLOR_BUFFER_BIT);
33}151}
152
153void DemoRenderer::tessellate(std::vector<Primitive>& primitives,
154 graphics::Renderable const& renderable,
155 geometry::Size const& buf_size) const
156{
157 GLRenderer::tessellate(primitives, renderable, buf_size);
158 tessellate_shadow(primitives, renderable, 80.0f);
159 tessellate_frame(primitives, renderable, 30.0f);
160}
161
162void DemoRenderer::tessellate_shadow(std::vector<Primitive>& primitives,
163 graphics::Renderable const& renderable,
164 float radius) const
165{
166 auto const& rect = renderable.screen_position();
167 GLfloat left = rect.top_left.x.as_int();
168 GLfloat right = left + rect.size.width.as_int();
169 GLfloat top = rect.top_left.y.as_int();
170 GLfloat bottom = top + rect.size.height.as_int();
171
172 auto n = primitives.size();
173 primitives.resize(n + 8);
174
175 GLfloat rightr = right + radius;
176 GLfloat leftr = left - radius;
177 GLfloat topr = top - radius;
178 GLfloat bottomr = bottom + radius;
179
180 auto& right_shadow = primitives[n++];
181 right_shadow.tex_id = shadow_corner_tex;
182 right_shadow.type = GL_TRIANGLE_FAN;
183 right_shadow.vertices.resize(4);
184 right_shadow.vertices[0] = {{right, top, 0.0f}, {0.0f, 0.0f}};
185 right_shadow.vertices[1] = {{rightr, top, 0.0f}, {1.0f, 0.0f}};
186 right_shadow.vertices[2] = {{rightr, bottom, 0.0f}, {1.0f, 0.0f}};
187 right_shadow.vertices[3] = {{right, bottom, 0.0f}, {0.0f, 0.0f}};
188
189 auto& left_shadow = primitives[n++];
190 left_shadow.tex_id = shadow_corner_tex;
191 left_shadow.type = GL_TRIANGLE_FAN;
192 left_shadow.vertices.resize(4);
193 left_shadow.vertices[0] = {{leftr, top, 0.0f}, {1.0f, 0.0f}};
194 left_shadow.vertices[1] = {{left, top, 0.0f}, {0.0f, 0.0f}};
195 left_shadow.vertices[2] = {{left, bottom, 0.0f}, {0.0f, 0.0f}};
196 left_shadow.vertices[3] = {{leftr, bottom, 0.0f}, {1.0f, 0.0f}};
197
198 auto& top_shadow = primitives[n++];
199 top_shadow.tex_id = shadow_corner_tex;
200 top_shadow.type = GL_TRIANGLE_FAN;
201 top_shadow.vertices.resize(4);
202 top_shadow.vertices[0] = {{left, topr, 0.0f}, {1.0f, 0.0f}};
203 top_shadow.vertices[1] = {{right, topr, 0.0f}, {1.0f, 0.0f}};
204 top_shadow.vertices[2] = {{right, top, 0.0f}, {0.0f, 0.0f}};
205 top_shadow.vertices[3] = {{left, top, 0.0f}, {0.0f, 0.0f}};
206
207 auto& bottom_shadow = primitives[n++];
208 bottom_shadow.tex_id = shadow_corner_tex;
209 bottom_shadow.type = GL_TRIANGLE_FAN;
210 bottom_shadow.vertices.resize(4);
211 bottom_shadow.vertices[0] = {{left, bottom, 0.0f}, {0.0f, 0.0f}};
212 bottom_shadow.vertices[1] = {{right, bottom, 0.0f}, {0.0f, 0.0f}};
213 bottom_shadow.vertices[2] = {{right, bottomr, 0.0f}, {1.0f, 0.0f}};
214 bottom_shadow.vertices[3] = {{left, bottomr, 0.0f}, {1.0f, 0.0f}};
215
216 auto& tr_shadow = primitives[n++];
217 tr_shadow.tex_id = shadow_corner_tex;
218 tr_shadow.type = GL_TRIANGLE_FAN;
219 tr_shadow.vertices.resize(4);
220 tr_shadow.vertices[0] = {{right, top, 0.0f}, {0.0f, 0.0f}};
221 tr_shadow.vertices[1] = {{right, topr, 0.0f}, {1.0f, 0.0f}};
222 tr_shadow.vertices[2] = {{rightr, topr, 0.0f}, {1.0f, 1.0f}};
223 tr_shadow.vertices[3] = {{rightr, top, 0.0f}, {0.0f, 1.0f}};
224
225 auto& br_shadow = primitives[n++];
226 br_shadow.tex_id = shadow_corner_tex;
227 br_shadow.type = GL_TRIANGLE_FAN;
228 br_shadow.vertices.resize(4);
229 br_shadow.vertices[0] = {{right, bottom, 0.0f}, {0.0f, 0.0f}};
230 br_shadow.vertices[1] = {{rightr, bottom, 0.0f}, {1.0f, 0.0f}};
231 br_shadow.vertices[2] = {{rightr, bottomr, 0.0f}, {1.0f, 1.0f}};
232 br_shadow.vertices[3] = {{right, bottomr, 0.0f}, {0.0f, 1.0f}};
233
234 auto& bl_shadow = primitives[n++];
235 bl_shadow.tex_id = shadow_corner_tex;
236 bl_shadow.type = GL_TRIANGLE_FAN;
237 bl_shadow.vertices.resize(4);
238 bl_shadow.vertices[0] = {{left, bottom, 0.0f}, {0.0f, 0.0f}};
239 bl_shadow.vertices[1] = {{left, bottomr, 0.0f}, {1.0f, 0.0f}};
240 bl_shadow.vertices[2] = {{leftr, bottomr, 0.0f}, {1.0f, 1.0f}};
241 bl_shadow.vertices[3] = {{leftr, bottom, 0.0f}, {0.0f, 1.0f}};
242
243 auto& tl_shadow = primitives[n++];
244 tl_shadow.tex_id = shadow_corner_tex;
245 tl_shadow.type = GL_TRIANGLE_FAN;
246 tl_shadow.vertices.resize(4);
247 tl_shadow.vertices[0] = {{left, top, 0.0f}, {0.0f, 0.0f}};
248 tl_shadow.vertices[1] = {{leftr, top, 0.0f}, {1.0f, 0.0f}};
249 tl_shadow.vertices[2] = {{leftr, topr, 0.0f}, {1.0f, 1.0f}};
250 tl_shadow.vertices[3] = {{left, topr, 0.0f}, {0.0f, 1.0f}};
251
252 // Shadows always need blending...
253 glEnable(GL_BLEND);
254 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
255}
256
257void DemoRenderer::tessellate_frame(std::vector<Primitive>& primitives,
258 graphics::Renderable const& renderable,
259 float titlebar_height) const
260{
261 auto const& rect = renderable.screen_position();
262 GLfloat left = rect.top_left.x.as_int();
263 GLfloat right = left + rect.size.width.as_int();
264 GLfloat top = rect.top_left.y.as_int();
265
266 auto n = primitives.size();
267 primitives.resize(n + 3);
268
269 GLfloat htop = top - titlebar_height;
270 GLfloat inleft = left + titlebar_height; // Square proportions for corners
271 GLfloat inright = right - titlebar_height;
272
273 GLfloat mid = (left + right) / 2.0f;
274 if (inleft > mid) inleft = mid;
275 if (inright < mid) inright = mid;
276
277 auto& top_left_corner = primitives[n++];
278 top_left_corner.tex_id = titlebar_corner_tex;
279 top_left_corner.type = GL_TRIANGLE_FAN;
280 top_left_corner.vertices.resize(4);
281 top_left_corner.vertices[0] = {{left, htop, 0.0f}, {0.0f, 0.0f}};
282 top_left_corner.vertices[1] = {{inleft, htop, 0.0f}, {1.0f, 0.0f}};
283 top_left_corner.vertices[2] = {{inleft, top, 0.0f}, {1.0f, 1.0f}};
284 top_left_corner.vertices[3] = {{left, top, 0.0f}, {0.0f, 1.0f}};
285
286 auto& top_right_corner = primitives[n++];
287 top_right_corner.tex_id = titlebar_corner_tex;
288 top_right_corner.type = GL_TRIANGLE_FAN;
289 top_right_corner.vertices.resize(4);
290 top_right_corner.vertices[0] = {{inright, htop, 0.0f}, {1.0f, 0.0f}};
291 top_right_corner.vertices[1] = {{right, htop, 0.0f}, {0.0f, 0.0f}};
292 top_right_corner.vertices[2] = {{right, top, 0.0f}, {0.0f, 1.0f}};
293 top_right_corner.vertices[3] = {{inright, top, 0.0f}, {1.0f, 1.0f}};
294
295 auto& titlebar = primitives[n++];
296 titlebar.tex_id = titlebar_corner_tex;
297 titlebar.type = GL_TRIANGLE_FAN;
298 titlebar.vertices.resize(4);
299 titlebar.vertices[0] = {{inleft, htop, 0.0f}, {1.0f, 0.0f}};
300 titlebar.vertices[1] = {{inright, htop, 0.0f}, {1.0f, 0.0f}};
301 titlebar.vertices[2] = {{inright, top, 0.0f}, {1.0f, 1.0f}};
302 titlebar.vertices[3] = {{inleft, top, 0.0f}, {1.0f, 1.0f}};
303}
304
34305
=== modified file 'examples/demo-shell/demo_renderer.h'
--- examples/demo-shell/demo_renderer.h 2014-02-14 09:58:06 +0000
+++ examples/demo-shell/demo_renderer.h 2014-04-07 13:29:13 +0000
@@ -30,7 +30,22 @@
30{30{
31public:31public:
32 DemoRenderer(geometry::Rectangle const& display_area);32 DemoRenderer(geometry::Rectangle const& display_area);
33 ~DemoRenderer();
34
33 void begin() const override;35 void begin() const override;
36 void tessellate(std::vector<Primitive>& primitives,
37 graphics::Renderable const& renderable,
38 geometry::Size const& buf_size) const override;
39 void tessellate_shadow(std::vector<Primitive>& primitives,
40 graphics::Renderable const& renderable,
41 float radius) const;
42 void tessellate_frame(std::vector<Primitive>& primitives,
43 graphics::Renderable const& renderable,
44 float titlebar_height) const;
45
46private:
47 GLuint shadow_corner_tex;
48 GLuint titlebar_corner_tex;
34};49};
3550
36} // namespace examples51} // namespace examples
3752
=== modified file 'examples/render_overlays.cpp'
--- examples/render_overlays.cpp 2014-03-17 07:35:22 +0000
+++ examples/render_overlays.cpp 2014-04-07 13:29:13 +0000
@@ -105,17 +105,17 @@
105 {105 {
106 }106 }
107107
108 std::shared_ptr<mg::Buffer> buffer(unsigned long) const override108 std::shared_ptr<mg::Buffer> buffer(void const*) const override
109 {109 {
110 return client->last_rendered();110 return client->last_rendered();
111 }111 }
112112
113 bool alpha_enabled() const113 bool alpha_enabled() const override
114 {114 {
115 return false;115 return false;
116 }116 }
117117
118 geom::Rectangle screen_position() const118 geom::Rectangle screen_position() const override
119 {119 {
120 return position;120 return position;
121 }121 }
@@ -130,14 +130,14 @@
130 return trans;130 return trans;
131 }131 }
132132
133 bool shaped() const133 bool shaped() const override
134 {134 {
135 return false;135 return false;
136 }136 }
137137
138 bool should_be_rendered_in(geom::Rectangle const& rect) const override138 bool visible() const override
139 {139 {
140 return rect.overlaps(position);140 return true;
141 }141 }
142142
143 int buffers_ready_for_compositor() const override143 int buffers_ready_for_compositor() const override
@@ -168,7 +168,9 @@
168 mir::DefaultServerConfiguration conf{argc, argv};168 mir::DefaultServerConfiguration conf{argc, argv};
169169
170 auto platform = conf.the_graphics_platform();170 auto platform = conf.the_graphics_platform();
171 auto display = platform->create_display(conf.the_display_configuration_policy());171 auto display = platform->create_display(
172 conf.the_display_configuration_policy(),
173 conf.the_gl_config());
172 auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());174 auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());
173175
174 mg::BufferProperties buffer_properties{176 mg::BufferProperties buffer_properties{
175177
=== modified file 'examples/render_surfaces.cpp'
--- examples/render_surfaces.cpp 2014-03-11 04:03:54 +0000
+++ examples/render_surfaces.cpp 2014-04-07 13:29:13 +0000
@@ -31,7 +31,8 @@
31#include "mir/graphics/display_buffer.h"31#include "mir/graphics/display_buffer.h"
32#include "mir/graphics/gl_context.h"32#include "mir/graphics/gl_context.h"
33#include "mir/shell/surface_factory.h"33#include "mir/shell/surface_factory.h"
34#include "mir/shell/surface.h"34#include "mir/scene/surface.h"
35#include "mir/scene/surface_coordinator.h"
35#include "mir/run_mir.h"36#include "mir/run_mir.h"
36#include "mir/report_exception.h"37#include "mir/report_exception.h"
37#include "mir/raii.h"38#include "mir/raii.h"
@@ -41,6 +42,9 @@
41#include "image_renderer.h"42#include "image_renderer.h"
42#include "server_configuration.h"43#include "server_configuration.h"
4344
45#define GLM_FORCE_RADIANS
46#include <glm/gtc/matrix_transform.hpp>
47
44#include <thread>48#include <thread>
45#include <atomic>49#include <atomic>
46#include <chrono>50#include <chrono>
@@ -90,6 +94,7 @@
90std::weak_ptr<mg::Cursor> cursor;94std::weak_ptr<mg::Cursor> cursor;
91static const uint32_t bg_color = 0x00000000;95static const uint32_t bg_color = 0x00000000;
92static const uint32_t fg_color = 0xffdd4814;96static const uint32_t fg_color = 0xffdd4814;
97static const float min_alpha = 0.3f;
9398
94void update_cursor(uint32_t bg_color, uint32_t fg_color)99void update_cursor(uint32_t bg_color, uint32_t fg_color)
95{100{
@@ -233,8 +238,16 @@
233 y = new_y;238 y = new_y;
234 }239 }
235240
236 surface->set_rotation(total_elapsed_sec * 120.0f, rotation_axis);241 glm::mat4 trans = glm::rotate(glm::mat4(1.0f),
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),
243 rotation_axis);
244 surface->set_transformation(trans);
245
246 float const alpha_amplitude = (1.0f - min_alpha) / 2.0f;
247 surface->set_alpha(min_alpha + alpha_amplitude +
248 alpha_amplitude *
249 sin(alpha_offset + 2 * M_PI * total_elapsed_sec /
250 3.0));
238 }251 }
239252
240private:253private:
@@ -433,7 +446,7 @@
433 std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl;446 std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl;
434447
435 auto const display = the_display();448 auto const display = the_display();
436 auto const surface_factory = the_scene_surface_factory();449 auto const surface_coordinator = the_surface_coordinator();
437 /* TODO: Get proper configuration */450 /* TODO: Get proper configuration */
438 geom::Rectangles view_area;451 geom::Rectangles view_area;
439 display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)452 display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)
@@ -452,12 +465,11 @@
452 int i = 0;465 int i = 0;
453 for (auto& m : moveables)466 for (auto& m : moveables)
454 {467 {
455 auto const s = surface_factory->create_surface(468 auto const s = surface_coordinator->add_surface(
456 nullptr,
457 msh::a_surface().of_size(surface_size)469 msh::a_surface().of_size(surface_size)
458 .of_pixel_format(surface_pf)470 .of_pixel_format(surface_pf)
459 .of_buffer_usage(mg::BufferUsage::hardware),471 .of_buffer_usage(mg::BufferUsage::hardware),
460 mf::SurfaceId(), {});472 {});
461473
462 /*474 /*
463 * We call swap_buffers() twice so that the surface is475 * We call swap_buffers() twice so that the surface is
464476
=== modified file 'include/platform/mir/graphics/display_buffer.h'
--- include/platform/mir/graphics/display_buffer.h 2014-03-06 06:05:17 +0000
+++ include/platform/mir/graphics/display_buffer.h 2014-04-07 13:29:13 +0000
@@ -20,11 +20,11 @@
20#define MIR_GRAPHICS_DISPLAY_BUFFER_H_20#define MIR_GRAPHICS_DISPLAY_BUFFER_H_
2121
22#include <mir/geometry/rectangle.h>22#include <mir/geometry/rectangle.h>
23#include <mir/graphics/renderable.h>
23#include <mir_toolkit/common.h>24#include <mir_toolkit/common.h>
2425
25#include <memory>26#include <memory>
26#include <functional>27#include <functional>
27#include <list>
2828
29namespace mir29namespace mir
30{30{
@@ -32,7 +32,6 @@
32{32{
3333
34class Buffer;34class Buffer;
35class Renderable;
3635
37/**36/**
38 * Interface to an output framebuffer.37 * Interface to an output framebuffer.
@@ -57,7 +56,7 @@
57 that Renderable via OpenGL, or via another method. If the Renderable is to be rendered56 that Renderable via OpenGL, or via another method. If the Renderable is to be rendered
58 via OpenGL, render_fn will be invoked on that Renderable. */57 via OpenGL, render_fn will be invoked on that Renderable. */
59 virtual void render_and_post_update(58 virtual void render_and_post_update(
60 std::list<std::shared_ptr<Renderable>> const& renderlist,59 RenderableList const& renderlist,
61 std::function<void(Renderable const&)> const& render_fn) = 0;60 std::function<void(Renderable const&)> const& render_fn) = 0;
6261
63 /** to be deprecated */62 /** to be deprecated */
6463
=== added file 'include/platform/mir/graphics/gl_config.h'
--- include/platform/mir/graphics/gl_config.h 1970-01-01 00:00:00 +0000
+++ include/platform/mir/graphics/gl_config.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,54 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_GL_CONFIG_H_
20#define MIR_GRAPHICS_GL_CONFIG_H_
21
22namespace mir
23{
24namespace graphics
25{
26
27/**
28 * Interface for customizing aspects of the GL config used by the server.
29 */
30class GLConfig
31{
32public:
33 virtual ~GLConfig() = default;
34
35 /**
36 * Gets the bits to use for each pixel in the depth buffer.
37 */
38 virtual int depth_buffer_bits() const = 0;
39
40 /**
41 * Gets the bits to use for each pixel in the stencil buffer.
42 */
43 virtual int stencil_buffer_bits() const = 0;
44
45protected:
46 GLConfig() = default;
47 GLConfig(GLConfig const&) = delete;
48 GLConfig& operator=(GLConfig const&) = delete;
49};
50
51}
52}
53
54#endif /* MIR_GRAPHICS_GL_CONFIG_H_ */
055
=== modified file 'include/platform/mir/graphics/platform.h'
--- include/platform/mir/graphics/platform.h 2014-03-06 06:05:17 +0000
+++ include/platform/mir/graphics/platform.h 2014-04-07 13:29:13 +0000
@@ -22,6 +22,7 @@
2222
23#include "basic_platform.h"23#include "basic_platform.h"
2424
25#include <boost/program_options/options_description.hpp>
25#include <memory>26#include <memory>
2627
27namespace mir28namespace mir
@@ -48,6 +49,7 @@
48class DisplayReport;49class DisplayReport;
49class DisplayConfigurationPolicy;50class DisplayConfigurationPolicy;
50class GraphicBufferAllocator;51class GraphicBufferAllocator;
52class GLConfig;
5153
52/**54/**
53 * \defgroup platform_enablement Mir platform enablement55 * \defgroup platform_enablement Mir platform enablement
@@ -81,7 +83,8 @@
81 * Creates the display subsystem.83 * Creates the display subsystem.
82 */84 */
83 virtual std::shared_ptr<Display> create_display(85 virtual std::shared_ptr<Display> create_display(
84 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy) = 0;86 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
87 std::shared_ptr<GLConfig> const& gl_config) = 0;
8588
86 /**89 /**
87 * Gets the IPC package for the platform.90 * Gets the IPC package for the platform.
@@ -119,6 +122,10 @@
119 */122 */
120extern "C" typedef std::shared_ptr<Platform>(*CreatePlatform)(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report);123extern "C" typedef std::shared_ptr<Platform>(*CreatePlatform)(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report);
121extern "C" std::shared_ptr<Platform> create_platform (std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report);124extern "C" std::shared_ptr<Platform> create_platform (std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report);
125extern "C" typedef void(*AddPlatformOptions)(
126 boost::program_options::options_description& config);
127extern "C" void add_platform_options(
128 boost::program_options::options_description& config);
122}129}
123}130}
124131
125132
=== modified file 'include/platform/mir/graphics/renderable.h'
--- include/platform/mir/graphics/renderable.h 2014-03-17 07:35:22 +0000
+++ include/platform/mir/graphics/renderable.h 2014-04-07 13:29:13 +0000
@@ -22,6 +22,7 @@
22#include <mir/geometry/rectangle.h>22#include <mir/geometry/rectangle.h>
23#include <glm/glm.hpp>23#include <glm/glm.hpp>
24#include <memory>24#include <memory>
25#include <list>
2526
26namespace mir27namespace mir
27{28{
@@ -35,19 +36,15 @@
35 /**36 /**
36 * Return the next buffer that should be composited/rendered.37 * Return the next buffer that should be composited/rendered.
37 *38 *
38 * \param [in] frameno The frameno parameter is important for39 * \param [in] user_id An arbitrary unique identifier used to distinguish
39 * multi-monitor platforms. Calls with the same frameno40 * separate threads/monitors/components which need
40 * will get the same buffer returned. This ensures that41 * to concurrently receive the same buffer. Calling
41 * a surface visible on multiple outputs does not get42 * with the same user_id will return a new (different)
42 * its buffers consumed any faster than the refresh43 * buffer to that user each time. For consistency,
43 * rate of a single monitor. Implementations may ignore44 * all callers need to determine their user_id in the
44 * the value of frameno on single-monitor platforms45 * same way (e.g. always use "this" pointer).
45 * only. The caller should always ensure the frameno
46 * is different to the previous frame. The exact value
47 * of frameno is not important but a large range of
48 * values is recommended.
49 */46 */
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;
5148
52 virtual bool alpha_enabled() const = 0;49 virtual bool alpha_enabled() const = 0;
53 virtual geometry::Rectangle screen_position() const = 0;50 virtual geometry::Rectangle screen_position() const = 0;
@@ -69,7 +66,14 @@
69 * the surface itself).66 * the surface itself).
70 */67 */
71 virtual glm::mat4 transformation() const = 0;68 virtual glm::mat4 transformation() const = 0;
72 virtual bool should_be_rendered_in(geometry::Rectangle const& rect) const = 0;69
70 /**
71 * TODO: Its a bit questionable that we have this member function, why not
72 * just trim the renderable from the RenderableList? Its convenient
73 * to have this function temporarily while refactoring --kdub
74 */
75 virtual bool visible() const = 0;
76
73 virtual bool shaped() const = 0; // meaning the pixel format has alpha77 virtual bool shaped() const = 0; // meaning the pixel format has alpha
74 virtual int buffers_ready_for_compositor() const = 0;78 virtual int buffers_ready_for_compositor() const = 0;
7579
@@ -80,6 +84,9 @@
80 Renderable& operator=(Renderable const&) = delete;84 Renderable& operator=(Renderable const&) = delete;
81};85};
8286
87// XXX Would performance be better with a vector?
88typedef std::list<std::shared_ptr<Renderable>> RenderableList;
89
83}90}
84}91}
8592
8693
=== modified file 'include/platform/mir/options/default_configuration.h'
--- include/platform/mir/options/default_configuration.h 2014-03-17 07:35:22 +0000
+++ include/platform/mir/options/default_configuration.h 2014-04-07 13:29:13 +0000
@@ -37,6 +37,7 @@
37 boost::program_options::options_description_easy_init add_options();37 boost::program_options::options_description_easy_init add_options();
3838
39private:39private:
40 void add_platform_options();
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"
41 std::shared_ptr<options::Option> the_options() const override;42 std::shared_ptr<options::Option> the_options() const override;
4243
4344
=== added file 'include/platform/mir/shared_library_loader.h'
--- include/platform/mir/shared_library_loader.h 1970-01-01 00:00:00 +0000
+++ include/platform/mir/shared_library_loader.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,28 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_SHARED_LIBRARY_LOADER_H_
20#define MIR_SHARED_LIBRARY_LOADER_H_
21
22#include <string>
23namespace mir
24{
25class SharedLibrary;
26SharedLibrary const* load_library(std::string const& libname);
27}
28#endif
029
=== modified file 'include/server/mir/compositor/buffer_stream.h'
--- include/server/mir/compositor/buffer_stream.h 2014-03-07 03:15:55 +0000
+++ include/server/mir/compositor/buffer_stream.h 2014-04-07 13:29:13 +0000
@@ -43,7 +43,7 @@
4343
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;
45 virtual std::shared_ptr<graphics::Buffer>45 virtual std::shared_ptr<graphics::Buffer>
46 lock_compositor_buffer(unsigned long frameno) = 0;46 lock_compositor_buffer(void const* user_id) = 0;
47 virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0;47 virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0;
48 virtual MirPixelFormat get_stream_pixel_format() = 0;48 virtual MirPixelFormat get_stream_pixel_format() = 0;
49 virtual geometry::Size stream_size() = 0;49 virtual geometry::Size stream_size() = 0;
5050
=== modified file 'include/server/mir/compositor/gl_renderer.h'
--- include/server/mir/compositor/gl_renderer.h 2014-03-17 07:35:22 +0000
+++ include/server/mir/compositor/gl_renderer.h 2014-04-07 13:29:13 +0000
@@ -54,14 +54,27 @@
54 GLfloat texcoord[2];54 GLfloat texcoord[2];
55 };55 };
5656
57 struct Primitive
58 {
59 GLenum type; // GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES etc
60 GLuint tex_id; // GL texture ID (or 0 to represent the surface itself)
61 std::vector<Vertex> vertices;
62 };
63
57 /**64 /**
58 * tessellate defines the list of triangles that will be used to render65 * tessellate defines the list of triangles that will be used to render
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.
60 * However you can override its behaviour to tessellate more finely and67 * However you can override its behaviour to tessellate more finely and
61 * deform freely for effects like wobbly windows.68 * deform freely for effects like wobbly windows.
62 *69 *
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
64 * GL_TRIANGLE_FAN or GL_TRIANGLES.71 * grown and/or modified.
72 * \param [in] renderable The renderable surface being tessellated.
73 * \param [in] buf_size The dimensions of the buffer being rendered,
74 * which can be particularly useful in
75 * calculating texcoords for a surface being
76 * actively resized (as the buf_size doesn't
77 * yet match renderable.size()).
65 *78 *
66 * \note The cohesion of this function to GLRenderer is quite loose and it79 * \note The cohesion of this function to GLRenderer is quite loose and it
67 * does not strictly need to reside here.80 * does not strictly need to reside here.
@@ -69,8 +82,18 @@
69 * the only OpenGL-specific class in the display server, and82 * the only OpenGL-specific class in the display server, and
70 * tessellation is very much OpenGL-specific.83 * tessellation is very much OpenGL-specific.
71 */84 */
72 virtual GLenum tessellate(graphics::Renderable const& renderable,85 virtual void tessellate(std::vector<Primitive>& primitives,
73 std::vector<Vertex>& vertices) const;86 graphics::Renderable const& renderable,
87 geometry::Size const& buf_size) const;
88
89 /**
90 * Load the texture for a surface any which way you like. The default
91 * implementation does so with efficient GPU-side caching built in.
92 *
93 * \returns The OpenGL texture name for the surface.
94 */
95 virtual GLuint load_texture(graphics::Renderable const& renderable,
96 graphics::Buffer& buffer) const;
7497
75private:98private:
76 GLuint vertex_shader;99 GLuint vertex_shader;
77100
=== modified file 'include/server/mir/compositor/renderer.h'
--- include/server/mir/compositor/renderer.h 2014-03-17 07:35:22 +0000
+++ include/server/mir/compositor/renderer.h 2014-04-07 13:29:13 +0000
@@ -40,8 +40,8 @@
40 virtual void set_rotation(float degrees) = 0;40 virtual void set_rotation(float degrees) = 0;
41 virtual void begin() const = 0;41 virtual void begin() const = 0;
4242
43 // XXX The buffer parameter here could now be replaced with a "frameno"43 // XXX The buffer parameter here could now be replaced with
44 // instead, and use renderable.buffer(frameno). Is that better?44 // renderable::buffer().
45 virtual void render(graphics::Renderable const& renderable,45 virtual void render(graphics::Renderable const& renderable,
46 graphics::Buffer& buffer) const = 0;46 graphics::Buffer& buffer) const = 0;
47 virtual void end() const = 0;47 virtual void end() const = 0;
4848
=== modified file 'include/server/mir/compositor/scene.h'
--- include/server/mir/compositor/scene.h 2014-03-17 07:35:22 +0000
+++ include/server/mir/compositor/scene.h 2014-04-07 13:29:13 +0000
@@ -20,6 +20,7 @@
20#define MIR_COMPOSITOR_SCENE_H_20#define MIR_COMPOSITOR_SCENE_H_
2121
22#include "mir/geometry/forward.h"22#include "mir/geometry/forward.h"
23#include "mir/graphics/renderable.h"
2324
24#include <memory>25#include <memory>
25#include <functional>26#include <functional>
@@ -62,13 +63,15 @@
62public:63public:
63 virtual ~Scene() {}64 virtual ~Scene() {}
6465
66 /**
67 * Generate a valid list of renderables based on the current state of the Scene.
68 * \returns a list of mg::Renderables. The list is in stacking order from back to front.
69 */
70 virtual graphics::RenderableList generate_renderable_list() const = 0;
71
65 // Back to front; normal rendering order72 // Back to front; normal rendering order
66 virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0;73 virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0;
6774
68 // Front to back; as used when scanning for occlusions
69 virtual void reverse_for_each_if(FilterForScene& filter,
70 OperatorForScene& op) = 0;
71
72 /**75 /**
73 * Sets a callback to be called whenever the state of the76 * Sets a callback to be called whenever the state of the
74 * Scene changes.77 * Scene changes.
7578
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/default_server_configuration.h 2014-04-07 13:29:13 +0000
@@ -61,7 +61,6 @@
61class SessionListener;61class SessionListener;
62class FocusController;62class FocusController;
63class DisplayLayout;63class DisplayLayout;
64class SurfaceConfigurator;
65}64}
66namespace time65namespace time
67{66{
@@ -69,6 +68,7 @@
69}68}
70namespace scene69namespace scene
71{70{
71class SurfaceFactory;
72class BroadcastingSessionEventSink;72class BroadcastingSessionEventSink;
73class BufferStreamFactory;73class BufferStreamFactory;
74class MediatingDisplayChanger;74class MediatingDisplayChanger;
@@ -78,7 +78,8 @@
78class SessionEventHandlerRegister;78class SessionEventHandlerRegister;
79class SessionManager;79class SessionManager;
80class SnapshotStrategy;80class SnapshotStrategy;
81class SurfaceBuilder;81class SurfaceCoordinator;
82class SurfaceConfigurator;
82class SurfaceStackModel;83class SurfaceStackModel;
83class SurfaceStack;84class SurfaceStack;
84class SurfaceRanker;85class SurfaceRanker;
@@ -93,6 +94,7 @@
93class BufferInitializer;94class BufferInitializer;
94class DisplayReport;95class DisplayReport;
95class GraphicBufferAllocator;96class GraphicBufferAllocator;
97class GLConfig;
96namespace nested { class HostConnection; }98namespace nested { class HostConnection; }
97}99}
98namespace input100namespace input
@@ -152,6 +154,7 @@
152 virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy();154 virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy();
153 virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection();155 virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection();
154 virtual std::shared_ptr<input::EventFilter> the_nested_event_filter();156 virtual std::shared_ptr<input::EventFilter> the_nested_event_filter();
157 virtual std::shared_ptr<graphics::GLConfig> the_gl_config();
155 /** @} */158 /** @} */
156159
157 /** @name graphics configuration - dependencies160 /** @name graphics configuration - dependencies
@@ -198,12 +201,10 @@
198 * configurable interfaces for modifying shell201 * configurable interfaces for modifying shell
199 * @{ */202 * @{ */
200 virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory();203 virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory();
201 virtual std::shared_ptr<shell::SurfaceFactory> the_scene_surface_factory();
202 virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter();204 virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter();
203 virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy();205 virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy();
204 virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener();206 virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener();
205 virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout();207 virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout();
206 virtual std::shared_ptr<shell::SurfaceConfigurator> the_shell_surface_configurator();
207 /** @} */208 /** @} */
208209
209 /** @name internal scene configuration210 /** @name internal scene configuration
@@ -216,7 +217,10 @@
216 virtual std::shared_ptr<scene::SessionEventSink> the_session_event_sink();217 virtual std::shared_ptr<scene::SessionEventSink> the_session_event_sink();
217 virtual std::shared_ptr<scene::SessionEventHandlerRegister> the_session_event_handler_register();218 virtual std::shared_ptr<scene::SessionEventHandlerRegister> the_session_event_handler_register();
218 virtual std::shared_ptr<scene::SurfaceStackModel> the_surface_stack_model();219 virtual std::shared_ptr<scene::SurfaceStackModel> the_surface_stack_model();
219 virtual std::shared_ptr<scene::SurfaceRanker> the_surface_ranker();220 virtual std::shared_ptr<scene::SurfaceRanker> the_surface_ranker();
221 virtual std::shared_ptr<scene::SurfaceFactory> the_surface_factory();
222 virtual std::shared_ptr<scene::SurfaceCoordinator>the_surface_coordinator();
223 virtual std::shared_ptr<scene::SurfaceConfigurator> the_surface_configurator();
220 /** @} */224 /** @} */
221225
222 /** @name scene configuration - dependencies226 /** @name scene configuration - dependencies
@@ -284,7 +288,7 @@
284 CachedPtr<scene::SceneReport> scene_report;288 CachedPtr<scene::SceneReport> scene_report;
285289
286 CachedPtr<shell::SurfaceFactory> shell_surface_factory;290 CachedPtr<shell::SurfaceFactory> shell_surface_factory;
287 CachedPtr<shell::SurfaceFactory> scene_surface_factory;291 CachedPtr<scene::SurfaceFactory> surface_factory;
288 CachedPtr<scene::SessionContainer> session_container;292 CachedPtr<scene::SessionContainer> session_container;
289 CachedPtr<shell::FocusSetter> shell_focus_setter;293 CachedPtr<shell::FocusSetter> shell_focus_setter;
290 CachedPtr<shell::PlacementStrategy> shell_placement_strategy;294 CachedPtr<shell::PlacementStrategy> shell_placement_strategy;
@@ -292,7 +296,7 @@
292 CachedPtr<scene::PixelBuffer> pixel_buffer;296 CachedPtr<scene::PixelBuffer> pixel_buffer;
293 CachedPtr<scene::SnapshotStrategy> snapshot_strategy;297 CachedPtr<scene::SnapshotStrategy> snapshot_strategy;
294 CachedPtr<shell::DisplayLayout> shell_display_layout;298 CachedPtr<shell::DisplayLayout> shell_display_layout;
295 CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator;299 CachedPtr<scene::SurfaceConfigurator> surface_configurator;
296 CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;300 CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;
297 CachedPtr<compositor::Compositor> compositor;301 CachedPtr<compositor::Compositor> compositor;
298 CachedPtr<compositor::CompositorReport> compositor_report;302 CachedPtr<compositor::CompositorReport> compositor_report;
@@ -304,6 +308,7 @@
304 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;308 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;
305 CachedPtr<graphics::nested::HostConnection> host_connection;309 CachedPtr<graphics::nested::HostConnection> host_connection;
306 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;310 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;
311 CachedPtr<graphics::GLConfig> gl_config;
307312
308private:313private:
309 std::shared_ptr<options::Configuration> const configuration_options;314 std::shared_ptr<options::Configuration> const configuration_options;
@@ -321,7 +326,6 @@
321 std::shared_ptr<scene::BroadcastingSessionEventSink> the_broadcasting_session_event_sink();326 std::shared_ptr<scene::BroadcastingSessionEventSink> the_broadcasting_session_event_sink();
322 std::shared_ptr<input::NestedInputRelay> the_nested_input_relay();327 std::shared_ptr<input::NestedInputRelay> the_nested_input_relay();
323 std::shared_ptr<scene::SessionManager> the_session_manager();328 std::shared_ptr<scene::SessionManager> the_session_manager();
324 std::shared_ptr<scene::SurfaceBuilder> the_surface_builder();
325 std::shared_ptr<scene::SurfaceController> the_surface_controller();329 std::shared_ptr<scene::SurfaceController> the_surface_controller();
326330
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>;
328332
=== modified file 'include/server/mir/frontend/display_changer.h'
--- include/server/mir/frontend/display_changer.h 2013-09-17 20:03:16 +0000
+++ include/server/mir/frontend/display_changer.h 2014-04-07 13:29:13 +0000
@@ -38,7 +38,6 @@
3838
39 virtual std::shared_ptr<graphics::DisplayConfiguration> active_configuration() = 0;39 virtual std::shared_ptr<graphics::DisplayConfiguration> active_configuration() = 0;
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;
41 virtual void ensure_display_powered(std::shared_ptr<Session> const& session) = 0;
4241
43protected:42protected:
44 DisplayChanger() = default;43 DisplayChanger() = default;
4544
=== modified file 'include/server/mir/frontend/session_authorizer.h'
--- include/server/mir/frontend/session_authorizer.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/frontend/session_authorizer.h 2014-04-07 13:29:13 +0000
@@ -29,10 +29,12 @@
29class SessionAuthorizer29class SessionAuthorizer
30{30{
31public:31public:
32 virtual ~SessionAuthorizer() {}32 virtual ~SessionAuthorizer() = default;
3333
34 virtual bool connection_is_allowed(pid_t pid) = 0;34 virtual bool connection_is_allowed(pid_t pid) = 0;
35 virtual bool configure_display_is_allowed(pid_t pid) = 0;35 virtual bool configure_display_is_allowed(pid_t pid) = 0;
36 virtual bool screencast_is_allowed(pid_t pid) = 0;
37
36protected:38protected:
37 SessionAuthorizer() = default;39 SessionAuthorizer() = default;
38 SessionAuthorizer(SessionAuthorizer const&) = delete;40 SessionAuthorizer(SessionAuthorizer const&) = delete;
3941
=== modified file 'include/server/mir/input/surface.h'
--- include/server/mir/input/surface.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/input/surface.h 2014-04-07 13:29:13 +0000
@@ -30,7 +30,7 @@
30class Surface30class Surface
31{31{
32public:32public:
33 virtual std::string const& name() const = 0;33 virtual std::string name() const = 0;
34 virtual geometry::Point top_left() const = 0;34 virtual geometry::Point top_left() const = 0;
35 virtual geometry::Size size() const = 0;35 virtual geometry::Size size() const = 0;
36 virtual bool contains(geometry::Point const& point) const = 0;36 virtual bool contains(geometry::Point const& point) const = 0;
3737
=== added file 'include/server/mir/scene/surface.h'
--- include/server/mir/scene/surface.h 1970-01-01 00:00:00 +0000
+++ include/server/mir/scene/surface.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIR_SCENE_SURFACE_H_
20#define MIR_SCENE_SURFACE_H_
21
22#include "mir/graphics/renderable.h"
23#include "mir/input/surface.h"
24#include "mir/shell/surface.h"
25
26namespace mir
27{
28namespace input { class InputChannel; }
29
30namespace scene
31{
32class SurfaceObserver;
33
34class Surface :
35 public graphics::Renderable,
36 public input::Surface,
37 public shell::Surface
38{
39public:
40 // resolve ambiguous member function names
41 std::string name() const = 0;
42 geometry::Size size() const = 0;
43 geometry::Point top_left() const = 0;
44 float alpha() const = 0;
45
46 // member functions that don't exist in base classes
47 // TODO input_channel() and on_change() relate to
48 // TODO adding and removing the surface from the scene and are probably not
49 // TODO cleanest interface for this.
50 virtual std::shared_ptr<input::InputChannel> input_channel() const = 0;
51 virtual void on_change(std::function<void()> change_notification) = 0;
52
53 virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
54 virtual void remove_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0;
55};
56}
57}
58
59#endif // MIR_SCENE_SURFACE_H_
060
=== renamed file 'include/server/mir/shell/surface_configurator.h' => 'include/server/mir/scene/surface_configurator.h'
--- include/server/mir/shell/surface_configurator.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/scene/surface_configurator.h 2014-04-07 13:29:13 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#ifndef MIR_SHELL_SURFACE_CONFIGURATOR_H_19#ifndef MIR_SCENE_SURFACE_CONFIGURATOR_H_
20#define MIR_SHELL_SURFACE_CONFIGURATOR_H_20#define MIR_SCENE_SURFACE_CONFIGURATOR_H_
2121
22#include "mir_toolkit/common.h"22#include "mir_toolkit/common.h"
2323
@@ -26,7 +26,7 @@
26namespace mir26namespace mir
27{27{
2828
29namespace shell29namespace scene
30{30{
31class Surface;31class Surface;
3232
@@ -51,4 +51,4 @@
51}51}
52} // namespace mir52} // namespace mir
5353
54#endif // MIR_SHELL_SURFACE_CONFIGURATOR_H_54#endif // MIR_SCENE_SURFACE_CONFIGURATOR_H_
5555
=== renamed file 'src/server/scene/surface_builder.h' => 'include/server/mir/scene/surface_coordinator.h'
--- src/server/scene/surface_builder.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/scene/surface_coordinator.h 2014-04-07 13:29:13 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-14 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -17,8 +17,10 @@
17 */17 */
1818
1919
20#ifndef MIR_SCENE_SURFACE_BUILDER_H_20#ifndef MIR_SCENE_SURFACE_COORDINATOR_H_
21#define MIR_SCENE_SURFACE_BUILDER_H_21#define MIR_SCENE_SURFACE_COORDINATOR_H_
22
23#include "mir/scene/surface_ranker.h"
2224
23#include <memory>25#include <memory>
2426
@@ -31,22 +33,25 @@
3133
32namespace scene34namespace scene
33{35{
34class BasicSurface;36class Surface;
37class SurfaceObserver;
3538
36class SurfaceBuilder39class SurfaceCoordinator : public SurfaceRanker
37{40{
38public:41public:
39 virtual std::weak_ptr<BasicSurface> create_surface(shell::SurfaceCreationParameters const& params) = 0;42 virtual std::shared_ptr<Surface> add_surface(
43 shell::SurfaceCreationParameters const& params,
44 std::shared_ptr<SurfaceObserver> const& observer) = 0;
4045
41 virtual void destroy_surface(std::weak_ptr<BasicSurface> const& surface) = 0;46 virtual void remove_surface(std::weak_ptr<Surface> const& surface) = 0;
42protected:47protected:
43 SurfaceBuilder() = default;48 SurfaceCoordinator() = default;
44 virtual ~SurfaceBuilder() = default;49 virtual ~SurfaceCoordinator() = default;
45 SurfaceBuilder(SurfaceBuilder const&) = delete;50 SurfaceCoordinator(SurfaceCoordinator const&) = delete;
46 SurfaceBuilder& operator=(SurfaceBuilder const&) = delete;51 SurfaceCoordinator& operator=(SurfaceCoordinator const&) = delete;
47};52};
48}53}
49}54}
5055
5156
52#endif /* MIR_SCENE_SURFACE_BUILDER_H_ */57#endif /* MIR_SCENE_SURFACE_COORDINATOR_H_ */
5358
=== added file 'include/server/mir/scene/surface_event_source.h'
--- include/server/mir/scene/surface_event_source.h 1970-01-01 00:00:00 +0000
+++ include/server/mir/scene/surface_event_source.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIR_SCENE_SURFACE_EVENT_SOURCE_H_
20#define MIR_SCENE_SURFACE_EVENT_SOURCE_H_
21
22#include "mir/scene/surface_observer.h"
23#include "mir/frontend/surface_id.h"
24#include "mir/frontend/event_sink.h"
25
26#include <memory>
27
28namespace mir
29{
30namespace scene
31{
32class SurfaceEventSource : public SurfaceObserver
33{
34public:
35 SurfaceEventSource(
36 frontend::SurfaceId id,
37 std::shared_ptr<frontend::EventSink> const& event_sink);
38
39 void attrib_change(MirSurfaceAttrib attrib, int value);
40 void resize(geometry::Size const& size);
41
42private:
43 frontend::SurfaceId const id;
44 std::shared_ptr<frontend::EventSink> const event_sink;
45};
46}
47}
48
49#endif // MIR_SCENE_SURFACE_EVENT_SOURCE_H_
050
=== renamed file 'src/server/scene/basic_surface_factory.h' => 'include/server/mir/scene/surface_factory.h'
--- src/server/scene/basic_surface_factory.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/scene/surface_factory.h 2014-04-07 13:29:13 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -16,33 +16,33 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#ifndef MIR_SCENE_BASIC_SURFACE_FACTORY_H_19#ifndef MIR_SCENE_SURFACE_FACTORY_H_
20#define MIR_SCENE_BASIC_SURFACE_FACTORY_H_20#define MIR_SCENE_SURFACE_FACTORY_H_
2121
22#include "mir/shell/surface_creation_parameters.h"22#include "mir/shell/surface_creation_parameters.h"
23#include <memory>23#include <memory>
24#include <functional>
2524
26namespace mir25namespace mir
27{26{
28namespace scene27namespace scene
29{28{
29class Surface;
3030
31class BasicSurface;31class SurfaceFactory
32class BasicSurfaceFactory
33{32{
34public:33public:
35 BasicSurfaceFactory() = default;34 SurfaceFactory() = default;
36 virtual ~BasicSurfaceFactory() = default;35 virtual ~SurfaceFactory() = default;
3736
38 virtual std::shared_ptr<BasicSurface> create_surface(37 virtual std::shared_ptr<Surface> create_surface(
39 shell::SurfaceCreationParameters const&, std::function<void()> const&) = 0;38 shell::SurfaceCreationParameters const& params) = 0;
39
40private:40private:
41 BasicSurfaceFactory(const BasicSurfaceFactory&) = delete;41 SurfaceFactory(const SurfaceFactory&) = delete;
42 BasicSurfaceFactory& operator=(const BasicSurfaceFactory&) = delete;42 SurfaceFactory& operator=(const SurfaceFactory&) = delete;
43};43};
4444
45}45}
46}46}
4747
48#endif /* MIR_SCENE_BASIC_SURFACE_FACTORY_H_ */48#endif /* MIR_SCENE_SURFACE_FACTORY_H_ */
4949
=== added file 'include/server/mir/scene/surface_observer.h'
--- include/server/mir/scene/surface_observer.h 1970-01-01 00:00:00 +0000
+++ include/server/mir/scene/surface_observer.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,45 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIR_SCENE_SURFACE_OBSERVER_H_
20#define MIR_SCENE_SURFACE_OBSERVER_H_
21
22#include "mir/geometry/size.h"
23#include "mir_toolkit/common.h"
24
25namespace mir
26{
27namespace scene
28{
29// Initial cut - supporting the frontend requirement, more will follow
30class SurfaceObserver
31{
32public:
33 virtual void attrib_change(MirSurfaceAttrib attrib, int value) = 0;
34 virtual void resize(geometry::Size const& size) = 0;
35
36protected:
37 SurfaceObserver() = default;
38 virtual ~SurfaceObserver() = default;
39 SurfaceObserver(SurfaceObserver const&) = delete;
40 SurfaceObserver& operator=(SurfaceObserver const&) = delete;
41};
42}
43}
44
45#endif // MIR_SCENE_SURFACE_OBSERVER_H_
046
=== renamed file 'src/server/scene/surface_ranker.h' => 'include/server/mir/scene/surface_ranker.h'
--- src/server/scene/surface_ranker.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/scene/surface_ranker.h 2014-04-07 13:29:13 +0000
@@ -26,12 +26,12 @@
26{26{
27namespace scene27namespace scene
28{28{
29class BasicSurface;29class Surface;
3030
31class SurfaceRanker31class SurfaceRanker
32{32{
33public:33public:
34 virtual void raise(std::weak_ptr<BasicSurface> const& surface) = 0;34 virtual void raise(std::weak_ptr<Surface> const& surface) = 0;
3535
36protected:36protected:
37 SurfaceRanker() = default;37 SurfaceRanker() = default;
3838
=== modified file 'include/server/mir/shell/surface.h'
--- include/server/mir/shell/surface.h 2014-03-06 06:05:17 +0000
+++ include/server/mir/shell/surface.h 2014-04-07 13:29:13 +0000
@@ -50,10 +50,8 @@
5050
51 virtual void allow_framedropping(bool) = 0;51 virtual void allow_framedropping(bool) = 0;
5252
53 virtual void raise(std::shared_ptr<scene::SurfaceRanker> const& controller) = 0;
54
55 virtual void resize(geometry::Size const& size) = 0;53 virtual void resize(geometry::Size const& size) = 0;
56 virtual void set_rotation(float degrees, glm::vec3 const& axis) = 0;54 virtual void set_transformation(glm::mat4 const& t) = 0;
5755
58 virtual float alpha() const = 0;56 virtual float alpha() const = 0;
59 virtual void set_alpha(float alpha) = 0;57 virtual void set_alpha(float alpha) = 0;
6058
=== modified file 'include/server/mir/shell/surface_factory.h'
--- include/server/mir/shell/surface_factory.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/shell/surface_factory.h 2014-04-07 13:29:13 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2012 Canonical Ltd.2 * Copyright © 2012-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -19,15 +19,12 @@
19#ifndef MIR_SHELL_SURFACE_FACTORY_H_19#ifndef MIR_SHELL_SURFACE_FACTORY_H_
20#define MIR_SHELL_SURFACE_FACTORY_H_20#define MIR_SHELL_SURFACE_FACTORY_H_
2121
22#include "mir/frontend/surface_id.h"
23#include <memory>22#include <memory>
2423
25namespace mir24namespace mir
26{25{
27namespace frontend26namespace scene { class SurfaceObserver; }
28{27
29class EventSink;
30}
31namespace shell28namespace shell
32{29{
33class Session;30class Session;
@@ -40,8 +37,9 @@
40 virtual std::shared_ptr<Surface> create_surface(37 virtual std::shared_ptr<Surface> create_surface(
41 Session* session,38 Session* session,
42 SurfaceCreationParameters const& params,39 SurfaceCreationParameters const& params,
43 frontend::SurfaceId id,40 std::shared_ptr<scene::SurfaceObserver> const& observer) = 0;
44 std::shared_ptr<frontend::EventSink> const& sink) = 0;41
42 virtual void destroy_surface(std::shared_ptr<Surface> const& surface) = 0;
4543
46protected:44protected:
47 virtual ~SurfaceFactory() {}45 virtual ~SurfaceFactory() {}
4846
=== added file 'include/shared/mir/geometry/length.h'
--- include/shared/mir/geometry/length.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir/geometry/length.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,102 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
17 */
18
19#ifndef MIR_GEOMETRY_LENGTH_H_
20#define MIR_GEOMETRY_LENGTH_H_
21
22namespace mir
23{
24namespace geometry
25{
26
27/// Length represents a physical length in the real world. The number of pixels
28/// this equates to can then be calculated based on a given DPI.
29class Length
30{
31public:
32 enum Units
33 {
34 micrometres = 1,
35 millimetres = 1000,
36 centimetres = 10000,
37 inches = 25400
38 };
39
40 Length() : magnitude(0) {}
41 Length(Length const&) = default;
42 Length& operator=(Length const&) = default;
43 Length(float mag, Units units) : magnitude(mag * units) {}
44
45 float as(Units units) const
46 {
47 return static_cast<float>(magnitude) / units;
48 }
49
50 float as_pixels(float dpi) const
51 {
52 return as(inches) * dpi;
53 }
54
55 bool operator==(Length const& rhs) const
56 {
57 return magnitude == rhs.magnitude;
58 }
59
60 bool operator!=(Length const& rhs) const
61 {
62 return magnitude != rhs.magnitude;
63 }
64
65private:
66 float magnitude;
67};
68
69inline Length operator"" _mm(long double mag)
70{
71 return Length(mag, Length::millimetres);
72}
73
74inline Length operator"" _mm(unsigned long long mag)
75{
76 return Length(mag, Length::millimetres);
77}
78
79inline Length operator"" _cm(long double mag)
80{
81 return Length(mag, Length::centimetres);
82}
83
84inline Length operator"" _cm(unsigned long long mag)
85{
86 return Length(mag, Length::centimetres);
87}
88
89inline Length operator"" _in(long double mag)
90{
91 return Length(mag, Length::inches);
92}
93
94inline Length operator"" _in(unsigned long long mag)
95{
96 return Length(mag, Length::inches);
97}
98
99} // namespace geometry
100} // namespace mir
101
102#endif // MIR_GEOMETRY_LENGTH_H_
0103
=== modified file 'include/test/mir_test_doubles/fake_renderable.h'
--- include/test/mir_test_doubles/fake_renderable.h 2014-03-17 07:35:22 +0000
+++ include/test/mir_test_doubles/fake_renderable.h 2014-04-07 13:29:13 +0000
@@ -42,7 +42,7 @@
42 : rect{{x, y}, {width, height}},42 : rect{{x, y}, {width, height}},
43 opacity(opacity),43 opacity(opacity),
44 rectangular(rectangular),44 rectangular(rectangular),
45 visible(visible),45 visible_(visible),
46 posted(posted)46 posted(posted)
47 {47 {
48 }48 }
@@ -57,9 +57,9 @@
57 return glm::mat4();57 return glm::mat4();
58 }58 }
5959
60 bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override60 bool visible() const override
61 {61 {
62 return visible && posted && rect.overlaps(r);62 return visible_ && posted;
63 }63 }
6464
65 bool shaped() const override65 bool shaped() const override
@@ -72,7 +72,7 @@
72 buf = b;72 buf = b;
73 }73 }
7474
75 std::shared_ptr<graphics::Buffer> buffer(unsigned long) const override75 std::shared_ptr<graphics::Buffer> buffer(void const*) const override
76 {76 {
77 return buf;77 return buf;
78 }78 }
@@ -97,7 +97,7 @@
97 mir::geometry::Rectangle rect;97 mir::geometry::Rectangle rect;
98 float opacity;98 float opacity;
99 bool rectangular;99 bool rectangular;
100 bool visible;100 bool visible_;
101 bool posted;101 bool posted;
102};102};
103103
104104
=== modified file 'include/test/mir_test_doubles/mock_buffer_bundle.h'
--- include/test/mir_test_doubles/mock_buffer_bundle.h 2014-03-07 03:15:55 +0000
+++ include/test/mir_test_doubles/mock_buffer_bundle.h 2014-04-07 13:29:13 +0000
@@ -39,7 +39,7 @@
3939
40 MOCK_METHOD1(client_acquire, void(std::function<void(graphics::Buffer*)>));40 MOCK_METHOD1(client_acquire, void(std::function<void(graphics::Buffer*)>));
41 MOCK_METHOD1(client_release, void(graphics::Buffer*));41 MOCK_METHOD1(client_release, void(graphics::Buffer*));
42 MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(unsigned long));42 MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(void const*));
43 MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&));43 MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&));
44 MOCK_METHOD0(snapshot_acquire, std::shared_ptr<graphics::Buffer>());44 MOCK_METHOD0(snapshot_acquire, std::shared_ptr<graphics::Buffer>());
45 MOCK_METHOD1(snapshot_release, void(std::shared_ptr<graphics::Buffer> const&));45 MOCK_METHOD1(snapshot_release, void(std::shared_ptr<graphics::Buffer> const&));
4646
=== modified file 'include/test/mir_test_doubles/mock_buffer_stream.h'
--- include/test/mir_test_doubles/mock_buffer_stream.h 2014-03-07 03:15:55 +0000
+++ include/test/mir_test_doubles/mock_buffer_stream.h 2014-04-07 13:29:13 +0000
@@ -33,7 +33,7 @@
33{33{
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));
35 MOCK_METHOD1(lock_compositor_buffer,35 MOCK_METHOD1(lock_compositor_buffer,
36 std::shared_ptr<graphics::Buffer>(unsigned long));36 std::shared_ptr<graphics::Buffer>(void const*));
37 MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>());37 MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>());
3838
39 MOCK_METHOD0(get_stream_pixel_format, MirPixelFormat());39 MOCK_METHOD0(get_stream_pixel_format, MirPixelFormat());
4040
=== modified file 'include/test/mir_test_doubles/mock_display_buffer.h'
--- include/test/mir_test_doubles/mock_display_buffer.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/mock_display_buffer.h 2014-04-07 13:29:13 +0000
@@ -46,7 +46,7 @@
46 MOCK_METHOD0(release_current, void());46 MOCK_METHOD0(release_current, void());
47 MOCK_METHOD0(post_update, void());47 MOCK_METHOD0(post_update, void());
48 MOCK_CONST_METHOD0(can_bypass, bool());48 MOCK_CONST_METHOD0(can_bypass, bool());
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&,
50 std::function<void(graphics::Renderable const&)> const&));50 std::function<void(graphics::Renderable const&)> const&));
51 MOCK_CONST_METHOD0(orientation, MirOrientation());51 MOCK_CONST_METHOD0(orientation, MirOrientation());
52};52};
5353
=== modified file 'include/test/mir_test_doubles/mock_display_changer.h'
--- include/test/mir_test_doubles/mock_display_changer.h 2013-09-17 20:03:16 +0000
+++ include/test/mir_test_doubles/mock_display_changer.h 2014-04-07 13:29:13 +0000
@@ -35,7 +35,6 @@
35 MOCK_METHOD0(active_configuration, std::shared_ptr<graphics::DisplayConfiguration>());35 MOCK_METHOD0(active_configuration, std::shared_ptr<graphics::DisplayConfiguration>());
36 MOCK_METHOD2(configure,36 MOCK_METHOD2(configure,
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&));
38 MOCK_METHOD1(ensure_display_powered, void(std::shared_ptr<frontend::Session> const&));
39};38};
4039
41}40}
4241
=== modified file 'include/test/mir_test_doubles/mock_display_device.h'
--- include/test/mir_test_doubles/mock_display_device.h 2014-03-11 13:44:57 +0000
+++ include/test/mir_test_doubles/mock_display_device.h 2014-04-07 13:29:13 +0000
@@ -38,7 +38,7 @@
38 MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&));38 MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&));
39 MOCK_METHOD3(render_gl_and_overlays, void(39 MOCK_METHOD3(render_gl_and_overlays, void(
40 graphics::android::SwappingGLContext const&,40 graphics::android::SwappingGLContext const&,
41 std::list<std::shared_ptr<graphics::Renderable>> const&,41 graphics::RenderableList const&,
42 std::function<void(graphics::Renderable const&)> const&));42 std::function<void(graphics::Renderable const&)> const&));
43 MOCK_METHOD1(post, void(graphics::Buffer const&));43 MOCK_METHOD1(post, void(graphics::Buffer const&));
44 MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation));44 MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation));
4545
=== modified file 'include/test/mir_test_doubles/mock_egl.h'
--- include/test/mir_test_doubles/mock_egl.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/mock_egl.h 2014-04-07 13:29:13 +0000
@@ -53,6 +53,33 @@
53 return false;53 return false;
54}54}
5555
56MATCHER_P2(EGLConfigContainsAttrib, attrib, value, "")
57{
58 bool attrib_position = true;
59 bool attrib_found = false;
60
61 while (!attrib_position || *arg != EGL_NONE)
62 {
63 if (attrib_position && *arg == attrib)
64 {
65 attrib_found = true;
66 }
67 else if (!attrib_position)
68 {
69 if (attrib_found && *arg == value)
70 {
71 return true;
72 }
73
74 attrib_found = false;
75 }
76 attrib_position = !attrib_position;
77 ++arg;
78 }
79
80 return false;
81}
82
56class MockEGL83class MockEGL
57{84{
58public:85public:
5986
=== added file 'include/test/mir_test_doubles/mock_gl_config.h'
--- include/test/mir_test_doubles/mock_gl_config.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_doubles/mock_gl_config.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_MOCK_GL_CONFIG_H_
20#define MIR_TEST_DOUBLES_MOCK_GL_CONFIG_H_
21
22#include "mir/graphics/gl_config.h"
23
24#include <gmock/gmock.h>
25
26namespace mir
27{
28namespace test
29{
30namespace doubles
31{
32
33struct MockGLConfig : public graphics::GLConfig
34{
35 MOCK_CONST_METHOD0(depth_buffer_bits, int());
36 MOCK_CONST_METHOD0(stencil_buffer_bits, int());
37};
38
39}
40}
41}
42
43#endif /* MIR_TEST_DOUBLES_MOCK_GL_CONFIG_H_ */
044
=== modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h'
--- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-04-07 13:29:13 +0000
@@ -21,8 +21,6 @@
2121
22#include <hardware/hwcomposer.h>22#include <hardware/hwcomposer.h>
23#include <gmock/gmock.h>23#include <gmock/gmock.h>
24#include <vector>
25#include <memory>
2624
27namespace mir25namespace mir
28{26{
@@ -37,16 +35,6 @@
37 MockHWCComposerDevice1()35 MockHWCComposerDevice1()
38 {36 {
39 using namespace testing;37 using namespace testing;
40
41 primary_prepare = false;
42 primary_set = false;
43 external_prepare = false;
44 external_set = false;
45 virtual_prepare = false;
46 virtual_set = false;
47 fb_fence = -1;
48 retire_fence = -1;
49
50 common.version = HWC_DEVICE_API_VERSION_1_1;38 common.version = HWC_DEVICE_API_VERSION_1_1;
5139
52 registerProcs = hook_registerProcs;40 registerProcs = hook_registerProcs;
@@ -56,91 +44,6 @@
56 blank = hook_blank;44 blank = hook_blank;
57 getDisplayConfigs = hook_getDisplayConfigs;45 getDisplayConfigs = hook_getDisplayConfigs;
58 getDisplayAttributes = hook_getDisplayAttributes;46 getDisplayAttributes = hook_getDisplayAttributes;
59
60 ON_CALL(*this, set_interface(_,_,_))
61 .WillByDefault(Invoke(this, &MockHWCComposerDevice1::save_last_set_arguments));
62 ON_CALL(*this, prepare_interface(_,_,_))
63 .WillByDefault(Invoke(this, &MockHWCComposerDevice1::save_last_prepare_arguments));
64 }
65
66 int save_args(hwc_display_contents_1_t* out, hwc_display_contents_1_t** in)
67 {
68 if ((nullptr == in) || (nullptr == *in))
69 return -1;
70
71 hwc_display_contents_1_t* primary_display = *in;
72 memcpy(out, primary_display, sizeof(hwc_display_contents_1_t));
73 return 0;
74 }
75
76 void hwc_set_return_fence(int fence)
77 {
78 fb_fence = fence;
79 }
80
81 void hwc_set_retire_fence(int fence)
82 {
83 retire_fence = fence;
84 }
85
86 int save_last_prepare_arguments(struct hwc_composer_device_1 *, size_t size, hwc_display_contents_1_t** displays)
87 {
88 if ((size == 0) || (!displays))
89 return -1;
90
91 switch (size)
92 {
93 case 3:
94 virtual_prepare = (!!displays[2]);
95 case 2:
96 external_prepare = (!!displays[1]);
97 case 1:
98 primary_prepare = (!!displays[0]);
99 for(auto i = 0u; i < displays[0]->numHwLayers; i++)
100 {
101 prepare_layerlist.push_back(displays[0]->hwLayers[i]);
102 prepare_layerlist.back().visibleRegionScreen = {0, nullptr};
103 }
104 save_args(&display0_prepare_content, displays);
105 default:
106 break;
107 }
108 return 0;
109 }
110
111 int save_last_set_arguments(
112 struct hwc_composer_device_1 *, size_t size, hwc_display_contents_1_t** displays)
113 {
114
115 if ((size == 0) || (!displays))
116 return -1;
117
118 switch (size)
119 {
120 case 3:
121 virtual_set = (!!displays[2]);
122 case 2:
123 external_set = (!!displays[1]);
124 case 1:
125 primary_set = (!!displays[0]);
126 for(auto i = 0u; i < displays[0]->numHwLayers; i++)
127 {
128 set_layerlist.push_back(displays[0]->hwLayers[i]);
129 set_layerlist.back().visibleRegionScreen = {0, nullptr};
130 }
131
132 save_args(&display0_set_content, displays);
133
134 if (displays[0]->numHwLayers >= 2)
135 {
136 displays[0]->hwLayers[1].releaseFenceFd = fb_fence;
137 displays[0]->retireFenceFd = retire_fence;
138 }
139
140 default:
141 break;
142 }
143 return 0;
144 }47 }
14548
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)
@@ -188,14 +91,6 @@
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));
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*));
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*));
191
192 bool primary_prepare, primary_set, external_prepare, external_set, virtual_prepare, virtual_set;
193 hwc_display_contents_1_t display0_set_content;
194 std::vector<hwc_layer_1> set_layerlist;
195 std::vector<hwc_layer_1> prepare_layerlist;
196 hwc_display_contents_1_t display0_prepare_content;
197 int fb_fence;
198 int retire_fence;
199};94};
20095
201}96}
20297
=== added file 'include/test/mir_test_doubles/mock_hwc_device_wrapper.h'
--- include/test/mir_test_doubles/mock_hwc_device_wrapper.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_doubles/mock_hwc_device_wrapper.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_MOCK_HWC_DEVICE_WRAPPER_H_
20#define MIR_TEST_DOUBLES_MOCK_HWC_DEVICE_WRAPPER_H_
21
22#include "src/platform/graphics/android/hwc_wrapper.h"
23
24#include <gmock/gmock.h>
25
26namespace mir
27{
28namespace test
29{
30namespace doubles
31{
32
33struct MockHWCDeviceWrapper : public graphics::android::HwcWrapper
34{
35 MOCK_CONST_METHOD1(prepare, void(hwc_display_contents_1_t&));
36 MOCK_CONST_METHOD1(set, void(hwc_display_contents_1_t&));
37};
38
39}
40}
41}
42#endif /* MIR_TEST_DOUBLES_MOCK_HWC_DEVICE_WRAPPER_H_ */
043
=== modified file 'include/test/mir_test_doubles/mock_input_surface.h'
--- include/test/mir_test_doubles/mock_input_surface.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/mock_input_surface.h 2014-04-07 13:29:13 +0000
@@ -43,12 +43,12 @@
43 Return(geometry::Size{}));43 Return(geometry::Size{}));
44 static std::string n;44 static std::string n;
45 ON_CALL(*this, name())45 ON_CALL(*this, name())
46 .WillByDefault(testing::ReturnRef(n));46 .WillByDefault(testing::Return(n));
47 }47 }
48 ~MockInputSurface() noexcept {}48 ~MockInputSurface() noexcept {}
49 MOCK_CONST_METHOD0(top_left, geometry::Point());49 MOCK_CONST_METHOD0(top_left, geometry::Point());
50 MOCK_CONST_METHOD0(size, geometry::Size());50 MOCK_CONST_METHOD0(size, geometry::Size());
51 MOCK_CONST_METHOD0(name, std::string const&());51 MOCK_CONST_METHOD0(name, std::string());
52 MOCK_CONST_METHOD1(contains, bool(geometry::Point const&));52 MOCK_CONST_METHOD1(contains, bool(geometry::Point const&));
53};53};
5454
5555
=== modified file 'include/test/mir_test_doubles/mock_renderable.h'
--- include/test/mir_test_doubles/mock_renderable.h 2014-03-17 07:35:22 +0000
+++ include/test/mir_test_doubles/mock_renderable.h 2014-04-07 13:29:13 +0000
@@ -37,15 +37,24 @@
37 .WillByDefault(testing::Return(geometry::Rectangle{{},{}}));37 .WillByDefault(testing::Return(geometry::Rectangle{{},{}}));
38 ON_CALL(*this, buffer(testing::_))38 ON_CALL(*this, buffer(testing::_))
39 .WillByDefault(testing::Return(std::make_shared<StubBuffer>()));39 .WillByDefault(testing::Return(std::make_shared<StubBuffer>()));
40 ON_CALL(*this, buffers_ready_for_compositor())
41 .WillByDefault(testing::Return(1));
42 ON_CALL(*this, alpha())
43 .WillByDefault(testing::Return(1.0f));
44 ON_CALL(*this, transformation())
45 .WillByDefault(testing::Return(glm::mat4{}));
46 ON_CALL(*this, visible())
47 .WillByDefault(testing::Return(true));
40 }48 }
41 MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(unsigned long));49
50 MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(void const*));
42 MOCK_CONST_METHOD0(alpha_enabled, bool());51 MOCK_CONST_METHOD0(alpha_enabled, bool());
43 MOCK_CONST_METHOD0(screen_position, geometry::Rectangle());52 MOCK_CONST_METHOD0(screen_position, geometry::Rectangle());
44 MOCK_CONST_METHOD0(alpha, float());53 MOCK_CONST_METHOD0(alpha, float());
45 MOCK_CONST_METHOD0(transformation, glm::mat4());54 MOCK_CONST_METHOD0(transformation, glm::mat4());
46 MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const& rect));55 MOCK_CONST_METHOD0(visible, bool());
47 MOCK_CONST_METHOD0(shaped, bool());56 MOCK_CONST_METHOD0(shaped, bool());
48 int buffers_ready_for_compositor() const override { return 1; }57 MOCK_CONST_METHOD0(buffers_ready_for_compositor, int());
49};58};
50}59}
51}60}
5261
=== modified file 'include/test/mir_test_doubles/mock_scene.h'
--- include/test/mir_test_doubles/mock_scene.h 2014-03-13 09:22:13 +0000
+++ include/test/mir_test_doubles/mock_scene.h 2014-04-07 13:29:13 +0000
@@ -32,10 +32,14 @@
32class MockScene : public compositor::Scene32class MockScene : public compositor::Scene
33{33{
34public:34public:
35 MockScene()
36 {
37 ON_CALL(*this, generate_renderable_list())
38 .WillByDefault(testing::Return(graphics::RenderableList{}));
39 }
40 MOCK_CONST_METHOD0(generate_renderable_list, graphics::RenderableList());
35 MOCK_METHOD2(for_each_if, void(compositor::FilterForScene&,41 MOCK_METHOD2(for_each_if, void(compositor::FilterForScene&,
36 compositor::OperatorForScene&));42 compositor::OperatorForScene&));
37 MOCK_METHOD2(reverse_for_each_if, void(compositor::FilterForScene&,
38 compositor::OperatorForScene&));
39 MOCK_METHOD1(set_change_callback, void(std::function<void()> const&));43 MOCK_METHOD1(set_change_callback, void(std::function<void()> const&));
40 MOCK_METHOD0(lock, void());44 MOCK_METHOD0(lock, void());
41 MOCK_METHOD0(unlock, void());45 MOCK_METHOD0(unlock, void());
4246
=== modified file 'include/test/mir_test_doubles/mock_surface.h'
--- include/test/mir_test_doubles/mock_surface.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/mock_surface.h 2014-04-07 13:29:13 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -19,16 +19,11 @@
19#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_H_19#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_H_
20#define MIR_TEST_DOUBLES_MOCK_SURFACE_H_20#define MIR_TEST_DOUBLES_MOCK_SURFACE_H_
2121
22#include "src/server/scene/surface_impl.h"22#include "src/server/scene/basic_surface.h"
2323#include "src/server/report/null_report_factory.h"
24#include "mir/shell/surface_creation_parameters.h"
25#include "null_event_sink.h"
26#include "null_surface_configurator.h"
2724
28#include <gmock/gmock.h>25#include <gmock/gmock.h>
2926
30#include <memory>
31
32namespace mir27namespace mir
33{28{
34namespace test29namespace test
@@ -36,10 +31,17 @@
36namespace doubles31namespace doubles
37{32{
3833
39struct MockSurface : public scene::SurfaceImpl34struct MockSurface : public scene::BasicSurface
40{35{
41 MockSurface(std::shared_ptr<scene::SurfaceBuilder> const& builder) :36 MockSurface() :
42 scene::SurfaceImpl(builder, std::make_shared<NullSurfaceConfigurator>(), shell::a_surface(), frontend::SurfaceId{}, std::make_shared<NullEventSink>())37 scene::BasicSurface(
38 {},
39 {{},{}},
40 true,
41 {},
42 {},
43 {},
44 mir::report::null_scene_report())
43 {45 {
44 }46 }
4547
@@ -53,7 +55,6 @@
53 MOCK_METHOD0(force_requests_to_complete, void());55 MOCK_METHOD0(force_requests_to_complete, void());
54 MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>());56 MOCK_METHOD0(advance_client_buffer, std::shared_ptr<graphics::Buffer>());
5557
56 MOCK_CONST_METHOD0(name, std::string());
57 MOCK_CONST_METHOD0(size, geometry::Size());58 MOCK_CONST_METHOD0(size, geometry::Size());
58 MOCK_CONST_METHOD0(pixel_format, MirPixelFormat());59 MOCK_CONST_METHOD0(pixel_format, MirPixelFormat());
5960
@@ -62,6 +63,7 @@
6263
63 MOCK_METHOD2(configure, int(MirSurfaceAttrib, int));64 MOCK_METHOD2(configure, int(MirSurfaceAttrib, int));
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&));
66 MOCK_METHOD1(add_observer, void(std::shared_ptr<scene::SurfaceObserver> const&));
65};67};
6668
67}69}
6870
=== modified file 'include/test/mir_test_doubles/mock_surface_configurator.h'
--- include/test/mir_test_doubles/mock_surface_configurator.h 2013-07-31 23:09:53 +0000
+++ include/test/mir_test_doubles/mock_surface_configurator.h 2014-04-07 13:29:13 +0000
@@ -19,7 +19,7 @@
19#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_19#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_
20#define MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_20#define MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_
2121
22#include "mir/shell/surface_configurator.h"22#include "mir/scene/surface_configurator.h"
2323
24#include <gmock/gmock.h>24#include <gmock/gmock.h>
2525
@@ -30,10 +30,10 @@
30namespace doubles30namespace doubles
31{31{
3232
33struct MockSurfaceConfigurator : public shell::SurfaceConfigurator33struct MockSurfaceConfigurator : public scene::SurfaceConfigurator
34{34{
35 MOCK_METHOD3(select_attribute_value, int(shell::Surface const&, MirSurfaceAttrib, int));35 MOCK_METHOD3(select_attribute_value, int(scene::Surface const&, MirSurfaceAttrib, int));
36 MOCK_METHOD3(attribute_set, void(shell::Surface const&, MirSurfaceAttrib, int));36 MOCK_METHOD3(attribute_set, void(scene::Surface const&, MirSurfaceAttrib, int));
37};37};
3838
39}39}
4040
=== modified file 'include/test/mir_test_doubles/mock_surface_factory.h'
--- include/test/mir_test_doubles/mock_surface_factory.h 2013-08-28 03:41:48 +0000
+++ include/test/mir_test_doubles/mock_surface_factory.h 2014-04-07 13:29:13 +0000
@@ -33,11 +33,12 @@
3333
34struct MockSurfaceFactory : public shell::SurfaceFactory34struct MockSurfaceFactory : public shell::SurfaceFactory
35{35{
36 MOCK_METHOD4(create_surface, std::shared_ptr<shell::Surface>(36 MOCK_METHOD3(create_surface, std::shared_ptr<shell::Surface>(
37 shell::Session*,37 shell::Session*,
38 const shell::SurfaceCreationParameters&,38 const shell::SurfaceCreationParameters&,
39 frontend::SurfaceId,39 std::shared_ptr<scene::SurfaceObserver> const&));
40 std::shared_ptr<frontend::EventSink> const&));40
41 void destroy_surface(std::shared_ptr<shell::Surface> const& /*surface*/) override {}
41};42};
4243
43}44}
4445
=== modified file 'include/test/mir_test_doubles/mock_surface_ranker.h'
--- include/test/mir_test_doubles/mock_surface_ranker.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/mock_surface_ranker.h 2014-04-07 13:29:13 +0000
@@ -20,7 +20,7 @@
20#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_20#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_
21#define MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_21#define MIR_TEST_DOUBLES_MOCK_SURFACE_RANKER_H_
2222
23#include "src/server/scene/surface_ranker.h"23#include "mir/scene/surface_ranker.h"
2424
25#include <gmock/gmock.h>25#include <gmock/gmock.h>
2626
@@ -33,7 +33,7 @@
3333
34struct MockSurfaceRanker : public scene::SurfaceRanker34struct MockSurfaceRanker : public scene::SurfaceRanker
35{35{
36 MOCK_METHOD1(raise, void(std::weak_ptr<scene::BasicSurface> const&));36 MOCK_METHOD1(raise, void(std::weak_ptr<scene::Surface> const&));
37};37};
3838
39}39}
4040
=== modified file 'include/test/mir_test_doubles/null_display_buffer.h'
--- include/test/mir_test_doubles/null_display_buffer.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/null_display_buffer.h 2014-04-07 13:29:13 +0000
@@ -37,7 +37,7 @@
37 void post_update() {}37 void post_update() {}
38 bool can_bypass() const override { return false; }38 bool can_bypass() const override { return false; }
39 void render_and_post_update(39 void render_and_post_update(
40 std::list<std::shared_ptr<graphics::Renderable>> const&,40 graphics::RenderableList const&,
41 std::function<void(graphics::Renderable const&)> const&) {}41 std::function<void(graphics::Renderable const&)> const&) {}
42 MirOrientation orientation() const override { return mir_orientation_normal; }42 MirOrientation orientation() const override { return mir_orientation_normal; }
43};43};
4444
=== modified file 'include/test/mir_test_doubles/null_display_changer.h'
--- include/test/mir_test_doubles/null_display_changer.h 2013-09-17 20:03:16 +0000
+++ include/test/mir_test_doubles/null_display_changer.h 2014-04-07 13:29:13 +0000
@@ -39,9 +39,6 @@
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&)
40 {40 {
41 }41 }
42 virtual void ensure_display_powered(std::shared_ptr<frontend::Session> const&)
43 {
44 }
45};42};
46}43}
47}44}
4845
=== modified file 'include/test/mir_test_doubles/null_platform.h'
--- include/test/mir_test_doubles/null_platform.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/null_platform.h 2014-04-07 13:29:13 +0000
@@ -39,7 +39,8 @@
39 }39 }
4040
41 std::shared_ptr<graphics::Display> create_display(41 std::shared_ptr<graphics::Display> create_display(
42 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&)42 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
43 std::shared_ptr<graphics::GLConfig> const&)
43 {44 {
44 return std::make_shared<NullDisplay>();45 return std::make_shared<NullDisplay>();
45 }46 }
4647
=== modified file 'include/test/mir_test_doubles/null_surface_configurator.h'
--- include/test/mir_test_doubles/null_surface_configurator.h 2013-07-29 22:55:20 +0000
+++ include/test/mir_test_doubles/null_surface_configurator.h 2014-04-07 13:29:13 +0000
@@ -19,7 +19,7 @@
19#ifndef MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_19#ifndef MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_
20#define MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_20#define MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_
2121
22#include "mir/shell/surface_configurator.h"22#include "mir/scene/surface_configurator.h"
2323
24namespace mir24namespace mir
25{25{
@@ -28,14 +28,14 @@
28namespace doubles28namespace doubles
29{29{
3030
31struct NullSurfaceConfigurator : public shell::SurfaceConfigurator31struct NullSurfaceConfigurator : public scene::SurfaceConfigurator
32{32{
33 int select_attribute_value(shell::Surface const&,33 int select_attribute_value(scene::Surface const&,
34 MirSurfaceAttrib, int requested_value)34 MirSurfaceAttrib, int requested_value)
35 {35 {
36 return requested_value;36 return requested_value;
37 }37 }
38 void attribute_set(shell::Surface const&,38 void attribute_set(scene::Surface const&,
39 MirSurfaceAttrib, int)39 MirSurfaceAttrib, int)
40 {40 {
41 }41 }
4242
=== modified file 'include/test/mir_test_doubles/stub_buffer_stream.h'
--- include/test/mir_test_doubles/stub_buffer_stream.h 2014-03-07 03:15:55 +0000
+++ include/test/mir_test_doubles/stub_buffer_stream.h 2014-04-07 13:29:13 +0000
@@ -40,7 +40,7 @@
40 {40 {
41 complete(&stub_client_buffer);41 complete(&stub_client_buffer);
42 }42 }
43 std::shared_ptr<graphics::Buffer> lock_compositor_buffer(unsigned long) override43 std::shared_ptr<graphics::Buffer> lock_compositor_buffer(void const*) override
44 {44 {
45 return stub_compositor_buffer;45 return stub_compositor_buffer;
46 }46 }
4747
=== modified file 'include/test/mir_test_doubles/stub_display_builder.h'
--- include/test/mir_test_doubles/stub_display_builder.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/stub_display_builder.h 2014-04-07 13:29:13 +0000
@@ -43,7 +43,7 @@
43 void post_update() {}43 void post_update() {}
44 bool can_bypass() const override { return false; }44 bool can_bypass() const override { return false; }
45 void render_and_post_update(45 void render_and_post_update(
46 std::list<std::shared_ptr<graphics::Renderable>> const&,46 graphics::RenderableList const&,
47 std::function<void(graphics::Renderable const&)> const&) {}47 std::function<void(graphics::Renderable const&)> const&) {}
48 MirOrientation orientation() const override { return mir_orientation_normal; }48 MirOrientation orientation() const override { return mir_orientation_normal; }
49 void configure(graphics::DisplayConfigurationOutput const&) {} 49 void configure(graphics::DisplayConfigurationOutput const&) {}
5050
=== modified file 'include/test/mir_test_doubles/stub_display_device.h'
--- include/test/mir_test_doubles/stub_display_device.h 2014-03-11 13:44:57 +0000
+++ include/test/mir_test_doubles/stub_display_device.h 2014-04-07 13:29:13 +0000
@@ -40,7 +40,7 @@
40 }40 }
41 void render_gl_and_overlays(41 void render_gl_and_overlays(
42 graphics::android::SwappingGLContext const&,42 graphics::android::SwappingGLContext const&,
43 std::list<std::shared_ptr<graphics::Renderable>> const&,43 graphics::RenderableList const&,
44 std::function<void(graphics::Renderable const&)> const&)44 std::function<void(graphics::Renderable const&)> const&)
45 {45 {
46 }46 }
4747
=== added file 'include/test/mir_test_doubles/stub_gl_config.h'
--- include/test/mir_test_doubles/stub_gl_config.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_doubles/stub_gl_config.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_STUB_GL_CONFIG_H_
20#define MIR_TEST_DOUBLES_STUB_GL_CONFIG_H_
21
22#include "mir/graphics/gl_config.h"
23
24#include <gmock/gmock.h>
25
26namespace mir
27{
28namespace test
29{
30namespace doubles
31{
32
33struct StubGLConfig : public graphics::GLConfig
34{
35 int depth_buffer_bits() const override { return 0; }
36 int stencil_buffer_bits() const override { return 0; }
37};
38
39}
40}
41}
42
43#endif /* MIR_TEST_DOUBLES_STUB_GL_CONFIG_H_ */
044
=== modified file 'include/test/mir_test_doubles/stub_ipc_factory.h'
--- include/test/mir_test_doubles/stub_ipc_factory.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/stub_ipc_factory.h 2014-04-07 13:29:13 +0000
@@ -41,7 +41,7 @@
41 }41 }
4242
43 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(43 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
44 pid_t, std::shared_ptr<frontend::EventSink> const&, bool) override44 pid_t, std::shared_ptr<frontend::EventSink> const&) override
45 {45 {
46 return server;46 return server;
47 }47 }
4848
=== modified file 'include/test/mir_test_doubles/stub_renderable.h'
--- include/test/mir_test_doubles/stub_renderable.h 2014-03-17 07:35:22 +0000
+++ include/test/mir_test_doubles/stub_renderable.h 2014-04-07 13:29:13 +0000
@@ -33,7 +33,7 @@
33class StubRenderable : public graphics::Renderable33class StubRenderable : public graphics::Renderable
34{34{
35public:35public:
36 std::shared_ptr<graphics::Buffer> buffer(unsigned long) const override36 std::shared_ptr<graphics::Buffer> buffer(void const*) const override
37 {37 {
38 return std::make_shared<StubBuffer>();38 return std::make_shared<StubBuffer>();
39 }39 }
@@ -53,7 +53,7 @@
53 {53 {
54 return trans;54 return trans;
55 }55 }
56 bool should_be_rendered_in(geometry::Rectangle const&) const override56 bool visible() const
57 {57 {
58 return true;58 return true;
59 }59 }
6060
=== modified file 'include/test/mir_test_doubles/stub_session_authorizer.h'
--- include/test/mir_test_doubles/stub_session_authorizer.h 2013-08-28 03:41:48 +0000
+++ include/test/mir_test_doubles/stub_session_authorizer.h 2014-04-07 13:29:13 +0000
@@ -38,6 +38,10 @@
38 {38 {
39 return true;39 return true;
40 }40 }
41 bool screencast_is_allowed(pid_t)
42 {
43 return true;
44 }
41};45};
4246
43}47}
4448
=== removed file 'include/test/mir_test_doubles/stub_surface_builder.h'
--- include/test/mir_test_doubles/stub_surface_builder.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/stub_surface_builder.h 1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
1/*
2 * Copyright © 2013-2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19
20#ifndef MIR_TEST_DOUBLES_STUB_SURFACE_BUILDER_H_
21#define MIR_TEST_DOUBLES_STUB_SURFACE_BUILDER_H_
22
23#include "src/server/scene/surface_builder.h"
24#include "src/server/scene/basic_surface.h"
25#include "src/server/report/null_report_factory.h"
26#include "mir/shell/surface_creation_parameters.h"
27
28#include "mir_test_doubles/stub_buffer_stream.h"
29#include <memory>
30namespace mir
31{
32namespace test
33{
34namespace doubles
35{
36
37class StubSurfaceBuilder : public scene::SurfaceBuilder
38{
39public:
40 StubSurfaceBuilder() :
41 dummy_surface(std::make_shared<scene::BasicSurface>(
42 std::string("stub"),
43 geometry::Rectangle{{},{}},
44 [](){},
45 false,
46 std::make_shared<StubBufferStream>(),
47 std::shared_ptr<input::InputChannel>(),
48 mir::report::null_scene_report()))
49 {
50 }
51
52 std::weak_ptr<scene::BasicSurface> create_surface(shell::SurfaceCreationParameters const&)
53 {
54 return dummy_surface;
55 }
56
57 void destroy_surface(std::weak_ptr<scene::BasicSurface> const& )
58 {
59 }
60
61private:
62 std::shared_ptr<scene::BasicSurface> dummy_surface;
63};
64}
65}
66}
67
68
69#endif /* MIR_TEST_DOUBLES_STUB_SURFACE_BUILDER_H_ */
700
=== removed file 'include/test/mir_test_doubles/stub_surface_ranker.h'
--- include/test/mir_test_doubles/stub_surface_ranker.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_doubles/stub_surface_ranker.h 1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19
20#ifndef MIR_TEST_DOUBLES_STUB_SURFACE_RANKER_H_
21#define MIR_TEST_DOUBLES_STUB_SURFACE_RANKER_H_
22
23#include "src/server/scene/surface_ranker.h"
24
25namespace mir
26{
27namespace test
28{
29namespace doubles
30{
31
32struct StubSurfaceRanker : public scene::SurfaceRanker
33{
34 void raise(std::weak_ptr<scene::BasicSurface> const&) override
35 {
36 }
37};
38
39}
40}
41}
42
43
44#endif /* MIR_TEST_DOUBLES_STUB_SURFACE_RANKER_H_ */
450
=== added file 'include/test/mir_test_framework/declarative_placement_strategy.h'
--- include/test/mir_test_framework/declarative_placement_strategy.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_framework/declarative_placement_strategy.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,64 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_
20#define MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_
21
22#include "mir/shell/placement_strategy.h"
23#include "mir/geometry/rectangle.h"
24#include "mir/scene/depth_id.h"
25
26#include <memory>
27#include <map>
28#include <string>
29
30namespace mir_test_framework
31{
32typedef std::map<std::string, mir::geometry::Rectangle> SurfaceGeometries;
33typedef std::map<std::string, mir::scene::DepthId> SurfaceDepths;
34
35/// DeclarativePlacementStrategy is a test utility server component for specifying
36/// a static list of surface geometries and relative depths. Used, for example,
37/// in input tests where it is necessary to set up scenarios depending on
38/// multiple surfaces geometry and stacking.
39class DeclarativePlacementStrategy : public mir::shell::PlacementStrategy
40{
41 public:
42 // Placement requests will be passed through to default strategy, and then overriden if the surface appears
43 // in the geometry or depth map. This allows for the convenience of leaving some surfaces geometries unspecified
44 // and receiving the default behavior.
45 DeclarativePlacementStrategy(std::shared_ptr<mir::shell::PlacementStrategy> const& default_strategy,
46 SurfaceGeometries const& positions_by_name, SurfaceDepths const& depths_by_name);
47
48 virtual ~DeclarativePlacementStrategy() = default;
49
50 mir::shell::SurfaceCreationParameters place(mir::shell::Session const& session, mir::shell::SurfaceCreationParameters const& request_parameters) override;
51
52protected:
53 DeclarativePlacementStrategy(const DeclarativePlacementStrategy&) = delete;
54 DeclarativePlacementStrategy& operator=(const DeclarativePlacementStrategy&) = delete;
55
56private:
57 std::shared_ptr<mir::shell::PlacementStrategy> const default_strategy;
58
59 SurfaceGeometries surface_geometries_by_name;
60 SurfaceDepths surface_depths_by_name;
61};
62}
63
64#endif // MIR_TEST_FRAMEWORK_DECLARATIVE_PLACEMENT_STRATEGY_H_
065
=== modified file 'include/test/mir_test_framework/udev_environment.h'
--- include/test/mir_test_framework/udev_environment.h 2014-03-06 06:05:17 +0000
+++ include/test/mir_test_framework/udev_environment.h 2014-04-07 13:29:13 +0000
@@ -56,6 +56,7 @@
56 void add_standard_device(std::string const& name);56 void add_standard_device(std::string const& name);
5757
58 UMockdevTestbed *testbed;58 UMockdevTestbed *testbed;
59 std::string const recordings_path;
59};60};
6061
61}62}
6263
=== modified file 'src/client/default_connection_configuration.cpp'
--- src/client/default_connection_configuration.cpp 2014-03-06 06:05:17 +0000
+++ src/client/default_connection_configuration.cpp 2014-04-07 13:29:13 +0000
@@ -103,7 +103,7 @@
103 {103 {
104 auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB");104 auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB");
105 std::string const val{val_raw ? val_raw : default_platform_lib};105 std::string const val{val_raw ? val_raw : default_platform_lib};
106 auto const platform_lib = load_library(val);106 auto const platform_lib = ::load_library(val);
107107
108 auto const create_client_platform_factory =108 auto const create_client_platform_factory =
109 platform_lib->load_function<mcl::CreateClientPlatformFactory>(109 platform_lib->load_function<mcl::CreateClientPlatformFactory>(
110110
=== modified file 'src/client/lttng/input_receiver_report_tp.h'
--- src/client/lttng/input_receiver_report_tp.h 2014-02-03 11:44:32 +0000
+++ src/client/lttng/input_receiver_report_tp.h 2014-04-07 13:29:13 +0000
@@ -26,6 +26,7 @@
26#define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_26#define MIR_CLIENT_LTTNG_INPUT_RECEIVER_REPORT_TP_H_
2727
28#include <lttng/tracepoint.h>28#include <lttng/tracepoint.h>
29#include <stdint.h>
2930
30#ifdef __clang__31#ifdef __clang__
31/*32/*
3233
=== modified file 'src/client/lttng/rpc_report_tp.h'
--- src/client/lttng/rpc_report_tp.h 2014-03-06 06:05:17 +0000
+++ src/client/lttng/rpc_report_tp.h 2014-04-07 13:29:13 +0000
@@ -26,6 +26,7 @@
26#define MIR_CLIENT_LTTNG_RPC_REPORT_TP_H_26#define MIR_CLIENT_LTTNG_RPC_REPORT_TP_H_
2727
28#include <lttng/tracepoint.h>28#include <lttng/tracepoint.h>
29#include <stdint.h>
2930
30#ifdef __clang__31#ifdef __clang__
31/*32/*
3233
=== modified file 'src/client/mir_client_library.cpp'
--- src/client/mir_client_library.cpp 2014-03-06 06:05:17 +0000
+++ src/client/mir_client_library.cpp 2014-04-07 13:29:13 +0000
@@ -120,8 +120,17 @@
120{120{
121 if (!error_connections.contains(connection))121 if (!error_connections.contains(connection))
122 {122 {
123 auto wait_handle = connection->disconnect();123 try
124 wait_handle->wait_for_all();124 {
125 auto wait_handle = connection->disconnect();
126 wait_handle->wait_for_all();
127 }
128 catch (std::exception const&)
129 {
130 // We're implementing a C API so no exceptions are to be
131 // propagated. And that's OK because if disconnect() fails,
132 // we don't care why. We're finished with the connection anyway.
133 }
125 }134 }
126 else135 else
127 {136 {
128137
=== modified file 'src/client/rpc/mir_basic_rpc_channel.cpp'
--- src/client/rpc/mir_basic_rpc_channel.cpp 2014-03-06 06:05:17 +0000
+++ src/client/rpc/mir_basic_rpc_channel.cpp 2014-04-07 13:29:13 +0000
@@ -34,7 +34,7 @@
34}34}
3535
36void mclrd::PendingCallCache::save_completion_details(36void mclrd::PendingCallCache::save_completion_details(
37 mir::protobuf::wire::Invocation& invoke,37 mir::protobuf::wire::Invocation const& invoke,
38 google::protobuf::Message* response,38 google::protobuf::Message* response,
39 std::shared_ptr<google::protobuf::Closure> const& complete)39 std::shared_ptr<google::protobuf::Closure> const& complete)
40{40{
@@ -102,8 +102,8 @@
102102
103103
104mir::protobuf::wire::Invocation mclr::MirBasicRpcChannel::invocation_for(104mir::protobuf::wire::Invocation mclr::MirBasicRpcChannel::invocation_for(
105 const google::protobuf::MethodDescriptor* method,105 google::protobuf::MethodDescriptor const* method,
106 const google::protobuf::Message* request)106 google::protobuf::Message const* request)
107{107{
108 char buffer[mir::frontend::serialization_buffer_size];108 char buffer[mir::frontend::serialization_buffer_size];
109109
110110
=== modified file 'src/client/rpc/mir_basic_rpc_channel.h'
--- src/client/rpc/mir_basic_rpc_channel.h 2014-03-06 06:05:17 +0000
+++ src/client/rpc/mir_basic_rpc_channel.h 2014-04-07 13:29:13 +0000
@@ -55,7 +55,7 @@
55 PendingCallCache(std::shared_ptr<RpcReport> const& rpc_report);55 PendingCallCache(std::shared_ptr<RpcReport> const& rpc_report);
5656
57 void save_completion_details(57 void save_completion_details(
58 mir::protobuf::wire::Invocation& invoke,58 mir::protobuf::wire::Invocation const& invoke,
59 google::protobuf::Message* response,59 google::protobuf::Message* response,
60 std::shared_ptr<google::protobuf::Closure> const& complete);60 std::shared_ptr<google::protobuf::Closure> const& complete);
6161
@@ -95,8 +95,9 @@
95 ~MirBasicRpcChannel();95 ~MirBasicRpcChannel();
9696
97protected:97protected:
98 mir::protobuf::wire::Invocation invocation_for(const google::protobuf::MethodDescriptor* method,98 mir::protobuf::wire::Invocation invocation_for(
99 const google::protobuf::Message* request);99 google::protobuf::MethodDescriptor const* method,
100 google::protobuf::Message const* request);
100 int next_id();101 int next_id();
101102
102private:103private:
103104
=== modified file 'src/client/rpc/mir_socket_rpc_channel.cpp'
--- src/client/rpc/mir_socket_rpc_channel.cpp 2014-03-06 06:05:17 +0000
+++ src/client/rpc/mir_socket_rpc_channel.cpp 2014-04-07 13:29:13 +0000
@@ -142,8 +142,39 @@
142{142{
143 if (!disconnected.load())143 if (!disconnected.load())
144 {144 {
145 auto surface = dynamic_cast<mir::protobuf::Surface*>(response);145 auto const message_type = response->GetTypeName();
146 mir::protobuf::Screencast* screencast{nullptr};146
147 mir::protobuf::Surface* surface = nullptr;
148 mir::protobuf::Buffer* buffer = nullptr;
149 mir::protobuf::Platform* platform = nullptr;
150
151 if (message_type == "mir.protobuf.Buffer")
152 {
153 buffer = static_cast<mir::protobuf::Buffer*>(response);
154 }
155 else if (message_type == "mir.protobuf.Surface")
156 {
157 surface = static_cast<mir::protobuf::Surface*>(response);
158 if (surface && surface->has_buffer())
159 buffer = surface->mutable_buffer();
160 }
161 else if (message_type == "mir.protobuf.Screencast")
162 {
163 auto screencast = static_cast<mir::protobuf::Screencast*>(response);
164 if (screencast && screencast->has_buffer())
165 buffer = screencast->mutable_buffer();
166 }
167 else if (message_type == "mir.protobuf.Platform")
168 {
169 platform = static_cast<mir::protobuf::Platform*>(response);
170 }
171 else if (message_type == "mir.protobuf.Connection")
172 {
173 auto connection = static_cast<mir::protobuf::Connection*>(response);
174 if (connection && connection->has_platform())
175 platform = connection->mutable_platform();
176 }
177
147 if (surface)178 if (surface)
148 {179 {
149 surface->clear_fd();180 surface->clear_fd();
@@ -158,19 +189,6 @@
158 rpc_report->file_descriptors_received(*response, fds);189 rpc_report->file_descriptors_received(*response, fds);
159 }190 }
160 }191 }
161 else
162 {
163 screencast = dynamic_cast<mir::protobuf::Screencast*>(response);
164 }
165
166 auto buffer = dynamic_cast<mir::protobuf::Buffer*>(response);
167 if (!buffer)
168 {
169 if (surface && surface->has_buffer())
170 buffer = surface->mutable_buffer();
171 else if (screencast && screencast->has_buffer())
172 buffer = screencast->mutable_buffer();
173 }
174192
175 if (buffer)193 if (buffer)
176 {194 {
@@ -187,14 +205,6 @@
187 }205 }
188 }206 }
189207
190 auto platform = dynamic_cast<mir::protobuf::Platform*>(response);
191 if (!platform)
192 {
193 auto connection = dynamic_cast<mir::protobuf::Connection*>(response);
194 if (connection && connection->has_platform())
195 platform = connection->mutable_platform();
196 }
197
198 if (platform)208 if (platform)
199 {209 {
200 platform->clear_fd();210 platform->clear_fd();
@@ -266,7 +276,7 @@
266 google::protobuf::Message* response,276 google::protobuf::Message* response,
267 google::protobuf::Closure* complete)277 google::protobuf::Closure* complete)
268{278{
269 mir::protobuf::wire::Invocation invocation = invocation_for(method, parameters);279 auto const& invocation = invocation_for(method, parameters);
270280
271 rpc_report->invocation_requested(invocation);281 rpc_report->invocation_requested(invocation);
272282
@@ -345,7 +355,7 @@
345 {355 {
346 const size_t body_size = read_message_header();356 const size_t body_size = read_message_header();
347357
348 result = read_message_body(body_size);358 read_message_body(result, body_size);
349359
350 rpc_report->result_receipt_succeeded(result);360 rpc_report->result_receipt_succeeded(result);
351 }361 }
@@ -431,18 +441,17 @@
431 return body_size;441 return body_size;
432}442}
433443
434mir::protobuf::wire::Result mclr::MirSocketRpcChannel::read_message_body(const size_t body_size)444void mclr::MirSocketRpcChannel::read_message_body(
445 mir::protobuf::wire::Result& result,
446 size_t const body_size)
435{447{
436 boost::system::error_code error;448 boost::system::error_code error;
437 boost::asio::streambuf message;449 body_bytes.resize(body_size);
438 boost::asio::read(socket, message, boost::asio::transfer_exactly(body_size), error);450 boost::asio::read(socket, boost::asio::buffer(body_bytes), error);
439 if (error)451 if (error)
440 {452 {
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()));
442 }454 }
443455
444 std::istream in(&message);456 result.ParseFromArray(body_bytes.data(), body_size);
445 mir::protobuf::wire::Result result;
446 result.ParseFromIstream(&in);
447 return result;
448}457}
449458
=== modified file 'src/client/rpc/mir_socket_rpc_channel.h'
--- src/client/rpc/mir_socket_rpc_channel.h 2014-03-06 06:05:17 +0000
+++ src/client/rpc/mir_socket_rpc_channel.h 2014-04-07 13:29:13 +0000
@@ -80,6 +80,7 @@
8080
81 static size_t const size_of_header = 2;81 static size_t const size_of_header = 2;
82 unsigned char header_bytes[size_of_header];82 unsigned char header_bytes[size_of_header];
83 std::vector<char> body_bytes;
8384
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);
85 void receive_file_descriptors(std::vector<int> &fds);86 void receive_file_descriptors(std::vector<int> &fds);
@@ -92,7 +93,8 @@
9293
93 size_t read_message_header();94 size_t read_message_header();
9495
95 mir::protobuf::wire::Result read_message_body(const size_t body_size);96 void read_message_body(mir::protobuf::wire::Result& result,
97 size_t const body_size);
96 void notify_disconnected();98 void notify_disconnected();
9799
98 std::shared_ptr<SurfaceMap> surface_map;100 std::shared_ptr<SurfaceMap> surface_map;
99101
=== modified file 'src/platform/CMakeLists.txt'
--- src/platform/CMakeLists.txt 2014-03-06 06:05:17 +0000
+++ src/platform/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -3,13 +3,14 @@
33
4add_library(4add_library(
5 mirplatform SHARED5 mirplatform SHARED
66 shared_library_loader.cpp
7 udev_wrapper.cpp7 udev_wrapper.cpp
8)8)
99
10target_link_libraries(10target_link_libraries(
11 mirplatform11 mirplatform
12 mirplatformgraphicscommon12 mirplatformgraphicscommon
13 mirsharedsharedlibrary
1314
14 ${UDEV_LDFLAGS} ${UDEV_LIBRARIES}15 ${UDEV_LDFLAGS} ${UDEV_LIBRARIES}
15)16)
1617
=== modified file 'src/platform/graphics/android/CMakeLists.txt'
--- src/platform/graphics/android/CMakeLists.txt 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -20,6 +20,7 @@
20 hwc_layerlist.cpp20 hwc_layerlist.cpp
21 hwc_layers.cpp21 hwc_layers.cpp
22 hwc_fb_device.cpp22 hwc_fb_device.cpp
23 hwc_formatted_logger.cpp
23 hwc_device.cpp24 hwc_device.cpp
24 hwc_common_device.cpp25 hwc_common_device.cpp
25 hwc_vsync.cpp26 hwc_vsync.cpp
@@ -44,9 +45,12 @@
44target_link_libraries(45target_link_libraries(
45 mirplatformgraphicsandroid46 mirplatformgraphicsandroid
4647
48 miroptions
47 mirplatform49 mirplatform
48 mirsharedandroid50 mirsharedandroid
51 mirsharedenv
4952
53 ${Boost_PROGRAM_OPTIONS_LIBRARY}
50 ${LIBHARDWARE_LIBRARIES}54 ${LIBHARDWARE_LIBRARIES}
51 ${EGL_LDFLAGS} ${EGL_LIBRARIES}55 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
52 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}56 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
5357
=== modified file 'src/platform/graphics/android/android_display.cpp'
--- src/platform/graphics/android/android_display.cpp 2014-03-17 07:35:22 +0000
+++ src/platform/graphics/android/android_display.cpp 2014-04-07 13:29:13 +0000
@@ -33,9 +33,10 @@
33namespace geom=mir::geometry;33namespace geom=mir::geometry;
3434
35mga::AndroidDisplay::AndroidDisplay(std::shared_ptr<mga::DisplayBuilder> const& display_builder,35mga::AndroidDisplay::AndroidDisplay(std::shared_ptr<mga::DisplayBuilder> const& display_builder,
36 std::shared_ptr<GLConfig> const& gl_config,
36 std::shared_ptr<DisplayReport> const& display_report)37 std::shared_ptr<DisplayReport> const& display_report)
37 : display_builder{display_builder},38 : display_builder{display_builder},
38 gl_context{display_builder->display_format(), *display_report},39 gl_context{display_builder->display_format(), *gl_config, *display_report},
39 display_buffer{display_builder->create_display_buffer(gl_context)}40 display_buffer{display_builder->create_display_buffer(gl_context)}
40{41{
41 display_report->report_successful_setup_of_native_resources();42 display_report->report_successful_setup_of_native_resources();
4243
=== modified file 'src/platform/graphics/android/android_display.h'
--- src/platform/graphics/android/android_display.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/android/android_display.h 2014-04-07 13:29:13 +0000
@@ -30,6 +30,7 @@
30{30{
3131
32class DisplayReport;32class DisplayReport;
33class GLConfig;
3334
34namespace android35namespace android
35{36{
@@ -41,6 +42,7 @@
41{42{
42public:43public:
43 explicit AndroidDisplay(std::shared_ptr<DisplayBuilder> const& display_builder,44 explicit AndroidDisplay(std::shared_ptr<DisplayBuilder> const& display_builder,
45 std::shared_ptr<GLConfig> const& gl_config,
44 std::shared_ptr<DisplayReport> const& display_report);46 std::shared_ptr<DisplayReport> const& display_report);
4547
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);
4749
=== modified file 'src/platform/graphics/android/android_platform.cpp'
--- src/platform/graphics/android/android_platform.cpp 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/android/android_platform.cpp 2014-04-07 13:29:13 +0000
@@ -31,6 +31,8 @@
31#include "mir/graphics/buffer_ipc_packer.h"31#include "mir/graphics/buffer_ipc_packer.h"
32#include "mir/graphics/display_report.h"32#include "mir/graphics/display_report.h"
33#include "mir/options/option.h"33#include "mir/options/option.h"
34#include "mir/options/configuration.h"
35#include "mir/abnormal_exit.h"
3436
35#include <boost/throw_exception.hpp>37#include <boost/throw_exception.hpp>
36#include <stdexcept>38#include <stdexcept>
@@ -40,6 +42,26 @@
40namespace mf=mir::frontend;42namespace mf=mir::frontend;
41namespace mo = mir::options;43namespace mo = mir::options;
4244
45namespace
46{
47char const* const hwc_log_opt = "hwc-report";
48bool should_log_hwc(mo::Option const& options)
49{
50 if (!options.is_set(hwc_log_opt))
51 return false;
52
53 auto opt = options.get<std::string>(hwc_log_opt);
54 if (opt == mo::log_opt_value)
55 return true;
56 else if (opt == mo::off_opt_value)
57 return false;
58 else
59 throw mir::AbnormalExit(
60 std::string("Invalid hwc-report option: " + opt + " (valid options are: \"" +
61 mo::off_opt_value + "\" and \"" + mo::log_opt_value + "\")"));
62}
63}
64
43mga::AndroidPlatform::AndroidPlatform(65mga::AndroidPlatform::AndroidPlatform(
44 std::shared_ptr<mga::DisplayBuilder> const& display_builder,66 std::shared_ptr<mga::DisplayBuilder> const& display_builder,
45 std::shared_ptr<mg::DisplayReport> const& display_report)67 std::shared_ptr<mg::DisplayReport> const& display_report)
@@ -61,9 +83,11 @@
61}83}
6284
63std::shared_ptr<mg::Display> mga::AndroidPlatform::create_display(85std::shared_ptr<mg::Display> mga::AndroidPlatform::create_display(
64 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&)86 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
87 std::shared_ptr<mg::GLConfig> const& gl_config)
65{88{
66 return std::make_shared<mga::AndroidDisplay>(display_builder, display_report);89 return std::make_shared<mga::AndroidDisplay>(
90 display_builder, gl_config, display_report);
67}91}
6892
69std::shared_ptr<mg::PlatformIPCPackage> mga::AndroidPlatform::get_ipc_package()93std::shared_ptr<mg::PlatformIPCPackage> mga::AndroidPlatform::get_ipc_package()
@@ -105,10 +129,10 @@
105 return std::make_shared<mga::InternalClient>();129 return std::make_shared<mga::InternalClient>();
106}130}
107131
108extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& /*options*/, std::shared_ptr<DisplayReport> const& display_report)132extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& options, std::shared_ptr<DisplayReport> const& display_report)
109{133{
110 auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>();134 auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
111 auto display_resource_factory = std::make_shared<mga::ResourceFactory>();135 auto display_resource_factory = std::make_shared<mga::ResourceFactory>(should_log_hwc(*options));
112 auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);136 auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);
113 auto display_builder = std::make_shared<mga::OutputBuilder>(137 auto display_builder = std::make_shared<mga::OutputBuilder>(
114 fb_allocator, display_resource_factory, display_report);138 fb_allocator, display_resource_factory, display_report);
@@ -121,3 +145,12 @@
121 // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder145 // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder
122 return std::make_shared<mga::AndroidPlatform>(nullptr, display_report);146 return std::make_shared<mga::AndroidPlatform>(nullptr, display_report);
123}147}
148
149extern "C" void add_platform_options(
150 boost::program_options::options_description& config)
151{
152 config.add_options()
153 (hwc_log_opt,
154 boost::program_options::value<std::string>()->default_value(std::string{mo::off_opt_value}),
155 "[platform-specific] How to handle the HWC logging report. [{log,off}]");
156}
124157
=== modified file 'src/platform/graphics/android/android_platform.h'
--- src/platform/graphics/android/android_platform.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/android/android_platform.h 2014-04-07 13:29:13 +0000
@@ -44,7 +44,8 @@
44 std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(44 std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(
45 std::shared_ptr<BufferInitializer> const& buffer_initializer);45 std::shared_ptr<BufferInitializer> const& buffer_initializer);
46 std::shared_ptr<Display> create_display(46 std::shared_ptr<Display> create_display(
47 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&);47 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
48 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/);
48 std::shared_ptr<PlatformIPCPackage> get_ipc_package();49 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
49 std::shared_ptr<InternalClient> create_internal_client();50 std::shared_ptr<InternalClient> create_internal_client();
50 void fill_ipc_package(BufferIPCPacker* packer, graphics::Buffer const* buffer) const;51 void fill_ipc_package(BufferIPCPacker* packer, graphics::Buffer const* buffer) const;
5152
=== modified file 'src/platform/graphics/android/display_buffer.cpp'
--- src/platform/graphics/android/display_buffer.cpp 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/display_buffer.cpp 2014-04-07 13:29:13 +0000
@@ -85,7 +85,7 @@
85}85}
8686
87void mga::DisplayBuffer::render_and_post_update(87void mga::DisplayBuffer::render_and_post_update(
88 std::list<std::shared_ptr<Renderable>> const& renderlist,88 RenderableList const& renderlist,
89 std::function<void(Renderable const&)> const& render_fn)89 std::function<void(Renderable const&)> const& render_fn)
90{90{
91 if (renderlist.empty())91 if (renderlist.empty())
9292
=== modified file 'src/platform/graphics/android/display_buffer.h'
--- src/platform/graphics/android/display_buffer.h 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/display_buffer.h 2014-04-07 13:29:13 +0000
@@ -50,7 +50,7 @@
50 bool can_bypass() const override;50 bool can_bypass() const override;
5151
52 void render_and_post_update(52 void render_and_post_update(
53 std::list<std::shared_ptr<Renderable>> const& renderlist,53 RenderableList const& renderlist,
54 std::function<void(Renderable const&)> const& render_fn);54 std::function<void(Renderable const&)> const& render_fn);
55 MirOrientation orientation() const override;55 MirOrientation orientation() const override;
5656
5757
=== modified file 'src/platform/graphics/android/display_device.h'
--- src/platform/graphics/android/display_device.h 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/display_device.h 2014-04-07 13:29:13 +0000
@@ -44,7 +44,7 @@
44 virtual void render_gl(SwappingGLContext const& context) = 0;44 virtual void render_gl(SwappingGLContext const& context) = 0;
45 virtual void render_gl_and_overlays(45 virtual void render_gl_and_overlays(
46 SwappingGLContext const& context,46 SwappingGLContext const& context,
47 std::list<std::shared_ptr<Renderable>> const& list,47 RenderableList const& list,
48 std::function<void(Renderable const&)> const& render_fn) = 0;48 std::function<void(Renderable const&)> const& render_fn) = 0;
49 virtual void post(Buffer const& buffer) = 0;49 virtual void post(Buffer const& buffer) = 0;
50 virtual bool apply_orientation(MirOrientation orientation) const = 0;50 virtual bool apply_orientation(MirOrientation orientation) const = 0;
5151
=== modified file 'src/platform/graphics/android/fb_device.cpp'
--- src/platform/graphics/android/fb_device.cpp 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/fb_device.cpp 2014-04-07 13:29:13 +0000
@@ -51,7 +51,7 @@
5151
52void mga::FBDevice::render_gl_and_overlays(52void mga::FBDevice::render_gl_and_overlays(
53 SwappingGLContext const& context,53 SwappingGLContext const& context,
54 std::list<std::shared_ptr<Renderable>> const& renderables,54 RenderableList const& renderables,
55 std::function<void(Renderable const&)> const& render_fn) 55 std::function<void(Renderable const&)> const& render_fn)
56{56{
57 for(auto const& renderable : renderables)57 for(auto const& renderable : renderables)
5858
=== modified file 'src/platform/graphics/android/fb_device.h'
--- src/platform/graphics/android/fb_device.h 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/fb_device.h 2014-04-07 13:29:13 +0000
@@ -40,7 +40,7 @@
40 virtual void render_gl(SwappingGLContext const& context);40 virtual void render_gl(SwappingGLContext const& context);
41 virtual void render_gl_and_overlays(41 virtual void render_gl_and_overlays(
42 SwappingGLContext const& context,42 SwappingGLContext const& context,
43 std::list<std::shared_ptr<Renderable>> const& list,43 RenderableList const& list,
44 std::function<void(Renderable const&)> const& render_fn);44 std::function<void(Renderable const&)> const& render_fn);
45 void post(Buffer const& buffer);45 void post(Buffer const& buffer);
4646
4747
=== modified file 'src/platform/graphics/android/gl_context.cpp'
--- src/platform/graphics/android/gl_context.cpp 2014-03-12 02:46:58 +0000
+++ src/platform/graphics/android/gl_context.cpp 2014-04-07 13:29:13 +0000
@@ -19,6 +19,7 @@
19#include "gl_context.h"19#include "gl_context.h"
20#include "android_format_conversion-inl.h"20#include "android_format_conversion-inl.h"
21#include "mir/graphics/display_report.h"21#include "mir/graphics/display_report.h"
22#include "mir/graphics/gl_config.h"
2223
23#include <algorithm>24#include <algorithm>
24#include <boost/throw_exception.hpp>25#include <boost/throw_exception.hpp>
@@ -31,13 +32,6 @@
31namespace32namespace
32{33{
3334
34static EGLint const required_egl_config_attr [] =
35{
36 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
37 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
38 EGL_NONE
39};
40
41static EGLint const default_egl_context_attr[] =35static EGLint const default_egl_context_attr[] =
42{36{
43 EGL_CONTEXT_CLIENT_VERSION, 2,37 EGL_CONTEXT_CLIENT_VERSION, 2,
@@ -69,8 +63,19 @@
6963
70/* the minimum requirement is to have EGL_WINDOW_BIT and EGL_OPENGL_ES2_BIT, and to select a config64/* the minimum requirement is to have EGL_WINDOW_BIT and EGL_OPENGL_ES2_BIT, and to select a config
71 whose pixel format matches that of the framebuffer. */65 whose pixel format matches that of the framebuffer. */
72static EGLConfig select_egl_config_with_format(EGLDisplay egl_display, MirPixelFormat display_format)66EGLConfig select_egl_config_with_format(
67 EGLDisplay egl_display, MirPixelFormat display_format,
68 mg::GLConfig const& gl_config)
73{69{
70 EGLint const required_egl_config_attr [] =
71 {
72 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
73 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
74 EGL_DEPTH_SIZE, gl_config.depth_buffer_bits(),
75 EGL_STENCIL_SIZE, gl_config.stencil_buffer_bits(),
76 EGL_NONE
77 };
78
74 int required_visual_id = mga::to_android_format(display_format);79 int required_visual_id = mga::to_android_format(display_format);
75 int num_potential_configs;80 int num_potential_configs;
76 EGLint num_match_configs;81 EGLint num_match_configs;
@@ -107,10 +112,12 @@
107 return eglCreateWindowSurface(disp, config, native, NULL);112 return eglCreateWindowSurface(disp, config, native, NULL);
108}113}
109114
110mga::GLContext::GLContext(MirPixelFormat display_format, mg::DisplayReport& report)115mga::GLContext::GLContext(MirPixelFormat display_format,
116 mg::GLConfig const& gl_config,
117 mg::DisplayReport& report)
111 : egl_display(create_and_initialize_display()),118 : egl_display(create_and_initialize_display()),
112 own_display(true),119 own_display(true),
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)),
114 egl_context{egl_display,121 egl_context{egl_display,
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)},
116 egl_surface{egl_display,123 egl_surface{egl_display,
117124
=== modified file 'src/platform/graphics/android/gl_context.h'
--- src/platform/graphics/android/gl_context.h 2014-03-12 02:46:58 +0000
+++ src/platform/graphics/android/gl_context.h 2014-04-07 13:29:13 +0000
@@ -29,6 +29,7 @@
29namespace graphics29namespace graphics
30{30{
31class DisplayReport;31class DisplayReport;
32class GLConfig;
32namespace android33namespace android
33{34{
3435
@@ -53,7 +54,9 @@
53{54{
54public:55public:
55 //For creating a gl context56 //For creating a gl context
56 GLContext(MirPixelFormat display_format, DisplayReport& report);57 GLContext(MirPixelFormat display_format,
58 GLConfig const& gl_config,
59 DisplayReport& report);
5760
58 //For creating a gl context shared with another GLContext61 //For creating a gl context shared with another GLContext
59 GLContext(GLContext const& shared_gl_context,62 GLContext(GLContext const& shared_gl_context,
6063
=== modified file 'src/platform/graphics/android/hwc_common_device.cpp'
--- src/platform/graphics/android/hwc_common_device.cpp 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/hwc_common_device.cpp 2014-04-07 13:29:13 +0000
@@ -44,8 +44,8 @@
4444
45mga::HWCCommonDevice::HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,45mga::HWCCommonDevice::HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
46 std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator)46 std::shared_ptr<mga::HWCVsyncCoordinator> const& coordinator)
47 : hwc_device(hwc_device),47 : coordinator(coordinator),
48 coordinator(coordinator),48 hwc_device(hwc_device),
49 current_mode(mir_power_mode_on)49 current_mode(mir_power_mode_on)
50{50{
51 callbacks.hooks.invalidate = invalidate_hook;51 callbacks.hooks.invalidate = invalidate_hook;
5252
=== modified file 'src/platform/graphics/android/hwc_common_device.h'
--- src/platform/graphics/android/hwc_common_device.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/android/hwc_common_device.h 2014-04-07 13:29:13 +0000
@@ -54,7 +54,6 @@
54 HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,54 HWCCommonDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
55 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);55 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);
5656
57 std::shared_ptr<hwc_composer_device_1> const hwc_device;
58 std::shared_ptr<HWCVsyncCoordinator> const coordinator;57 std::shared_ptr<HWCVsyncCoordinator> const coordinator;
59 std::unique_lock<std::mutex> lock_unblanked();58 std::unique_lock<std::mutex> lock_unblanked();
6059
@@ -64,6 +63,8 @@
6463
65 HWCCallbacks callbacks;64 HWCCallbacks callbacks;
6665
66 std::shared_ptr<hwc_composer_device_1> const hwc_device;
67
67 std::mutex blanked_mutex;68 std::mutex blanked_mutex;
68 std::condition_variable blanked_cond;69 std::condition_variable blanked_cond;
69 MirPowerMode current_mode;70 MirPowerMode current_mode;
7071
=== modified file 'src/platform/graphics/android/hwc_device.cpp'
--- src/platform/graphics/android/hwc_device.cpp 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/hwc_device.cpp 2014-04-07 13:29:13 +0000
@@ -21,6 +21,7 @@
21#include "hwc_device.h"21#include "hwc_device.h"
22#include "hwc_layerlist.h"22#include "hwc_layerlist.h"
23#include "hwc_vsync_coordinator.h"23#include "hwc_vsync_coordinator.h"
24#include "hwc_wrapper.h"
24#include "framebuffer_bundle.h"25#include "framebuffer_bundle.h"
25#include "buffer.h"26#include "buffer.h"
26#include "mir/graphics/buffer.h"27#include "mir/graphics/buffer.h"
@@ -89,7 +90,7 @@
8990
90void mga::HwcDevice::render_gl_and_overlays(91void mga::HwcDevice::render_gl_and_overlays(
91 SwappingGLContext const& context,92 SwappingGLContext const& context,
92 std::list<std::shared_ptr<Renderable>> const& renderables,93 RenderableList const& renderables,
93 std::function<void(Renderable const&)> const& render_fn)94 std::function<void(Renderable const&)> const& render_fn)
94{95{
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)))
9697
=== modified file 'src/platform/graphics/android/hwc_device.h'
--- src/platform/graphics/android/hwc_device.h 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/hwc_device.h 2014-04-07 13:29:13 +0000
@@ -35,20 +35,7 @@
35{35{
36class HWCVsyncCoordinator;36class HWCVsyncCoordinator;
37class SyncFileOps;37class SyncFileOps;
3838class HwcWrapper;
39class HwcWrapper
40{
41public:
42 virtual ~HwcWrapper() = default;
43
44 virtual void prepare(hwc_display_contents_1_t&) const = 0;
45 virtual void set(hwc_display_contents_1_t&) const = 0;
46
47protected:
48 HwcWrapper() = default;
49 HwcWrapper& operator=(HwcWrapper const&) = delete;
50 HwcWrapper(HwcWrapper const&) = delete;
51};
5239
53class HwcDevice : public HWCCommonDevice40class HwcDevice : public HWCCommonDevice
54{41{
@@ -63,7 +50,7 @@
63 virtual void render_gl(SwappingGLContext const& context);50 virtual void render_gl(SwappingGLContext const& context);
64 virtual void render_gl_and_overlays(51 virtual void render_gl_and_overlays(
65 SwappingGLContext const& context,52 SwappingGLContext const& context,
66 std::list<std::shared_ptr<Renderable>> const& list,53 RenderableList const& list,
67 std::function<void(Renderable const&)> const& render_fn);54 std::function<void(Renderable const&)> const& render_fn);
68 void post(Buffer const& buffer);55 void post(Buffer const& buffer);
6956
7057
=== modified file 'src/platform/graphics/android/hwc_fb_device.cpp'
--- src/platform/graphics/android/hwc_fb_device.cpp 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/hwc_fb_device.cpp 2014-04-07 13:29:13 +0000
@@ -21,6 +21,7 @@
21#include "hwc_vsync_coordinator.h"21#include "hwc_vsync_coordinator.h"
22#include "framebuffer_bundle.h"22#include "framebuffer_bundle.h"
23#include "android_format_conversion-inl.h"23#include "android_format_conversion-inl.h"
24#include "hwc_wrapper.h"
24#include "mir/graphics/buffer.h"25#include "mir/graphics/buffer.h"
25#include "mir/graphics/android/native_buffer.h"26#include "mir/graphics/android/native_buffer.h"
2627
@@ -33,9 +34,11 @@
33namespace geom = mir::geometry;34namespace geom = mir::geometry;
3435
35mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,36mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
37 std::shared_ptr<HwcWrapper> const& hwc_wrapper,
36 std::shared_ptr<framebuffer_device_t> const& fb_device,38 std::shared_ptr<framebuffer_device_t> const& fb_device,
37 std::shared_ptr<HWCVsyncCoordinator> const& coordinator)39 std::shared_ptr<HWCVsyncCoordinator> const& coordinator)
38 : HWCCommonDevice(hwc_device, coordinator),40 : HWCCommonDevice(hwc_device, coordinator),
41 hwc_wrapper(hwc_wrapper),
39 fb_device(fb_device),42 fb_device(fb_device),
40 layer_list{{},1}43 layer_list{{},1}
41{44{
@@ -44,41 +47,33 @@
4447
45void mga::HwcFbDevice::gpu_render()48void mga::HwcFbDevice::gpu_render()
46{49{
47 auto rc = 0; 50 if (auto display_list = layer_list.native_list().lock())
48 auto display_list = layer_list.native_list().lock();
49 if (display_list)
50 {51 {
51 display_list->dpy = eglGetCurrentDisplay();52 display_list->dpy = eglGetCurrentDisplay();
52 display_list->sur = eglGetCurrentSurface(EGL_DRAW);53 display_list->sur = eglGetCurrentSurface(EGL_DRAW);
5354
54 //set() may affect EGL state by calling eglSwapBuffers.55 //set() may affect EGL state by calling eglSwapBuffers.
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.
56 hwc_display_contents_1_t* displays[num_displays] {display_list.get()};57 hwc_wrapper->set(*display_list);
57 rc = hwc_device->set(hwc_device.get(), num_displays, displays);
58 }58 }
5959 else
60 if ((rc != 0) || (!display_list))
61 {60 {
62 std::stringstream ss;61 std::stringstream ss;
63 ss << "error during hwc set(). rc = " << std::hex << rc;62 ss << "error locking list during hwc set()";
64 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));63 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));
65 }64 }
66}65}
6766
68void mga::HwcFbDevice::prepare()67void mga::HwcFbDevice::prepare()
69{68{
70 auto rc = 0;69 if (auto display_list = layer_list.native_list().lock())
71 auto display_list = layer_list.native_list().lock();
72 if (display_list)
73 {70 {
74 hwc_display_contents_1_t* displays[num_displays] {display_list.get()};71 hwc_wrapper->prepare(*display_list);
75 rc = hwc_device->prepare(hwc_device.get(), num_displays, displays);
76 }72 }
7773 else
78 if ((rc != 0) || (!display_list))
79 {74 {
80 std::stringstream ss;75 std::stringstream ss;
81 ss << "error during hwc prepare(). rc = " << std::hex << rc;76 ss << "error accessing list during hwc prepare()";
82 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));77 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));
83 }78 }
84}79}
@@ -91,7 +86,7 @@
9186
92void mga::HwcFbDevice::render_gl_and_overlays(87void mga::HwcFbDevice::render_gl_and_overlays(
93 SwappingGLContext const&,88 SwappingGLContext const&,
94 std::list<std::shared_ptr<Renderable>> const& renderables,89 RenderableList const& renderables,
95 std::function<void(Renderable const&)> const& render_fn)90 std::function<void(Renderable const&)> const& render_fn)
96{91{
97 prepare();92 prepare();
9893
=== modified file 'src/platform/graphics/android/hwc_fb_device.h'
--- src/platform/graphics/android/hwc_fb_device.h 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/hwc_fb_device.h 2014-04-07 13:29:13 +0000
@@ -30,24 +30,28 @@
30{30{
31namespace android31namespace android
32{32{
33class HwcWrapper;
3334
34class HwcFbDevice : public HWCCommonDevice35class HwcFbDevice : public HWCCommonDevice
35{36{
36public:37public:
37 HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,38 HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device,
39 std::shared_ptr<HwcWrapper> const& hwc_wrapper,
38 std::shared_ptr<framebuffer_device_t> const& fb_device,40 std::shared_ptr<framebuffer_device_t> const& fb_device,
39 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);41 std::shared_ptr<HWCVsyncCoordinator> const& coordinator);
4042
41 virtual void render_gl(SwappingGLContext const& context);43 virtual void render_gl(SwappingGLContext const& context);
42 virtual void render_gl_and_overlays(44 virtual void render_gl_and_overlays(
43 SwappingGLContext const& context,45 SwappingGLContext const& context,
44 std::list<std::shared_ptr<Renderable>> const& list,46 RenderableList const& list,
45 std::function<void(Renderable const&)> const& render_fn);47 std::function<void(Renderable const&)> const& render_fn);
46 void post(Buffer const& buffer);48 void post(Buffer const& buffer);
4749
48private:50private:
49 void prepare();51 void prepare();
50 void gpu_render();52 void gpu_render();
53
54 std::shared_ptr<HwcWrapper> const hwc_wrapper;
51 std::shared_ptr<framebuffer_device_t> const fb_device;55 std::shared_ptr<framebuffer_device_t> const fb_device;
52 static int const num_displays{1};56 static int const num_displays{1};
53 LayerList layer_list;57 LayerList layer_list;
5458
=== added file 'src/platform/graphics/android/hwc_formatted_logger.cpp'
--- src/platform/graphics/android/hwc_formatted_logger.cpp 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/android/hwc_formatted_logger.cpp 2014-04-07 13:29:13 +0000
@@ -0,0 +1,177 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#include "hwc_formatted_logger.h"
20#include <iostream>
21#include <iomanip>
22
23namespace mga=mir::graphics::android;
24
25namespace
26{
27std::string const separator{" | "};
28int const layer_num_column_size{2};
29int const blending_column_size{8};
30int const rotation_column_size{9};
31int const rect_entry_column_size{4};
32int const type_column_size{9};
33
34class StreamFormatter
35{
36public:
37 StreamFormatter(std::ostream& str, unsigned int const width, std::ios_base::fmtflags flags)
38 : stream(str),
39 old_width(stream.width(width)),
40 old_flags(stream.setf(flags,std::ios::adjustfield))
41 {
42 }
43
44 ~StreamFormatter()
45 {
46 stream.setf(old_flags, std::ios::adjustfield);
47 stream.width(old_width);
48 }
49private:
50 std::ostream& stream;
51 unsigned int const old_width;
52 std::ios_base::fmtflags const old_flags;
53};
54
55struct LayerNumber{ unsigned int const num; };
56std::ostream& operator<<(std::ostream& str, LayerNumber l)
57{
58 StreamFormatter stream_format(str, layer_num_column_size, std::ios_base::right);
59 return str << l.num % 100;
60}
61
62struct HwcRotation{ unsigned int const key; };
63std::ostream& operator<<(std::ostream& str, HwcRotation rotation_key)
64{
65 StreamFormatter stream_format(str, rotation_column_size, std::ios_base::left);
66 switch(rotation_key.key)
67 {
68 case 0:
69 return str << std::string{"NONE"};
70 case HWC_TRANSFORM_ROT_90:
71 return str << std::string{"ROT_90"};
72 case HWC_TRANSFORM_ROT_180:
73 return str << std::string{"ROT_180"};
74 case HWC_TRANSFORM_ROT_270:
75 return str << std::string{"ROT_270"};
76 default:
77 return str << std::string{"UNKNOWN"};
78 }
79}
80
81struct HwcBlending{ int const key; };
82std::ostream& operator<<(std::ostream& str, HwcBlending blending_key)
83{
84 StreamFormatter stream_format(str, blending_column_size, std::ios_base::left);
85 switch(blending_key.key)
86 {
87 case HWC_BLENDING_NONE:
88 return str << std::string{"NONE"};
89 case HWC_BLENDING_PREMULT:
90 return str << std::string{"PREMULT"};
91 case HWC_BLENDING_COVERAGE:
92 return str << std::string{"COVERAGE"};
93 default:
94 return str << std::string{"UNKNOWN"};
95 }
96}
97
98struct HwcType{ int const type; unsigned int const flags; };
99std::ostream& operator<<(std::ostream& str, HwcType type)
100{
101 StreamFormatter stream_format(str, type_column_size, std::ios_base::left);
102 switch(type.type)
103 {
104 case HWC_OVERLAY:
105 return str << std::string{"OVERLAY"};
106 case HWC_FRAMEBUFFER:
107 if (type.flags == HWC_SKIP_LAYER)
108 return str << std::string{"FORCE_GL"};
109 else
110 return str << std::string{"GL_RENDER"};
111 case HWC_FRAMEBUFFER_TARGET:
112 return str << std::string{"FB_TARGET"};
113 default:
114 return str << std::string{"UNKNOWN"};
115 }
116}
117
118struct HwcRectMember { int member; };
119std::ostream& operator<<(std::ostream& str, HwcRectMember rect)
120{
121 StreamFormatter stream_format(str, rect_entry_column_size, std::ios_base::right);
122 return str << rect.member;
123}
124
125struct HwcRect { hwc_rect_t const& rect; };
126std::ostream& operator<<(std::ostream& str, HwcRect r)
127{
128 return str << "{"
129 << HwcRectMember{r.rect.left} << ","
130 << HwcRectMember{r.rect.top} << ","
131 << HwcRectMember{r.rect.right} << ","
132 << HwcRectMember{r.rect.bottom} << "}";
133}
134}
135
136void mga::HwcFormattedLogger::log_list_submitted_to_prepare(hwc_display_contents_1_t const& list) const
137{
138 std::cout << "before prepare():" << std::endl
139 << " # | pos {l,t,r,b} | crop {l,t,r,b} | transform | blending | "
140 << std::endl;
141 for(auto i = 0u; i < list.numHwLayers; i++)
142 std::cout << LayerNumber{i}
143 << separator
144 << HwcRect{list.hwLayers[i].displayFrame}
145 << separator
146 << HwcRect{list.hwLayers[i].sourceCrop}
147 << separator
148 << HwcRotation{list.hwLayers[i].transform}
149 << separator
150 << HwcBlending{list.hwLayers[i].blending}
151 << separator
152 << std::endl;
153}
154
155void mga::HwcFormattedLogger::log_prepare_done(hwc_display_contents_1_t const& list) const
156{
157 std::cout << "after prepare():" << std::endl
158 << " # | Type | " << std::endl;
159 for(auto i = 0u; i < list.numHwLayers; i++)
160 std::cout << LayerNumber{i}
161 << separator
162 << HwcType{list.hwLayers[i].compositionType,list.hwLayers[i].flags}
163 << separator
164 << std::endl;
165}
166
167void mga::HwcFormattedLogger::log_set_list(hwc_display_contents_1_t const& list) const
168{
169 std::cout << "set list():" << std::endl
170 << " # | handle" << std::endl;
171
172 for(auto i = 0u; i < list.numHwLayers; i++)
173 std::cout << LayerNumber{i}
174 << separator
175 << list.hwLayers[i].handle
176 << std::endl;
177}
0178
=== added file 'src/platform/graphics/android/hwc_formatted_logger.h'
--- src/platform/graphics/android/hwc_formatted_logger.h 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/android/hwc_formatted_logger.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,41 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_ANDROID_HWC_FORMATTED_LOGGER_H_
20#define MIR_GRAPHICS_ANDROID_HWC_FORMATTED_LOGGER_H_
21
22#include "hwc_logger.h"
23
24namespace mir
25{
26namespace graphics
27{
28namespace android
29{
30class HwcFormattedLogger : public HwcLogger
31{
32public:
33 HwcFormattedLogger() = default;
34 void log_list_submitted_to_prepare(hwc_display_contents_1_t const& list) const override;
35 void log_prepare_done(hwc_display_contents_1_t const& list) const override;
36 void log_set_list(hwc_display_contents_1_t const& list) const override;
37};
38}
39}
40}
41#endif /* MIR_GRAPHICS_ANDROID_HWC_FORMATTED_LOGGER_H_ */
042
=== modified file 'src/platform/graphics/android/hwc_layerlist.cpp'
--- src/platform/graphics/android/hwc_layerlist.cpp 2014-03-17 07:35:22 +0000
+++ src/platform/graphics/android/hwc_layerlist.cpp 2014-04-07 13:29:13 +0000
@@ -52,7 +52,7 @@
52}52}
5353
54bool mga::LayerList::update_list_and_check_if_changed(54bool mga::LayerList::update_list_and_check_if_changed(
55 std::list<std::shared_ptr<mg::Renderable>> const& renderlist,55 RenderableList const& renderlist,
56 size_t additional_layers)56 size_t additional_layers)
57{57{
58 size_t needed_size = renderlist.size() + additional_layers; 58 size_t needed_size = renderlist.size() + additional_layers;
@@ -70,7 +70,7 @@
70 {70 {
71 layers_it->set_render_parameters(71 layers_it->set_render_parameters(
72 renderable->screen_position(), renderable->alpha_enabled());72 renderable->screen_position(), renderable->alpha_enabled());
73 layers_it->set_buffer(*renderable->buffer(1));// TODO: remove needing to know about frameno73 layers_it->set_buffer(*renderable->buffer(this));
74 any_buffer_updated |= layers_it->needs_hwc_commit(); 74 any_buffer_updated |= layers_it->needs_hwc_commit();
75 layers_it++;75 layers_it++;
76 }76 }
@@ -88,7 +88,7 @@
88 renderable->screen_position(),88 renderable->screen_position(),
89 renderable->alpha_enabled(),89 renderable->alpha_enabled(),
90 hwc_representation, i++));90 hwc_representation, i++));
91 new_layers.back().set_buffer(*renderable->buffer(1));// TODO: remove needing to know about frameno91 new_layers.back().set_buffer(*renderable->buffer(this));
92 }92 }
9393
94 for(; i < needed_size; i++)94 for(; i < needed_size; i++)
@@ -137,7 +137,7 @@
137}137}
138138
139mga::LayerList::LayerList(139mga::LayerList::LayerList(
140 std::list<std::shared_ptr<mg::Renderable>> const& renderlist,140 RenderableList const& renderlist,
141 size_t additional_layers)141 size_t additional_layers)
142{142{
143 update_list_and_check_if_changed(renderlist, additional_layers);143 update_list_and_check_if_changed(renderlist, additional_layers);
144144
=== modified file 'src/platform/graphics/android/hwc_layerlist.h'
--- src/platform/graphics/android/hwc_layerlist.h 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/hwc_layerlist.h 2014-04-07 13:29:13 +0000
@@ -48,9 +48,9 @@
48class LayerList48class LayerList
49{49{
50public:50public:
51 LayerList(std::list<std::shared_ptr<Renderable>> const& renderlist, size_t additional_layers);51 LayerList(RenderableList const& renderlist, size_t additional_layers);
52 bool update_list_and_check_if_changed(52 bool update_list_and_check_if_changed(
53 std::list<std::shared_ptr<Renderable>> const& renderlist,53 RenderableList const& renderlist,
54 size_t additional_layers);54 size_t additional_layers);
5555
56 std::list<HWCLayer>::iterator begin();56 std::list<HWCLayer>::iterator begin();
5757
=== added file 'src/platform/graphics/android/hwc_logger.h'
--- src/platform/graphics/android/hwc_logger.h 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/android/hwc_logger.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_ANDROID_HWC_LOGGER_H_
20#define MIR_GRAPHICS_ANDROID_HWC_LOGGER_H_
21
22#include <hardware/hwcomposer.h>
23
24namespace mir
25{
26namespace graphics
27{
28namespace android
29{
30class HwcLogger
31{
32public:
33 virtual ~HwcLogger() = default;
34
35 virtual void log_list_submitted_to_prepare(hwc_display_contents_1_t const& list) const = 0;
36 virtual void log_prepare_done(hwc_display_contents_1_t const& list) const = 0;
37 virtual void log_set_list(hwc_display_contents_1_t const& list) const = 0;
38protected:
39 HwcLogger() = default;
40 HwcLogger& operator=(HwcLogger const&) = delete;
41 HwcLogger(HwcLogger const&) = delete;
42};
43}
44}
45}
46#endif /* MIR_GRAPHICS_ANDROID_HWC_LOGGER_H_ */
047
=== added file 'src/platform/graphics/android/hwc_wrapper.h'
--- src/platform/graphics/android/hwc_wrapper.h 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/android/hwc_wrapper.h 2014-04-07 13:29:13 +0000
@@ -0,0 +1,47 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_
20#define MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_
21
22#include <hardware/hwcomposer.h>
23
24namespace mir
25{
26namespace graphics
27{
28namespace android
29{
30class HwcWrapper
31{
32public:
33 virtual ~HwcWrapper() = default;
34
35 virtual void prepare(hwc_display_contents_1_t&) const = 0;
36 virtual void set(hwc_display_contents_1_t&) const = 0;
37
38protected:
39 HwcWrapper() = default;
40 HwcWrapper& operator=(HwcWrapper const&) = delete;
41 HwcWrapper(HwcWrapper const&) = delete;
42};
43}
44}
45}
46
47#endif /* MIR_GRAPHICS_ANDROID_HWC_WRAPPER_H_ */
048
=== modified file 'src/platform/graphics/android/real_hwc_wrapper.cpp'
--- src/platform/graphics/android/real_hwc_wrapper.cpp 2014-02-26 22:22:15 +0000
+++ src/platform/graphics/android/real_hwc_wrapper.cpp 2014-04-07 13:29:13 +0000
@@ -17,14 +17,18 @@
17 */17 */
1818
19#include "real_hwc_wrapper.h"19#include "real_hwc_wrapper.h"
20#include "hwc_logger.h"
20#include <boost/throw_exception.hpp>21#include <boost/throw_exception.hpp>
21#include <stdexcept>22#include <stdexcept>
22#include <sstream>23#include <sstream>
2324
24namespace mga=mir::graphics::android;25namespace mga=mir::graphics::android;
2526
26mga::RealHwcWrapper::RealHwcWrapper(std::shared_ptr<hwc_composer_device_1> const& hwc_device)27mga::RealHwcWrapper::RealHwcWrapper(
27 : hwc_device(hwc_device)28 std::shared_ptr<hwc_composer_device_1> const& hwc_device,
29 std::shared_ptr<mga::HwcLogger> const& logger)
30 : hwc_device(hwc_device),
31 logger(logger)
28{32{
29}33}
3034
@@ -33,17 +37,22 @@
33 //note, although we only have a primary display right now,37 //note, although we only have a primary display right now,
34 // set the external and virtual displays to null as some drivers check for that38 // set the external and virtual displays to null as some drivers check for that
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};
40
41 logger->log_list_submitted_to_prepare(display_list);
36 if (auto rc = hwc_device->prepare(hwc_device.get(), 1, displays))42 if (auto rc = hwc_device->prepare(hwc_device.get(), 1, displays))
37 {43 {
38 std::stringstream ss;44 std::stringstream ss;
39 ss << "error during hwc prepare(). rc = " << std::hex << rc;45 ss << "error during hwc prepare(). rc = " << std::hex << rc;
40 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));46 BOOST_THROW_EXCEPTION(std::runtime_error(ss.str()));
41 }47 }
48 logger->log_prepare_done(display_list);
42}49}
4350
44void mga::RealHwcWrapper::set(hwc_display_contents_1_t& display_list) const51void mga::RealHwcWrapper::set(hwc_display_contents_1_t& display_list) const
45{52{
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};
54
55 logger->log_set_list(display_list);
47 if (auto rc = hwc_device->set(hwc_device.get(), 1, displays))56 if (auto rc = hwc_device->set(hwc_device.get(), 1, displays))
48 {57 {
49 std::stringstream ss;58 std::stringstream ss;
5059
=== modified file 'src/platform/graphics/android/real_hwc_wrapper.h'
--- src/platform/graphics/android/real_hwc_wrapper.h 2014-02-20 22:20:34 +0000
+++ src/platform/graphics/android/real_hwc_wrapper.h 2014-04-07 13:29:13 +0000
@@ -19,7 +19,7 @@
19#ifndef MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_19#ifndef MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_
20#define MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_20#define MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_
2121
22#include "hwc_device.h"22#include "hwc_wrapper.h"
23#include <memory>23#include <memory>
24#include <hardware/hwcomposer.h>24#include <hardware/hwcomposer.h>
2525
@@ -29,17 +29,20 @@
29{29{
30namespace android30namespace android
31{31{
3232class HwcLogger;
33class RealHwcWrapper : public HwcWrapper33class RealHwcWrapper : public HwcWrapper
34{34{
35public:35public:
36 RealHwcWrapper(std::shared_ptr<hwc_composer_device_1> const& hwc_device);36 RealHwcWrapper(
37 std::shared_ptr<hwc_composer_device_1> const& hwc_device,
38 std::shared_ptr<HwcLogger> const& logger);
3739
38 void prepare(hwc_display_contents_1_t&) const override;40 void prepare(hwc_display_contents_1_t&) const override;
39 void set(hwc_display_contents_1_t&) const override;41 void set(hwc_display_contents_1_t&) const override;
40private:42private:
41 static size_t const num_displays{3}; //primary, external, virtual43 static size_t const num_displays{3}; //primary, external, virtual
42 std::shared_ptr<hwc_composer_device_1> const hwc_device;44 std::shared_ptr<hwc_composer_device_1> const hwc_device;
45 std::shared_ptr<HwcLogger> const logger;
43};46};
4447
45}48}
4649
=== modified file 'src/platform/graphics/android/resource_factory.cpp'
--- src/platform/graphics/android/resource_factory.cpp 2014-03-11 13:44:57 +0000
+++ src/platform/graphics/android/resource_factory.cpp 2014-04-07 13:29:13 +0000
@@ -31,6 +31,7 @@
31#include "hwc_vsync.h"31#include "hwc_vsync.h"
32#include "android_display.h"32#include "android_display.h"
33#include "real_hwc_wrapper.h"33#include "real_hwc_wrapper.h"
34#include "hwc_formatted_logger.h"
3435
35#include <boost/throw_exception.hpp>36#include <boost/throw_exception.hpp>
36#include <stdexcept>37#include <stdexcept>
@@ -39,6 +40,11 @@
39namespace mg = mir::graphics;40namespace mg = mir::graphics;
40namespace mga=mir::graphics::android;41namespace mga=mir::graphics::android;
4142
43mga::ResourceFactory::ResourceFactory(bool should_log_hwc)
44 : should_log_hwc{should_log_hwc}
45{
46}
47
42std::shared_ptr<framebuffer_device_t> mga::ResourceFactory::create_fb_native_device() const48std::shared_ptr<framebuffer_device_t> mga::ResourceFactory::create_fb_native_device() const
43{49{
44 hw_module_t const* module;50 hw_module_t const* module;
@@ -89,12 +95,37 @@
89 return std::make_shared<mga::FBDevice>(fb_native_device);95 return std::make_shared<mga::FBDevice>(fb_native_device);
90}96}
9197
98namespace
99{
100struct NullHwcLogger : public mga::HwcLogger
101{
102 void log_list_submitted_to_prepare(hwc_display_contents_1_t const&) const override
103 {
104 }
105 void log_prepare_done(hwc_display_contents_1_t const&) const override
106 {
107 }
108 void log_set_list(hwc_display_contents_1_t const&) const override
109 {
110 }
111};
112
113std::shared_ptr<mga::HwcLogger> make_logger(bool should_log)
114{
115 if (should_log)
116 return std::make_shared<mga::HwcFormattedLogger>();
117 else
118 return std::make_shared<NullHwcLogger>();
119}
120
121}
122
92std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_device(123std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_device(
93 std::shared_ptr<hwc_composer_device_1> const& hwc_native_device) const124 std::shared_ptr<hwc_composer_device_1> const& hwc_native_device) const
94{125{
95 auto syncer = std::make_shared<mga::HWCVsync>();126 auto syncer = std::make_shared<mga::HWCVsync>();
96 auto file_ops = std::make_shared<mga::RealSyncFileOps>();127 auto file_ops = std::make_shared<mga::RealSyncFileOps>();
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));
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);
99}130}
100131
@@ -103,5 +134,7 @@
103 std::shared_ptr<framebuffer_device_t> const& fb_native_device) const134 std::shared_ptr<framebuffer_device_t> const& fb_native_device) const
104{135{
105 auto syncer = std::make_shared<mga::HWCVsync>();136 auto syncer = std::make_shared<mga::HWCVsync>();
106 return std::make_shared<mga::HwcFbDevice>(hwc_native_device, fb_native_device, syncer);137 auto logger = std::make_shared<NullHwcLogger>();
138 auto wrapper = std::make_shared<mga::RealHwcWrapper>(hwc_native_device, make_logger(should_log_hwc));
139 return std::make_shared<mga::HwcFbDevice>(hwc_native_device, wrapper, fb_native_device, syncer);
107}140}
108141
=== modified file 'src/platform/graphics/android/resource_factory.h'
--- src/platform/graphics/android/resource_factory.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/android/resource_factory.h 2014-04-07 13:29:13 +0000
@@ -31,6 +31,8 @@
31class ResourceFactory : public DisplayResourceFactory31class ResourceFactory : public DisplayResourceFactory
32{32{
33public:33public:
34 ResourceFactory(bool should_log_hwc);
35
34 //native allocations36 //native allocations
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;
36 std::shared_ptr<framebuffer_device_t> create_fb_native_device() const;38 std::shared_ptr<framebuffer_device_t> create_fb_native_device() const;
@@ -46,6 +48,8 @@
4648
47 std::shared_ptr<ANativeWindow> create_native_window(49 std::shared_ptr<ANativeWindow> create_native_window(
48 std::shared_ptr<FramebufferBundle> const& fb_bundle) const;50 std::shared_ptr<FramebufferBundle> const& fb_bundle) const;
51private:
52 bool const should_log_hwc;
49};53};
5054
51}55}
5256
=== modified file 'src/platform/graphics/mesa/CMakeLists.txt'
--- src/platform/graphics/mesa/CMakeLists.txt 2014-03-10 03:02:32 +0000
+++ src/platform/graphics/mesa/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -47,6 +47,7 @@
47 mirplatformgraphicsmesa47 mirplatformgraphicsmesa
48 mirplatform48 mirplatform
4949
50 ${Boost_PROGRAM_OPTIONS_LIBRARY}
50 ${DRM_LDFLAGS} ${DRM_LIBRARIES}51 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
51 ${GBM_LDFLAGS} ${GBM_LIBRARIES}52 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
52 ${EGL_LDFLAGS} ${EGL_LIBRARIES}53 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
5354
=== modified file 'src/platform/graphics/mesa/display.cpp'
--- src/platform/graphics/mesa/display.cpp 2014-03-17 07:35:22 +0000
+++ src/platform/graphics/mesa/display.cpp 2014-04-07 13:29:13 +0000
@@ -54,7 +54,10 @@
54class GBMGLContext : public mg::GLContext54class GBMGLContext : public mg::GLContext
55{55{
56public:56public:
57 GBMGLContext(mgm::helpers::GBMHelper const& gbm, EGLContext shared_context)57 GBMGLContext(mgm::helpers::GBMHelper const& gbm,
58 mg::GLConfig const& gl_config,
59 EGLContext shared_context)
60 : egl{gl_config}
58 {61 {
59 egl.setup(gbm, shared_context);62 egl.setup(gbm, shared_context);
60 }63 }
@@ -77,13 +80,16 @@
7780
78mgm::Display::Display(std::shared_ptr<Platform> const& platform,81mgm::Display::Display(std::shared_ptr<Platform> const& platform,
79 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,82 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
83 std::shared_ptr<GLConfig> const& gl_config,
80 std::shared_ptr<DisplayReport> const& listener)84 std::shared_ptr<DisplayReport> const& listener)
81 : platform(platform),85 : platform(platform),
82 listener(listener),86 listener(listener),
83 monitor(mir::udev::Context()),87 monitor(mir::udev::Context()),
88 shared_egl{*gl_config},
84 output_container{platform->drm.fd,89 output_container{platform->drm.fd,
85 std::make_shared<KMSPageFlipper>(platform->drm.fd)},90 std::make_shared<KMSPageFlipper>(platform->drm.fd)},
86 current_display_configuration{platform->drm.fd}91 current_display_configuration{platform->drm.fd},
92 gl_config{gl_config}
87{93{
88 platform->vt->set_graphics_mode();94 platform->vt->set_graphics_mode();
8995
@@ -203,6 +209,7 @@
203 std::move(surface),209 std::move(surface),
204 bounding_rect,210 bounding_rect,
205 orientation,211 orientation,
212 *gl_config,
206 shared_egl.context()}};213 shared_egl.context()}};
207214
208 display_buffers_new.push_back(std::move(db));215 display_buffers_new.push_back(std::move(db));
@@ -320,7 +327,10 @@
320std::unique_ptr<mg::GLContext> mgm::Display::create_gl_context()327std::unique_ptr<mg::GLContext> mgm::Display::create_gl_context()
321{328{
322 return std::unique_ptr<GBMGLContext>{329 return std::unique_ptr<GBMGLContext>{
323 new GBMGLContext{platform->gbm, shared_egl.context()}};330 new GBMGLContext{
331 platform->gbm,
332 *gl_config,
333 shared_egl.context()}};
324}334}
325335
326void mgm::Display::clear_connected_unused_outputs()336void mgm::Display::clear_connected_unused_outputs()
327337
=== modified file 'src/platform/graphics/mesa/display.h'
--- src/platform/graphics/mesa/display.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/mesa/display.h 2014-04-07 13:29:13 +0000
@@ -41,6 +41,7 @@
41class DisplayBuffer;41class DisplayBuffer;
42class DisplayConfigurationPolicy;42class DisplayConfigurationPolicy;
43class EventHandlerRegister;43class EventHandlerRegister;
44class GLConfig;
4445
45namespace mesa46namespace mesa
46{47{
@@ -54,8 +55,9 @@
54{55{
55public:56public:
56 Display(std::shared_ptr<Platform> const& platform,57 Display(std::shared_ptr<Platform> const& platform,
57 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,58 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
58 std::shared_ptr<DisplayReport> const& listener);59 std::shared_ptr<GLConfig> const& gl_config,
60 std::shared_ptr<DisplayReport> const& listener);
59 ~Display();61 ~Display();
6062
61 geometry::Rectangle view_area() const;63 geometry::Rectangle view_area() const;
@@ -92,6 +94,7 @@
92 RealKMSOutputContainer output_container;94 RealKMSOutputContainer output_container;
93 mutable RealKMSDisplayConfiguration current_display_configuration;95 mutable RealKMSDisplayConfiguration current_display_configuration;
94 std::shared_ptr<Cursor> cursor;96 std::shared_ptr<Cursor> cursor;
97 std::shared_ptr<GLConfig> const gl_config;
95};98};
9699
97}100}
98101
=== modified file 'src/platform/graphics/mesa/display_buffer.cpp'
--- src/platform/graphics/mesa/display_buffer.cpp 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/mesa/display_buffer.cpp 2014-04-07 13:29:13 +0000
@@ -101,6 +101,7 @@
101 GBMSurfaceUPtr surface_gbm_param,101 GBMSurfaceUPtr surface_gbm_param,
102 geom::Rectangle const& area,102 geom::Rectangle const& area,
103 MirOrientation rot,103 MirOrientation rot,
104 GLConfig const& gl_config,
104 EGLContext shared_context)105 EGLContext shared_context)
105 : last_flipped_bufobj{nullptr},106 : last_flipped_bufobj{nullptr},
106 scheduled_bufobj{nullptr},107 scheduled_bufobj{nullptr},
@@ -109,6 +110,7 @@
109 drm(platform->drm),110 drm(platform->drm),
110 outputs(outputs),111 outputs(outputs),
111 surface_gbm{std::move(surface_gbm_param)},112 surface_gbm{std::move(surface_gbm_param)},
113 egl{gl_config},
112 area(area),114 area(area),
113 rotation(rot),115 rotation(rot),
114 needs_set_crtc{false},116 needs_set_crtc{false},
@@ -196,7 +198,7 @@
196}198}
197199
198void mgm::DisplayBuffer::render_and_post_update(200void mgm::DisplayBuffer::render_and_post_update(
199 std::list<std::shared_ptr<Renderable>> const&,201 RenderableList const&,
200 std::function<void(Renderable const&)> const&)202 std::function<void(Renderable const&)> const&)
201{203{
202 post_update(nullptr); 204 post_update(nullptr);
203205
=== modified file 'src/platform/graphics/mesa/display_buffer.h'
--- src/platform/graphics/mesa/display_buffer.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/mesa/display_buffer.h 2014-04-07 13:29:13 +0000
@@ -32,6 +32,7 @@
32{32{
3333
34class DisplayReport;34class DisplayReport;
35class GLConfig;
3536
36namespace mesa37namespace mesa
37{38{
@@ -49,6 +50,7 @@
49 GBMSurfaceUPtr surface_gbm,50 GBMSurfaceUPtr surface_gbm,
50 geometry::Rectangle const& area,51 geometry::Rectangle const& area,
51 MirOrientation rot,52 MirOrientation rot,
53 GLConfig const& gl_config,
52 EGLContext shared_context);54 EGLContext shared_context);
53 ~DisplayBuffer();55 ~DisplayBuffer();
5456
@@ -59,7 +61,7 @@
5961
60 bool can_bypass() const override;62 bool can_bypass() const override;
61 void post_update(std::shared_ptr<graphics::Buffer> bypass_buf) override;63 void post_update(std::shared_ptr<graphics::Buffer> bypass_buf) override;
62 void render_and_post_update(std::list<std::shared_ptr<Renderable>> const& renderlist,64 void render_and_post_update(RenderableList const& renderlist,
63 std::function<void(Renderable const&)> const& render_fn);65 std::function<void(Renderable const&)> const& render_fn);
64 MirOrientation orientation() const override;66 MirOrientation orientation() const override;
65 void schedule_set_crtc();67 void schedule_set_crtc();
6668
=== modified file 'src/platform/graphics/mesa/display_helpers.cpp'
--- src/platform/graphics/mesa/display_helpers.cpp 2014-03-12 02:46:58 +0000
+++ src/platform/graphics/mesa/display_helpers.cpp 2014-04-07 13:29:13 +0000
@@ -19,6 +19,7 @@
19#include "display_helpers.h"19#include "display_helpers.h"
20#include "drm_close_threadsafe.h"20#include "drm_close_threadsafe.h"
2121
22#include "mir/graphics/gl_config.h"
22#include "mir/udev/wrapper.h"23#include "mir/udev/wrapper.h"
2324
24#include <boost/exception/errinfo_errno.hpp>25#include <boost/exception/errinfo_errno.hpp>
@@ -219,7 +220,7 @@
219 sv.drm_dd_major = -1; /* Don't care */220 sv.drm_dd_major = -1; /* Don't care */
220 sv.drm_dd_minor = -1; /* Don't care */221 sv.drm_dd_minor = -1; /* Don't care */
221222
222 if ((error = drmSetInterfaceVersion(tmp_fd, &sv)))223 if ((error = -drmSetInterfaceVersion(tmp_fd, &sv)))
223 {224 {
224 close(tmp_fd);225 close(tmp_fd);
225 tmp_fd = -1;226 tmp_fd = -1;
@@ -238,7 +239,7 @@
238 {239 {
239 BOOST_THROW_EXCEPTION(240 BOOST_THROW_EXCEPTION(
240 boost::enable_error_info(241 boost::enable_error_info(
241 std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(-error));242 std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(error));
242 }243 }
243244
244 return tmp_fd;245 return tmp_fd;
@@ -295,6 +296,15 @@
295 * EGLHelper *296 * EGLHelper *
296 *************/297 *************/
297298
299mgmh::EGLHelper::EGLHelper(GLConfig const& gl_config)
300 : depth_buffer_bits{gl_config.depth_buffer_bits()},
301 stencil_buffer_bits{gl_config.stencil_buffer_bits()},
302 egl_display{EGL_NO_DISPLAY}, egl_config{0},
303 egl_context{EGL_NO_CONTEXT}, egl_surface{EGL_NO_SURFACE},
304 should_terminate_egl{false}
305{
306}
307
298void mgmh::EGLHelper::setup(GBMHelper const& gbm)308void mgmh::EGLHelper::setup(GBMHelper const& gbm)
299{309{
300 static const EGLint context_attr[] = {310 static const EGLint context_attr[] = {
@@ -378,12 +388,14 @@
378388
379void mgmh::EGLHelper::setup_internal(GBMHelper const& gbm, bool initialize)389void mgmh::EGLHelper::setup_internal(GBMHelper const& gbm, bool initialize)
380{390{
381 static const EGLint config_attr[] = {391 EGLint const config_attr[] = {
382 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,392 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
383 EGL_RED_SIZE, 8,393 EGL_RED_SIZE, 8,
384 EGL_GREEN_SIZE, 8,394 EGL_GREEN_SIZE, 8,
385 EGL_BLUE_SIZE, 8,395 EGL_BLUE_SIZE, 8,
386 EGL_ALPHA_SIZE, 0,396 EGL_ALPHA_SIZE, 0,
397 EGL_DEPTH_SIZE, depth_buffer_bits,
398 EGL_STENCIL_SIZE, stencil_buffer_bits,
387 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,399 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
388 EGL_NONE400 EGL_NONE
389 };401 };
390402
=== modified file 'src/platform/graphics/mesa/display_helpers.h'
--- src/platform/graphics/mesa/display_helpers.h 2014-03-12 02:46:58 +0000
+++ src/platform/graphics/mesa/display_helpers.h 2014-04-07 13:29:13 +0000
@@ -37,6 +37,8 @@
37{37{
38namespace graphics38namespace graphics
39{39{
40class GLConfig;
41
40namespace mesa42namespace mesa
41{43{
4244
@@ -92,11 +94,7 @@
92class EGLHelper94class EGLHelper
93{95{
94public:96public:
95 EGLHelper()97 EGLHelper(GLConfig const& gl_config);
96 : egl_display{EGL_NO_DISPLAY}, egl_config{0},
97 egl_context{EGL_NO_CONTEXT}, egl_surface{EGL_NO_SURFACE},
98 should_terminate_egl{false} {}
99
100 ~EGLHelper() noexcept;98 ~EGLHelper() noexcept;
10199
102 EGLHelper(const EGLHelper&) = delete;100 EGLHelper(const EGLHelper&) = delete;
@@ -117,6 +115,8 @@
117private:115private:
118 void setup_internal(GBMHelper const& gbm, bool initialize);116 void setup_internal(GBMHelper const& gbm, bool initialize);
119117
118 EGLint const depth_buffer_bits;
119 EGLint const stencil_buffer_bits;
120 EGLDisplay egl_display;120 EGLDisplay egl_display;
121 EGLConfig egl_config;121 EGLConfig egl_config;
122 EGLContext egl_context;122 EGLContext egl_context;
123123
=== modified file 'src/platform/graphics/mesa/platform.cpp'
--- src/platform/graphics/mesa/platform.cpp 2014-03-13 07:47:55 +0000
+++ src/platform/graphics/mesa/platform.cpp 2014-04-07 13:29:13 +0000
@@ -147,11 +147,13 @@
147}147}
148148
149std::shared_ptr<mg::Display> mgm::Platform::create_display(149std::shared_ptr<mg::Display> mgm::Platform::create_display(
150 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy)150 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
151 std::shared_ptr<GLConfig> const& gl_config)
151{152{
152 return std::make_shared<mgm::Display>(153 return std::make_shared<mgm::Display>(
153 this->shared_from_this(),154 this->shared_from_this(),
154 initial_conf_policy,155 initial_conf_policy,
156 gl_config,
155 listener);157 listener);
156}158}
157159
@@ -219,3 +221,11 @@
219 return (display == mgm::NativePlatform::internal_native_display().get());221 return (display == mgm::NativePlatform::internal_native_display().get());
220 return 0;222 return 0;
221}223}
224
225extern "C" void add_platform_options(boost::program_options::options_description& config)
226{
227 config.add_options()
228 ("vt",
229 boost::program_options::value<int>()->default_value(0),
230 "[platform-specific] VT to run on or 0 to use current.");
231}
222232
=== modified file 'src/platform/graphics/mesa/platform.h'
--- src/platform/graphics/mesa/platform.h 2014-03-06 06:05:17 +0000
+++ src/platform/graphics/mesa/platform.h 2014-04-07 13:29:13 +0000
@@ -47,7 +47,8 @@
47 std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(47 std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(
48 const std::shared_ptr<BufferInitializer>& buffer_initializer);48 const std::shared_ptr<BufferInitializer>& buffer_initializer);
49 std::shared_ptr<graphics::Display> create_display(49 std::shared_ptr<graphics::Display> create_display(
50 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy);50 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
51 std::shared_ptr<GLConfig> const& gl_config);
51 std::shared_ptr<PlatformIPCPackage> get_ipc_package();52 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
52 std::shared_ptr<InternalClient> create_internal_client();53 std::shared_ptr<InternalClient> create_internal_client();
5354
5455
=== modified file 'src/platform/options/default_configuration.cpp'
--- src/platform/options/default_configuration.cpp 2014-03-17 07:35:22 +0000
+++ src/platform/options/default_configuration.cpp 2014-04-07 13:29:13 +0000
@@ -16,7 +16,10 @@
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */17 */
1818
19#include "mir/shared_library.h"
20#include "mir/shared_library_loader.h"
19#include "mir/options/default_configuration.h"21#include "mir/options/default_configuration.h"
22#include "mir/graphics/platform.h"
20#include "mir/default_configuration.h"23#include "mir/default_configuration.h"
21#include "mir/abnormal_exit.h"24#include "mir/abnormal_exit.h"
2225
@@ -114,9 +117,35 @@
114 (name_opt, po::value<std::string>(),117 (name_opt, po::value<std::string>(),
115 "When nested, the name Mir uses when registering with the host.")118 "When nested, the name Mir uses when registering with the host.")
116 (offscreen_opt,119 (offscreen_opt,
117 "Render to offscreen buffers instead of the real outputs.")120 "Render to offscreen buffers instead of the real outputs.");
118 ("vt", po::value<int>()->default_value(0), // TODO this not applicable on all graphics platforms121
119 "VT to run on or 0 to use current.");122 add_platform_options();
123}
124
125void mo::DefaultConfiguration::add_platform_options()
126{
127 namespace po = boost::program_options;
128 po::options_description program_options;
129 program_options.add_options()
130 (platform_graphics_lib,
131 po::value<std::string>()->default_value(default_platform_graphics_lib), "");
132 mo::ProgramOption options;
133 options.parse_arguments(program_options, argc, argv);
134
135 std::string graphics_libname;
136 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");
137 if (!options.is_set(platform_graphics_lib) && env_libname)
138 {
139 graphics_libname = std::string{env_libname};
140 }
141 else
142 {
143 graphics_libname = options.get<std::string>(platform_graphics_lib);
144 }
145
146 auto graphics_lib = load_library(graphics_libname);
147 auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options"));
148 add_platform_options(*this->program_options);
120}149}
121150
122boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()151boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()
123152
=== added file 'src/platform/shared_library_loader.cpp'
--- src/platform/shared_library_loader.cpp 1970-01-01 00:00:00 +0000
+++ src/platform/shared_library_loader.cpp 2014-04-07 13:29:13 +0000
@@ -0,0 +1,38 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#include "mir/shared_library_loader.h"
20#include "mir/shared_library.h"
21#include <memory>
22#include <map>
23
24mir::SharedLibrary const* mir::load_library(std::string const& libname)
25{
26 // There's no point in loading twice, and it isn't safe to unload...
27 static std::map<std::string, std::shared_ptr<mir::SharedLibrary>> libraries_cache;
28
29 if (auto& ptr = libraries_cache[libname])
30 {
31 return ptr.get();
32 }
33 else
34 {
35 ptr = std::make_shared<mir::SharedLibrary>(libname);
36 return ptr.get();
37 }
38}
039
=== modified file 'src/server/CMakeLists.txt'
--- src/server/CMakeLists.txt 2014-03-12 06:41:13 +0000
+++ src/server/CMakeLists.txt 2014-04-07 13:29:13 +0000
@@ -94,7 +94,7 @@
94 )94 )
95endif()95endif()
9696
97set(MIRSERVER_ABI 17)97set(MIRSERVER_ABI 18)
9898
99set_target_properties(99set_target_properties(
100 mirserver100 mirserver
101101
=== modified file 'src/server/compositor/buffer_bundle.h'
--- src/server/compositor/buffer_bundle.h 2014-03-07 03:15:55 +0000
+++ src/server/compositor/buffer_bundle.h 2014-04-07 13:29:13 +0000
@@ -36,8 +36,20 @@
36 virtual ~BufferBundle() noexcept {}36 virtual ~BufferBundle() noexcept {}
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;
38 virtual void client_release(graphics::Buffer*) = 0;38 virtual void client_release(graphics::Buffer*) = 0;
39
40 /**
41 * Acquire the next buffer that's ready to display/composite.
42 *
43 * \param [in] user_id A unique identifier of who is going to use the
44 * buffer, to ensure that separate users representing
45 * separate monitors who need the same frame will get
46 * the same buffer. However consecutive calls for the
47 * same user will get different buffers. To avoid
48 * collisions, all callers should determine user_id
49 * in the same way (e.g. always use "this" pointer).
50 */
39 virtual std::shared_ptr<graphics::Buffer>51 virtual std::shared_ptr<graphics::Buffer>
40 compositor_acquire(unsigned long frameno) = 0;52 compositor_acquire(void const* user_id) = 0;
41 virtual void compositor_release(std::shared_ptr<graphics::Buffer> const&) = 0;53 virtual void compositor_release(std::shared_ptr<graphics::Buffer> const&) = 0;
42 virtual std::shared_ptr<graphics::Buffer> snapshot_acquire() = 0;54 virtual std::shared_ptr<graphics::Buffer> snapshot_acquire() = 0;
43 virtual void snapshot_release(std::shared_ptr<graphics::Buffer> const&) = 0;55 virtual void snapshot_release(std::shared_ptr<graphics::Buffer> const&) = 0;
4456
=== modified file 'src/server/compositor/buffer_stream_surfaces.cpp'
--- src/server/compositor/buffer_stream_surfaces.cpp 2014-03-07 03:15:55 +0000
+++ src/server/compositor/buffer_stream_surfaces.cpp 2014-04-07 13:29:13 +0000
@@ -38,10 +38,10 @@
38}38}
3939
40std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_compositor_buffer(40std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_compositor_buffer(
41 unsigned long frameno)41 void const* user_id)
42{42{
43 return std::make_shared<mc::TemporaryCompositorBuffer>(43 return std::make_shared<mc::TemporaryCompositorBuffer>(
44 buffer_bundle, frameno);44 buffer_bundle, user_id);
45}45}
4646
47std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_snapshot_buffer()47std::shared_ptr<mg::Buffer> mc::BufferStreamSurfaces::lock_snapshot_buffer()
4848
=== modified file 'src/server/compositor/buffer_stream_surfaces.h'
--- src/server/compositor/buffer_stream_surfaces.h 2014-03-07 03:15:55 +0000
+++ src/server/compositor/buffer_stream_surfaces.h 2014-04-07 13:29:13 +0000
@@ -42,7 +42,7 @@
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;
4343
44 std::shared_ptr<graphics::Buffer>44 std::shared_ptr<graphics::Buffer>
45 lock_compositor_buffer(unsigned long frameno) override;45 lock_compositor_buffer(void const* user_id) override;
46 std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override;46 std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() override;
4747
48 MirPixelFormat get_stream_pixel_format() override;48 MirPixelFormat get_stream_pixel_format() override;
4949
=== modified file 'src/server/compositor/bypass.cpp'
--- src/server/compositor/bypass.cpp 2014-03-17 07:35:22 +0000
+++ src/server/compositor/bypass.cpp 2014-04-07 13:29:13 +0000
@@ -44,9 +44,14 @@
4444
45 auto const& view_area = display_buffer.view_area();45 auto const& view_area = display_buffer.view_area();
4646
47 //TODO: remove this check, why are we getting a non visible renderable
48 // in the list of surfaces?
49 if (!renderable.visible())
50 return false;
51
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...
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.
49 if (!renderable.should_be_rendered_in(view_area))54 if (!view_area.contains(renderable.screen_position()))
50 return false;55 return false;
5156
52 topmost_fits = false;57 topmost_fits = false;
5358
=== modified file 'src/server/compositor/default_display_buffer_compositor.cpp'
--- src/server/compositor/default_display_buffer_compositor.cpp 2014-03-17 07:35:22 +0000
+++ src/server/compositor/default_display_buffer_compositor.cpp 2014-04-07 13:29:13 +0000
@@ -29,41 +29,35 @@
29#include "occlusion.h"29#include "occlusion.h"
30#include <mutex>30#include <mutex>
31#include <cstdlib>31#include <cstdlib>
32#include <vector>32#include <algorithm>
3333
34namespace mc = mir::compositor;34namespace mc = mir::compositor;
35namespace mg = mir::graphics;35namespace mg = mir::graphics;
3636
37//TODO remove VisibilityFilter once we don't need filters/operators for rendering
37namespace38namespace
38{39{
3940struct VisibilityFilter : public mc::FilterForScene
40struct FilterForVisibleSceneInRegion : public mc::FilterForScene
41{41{
42 FilterForVisibleSceneInRegion(42public:
43 mir::geometry::Rectangle const& enclosing_region,43 VisibilityFilter(
44 mc::OcclusionMatch const& occlusions)44 mg::RenderableList const& renderable_list)
45 : enclosing_region(enclosing_region),45 : list(renderable_list)
46 occlusions(occlusions)
47 {46 {
48 }47 }
48
49 bool operator()(mg::Renderable const& r)49 bool operator()(mg::Renderable const& r)
50 {50 {
51 return r.should_be_rendered_in(enclosing_region) &&51 auto matcher = [&r](std::shared_ptr<mg::Renderable> const& renderable)
52 !occlusions.occluded(r);52 {
53 return (renderable.get() == &r);
54 };
55 return (std::find_if(list.begin(), list.end(), matcher) != list.end());
53 }56 }
5457
55 mir::geometry::Rectangle const& enclosing_region;58private:
56 mc::OcclusionMatch const& occlusions;59 mg::RenderableList const& list;
57};60};
58
59std::mutex global_frameno_lock;
60unsigned long global_frameno = 0;
61
62bool wrapped_greater_or_equal(unsigned long a, unsigned long b)
63{
64 return (a - b) < (~0UL / 2UL);
65}
66
67}61}
6862
69mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor(63mc::DefaultDisplayBufferCompositor::DefaultDisplayBufferCompositor(
@@ -75,29 +69,14 @@
75 scene{scene},69 scene{scene},
76 renderer{renderer},70 renderer{renderer},
77 report{report},71 report{report},
78 local_frameno{global_frameno}72 last_pass_rendered_anything{false}
79{73{
80}74}
8175
82
83bool mc::DefaultDisplayBufferCompositor::composite()76bool mc::DefaultDisplayBufferCompositor::composite()
84{77{
85 report->began_frame(this);78 report->began_frame(this);
8679
87 /*
88 * Increment frame counts for each tick of the fastest instance of
89 * DefaultDisplayBufferCompositor. This means for the fastest refresh
90 * rate of all attached outputs.
91 */
92 local_frameno++;
93 {
94 std::lock_guard<std::mutex> lock(global_frameno_lock);
95 if (wrapped_greater_or_equal(local_frameno, global_frameno))
96 global_frameno = local_frameno;
97 else
98 local_frameno = global_frameno;
99 }
100
101 static bool const bypass_env{[]80 static bool const bypass_env{[]
102 {81 {
103 auto const env = getenv("MIR_BYPASS");82 auto const env = getenv("MIR_BYPASS");
@@ -123,8 +102,13 @@
123102
124 if (filter.fullscreen_on_top())103 if (filter.fullscreen_on_top())
125 {104 {
126 auto bypass_buf =105 /*
127 match.topmost_fullscreen()->buffer(local_frameno);106 * Notice the user_id we pass to buffer() here has to be
107 * different to the one used in the Renderer. This is in case
108 * the below if() fails we want to complete the frame using the
109 * same buffer (different user_id required).
110 */
111 auto bypass_buf = match.topmost_fullscreen()->buffer(this);
128112
129 if (bypass_buf->can_bypass())113 if (bypass_buf->can_bypass())
130 {114 {
@@ -140,41 +124,32 @@
140124
141 if (!bypassed)125 if (!bypassed)
142 {126 {
143 // preserves buffers used in rendering until after post_update()
144 std::vector<std::shared_ptr<void>> saved_resources;
145 auto save_resource = [&](std::shared_ptr<void> const& r)
146 {
147 saved_resources.push_back(r);
148 };
149
150 display_buffer.make_current();127 display_buffer.make_current();
151128
152 auto const& view_area = display_buffer.view_area();129 auto const& view_area = display_buffer.view_area();
130 auto renderable_list = scene->generate_renderable_list();
131 mc::filter_occlusions_from(renderable_list, view_area);
153132
154 mc::OcclusionFilter occlusion_search(view_area);133 for(auto const& renderable : renderable_list)
155 mc::OcclusionMatch occlusion_match;134 uncomposited_buffers |= (renderable->buffers_ready_for_compositor() > 1);
156 scene->reverse_for_each_if(occlusion_search, occlusion_match);
157135
158 renderer->set_rotation(display_buffer.orientation());136 renderer->set_rotation(display_buffer.orientation());
159 renderer->begin();137 renderer->begin();
160 mc::RenderingOperator applicator(*renderer, save_resource, local_frameno, uncomposited_buffers);138 mc::RenderingOperator applicator(*renderer);
161 FilterForVisibleSceneInRegion selector(view_area, occlusion_match);139 VisibilityFilter selector(renderable_list);
162 scene->for_each_if(selector, applicator);140 scene->for_each_if(selector, applicator);
163 renderer->end();141 renderer->end();
164142
165 display_buffer.post_update();143 display_buffer.post_update();
166144
167 // This is a frig to avoid lp:1286190145 // This is a frig to avoid lp:1286190
168 if (size_of_last_pass)146 if (last_pass_rendered_anything && renderable_list.empty())
169 {147 uncomposited_buffers = true;
170 uncomposited_buffers |= saved_resources.empty();
171 }
172148
173 size_of_last_pass = saved_resources.size();149 last_pass_rendered_anything = !renderable_list.empty();
174 // End of frig150 // End of frig
175 }151 }
176152
177 report->finished_frame(bypassed, this);153 report->finished_frame(bypassed, this);
178 return uncomposited_buffers;154 return uncomposited_buffers;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches