Merge lp:~mir-team/mir/trunk-0.1.7 into lp:mir/0.1
- trunk-0.1.7
- Merge into trusty
Status: | Merged |
---|---|
Merged at revision: | 1179 |
Proposed branch: | lp:~mir-team/mir/trunk-0.1.7 |
Merge into: | lp:mir/0.1 |
Diff against target: |
12893 lines (+4671/-2634) 200 files modified
3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp (+8/-0) CMakeLists.txt (+1/-1) debian/changelog (+56/-0) debian/control (+2/-2) debian/libmirserver17.install (+1/-1) debian/rules (+5/-3) examples/CMakeLists.txt (+0/-1) examples/demo-shell/CMakeLists.txt (+1/-0) examples/demo-shell/demo_renderer.cpp (+33/-0) examples/demo-shell/demo_renderer.h (+39/-0) examples/demo-shell/demo_shell.cpp (+21/-2) examples/demo-shell/window_manager.cpp (+10/-24) examples/eglplasma.c (+9/-7) examples/image_renderer.cpp (+1/-0) examples/pixel_format_selector.cpp (+2/-7) examples/render_overlays.cpp (+92/-21) examples/render_surfaces.cpp (+32/-5) examples/scroll.cpp (+62/-41) examples/server_configuration.cpp (+15/-26) include/platform/mir/graphics/display_configuration.h (+27/-7) include/platform/mir/graphics/overlapping_output_grouping.h (+3/-7) include/platform/mir/graphics/renderable.h (+39/-1) include/platform/mir/options/configuration.h (+0/-1) include/server/mir/compositor/buffer_stream.h (+2/-1) include/server/mir/compositor/compositing_criteria.h (+0/-52) include/server/mir/compositor/display_buffer_compositor.h (+4/-2) include/server/mir/compositor/gl_renderer.h (+32/-6) include/server/mir/compositor/renderer.h (+6/-2) include/server/mir/compositor/scene.h (+3/-4) include/server/mir/frontend/screencast.h (+3/-1) include/server/mir/shell/session.h (+0/-1) include/shared/mir_toolkit/client_types.h (+23/-3) include/shared/testdraw/draw_pattern_checkered-inl.h (+3/-3) include/shared/testdraw/graphics_region_factory.h (+4/-4) include/shared/testdraw/patterns.h (+3/-3) include/test/mir_test_doubles/fake_renderable.h (+39/-17) include/test/mir_test_doubles/mock_android_native_buffer.h (+9/-0) include/test/mir_test_doubles/mock_buffer_bundle.h (+1/-0) include/test/mir_test_doubles/mock_buffer_stream.h (+1/-0) include/test/mir_test_doubles/mock_compositing_criteria.h (+0/-45) include/test/mir_test_doubles/mock_display_device.h (+6/-3) include/test/mir_test_doubles/mock_gl.h (+3/-2) include/test/mir_test_doubles/mock_render_function.h (+40/-0) include/test/mir_test_doubles/mock_render_function.h.moved (+40/-0) include/test/mir_test_doubles/mock_renderable.h (+14/-1) include/test/mir_test_doubles/mock_renderer.h (+2/-2) include/test/mir_test_doubles/mock_scene.h (+48/-0) include/test/mir_test_doubles/mock_screencast.h (+4/-2) include/test/mir_test_doubles/mock_swapping_gl_context.h (+39/-0) include/test/mir_test_doubles/null_display_configuration.h (+1/-1) include/test/mir_test_doubles/null_screencast.h (+3/-1) include/test/mir_test_doubles/stub_buffer.h (+16/-4) include/test/mir_test_doubles/stub_buffer_stream.h (+2/-0) include/test/mir_test_doubles/stub_display_configuration.h (+6/-1) include/test/mir_test_doubles/stub_display_device.h (+5/-2) include/test/mir_test_doubles/stub_renderable.h (+27/-2) include/test/mir_test_doubles/stub_renderer.h (+2/-2) include/test/mir_test_doubles/stub_swapping_gl_context.h (+39/-0) src/client/CMakeLists.txt (+1/-0) src/client/android/CMakeLists.txt (+9/-2) src/client/mesa/CMakeLists.txt (+9/-2) src/client/mir_screencast.cpp (+20/-23) src/client/mir_screencast.h (+4/-2) src/client/mir_screencast_api.cpp (+9/-19) src/client/mir_surface.h (+0/-2) src/platform/graphics/CMakeLists.txt (+1/-0) src/platform/graphics/android/CMakeLists.txt (+10/-2) src/platform/graphics/android/android_display.cpp (+8/-0) src/platform/graphics/android/android_display_configuration.cpp (+4/-5) src/platform/graphics/android/android_display_configuration.h (+1/-4) src/platform/graphics/android/display_buffer.cpp (+10/-16) src/platform/graphics/android/display_buffer.h (+1/-1) src/platform/graphics/android/display_device.h (+6/-3) src/platform/graphics/android/fb_device.cpp (+15/-14) src/platform/graphics/android/fb_device.h (+5/-3) src/platform/graphics/android/gl_context.cpp (+12/-0) src/platform/graphics/android/gl_context.h (+15/-12) src/platform/graphics/android/hwc_device.cpp (+96/-57) src/platform/graphics/android/hwc_device.h (+27/-5) src/platform/graphics/android/hwc_fb_device.cpp (+50/-30) src/platform/graphics/android/hwc_fb_device.h (+7/-3) src/platform/graphics/android/hwc_layerlist.cpp (+84/-90) src/platform/graphics/android/hwc_layerlist.h (+21/-30) src/platform/graphics/android/hwc_layers.cpp (+41/-11) src/platform/graphics/android/hwc_layers.h (+7/-4) src/platform/graphics/android/real_hwc_wrapper.cpp (+53/-0) src/platform/graphics/android/real_hwc_wrapper.h (+48/-0) src/platform/graphics/android/resource_factory.cpp (+3/-1) src/platform/graphics/display_configuration.cpp (+50/-0) src/platform/graphics/mesa/CMakeLists.txt (+9/-3) src/platform/graphics/mesa/cursor.cpp (+26/-15) src/platform/graphics/mesa/cursor.h (+2/-1) src/platform/graphics/mesa/display.cpp (+7/-1) src/platform/graphics/mesa/linux_virtual_terminal.cpp (+6/-5) src/platform/graphics/mesa/linux_virtual_terminal.h (+21/-0) src/platform/graphics/mesa/native_platform.cpp (+48/-1) src/platform/graphics/mesa/native_platform.h (+10/-0) src/platform/graphics/mesa/platform.cpp (+39/-2) src/platform/graphics/mesa/real_kms_display_configuration.cpp (+6/-34) src/platform/graphics/mesa/real_kms_display_configuration.h (+1/-4) src/platform/graphics/overlapping_output_grouping.cpp (+7/-8) src/platform/options/default_configuration.cpp (+2/-5) src/server/CMakeLists.txt (+1/-1) src/server/compositor/buffer_bundle.h (+1/-0) src/server/compositor/buffer_stream_surfaces.cpp (+5/-0) src/server/compositor/buffer_stream_surfaces.h (+1/-0) src/server/compositor/bypass.cpp (+13/-52) src/server/compositor/bypass.h (+5/-9) src/server/compositor/compositing_screencast.cpp (+14/-37) src/server/compositor/compositing_screencast.h (+6/-4) src/server/compositor/default_configuration.cpp (+7/-4) src/server/compositor/default_display_buffer_compositor.cpp (+25/-8) src/server/compositor/default_display_buffer_compositor.h (+2/-1) src/server/compositor/default_display_buffer_compositor_factory.cpp (+2/-2) src/server/compositor/gl_renderer.cpp (+45/-57) src/server/compositor/gl_renderer_factory.cpp (+1/-1) src/server/compositor/gl_renderer_factory.h (+1/-1) src/server/compositor/multi_threaded_compositor.cpp (+42/-25) src/server/compositor/multi_threaded_compositor.h (+5/-3) src/server/compositor/occlusion.cpp (+12/-32) src/server/compositor/occlusion.h (+4/-6) src/server/compositor/rendering_operator.cpp (+9/-5) src/server/compositor/rendering_operator.h (+5/-3) src/server/compositor/screencast_display_buffer.cpp (+3/-2) src/server/compositor/switching_bundle.cpp (+32/-19) src/server/compositor/switching_bundle.h (+2/-0) src/server/frontend/session_mediator.cpp (+31/-20) src/server/graphics/default_configuration.cpp (+28/-31) src/server/graphics/default_display_configuration_policy.cpp (+9/-10) src/server/graphics/nested/nested_display.cpp (+43/-34) src/server/graphics/nested/nested_display_configuration.cpp (+59/-39) src/server/graphics/nested/nested_display_configuration.h (+1/-5) src/server/graphics/offscreen/display.cpp (+6/-0) src/server/graphics/offscreen/display_configuration.cpp (+5/-3) src/server/graphics/offscreen/display_configuration.h (+1/-5) src/server/input/default_configuration.cpp (+2/-2) src/server/input/nested_input_relay.cpp (+34/-55) src/server/scene/basic_surface.cpp (+26/-41) src/server/scene/basic_surface.h (+9/-6) src/server/scene/mediating_display_changer.cpp (+2/-7) src/server/scene/surface_stack.cpp (+9/-11) src/shared/CMakeLists.txt (+1/-0) src/shared/protobuf/mir_protobuf.proto (+9/-1) src/shared/testdraw/CMakeLists.txt (+2/-0) src/shared/testdraw/android_graphics_region_factory.cpp (+6/-5) src/shared/testdraw/mesa_graphics_region_factory.cpp (+5/-5) src/shared/testdraw/patterns.cpp (+4/-4) src/utils/screencast.cpp (+161/-76) tests/CMakeLists.txt (+0/-1) tests/acceptance-tests/test_client_input.cpp (+38/-0) tests/acceptance-tests/test_client_screencast.cpp (+72/-39) tests/acceptance-tests/test_server_shutdown.cpp (+2/-2) tests/acceptance-tests/test_surfaces_with_output_id.cpp (+4/-10) tests/integration-tests/client/test_client_render.cpp (+2/-2) tests/integration-tests/client/test_screencast.cpp (+5/-1) tests/integration-tests/graphics/android/test_buffer_integration.cpp (+2/-2) tests/integration-tests/input/CMakeLists.txt (+1/-0) tests/integration-tests/input/test_nested_input.cpp (+124/-0) tests/integration-tests/test_session.cpp (+2/-2) tests/integration-tests/test_surface_first_frame_sync.cpp (+3/-3) tests/integration-tests/test_swapinterval.cpp (+2/-1) tests/mir_test/display_config_matchers.cpp (+6/-3) tests/mir_test_doubles/mock_gl.cpp (+6/-0) tests/mir_test_framework/stubbed_server_configuration.cpp (+2/-2) tests/unit-tests/client/test_mir_screencast.cpp (+91/-79) tests/unit-tests/compositor/test_bypass.cpp (+55/-59) tests/unit-tests/compositor/test_compositing_screencast.cpp (+31/-20) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+91/-81) tests/unit-tests/compositor/test_gl_renderer.cpp (+31/-37) tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+85/-33) tests/unit-tests/compositor/test_occlusion.cpp (+24/-27) tests/unit-tests/compositor/test_rendering_operator.cpp (+13/-13) tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+17/-0) tests/unit-tests/draw/test_draw_patterns.cpp (+1/-1) tests/unit-tests/frontend/test_session_mediator.cpp (+1/-9) tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/android/hwc_struct_helpers.h (+16/-3) tests/unit-tests/graphics/android/test_android_fb.cpp (+21/-29) tests/unit-tests/graphics/android/test_fb_device.cpp (+25/-16) tests/unit-tests/graphics/android/test_hwc_common_device.cpp (+18/-1) tests/unit-tests/graphics/android/test_hwc_device.cpp (+528/-117) tests/unit-tests/graphics/android/test_hwc_display.cpp (+5/-23) tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+88/-51) tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+36/-196) tests/unit-tests/graphics/android/test_hwc_layers.cpp (+122/-85) tests/unit-tests/graphics/android/test_hwc_wrapper.cpp (+119/-0) tests/unit-tests/graphics/mesa/test_cursor.cpp (+93/-5) tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+27/-37) tests/unit-tests/graphics/mesa/test_linux_virtual_terminal.cpp (+175/-11) tests/unit-tests/graphics/mesa/test_native_platform.cpp (+60/-0) tests/unit-tests/graphics/mesa/test_overlapping_output_grouping.cpp (+4/-7) tests/unit-tests/graphics/nested/test_nested_display_configuration.cpp (+20/-68) tests/unit-tests/graphics/test_default_display_configuration_policy.cpp (+42/-38) tests/unit-tests/graphics/test_display.cpp (+34/-0) tests/unit-tests/graphics/test_display_configuration.cpp (+41/-0) tests/unit-tests/scene/test_basic_surface.cpp (+2/-28) tests/unit-tests/scene/test_surface.cpp (+0/-1) tests/unit-tests/scene/test_surface_stack.cpp (+83/-113) tests/unit-tests/test_udev_wrapper.cpp (+3/-1) tools/install_on_android.sh (+1/-1) |
To merge this branch: | bzr merge lp:~mir-team/mir/trunk-0.1.7 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Mir development team | Pending | ||
Review via email: mp+211132@code.launchpad.net |
Commit message
Merge latest upstream release 0.1.7 (development-branch r1473)
Description of the change
kevin gunn (kgunn72) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1475
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) wrote : | # |
Verified the diff to release 0.1.7 is now only debian/changelog. And the conflicts no longer reappear when merging between distro/development.
kevin gunn (kgunn72) wrote : | # |
daniel - in the future, if you update the branch especially with updates from devel, make sure to disable the arm integration tests, as those tests will fail on the silo builders
Preview Diff
1 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp' | |||
2 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2014-01-22 10:03:11 +0000 | |||
3 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2014-03-17 15:02:33 +0000 | |||
4 | @@ -432,6 +432,7 @@ | |||
5 | 432 | sp<InputWindowHandle> InputDispatcher::findTouchedWindowAtLocked(int32_t x, int32_t y) { | 432 | sp<InputWindowHandle> InputDispatcher::findTouchedWindowAtLocked(int32_t x, int32_t y) { |
6 | 433 | sp<InputWindowHandle> foundHandle = NULL; | 433 | sp<InputWindowHandle> foundHandle = NULL; |
7 | 434 | mEnumerator->for_each([&](sp<InputWindowHandle> windowHandle) { | 434 | mEnumerator->for_each([&](sp<InputWindowHandle> windowHandle) { |
8 | 435 | windowHandle->updateInfo(); | ||
9 | 435 | const InputWindowInfo* windowInfo = windowHandle->getInfo(); | 436 | const InputWindowInfo* windowInfo = windowHandle->getInfo(); |
10 | 436 | int32_t flags = windowInfo->layoutParamsFlags; | 437 | int32_t flags = windowInfo->layoutParamsFlags; |
11 | 437 | 438 | ||
12 | @@ -1151,6 +1152,7 @@ | |||
13 | 1151 | 1152 | ||
14 | 1152 | // Traverse windows from front to back to find touched window and outside targets. | 1153 | // Traverse windows from front to back to find touched window and outside targets. |
15 | 1153 | mEnumerator->for_each([&](sp<InputWindowHandle> const& windowHandle){ | 1154 | mEnumerator->for_each([&](sp<InputWindowHandle> const& windowHandle){ |
16 | 1155 | windowHandle->updateInfo(); | ||
17 | 1154 | const InputWindowInfo* windowInfo = windowHandle->getInfo(); | 1156 | const InputWindowInfo* windowInfo = windowHandle->getInfo(); |
18 | 1155 | int32_t flags = windowInfo->layoutParamsFlags; | 1157 | int32_t flags = windowInfo->layoutParamsFlags; |
19 | 1156 | 1158 | ||
20 | @@ -2742,6 +2744,12 @@ | |||
21 | 2742 | c_str(newFocusedWindowHandle->getName())); | 2744 | c_str(newFocusedWindowHandle->getName())); |
22 | 2743 | #endif | 2745 | #endif |
23 | 2744 | } | 2746 | } |
24 | 2747 | |||
25 | 2748 | if (mInputTargetWaitCause != INPUT_TARGET_WAIT_CAUSE_NONE) { | ||
26 | 2749 | releasePendingEventLocked(); | ||
27 | 2750 | drainInboundQueueLocked(); | ||
28 | 2751 | } | ||
29 | 2752 | |||
30 | 2745 | mFocusedWindowHandle = newFocusedWindowHandle; | 2753 | mFocusedWindowHandle = newFocusedWindowHandle; |
31 | 2746 | } | 2754 | } |
32 | 2747 | } | 2755 | } |
33 | 2748 | 2756 | ||
34 | === modified file 'CMakeLists.txt' | |||
35 | --- CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
36 | +++ CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
37 | @@ -28,7 +28,7 @@ | |||
38 | 28 | 28 | ||
39 | 29 | set(MIR_VERSION_MAJOR 0) | 29 | set(MIR_VERSION_MAJOR 0) |
40 | 30 | set(MIR_VERSION_MINOR 1) | 30 | set(MIR_VERSION_MINOR 1) |
42 | 31 | set(MIR_VERSION_PATCH 6) | 31 | set(MIR_VERSION_PATCH 7) |
43 | 32 | 32 | ||
44 | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
45 | 34 | execute_process( | 34 | execute_process( |
46 | 35 | 35 | ||
47 | === modified file 'debian/changelog' | |||
48 | --- debian/changelog 2014-03-10 19:28:46 +0000 | |||
49 | +++ debian/changelog 2014-03-17 15:02:33 +0000 | |||
50 | @@ -1,3 +1,59 @@ | |||
51 | 1 | mir (0.1.7-0ubuntu1) UNRELEASED; urgency=medium | ||
52 | 2 | |||
53 | 3 | * New upstream release 0.1.7 (https://launchpad.net/mir/+milestone/0.1.7) | ||
54 | 4 | - mirserver ABI bumped to 17 | ||
55 | 5 | - mirclient ABI unchanged, still at 7. Clients do not need rebuilding. | ||
56 | 6 | - Server API changes (AKA why doesn't my code build any more?): | ||
57 | 7 | . Class "CompositingCriteria" has been removed. It's replaced by the more | ||
58 | 8 | flexible "Renderable" interface. This also resulted in parameter | ||
59 | 9 | changes for the Renderer and scene filtering classes. | ||
60 | 10 | . The function "DisplayConfiguration::configure_output()" has been | ||
61 | 11 | removed. Instead, please use the new mutable version of | ||
62 | 12 | "DisplayConfiguration::for_each_output()" with which you can modify | ||
63 | 13 | the output structure passed in on each iteration. | ||
64 | 14 | . Exposed formerly private class "GLRenderer" and demonstrated how | ||
65 | 15 | to override its behaviour in demo-shell. This area is under | ||
66 | 16 | construction and may experience further major changes. | ||
67 | 17 | - Added initial support for hardware (HWC) overlays to accelerate | ||
68 | 18 | rendering and reduce power consumption. Not complete yet. | ||
69 | 19 | - Screen rotation: Added mouse cursor rotation support, so you can now | ||
70 | 20 | still control things on a rotated screen. Still missing rotation of | ||
71 | 21 | the cursor bitmap itself. | ||
72 | 22 | - Lots of fixes to support nested Mir servers (see below). | ||
73 | 23 | - Major simplification to how surface size/position/transformation | ||
74 | 24 | interact, making transformations much easier to manage and work with. | ||
75 | 25 | - Bugs fixed: | ||
76 | 26 | . ./cross-compile-chroot.sh: line 83: popd: build-android-arm: invalid | ||
77 | 27 | argument popd: usage: popd [-n] [+N | -N] (LP: #1287600) | ||
78 | 28 | . Key events sent to the wrong client (and delayed) (LP: #1213804) | ||
79 | 29 | . Nested servers never receive input events (in their filters) | ||
80 | 30 | (LP: #1260612) | ||
81 | 31 | . Software clients crash immediately on nested servers - what(): Failed | ||
82 | 32 | to mmap buffer (LP: #1261286) | ||
83 | 33 | . MirMotionEvent lacks local coordinates. Reports only screen | ||
84 | 34 | coordinates. (LP: #1268819) | ||
85 | 35 | . Nested Mir crashes with - what(): | ||
86 | 36 | MesaNativePlatform::create_internal_client is not implemented yet! | ||
87 | 37 | (LP: #1279092) | ||
88 | 38 | . clients fail to find some libraries if mir installed via "make install" | ||
89 | 39 | (LP: #1285566) | ||
90 | 40 | . Nested server hangs with multimonitor and internal clients. | ||
91 | 41 | (LP: #1287282) | ||
92 | 42 | . [regression] Multi-monitor frame sync no longer works (not | ||
93 | 43 | synchronized), and frames skip/jump/stutter (LP: #1288570) | ||
94 | 44 | . Mir FTBFS: /usr/bin/ld: cannot find -lmirtestdraw (when cmake .. | ||
95 | 45 | -DMIR_ENABLE_TESTS=OFF) (LP: #1283951) | ||
96 | 46 | . nested Mir library calls next_buffer() during startup (LP: #1284739) | ||
97 | 47 | . Building Mir produces lots of warnings from GLM headers about | ||
98 | 48 | deprecated degrees values vs radians (LP: #1286010) | ||
99 | 49 | . [enhancement] screencast of a single window (LP: #1288478) | ||
100 | 50 | . Nexus4 + mir_demo_client_eglplasma starts to stutter after a while | ||
101 | 51 | (LP: #1189753) | ||
102 | 52 | . --host-socket documented default argument isn't used as default | ||
103 | 53 | (LP: #1262091) | ||
104 | 54 | |||
105 | 55 | -- Daniel van Vugt <daniel.van.vugt@canonical.com> Wed, 12 Mar 2014 11:05:20 +0800 | ||
106 | 56 | |||
107 | 1 | mir (0.1.6+14.04.20140310-0ubuntu1) trusty; urgency=medium | 57 | mir (0.1.6+14.04.20140310-0ubuntu1) trusty; urgency=medium |
108 | 2 | 58 | ||
109 | 3 | [ Kevin Gunn ] | 59 | [ Kevin Gunn ] |
110 | 4 | 60 | ||
111 | === modified file 'debian/control' | |||
112 | --- debian/control 2014-03-06 14:18:50 +0000 | |||
113 | +++ debian/control 2014-03-17 15:02:33 +0000 | |||
114 | @@ -70,7 +70,7 @@ | |||
115 | 70 | . | 70 | . |
116 | 71 | Contains the protocol's definition files. | 71 | Contains the protocol's definition files. |
117 | 72 | 72 | ||
119 | 73 | Package: libmirserver16 | 73 | Package: libmirserver17 |
120 | 74 | Section: libs | 74 | Section: libs |
121 | 75 | Architecture: i386 amd64 armhf arm64 | 75 | Architecture: i386 amd64 armhf arm64 |
122 | 76 | Multi-Arch: same | 76 | Multi-Arch: same |
123 | @@ -148,7 +148,7 @@ | |||
124 | 148 | Architecture: i386 amd64 armhf arm64 | 148 | Architecture: i386 amd64 armhf arm64 |
125 | 149 | Multi-Arch: same | 149 | Multi-Arch: same |
126 | 150 | Pre-Depends: ${misc:Pre-Depends} | 150 | Pre-Depends: ${misc:Pre-Depends} |
128 | 151 | Depends: libmirserver16 (= ${binary:Version}), | 151 | Depends: libmirserver17 (= ${binary:Version}), |
129 | 152 | libmirprotobuf-dev (= ${binary:Version}), | 152 | libmirprotobuf-dev (= ${binary:Version}), |
130 | 153 | mircommon-dev (= ${binary:Version}), | 153 | mircommon-dev (= ${binary:Version}), |
131 | 154 | libglm-dev, | 154 | libglm-dev, |
132 | 155 | 155 | ||
133 | === renamed file 'debian/libmirserver16.install' => 'debian/libmirserver17.install' | |||
134 | --- debian/libmirserver16.install 2014-02-21 03:57:16 +0000 | |||
135 | +++ debian/libmirserver17.install 2014-03-17 15:02:33 +0000 | |||
136 | @@ -1,1 +1,1 @@ | |||
138 | 1 | usr/lib/*/libmirserver.so.16 | 1 | usr/lib/*/libmirserver.so.17 |
139 | 2 | 2 | ||
140 | === modified file 'debian/rules' | |||
141 | --- debian/rules 2014-03-06 14:18:50 +0000 | |||
142 | +++ debian/rules 2014-03-17 15:02:33 +0000 | |||
143 | @@ -22,8 +22,8 @@ | |||
144 | 22 | dh_auto_configure -- \ | 22 | dh_auto_configure -- \ |
145 | 23 | $(COMMON_CONFIGURE_OPTIONS) \ | 23 | $(COMMON_CONFIGURE_OPTIONS) \ |
146 | 24 | -DMIR_RUN_ACCEPTANCE_TESTS=OFF \ | 24 | -DMIR_RUN_ACCEPTANCE_TESTS=OFF \ |
149 | 25 | -DMIR_RUN_INTEGRATION_TESTS=OFF \ | 25 | -DMIR_RUN_INTEGRATION_TESTS=OFF \ |
150 | 26 | -DMIR_PLATFORM=android\;mesa | 26 | -DMIR_PLATFORM=android\;mesa |
151 | 27 | else | 27 | else |
152 | 28 | ifeq ($(DEB_HOST_ARCH),arm64) | 28 | ifeq ($(DEB_HOST_ARCH),arm64) |
153 | 29 | dh_auto_configure -- \ | 29 | dh_auto_configure -- \ |
154 | @@ -41,7 +41,9 @@ | |||
155 | 41 | dh_makeshlibs -V | 41 | dh_makeshlibs -V |
156 | 42 | 42 | ||
157 | 43 | override_dh_install: | 43 | override_dh_install: |
159 | 44 | dh_install --fail-missing | 44 | dh_install --fail-missing \ |
160 | 45 | -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmirplatformgraphics.so \ | ||
161 | 46 | -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmirclientplatform.so | ||
162 | 45 | sh debian/install_ld_so_conf.sh $(DEB_HOST_MULTIARCH) | 47 | sh debian/install_ld_so_conf.sh $(DEB_HOST_MULTIARCH) |
163 | 46 | 48 | ||
164 | 47 | override_dh_installdeb: | 49 | override_dh_installdeb: |
165 | 48 | 50 | ||
166 | === modified file 'examples/CMakeLists.txt' | |||
167 | --- examples/CMakeLists.txt 2014-03-04 04:19:26 +0000 | |||
168 | +++ examples/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
169 | @@ -93,7 +93,6 @@ | |||
170 | 93 | ${PROJECT_SOURCE_DIR}/include/server | 93 | ${PROJECT_SOURCE_DIR}/include/server |
171 | 94 | ${PROJECT_SOURCE_DIR}/include/client | 94 | ${PROJECT_SOURCE_DIR}/include/client |
172 | 95 | ${PROJECT_SOURCE_DIR}/include/platform | 95 | ${PROJECT_SOURCE_DIR}/include/platform |
173 | 96 | ${PROJECT_SOURCE_DIR}/include/test/mir_test/draw | ||
174 | 97 | ${GLESv2_INCLUDE_DIRS} | 96 | ${GLESv2_INCLUDE_DIRS} |
175 | 98 | ) | 97 | ) |
176 | 99 | 98 | ||
177 | 100 | 99 | ||
178 | === modified file 'examples/demo-shell/CMakeLists.txt' | |||
179 | --- examples/demo-shell/CMakeLists.txt 2013-08-28 03:41:48 +0000 | |||
180 | +++ examples/demo-shell/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
181 | @@ -1,5 +1,6 @@ | |||
182 | 1 | add_executable(mir_demo_server_shell | 1 | add_executable(mir_demo_server_shell |
183 | 2 | demo_shell.cpp | 2 | demo_shell.cpp |
184 | 3 | demo_renderer.cpp | ||
185 | 3 | fullscreen_placement_strategy.cpp | 4 | fullscreen_placement_strategy.cpp |
186 | 4 | window_manager.cpp | 5 | window_manager.cpp |
187 | 5 | ../server_configuration.cpp | 6 | ../server_configuration.cpp |
188 | 6 | 7 | ||
189 | === added file 'examples/demo-shell/demo_renderer.cpp' | |||
190 | --- examples/demo-shell/demo_renderer.cpp 1970-01-01 00:00:00 +0000 | |||
191 | +++ examples/demo-shell/demo_renderer.cpp 2014-03-17 15:02:33 +0000 | |||
192 | @@ -0,0 +1,33 @@ | |||
193 | 1 | /* | ||
194 | 2 | * Copyright © 2014 Canonical Ltd. | ||
195 | 3 | * | ||
196 | 4 | * This program is free software: you can redistribute it and/or modify | ||
197 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
198 | 6 | * published by the Free Software Foundation. | ||
199 | 7 | * | ||
200 | 8 | * This program is distributed in the hope that it will be useful, | ||
201 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
202 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
203 | 11 | * GNU General Public License for more details. | ||
204 | 12 | * | ||
205 | 13 | * You should have received a copy of the GNU General Public License | ||
206 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
207 | 15 | * | ||
208 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
209 | 17 | */ | ||
210 | 18 | |||
211 | 19 | #include "demo_renderer.h" | ||
212 | 20 | |||
213 | 21 | using namespace mir; | ||
214 | 22 | using namespace mir::examples; | ||
215 | 23 | |||
216 | 24 | DemoRenderer::DemoRenderer(geometry::Rectangle const& display_area) | ||
217 | 25 | : GLRenderer(display_area) | ||
218 | 26 | { | ||
219 | 27 | } | ||
220 | 28 | |||
221 | 29 | void DemoRenderer::begin() const | ||
222 | 30 | { | ||
223 | 31 | glClearColor(0.2f, 0.2f, 0.2f, 1.0f); | ||
224 | 32 | glClear(GL_COLOR_BUFFER_BIT); | ||
225 | 33 | } | ||
226 | 0 | 34 | ||
227 | === added file 'examples/demo-shell/demo_renderer.h' | |||
228 | --- examples/demo-shell/demo_renderer.h 1970-01-01 00:00:00 +0000 | |||
229 | +++ examples/demo-shell/demo_renderer.h 2014-03-17 15:02:33 +0000 | |||
230 | @@ -0,0 +1,39 @@ | |||
231 | 1 | /* | ||
232 | 2 | * Copyright © 2014 Canonical Ltd. | ||
233 | 3 | * | ||
234 | 4 | * This program is free software: you can redistribute it and/or modify | ||
235 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
236 | 6 | * published by the Free Software Foundation. | ||
237 | 7 | * | ||
238 | 8 | * This program is distributed in the hope that it will be useful, | ||
239 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
240 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
241 | 11 | * GNU General Public License for more details. | ||
242 | 12 | * | ||
243 | 13 | * You should have received a copy of the GNU General Public License | ||
244 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
245 | 15 | * | ||
246 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
247 | 17 | */ | ||
248 | 18 | |||
249 | 19 | #ifndef MIR_EXAMPLES_DEMO_RENDERER_H_ | ||
250 | 20 | #define MIR_EXAMPLES_DEMO_RENDERER_H_ | ||
251 | 21 | |||
252 | 22 | #include "mir/compositor/gl_renderer.h" | ||
253 | 23 | |||
254 | 24 | namespace mir | ||
255 | 25 | { | ||
256 | 26 | namespace examples | ||
257 | 27 | { | ||
258 | 28 | |||
259 | 29 | class DemoRenderer : public compositor::GLRenderer | ||
260 | 30 | { | ||
261 | 31 | public: | ||
262 | 32 | DemoRenderer(geometry::Rectangle const& display_area); | ||
263 | 33 | void begin() const override; | ||
264 | 34 | }; | ||
265 | 35 | |||
266 | 36 | } // namespace examples | ||
267 | 37 | } // namespace mir | ||
268 | 38 | |||
269 | 39 | #endif // MIR_EXAMPLES_DEMO_RENDERER_H_ | ||
270 | 0 | 40 | ||
271 | === modified file 'examples/demo-shell/demo_shell.cpp' | |||
272 | --- examples/demo-shell/demo_shell.cpp 2014-02-28 13:51:43 +0000 | |||
273 | +++ examples/demo-shell/demo_shell.cpp 2014-03-17 15:02:33 +0000 | |||
274 | @@ -18,6 +18,7 @@ | |||
275 | 18 | 18 | ||
276 | 19 | /// \example demo_shell.cpp A simple mir shell | 19 | /// \example demo_shell.cpp A simple mir shell |
277 | 20 | 20 | ||
278 | 21 | #include "demo_renderer.h" | ||
279 | 21 | #include "window_manager.h" | 22 | #include "window_manager.h" |
280 | 22 | #include "fullscreen_placement_strategy.h" | 23 | #include "fullscreen_placement_strategy.h" |
281 | 23 | #include "../server_configuration.h" | 24 | #include "../server_configuration.h" |
282 | @@ -27,6 +28,7 @@ | |||
283 | 27 | #include "mir/report_exception.h" | 28 | #include "mir/report_exception.h" |
284 | 28 | #include "mir/graphics/display.h" | 29 | #include "mir/graphics/display.h" |
285 | 29 | #include "mir/input/composite_event_filter.h" | 30 | #include "mir/input/composite_event_filter.h" |
286 | 31 | #include "mir/compositor/renderer_factory.h" | ||
287 | 30 | 32 | ||
288 | 31 | #include <iostream> | 33 | #include <iostream> |
289 | 32 | 34 | ||
290 | @@ -42,8 +44,19 @@ | |||
291 | 42 | namespace examples | 44 | namespace examples |
292 | 43 | { | 45 | { |
293 | 44 | 46 | ||
296 | 45 | struct DemoServerConfiguration : mir::examples::ServerConfiguration | 47 | class DemoRendererFactory : public compositor::RendererFactory |
297 | 46 | { | 48 | { |
298 | 49 | public: | ||
299 | 50 | std::unique_ptr<compositor::Renderer> create_renderer_for( | ||
300 | 51 | geometry::Rectangle const& rect) override | ||
301 | 52 | { | ||
302 | 53 | return std::unique_ptr<compositor::Renderer>(new DemoRenderer(rect)); | ||
303 | 54 | } | ||
304 | 55 | }; | ||
305 | 56 | |||
306 | 57 | class DemoServerConfiguration : public mir::examples::ServerConfiguration | ||
307 | 58 | { | ||
308 | 59 | public: | ||
309 | 47 | DemoServerConfiguration(int argc, char const* argv[], | 60 | DemoServerConfiguration(int argc, char const* argv[], |
310 | 48 | std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list) | 61 | std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list) |
311 | 49 | : ServerConfiguration([argc, argv] | 62 | : ServerConfiguration([argc, argv] |
312 | @@ -82,6 +95,12 @@ | |||
313 | 82 | return composite_filter; | 95 | return composite_filter; |
314 | 83 | } | 96 | } |
315 | 84 | 97 | ||
316 | 98 | std::shared_ptr<compositor::RendererFactory> the_renderer_factory() override | ||
317 | 99 | { | ||
318 | 100 | return std::make_shared<DemoRendererFactory>(); | ||
319 | 101 | } | ||
320 | 102 | |||
321 | 103 | private: | ||
322 | 85 | std::vector<std::shared_ptr<mi::EventFilter>> const filter_list; | 104 | std::vector<std::shared_ptr<mi::EventFilter>> const filter_list; |
323 | 86 | }; | 105 | }; |
324 | 87 | 106 | ||
325 | 88 | 107 | ||
326 | === modified file 'examples/demo-shell/window_manager.cpp' | |||
327 | --- examples/demo-shell/window_manager.cpp 2014-03-05 02:30:30 +0000 | |||
328 | +++ examples/demo-shell/window_manager.cpp 2014-03-17 15:02:33 +0000 | |||
329 | @@ -140,23 +140,14 @@ | |||
330 | 140 | { | 140 | { |
331 | 141 | compositor->stop(); | 141 | compositor->stop(); |
332 | 142 | auto conf = display->configuration(); | 142 | auto conf = display->configuration(); |
350 | 143 | conf->for_each_output([&](mg::DisplayConfigurationOutput const& output) -> void | 143 | MirPowerMode new_power_mode = display_off ? |
351 | 144 | { | 144 | mir_power_mode_on : mir_power_mode_off; |
352 | 145 | MirPowerMode power_mode; | 145 | conf->for_each_output( |
353 | 146 | if (!output.used) return; | 146 | [&](mg::UserDisplayConfigurationOutput& output) -> void |
354 | 147 | 147 | { | |
355 | 148 | if (display_off == true) | 148 | output.power_mode = new_power_mode; |
356 | 149 | power_mode = mir_power_mode_on; | 149 | } |
357 | 150 | else | 150 | ); |
341 | 151 | power_mode = mir_power_mode_off; | ||
342 | 152 | |||
343 | 153 | conf->configure_output(output.id, output.used, | ||
344 | 154 | output.top_left, | ||
345 | 155 | output.current_mode_index, | ||
346 | 156 | output.current_format, | ||
347 | 157 | power_mode, | ||
348 | 158 | output.orientation); | ||
349 | 159 | }); | ||
358 | 160 | display_off = !display_off; | 151 | display_off = !display_off; |
359 | 161 | 152 | ||
360 | 162 | display->configure(*conf.get()); | 153 | display->configure(*conf.get()); |
361 | @@ -184,14 +175,9 @@ | |||
362 | 184 | compositor->stop(); | 175 | compositor->stop(); |
363 | 185 | auto conf = display->configuration(); | 176 | auto conf = display->configuration(); |
364 | 186 | conf->for_each_output( | 177 | conf->for_each_output( |
366 | 187 | [&](mg::DisplayConfigurationOutput const& output) -> void | 178 | [&](mg::UserDisplayConfigurationOutput& output) -> void |
367 | 188 | { | 179 | { |
374 | 189 | conf->configure_output(output.id, output.used, | 180 | output.orientation = orientation; |
369 | 190 | output.top_left, | ||
370 | 191 | output.current_mode_index, | ||
371 | 192 | output.current_format, | ||
372 | 193 | output.power_mode, | ||
373 | 194 | orientation); | ||
375 | 195 | } | 181 | } |
376 | 196 | ); | 182 | ); |
377 | 197 | display->configure(*conf); | 183 | display->configure(*conf); |
378 | 198 | 184 | ||
379 | === modified file 'examples/eglplasma.c' | |||
380 | --- examples/eglplasma.c 2013-09-19 13:24:22 +0000 | |||
381 | +++ examples/eglplasma.c 2014-03-17 15:02:33 +0000 | |||
382 | @@ -85,14 +85,13 @@ | |||
383 | 85 | " const float pi2 = 6.283185308; \n" | 85 | " const float pi2 = 6.283185308; \n" |
384 | 86 | " float u = texcoord.x * pi2; \n" | 86 | " float u = texcoord.x * pi2; \n" |
385 | 87 | " float v = texcoord.y * pi2; \n" | 87 | " float v = texcoord.y * pi2; \n" |
390 | 88 | " float t = mod(theta, pi2); \n" | 88 | " float us = (cos(1.1 * u + 7.0 * theta) + \n" |
391 | 89 | " float us = (cos(1.1 * u + 7.0 * t) + \n" | 89 | " cos(2.3 * v * cos(1.0 * theta)) + \n" |
392 | 90 | " cos(2.3 * v * cos(1.0 * t)) + \n" | 90 | " cos(0.3 * u * cos(3.0 * theta)) \n" |
389 | 91 | " cos(0.3 * u * cos(3.0 * t)) \n" | ||
393 | 92 | " ) / 3.0; \n" | 91 | " ) / 3.0; \n" |
397 | 93 | " float vs = (cos(2.3 * v + 8.0 * t) + \n" | 92 | " float vs = (cos(2.3 * v + 8.0 * theta) + \n" |
398 | 94 | " cos(1.3 * u * cos(3.0 * t)) + \n" | 93 | " cos(1.3 * u * cos(3.0 * theta)) + \n" |
399 | 95 | " cos(1.7 * v * cos(2.0 * t)) \n" | 94 | " cos(1.7 * v * cos(2.0 * theta)) \n" |
400 | 96 | " ) / 3.0; \n" | 95 | " ) / 3.0; \n" |
401 | 97 | " float x = (us * vs + 1.0) / 2.0; \n" | 96 | " float x = (us * vs + 1.0) / 2.0; \n" |
402 | 98 | " gl_FragColor = vec4(gradient(x), 1.0); \n" | 97 | " gl_FragColor = vec4(gradient(x), 1.0); \n" |
403 | @@ -105,6 +104,7 @@ | |||
404 | 105 | 1.0f,-1.0f, | 104 | 1.0f,-1.0f, |
405 | 106 | -1.0f,-1.0f, | 105 | -1.0f,-1.0f, |
406 | 107 | }; | 106 | }; |
407 | 107 | const float pi2 = 6.283185308f; | ||
408 | 108 | GLuint vshader, fshader, prog; | 108 | GLuint vshader, fshader, prog; |
409 | 109 | GLint linked, low_color, high_color, vpos, theta; | 109 | GLint linked, low_color, high_color, vpos, theta; |
410 | 110 | unsigned int width = 0, height = 0; | 110 | unsigned int width = 0, height = 0; |
411 | @@ -151,6 +151,8 @@ | |||
412 | 151 | { | 151 | { |
413 | 152 | glUniform1f(theta, angle); | 152 | glUniform1f(theta, angle); |
414 | 153 | angle += 0.005f; | 153 | angle += 0.005f; |
415 | 154 | if (angle > pi2) | ||
416 | 155 | angle -= pi2; | ||
417 | 154 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | 156 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
418 | 155 | mir_eglapp_swap_buffers(); | 157 | mir_eglapp_swap_buffers(); |
419 | 156 | } | 158 | } |
420 | 157 | 159 | ||
421 | === modified file 'examples/image_renderer.cpp' | |||
422 | --- examples/image_renderer.cpp 2014-01-22 10:03:11 +0000 | |||
423 | +++ examples/image_renderer.cpp 2014-03-17 15:02:33 +0000 | |||
424 | @@ -23,6 +23,7 @@ | |||
425 | 23 | #pragma GCC diagnostic warning "-Wall" | 23 | #pragma GCC diagnostic warning "-Wall" |
426 | 24 | #include <glm/glm.hpp> | 24 | #include <glm/glm.hpp> |
427 | 25 | #pragma GCC diagnostic pop | 25 | #pragma GCC diagnostic pop |
428 | 26 | #define GLM_FORCE_RADIANS | ||
429 | 26 | #include <glm/gtc/type_ptr.hpp> | 27 | #include <glm/gtc/type_ptr.hpp> |
430 | 27 | 28 | ||
431 | 28 | #include <memory> | 29 | #include <memory> |
432 | 29 | 30 | ||
433 | === modified file 'examples/pixel_format_selector.cpp' | |||
434 | --- examples/pixel_format_selector.cpp 2014-03-05 02:30:30 +0000 | |||
435 | +++ examples/pixel_format_selector.cpp 2014-03-17 15:02:33 +0000 | |||
436 | @@ -40,7 +40,7 @@ | |||
437 | 40 | { | 40 | { |
438 | 41 | base_policy->apply_to(conf); | 41 | base_policy->apply_to(conf); |
439 | 42 | conf.for_each_output( | 42 | conf.for_each_output( |
441 | 43 | [&](graphics::DisplayConfigurationOutput const& conf_output) | 43 | [&](graphics::UserDisplayConfigurationOutput& conf_output) |
442 | 44 | { | 44 | { |
443 | 45 | if (!conf_output.connected || !conf_output.used) return; | 45 | if (!conf_output.connected || !conf_output.used) return; |
444 | 46 | 46 | ||
445 | @@ -56,12 +56,7 @@ | |||
446 | 56 | if (pos == conf_output.pixel_formats.end()) | 56 | if (pos == conf_output.pixel_formats.end()) |
447 | 57 | return; | 57 | return; |
448 | 58 | 58 | ||
455 | 59 | conf.configure_output(conf_output.id, true, conf_output.top_left, | 59 | conf_output.current_format = *pos; |
450 | 60 | conf_output.current_mode_index, | ||
451 | 61 | *pos, | ||
452 | 62 | conf_output.power_mode, | ||
453 | 63 | conf_output.orientation | ||
454 | 64 | ); | ||
456 | 65 | }); | 60 | }); |
457 | 66 | } | 61 | } |
458 | 67 | 62 | ||
459 | 68 | 63 | ||
460 | === modified file 'examples/render_overlays.cpp' | |||
461 | --- examples/render_overlays.cpp 2014-03-04 04:19:26 +0000 | |||
462 | +++ examples/render_overlays.cpp 2014-03-17 15:02:33 +0000 | |||
463 | @@ -25,9 +25,10 @@ | |||
464 | 25 | #include "mir/graphics/buffer_properties.h" | 25 | #include "mir/graphics/buffer_properties.h" |
465 | 26 | #include "mir/report_exception.h" | 26 | #include "mir/report_exception.h" |
466 | 27 | 27 | ||
469 | 28 | #include "graphics_region_factory.h" | 28 | #include "testdraw/graphics_region_factory.h" |
470 | 29 | #include "patterns.h" | 29 | #include "testdraw/patterns.h" |
471 | 30 | 30 | ||
472 | 31 | #include <chrono> | ||
473 | 31 | #include <csignal> | 32 | #include <csignal> |
474 | 32 | #include <iostream> | 33 | #include <iostream> |
475 | 33 | 34 | ||
476 | @@ -44,20 +45,69 @@ | |||
477 | 44 | { | 45 | { |
478 | 45 | running = false; | 46 | running = false; |
479 | 46 | } | 47 | } |
481 | 47 | } | 48 | |
482 | 49 | class DemoOverlayClient | ||
483 | 50 | { | ||
484 | 51 | public: | ||
485 | 52 | DemoOverlayClient( | ||
486 | 53 | mg::GraphicBufferAllocator& buffer_allocator, | ||
487 | 54 | mg::BufferProperties const& buffer_properties, uint32_t color) | ||
488 | 55 | : front_buffer(buffer_allocator.alloc_buffer(buffer_properties)), | ||
489 | 56 | back_buffer(buffer_allocator.alloc_buffer(buffer_properties)), | ||
490 | 57 | region_factory(mir::test::draw::create_graphics_region_factory()), | ||
491 | 58 | color{color}, | ||
492 | 59 | last_tick{std::chrono::high_resolution_clock::now()} | ||
493 | 60 | { | ||
494 | 61 | } | ||
495 | 62 | |||
496 | 63 | void update_green_channel() | ||
497 | 64 | { | ||
498 | 65 | char green_value = (color >> 8) & 0xFF; | ||
499 | 66 | green_value += compute_update_value(); | ||
500 | 67 | color &= 0xFFFF00FF; | ||
501 | 68 | color |= (green_value << 8); | ||
502 | 69 | |||
503 | 70 | mir::test::draw::DrawPatternSolid fill{color}; | ||
504 | 71 | fill.draw(*region_factory->graphic_region_from_handle(*back_buffer->native_buffer_handle())); | ||
505 | 72 | std::swap(front_buffer, back_buffer); | ||
506 | 73 | } | ||
507 | 74 | |||
508 | 75 | std::shared_ptr<mg::Buffer> last_rendered() | ||
509 | 76 | { | ||
510 | 77 | return front_buffer; | ||
511 | 78 | } | ||
512 | 79 | |||
513 | 80 | private: | ||
514 | 81 | int compute_update_value() | ||
515 | 82 | { | ||
516 | 83 | float const update_ratio{3.90625}; //this will give an update of 256 in 1s | ||
517 | 84 | auto current_tick = std::chrono::high_resolution_clock::now(); | ||
518 | 85 | auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>( | ||
519 | 86 | current_tick - last_tick).count(); | ||
520 | 87 | float update_value = elapsed_ms / update_ratio; | ||
521 | 88 | last_tick = current_tick; | ||
522 | 89 | return static_cast<int>(update_value); | ||
523 | 90 | } | ||
524 | 91 | |||
525 | 92 | std::shared_ptr<mg::Buffer> front_buffer; | ||
526 | 93 | std::shared_ptr<mg::Buffer> back_buffer; | ||
527 | 94 | std::shared_ptr<mir::test::draw::GraphicsRegionFactory> region_factory; | ||
528 | 95 | unsigned int color; | ||
529 | 96 | std::chrono::time_point<std::chrono::high_resolution_clock> last_tick; | ||
530 | 97 | }; | ||
531 | 48 | 98 | ||
532 | 49 | class DemoRenderable : public mg::Renderable | 99 | class DemoRenderable : public mg::Renderable |
533 | 50 | { | 100 | { |
534 | 51 | public: | 101 | public: |
537 | 52 | DemoRenderable(std::shared_ptr<mg::Buffer> const& buffer, geom::Rectangle rect) | 102 | DemoRenderable(std::shared_ptr<DemoOverlayClient> const& client, geom::Rectangle rect) |
538 | 53 | : renderable_buffer(buffer), | 103 | : client(client), |
539 | 54 | position(rect) | 104 | position(rect) |
540 | 55 | { | 105 | { |
541 | 56 | } | 106 | } |
542 | 57 | 107 | ||
544 | 58 | std::shared_ptr<mg::Buffer> buffer() const | 108 | std::shared_ptr<mg::Buffer> buffer(unsigned long) const override |
545 | 59 | { | 109 | { |
547 | 60 | return renderable_buffer; | 110 | return client->last_rendered(); |
548 | 61 | } | 111 | } |
549 | 62 | 112 | ||
550 | 63 | bool alpha_enabled() const | 113 | bool alpha_enabled() const |
551 | @@ -70,16 +120,41 @@ | |||
552 | 70 | return position; | 120 | return position; |
553 | 71 | } | 121 | } |
554 | 72 | 122 | ||
555 | 123 | float alpha() const override | ||
556 | 124 | { | ||
557 | 125 | return 1.0f; | ||
558 | 126 | } | ||
559 | 127 | |||
560 | 128 | glm::mat4 transformation() const override | ||
561 | 129 | { | ||
562 | 130 | return trans; | ||
563 | 131 | } | ||
564 | 132 | |||
565 | 133 | bool shaped() const | ||
566 | 134 | { | ||
567 | 135 | return false; | ||
568 | 136 | } | ||
569 | 137 | |||
570 | 138 | bool should_be_rendered_in(geom::Rectangle const& rect) const override | ||
571 | 139 | { | ||
572 | 140 | return rect.overlaps(position); | ||
573 | 141 | } | ||
574 | 142 | |||
575 | 143 | int buffers_ready_for_compositor() const override | ||
576 | 144 | { | ||
577 | 145 | return 1; | ||
578 | 146 | } | ||
579 | 147 | |||
580 | 73 | private: | 148 | private: |
582 | 74 | std::shared_ptr<mg::Buffer> const renderable_buffer; | 149 | std::shared_ptr<DemoOverlayClient> const client; |
583 | 75 | geom::Rectangle const position; | 150 | geom::Rectangle const position; |
584 | 151 | glm::mat4 const trans; | ||
585 | 76 | }; | 152 | }; |
586 | 153 | } | ||
587 | 77 | 154 | ||
588 | 78 | int main(int argc, char const** argv) | 155 | int main(int argc, char const** argv) |
589 | 79 | try | 156 | try |
590 | 80 | { | 157 | { |
591 | 81 | mir::test::draw::DrawPatternSolid fill_with_green(0x00FF00FF); | ||
592 | 82 | mir::test::draw::DrawPatternSolid fill_with_blue(0x0000FFFF); | ||
593 | 83 | 158 | ||
594 | 84 | /* Set up graceful exit on SIGINT and SIGTERM */ | 159 | /* Set up graceful exit on SIGINT and SIGTERM */ |
595 | 85 | struct sigaction sa; | 160 | struct sigaction sa; |
596 | @@ -95,7 +170,6 @@ | |||
597 | 95 | auto platform = conf.the_graphics_platform(); | 170 | auto platform = conf.the_graphics_platform(); |
598 | 96 | auto display = platform->create_display(conf.the_display_configuration_policy()); | 171 | auto display = platform->create_display(conf.the_display_configuration_policy()); |
599 | 97 | auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer()); | 172 | auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer()); |
600 | 98 | auto region_factory = mir::test::draw::create_graphics_region_factory(); | ||
601 | 99 | 173 | ||
602 | 100 | mg::BufferProperties buffer_properties{ | 174 | mg::BufferProperties buffer_properties{ |
603 | 101 | geom::Size{512, 512}, | 175 | geom::Size{512, 512}, |
604 | @@ -103,18 +177,13 @@ | |||
605 | 103 | mg::BufferUsage::hardware | 177 | mg::BufferUsage::hardware |
606 | 104 | }; | 178 | }; |
607 | 105 | 179 | ||
616 | 106 | auto buffer1 = buffer_allocator->alloc_buffer(buffer_properties); | 180 | auto client1 = std::make_shared<DemoOverlayClient>(*buffer_allocator, buffer_properties,0xFF0000FF); |
617 | 107 | auto buffer2 = buffer_allocator->alloc_buffer(buffer_properties); | 181 | auto client2 = std::make_shared<DemoOverlayClient>(*buffer_allocator, buffer_properties,0xFFFFFF00); |
618 | 108 | 182 | ||
611 | 109 | fill_with_green.draw(*region_factory->graphic_region_from_handle(*buffer1->native_buffer_handle())); | ||
612 | 110 | fill_with_blue.draw(*region_factory->graphic_region_from_handle(*buffer2->native_buffer_handle())); | ||
613 | 111 | |||
614 | 112 | geom::Rectangle screen_pos1{{0,0} , {512, 512}}; | ||
615 | 113 | geom::Rectangle screen_pos2{{80,80} , {592,592}}; | ||
619 | 114 | std::list<std::shared_ptr<mg::Renderable>> renderlist | 183 | std::list<std::shared_ptr<mg::Renderable>> renderlist |
620 | 115 | { | 184 | { |
623 | 116 | std::make_shared<DemoRenderable>(buffer2, screen_pos2), | 185 | std::make_shared<DemoRenderable>(client1, geom::Rectangle{{0,0} , {512, 512}}), |
624 | 117 | std::make_shared<DemoRenderable>(buffer1, screen_pos1) | 186 | std::make_shared<DemoRenderable>(client2, geom::Rectangle{{80,80} , {592,592}}) |
625 | 118 | }; | 187 | }; |
626 | 119 | 188 | ||
627 | 120 | while (running) | 189 | while (running) |
628 | @@ -122,6 +191,8 @@ | |||
629 | 122 | display->for_each_display_buffer([&](mg::DisplayBuffer& buffer) | 191 | display->for_each_display_buffer([&](mg::DisplayBuffer& buffer) |
630 | 123 | { | 192 | { |
631 | 124 | buffer.make_current(); | 193 | buffer.make_current(); |
632 | 194 | client1->update_green_channel(); | ||
633 | 195 | client2->update_green_channel(); | ||
634 | 125 | auto render_fn = [](mg::Renderable const&) {}; | 196 | auto render_fn = [](mg::Renderable const&) {}; |
635 | 126 | buffer.render_and_post_update(renderlist, render_fn); | 197 | buffer.render_and_post_update(renderlist, render_fn); |
636 | 127 | }); | 198 | }); |
637 | 128 | 199 | ||
638 | === modified file 'examples/render_surfaces.cpp' | |||
639 | --- examples/render_surfaces.cpp 2014-02-28 13:51:43 +0000 | |||
640 | +++ examples/render_surfaces.cpp 2014-03-17 15:02:33 +0000 | |||
641 | @@ -17,6 +17,7 @@ | |||
642 | 17 | */ | 17 | */ |
643 | 18 | 18 | ||
644 | 19 | #include "mir/compositor/display_buffer_compositor_factory.h" | 19 | #include "mir/compositor/display_buffer_compositor_factory.h" |
645 | 20 | #include "mir/server_status_listener.h" | ||
646 | 20 | #include "mir/compositor/display_buffer_compositor.h" | 21 | #include "mir/compositor/display_buffer_compositor.h" |
647 | 21 | #include "mir/options/default_configuration.h" | 22 | #include "mir/options/default_configuration.h" |
648 | 22 | #include "mir/graphics/graphic_buffer_allocator.h" | 23 | #include "mir/graphics/graphic_buffer_allocator.h" |
649 | @@ -48,8 +49,6 @@ | |||
650 | 48 | #include <sstream> | 49 | #include <sstream> |
651 | 49 | #include <vector> | 50 | #include <vector> |
652 | 50 | 51 | ||
653 | 51 | #include <glm/gtc/matrix_transform.hpp> | ||
654 | 52 | |||
655 | 53 | namespace mg = mir::graphics; | 52 | namespace mg = mir::graphics; |
656 | 54 | namespace mc = mir::compositor; | 53 | namespace mc = mir::compositor; |
657 | 55 | namespace ms = mir::scene; | 54 | namespace ms = mir::scene; |
658 | @@ -86,6 +85,7 @@ | |||
659 | 86 | 85 | ||
660 | 87 | namespace | 86 | namespace |
661 | 88 | { | 87 | { |
662 | 88 | std::atomic<bool> created{false}; | ||
663 | 89 | bool input_is_on = false; | 89 | bool input_is_on = false; |
664 | 90 | std::weak_ptr<mg::Cursor> cursor; | 90 | std::weak_ptr<mg::Cursor> cursor; |
665 | 91 | static const uint32_t bg_color = 0x00000000; | 91 | static const uint32_t bg_color = 0x00000000; |
666 | @@ -326,6 +326,31 @@ | |||
667 | 326 | } | 326 | } |
668 | 327 | ///\internal [RenderResourcesBufferInitializer_tag] | 327 | ///\internal [RenderResourcesBufferInitializer_tag] |
669 | 328 | 328 | ||
670 | 329 | // Unless the compositor starts before we create the surfaces it won't respond to | ||
671 | 330 | // the change notification that causes. | ||
672 | 331 | std::shared_ptr<mir::ServerStatusListener> the_server_status_listener() | ||
673 | 332 | { | ||
674 | 333 | struct ServerStatusListener : mir::ServerStatusListener | ||
675 | 334 | { | ||
676 | 335 | ServerStatusListener(std::function<void()> create_surfaces, std::shared_ptr<mir::ServerStatusListener> wrapped) : | ||
677 | 336 | create_surfaces(create_surfaces), wrapped(wrapped) {} | ||
678 | 337 | |||
679 | 338 | virtual void paused() override { wrapped->paused(); } | ||
680 | 339 | virtual void resumed() override { wrapped->resumed(); } | ||
681 | 340 | virtual void started() override { wrapped->started(); create_surfaces(); create_surfaces = []{}; } | ||
682 | 341 | |||
683 | 342 | std::function<void()> create_surfaces; | ||
684 | 343 | std::shared_ptr<mir::ServerStatusListener> const wrapped; | ||
685 | 344 | }; | ||
686 | 345 | |||
687 | 346 | return server_status_listener( | ||
688 | 347 | [this]() | ||
689 | 348 | { | ||
690 | 349 | auto wrapped = ServerConfiguration::the_server_status_listener(); | ||
691 | 350 | return std::make_shared<ServerStatusListener>([this] { create_surfaces(); }, wrapped); | ||
692 | 351 | }); | ||
693 | 352 | } | ||
694 | 353 | |||
695 | 329 | ///\internal [RenderSurfacesDisplayBufferCompositor_tag] | 354 | ///\internal [RenderSurfacesDisplayBufferCompositor_tag] |
696 | 330 | // Decorate the DefaultDisplayBufferCompositor in order to move surfaces. | 355 | // Decorate the DefaultDisplayBufferCompositor in order to move surfaces. |
697 | 331 | std::shared_ptr<mc::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory() override | 356 | std::shared_ptr<mc::DisplayBufferCompositorFactory> the_display_buffer_compositor_factory() override |
698 | @@ -342,8 +367,9 @@ | |||
699 | 342 | { | 367 | { |
700 | 343 | } | 368 | } |
701 | 344 | 369 | ||
703 | 345 | void composite() | 370 | bool composite() |
704 | 346 | { | 371 | { |
705 | 372 | while (!created) std::this_thread::yield(); | ||
706 | 347 | animate_cursor(); | 373 | animate_cursor(); |
707 | 348 | stop_watch.stop(); | 374 | stop_watch.stop(); |
708 | 349 | if (stop_watch.elapsed_seconds_since_last_restart() >= 1) | 375 | if (stop_watch.elapsed_seconds_since_last_restart() >= 1) |
709 | @@ -360,6 +386,7 @@ | |||
710 | 360 | m.step(); | 386 | m.step(); |
711 | 361 | 387 | ||
712 | 362 | frames++; | 388 | frames++; |
713 | 389 | return false; | ||
714 | 363 | } | 390 | } |
715 | 364 | 391 | ||
716 | 365 | private: | 392 | private: |
717 | @@ -459,6 +486,8 @@ | |||
718 | 459 | 2.0f * M_PI * cos(i)); | 486 | 2.0f * M_PI * cos(i)); |
719 | 460 | ++i; | 487 | ++i; |
720 | 461 | } | 488 | } |
721 | 489 | |||
722 | 490 | created = true; | ||
723 | 462 | } | 491 | } |
724 | 463 | 492 | ||
725 | 464 | bool input_is_on() | 493 | bool input_is_on() |
726 | @@ -492,8 +521,6 @@ | |||
727 | 492 | 521 | ||
728 | 493 | mir::run_mir(conf, [&](mir::DisplayServer&) | 522 | mir::run_mir(conf, [&](mir::DisplayServer&) |
729 | 494 | { | 523 | { |
730 | 495 | conf.create_surfaces(); | ||
731 | 496 | |||
732 | 497 | cursor = conf.the_cursor(); | 524 | cursor = conf.the_cursor(); |
733 | 498 | 525 | ||
734 | 499 | input_is_on = conf.input_is_on(); | 526 | input_is_on = conf.input_is_on(); |
735 | 500 | 527 | ||
736 | === modified file 'examples/scroll.cpp' | |||
737 | --- examples/scroll.cpp 2014-03-04 04:19:26 +0000 | |||
738 | +++ examples/scroll.cpp 2014-03-17 15:02:33 +0000 | |||
739 | @@ -23,46 +23,21 @@ | |||
740 | 23 | #include <signal.h> | 23 | #include <signal.h> |
741 | 24 | #include <string.h> | 24 | #include <string.h> |
742 | 25 | #include <stdio.h> | 25 | #include <stdio.h> |
743 | 26 | #include <stdlib.h> | ||
744 | 26 | #include <unistd.h> | 27 | #include <unistd.h> |
745 | 27 | #include <getopt.h> | 28 | #include <getopt.h> |
746 | 28 | #include <EGL/egl.h> | 29 | #include <EGL/egl.h> |
747 | 29 | #include <GLES2/gl2.h> | 30 | #include <GLES2/gl2.h> |
748 | 30 | 31 | ||
749 | 32 | #include <thread> | ||
750 | 33 | |||
751 | 31 | static char const *socket_file = NULL; | 34 | static char const *socket_file = NULL; |
754 | 32 | 35 | static EGLDisplay disp; | |
755 | 33 | int main(int argc, char* argv[]) | 36 | |
756 | 37 | |||
757 | 38 | void create_and_run_scroll_surface(MirConnection *connection) | ||
758 | 34 | { | 39 | { |
759 | 35 | MirConnection *connection = 0; | ||
760 | 36 | MirSurface *surface = 0; | 40 | MirSurface *surface = 0; |
761 | 37 | int arg; | ||
762 | 38 | opterr = 0; | ||
763 | 39 | while ((arg = getopt (argc, argv, "hm:")) != -1) | ||
764 | 40 | { | ||
765 | 41 | switch (arg) | ||
766 | 42 | { | ||
767 | 43 | case 'm': | ||
768 | 44 | socket_file = optarg; | ||
769 | 45 | break; | ||
770 | 46 | |||
771 | 47 | case '?': | ||
772 | 48 | case 'h': | ||
773 | 49 | default: | ||
774 | 50 | puts(argv[0]); | ||
775 | 51 | puts("Usage:"); | ||
776 | 52 | puts(" -m <Mir server socket>"); | ||
777 | 53 | puts(" -h: this help text"); | ||
778 | 54 | return -1; | ||
779 | 55 | } | ||
780 | 56 | } | ||
781 | 57 | |||
782 | 58 | puts("Starting"); | ||
783 | 59 | |||
784 | 60 | connection = mir_connect_sync(socket_file, __PRETTY_FUNCTION__); | ||
785 | 61 | assert(connection != NULL); | ||
786 | 62 | assert(mir_connection_is_valid(connection)); | ||
787 | 63 | assert(strcmp(mir_connection_get_error_message(connection), "") == 0); | ||
788 | 64 | puts("Connected"); | ||
789 | 65 | |||
790 | 66 | MirPixelFormat pixel_format; | 41 | MirPixelFormat pixel_format; |
791 | 67 | unsigned int valid_formats; | 42 | unsigned int valid_formats; |
792 | 68 | mir_connection_get_available_surface_formats(connection, &pixel_format, 1, &valid_formats); | 43 | mir_connection_get_available_surface_formats(connection, &pixel_format, 1, &valid_formats); |
793 | @@ -79,7 +54,6 @@ | |||
794 | 79 | 54 | ||
795 | 80 | /* egl setup */ | 55 | /* egl setup */ |
796 | 81 | int major, minor, n, rc; | 56 | int major, minor, n, rc; |
797 | 82 | EGLDisplay disp; | ||
798 | 83 | EGLContext context; | 57 | EGLContext context; |
799 | 84 | EGLSurface egl_surface; | 58 | EGLSurface egl_surface; |
800 | 85 | EGLConfig egl_config; | 59 | EGLConfig egl_config; |
801 | @@ -93,13 +67,9 @@ | |||
802 | 93 | EGL_NONE }; | 67 | EGL_NONE }; |
803 | 94 | EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; | 68 | EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; |
804 | 95 | 69 | ||
805 | 96 | EGLNativeDisplayType native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(connection); | ||
806 | 97 | EGLNativeWindowType native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(surface); | 70 | EGLNativeWindowType native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(surface); |
807 | 98 | assert(native_window != (EGLNativeWindowType)NULL); | 71 | assert(native_window != (EGLNativeWindowType)NULL); |
808 | 99 | 72 | ||
809 | 100 | disp = eglGetDisplay(native_display); | ||
810 | 101 | assert(disp != EGL_NO_DISPLAY); | ||
811 | 102 | |||
812 | 103 | rc = eglInitialize(disp, &major, &minor); | 73 | rc = eglInitialize(disp, &major, &minor); |
813 | 104 | assert(rc == EGL_TRUE); | 74 | assert(rc == EGL_TRUE); |
814 | 105 | assert(major == 1); | 75 | assert(major == 1); |
815 | @@ -131,16 +101,67 @@ | |||
816 | 131 | 101 | ||
817 | 132 | eglDestroySurface(disp, egl_surface); | 102 | eglDestroySurface(disp, egl_surface); |
818 | 133 | eglDestroyContext(disp, context); | 103 | eglDestroyContext(disp, context); |
821 | 134 | eglTerminate(disp); | 104 | |
820 | 135 | |||
822 | 136 | mir_surface_release_sync(surface); | 105 | mir_surface_release_sync(surface); |
823 | 137 | puts("Surface released"); | 106 | puts("Surface released"); |
824 | 107 | } | ||
825 | 108 | |||
826 | 109 | int main(int argc, char* argv[]) | ||
827 | 110 | { | ||
828 | 111 | MirConnection *connection = 0; | ||
829 | 112 | unsigned num_windows = 1; | ||
830 | 113 | int arg; | ||
831 | 114 | opterr = 0; | ||
832 | 115 | while ((arg = getopt (argc, argv, "hm:w:")) != -1) | ||
833 | 116 | { | ||
834 | 117 | switch (arg) | ||
835 | 118 | { | ||
836 | 119 | case 'm': | ||
837 | 120 | socket_file = optarg; | ||
838 | 121 | break; | ||
839 | 122 | case 'w': | ||
840 | 123 | num_windows = atoi(optarg); | ||
841 | 124 | break; | ||
842 | 125 | case '?': | ||
843 | 126 | case 'h': | ||
844 | 127 | default: | ||
845 | 128 | puts(argv[0]); | ||
846 | 129 | puts("Usage:"); | ||
847 | 130 | puts(" -m <Mir server socket>"); | ||
848 | 131 | puts(" -w <Number of windows to create>:"); | ||
849 | 132 | puts(" -h: this help text"); | ||
850 | 133 | return -1; | ||
851 | 134 | } | ||
852 | 135 | } | ||
853 | 136 | |||
854 | 137 | puts("Starting"); | ||
855 | 138 | |||
856 | 139 | connection = mir_connect_sync(socket_file, __PRETTY_FUNCTION__); | ||
857 | 140 | assert(connection != NULL); | ||
858 | 141 | assert(mir_connection_is_valid(connection)); | ||
859 | 142 | assert(strcmp(mir_connection_get_error_message(connection), "") == 0); | ||
860 | 143 | puts("Connected"); | ||
861 | 144 | |||
862 | 145 | EGLNativeDisplayType native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(connection); | ||
863 | 146 | disp = eglGetDisplay(native_display); | ||
864 | 147 | assert(disp != EGL_NO_DISPLAY); | ||
865 | 148 | |||
866 | 149 | if (num_windows == 1) | ||
867 | 150 | { | ||
868 | 151 | create_and_run_scroll_surface(connection); | ||
869 | 152 | } | ||
870 | 153 | else | ||
871 | 154 | { | ||
872 | 155 | for (unsigned i = 0; i < num_windows; i++) std::thread(create_and_run_scroll_surface, connection).detach(); | ||
873 | 156 | for(;;) {} | ||
874 | 157 | } | ||
875 | 158 | |||
876 | 159 | |||
877 | 160 | eglTerminate(disp); | ||
878 | 138 | 161 | ||
879 | 139 | mir_connection_release(connection); | 162 | mir_connection_release(connection); |
880 | 140 | puts("Connection released"); | 163 | puts("Connection released"); |
881 | 141 | 164 | ||
882 | 142 | (void)rc; | ||
883 | 143 | |||
884 | 144 | return 0; | 165 | return 0; |
885 | 145 | } | 166 | } |
886 | 146 | 167 | ||
887 | 147 | 168 | ||
888 | === modified file 'examples/server_configuration.cpp' | |||
889 | --- examples/server_configuration.cpp 2014-03-05 02:30:30 +0000 | |||
890 | +++ examples/server_configuration.cpp 2014-03-17 15:02:33 +0000 | |||
891 | @@ -56,28 +56,23 @@ | |||
892 | 56 | }); | 56 | }); |
893 | 57 | 57 | ||
894 | 58 | conf.for_each_output( | 58 | conf.for_each_output( |
896 | 59 | [&](mg::DisplayConfigurationOutput const& conf_output) | 59 | [&](mg::UserDisplayConfigurationOutput& conf_output) |
897 | 60 | { | 60 | { |
898 | 61 | if (conf_output.connected && conf_output.modes.size() > 0 && | 61 | if (conf_output.connected && conf_output.modes.size() > 0 && |
899 | 62 | available_outputs_for_card[conf_output.card_id] > 0) | 62 | available_outputs_for_card[conf_output.card_id] > 0) |
900 | 63 | { | 63 | { |
907 | 64 | conf.configure_output(conf_output.id, true, | 64 | conf_output.used = true; |
908 | 65 | geom::Point{max_x, 0}, | 65 | conf_output.top_left = geom::Point{max_x, 0}; |
909 | 66 | preferred_mode_index, | 66 | conf_output.current_mode_index = preferred_mode_index; |
910 | 67 | conf_output.current_format, | 67 | conf_output.power_mode = mir_power_mode_on; |
911 | 68 | mir_power_mode_on, | 68 | conf_output.orientation = mir_orientation_normal; |
906 | 69 | mir_orientation_normal); | ||
912 | 70 | max_x += conf_output.modes[preferred_mode_index].size.width.as_int(); | 69 | max_x += conf_output.modes[preferred_mode_index].size.width.as_int(); |
913 | 71 | --available_outputs_for_card[conf_output.card_id]; | 70 | --available_outputs_for_card[conf_output.card_id]; |
914 | 72 | } | 71 | } |
915 | 73 | else | 72 | else |
916 | 74 | { | 73 | { |
923 | 75 | conf.configure_output(conf_output.id, false, | 74 | conf_output.used = false; |
924 | 76 | conf_output.top_left, | 75 | conf_output.power_mode = mir_power_mode_off; |
919 | 77 | conf_output.current_mode_index, | ||
920 | 78 | conf_output.current_format, | ||
921 | 79 | mir_power_mode_on, | ||
922 | 80 | mir_orientation_normal); | ||
925 | 81 | } | 76 | } |
926 | 82 | }); | 77 | }); |
927 | 83 | } | 78 | } |
928 | @@ -92,26 +87,20 @@ | |||
929 | 92 | bool done{false}; | 87 | bool done{false}; |
930 | 93 | 88 | ||
931 | 94 | conf.for_each_output( | 89 | conf.for_each_output( |
933 | 95 | [&](mg::DisplayConfigurationOutput const& conf_output) | 90 | [&](mg::UserDisplayConfigurationOutput& conf_output) |
934 | 96 | { | 91 | { |
935 | 97 | if (!done && conf_output.connected && conf_output.modes.size() > 0) | 92 | if (!done && conf_output.connected && conf_output.modes.size() > 0) |
936 | 98 | { | 93 | { |
943 | 99 | conf.configure_output(conf_output.id, true, | 94 | conf_output.used = true; |
944 | 100 | geom::Point{0, 0}, | 95 | conf_output.top_left = geom::Point{0, 0}; |
945 | 101 | preferred_mode_index, | 96 | conf_output.current_mode_index = preferred_mode_index; |
946 | 102 | conf_output.current_format, | 97 | conf_output.power_mode = mir_power_mode_on; |
941 | 103 | mir_power_mode_on, | ||
942 | 104 | mir_orientation_normal); | ||
947 | 105 | done = true; | 98 | done = true; |
948 | 106 | } | 99 | } |
949 | 107 | else | 100 | else |
950 | 108 | { | 101 | { |
957 | 109 | conf.configure_output(conf_output.id, false, | 102 | conf_output.used = false; |
958 | 110 | conf_output.top_left, | 103 | conf_output.power_mode = mir_power_mode_off; |
953 | 111 | conf_output.current_mode_index, | ||
954 | 112 | conf_output.current_format, | ||
955 | 113 | mir_power_mode_on, | ||
956 | 114 | mir_orientation_normal); | ||
959 | 115 | } | 104 | } |
960 | 116 | }); | 105 | }); |
961 | 117 | } | 106 | } |
962 | 118 | 107 | ||
963 | === modified file 'include/platform/mir/graphics/display_configuration.h' | |||
964 | --- include/platform/mir/graphics/display_configuration.h 2014-03-05 02:30:30 +0000 | |||
965 | +++ include/platform/mir/graphics/display_configuration.h 2014-03-17 15:02:33 +0000 | |||
966 | @@ -114,6 +114,31 @@ | |||
967 | 114 | /** The logical rectangle occupied by the output, based on its position, | 114 | /** The logical rectangle occupied by the output, based on its position, |
968 | 115 | current mode and orientation (rotation) */ | 115 | current mode and orientation (rotation) */ |
969 | 116 | geometry::Rectangle extents() const; | 116 | geometry::Rectangle extents() const; |
970 | 117 | bool valid() const; | ||
971 | 118 | }; | ||
972 | 119 | |||
973 | 120 | /** | ||
974 | 121 | * Mirror of a DisplayConfigurationOutput, with some fields limited to | ||
975 | 122 | * being read-only, preventing users from changing things they shouldn't. | ||
976 | 123 | */ | ||
977 | 124 | struct UserDisplayConfigurationOutput | ||
978 | 125 | { | ||
979 | 126 | DisplayConfigurationOutputId const& id; | ||
980 | 127 | DisplayConfigurationCardId const& card_id; | ||
981 | 128 | DisplayConfigurationOutputType const& type; | ||
982 | 129 | std::vector<MirPixelFormat> const& pixel_formats; | ||
983 | 130 | std::vector<DisplayConfigurationMode> const& modes; | ||
984 | 131 | size_t const& preferred_mode_index; | ||
985 | 132 | geometry::Size const& physical_size_mm; | ||
986 | 133 | bool const& connected; | ||
987 | 134 | bool& used; | ||
988 | 135 | geometry::Point& top_left; | ||
989 | 136 | size_t& current_mode_index; | ||
990 | 137 | MirPixelFormat& current_format; | ||
991 | 138 | MirPowerMode& power_mode; | ||
992 | 139 | MirOrientation& orientation; | ||
993 | 140 | |||
994 | 141 | UserDisplayConfigurationOutput(DisplayConfigurationOutput& master); | ||
995 | 117 | }; | 142 | }; |
996 | 118 | 143 | ||
997 | 119 | std::ostream& operator<<(std::ostream& out, DisplayConfigurationCard const& val); | 144 | std::ostream& operator<<(std::ostream& out, DisplayConfigurationCard const& val); |
998 | @@ -140,13 +165,8 @@ | |||
999 | 140 | virtual void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const = 0; | 165 | virtual void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const = 0; |
1000 | 141 | /** Executes a function object for each output in the configuration. */ | 166 | /** Executes a function object for each output in the configuration. */ |
1001 | 142 | virtual void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const = 0; | 167 | virtual void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const = 0; |
1009 | 143 | 168 | virtual void for_each_output(std::function<void(UserDisplayConfigurationOutput&)> f) = 0; | |
1010 | 144 | /** Configures an output. */ | 169 | virtual bool valid() const; |
1004 | 145 | virtual void configure_output(DisplayConfigurationOutputId id, bool used, | ||
1005 | 146 | geometry::Point top_left, size_t mode_index, | ||
1006 | 147 | MirPixelFormat format, | ||
1007 | 148 | MirPowerMode power_mode, | ||
1008 | 149 | MirOrientation orientation) = 0; | ||
1011 | 150 | 170 | ||
1012 | 151 | protected: | 171 | protected: |
1013 | 152 | DisplayConfiguration() = default; | 172 | DisplayConfiguration() = default; |
1014 | 153 | 173 | ||
1015 | === renamed file 'src/platform/graphics/mesa/overlapping_output_grouping.h' => 'include/platform/mir/graphics/overlapping_output_grouping.h' | |||
1016 | --- src/platform/graphics/mesa/overlapping_output_grouping.h 2014-01-22 10:03:11 +0000 | |||
1017 | +++ include/platform/mir/graphics/overlapping_output_grouping.h 2014-03-17 15:02:33 +0000 | |||
1018 | @@ -16,8 +16,8 @@ | |||
1019 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
1020 | 17 | */ | 17 | */ |
1021 | 18 | 18 | ||
1024 | 19 | #ifndef MIR_GRAPHICS_MESA_OVERLAPPING_OUTPUT_GROUPING_H_ | 19 | #ifndef MIR_GRAPHICS_OVERLAPPING_OUTPUT_GROUPING_H_ |
1025 | 20 | #define MIR_GRAPHICS_MESA_OVERLAPPING_OUTPUT_GROUPING_H_ | 20 | #define MIR_GRAPHICS_OVERLAPPING_OUTPUT_GROUPING_H_ |
1026 | 21 | 21 | ||
1027 | 22 | #include <vector> | 22 | #include <vector> |
1028 | 23 | #include <functional> | 23 | #include <functional> |
1029 | @@ -34,9 +34,6 @@ | |||
1030 | 34 | class DisplayConfiguration; | 34 | class DisplayConfiguration; |
1031 | 35 | struct DisplayConfigurationOutput; | 35 | struct DisplayConfigurationOutput; |
1032 | 36 | 36 | ||
1033 | 37 | namespace mesa | ||
1034 | 38 | { | ||
1035 | 39 | |||
1036 | 40 | class OverlappingOutputGroup | 37 | class OverlappingOutputGroup |
1037 | 41 | { | 38 | { |
1038 | 42 | public: | 39 | public: |
1039 | @@ -67,6 +64,5 @@ | |||
1040 | 67 | 64 | ||
1041 | 68 | } | 65 | } |
1042 | 69 | } | 66 | } |
1043 | 70 | } | ||
1044 | 71 | 67 | ||
1046 | 72 | #endif /* MIR_GRAPHICS_MESA_OVERLAPPING_OUTPUT_GROUPING_H_ */ | 68 | #endif /* MIR_GRAPHICS_OVERLAPPING_OUTPUT_GROUPING_H_ */ |
1047 | 73 | 69 | ||
1048 | === modified file 'include/platform/mir/graphics/renderable.h' | |||
1049 | --- include/platform/mir/graphics/renderable.h 2014-03-04 04:19:26 +0000 | |||
1050 | +++ include/platform/mir/graphics/renderable.h 2014-03-17 15:02:33 +0000 | |||
1051 | @@ -20,6 +20,7 @@ | |||
1052 | 20 | #define MIR_GRAPHICS_RENDERABLE_H_ | 20 | #define MIR_GRAPHICS_RENDERABLE_H_ |
1053 | 21 | 21 | ||
1054 | 22 | #include <mir/geometry/rectangle.h> | 22 | #include <mir/geometry/rectangle.h> |
1055 | 23 | #include <glm/glm.hpp> | ||
1056 | 23 | #include <memory> | 24 | #include <memory> |
1057 | 24 | 25 | ||
1058 | 25 | namespace mir | 26 | namespace mir |
1059 | @@ -31,10 +32,47 @@ | |||
1060 | 31 | class Renderable | 32 | class Renderable |
1061 | 32 | { | 33 | { |
1062 | 33 | public: | 34 | public: |
1064 | 34 | virtual std::shared_ptr<Buffer> buffer() const = 0; | 35 | /** |
1065 | 36 | * Return the next buffer that should be composited/rendered. | ||
1066 | 37 | * | ||
1067 | 38 | * \param [in] frameno The frameno parameter is important for | ||
1068 | 39 | * multi-monitor platforms. Calls with the same frameno | ||
1069 | 40 | * will get the same buffer returned. This ensures that | ||
1070 | 41 | * a surface visible on multiple outputs does not get | ||
1071 | 42 | * its buffers consumed any faster than the refresh | ||
1072 | 43 | * rate of a single monitor. Implementations may ignore | ||
1073 | 44 | * the value of frameno on single-monitor platforms | ||
1074 | 45 | * only. The caller should always ensure the frameno | ||
1075 | 46 | * is different to the previous frame. The exact value | ||
1076 | 47 | * of frameno is not important but a large range of | ||
1077 | 48 | * values is recommended. | ||
1078 | 49 | */ | ||
1079 | 50 | virtual std::shared_ptr<Buffer> buffer(unsigned long frameno) const = 0; | ||
1080 | 51 | |||
1081 | 35 | virtual bool alpha_enabled() const = 0; | 52 | virtual bool alpha_enabled() const = 0; |
1082 | 36 | virtual geometry::Rectangle screen_position() const = 0; | 53 | virtual geometry::Rectangle screen_position() const = 0; |
1083 | 37 | 54 | ||
1084 | 55 | // These are from the old CompositingCriteria. There is a little bit | ||
1085 | 56 | // of function overlap with the above functions still. | ||
1086 | 57 | virtual float alpha() const = 0; | ||
1087 | 58 | |||
1088 | 59 | /** | ||
1089 | 60 | * Transformation returns the transformation matrix that should be applied | ||
1090 | 61 | * to the surface. By default when there are no transformations this will | ||
1091 | 62 | * be the identity matrix. | ||
1092 | 63 | * | ||
1093 | 64 | * \warning As this functionality is presently only used by | ||
1094 | 65 | * mir_demo_standalone_render_surfaces for rotations it may be | ||
1095 | 66 | * deprecated in future. It is expected that real transformations | ||
1096 | 67 | * may become more transient things (e.g. applied by animation | ||
1097 | 68 | * logic externally instead of being a semi-permanent attribute of | ||
1098 | 69 | * the surface itself). | ||
1099 | 70 | */ | ||
1100 | 71 | virtual glm::mat4 transformation() const = 0; | ||
1101 | 72 | virtual bool should_be_rendered_in(geometry::Rectangle const& rect) const = 0; | ||
1102 | 73 | virtual bool shaped() const = 0; // meaning the pixel format has alpha | ||
1103 | 74 | virtual int buffers_ready_for_compositor() const = 0; | ||
1104 | 75 | |||
1105 | 38 | protected: | 76 | protected: |
1106 | 39 | Renderable() = default; | 77 | Renderable() = default; |
1107 | 40 | virtual ~Renderable() = default; | 78 | virtual ~Renderable() = default; |
1108 | 41 | 79 | ||
1109 | === modified file 'include/platform/mir/options/configuration.h' | |||
1110 | --- include/platform/mir/options/configuration.h 2014-02-20 17:59:00 +0000 | |||
1111 | +++ include/platform/mir/options/configuration.h 2014-03-17 15:02:33 +0000 | |||
1112 | @@ -39,7 +39,6 @@ | |||
1113 | 39 | extern char const* const scene_report_opt; | 39 | extern char const* const scene_report_opt; |
1114 | 40 | extern char const* const input_report_opt; | 40 | extern char const* const input_report_opt; |
1115 | 41 | extern char const* const host_socket_opt; | 41 | extern char const* const host_socket_opt; |
1116 | 42 | extern char const* const standalone_opt; | ||
1117 | 43 | extern char const* const frontend_threads_opt; | 42 | extern char const* const frontend_threads_opt; |
1118 | 44 | 43 | ||
1119 | 45 | extern char const* const name_opt; | 44 | extern char const* const name_opt; |
1120 | 46 | 45 | ||
1121 | === modified file 'include/server/mir/compositor/buffer_stream.h' | |||
1122 | --- include/server/mir/compositor/buffer_stream.h 2014-02-10 09:07:48 +0000 | |||
1123 | +++ include/server/mir/compositor/buffer_stream.h 2014-03-17 15:02:33 +0000 | |||
1124 | @@ -1,5 +1,5 @@ | |||
1125 | 1 | /* | 1 | /* |
1127 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1128 | 3 | * | 3 | * |
1129 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1130 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1131 | @@ -50,6 +50,7 @@ | |||
1132 | 50 | virtual void resize(geometry::Size const& size) = 0; | 50 | virtual void resize(geometry::Size const& size) = 0; |
1133 | 51 | virtual void allow_framedropping(bool) = 0; | 51 | virtual void allow_framedropping(bool) = 0; |
1134 | 52 | virtual void force_requests_to_complete() = 0; | 52 | virtual void force_requests_to_complete() = 0; |
1135 | 53 | virtual int buffers_ready_for_compositor() const = 0; | ||
1136 | 53 | }; | 54 | }; |
1137 | 54 | 55 | ||
1138 | 55 | } | 56 | } |
1139 | 56 | 57 | ||
1140 | === removed file 'include/server/mir/compositor/compositing_criteria.h' | |||
1141 | --- include/server/mir/compositor/compositing_criteria.h 2014-03-10 19:28:33 +0000 | |||
1142 | +++ include/server/mir/compositor/compositing_criteria.h 1970-01-01 00:00:00 +0000 | |||
1143 | @@ -1,52 +0,0 @@ | |||
1144 | 1 | /* | ||
1145 | 2 | * Copyright © 2013 Canonical Ltd. | ||
1146 | 3 | * | ||
1147 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1148 | 5 | * under the terms of the GNU General Public License version 3, | ||
1149 | 6 | * as published by the Free Software Foundation. | ||
1150 | 7 | * | ||
1151 | 8 | * This program is distributed in the hope that it will be useful, | ||
1152 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1153 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1154 | 11 | * GNU General Public License for more details. | ||
1155 | 12 | * | ||
1156 | 13 | * You should have received a copy of the GNU General Public License | ||
1157 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1158 | 15 | * | ||
1159 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
1160 | 17 | */ | ||
1161 | 18 | |||
1162 | 19 | #ifndef MIR_COMPOSITOR_COMPOSITING_CRITERIA_H_ | ||
1163 | 20 | #define MIR_COMPOSITOR_COMPOSITING_CRITERIA_H_ | ||
1164 | 21 | |||
1165 | 22 | #include <glm/glm.hpp> | ||
1166 | 23 | |||
1167 | 24 | namespace mir | ||
1168 | 25 | { | ||
1169 | 26 | namespace geometry | ||
1170 | 27 | { | ||
1171 | 28 | struct Rectangle; | ||
1172 | 29 | } | ||
1173 | 30 | namespace compositor | ||
1174 | 31 | { | ||
1175 | 32 | |||
1176 | 33 | class CompositingCriteria | ||
1177 | 34 | { | ||
1178 | 35 | public: | ||
1179 | 36 | virtual float alpha() const = 0; | ||
1180 | 37 | virtual glm::mat4 const& transformation() const = 0; | ||
1181 | 38 | virtual bool should_be_rendered_in(geometry::Rectangle const& rect) const = 0; | ||
1182 | 39 | virtual bool shaped() const = 0; // meaning the pixel format has alpha | ||
1183 | 40 | |||
1184 | 41 | virtual ~CompositingCriteria() = default; | ||
1185 | 42 | |||
1186 | 43 | protected: | ||
1187 | 44 | CompositingCriteria() = default; | ||
1188 | 45 | CompositingCriteria(CompositingCriteria const&) = delete; | ||
1189 | 46 | CompositingCriteria& operator=(CompositingCriteria const&) = delete; | ||
1190 | 47 | }; | ||
1191 | 48 | |||
1192 | 49 | } | ||
1193 | 50 | } | ||
1194 | 51 | |||
1195 | 52 | #endif /* MIR_COMPOSITOR_COMPOSITING_CRITERIA_H_ */ | ||
1196 | 53 | 0 | ||
1197 | === modified file 'include/server/mir/compositor/display_buffer_compositor.h' | |||
1198 | --- include/server/mir/compositor/display_buffer_compositor.h 2013-08-28 03:41:48 +0000 | |||
1199 | +++ include/server/mir/compositor/display_buffer_compositor.h 2014-03-17 15:02:33 +0000 | |||
1200 | @@ -1,5 +1,5 @@ | |||
1201 | 1 | /* | 1 | /* |
1203 | 2 | * Copyright © 2012-2013 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1204 | 3 | * | 3 | * |
1205 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1206 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1207 | @@ -30,7 +30,9 @@ | |||
1208 | 30 | public: | 30 | public: |
1209 | 31 | virtual ~DisplayBufferCompositor() = default; | 31 | virtual ~DisplayBufferCompositor() = default; |
1210 | 32 | 32 | ||
1212 | 33 | virtual void composite() = 0; | 33 | /// Returns true if there is additional work to do. E.g. a composited surface |
1213 | 34 | /// has additional buffers ready to composite or during animation | ||
1214 | 35 | virtual bool composite() = 0; | ||
1215 | 34 | 36 | ||
1216 | 35 | protected: | 37 | protected: |
1217 | 36 | DisplayBufferCompositor() = default; | 38 | DisplayBufferCompositor() = default; |
1218 | 37 | 39 | ||
1219 | === renamed file 'src/server/compositor/gl_renderer.h' => 'include/server/mir/compositor/gl_renderer.h' | |||
1220 | --- src/server/compositor/gl_renderer.h 2014-03-04 04:19:26 +0000 | |||
1221 | +++ include/server/mir/compositor/gl_renderer.h 2014-03-17 15:02:33 +0000 | |||
1222 | @@ -19,11 +19,12 @@ | |||
1223 | 19 | #ifndef MIR_COMPOSITOR_GL_RENDERER_H_ | 19 | #ifndef MIR_COMPOSITOR_GL_RENDERER_H_ |
1224 | 20 | #define MIR_COMPOSITOR_GL_RENDERER_H_ | 20 | #define MIR_COMPOSITOR_GL_RENDERER_H_ |
1225 | 21 | 21 | ||
1229 | 22 | #include "renderer.h" | 22 | #include <mir/compositor/renderer.h> |
1230 | 23 | #include "mir/geometry/rectangle.h" | 23 | #include <mir/geometry/rectangle.h> |
1231 | 24 | #include "mir/graphics/buffer_id.h" | 24 | #include <mir/graphics/buffer_id.h> |
1232 | 25 | #include <GLES2/gl2.h> | 25 | #include <GLES2/gl2.h> |
1233 | 26 | #include <unordered_map> | 26 | #include <unordered_map> |
1234 | 27 | #include <vector> | ||
1235 | 27 | 28 | ||
1236 | 28 | namespace mir | 29 | namespace mir |
1237 | 29 | { | 30 | { |
1238 | @@ -40,27 +41,52 @@ | |||
1239 | 40 | void set_viewport(geometry::Rectangle const& rect) override; | 41 | void set_viewport(geometry::Rectangle const& rect) override; |
1240 | 41 | void set_rotation(float degrees) override; | 42 | void set_rotation(float degrees) override; |
1241 | 42 | void begin() const override; | 43 | void begin() const override; |
1243 | 43 | void render(CompositingCriteria const& info, graphics::Buffer& buffer) const override; | 44 | void render(graphics::Renderable const& renderable, |
1244 | 45 | graphics::Buffer& buffer) const override; | ||
1245 | 44 | void end() const override; | 46 | void end() const override; |
1246 | 45 | 47 | ||
1247 | 46 | // This is called _without_ a GL context: | 48 | // This is called _without_ a GL context: |
1248 | 47 | void suspend() override; | 49 | void suspend() override; |
1249 | 48 | 50 | ||
1250 | 51 | struct Vertex | ||
1251 | 52 | { | ||
1252 | 53 | GLfloat position[3]; | ||
1253 | 54 | GLfloat texcoord[2]; | ||
1254 | 55 | }; | ||
1255 | 56 | |||
1256 | 57 | /** | ||
1257 | 58 | * tessellate defines the list of triangles that will be used to render | ||
1258 | 59 | * the surface. By default it just returns 4 vertices for a rectangle. | ||
1259 | 60 | * However you can override its behaviour to tessellate more finely and | ||
1260 | 61 | * deform freely for effects like wobbly windows. | ||
1261 | 62 | * | ||
1262 | 63 | * \returns The mode to be passed to glDrawArrays, e.g. GL_TRIANGLE_STRIP, | ||
1263 | 64 | * GL_TRIANGLE_FAN or GL_TRIANGLES. | ||
1264 | 65 | * | ||
1265 | 66 | * \note The cohesion of this function to GLRenderer is quite loose and it | ||
1266 | 67 | * does not strictly need to reside here. | ||
1267 | 68 | * However it seems a good choice under GLRenderer while this remains | ||
1268 | 69 | * the only OpenGL-specific class in the display server, and | ||
1269 | 70 | * tessellation is very much OpenGL-specific. | ||
1270 | 71 | */ | ||
1271 | 72 | virtual GLenum tessellate(graphics::Renderable const& renderable, | ||
1272 | 73 | std::vector<Vertex>& vertices) const; | ||
1273 | 74 | |||
1274 | 49 | private: | 75 | private: |
1275 | 50 | GLuint vertex_shader; | 76 | GLuint vertex_shader; |
1276 | 51 | GLuint fragment_shader; | 77 | GLuint fragment_shader; |
1277 | 52 | GLuint program; | 78 | GLuint program; |
1278 | 53 | GLuint position_attr_loc; | 79 | GLuint position_attr_loc; |
1279 | 54 | GLuint texcoord_attr_loc; | 80 | GLuint texcoord_attr_loc; |
1280 | 81 | GLuint centre_uniform_loc; | ||
1281 | 55 | GLuint display_transform_uniform_loc; | 82 | GLuint display_transform_uniform_loc; |
1282 | 56 | GLuint transform_uniform_loc; | 83 | GLuint transform_uniform_loc; |
1283 | 57 | GLuint alpha_uniform_loc; | 84 | GLuint alpha_uniform_loc; |
1284 | 58 | GLuint vertex_attribs_vbo; | ||
1285 | 59 | float rotation; | 85 | float rotation; |
1286 | 60 | 86 | ||
1287 | 61 | geometry::Rectangle viewport; | 87 | geometry::Rectangle viewport; |
1288 | 62 | 88 | ||
1290 | 63 | typedef CompositingCriteria const* SurfaceID; | 89 | typedef graphics::Renderable const* SurfaceID; |
1291 | 64 | struct Texture | 90 | struct Texture |
1292 | 65 | { | 91 | { |
1293 | 66 | GLuint id = 0; | 92 | GLuint id = 0; |
1294 | 67 | 93 | ||
1295 | === renamed file 'src/server/compositor/renderer.h' => 'include/server/mir/compositor/renderer.h' | |||
1296 | --- src/server/compositor/renderer.h 2014-03-04 04:19:26 +0000 | |||
1297 | +++ include/server/mir/compositor/renderer.h 2014-03-17 15:02:33 +0000 | |||
1298 | @@ -26,10 +26,10 @@ | |||
1299 | 26 | namespace graphics | 26 | namespace graphics |
1300 | 27 | { | 27 | { |
1301 | 28 | class Buffer; | 28 | class Buffer; |
1302 | 29 | class Renderable; | ||
1303 | 29 | } | 30 | } |
1304 | 30 | namespace compositor | 31 | namespace compositor |
1305 | 31 | { | 32 | { |
1306 | 32 | class CompositingCriteria; | ||
1307 | 33 | 33 | ||
1308 | 34 | class Renderer | 34 | class Renderer |
1309 | 35 | { | 35 | { |
1310 | @@ -39,7 +39,11 @@ | |||
1311 | 39 | virtual void set_viewport(geometry::Rectangle const& rect) = 0; | 39 | virtual void set_viewport(geometry::Rectangle const& rect) = 0; |
1312 | 40 | virtual void set_rotation(float degrees) = 0; | 40 | virtual void set_rotation(float degrees) = 0; |
1313 | 41 | virtual void begin() const = 0; | 41 | virtual void begin() const = 0; |
1315 | 42 | virtual void render(CompositingCriteria const& info, graphics::Buffer& buffer) const = 0; | 42 | |
1316 | 43 | // XXX The buffer parameter here could now be replaced with a "frameno" | ||
1317 | 44 | // instead, and use renderable.buffer(frameno). Is that better? | ||
1318 | 45 | virtual void render(graphics::Renderable const& renderable, | ||
1319 | 46 | graphics::Buffer& buffer) const = 0; | ||
1320 | 43 | virtual void end() const = 0; | 47 | virtual void end() const = 0; |
1321 | 44 | 48 | ||
1322 | 45 | virtual void suspend() = 0; // called when begin/render/end skipped | 49 | virtual void suspend() = 0; // called when begin/render/end skipped |
1323 | 46 | 50 | ||
1324 | === renamed file 'src/server/compositor/renderer_factory.h' => 'include/server/mir/compositor/renderer_factory.h' | |||
1325 | === modified file 'include/server/mir/compositor/scene.h' | |||
1326 | --- include/server/mir/compositor/scene.h 2014-03-04 04:19:26 +0000 | |||
1327 | +++ include/server/mir/compositor/scene.h 2014-03-17 15:02:33 +0000 | |||
1328 | @@ -26,17 +26,16 @@ | |||
1329 | 26 | 26 | ||
1330 | 27 | namespace mir | 27 | namespace mir |
1331 | 28 | { | 28 | { |
1332 | 29 | namespace graphics { class Renderable; } | ||
1333 | 29 | namespace compositor | 30 | namespace compositor |
1334 | 30 | { | 31 | { |
1335 | 31 | class BufferStream; | ||
1336 | 32 | class CompositingCriteria; | ||
1337 | 33 | 32 | ||
1338 | 34 | class FilterForScene | 33 | class FilterForScene |
1339 | 35 | { | 34 | { |
1340 | 36 | public: | 35 | public: |
1341 | 37 | virtual ~FilterForScene() {} | 36 | virtual ~FilterForScene() {} |
1342 | 38 | 37 | ||
1344 | 39 | virtual bool operator()(CompositingCriteria const&) = 0; | 38 | virtual bool operator()(graphics::Renderable const&) = 0; |
1345 | 40 | 39 | ||
1346 | 41 | protected: | 40 | protected: |
1347 | 42 | FilterForScene() = default; | 41 | FilterForScene() = default; |
1348 | @@ -49,7 +48,7 @@ | |||
1349 | 49 | public: | 48 | public: |
1350 | 50 | virtual ~OperatorForScene() {} | 49 | virtual ~OperatorForScene() {} |
1351 | 51 | 50 | ||
1353 | 52 | virtual void operator()(CompositingCriteria const&, BufferStream&) = 0; | 51 | virtual void operator()(graphics::Renderable const&) = 0; |
1354 | 53 | 52 | ||
1355 | 54 | protected: | 53 | protected: |
1356 | 55 | OperatorForScene() = default; | 54 | OperatorForScene() = default; |
1357 | 56 | 55 | ||
1358 | === modified file 'include/server/mir/frontend/screencast.h' | |||
1359 | --- include/server/mir/frontend/screencast.h 2014-01-30 13:08:32 +0000 | |||
1360 | +++ include/server/mir/frontend/screencast.h 2014-03-17 15:02:33 +0000 | |||
1361 | @@ -39,7 +39,9 @@ | |||
1362 | 39 | virtual ~Screencast() = default; | 39 | virtual ~Screencast() = default; |
1363 | 40 | 40 | ||
1364 | 41 | virtual ScreencastSessionId create_session( | 41 | virtual ScreencastSessionId create_session( |
1366 | 42 | graphics::DisplayConfigurationOutputId output_id) = 0; | 42 | mir::geometry::Rectangle const& region, |
1367 | 43 | mir::geometry::Size const& size, | ||
1368 | 44 | MirPixelFormat pixel_format) = 0; | ||
1369 | 43 | virtual void destroy_session(ScreencastSessionId id) = 0; | 45 | virtual void destroy_session(ScreencastSessionId id) = 0; |
1370 | 44 | virtual std::shared_ptr<graphics::Buffer> capture(ScreencastSessionId id) = 0; | 46 | virtual std::shared_ptr<graphics::Buffer> capture(ScreencastSessionId id) = 0; |
1371 | 45 | 47 | ||
1372 | 46 | 48 | ||
1373 | === modified file 'include/server/mir/shell/session.h' | |||
1374 | --- include/server/mir/shell/session.h 2014-03-04 04:19:26 +0000 | |||
1375 | +++ include/server/mir/shell/session.h 2014-03-17 15:02:33 +0000 | |||
1376 | @@ -33,7 +33,6 @@ | |||
1377 | 33 | class Session : public frontend::Session | 33 | class Session : public frontend::Session |
1378 | 34 | { | 34 | { |
1379 | 35 | public: | 35 | public: |
1380 | 36 | virtual std::string name() const = 0; | ||
1381 | 37 | virtual void force_requests_to_complete() = 0; | 36 | virtual void force_requests_to_complete() = 0; |
1382 | 38 | virtual pid_t process_id() const = 0; | 37 | virtual pid_t process_id() const = 0; |
1383 | 39 | 38 | ||
1384 | 40 | 39 | ||
1385 | === modified file 'include/shared/mir_toolkit/client_types.h' | |||
1386 | --- include/shared/mir_toolkit/client_types.h 2014-02-10 09:07:48 +0000 | |||
1387 | +++ include/shared/mir_toolkit/client_types.h 2014-03-17 15:02:33 +0000 | |||
1388 | @@ -267,15 +267,35 @@ | |||
1389 | 267 | void *context; | 267 | void *context; |
1390 | 268 | } MirEventDelegate; | 268 | } MirEventDelegate; |
1391 | 269 | 269 | ||
1392 | 270 | typedef struct MirRectangle | ||
1393 | 271 | { | ||
1394 | 272 | int left; | ||
1395 | 273 | int top; | ||
1396 | 274 | unsigned int width; | ||
1397 | 275 | unsigned int height; | ||
1398 | 276 | } MirRectangle; | ||
1399 | 277 | |||
1400 | 270 | /** | 278 | /** |
1401 | 271 | * MirScreencastParameters is the structure of required information that | 279 | * MirScreencastParameters is the structure of required information that |
1402 | 272 | * you must provide to Mir in order to create a MirScreencast. | 280 | * you must provide to Mir in order to create a MirScreencast. |
1403 | 281 | * The width and height parameters can be used to down-scale the screencast | ||
1404 | 282 | * For no scaling set them to the region width and height. | ||
1405 | 273 | */ | 283 | */ |
1406 | 274 | typedef struct MirScreencastParameters | 284 | typedef struct MirScreencastParameters |
1407 | 275 | { | 285 | { |
1411 | 276 | uint32_t output_id; | 286 | /** |
1412 | 277 | uint32_t width; | 287 | * The rectangular region of the screen to capture - |
1413 | 278 | uint32_t height; | 288 | * The region is specified in virtual screen space hence multiple screens can be captured simultaneously |
1414 | 289 | */ | ||
1415 | 290 | MirRectangle region; | ||
1416 | 291 | /** The width of the screencast which can be different than the screen region capture width */ | ||
1417 | 292 | unsigned int width; | ||
1418 | 293 | /** The height of the screencast which can be different than the screen region capture height */ | ||
1419 | 294 | unsigned int height; | ||
1420 | 295 | /** | ||
1421 | 296 | * The pixel format of the screencast. | ||
1422 | 297 | * It must be a supported format obtained from mir_connection_get_available_surface_formats. | ||
1423 | 298 | */ | ||
1424 | 279 | MirPixelFormat pixel_format; | 299 | MirPixelFormat pixel_format; |
1425 | 280 | } MirScreencastParameters; | 300 | } MirScreencastParameters; |
1426 | 281 | 301 | ||
1427 | 282 | 302 | ||
1428 | === renamed directory 'include/test/mir_test/draw' => 'include/shared/testdraw' | |||
1429 | === modified file 'include/shared/testdraw/draw_pattern_checkered-inl.h' | |||
1430 | --- include/test/mir_test/draw/draw_pattern_checkered-inl.h 2014-03-04 04:19:26 +0000 | |||
1431 | +++ include/shared/testdraw/draw_pattern_checkered-inl.h 2014-03-17 15:02:33 +0000 | |||
1432 | @@ -2,15 +2,15 @@ | |||
1433 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012 Canonical Ltd. |
1434 | 3 | * | 3 | * |
1435 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1437 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
1438 | 6 | * as published by the Free Software Foundation. | 6 | * as published by the Free Software Foundation. |
1439 | 7 | * | 7 | * |
1440 | 8 | * This program is distributed in the hope that it will be useful, | 8 | * This program is distributed in the hope that it will be useful, |
1441 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1442 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1444 | 11 | * GNU General Public License for more details. | 11 | * GNU Lesser General Public License for more details. |
1445 | 12 | * | 12 | * |
1447 | 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU Lesser General Public License |
1448 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1449 | 15 | * | 15 | * |
1450 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1451 | 17 | 17 | ||
1452 | === modified file 'include/shared/testdraw/graphics_region_factory.h' | |||
1453 | --- include/test/mir_test/draw/graphics_region_factory.h 2014-03-04 04:19:26 +0000 | |||
1454 | +++ include/shared/testdraw/graphics_region_factory.h 2014-03-17 15:02:33 +0000 | |||
1455 | @@ -2,15 +2,15 @@ | |||
1456 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012 Canonical Ltd. |
1457 | 3 | * | 3 | * |
1458 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1460 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
1461 | 6 | * as published by the Free Software Foundation. | 6 | * as published by the Free Software Foundation. |
1462 | 7 | * | 7 | * |
1463 | 8 | * This program is distributed in the hope that it will be useful, | 8 | * This program is distributed in the hope that it will be useful, |
1464 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1465 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1467 | 11 | * GNU General Public License for more details. | 11 | * GNU Lesser General Public License for more details. |
1468 | 12 | * | 12 | * |
1470 | 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU Lesser General Public License |
1471 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1472 | 15 | * | 15 | * |
1473 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1474 | @@ -34,7 +34,7 @@ | |||
1475 | 34 | public: | 34 | public: |
1476 | 35 | virtual ~GraphicsRegionFactory() {} | 35 | virtual ~GraphicsRegionFactory() {} |
1477 | 36 | virtual std::shared_ptr<MirGraphicsRegion> graphic_region_from_handle( | 36 | virtual std::shared_ptr<MirGraphicsRegion> graphic_region_from_handle( |
1479 | 37 | graphics::NativeBuffer const& native_buffer) = 0; | 37 | graphics::NativeBuffer& native_buffer) = 0; |
1480 | 38 | 38 | ||
1481 | 39 | protected: | 39 | protected: |
1482 | 40 | GraphicsRegionFactory() = default; | 40 | GraphicsRegionFactory() = default; |
1483 | 41 | 41 | ||
1484 | === modified file 'include/shared/testdraw/patterns.h' | |||
1485 | --- include/test/mir_test/draw/patterns.h 2014-03-04 04:19:26 +0000 | |||
1486 | +++ include/shared/testdraw/patterns.h 2014-03-17 15:02:33 +0000 | |||
1487 | @@ -2,15 +2,15 @@ | |||
1488 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012 Canonical Ltd. |
1489 | 3 | * | 3 | * |
1490 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1492 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
1493 | 6 | * as published by the Free Software Foundation. | 6 | * as published by the Free Software Foundation. |
1494 | 7 | * | 7 | * |
1495 | 8 | * This program is distributed in the hope that it will be useful, | 8 | * This program is distributed in the hope that it will be useful, |
1496 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1497 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1499 | 11 | * GNU General Public License for more details. | 11 | * GNU Lesser General Public License for more details. |
1500 | 12 | * | 12 | * |
1502 | 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU Lesser General Public License |
1503 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1504 | 15 | * | 15 | * |
1505 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1506 | 17 | 17 | ||
1507 | === renamed file 'include/test/mir_test_doubles/stub_compositing_criteria.h' => 'include/test/mir_test_doubles/fake_renderable.h' | |||
1508 | --- include/test/mir_test_doubles/stub_compositing_criteria.h 2014-03-04 04:19:26 +0000 | |||
1509 | +++ include/test/mir_test_doubles/fake_renderable.h 2014-03-17 15:02:33 +0000 | |||
1510 | @@ -16,10 +16,11 @@ | |||
1511 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> |
1512 | 17 | */ | 17 | */ |
1513 | 18 | 18 | ||
1516 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_COMPOSITING_CRITERIA_H_ | 19 | #ifndef MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ |
1517 | 20 | #define MIR_TEST_DOUBLES_STUB_COMPOSITING_CRITERIA_H_ | 20 | #define MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ |
1518 | 21 | 21 | ||
1520 | 22 | #include "mir/compositor/compositing_criteria.h" | 22 | #include "mir/graphics/renderable.h" |
1521 | 23 | #define GLM_FORCE_RADIANS | ||
1522 | 23 | #include <glm/gtc/matrix_transform.hpp> | 24 | #include <glm/gtc/matrix_transform.hpp> |
1523 | 24 | #include <gmock/gmock.h> | 25 | #include <gmock/gmock.h> |
1524 | 25 | 26 | ||
1525 | @@ -30,24 +31,20 @@ | |||
1526 | 30 | namespace doubles | 31 | namespace doubles |
1527 | 31 | { | 32 | { |
1528 | 32 | 33 | ||
1530 | 33 | class StubCompositingCriteria : public compositor::CompositingCriteria | 34 | class FakeRenderable : public graphics::Renderable |
1531 | 34 | { | 35 | { |
1532 | 35 | public: | 36 | public: |
1538 | 36 | StubCompositingCriteria(int x, int y, int width, int height, | 37 | FakeRenderable(int x, int y, int width, int height, |
1539 | 37 | float opacity=1.0f, | 38 | float opacity=1.0f, |
1540 | 38 | bool rectangular=true, | 39 | bool rectangular=true, |
1541 | 39 | bool visible=true, | 40 | bool visible=true, |
1542 | 40 | bool posted=true) | 41 | bool posted=true) |
1543 | 41 | : rect{{x, y}, {width, height}}, | 42 | : rect{{x, y}, {width, height}}, |
1544 | 42 | opacity(opacity), | 43 | opacity(opacity), |
1545 | 43 | rectangular(rectangular), | 44 | rectangular(rectangular), |
1546 | 44 | visible(visible), | 45 | visible(visible), |
1547 | 45 | posted(posted) | 46 | posted(posted) |
1548 | 46 | { | 47 | { |
1549 | 47 | const glm::mat4 ident; | ||
1550 | 48 | glm::vec3 size(width, height, 0.0f); | ||
1551 | 49 | glm::vec3 pos(x + width / 2, y + height / 2, 0.0f); | ||
1552 | 50 | trans = glm::scale( glm::translate(ident, pos), size); | ||
1553 | 51 | } | 48 | } |
1554 | 52 | 49 | ||
1555 | 53 | float alpha() const override | 50 | float alpha() const override |
1556 | @@ -55,9 +52,9 @@ | |||
1557 | 55 | return opacity; | 52 | return opacity; |
1558 | 56 | } | 53 | } |
1559 | 57 | 54 | ||
1561 | 58 | glm::mat4 const& transformation() const override | 55 | glm::mat4 transformation() const override |
1562 | 59 | { | 56 | { |
1564 | 60 | return trans; | 57 | return glm::mat4(); |
1565 | 61 | } | 58 | } |
1566 | 62 | 59 | ||
1567 | 63 | bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override | 60 | bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override |
1568 | @@ -70,9 +67,34 @@ | |||
1569 | 70 | return !rectangular; | 67 | return !rectangular; |
1570 | 71 | } | 68 | } |
1571 | 72 | 69 | ||
1572 | 70 | void set_buffer(std::shared_ptr<graphics::Buffer> b) | ||
1573 | 71 | { | ||
1574 | 72 | buf = b; | ||
1575 | 73 | } | ||
1576 | 74 | |||
1577 | 75 | std::shared_ptr<graphics::Buffer> buffer(unsigned long) const override | ||
1578 | 76 | { | ||
1579 | 77 | return buf; | ||
1580 | 78 | } | ||
1581 | 79 | |||
1582 | 80 | bool alpha_enabled() const override | ||
1583 | 81 | { | ||
1584 | 82 | return shaped() || alpha() < 1.0f; | ||
1585 | 83 | } | ||
1586 | 84 | |||
1587 | 85 | geometry::Rectangle screen_position() const override | ||
1588 | 86 | { | ||
1589 | 87 | return rect; | ||
1590 | 88 | } | ||
1591 | 89 | |||
1592 | 90 | int buffers_ready_for_compositor() const override | ||
1593 | 91 | { | ||
1594 | 92 | return 1; | ||
1595 | 93 | } | ||
1596 | 94 | |||
1597 | 73 | private: | 95 | private: |
1598 | 96 | std::shared_ptr<graphics::Buffer> buf; | ||
1599 | 74 | mir::geometry::Rectangle rect; | 97 | mir::geometry::Rectangle rect; |
1600 | 75 | glm::mat4 trans; | ||
1601 | 76 | float opacity; | 98 | float opacity; |
1602 | 77 | bool rectangular; | 99 | bool rectangular; |
1603 | 78 | bool visible; | 100 | bool visible; |
1604 | @@ -82,4 +104,4 @@ | |||
1605 | 82 | } // namespace doubles | 104 | } // namespace doubles |
1606 | 83 | } // namespace test | 105 | } // namespace test |
1607 | 84 | } // namespace mir | 106 | } // namespace mir |
1609 | 85 | #endif // MIR_TEST_DOUBLES_STUB_COMPOSITING_CRITERIA_H_ | 107 | #endif // MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ |
1610 | 86 | 108 | ||
1611 | === modified file 'include/test/mir_test_doubles/mock_android_native_buffer.h' | |||
1612 | --- include/test/mir_test_doubles/mock_android_native_buffer.h 2014-02-10 09:07:48 +0000 | |||
1613 | +++ include/test/mir_test_doubles/mock_android_native_buffer.h 2014-03-17 15:02:33 +0000 | |||
1614 | @@ -20,6 +20,7 @@ | |||
1615 | 20 | #define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_ | 20 | #define MIR_TEST_DOUBLES_MOCK_ANDROID_NATIVE_BUFFER_H_ |
1616 | 21 | 21 | ||
1617 | 22 | #include "mir/graphics/android/native_buffer.h" | 22 | #include "mir/graphics/android/native_buffer.h" |
1618 | 23 | #include "mir/geometry/size.h" | ||
1619 | 23 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
1620 | 24 | 25 | ||
1621 | 25 | namespace mir | 26 | namespace mir |
1622 | @@ -41,6 +42,14 @@ | |||
1623 | 41 | ON_CALL(*this, copy_fence()) | 42 | ON_CALL(*this, copy_fence()) |
1624 | 42 | .WillByDefault(Return(-1)); | 43 | .WillByDefault(Return(-1)); |
1625 | 43 | } | 44 | } |
1626 | 45 | |||
1627 | 46 | MockAndroidNativeBuffer(geometry::Size sz) | ||
1628 | 47 | : MockAndroidNativeBuffer() | ||
1629 | 48 | { | ||
1630 | 49 | stub_anwb.width = sz.width.as_int(); | ||
1631 | 50 | stub_anwb.height = sz.height.as_int(); | ||
1632 | 51 | } | ||
1633 | 52 | |||
1634 | 44 | MOCK_CONST_METHOD0(anwb, ANativeWindowBuffer*()); | 53 | MOCK_CONST_METHOD0(anwb, ANativeWindowBuffer*()); |
1635 | 45 | MOCK_CONST_METHOD0(handle, buffer_handle_t()); | 54 | MOCK_CONST_METHOD0(handle, buffer_handle_t()); |
1636 | 46 | MOCK_CONST_METHOD0(copy_fence, graphics::android::NativeFence()); | 55 | MOCK_CONST_METHOD0(copy_fence, graphics::android::NativeFence()); |
1637 | 47 | 56 | ||
1638 | === modified file 'include/test/mir_test_doubles/mock_buffer_bundle.h' | |||
1639 | --- include/test/mir_test_doubles/mock_buffer_bundle.h 2014-02-10 09:07:48 +0000 | |||
1640 | +++ include/test/mir_test_doubles/mock_buffer_bundle.h 2014-03-17 15:02:33 +0000 | |||
1641 | @@ -48,6 +48,7 @@ | |||
1642 | 48 | MOCK_METHOD0(force_client_abort, void()); | 48 | MOCK_METHOD0(force_client_abort, void()); |
1643 | 49 | MOCK_METHOD0(force_requests_to_complete, void()); | 49 | MOCK_METHOD0(force_requests_to_complete, void()); |
1644 | 50 | MOCK_METHOD1(resize, void(const geometry::Size &)); | 50 | MOCK_METHOD1(resize, void(const geometry::Size &)); |
1645 | 51 | int buffers_ready_for_compositor() const override { return 1; } | ||
1646 | 51 | }; | 52 | }; |
1647 | 52 | 53 | ||
1648 | 53 | } | 54 | } |
1649 | 54 | 55 | ||
1650 | === modified file 'include/test/mir_test_doubles/mock_buffer_stream.h' | |||
1651 | --- include/test/mir_test_doubles/mock_buffer_stream.h 2014-02-10 09:07:48 +0000 | |||
1652 | +++ include/test/mir_test_doubles/mock_buffer_stream.h 2014-03-17 15:02:33 +0000 | |||
1653 | @@ -42,6 +42,7 @@ | |||
1654 | 42 | MOCK_METHOD0(force_client_completion, void()); | 42 | MOCK_METHOD0(force_client_completion, void()); |
1655 | 43 | MOCK_METHOD1(allow_framedropping, void(bool)); | 43 | MOCK_METHOD1(allow_framedropping, void(bool)); |
1656 | 44 | MOCK_METHOD0(force_requests_to_complete, void()); | 44 | MOCK_METHOD0(force_requests_to_complete, void()); |
1657 | 45 | int buffers_ready_for_compositor() const override { return 1; } | ||
1658 | 45 | }; | 46 | }; |
1659 | 46 | } | 47 | } |
1660 | 47 | } | 48 | } |
1661 | 48 | 49 | ||
1662 | === removed file 'include/test/mir_test_doubles/mock_compositing_criteria.h' | |||
1663 | --- include/test/mir_test_doubles/mock_compositing_criteria.h 2014-03-10 19:28:33 +0000 | |||
1664 | +++ include/test/mir_test_doubles/mock_compositing_criteria.h 1970-01-01 00:00:00 +0000 | |||
1665 | @@ -1,45 +0,0 @@ | |||
1666 | 1 | /* | ||
1667 | 2 | * Copyright © 2013 Canonical Ltd. | ||
1668 | 3 | * | ||
1669 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1670 | 5 | * under the terms of the GNU General Public License version 3, | ||
1671 | 6 | * as published by the Free Software Foundation. | ||
1672 | 7 | * | ||
1673 | 8 | * This program is distributed in the hope that it will be useful, | ||
1674 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1675 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1676 | 11 | * GNU General Public License for more details. | ||
1677 | 12 | * | ||
1678 | 13 | * You should have received a copy of the GNU General Public License | ||
1679 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1680 | 15 | * | ||
1681 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
1682 | 17 | */ | ||
1683 | 18 | |||
1684 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_COMPOSITING_CRITERIA_H_ | ||
1685 | 20 | #define MIR_TEST_DOUBLES_MOCK_COMPOSITING_CRITERIA_H_ | ||
1686 | 21 | |||
1687 | 22 | #include "mir/compositor/compositing_criteria.h" | ||
1688 | 23 | #include <gmock/gmock.h> | ||
1689 | 24 | |||
1690 | 25 | namespace mir | ||
1691 | 26 | { | ||
1692 | 27 | namespace test | ||
1693 | 28 | { | ||
1694 | 29 | namespace doubles | ||
1695 | 30 | { | ||
1696 | 31 | |||
1697 | 32 | class MockCompositingCriteria : public compositor::CompositingCriteria | ||
1698 | 33 | { | ||
1699 | 34 | public: | ||
1700 | 35 | ~MockCompositingCriteria() noexcept {} | ||
1701 | 36 | MOCK_CONST_METHOD0(alpha, float()); | ||
1702 | 37 | MOCK_CONST_METHOD0(transformation, glm::mat4 const&()); | ||
1703 | 38 | MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const&)); | ||
1704 | 39 | MOCK_CONST_METHOD0(shaped, bool()); | ||
1705 | 40 | }; | ||
1706 | 41 | |||
1707 | 42 | } | ||
1708 | 43 | } | ||
1709 | 44 | } | ||
1710 | 45 | #endif /* MIR_TEST_DOUBLES_MOCK_COMPOSITING_CRITERIA_H_ */ | ||
1711 | 46 | 0 | ||
1712 | === modified file 'include/test/mir_test_doubles/mock_display_device.h' | |||
1713 | --- include/test/mir_test_doubles/mock_display_device.h 2014-02-28 13:51:43 +0000 | |||
1714 | +++ include/test/mir_test_doubles/mock_display_device.h 2014-03-17 15:02:33 +0000 | |||
1715 | @@ -21,6 +21,7 @@ | |||
1716 | 21 | 21 | ||
1717 | 22 | #include "mir/graphics/buffer.h" | 22 | #include "mir/graphics/buffer.h" |
1718 | 23 | #include "src/platform/graphics/android/display_device.h" | 23 | #include "src/platform/graphics/android/display_device.h" |
1719 | 24 | #include "src/platform/graphics/android/gl_context.h" | ||
1720 | 24 | #include <gmock/gmock.h> | 25 | #include <gmock/gmock.h> |
1721 | 25 | 26 | ||
1722 | 26 | namespace mir | 27 | namespace mir |
1723 | @@ -34,9 +35,11 @@ | |||
1724 | 34 | public: | 35 | public: |
1725 | 35 | ~MockDisplayDevice() noexcept {} | 36 | ~MockDisplayDevice() noexcept {} |
1726 | 36 | MOCK_METHOD1(mode, void(MirPowerMode)); | 37 | MOCK_METHOD1(mode, void(MirPowerMode)); |
1730 | 37 | MOCK_METHOD0(prepare_gl, void()); | 38 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); |
1731 | 38 | MOCK_METHOD1(prepare_gl_and_overlays, void(std::list<std::shared_ptr<graphics::Renderable>> const&)); | 39 | MOCK_METHOD3(render_gl_and_overlays, void( |
1732 | 39 | MOCK_METHOD2(gpu_render, void(EGLDisplay, EGLSurface)); | 40 | graphics::android::SwappingGLContext const&, |
1733 | 41 | std::list<std::shared_ptr<graphics::Renderable>> const&, | ||
1734 | 42 | std::function<void(graphics::Renderable const&)> const&)); | ||
1735 | 40 | MOCK_METHOD1(post, void(graphics::Buffer const&)); | 43 | MOCK_METHOD1(post, void(graphics::Buffer const&)); |
1736 | 41 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); | 44 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); |
1737 | 42 | }; | 45 | }; |
1738 | 43 | 46 | ||
1739 | === modified file 'include/test/mir_test_doubles/mock_gl.h' | |||
1740 | --- include/test/mir_test_doubles/mock_gl.h 2014-02-10 09:07:48 +0000 | |||
1741 | +++ include/test/mir_test_doubles/mock_gl.h 2014-03-17 15:02:33 +0000 | |||
1742 | @@ -61,6 +61,7 @@ | |||
1743 | 61 | MOCK_METHOD3(glDrawArrays, void(GLenum, GLint, GLsizei)); | 61 | MOCK_METHOD3(glDrawArrays, void(GLenum, GLint, GLsizei)); |
1744 | 62 | MOCK_METHOD1(glEnable, void(GLenum)); | 62 | MOCK_METHOD1(glEnable, void(GLenum)); |
1745 | 63 | MOCK_METHOD1(glEnableVertexAttribArray, void(GLuint)); | 63 | MOCK_METHOD1(glEnableVertexAttribArray, void(GLuint)); |
1746 | 64 | MOCK_METHOD0(glFinish, void()); | ||
1747 | 64 | MOCK_METHOD4(glFramebufferRenderbuffer, | 65 | MOCK_METHOD4(glFramebufferRenderbuffer, |
1748 | 65 | void(GLenum, GLenum, GLenum, GLuint)); | 66 | void(GLenum, GLenum, GLenum, GLuint)); |
1749 | 66 | MOCK_METHOD5(glFramebufferTexture2D, | 67 | MOCK_METHOD5(glFramebufferTexture2D, |
1750 | @@ -92,7 +93,8 @@ | |||
1751 | 92 | void(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, | 93 | void(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, |
1752 | 93 | GLenum,const GLvoid*)); | 94 | GLenum,const GLvoid*)); |
1753 | 94 | MOCK_METHOD3(glTexParameteri, void(GLenum, GLenum, GLenum)); | 95 | MOCK_METHOD3(glTexParameteri, void(GLenum, GLenum, GLenum)); |
1755 | 95 | MOCK_METHOD2(glUniform1f, void(GLuint, GLfloat)); | 96 | MOCK_METHOD2(glUniform1f, void(GLint, GLfloat)); |
1756 | 97 | MOCK_METHOD3(glUniform2f, void(GLint, GLfloat, GLfloat)); | ||
1757 | 96 | MOCK_METHOD2(glUniform1i, void(GLint, GLint)); | 98 | MOCK_METHOD2(glUniform1i, void(GLint, GLint)); |
1758 | 97 | MOCK_METHOD4(glUniformMatrix4fv, | 99 | MOCK_METHOD4(glUniformMatrix4fv, |
1759 | 98 | void(GLuint, GLsizei, GLboolean, const GLfloat *)); | 100 | void(GLuint, GLsizei, GLboolean, const GLfloat *)); |
1760 | @@ -101,7 +103,6 @@ | |||
1761 | 101 | void(GLuint, GLint, GLenum, GLboolean, GLsizei, | 103 | void(GLuint, GLint, GLenum, GLboolean, GLsizei, |
1762 | 102 | const GLvoid *)); | 104 | const GLvoid *)); |
1763 | 103 | MOCK_METHOD4(glViewport, void(GLint, GLint, GLsizei, GLsizei)); | 105 | MOCK_METHOD4(glViewport, void(GLint, GLint, GLsizei, GLsizei)); |
1764 | 104 | MOCK_METHOD0(glFinish, void()); | ||
1765 | 105 | }; | 106 | }; |
1766 | 106 | 107 | ||
1767 | 107 | } | 108 | } |
1768 | 108 | 109 | ||
1769 | === added file 'include/test/mir_test_doubles/mock_render_function.h' | |||
1770 | --- include/test/mir_test_doubles/mock_render_function.h 1970-01-01 00:00:00 +0000 | |||
1771 | +++ include/test/mir_test_doubles/mock_render_function.h 2014-03-17 15:02:33 +0000 | |||
1772 | @@ -0,0 +1,40 @@ | |||
1773 | 1 | /* | ||
1774 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1775 | 3 | * | ||
1776 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1777 | 5 | * under the terms of the GNU General Public License version 3, | ||
1778 | 6 | * as published by the Free Software Foundation. | ||
1779 | 7 | * | ||
1780 | 8 | * This program is distributed in the hope that it will be useful, | ||
1781 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1782 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1783 | 11 | * GNU General Public License for more details. | ||
1784 | 12 | * | ||
1785 | 13 | * You should have received a copy of the GNU General Public License | ||
1786 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1787 | 15 | * | ||
1788 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
1789 | 17 | */ | ||
1790 | 18 | |||
1791 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ | ||
1792 | 20 | #define MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ | ||
1793 | 21 | |||
1794 | 22 | #include <mir/graphics/renderable.h> | ||
1795 | 23 | |||
1796 | 24 | namespace mir | ||
1797 | 25 | { | ||
1798 | 26 | namespace test | ||
1799 | 27 | { | ||
1800 | 28 | namespace doubles | ||
1801 | 29 | { | ||
1802 | 30 | |||
1803 | 31 | struct MockRenderFunction | ||
1804 | 32 | { | ||
1805 | 33 | MOCK_METHOD1(called, void(graphics::Renderable const&)); | ||
1806 | 34 | }; | ||
1807 | 35 | |||
1808 | 36 | } | ||
1809 | 37 | } | ||
1810 | 38 | } | ||
1811 | 39 | |||
1812 | 40 | #endif /* MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ */ | ||
1813 | 0 | 41 | ||
1814 | === added file 'include/test/mir_test_doubles/mock_render_function.h.moved' | |||
1815 | --- include/test/mir_test_doubles/mock_render_function.h.moved 1970-01-01 00:00:00 +0000 | |||
1816 | +++ include/test/mir_test_doubles/mock_render_function.h.moved 2014-03-17 15:02:33 +0000 | |||
1817 | @@ -0,0 +1,40 @@ | |||
1818 | 1 | /* | ||
1819 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1820 | 3 | * | ||
1821 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1822 | 5 | * under the terms of the GNU General Public License version 3, | ||
1823 | 6 | * as published by the Free Software Foundation. | ||
1824 | 7 | * | ||
1825 | 8 | * This program is distributed in the hope that it will be useful, | ||
1826 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1827 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1828 | 11 | * GNU General Public License for more details. | ||
1829 | 12 | * | ||
1830 | 13 | * You should have received a copy of the GNU General Public License | ||
1831 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1832 | 15 | * | ||
1833 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
1834 | 17 | */ | ||
1835 | 18 | |||
1836 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ | ||
1837 | 20 | #define MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ | ||
1838 | 21 | |||
1839 | 22 | #include <mir/graphics/renderable.h> | ||
1840 | 23 | |||
1841 | 24 | namespace mir | ||
1842 | 25 | { | ||
1843 | 26 | namespace test | ||
1844 | 27 | { | ||
1845 | 28 | namespace doubles | ||
1846 | 29 | { | ||
1847 | 30 | |||
1848 | 31 | struct MockRenderFunction | ||
1849 | 32 | { | ||
1850 | 33 | MOCK_METHOD1(called, void(graphics::Renderable const&)); | ||
1851 | 34 | }; | ||
1852 | 35 | |||
1853 | 36 | } | ||
1854 | 37 | } | ||
1855 | 38 | } | ||
1856 | 39 | |||
1857 | 40 | #endif /* MIR_TEST_DOUBLES_MOCK_RENDER_FUNCTION_H_ */ | ||
1858 | 0 | 41 | ||
1859 | === modified file 'include/test/mir_test_doubles/mock_renderable.h' | |||
1860 | --- include/test/mir_test_doubles/mock_renderable.h 2014-03-04 04:19:26 +0000 | |||
1861 | +++ include/test/mir_test_doubles/mock_renderable.h 2014-03-17 15:02:33 +0000 | |||
1862 | @@ -19,6 +19,7 @@ | |||
1863 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_ | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_ |
1864 | 20 | #define MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_ | 20 | #define MIR_TEST_DOUBLES_MOCK_RENDERABLE_H_ |
1865 | 21 | 21 | ||
1866 | 22 | #include "mir_test_doubles/stub_buffer.h" | ||
1867 | 22 | #include <mir/graphics/renderable.h> | 23 | #include <mir/graphics/renderable.h> |
1868 | 23 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
1869 | 24 | 25 | ||
1870 | @@ -30,9 +31,21 @@ | |||
1871 | 30 | { | 31 | { |
1872 | 31 | struct MockRenderable : public graphics::Renderable | 32 | struct MockRenderable : public graphics::Renderable |
1873 | 32 | { | 33 | { |
1875 | 33 | MOCK_CONST_METHOD0(buffer, std::shared_ptr<graphics::Buffer>()); | 34 | MockRenderable() |
1876 | 35 | { | ||
1877 | 36 | ON_CALL(*this, screen_position()) | ||
1878 | 37 | .WillByDefault(testing::Return(geometry::Rectangle{{},{}})); | ||
1879 | 38 | ON_CALL(*this, buffer(testing::_)) | ||
1880 | 39 | .WillByDefault(testing::Return(std::make_shared<StubBuffer>())); | ||
1881 | 40 | } | ||
1882 | 41 | MOCK_CONST_METHOD1(buffer, std::shared_ptr<graphics::Buffer>(unsigned long)); | ||
1883 | 34 | MOCK_CONST_METHOD0(alpha_enabled, bool()); | 42 | MOCK_CONST_METHOD0(alpha_enabled, bool()); |
1884 | 35 | MOCK_CONST_METHOD0(screen_position, geometry::Rectangle()); | 43 | MOCK_CONST_METHOD0(screen_position, geometry::Rectangle()); |
1885 | 44 | MOCK_CONST_METHOD0(alpha, float()); | ||
1886 | 45 | MOCK_CONST_METHOD0(transformation, glm::mat4()); | ||
1887 | 46 | MOCK_CONST_METHOD1(should_be_rendered_in, bool(geometry::Rectangle const& rect)); | ||
1888 | 47 | MOCK_CONST_METHOD0(shaped, bool()); | ||
1889 | 48 | int buffers_ready_for_compositor() const override { return 1; } | ||
1890 | 36 | }; | 49 | }; |
1891 | 37 | } | 50 | } |
1892 | 38 | } | 51 | } |
1893 | 39 | 52 | ||
1894 | === modified file 'include/test/mir_test_doubles/mock_renderer.h' | |||
1895 | --- include/test/mir_test_doubles/mock_renderer.h 2014-03-04 04:19:26 +0000 | |||
1896 | +++ include/test/mir_test_doubles/mock_renderer.h 2014-03-17 15:02:33 +0000 | |||
1897 | @@ -18,7 +18,7 @@ | |||
1898 | 18 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDERER_H_ | 18 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDERER_H_ |
1899 | 19 | #define MIR_TEST_DOUBLES_MOCK_RENDERER_H_ | 19 | #define MIR_TEST_DOUBLES_MOCK_RENDERER_H_ |
1900 | 20 | 20 | ||
1902 | 21 | #include "src/server/compositor/renderer.h" | 21 | #include "mir/compositor/renderer.h" |
1903 | 22 | 22 | ||
1904 | 23 | #include <gmock/gmock.h> | 23 | #include <gmock/gmock.h> |
1905 | 24 | 24 | ||
1906 | @@ -34,7 +34,7 @@ | |||
1907 | 34 | MOCK_METHOD1(set_viewport, void(geometry::Rectangle const&)); | 34 | MOCK_METHOD1(set_viewport, void(geometry::Rectangle const&)); |
1908 | 35 | MOCK_METHOD1(set_rotation, void(float)); | 35 | MOCK_METHOD1(set_rotation, void(float)); |
1909 | 36 | MOCK_CONST_METHOD0(begin, void()); | 36 | MOCK_CONST_METHOD0(begin, void()); |
1911 | 37 | MOCK_CONST_METHOD2(render, void(compositor::CompositingCriteria const&, graphics::Buffer&)); | 37 | MOCK_CONST_METHOD2(render, void(graphics::Renderable const&, graphics::Buffer&)); |
1912 | 38 | MOCK_CONST_METHOD0(end, void()); | 38 | MOCK_CONST_METHOD0(end, void()); |
1913 | 39 | MOCK_METHOD0(suspend, void()); | 39 | MOCK_METHOD0(suspend, void()); |
1914 | 40 | 40 | ||
1915 | 41 | 41 | ||
1916 | === added file 'include/test/mir_test_doubles/mock_scene.h' | |||
1917 | --- include/test/mir_test_doubles/mock_scene.h 1970-01-01 00:00:00 +0000 | |||
1918 | +++ include/test/mir_test_doubles/mock_scene.h 2014-03-17 15:02:33 +0000 | |||
1919 | @@ -0,0 +1,48 @@ | |||
1920 | 1 | /* | ||
1921 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1922 | 3 | * | ||
1923 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1924 | 5 | * under the terms of the GNU General Public License version 3, | ||
1925 | 6 | * as published by the Free Software Foundation. | ||
1926 | 7 | * | ||
1927 | 8 | * This program is distributed in the hope that it will be useful, | ||
1928 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1929 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1930 | 11 | * GNU General Public License for more details. | ||
1931 | 12 | * | ||
1932 | 13 | * You should have received a copy of the GNU General Public License | ||
1933 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1934 | 15 | * | ||
1935 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
1936 | 17 | */ | ||
1937 | 18 | |||
1938 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SCENE_H_ | ||
1939 | 20 | #define MIR_TEST_DOUBLES_MOCK_SCENE_H_ | ||
1940 | 21 | |||
1941 | 22 | #include "mir/compositor/scene.h" | ||
1942 | 23 | #include <gmock/gmock.h> | ||
1943 | 24 | |||
1944 | 25 | namespace mir | ||
1945 | 26 | { | ||
1946 | 27 | namespace test | ||
1947 | 28 | { | ||
1948 | 29 | namespace doubles | ||
1949 | 30 | { | ||
1950 | 31 | |||
1951 | 32 | class MockScene : public compositor::Scene | ||
1952 | 33 | { | ||
1953 | 34 | public: | ||
1954 | 35 | MOCK_METHOD2(for_each_if, void(compositor::FilterForScene&, | ||
1955 | 36 | compositor::OperatorForScene&)); | ||
1956 | 37 | MOCK_METHOD2(reverse_for_each_if, void(compositor::FilterForScene&, | ||
1957 | 38 | compositor::OperatorForScene&)); | ||
1958 | 39 | MOCK_METHOD1(set_change_callback, void(std::function<void()> const&)); | ||
1959 | 40 | MOCK_METHOD0(lock, void()); | ||
1960 | 41 | MOCK_METHOD0(unlock, void()); | ||
1961 | 42 | }; | ||
1962 | 43 | |||
1963 | 44 | } // namespace doubles | ||
1964 | 45 | } // namespace test | ||
1965 | 46 | } // namespace mir | ||
1966 | 47 | |||
1967 | 48 | #endif /* MIR_TEST_DOUBLES_MOCK_SCENE_H_ */ | ||
1968 | 0 | 49 | ||
1969 | === modified file 'include/test/mir_test_doubles/mock_screencast.h' | |||
1970 | --- include/test/mir_test_doubles/mock_screencast.h 2014-01-29 18:02:33 +0000 | |||
1971 | +++ include/test/mir_test_doubles/mock_screencast.h 2014-03-17 15:02:33 +0000 | |||
1972 | @@ -33,9 +33,11 @@ | |||
1973 | 33 | class MockScreencast : public frontend::Screencast | 33 | class MockScreencast : public frontend::Screencast |
1974 | 34 | { | 34 | { |
1975 | 35 | public: | 35 | public: |
1977 | 36 | MOCK_METHOD1(create_session, | 36 | MOCK_METHOD3(create_session, |
1978 | 37 | frontend::ScreencastSessionId( | 37 | frontend::ScreencastSessionId( |
1980 | 38 | graphics::DisplayConfigurationOutputId)); | 38 | geometry::Rectangle const&, |
1981 | 39 | geometry::Size const&, | ||
1982 | 40 | MirPixelFormat)); | ||
1983 | 39 | MOCK_METHOD1(destroy_session, void(frontend::ScreencastSessionId)); | 41 | MOCK_METHOD1(destroy_session, void(frontend::ScreencastSessionId)); |
1984 | 40 | MOCK_METHOD1(capture, | 42 | MOCK_METHOD1(capture, |
1985 | 41 | std::shared_ptr<graphics::Buffer>( | 43 | std::shared_ptr<graphics::Buffer>( |
1986 | 42 | 44 | ||
1987 | === added file 'include/test/mir_test_doubles/mock_swapping_gl_context.h' | |||
1988 | --- include/test/mir_test_doubles/mock_swapping_gl_context.h 1970-01-01 00:00:00 +0000 | |||
1989 | +++ include/test/mir_test_doubles/mock_swapping_gl_context.h 2014-03-17 15:02:33 +0000 | |||
1990 | @@ -0,0 +1,39 @@ | |||
1991 | 1 | /* | ||
1992 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1993 | 3 | * | ||
1994 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1995 | 5 | * under the terms of the GNU General Public License version 3, | ||
1996 | 6 | * as published by the Free Software Foundation. | ||
1997 | 7 | * | ||
1998 | 8 | * This program is distributed in the hope that it will be useful, | ||
1999 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2000 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2001 | 11 | * GNU General Public License for more details. | ||
2002 | 12 | * | ||
2003 | 13 | * You should have received a copy of the GNU General Public License | ||
2004 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2005 | 15 | * | ||
2006 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
2007 | 17 | */ | ||
2008 | 18 | |||
2009 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_SWAPPING_GL_CONTEXT_H_ | ||
2010 | 20 | #define MIR_TEST_DOUBLES_MOCK_SWAPPING_GL_CONTEXT_H_ | ||
2011 | 21 | |||
2012 | 22 | #include "src/platform/graphics/android/gl_context.h" | ||
2013 | 23 | |||
2014 | 24 | namespace mir | ||
2015 | 25 | { | ||
2016 | 26 | namespace test | ||
2017 | 27 | { | ||
2018 | 28 | namespace doubles | ||
2019 | 29 | { | ||
2020 | 30 | |||
2021 | 31 | struct MockSwappingGLContext : public graphics::android::SwappingGLContext | ||
2022 | 32 | { | ||
2023 | 33 | MOCK_CONST_METHOD0(swap_buffers, void()); | ||
2024 | 34 | }; | ||
2025 | 35 | |||
2026 | 36 | } | ||
2027 | 37 | } | ||
2028 | 38 | } | ||
2029 | 39 | #endif // MIR_TEST_DOUBLES_MOCK_COMPOSITING_CRITERIA_H_ | ||
2030 | 0 | 40 | ||
2031 | === modified file 'include/test/mir_test_doubles/null_display_configuration.h' | |||
2032 | --- include/test/mir_test_doubles/null_display_configuration.h 2014-03-05 02:30:30 +0000 | |||
2033 | +++ include/test/mir_test_doubles/null_display_configuration.h 2014-03-17 15:02:33 +0000 | |||
2034 | @@ -35,7 +35,7 @@ | |||
2035 | 35 | void for_each_output(std::function<void(graphics::DisplayConfigurationOutput const&)>) const override | 35 | void for_each_output(std::function<void(graphics::DisplayConfigurationOutput const&)>) const override |
2036 | 36 | { | 36 | { |
2037 | 37 | } | 37 | } |
2039 | 38 | void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t, MirPixelFormat, MirPowerMode, MirOrientation) override | 38 | void for_each_output(std::function<void(graphics::UserDisplayConfigurationOutput&)>) override |
2040 | 39 | { | 39 | { |
2041 | 40 | } | 40 | } |
2042 | 41 | }; | 41 | }; |
2043 | 42 | 42 | ||
2044 | === modified file 'include/test/mir_test_doubles/null_screencast.h' | |||
2045 | --- include/test/mir_test_doubles/null_screencast.h 2014-01-29 18:02:33 +0000 | |||
2046 | +++ include/test/mir_test_doubles/null_screencast.h 2014-03-17 15:02:33 +0000 | |||
2047 | @@ -32,7 +32,9 @@ | |||
2048 | 32 | { | 32 | { |
2049 | 33 | public: | 33 | public: |
2050 | 34 | frontend::ScreencastSessionId create_session( | 34 | frontend::ScreencastSessionId create_session( |
2052 | 35 | graphics::DisplayConfigurationOutputId) | 35 | geometry::Rectangle const&, |
2053 | 36 | geometry::Size const&, | ||
2054 | 37 | MirPixelFormat) | ||
2055 | 36 | { | 38 | { |
2056 | 37 | return frontend::ScreencastSessionId{1}; | 39 | return frontend::ScreencastSessionId{1}; |
2057 | 38 | } | 40 | } |
2058 | 39 | 41 | ||
2059 | === modified file 'include/test/mir_test_doubles/stub_buffer.h' | |||
2060 | --- include/test/mir_test_doubles/stub_buffer.h 2014-03-04 04:19:26 +0000 | |||
2061 | +++ include/test/mir_test_doubles/stub_buffer.h 2014-03-17 15:02:33 +0000 | |||
2062 | @@ -39,20 +39,31 @@ | |||
2063 | 39 | { | 39 | { |
2064 | 40 | public: | 40 | public: |
2065 | 41 | StubBuffer() | 41 | StubBuffer() |
2068 | 42 | : buf_size{0, 0}, | 42 | : StubBuffer{ |
2069 | 43 | buf_pixel_format{mir_pixel_format_abgr_8888} | 43 | graphics::BufferProperties{ |
2070 | 44 | geometry::Size{}, | ||
2071 | 45 | mir_pixel_format_abgr_8888, | ||
2072 | 46 | graphics::BufferUsage::hardware}} | ||
2073 | 47 | |||
2074 | 44 | { | 48 | { |
2075 | 45 | } | 49 | } |
2076 | 46 | 50 | ||
2077 | 47 | StubBuffer(graphics::BufferProperties const& properties) | 51 | StubBuffer(graphics::BufferProperties const& properties) |
2078 | 52 | : StubBuffer{properties, geometry::Stride{}} | ||
2079 | 53 | { | ||
2080 | 54 | } | ||
2081 | 55 | |||
2082 | 56 | StubBuffer(graphics::BufferProperties const& properties, | ||
2083 | 57 | geometry::Stride stride) | ||
2084 | 48 | : buf_size{properties.size}, | 58 | : buf_size{properties.size}, |
2086 | 49 | buf_pixel_format{properties.format} | 59 | buf_pixel_format{properties.format}, |
2087 | 60 | buf_stride{stride} | ||
2088 | 50 | { | 61 | { |
2089 | 51 | } | 62 | } |
2090 | 52 | 63 | ||
2091 | 53 | virtual geometry::Size size() const { return buf_size; } | 64 | virtual geometry::Size size() const { return buf_size; } |
2092 | 54 | 65 | ||
2094 | 55 | virtual geometry::Stride stride() const { return geometry::Stride(); } | 66 | virtual geometry::Stride stride() const { return buf_stride; } |
2095 | 56 | 67 | ||
2096 | 57 | virtual MirPixelFormat pixel_format() const { return buf_pixel_format; } | 68 | virtual MirPixelFormat pixel_format() const { return buf_pixel_format; } |
2097 | 58 | 69 | ||
2098 | @@ -70,6 +81,7 @@ | |||
2099 | 70 | 81 | ||
2100 | 71 | geometry::Size const buf_size; | 82 | geometry::Size const buf_size; |
2101 | 72 | MirPixelFormat const buf_pixel_format; | 83 | MirPixelFormat const buf_pixel_format; |
2102 | 84 | geometry::Stride const buf_stride; | ||
2103 | 73 | }; | 85 | }; |
2104 | 74 | } | 86 | } |
2105 | 75 | } | 87 | } |
2106 | 76 | 88 | ||
2107 | === modified file 'include/test/mir_test_doubles/stub_buffer_stream.h' | |||
2108 | --- include/test/mir_test_doubles/stub_buffer_stream.h 2014-02-10 09:07:48 +0000 | |||
2109 | +++ include/test/mir_test_doubles/stub_buffer_stream.h 2014-03-17 15:02:33 +0000 | |||
2110 | @@ -72,6 +72,8 @@ | |||
2111 | 72 | { | 72 | { |
2112 | 73 | } | 73 | } |
2113 | 74 | 74 | ||
2114 | 75 | int buffers_ready_for_compositor() const override { return 1; } | ||
2115 | 76 | |||
2116 | 75 | StubBuffer stub_client_buffer; | 77 | StubBuffer stub_client_buffer; |
2117 | 76 | std::shared_ptr<graphics::Buffer> stub_compositor_buffer; | 78 | std::shared_ptr<graphics::Buffer> stub_compositor_buffer; |
2118 | 77 | }; | 79 | }; |
2119 | 78 | 80 | ||
2120 | === modified file 'include/test/mir_test_doubles/stub_display_configuration.h' | |||
2121 | --- include/test/mir_test_doubles/stub_display_configuration.h 2014-03-05 02:30:30 +0000 | |||
2122 | +++ include/test/mir_test_doubles/stub_display_configuration.h 2014-03-17 15:02:33 +0000 | |||
2123 | @@ -156,8 +156,13 @@ | |||
2124 | 156 | } | 156 | } |
2125 | 157 | } | 157 | } |
2126 | 158 | 158 | ||
2128 | 159 | void configure_output(graphics::DisplayConfigurationOutputId, bool, geometry::Point, size_t, MirPixelFormat, MirPowerMode, MirOrientation) override | 159 | void for_each_output(std::function<void(graphics::UserDisplayConfigurationOutput&)> f) override |
2129 | 160 | { | 160 | { |
2130 | 161 | for (auto& disp : outputs) | ||
2131 | 162 | { | ||
2132 | 163 | graphics::UserDisplayConfigurationOutput user(disp); | ||
2133 | 164 | f(user); | ||
2134 | 165 | } | ||
2135 | 161 | } | 166 | } |
2136 | 162 | 167 | ||
2137 | 163 | std::vector<graphics::DisplayConfigurationCard> cards; | 168 | std::vector<graphics::DisplayConfigurationCard> cards; |
2138 | 164 | 169 | ||
2139 | === modified file 'include/test/mir_test_doubles/stub_display_device.h' | |||
2140 | --- include/test/mir_test_doubles/stub_display_device.h 2014-02-11 03:04:50 +0000 | |||
2141 | +++ include/test/mir_test_doubles/stub_display_device.h 2014-03-17 15:02:33 +0000 | |||
2142 | @@ -38,10 +38,13 @@ | |||
2143 | 38 | void mode(MirPowerMode) | 38 | void mode(MirPowerMode) |
2144 | 39 | { | 39 | { |
2145 | 40 | } | 40 | } |
2147 | 41 | void prepare_gl_and_overlays(std::list<std::shared_ptr<graphics::Renderable>> const&) | 41 | void render_gl_and_overlays( |
2148 | 42 | graphics::android::SwappingGLContext const&, | ||
2149 | 43 | std::list<std::shared_ptr<graphics::Renderable>> const&, | ||
2150 | 44 | std::function<void(graphics::Renderable const&)> const&) | ||
2151 | 42 | { | 45 | { |
2152 | 43 | } | 46 | } |
2154 | 44 | void prepare_gl() | 47 | void render_gl(graphics::android::SwappingGLContext const&) |
2155 | 45 | { | 48 | { |
2156 | 46 | } | 49 | } |
2157 | 47 | void gpu_render(EGLDisplay, EGLSurface) | 50 | void gpu_render(EGLDisplay, EGLSurface) |
2158 | 48 | 51 | ||
2159 | === modified file 'include/test/mir_test_doubles/stub_renderable.h' | |||
2160 | --- include/test/mir_test_doubles/stub_renderable.h 2014-03-04 04:19:26 +0000 | |||
2161 | +++ include/test/mir_test_doubles/stub_renderable.h 2014-03-17 15:02:33 +0000 | |||
2162 | @@ -19,6 +19,7 @@ | |||
2163 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_RENDERABLE_H_ | 19 | #ifndef MIR_TEST_DOUBLES_STUB_RENDERABLE_H_ |
2164 | 20 | #define MIR_TEST_DOUBLES_STUB_RENDERABLE_H_ | 20 | #define MIR_TEST_DOUBLES_STUB_RENDERABLE_H_ |
2165 | 21 | 21 | ||
2166 | 22 | #include "mir_test_doubles/stub_buffer.h" | ||
2167 | 22 | #include <mir/graphics/renderable.h> | 23 | #include <mir/graphics/renderable.h> |
2168 | 23 | #include <memory> | 24 | #include <memory> |
2169 | 24 | 25 | ||
2170 | @@ -32,9 +33,9 @@ | |||
2171 | 32 | class StubRenderable : public graphics::Renderable | 33 | class StubRenderable : public graphics::Renderable |
2172 | 33 | { | 34 | { |
2173 | 34 | public: | 35 | public: |
2175 | 35 | std::shared_ptr<graphics::Buffer> buffer() const | 36 | std::shared_ptr<graphics::Buffer> buffer(unsigned long) const override |
2176 | 36 | { | 37 | { |
2178 | 37 | return {}; | 38 | return std::make_shared<StubBuffer>(); |
2179 | 38 | } | 39 | } |
2180 | 39 | bool alpha_enabled() const | 40 | bool alpha_enabled() const |
2181 | 40 | { | 41 | { |
2182 | @@ -44,6 +45,30 @@ | |||
2183 | 44 | { | 45 | { |
2184 | 45 | return {{},{}}; | 46 | return {{},{}}; |
2185 | 46 | } | 47 | } |
2186 | 48 | float alpha() const override | ||
2187 | 49 | { | ||
2188 | 50 | return 1.0f; | ||
2189 | 51 | } | ||
2190 | 52 | glm::mat4 transformation() const override | ||
2191 | 53 | { | ||
2192 | 54 | return trans; | ||
2193 | 55 | } | ||
2194 | 56 | bool should_be_rendered_in(geometry::Rectangle const&) const override | ||
2195 | 57 | { | ||
2196 | 58 | return true; | ||
2197 | 59 | } | ||
2198 | 60 | bool shaped() const override | ||
2199 | 61 | { | ||
2200 | 62 | return false; | ||
2201 | 63 | } | ||
2202 | 64 | |||
2203 | 65 | int buffers_ready_for_compositor() const override | ||
2204 | 66 | { | ||
2205 | 67 | return 1; | ||
2206 | 68 | } | ||
2207 | 69 | |||
2208 | 70 | private: | ||
2209 | 71 | glm::mat4 trans; | ||
2210 | 47 | }; | 72 | }; |
2211 | 48 | 73 | ||
2212 | 49 | } | 74 | } |
2213 | 50 | 75 | ||
2214 | === modified file 'include/test/mir_test_doubles/stub_renderer.h' | |||
2215 | --- include/test/mir_test_doubles/stub_renderer.h 2014-03-04 04:19:26 +0000 | |||
2216 | +++ include/test/mir_test_doubles/stub_renderer.h 2014-03-17 15:02:33 +0000 | |||
2217 | @@ -19,7 +19,7 @@ | |||
2218 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_RENDERER_H_ | 19 | #ifndef MIR_TEST_DOUBLES_STUB_RENDERER_H_ |
2219 | 20 | #define MIR_TEST_DOUBLES_STUB_RENDERER_H_ | 20 | #define MIR_TEST_DOUBLES_STUB_RENDERER_H_ |
2220 | 21 | 21 | ||
2222 | 22 | #include "src/server/compositor/renderer.h" | 22 | #include "mir/compositor/renderer.h" |
2223 | 23 | 23 | ||
2224 | 24 | namespace mir | 24 | namespace mir |
2225 | 25 | { | 25 | { |
2226 | @@ -43,7 +43,7 @@ | |||
2227 | 43 | { | 43 | { |
2228 | 44 | } | 44 | } |
2229 | 45 | 45 | ||
2231 | 46 | void render(compositor::CompositingCriteria const&, | 46 | void render(graphics::Renderable const&, |
2232 | 47 | graphics::Buffer&) const override | 47 | graphics::Buffer&) const override |
2233 | 48 | { | 48 | { |
2234 | 49 | } | 49 | } |
2235 | 50 | 50 | ||
2236 | === added file 'include/test/mir_test_doubles/stub_swapping_gl_context.h' | |||
2237 | --- include/test/mir_test_doubles/stub_swapping_gl_context.h 1970-01-01 00:00:00 +0000 | |||
2238 | +++ include/test/mir_test_doubles/stub_swapping_gl_context.h 2014-03-17 15:02:33 +0000 | |||
2239 | @@ -0,0 +1,39 @@ | |||
2240 | 1 | /* | ||
2241 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2242 | 3 | * | ||
2243 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2244 | 5 | * under the terms of the GNU General Public License version 3, | ||
2245 | 6 | * as published by the Free Software Foundation. | ||
2246 | 7 | * | ||
2247 | 8 | * This program is distributed in the hope that it will be useful, | ||
2248 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2249 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2250 | 11 | * GNU General Public License for more details. | ||
2251 | 12 | * | ||
2252 | 13 | * You should have received a copy of the GNU General Public License | ||
2253 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2254 | 15 | * | ||
2255 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
2256 | 17 | */ | ||
2257 | 18 | |||
2258 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_SWAPPING_GL_CONTEXT_H_ | ||
2259 | 20 | #define MIR_TEST_DOUBLES_STUB_SWAPPING_GL_CONTEXT_H_ | ||
2260 | 21 | |||
2261 | 22 | #include "src/platform/graphics/android/gl_context.h" | ||
2262 | 23 | |||
2263 | 24 | namespace mir | ||
2264 | 25 | { | ||
2265 | 26 | namespace test | ||
2266 | 27 | { | ||
2267 | 28 | namespace doubles | ||
2268 | 29 | { | ||
2269 | 30 | |||
2270 | 31 | struct StubSwappingGLContext : public graphics::android::SwappingGLContext | ||
2271 | 32 | { | ||
2272 | 33 | void swap_buffers() const {} | ||
2273 | 34 | }; | ||
2274 | 35 | |||
2275 | 36 | } | ||
2276 | 37 | } | ||
2277 | 38 | } | ||
2278 | 39 | #endif // MIR_TEST_DOUBLES_STUB_COMPOSITING_CRITERIA_H_ | ||
2279 | 0 | 40 | ||
2280 | === modified file 'src/client/CMakeLists.txt' | |||
2281 | --- src/client/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
2282 | +++ src/client/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
2283 | @@ -72,6 +72,7 @@ | |||
2284 | 72 | mirsharedinput | 72 | mirsharedinput |
2285 | 73 | mirsharedlogging | 73 | mirsharedlogging |
2286 | 74 | mirsharedenv | 74 | mirsharedenv |
2287 | 75 | mirsharedgeometry | ||
2288 | 75 | mirsharedsharedlibrary | 76 | mirsharedsharedlibrary |
2289 | 76 | mirclientrpc | 77 | mirclientrpc |
2290 | 77 | mirclientlttngstatic | 78 | mirclientlttngstatic |
2291 | 78 | 79 | ||
2292 | === modified file 'src/client/android/CMakeLists.txt' | |||
2293 | --- src/client/android/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
2294 | +++ src/client/android/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
2295 | @@ -26,6 +26,8 @@ | |||
2296 | 26 | ${LIBHARDWARE_LIBRARIES} | 26 | ${LIBHARDWARE_LIBRARIES} |
2297 | 27 | ) | 27 | ) |
2298 | 28 | 28 | ||
2299 | 29 | install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/android) | ||
2300 | 30 | |||
2301 | 29 | if (MIR_TEST_PLATFORM STREQUAL "android") | 31 | if (MIR_TEST_PLATFORM STREQUAL "android") |
2302 | 30 | add_custom_command(TARGET mirclientplatformandroid | 32 | add_custom_command(TARGET mirclientplatformandroid |
2303 | 31 | POST_BUILD | 33 | POST_BUILD |
2304 | @@ -33,6 +35,11 @@ | |||
2305 | 33 | COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirclientplatformandroid> libmirclientplatform.so | 35 | COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirclientplatformandroid> libmirclientplatform.so |
2306 | 34 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} | 36 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
2307 | 35 | ) | 37 | ) |
2308 | 38 | |||
2309 | 39 | install(CODE | ||
2310 | 40 | "execute_process( | ||
2311 | 41 | COMMAND ln -sf mir/clientplatform/android/libmirclientplatform.so | ||
2312 | 42 | WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | ||
2313 | 43 | )" | ||
2314 | 44 | ) | ||
2315 | 36 | endif() | 45 | endif() |
2316 | 37 | |||
2317 | 38 | install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/android) | ||
2318 | 39 | 46 | ||
2319 | === modified file 'src/client/mesa/CMakeLists.txt' | |||
2320 | --- src/client/mesa/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
2321 | +++ src/client/mesa/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
2322 | @@ -27,6 +27,8 @@ | |||
2323 | 27 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} | 27 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
2324 | 28 | ) | 28 | ) |
2325 | 29 | 29 | ||
2326 | 30 | install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/mesa) | ||
2327 | 31 | |||
2328 | 30 | if (MIR_TEST_PLATFORM STREQUAL "mesa") | 32 | if (MIR_TEST_PLATFORM STREQUAL "mesa") |
2329 | 31 | add_custom_command(TARGET mirclientplatformmesa | 33 | add_custom_command(TARGET mirclientplatformmesa |
2330 | 32 | POST_BUILD | 34 | POST_BUILD |
2331 | @@ -34,7 +36,12 @@ | |||
2332 | 34 | COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirclientplatformmesa> libmirclientplatform.so | 36 | COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirclientplatformmesa> libmirclientplatform.so |
2333 | 35 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} | 37 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
2334 | 36 | ) | 38 | ) |
2335 | 39 | |||
2336 | 40 | install(CODE | ||
2337 | 41 | "execute_process( | ||
2338 | 42 | COMMAND ln -sf mir/clientplatform/mesa/libmirclientplatform.so | ||
2339 | 43 | WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | ||
2340 | 44 | )" | ||
2341 | 45 | ) | ||
2342 | 37 | endif() | 46 | endif() |
2343 | 38 | 47 | ||
2344 | 39 | install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/mesa) | ||
2345 | 40 | |||
2346 | 41 | 48 | ||
2347 | === modified file 'src/client/mir_screencast.cpp' | |||
2348 | --- src/client/mir_screencast.cpp 2014-02-10 09:07:48 +0000 | |||
2349 | +++ src/client/mir_screencast.cpp 2014-03-17 15:02:33 +0000 | |||
2350 | @@ -31,23 +31,6 @@ | |||
2351 | 31 | 31 | ||
2352 | 32 | void null_callback(MirScreencast*, void*) {} | 32 | void null_callback(MirScreencast*, void*) {} |
2353 | 33 | 33 | ||
2354 | 34 | geom::Size mir_output_get_size(MirDisplayOutput const& output) | ||
2355 | 35 | { | ||
2356 | 36 | if (output.connected && output.used && | ||
2357 | 37 | output.current_mode < output.num_modes) | ||
2358 | 38 | { | ||
2359 | 39 | auto& current_mode = output.modes[output.current_mode]; | ||
2360 | 40 | return geom::Size{current_mode.horizontal_resolution, | ||
2361 | 41 | current_mode.vertical_resolution}; | ||
2362 | 42 | } | ||
2363 | 43 | else | ||
2364 | 44 | { | ||
2365 | 45 | BOOST_THROW_EXCEPTION( | ||
2366 | 46 | std::runtime_error("Couldn't get size from invalid output")); | ||
2367 | 47 | } | ||
2368 | 48 | } | ||
2369 | 49 | |||
2370 | 50 | |||
2371 | 51 | void populate_buffer_package( | 34 | void populate_buffer_package( |
2372 | 52 | MirBufferPackage& buffer_package, | 35 | MirBufferPackage& buffer_package, |
2373 | 53 | mir::protobuf::Buffer const& protobuf_buffer) | 36 | mir::protobuf::Buffer const& protobuf_buffer) |
2374 | @@ -86,24 +69,38 @@ | |||
2375 | 86 | } | 69 | } |
2376 | 87 | 70 | ||
2377 | 88 | MirScreencast::MirScreencast( | 71 | MirScreencast::MirScreencast( |
2379 | 89 | MirDisplayOutput const& output, | 72 | geom::Rectangle const& region, |
2380 | 73 | geom::Size const& size, | ||
2381 | 74 | MirPixelFormat pixel_format, | ||
2382 | 90 | mir::protobuf::DisplayServer& server, | 75 | mir::protobuf::DisplayServer& server, |
2383 | 91 | std::shared_ptr<mcl::EGLNativeWindowFactory> const& egl_native_window_factory, | 76 | std::shared_ptr<mcl::EGLNativeWindowFactory> const& egl_native_window_factory, |
2384 | 92 | std::shared_ptr<mcl::ClientBufferFactory> const& factory, | 77 | std::shared_ptr<mcl::ClientBufferFactory> const& factory, |
2385 | 93 | mir_screencast_callback callback, void* context) | 78 | mir_screencast_callback callback, void* context) |
2386 | 94 | : server(server), | 79 | : server(server), |
2390 | 95 | output_id{output.output_id}, | 80 | output_size{size}, |
2391 | 96 | output_size{mir_output_get_size(output)}, | 81 | output_format{pixel_format}, |
2389 | 97 | output_format{output.current_format}, | ||
2392 | 98 | egl_native_window_factory{egl_native_window_factory}, | 82 | egl_native_window_factory{egl_native_window_factory}, |
2393 | 99 | buffer_depository{factory, mir::frontend::client_buffer_cache_size} | 83 | buffer_depository{factory, mir::frontend::client_buffer_cache_size} |
2394 | 100 | { | 84 | { |
2395 | 85 | if (output_size.width.as_int() == 0 || | ||
2396 | 86 | output_size.height.as_int() == 0 || | ||
2397 | 87 | region.size.width.as_int() == 0 || | ||
2398 | 88 | region.size.height.as_int() == 0 || | ||
2399 | 89 | pixel_format == mir_pixel_format_invalid) | ||
2400 | 90 | { | ||
2401 | 91 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid parameters")); | ||
2402 | 92 | } | ||
2403 | 101 | protobuf_screencast.set_error("Not initialized"); | 93 | protobuf_screencast.set_error("Not initialized"); |
2404 | 102 | 94 | ||
2405 | 103 | mir::protobuf::ScreencastParameters parameters; | 95 | mir::protobuf::ScreencastParameters parameters; |
2407 | 104 | parameters.set_output_id(output_id); | 96 | |
2408 | 97 | parameters.mutable_region()->set_left(region.top_left.x.as_int()); | ||
2409 | 98 | parameters.mutable_region()->set_top(region.top_left.y.as_int()); | ||
2410 | 99 | parameters.mutable_region()->set_width(region.size.width.as_uint32_t()); | ||
2411 | 100 | parameters.mutable_region()->set_height(region.size.height.as_uint32_t()); | ||
2412 | 105 | parameters.set_width(output_size.width.as_uint32_t()); | 101 | parameters.set_width(output_size.width.as_uint32_t()); |
2413 | 106 | parameters.set_height(output_size.height.as_uint32_t()); | 102 | parameters.set_height(output_size.height.as_uint32_t()); |
2414 | 103 | parameters.set_pixel_format(pixel_format); | ||
2415 | 107 | 104 | ||
2416 | 108 | server.create_screencast( | 105 | server.create_screencast( |
2417 | 109 | nullptr, | 106 | nullptr, |
2418 | @@ -132,7 +129,7 @@ | |||
2419 | 132 | output_size.height.as_int(), | 129 | output_size.height.as_int(), |
2420 | 133 | output_format, | 130 | output_format, |
2421 | 134 | mir_buffer_usage_hardware, | 131 | mir_buffer_usage_hardware, |
2423 | 135 | output_id}; | 132 | mir_display_output_id_invalid}; |
2424 | 136 | } | 133 | } |
2425 | 137 | 134 | ||
2426 | 138 | std::shared_ptr<mcl::ClientBuffer> MirScreencast::get_current_buffer() | 135 | std::shared_ptr<mcl::ClientBuffer> MirScreencast::get_current_buffer() |
2427 | 139 | 136 | ||
2428 | === modified file 'src/client/mir_screencast.h' | |||
2429 | --- src/client/mir_screencast.h 2014-02-10 09:07:48 +0000 | |||
2430 | +++ src/client/mir_screencast.h 2014-03-17 15:02:33 +0000 | |||
2431 | @@ -25,6 +25,7 @@ | |||
2432 | 25 | #include "mir_toolkit/client_types.h" | 25 | #include "mir_toolkit/client_types.h" |
2433 | 26 | #include "mir_protobuf.pb.h" | 26 | #include "mir_protobuf.pb.h" |
2434 | 27 | #include "mir/geometry/size.h" | 27 | #include "mir/geometry/size.h" |
2435 | 28 | #include "mir/geometry/rectangle.h" | ||
2436 | 28 | 29 | ||
2437 | 29 | #include <EGL/eglplatform.h> | 30 | #include <EGL/eglplatform.h> |
2438 | 30 | 31 | ||
2439 | @@ -42,7 +43,9 @@ | |||
2440 | 42 | { | 43 | { |
2441 | 43 | public: | 44 | public: |
2442 | 44 | MirScreencast( | 45 | MirScreencast( |
2444 | 45 | MirDisplayOutput const& output, | 46 | mir::geometry::Rectangle const& region, |
2445 | 47 | mir::geometry::Size const& size, | ||
2446 | 48 | MirPixelFormat pixel_format, | ||
2447 | 46 | mir::protobuf::DisplayServer& server, | 49 | mir::protobuf::DisplayServer& server, |
2448 | 47 | std::shared_ptr<mir::client::EGLNativeWindowFactory> const& egl_native_window_factory, | 50 | std::shared_ptr<mir::client::EGLNativeWindowFactory> const& egl_native_window_factory, |
2449 | 48 | std::shared_ptr<mir::client::ClientBufferFactory> const& factory, | 51 | std::shared_ptr<mir::client::ClientBufferFactory> const& factory, |
2450 | @@ -75,7 +78,6 @@ | |||
2451 | 75 | mir_screencast_callback callback, void* context); | 78 | mir_screencast_callback callback, void* context); |
2452 | 76 | 79 | ||
2453 | 77 | mir::protobuf::DisplayServer& server; | 80 | mir::protobuf::DisplayServer& server; |
2454 | 78 | uint32_t const output_id; | ||
2455 | 79 | mir::geometry::Size const output_size; | 81 | mir::geometry::Size const output_size; |
2456 | 80 | MirPixelFormat const output_format; | 82 | MirPixelFormat const output_format; |
2457 | 81 | std::shared_ptr<mir::client::EGLNativeWindowFactory> const egl_native_window_factory; | 83 | std::shared_ptr<mir::client::EGLNativeWindowFactory> const egl_native_window_factory; |
2458 | 82 | 84 | ||
2459 | === modified file 'src/client/mir_screencast_api.cpp' | |||
2460 | --- src/client/mir_screencast_api.cpp 2014-02-18 02:12:21 +0000 | |||
2461 | +++ src/client/mir_screencast_api.cpp 2014-03-17 15:02:33 +0000 | |||
2462 | @@ -26,25 +26,7 @@ | |||
2463 | 26 | 26 | ||
2464 | 27 | namespace | 27 | namespace |
2465 | 28 | { | 28 | { |
2466 | 29 | |||
2467 | 30 | void null_callback(MirScreencast*, void*) {} | 29 | void null_callback(MirScreencast*, void*) {} |
2468 | 31 | |||
2469 | 32 | MirDisplayOutput& find_display_output( | ||
2470 | 33 | MirDisplayConfiguration const& config, | ||
2471 | 34 | uint32_t output_id) | ||
2472 | 35 | { | ||
2473 | 36 | for (decltype(config.num_outputs) i = 0; i != config.num_outputs; ++i) | ||
2474 | 37 | { | ||
2475 | 38 | if (config.outputs[i].output_id == output_id) | ||
2476 | 39 | { | ||
2477 | 40 | return config.outputs[i]; | ||
2478 | 41 | } | ||
2479 | 42 | } | ||
2480 | 43 | |||
2481 | 44 | BOOST_THROW_EXCEPTION( | ||
2482 | 45 | std::runtime_error("Couldn't find output with supplied id")); | ||
2483 | 46 | } | ||
2484 | 47 | |||
2485 | 48 | } | 30 | } |
2486 | 49 | 31 | ||
2487 | 50 | MirScreencast* mir_connection_create_screencast_sync( | 32 | MirScreencast* mir_connection_create_screencast_sync( |
2488 | @@ -64,9 +46,17 @@ | |||
2489 | 64 | 46 | ||
2490 | 65 | auto const client_platform = connection->get_client_platform(); | 47 | auto const client_platform = connection->get_client_platform(); |
2491 | 66 | 48 | ||
2492 | 49 | mir::geometry::Rectangle const region{ | ||
2493 | 50 | {parameters->region.left, parameters->region.top}, | ||
2494 | 51 | {parameters->region.width, parameters->region.height} | ||
2495 | 52 | }; | ||
2496 | 53 | mir::geometry::Size const size{parameters->width, parameters->height}; | ||
2497 | 54 | |||
2498 | 67 | std::unique_ptr<MirScreencast> screencast_uptr{ | 55 | std::unique_ptr<MirScreencast> screencast_uptr{ |
2499 | 68 | new MirScreencast{ | 56 | new MirScreencast{ |
2501 | 69 | find_display_output(*config, parameters->output_id), | 57 | region, |
2502 | 58 | size, | ||
2503 | 59 | parameters->pixel_format, | ||
2504 | 70 | connection->display_server(), | 60 | connection->display_server(), |
2505 | 71 | client_platform, | 61 | client_platform, |
2506 | 72 | client_platform->create_buffer_factory(), | 62 | client_platform->create_buffer_factory(), |
2507 | 73 | 63 | ||
2508 | === modified file 'src/client/mir_surface.h' | |||
2509 | --- src/client/mir_surface.h 2014-02-10 09:07:48 +0000 | |||
2510 | +++ src/client/mir_surface.h 2014-03-17 15:02:33 +0000 | |||
2511 | @@ -106,8 +106,6 @@ | |||
2512 | 106 | MirPixelFormat convert_ipc_pf_to_geometry(google::protobuf::int32 pf); | 106 | MirPixelFormat convert_ipc_pf_to_geometry(google::protobuf::int32 pf); |
2513 | 107 | void release_cpu_region(); | 107 | void release_cpu_region(); |
2514 | 108 | 108 | ||
2515 | 109 | /* todo: race condition. protobuf does not guarantee that callbacks will be synchronized. potential | ||
2516 | 110 | race in surface, last_buffer_id */ | ||
2517 | 111 | mir::protobuf::DisplayServer::Stub & server; | 109 | mir::protobuf::DisplayServer::Stub & server; |
2518 | 112 | mir::protobuf::Surface surface; | 110 | mir::protobuf::Surface surface; |
2519 | 113 | std::string error_message; | 111 | std::string error_message; |
2520 | 114 | 112 | ||
2521 | === modified file 'src/platform/graphics/CMakeLists.txt' | |||
2522 | --- src/platform/graphics/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
2523 | +++ src/platform/graphics/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
2524 | @@ -10,6 +10,7 @@ | |||
2525 | 10 | display_configuration.cpp | 10 | display_configuration.cpp |
2526 | 11 | buffer_basic.cpp | 11 | buffer_basic.cpp |
2527 | 12 | pixel_format_utils.cpp | 12 | pixel_format_utils.cpp |
2528 | 13 | overlapping_output_grouping.cpp | ||
2529 | 13 | ) | 14 | ) |
2530 | 14 | 15 | ||
2531 | 15 | add_library( | 16 | add_library( |
2532 | 16 | 17 | ||
2533 | === modified file 'src/platform/graphics/android/CMakeLists.txt' | |||
2534 | --- src/platform/graphics/android/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
2535 | +++ src/platform/graphics/android/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
2536 | @@ -32,6 +32,7 @@ | |||
2537 | 32 | interpreter_cache.cpp | 32 | interpreter_cache.cpp |
2538 | 33 | internal_client.cpp | 33 | internal_client.cpp |
2539 | 34 | gl_context.cpp | 34 | gl_context.cpp |
2540 | 35 | real_hwc_wrapper.cpp | ||
2541 | 35 | ) | 36 | ) |
2542 | 36 | 37 | ||
2543 | 37 | set_target_properties( | 38 | set_target_properties( |
2544 | @@ -51,6 +52,8 @@ | |||
2545 | 51 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} | 52 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} |
2546 | 52 | ) | 53 | ) |
2547 | 53 | 54 | ||
2548 | 55 | install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/android) | ||
2549 | 56 | |||
2550 | 54 | if (MIR_TEST_PLATFORM STREQUAL "android") | 57 | if (MIR_TEST_PLATFORM STREQUAL "android") |
2551 | 55 | add_custom_command(TARGET mirplatformgraphicsandroid | 58 | add_custom_command(TARGET mirplatformgraphicsandroid |
2552 | 56 | POST_BUILD | 59 | POST_BUILD |
2553 | @@ -58,6 +61,11 @@ | |||
2554 | 58 | COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> libmirplatformgraphics.so | 61 | COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> libmirplatformgraphics.so |
2555 | 59 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} | 62 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
2556 | 60 | ) | 63 | ) |
2557 | 64 | |||
2558 | 65 | install(CODE | ||
2559 | 66 | "execute_process( | ||
2560 | 67 | COMMAND ln -sf mir/platformgraphics/android/libmirplatformgraphics.so | ||
2561 | 68 | WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | ||
2562 | 69 | )" | ||
2563 | 70 | ) | ||
2564 | 61 | endif() | 71 | endif() |
2565 | 62 | |||
2566 | 63 | install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/android) | ||
2567 | 64 | 72 | ||
2568 | === modified file 'src/platform/graphics/android/android_display.cpp' | |||
2569 | --- src/platform/graphics/android/android_display.cpp 2014-03-05 02:30:30 +0000 | |||
2570 | +++ src/platform/graphics/android/android_display.cpp 2014-03-17 15:02:33 +0000 | |||
2571 | @@ -26,6 +26,8 @@ | |||
2572 | 26 | #include "display_builder.h" | 26 | #include "display_builder.h" |
2573 | 27 | #include "mir/geometry/rectangle.h" | 27 | #include "mir/geometry/rectangle.h" |
2574 | 28 | 28 | ||
2575 | 29 | #include <boost/throw_exception.hpp> | ||
2576 | 30 | |||
2577 | 29 | namespace mga=mir::graphics::android; | 31 | namespace mga=mir::graphics::android; |
2578 | 30 | namespace mg=mir::graphics; | 32 | namespace mg=mir::graphics; |
2579 | 31 | namespace geom=mir::geometry; | 33 | namespace geom=mir::geometry; |
2580 | @@ -57,6 +59,12 @@ | |||
2581 | 57 | 59 | ||
2582 | 58 | void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration) | 60 | void mga::AndroidDisplay::configure(mg::DisplayConfiguration const& configuration) |
2583 | 59 | { | 61 | { |
2584 | 62 | if (!configuration.valid()) | ||
2585 | 63 | { | ||
2586 | 64 | BOOST_THROW_EXCEPTION( | ||
2587 | 65 | std::logic_error("Invalid or inconsistent display configuration")); | ||
2588 | 66 | } | ||
2589 | 67 | |||
2590 | 60 | configuration.for_each_output([&](mg::DisplayConfigurationOutput const& output) | 68 | configuration.for_each_output([&](mg::DisplayConfigurationOutput const& output) |
2591 | 61 | { | 69 | { |
2592 | 62 | display_buffer->configure(output); | 70 | display_buffer->configure(output); |
2593 | 63 | 71 | ||
2594 | === modified file 'src/platform/graphics/android/android_display_configuration.cpp' | |||
2595 | --- src/platform/graphics/android/android_display_configuration.cpp 2014-03-05 02:30:30 +0000 | |||
2596 | +++ src/platform/graphics/android/android_display_configuration.cpp 2014-03-17 15:02:33 +0000 | |||
2597 | @@ -52,10 +52,9 @@ | |||
2598 | 52 | f(configuration); | 52 | f(configuration); |
2599 | 53 | } | 53 | } |
2600 | 54 | 54 | ||
2604 | 55 | void mga::AndroidDisplayConfiguration::configure_output( | 55 | void mga::AndroidDisplayConfiguration::for_each_output(std::function<void(mg::UserDisplayConfigurationOutput&)> f) |
2602 | 56 | mg::DisplayConfigurationOutputId, bool, geom::Point, size_t, | ||
2603 | 57 | MirPixelFormat, MirPowerMode power_mode, MirOrientation orientation) | ||
2605 | 58 | { | 56 | { |
2608 | 59 | configuration.power_mode = power_mode; | 57 | mg::UserDisplayConfigurationOutput user(configuration); |
2609 | 60 | configuration.orientation = orientation; | 58 | f(user); |
2610 | 61 | } | 59 | } |
2611 | 60 | |||
2612 | 62 | 61 | ||
2613 | === modified file 'src/platform/graphics/android/android_display_configuration.h' | |||
2614 | --- src/platform/graphics/android/android_display_configuration.h 2014-03-05 02:30:30 +0000 | |||
2615 | +++ src/platform/graphics/android/android_display_configuration.h 2014-03-17 15:02:33 +0000 | |||
2616 | @@ -37,10 +37,7 @@ | |||
2617 | 37 | 37 | ||
2618 | 38 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const override; | 38 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const override; |
2619 | 39 | void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const override; | 39 | void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const override; |
2624 | 40 | void configure_output(DisplayConfigurationOutputId id, bool used, | 40 | void for_each_output(std::function<void(UserDisplayConfigurationOutput&)> f) override; |
2621 | 41 | geometry::Point top_left, size_t mode_index, | ||
2622 | 42 | MirPixelFormat format, MirPowerMode power_mode, | ||
2623 | 43 | MirOrientation) override; | ||
2625 | 44 | 41 | ||
2626 | 45 | private: | 42 | private: |
2627 | 46 | DisplayConfigurationOutput configuration; | 43 | DisplayConfigurationOutput configuration; |
2628 | 47 | 44 | ||
2629 | === modified file 'src/platform/graphics/android/display_buffer.cpp' | |||
2630 | --- src/platform/graphics/android/display_buffer.cpp 2014-02-28 13:51:43 +0000 | |||
2631 | +++ src/platform/graphics/android/display_buffer.cpp 2014-03-17 15:02:33 +0000 | |||
2632 | @@ -85,35 +85,29 @@ | |||
2633 | 85 | } | 85 | } |
2634 | 86 | 86 | ||
2635 | 87 | void mga::DisplayBuffer::render_and_post_update( | 87 | void mga::DisplayBuffer::render_and_post_update( |
2638 | 88 | std::list<std::shared_ptr<Renderable>> const& renderlist, | 88 | std::list<std::shared_ptr<Renderable>> const& renderlist, |
2639 | 89 | std::function<void(Renderable const&)> const& render_fn) | 89 | std::function<void(Renderable const&)> const& render_fn) |
2640 | 90 | { | 90 | { |
2641 | 91 | if (renderlist.empty()) | 91 | if (renderlist.empty()) |
2642 | 92 | { | 92 | { |
2644 | 93 | display_device->prepare_gl(); | 93 | display_device->render_gl(gl_context); |
2645 | 94 | } | 94 | } |
2646 | 95 | else | 95 | else |
2647 | 96 | { | 96 | { |
2657 | 97 | display_device->prepare_gl_and_overlays(renderlist); | 97 | display_device->render_gl_and_overlays(gl_context, renderlist, render_fn); |
2658 | 98 | } | 98 | } |
2659 | 99 | 99 | ||
2660 | 100 | for(auto& renderable : renderlist) | 100 | post(); |
2652 | 101 | { | ||
2653 | 102 | render_fn(*renderable); | ||
2654 | 103 | } | ||
2655 | 104 | |||
2656 | 105 | render_and_post(); | ||
2661 | 106 | } | 101 | } |
2662 | 107 | 102 | ||
2663 | 108 | void mga::DisplayBuffer::post_update() | 103 | void mga::DisplayBuffer::post_update() |
2664 | 109 | { | 104 | { |
2667 | 110 | display_device->prepare_gl(); | 105 | display_device->render_gl(gl_context); |
2668 | 111 | render_and_post(); | 106 | post(); |
2669 | 112 | } | 107 | } |
2670 | 113 | 108 | ||
2672 | 114 | void mga::DisplayBuffer::render_and_post() | 109 | void mga::DisplayBuffer::post() |
2673 | 115 | { | 110 | { |
2674 | 116 | display_device->gpu_render(gl_context.display(), gl_context.surface()); | ||
2675 | 117 | auto last_rendered = fb_bundle->last_rendered_buffer(); | 111 | auto last_rendered = fb_bundle->last_rendered_buffer(); |
2676 | 118 | display_device->post(*last_rendered); | 112 | display_device->post(*last_rendered); |
2677 | 119 | } | 113 | } |
2678 | 120 | 114 | ||
2679 | === modified file 'src/platform/graphics/android/display_buffer.h' | |||
2680 | --- src/platform/graphics/android/display_buffer.h 2014-02-28 13:51:43 +0000 | |||
2681 | +++ src/platform/graphics/android/display_buffer.h 2014-03-17 15:02:33 +0000 | |||
2682 | @@ -58,7 +58,7 @@ | |||
2683 | 58 | void configure(DisplayConfigurationOutput const&); | 58 | void configure(DisplayConfigurationOutput const&); |
2684 | 59 | 59 | ||
2685 | 60 | private: | 60 | private: |
2687 | 61 | void render_and_post(); | 61 | void post(); |
2688 | 62 | 62 | ||
2689 | 63 | std::shared_ptr<FramebufferBundle> const fb_bundle; | 63 | std::shared_ptr<FramebufferBundle> const fb_bundle; |
2690 | 64 | std::shared_ptr<DisplayDevice> const display_device; | 64 | std::shared_ptr<DisplayDevice> const display_device; |
2691 | 65 | 65 | ||
2692 | === modified file 'src/platform/graphics/android/display_device.h' | |||
2693 | --- src/platform/graphics/android/display_device.h 2014-02-28 13:51:43 +0000 | |||
2694 | +++ src/platform/graphics/android/display_device.h 2014-03-17 15:02:33 +0000 | |||
2695 | @@ -33,6 +33,7 @@ | |||
2696 | 33 | 33 | ||
2697 | 34 | namespace android | 34 | namespace android |
2698 | 35 | { | 35 | { |
2699 | 36 | class SwappingGLContext; | ||
2700 | 36 | 37 | ||
2701 | 37 | class DisplayDevice | 38 | class DisplayDevice |
2702 | 38 | { | 39 | { |
2703 | @@ -40,9 +41,11 @@ | |||
2704 | 40 | virtual ~DisplayDevice() = default; | 41 | virtual ~DisplayDevice() = default; |
2705 | 41 | 42 | ||
2706 | 42 | virtual void mode(MirPowerMode mode) = 0; | 43 | virtual void mode(MirPowerMode mode) = 0; |
2710 | 43 | virtual void prepare_gl() = 0; | 44 | virtual void render_gl(SwappingGLContext const& context) = 0; |
2711 | 44 | virtual void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list) = 0; | 45 | virtual void render_gl_and_overlays( |
2712 | 45 | virtual void gpu_render(EGLDisplay dpy, EGLSurface sur) = 0; | 46 | SwappingGLContext const& context, |
2713 | 47 | std::list<std::shared_ptr<Renderable>> const& list, | ||
2714 | 48 | std::function<void(Renderable const&)> const& render_fn) = 0; | ||
2715 | 46 | virtual void post(Buffer const& buffer) = 0; | 49 | virtual void post(Buffer const& buffer) = 0; |
2716 | 47 | virtual bool apply_orientation(MirOrientation orientation) const = 0; | 50 | virtual bool apply_orientation(MirOrientation orientation) const = 0; |
2717 | 48 | 51 | ||
2718 | 49 | 52 | ||
2719 | === modified file 'src/platform/graphics/android/fb_device.cpp' | |||
2720 | --- src/platform/graphics/android/fb_device.cpp 2014-02-28 13:51:43 +0000 | |||
2721 | +++ src/platform/graphics/android/fb_device.cpp 2014-03-17 15:02:33 +0000 | |||
2722 | @@ -19,6 +19,7 @@ | |||
2723 | 19 | #include "mir/graphics/buffer.h" | 19 | #include "mir/graphics/buffer.h" |
2724 | 20 | #include "mir/graphics/android/native_buffer.h" | 20 | #include "mir/graphics/android/native_buffer.h" |
2725 | 21 | #include "mir/graphics/android/sync_fence.h" | 21 | #include "mir/graphics/android/sync_fence.h" |
2726 | 22 | #include "gl_context.h" | ||
2727 | 22 | #include "android_format_conversion-inl.h" | 23 | #include "android_format_conversion-inl.h" |
2728 | 23 | #include "fb_device.h" | 24 | #include "fb_device.h" |
2729 | 24 | #include "framebuffer_bundle.h" | 25 | #include "framebuffer_bundle.h" |
2730 | @@ -43,20 +44,20 @@ | |||
2731 | 43 | mode(mir_power_mode_on); | 44 | mode(mir_power_mode_on); |
2732 | 44 | } | 45 | } |
2733 | 45 | 46 | ||
2748 | 46 | void mga::FBDevice::prepare_gl() | 47 | void mga::FBDevice::render_gl(SwappingGLContext const& context) |
2749 | 47 | { | 48 | { |
2750 | 48 | } | 49 | context.swap_buffers(); |
2751 | 49 | 50 | } | |
2752 | 50 | void mga::FBDevice::prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const&) | 51 | |
2753 | 51 | { | 52 | void mga::FBDevice::render_gl_and_overlays( |
2754 | 52 | } | 53 | SwappingGLContext const& context, |
2755 | 53 | 54 | std::list<std::shared_ptr<Renderable>> const& renderables, | |
2756 | 54 | void mga::FBDevice::gpu_render(EGLDisplay dpy, EGLSurface sur) | 55 | std::function<void(Renderable const&)> const& render_fn) |
2757 | 55 | { | 56 | { |
2758 | 56 | if (eglSwapBuffers(dpy, sur) == EGL_FALSE) | 57 | for(auto const& renderable : renderables) |
2759 | 57 | { | 58 | render_fn(*renderable); |
2760 | 58 | BOOST_THROW_EXCEPTION(std::runtime_error("eglSwapBuffers failure\n")); | 59 | |
2761 | 59 | } | 60 | context.swap_buffers(); |
2762 | 60 | } | 61 | } |
2763 | 61 | 62 | ||
2764 | 62 | void mga::FBDevice::post(mg::Buffer const& buffer) | 63 | void mga::FBDevice::post(mg::Buffer const& buffer) |
2765 | 63 | 64 | ||
2766 | === modified file 'src/platform/graphics/android/fb_device.h' | |||
2767 | --- src/platform/graphics/android/fb_device.h 2014-02-28 13:51:43 +0000 | |||
2768 | +++ src/platform/graphics/android/fb_device.h 2014-03-17 15:02:33 +0000 | |||
2769 | @@ -37,9 +37,11 @@ | |||
2770 | 37 | 37 | ||
2771 | 38 | bool apply_orientation(MirOrientation orientation) const; | 38 | bool apply_orientation(MirOrientation orientation) const; |
2772 | 39 | void mode(MirPowerMode mode); | 39 | void mode(MirPowerMode mode); |
2776 | 40 | void prepare_gl(); | 40 | virtual void render_gl(SwappingGLContext const& context); |
2777 | 41 | void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list); | 41 | virtual void render_gl_and_overlays( |
2778 | 42 | void gpu_render(EGLDisplay dpy, EGLSurface sur); | 42 | SwappingGLContext const& context, |
2779 | 43 | std::list<std::shared_ptr<Renderable>> const& list, | ||
2780 | 44 | std::function<void(Renderable const&)> const& render_fn); | ||
2781 | 43 | void post(Buffer const& buffer); | 45 | void post(Buffer const& buffer); |
2782 | 44 | 46 | ||
2783 | 45 | private: | 47 | private: |
2784 | 46 | 48 | ||
2785 | === modified file 'src/platform/graphics/android/gl_context.cpp' | |||
2786 | --- src/platform/graphics/android/gl_context.cpp 2014-01-22 10:03:11 +0000 | |||
2787 | +++ src/platform/graphics/android/gl_context.cpp 2014-03-17 15:02:33 +0000 | |||
2788 | @@ -23,6 +23,7 @@ | |||
2789 | 23 | #include <algorithm> | 23 | #include <algorithm> |
2790 | 24 | #include <boost/throw_exception.hpp> | 24 | #include <boost/throw_exception.hpp> |
2791 | 25 | #include <stdexcept> | 25 | #include <stdexcept> |
2792 | 26 | #include <sstream> | ||
2793 | 26 | 27 | ||
2794 | 27 | namespace mg=mir::graphics; | 28 | namespace mg=mir::graphics; |
2795 | 28 | namespace mga=mir::graphics::android; | 29 | namespace mga=mir::graphics::android; |
2796 | @@ -145,6 +146,17 @@ | |||
2797 | 145 | eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | 146 | eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
2798 | 146 | } | 147 | } |
2799 | 147 | 148 | ||
2800 | 149 | void mga::GLContext::swap_buffers() const | ||
2801 | 150 | { | ||
2802 | 151 | eglGetError(); | ||
2803 | 152 | if (eglSwapBuffers(egl_display, egl_surface) == EGL_FALSE) | ||
2804 | 153 | { | ||
2805 | 154 | std::stringstream sstream; | ||
2806 | 155 | sstream << "eglSwapBuffers failure: EGL error code " << std::hex << eglGetError(); | ||
2807 | 156 | BOOST_THROW_EXCEPTION(std::runtime_error(sstream.str())); | ||
2808 | 157 | } | ||
2809 | 158 | } | ||
2810 | 159 | |||
2811 | 148 | mga::GLContext::~GLContext() | 160 | mga::GLContext::~GLContext() |
2812 | 149 | { | 161 | { |
2813 | 150 | if (eglGetCurrentContext() == egl_context) | 162 | if (eglGetCurrentContext() == egl_context) |
2814 | 151 | 163 | ||
2815 | === modified file 'src/platform/graphics/android/gl_context.h' | |||
2816 | --- src/platform/graphics/android/gl_context.h 2014-01-22 10:03:11 +0000 | |||
2817 | +++ src/platform/graphics/android/gl_context.h 2014-03-17 15:02:33 +0000 | |||
2818 | @@ -36,7 +36,20 @@ | |||
2819 | 36 | EGLSurface create_dummy_pbuffer_surface(EGLDisplay, EGLConfig); | 36 | EGLSurface create_dummy_pbuffer_surface(EGLDisplay, EGLConfig); |
2820 | 37 | EGLSurface create_window_surface(EGLDisplay, EGLConfig, EGLNativeWindowType); | 37 | EGLSurface create_window_surface(EGLDisplay, EGLConfig, EGLNativeWindowType); |
2821 | 38 | 38 | ||
2823 | 39 | class GLContext : public graphics::GLContext | 39 | class SwappingGLContext |
2824 | 40 | { | ||
2825 | 41 | public: | ||
2826 | 42 | virtual ~SwappingGLContext() = default; | ||
2827 | 43 | virtual void swap_buffers() const = 0; | ||
2828 | 44 | |||
2829 | 45 | protected: | ||
2830 | 46 | SwappingGLContext() = default; | ||
2831 | 47 | SwappingGLContext(SwappingGLContext const&) = delete; | ||
2832 | 48 | SwappingGLContext& operator=(SwappingGLContext const&) = delete; | ||
2833 | 49 | }; | ||
2834 | 50 | |||
2835 | 51 | class GLContext : public SwappingGLContext, | ||
2836 | 52 | public graphics::GLContext | ||
2837 | 40 | { | 53 | { |
2838 | 41 | public: | 54 | public: |
2839 | 42 | //For creating a gl context | 55 | //For creating a gl context |
2840 | @@ -49,19 +62,9 @@ | |||
2841 | 49 | ~GLContext(); | 62 | ~GLContext(); |
2842 | 50 | 63 | ||
2843 | 51 | void make_current() const override; | 64 | void make_current() const override; |
2845 | 52 | void swap_buffers(); | 65 | void swap_buffers() const override; |
2846 | 53 | void release_current() const override; | 66 | void release_current() const override; |
2847 | 54 | 67 | ||
2848 | 55 | /* TODO: (kdub) remove these two functions once HWC1.0 construction is sorted out. */ | ||
2849 | 56 | EGLDisplay display() | ||
2850 | 57 | { | ||
2851 | 58 | return egl_display; | ||
2852 | 59 | } | ||
2853 | 60 | EGLSurface surface() | ||
2854 | 61 | { | ||
2855 | 62 | return egl_surface; | ||
2856 | 63 | } | ||
2857 | 64 | |||
2858 | 65 | private: | 68 | private: |
2859 | 66 | EGLDisplay const egl_display; | 69 | EGLDisplay const egl_display; |
2860 | 67 | bool const own_display; | 70 | bool const own_display; |
2861 | 68 | 71 | ||
2862 | === modified file 'src/platform/graphics/android/hwc_device.cpp' | |||
2863 | --- src/platform/graphics/android/hwc_device.cpp 2014-02-11 03:04:50 +0000 | |||
2864 | +++ src/platform/graphics/android/hwc_device.cpp 2014-03-17 15:02:33 +0000 | |||
2865 | @@ -17,83 +17,122 @@ | |||
2866 | 17 | * Kevin DuBois <kevin.dubois@canonical.com> | 17 | * Kevin DuBois <kevin.dubois@canonical.com> |
2867 | 18 | */ | 18 | */ |
2868 | 19 | 19 | ||
2869 | 20 | #include "gl_context.h" | ||
2870 | 20 | #include "hwc_device.h" | 21 | #include "hwc_device.h" |
2871 | 21 | #include "hwc_layerlist.h" | 22 | #include "hwc_layerlist.h" |
2872 | 22 | #include "hwc_vsync_coordinator.h" | 23 | #include "hwc_vsync_coordinator.h" |
2873 | 23 | #include "framebuffer_bundle.h" | 24 | #include "framebuffer_bundle.h" |
2874 | 24 | #include "buffer.h" | 25 | #include "buffer.h" |
2875 | 25 | #include "mir/graphics/android/native_buffer.h" | ||
2876 | 26 | #include "mir/graphics/buffer.h" | 26 | #include "mir/graphics/buffer.h" |
2877 | 27 | 27 | ||
2878 | 28 | #include <EGL/eglext.h> | ||
2879 | 29 | #include <boost/throw_exception.hpp> | ||
2880 | 30 | #include <stdexcept> | ||
2881 | 31 | |||
2882 | 32 | namespace mg = mir::graphics; | 28 | namespace mg = mir::graphics; |
2883 | 33 | namespace mga=mir::graphics::android; | 29 | namespace mga=mir::graphics::android; |
2884 | 34 | namespace geom = mir::geometry; | 30 | namespace geom = mir::geometry; |
2885 | 35 | 31 | ||
2886 | 32 | namespace | ||
2887 | 33 | { | ||
2888 | 34 | static const size_t fbtarget_plus_skip_size = 2; | ||
2889 | 35 | static const size_t fbtarget_size = 1; | ||
2890 | 36 | } | ||
2891 | 37 | |||
2892 | 38 | void mga::HwcDevice::setup_layer_types() | ||
2893 | 39 | { | ||
2894 | 40 | auto it = hwc_list.additional_layers_begin(); | ||
2895 | 41 | auto const num_additional_layers = std::distance(it, hwc_list.end()); | ||
2896 | 42 | switch (num_additional_layers) | ||
2897 | 43 | { | ||
2898 | 44 | case fbtarget_plus_skip_size: | ||
2899 | 45 | it->set_layer_type(mga::LayerType::skip); | ||
2900 | 46 | ++it; | ||
2901 | 47 | case fbtarget_size: | ||
2902 | 48 | it->set_layer_type(mga::LayerType::framebuffer_target); | ||
2903 | 49 | default: | ||
2904 | 50 | break; | ||
2905 | 51 | } | ||
2906 | 52 | } | ||
2907 | 53 | |||
2908 | 54 | void mga::HwcDevice::set_list_framebuffer(mg::Buffer const& buffer) | ||
2909 | 55 | { | ||
2910 | 56 | geom::Rectangle const disp_frame{{0,0}, {buffer.size()}}; | ||
2911 | 57 | for(auto it = hwc_list.additional_layers_begin(); it != hwc_list.end(); it++) | ||
2912 | 58 | { | ||
2913 | 59 | //TODO: the functions on mga::Layer should be consolidated | ||
2914 | 60 | it->set_render_parameters(disp_frame, false); | ||
2915 | 61 | it->set_buffer(buffer); | ||
2916 | 62 | it->prepare_for_draw(); | ||
2917 | 63 | } | ||
2918 | 64 | } | ||
2919 | 65 | |||
2920 | 36 | mga::HwcDevice::HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 66 | mga::HwcDevice::HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
2921 | 67 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, | ||
2922 | 37 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator, | 68 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator, |
2923 | 38 | std::shared_ptr<SyncFileOps> const& sync_ops) | 69 | std::shared_ptr<SyncFileOps> const& sync_ops) |
2924 | 39 | : HWCCommonDevice(hwc_device, coordinator), | 70 | : HWCCommonDevice(hwc_device, coordinator), |
2925 | 71 | hwc_list{{}, 2}, | ||
2926 | 72 | hwc_wrapper(hwc_wrapper), | ||
2927 | 40 | sync_ops(sync_ops) | 73 | sync_ops(sync_ops) |
2928 | 41 | { | 74 | { |
2960 | 42 | } | 75 | setup_layer_types(); |
2961 | 43 | 76 | } | |
2962 | 44 | void mga::HwcDevice::prepare_gl() | 77 | |
2963 | 45 | { | 78 | void mga::HwcDevice::render_gl(SwappingGLContext const& context) |
2964 | 46 | auto rc = 0; | 79 | { |
2965 | 47 | auto display_list = layer_list.native_list().lock(); | 80 | hwc_list.update_list_and_check_if_changed({}, fbtarget_plus_skip_size); |
2966 | 48 | if (display_list) | 81 | setup_layer_types(); |
2967 | 49 | { | 82 | |
2968 | 50 | //note, although we only have a primary display right now, | 83 | list_needs_commit = true; |
2969 | 51 | // set the external and virtual displays to null as some drivers check for that | 84 | |
2970 | 52 | hwc_display_contents_1_t* displays[num_displays] {display_list.get(), nullptr, nullptr}; | 85 | hwc_wrapper->prepare(*hwc_list.native_list().lock()); |
2971 | 53 | rc = hwc_device->prepare(hwc_device.get(), 1, displays); | 86 | |
2972 | 54 | } | 87 | context.swap_buffers(); |
2973 | 55 | 88 | } | |
2974 | 56 | if ((rc != 0) || (!display_list)) | 89 | |
2975 | 57 | { | 90 | void mga::HwcDevice::render_gl_and_overlays( |
2976 | 58 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()")); | 91 | SwappingGLContext const& context, |
2977 | 59 | } | 92 | std::list<std::shared_ptr<Renderable>> const& renderables, |
2978 | 60 | } | 93 | std::function<void(Renderable const&)> const& render_fn) |
2979 | 61 | 94 | { | |
2980 | 62 | void mga::HwcDevice::prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const&) | 95 | if (!(list_needs_commit = hwc_list.update_list_and_check_if_changed(renderables, fbtarget_size))) |
2981 | 63 | { | 96 | return; |
2982 | 64 | prepare_gl(); | 97 | setup_layer_types(); |
2983 | 65 | } | 98 | |
2984 | 66 | 99 | hwc_wrapper->prepare(*hwc_list.native_list().lock()); | |
2985 | 67 | void mga::HwcDevice::gpu_render(EGLDisplay dpy, EGLSurface sur) | 100 | |
2986 | 68 | { | 101 | //draw layers that the HWC did not accept for overlays here |
2987 | 69 | if (eglSwapBuffers(dpy, sur) == EGL_FALSE) | 102 | bool needs_swapbuffers = false; |
2988 | 70 | { | 103 | auto layers_it = hwc_list.begin(); |
2989 | 71 | BOOST_THROW_EXCEPTION(std::runtime_error("eglSwapBuffers failure\n")); | 104 | for(auto const& renderable : renderables) |
2990 | 72 | } | 105 | { |
2991 | 106 | //prepare all layers for draw. | ||
2992 | 107 | layers_it->prepare_for_draw(); | ||
2993 | 108 | |||
2994 | 109 | //trigger GL on the layers that are not overlays | ||
2995 | 110 | if (layers_it->needs_gl_render()) | ||
2996 | 111 | { | ||
2997 | 112 | render_fn(*renderable); | ||
2998 | 113 | needs_swapbuffers = true; | ||
2999 | 114 | } | ||
3000 | 115 | layers_it++; | ||
3001 | 116 | } | ||
3002 | 117 | |||
3003 | 118 | if (needs_swapbuffers) | ||
3004 | 119 | context.swap_buffers(); | ||
3005 | 73 | } | 120 | } |
3006 | 74 | 121 | ||
3007 | 75 | void mga::HwcDevice::post(mg::Buffer const& buffer) | 122 | void mga::HwcDevice::post(mg::Buffer const& buffer) |
3008 | 76 | { | 123 | { |
3009 | 124 | if (!list_needs_commit) | ||
3010 | 125 | return; | ||
3011 | 126 | |||
3012 | 77 | auto lg = lock_unblanked(); | 127 | auto lg = lock_unblanked(); |
3034 | 78 | 128 | set_list_framebuffer(buffer); | |
3035 | 79 | layer_list.set_fb_target(buffer); | 129 | hwc_wrapper->set(*hwc_list.native_list().lock()); |
3036 | 80 | 130 | ||
3037 | 81 | auto rc = 0; | 131 | for(auto& layer : hwc_list) |
3038 | 82 | auto display_list = layer_list.native_list().lock(); | 132 | { |
3039 | 83 | if (display_list) | 133 | layer.update_fence_and_release_buffer(); |
3040 | 84 | { | 134 | } |
3041 | 85 | hwc_display_contents_1_t* displays[num_displays] {display_list.get(), nullptr, nullptr}; | 135 | |
3042 | 86 | rc = hwc_device->set(hwc_device.get(), 1, displays); | 136 | mga::SyncFence retire_fence(sync_ops, hwc_list.retirement_fence()); |
3043 | 87 | 137 | list_needs_commit = false; | |
3023 | 88 | mga::SyncFence retire_fence(sync_ops, layer_list.retirement_fence()); | ||
3024 | 89 | |||
3025 | 90 | int framebuffer_fence = layer_list.fb_target_fence(); | ||
3026 | 91 | auto native_buffer = buffer.native_buffer_handle(); | ||
3027 | 92 | native_buffer->update_fence(framebuffer_fence); | ||
3028 | 93 | } | ||
3029 | 94 | |||
3030 | 95 | if ((rc != 0) || (!display_list)) | ||
3031 | 96 | { | ||
3032 | 97 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()")); | ||
3033 | 98 | } | ||
3044 | 99 | } | 138 | } |
3045 | 100 | 139 | ||
3046 | === modified file 'src/platform/graphics/android/hwc_device.h' | |||
3047 | --- src/platform/graphics/android/hwc_device.h 2014-02-11 03:04:50 +0000 | |||
3048 | +++ src/platform/graphics/android/hwc_device.h 2014-03-17 15:02:33 +0000 | |||
3049 | @@ -36,23 +36,45 @@ | |||
3050 | 36 | class HWCVsyncCoordinator; | 36 | class HWCVsyncCoordinator; |
3051 | 37 | class SyncFileOps; | 37 | class SyncFileOps; |
3052 | 38 | 38 | ||
3053 | 39 | class HwcWrapper | ||
3054 | 40 | { | ||
3055 | 41 | public: | ||
3056 | 42 | virtual ~HwcWrapper() = default; | ||
3057 | 43 | |||
3058 | 44 | virtual void prepare(hwc_display_contents_1_t&) const = 0; | ||
3059 | 45 | virtual void set(hwc_display_contents_1_t&) const = 0; | ||
3060 | 46 | |||
3061 | 47 | protected: | ||
3062 | 48 | HwcWrapper() = default; | ||
3063 | 49 | HwcWrapper& operator=(HwcWrapper const&) = delete; | ||
3064 | 50 | HwcWrapper(HwcWrapper const&) = delete; | ||
3065 | 51 | }; | ||
3066 | 52 | |||
3067 | 39 | class HwcDevice : public HWCCommonDevice | 53 | class HwcDevice : public HWCCommonDevice |
3068 | 40 | { | 54 | { |
3069 | 41 | public: | 55 | public: |
3070 | 56 | //TODO: the first two constructor arguments are redundant. eliminate the 1st one when the 2nd | ||
3071 | 57 | // one can be used by the HWCCommonDevice | ||
3072 | 42 | HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 58 | HwcDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
3073 | 59 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, | ||
3074 | 43 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator, | 60 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator, |
3075 | 44 | std::shared_ptr<SyncFileOps> const& sync_ops); | 61 | std::shared_ptr<SyncFileOps> const& sync_ops); |
3076 | 45 | 62 | ||
3080 | 46 | void prepare_gl(); | 63 | virtual void render_gl(SwappingGLContext const& context); |
3081 | 47 | void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list); | 64 | virtual void render_gl_and_overlays( |
3082 | 48 | void gpu_render(EGLDisplay dpy, EGLSurface sur); | 65 | SwappingGLContext const& context, |
3083 | 66 | std::list<std::shared_ptr<Renderable>> const& list, | ||
3084 | 67 | std::function<void(Renderable const&)> const& render_fn); | ||
3085 | 49 | void post(Buffer const& buffer); | 68 | void post(Buffer const& buffer); |
3086 | 50 | 69 | ||
3087 | 51 | private: | 70 | private: |
3089 | 52 | FBTargetLayerList layer_list; | 71 | LayerList hwc_list; |
3090 | 72 | void set_list_framebuffer(Buffer const&); | ||
3091 | 73 | void setup_layer_types(); | ||
3092 | 53 | 74 | ||
3093 | 75 | std::shared_ptr<HwcWrapper> const hwc_wrapper; | ||
3094 | 54 | std::shared_ptr<SyncFileOps> const sync_ops; | 76 | std::shared_ptr<SyncFileOps> const sync_ops; |
3096 | 55 | static size_t const num_displays{3}; //primary, external, virtual | 77 | bool list_needs_commit{false}; |
3097 | 56 | }; | 78 | }; |
3098 | 57 | 79 | ||
3099 | 58 | } | 80 | } |
3100 | 59 | 81 | ||
3101 | === modified file 'src/platform/graphics/android/hwc_fb_device.cpp' | |||
3102 | --- src/platform/graphics/android/hwc_fb_device.cpp 2014-02-11 03:04:50 +0000 | |||
3103 | +++ src/platform/graphics/android/hwc_fb_device.cpp 2014-03-17 15:02:33 +0000 | |||
3104 | @@ -25,6 +25,7 @@ | |||
3105 | 25 | #include "mir/graphics/android/native_buffer.h" | 25 | #include "mir/graphics/android/native_buffer.h" |
3106 | 26 | 26 | ||
3107 | 27 | #include <boost/throw_exception.hpp> | 27 | #include <boost/throw_exception.hpp> |
3108 | 28 | #include <sstream> | ||
3109 | 28 | #include <stdexcept> | 29 | #include <stdexcept> |
3110 | 29 | 30 | ||
3111 | 30 | namespace mg = mir::graphics; | 31 | namespace mg = mir::graphics; |
3112 | @@ -35,39 +36,20 @@ | |||
3113 | 35 | std::shared_ptr<framebuffer_device_t> const& fb_device, | 36 | std::shared_ptr<framebuffer_device_t> const& fb_device, |
3114 | 36 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator) | 37 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator) |
3115 | 37 | : HWCCommonDevice(hwc_device, coordinator), | 38 | : HWCCommonDevice(hwc_device, coordinator), |
3142 | 38 | fb_device(fb_device) | 39 | fb_device(fb_device), |
3143 | 39 | { | 40 | layer_list{{},1} |
3144 | 40 | } | 41 | { |
3145 | 41 | 42 | layer_list.additional_layers_begin()->set_layer_type(mga::LayerType::skip); | |
3146 | 42 | void mga::HwcFbDevice::prepare_gl() | 43 | } |
3147 | 43 | { | 44 | |
3148 | 44 | auto rc = 0; | 45 | void mga::HwcFbDevice::gpu_render() |
3123 | 45 | auto display_list = layer_list.native_list().lock(); | ||
3124 | 46 | if (display_list) | ||
3125 | 47 | { | ||
3126 | 48 | hwc_display_contents_1_t* displays[num_displays] {display_list.get()}; | ||
3127 | 49 | rc = hwc_device->prepare(hwc_device.get(), num_displays, displays); | ||
3128 | 50 | } | ||
3129 | 51 | |||
3130 | 52 | if ((rc != 0) || (!display_list)) | ||
3131 | 53 | { | ||
3132 | 54 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc prepare()")); | ||
3133 | 55 | } | ||
3134 | 56 | } | ||
3135 | 57 | |||
3136 | 58 | void mga::HwcFbDevice::prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const&) | ||
3137 | 59 | { | ||
3138 | 60 | prepare_gl(); | ||
3139 | 61 | } | ||
3140 | 62 | |||
3141 | 63 | void mga::HwcFbDevice::gpu_render(EGLDisplay dpy, EGLSurface sur) | ||
3149 | 64 | { | 46 | { |
3150 | 65 | auto rc = 0; | 47 | auto rc = 0; |
3151 | 66 | auto display_list = layer_list.native_list().lock(); | 48 | auto display_list = layer_list.native_list().lock(); |
3152 | 67 | if (display_list) | 49 | if (display_list) |
3153 | 68 | { | 50 | { |
3156 | 69 | display_list->dpy = dpy; | 51 | display_list->dpy = eglGetCurrentDisplay(); |
3157 | 70 | display_list->sur = sur; | 52 | display_list->sur = eglGetCurrentSurface(EGL_DRAW); |
3158 | 71 | 53 | ||
3159 | 72 | //set() may affect EGL state by calling eglSwapBuffers. | 54 | //set() may affect EGL state by calling eglSwapBuffers. |
3160 | 73 | //HWC 1.0 is the only version of HWC that can do this. | 55 | //HWC 1.0 is the only version of HWC that can do this. |
3161 | @@ -77,8 +59,46 @@ | |||
3162 | 77 | 59 | ||
3163 | 78 | if ((rc != 0) || (!display_list)) | 60 | if ((rc != 0) || (!display_list)) |
3164 | 79 | { | 61 | { |
3167 | 80 | BOOST_THROW_EXCEPTION(std::runtime_error("error during hwc set()")); | 62 | std::stringstream ss; |
3168 | 81 | } | 63 | ss << "error during hwc set(). rc = " << std::hex << rc; |
3169 | 64 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | ||
3170 | 65 | } | ||
3171 | 66 | } | ||
3172 | 67 | |||
3173 | 68 | void mga::HwcFbDevice::prepare() | ||
3174 | 69 | { | ||
3175 | 70 | auto rc = 0; | ||
3176 | 71 | auto display_list = layer_list.native_list().lock(); | ||
3177 | 72 | if (display_list) | ||
3178 | 73 | { | ||
3179 | 74 | hwc_display_contents_1_t* displays[num_displays] {display_list.get()}; | ||
3180 | 75 | rc = hwc_device->prepare(hwc_device.get(), num_displays, displays); | ||
3181 | 76 | } | ||
3182 | 77 | |||
3183 | 78 | if ((rc != 0) || (!display_list)) | ||
3184 | 79 | { | ||
3185 | 80 | std::stringstream ss; | ||
3186 | 81 | ss << "error during hwc prepare(). rc = " << std::hex << rc; | ||
3187 | 82 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | ||
3188 | 83 | } | ||
3189 | 84 | } | ||
3190 | 85 | |||
3191 | 86 | void mga::HwcFbDevice::render_gl(SwappingGLContext const&) | ||
3192 | 87 | { | ||
3193 | 88 | prepare(); | ||
3194 | 89 | gpu_render(); | ||
3195 | 90 | } | ||
3196 | 91 | |||
3197 | 92 | void mga::HwcFbDevice::render_gl_and_overlays( | ||
3198 | 93 | SwappingGLContext const&, | ||
3199 | 94 | std::list<std::shared_ptr<Renderable>> const& renderables, | ||
3200 | 95 | std::function<void(Renderable const&)> const& render_fn) | ||
3201 | 96 | { | ||
3202 | 97 | prepare(); | ||
3203 | 98 | //TODO: filter this list based on the results of the preparation | ||
3204 | 99 | for(auto const& renderable : renderables) | ||
3205 | 100 | render_fn(*renderable); | ||
3206 | 101 | gpu_render(); | ||
3207 | 82 | } | 102 | } |
3208 | 83 | 103 | ||
3209 | 84 | void mga::HwcFbDevice::post(mg::Buffer const& buffer) | 104 | void mga::HwcFbDevice::post(mg::Buffer const& buffer) |
3210 | 85 | 105 | ||
3211 | === modified file 'src/platform/graphics/android/hwc_fb_device.h' | |||
3212 | --- src/platform/graphics/android/hwc_fb_device.h 2014-02-11 03:04:50 +0000 | |||
3213 | +++ src/platform/graphics/android/hwc_fb_device.h 2014-03-17 15:02:33 +0000 | |||
3214 | @@ -38,12 +38,16 @@ | |||
3215 | 38 | std::shared_ptr<framebuffer_device_t> const& fb_device, | 38 | std::shared_ptr<framebuffer_device_t> const& fb_device, |
3216 | 39 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 39 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
3217 | 40 | 40 | ||
3221 | 41 | void prepare_gl(); | 41 | virtual void render_gl(SwappingGLContext const& context); |
3222 | 42 | void prepare_gl_and_overlays(std::list<std::shared_ptr<Renderable>> const& list); | 42 | virtual void render_gl_and_overlays( |
3223 | 43 | void gpu_render(EGLDisplay dpy, EGLSurface sur); | 43 | SwappingGLContext const& context, |
3224 | 44 | std::list<std::shared_ptr<Renderable>> const& list, | ||
3225 | 45 | std::function<void(Renderable const&)> const& render_fn); | ||
3226 | 44 | void post(Buffer const& buffer); | 46 | void post(Buffer const& buffer); |
3227 | 45 | 47 | ||
3228 | 46 | private: | 48 | private: |
3229 | 49 | void prepare(); | ||
3230 | 50 | void gpu_render(); | ||
3231 | 47 | std::shared_ptr<framebuffer_device_t> const fb_device; | 51 | std::shared_ptr<framebuffer_device_t> const fb_device; |
3232 | 48 | static int const num_displays{1}; | 52 | static int const num_displays{1}; |
3233 | 49 | LayerList layer_list; | 53 | LayerList layer_list; |
3234 | 50 | 54 | ||
3235 | === modified file 'src/platform/graphics/android/hwc_layerlist.cpp' | |||
3236 | --- src/platform/graphics/android/hwc_layerlist.cpp 2014-03-04 04:19:26 +0000 | |||
3237 | +++ src/platform/graphics/android/hwc_layerlist.cpp 2014-03-17 15:02:33 +0000 | |||
3238 | @@ -51,101 +51,95 @@ | |||
3239 | 51 | } | 51 | } |
3240 | 52 | } | 52 | } |
3241 | 53 | 53 | ||
3266 | 54 | void mga::LayerListBase::update_representation(size_t needed_size) | 54 | bool mga::LayerList::update_list_and_check_if_changed( |
3267 | 55 | { | 55 | std::list<std::shared_ptr<mg::Renderable>> const& renderlist, |
3268 | 56 | std::shared_ptr<hwc_display_contents_1_t> new_hwc_representation; | 56 | size_t additional_layers) |
3269 | 57 | std::list<HWCLayer> new_layers; | 57 | { |
3270 | 58 | 58 | size_t needed_size = renderlist.size() + additional_layers; | |
3271 | 59 | if (hwc_representation->numHwLayers != needed_size) | 59 | |
3272 | 60 | { | 60 | bool any_buffer_updated = false; |
3273 | 61 | new_hwc_representation = generate_hwc_list(needed_size); | 61 | if ((!hwc_representation) || hwc_representation->numHwLayers != needed_size) |
3274 | 62 | } | 62 | { |
3275 | 63 | else | 63 | hwc_representation = generate_hwc_list(needed_size); |
3276 | 64 | { | 64 | } |
3277 | 65 | new_hwc_representation = hwc_representation; | 65 | |
3278 | 66 | } | 66 | if (layers.size() == needed_size) |
3279 | 67 | 67 | { | |
3280 | 68 | for (auto i = 0u; i < needed_size; i++) | 68 | auto layers_it = layers.begin(); |
3281 | 69 | { | 69 | for(auto renderable : renderlist) |
3282 | 70 | new_layers.emplace_back(mga::HWCLayer(new_hwc_representation, i)); | 70 | { |
3283 | 71 | } | 71 | layers_it->set_render_parameters( |
3284 | 72 | 72 | renderable->screen_position(), renderable->alpha_enabled()); | |
3285 | 73 | std::swap(new_layers, layers); | 73 | layers_it->set_buffer(*renderable->buffer(1));// TODO: remove needing to know about frameno |
3286 | 74 | hwc_representation = new_hwc_representation; | 74 | any_buffer_updated |= layers_it->needs_hwc_commit(); |
3287 | 75 | } | 75 | layers_it++; |
3288 | 76 | 76 | } | |
3289 | 77 | std::weak_ptr<hwc_display_contents_1_t> mga::LayerListBase::native_list() | 77 | } |
3290 | 78 | else | ||
3291 | 79 | { | ||
3292 | 80 | any_buffer_updated = true; | ||
3293 | 81 | std::list<HWCLayer> new_layers; | ||
3294 | 82 | auto i = 0u; | ||
3295 | 83 | for(auto const& renderable : renderlist) | ||
3296 | 84 | { | ||
3297 | 85 | new_layers.emplace_back( | ||
3298 | 86 | mga::HWCLayer( | ||
3299 | 87 | mga::LayerType::gl_rendered, | ||
3300 | 88 | renderable->screen_position(), | ||
3301 | 89 | renderable->alpha_enabled(), | ||
3302 | 90 | hwc_representation, i++)); | ||
3303 | 91 | new_layers.back().set_buffer(*renderable->buffer(1));// TODO: remove needing to know about frameno | ||
3304 | 92 | } | ||
3305 | 93 | |||
3306 | 94 | for(; i < needed_size; i++) | ||
3307 | 95 | { | ||
3308 | 96 | new_layers.emplace_back(mga::HWCLayer(hwc_representation, i)); | ||
3309 | 97 | } | ||
3310 | 98 | layers = std::move(new_layers); | ||
3311 | 99 | } | ||
3312 | 100 | |||
3313 | 101 | if (additional_layers == 0) | ||
3314 | 102 | { | ||
3315 | 103 | first_additional_layer = layers.end(); | ||
3316 | 104 | } | ||
3317 | 105 | else | ||
3318 | 106 | { | ||
3319 | 107 | first_additional_layer = layers.begin(); | ||
3320 | 108 | std::advance(first_additional_layer, renderlist.size()); | ||
3321 | 109 | } | ||
3322 | 110 | |||
3323 | 111 | return any_buffer_updated; | ||
3324 | 112 | } | ||
3325 | 113 | |||
3326 | 114 | std::list<mga::HWCLayer>::iterator mga::LayerList::begin() | ||
3327 | 115 | { | ||
3328 | 116 | return layers.begin(); | ||
3329 | 117 | } | ||
3330 | 118 | |||
3331 | 119 | std::list<mga::HWCLayer>::iterator mga::LayerList::additional_layers_begin() | ||
3332 | 120 | { | ||
3333 | 121 | return first_additional_layer; | ||
3334 | 122 | } | ||
3335 | 123 | |||
3336 | 124 | std::list<mga::HWCLayer>::iterator mga::LayerList::end() | ||
3337 | 125 | { | ||
3338 | 126 | return layers.end(); | ||
3339 | 127 | } | ||
3340 | 128 | |||
3341 | 129 | std::weak_ptr<hwc_display_contents_1_t> mga::LayerList::native_list() | ||
3342 | 78 | { | 130 | { |
3343 | 79 | return hwc_representation; | 131 | return hwc_representation; |
3344 | 80 | } | 132 | } |
3345 | 81 | 133 | ||
3347 | 82 | mga::NativeFence mga::LayerListBase::retirement_fence() | 134 | mga::NativeFence mga::LayerList::retirement_fence() |
3348 | 83 | { | 135 | { |
3349 | 84 | return hwc_representation->retireFenceFd; | 136 | return hwc_representation->retireFenceFd; |
3350 | 85 | } | 137 | } |
3351 | 86 | 138 | ||
3417 | 87 | mga::LayerListBase::LayerListBase(size_t initial_list_size) | 139 | mga::LayerList::LayerList( |
3418 | 88 | : hwc_representation{generate_hwc_list(initial_list_size)} | 140 | std::list<std::shared_ptr<mg::Renderable>> const& renderlist, |
3419 | 89 | { | 141 | size_t additional_layers) |
3420 | 90 | update_representation(initial_list_size); | 142 | { |
3421 | 91 | } | 143 | update_list_and_check_if_changed(renderlist, additional_layers); |
3422 | 92 | 144 | } | |
3423 | 93 | mga::LayerList::LayerList() | 145 | |
3359 | 94 | : LayerListBase{1} | ||
3360 | 95 | { | ||
3361 | 96 | layers.back().set_layer_type(mga::LayerType::skip); | ||
3362 | 97 | } | ||
3363 | 98 | |||
3364 | 99 | mga::FBTargetLayerList::FBTargetLayerList() | ||
3365 | 100 | : LayerListBase{2} | ||
3366 | 101 | { | ||
3367 | 102 | layers.front().set_layer_type(mga::LayerType::skip); | ||
3368 | 103 | layers.back().set_layer_type(mga::LayerType::framebuffer_target); | ||
3369 | 104 | } | ||
3370 | 105 | |||
3371 | 106 | void mga::FBTargetLayerList::reset_composition_layers() | ||
3372 | 107 | { | ||
3373 | 108 | update_representation(2); | ||
3374 | 109 | |||
3375 | 110 | layers.front().set_layer_type(mga::LayerType::skip); | ||
3376 | 111 | layers.back().set_layer_type(mga::LayerType::framebuffer_target); | ||
3377 | 112 | |||
3378 | 113 | skip_layers_present = true; | ||
3379 | 114 | } | ||
3380 | 115 | |||
3381 | 116 | void mga::FBTargetLayerList::set_composition_layers(std::list<std::shared_ptr<graphics::Renderable>> const& list) | ||
3382 | 117 | { | ||
3383 | 118 | auto const needed_size = list.size() + 1; | ||
3384 | 119 | update_representation(needed_size); | ||
3385 | 120 | |||
3386 | 121 | auto layers_it = layers.begin(); | ||
3387 | 122 | for(auto const& renderable : list) | ||
3388 | 123 | { | ||
3389 | 124 | layers_it->set_layer_type(mga::LayerType::gl_rendered); | ||
3390 | 125 | layers_it->set_render_parameters(renderable->screen_position(), renderable->alpha_enabled()); | ||
3391 | 126 | layers_it->set_buffer(*renderable->buffer()); | ||
3392 | 127 | layers_it++; | ||
3393 | 128 | } | ||
3394 | 129 | |||
3395 | 130 | layers_it->set_layer_type(mga::LayerType::framebuffer_target); | ||
3396 | 131 | skip_layers_present = false; | ||
3397 | 132 | } | ||
3398 | 133 | |||
3399 | 134 | |||
3400 | 135 | void mga::FBTargetLayerList::set_fb_target(mg::Buffer const& buffer) | ||
3401 | 136 | { | ||
3402 | 137 | geom::Rectangle const disp_frame{{0,0}, {buffer.size()}}; | ||
3403 | 138 | if (skip_layers_present) | ||
3404 | 139 | { | ||
3405 | 140 | layers.front().set_render_parameters(disp_frame, false); | ||
3406 | 141 | layers.front().set_buffer(buffer); | ||
3407 | 142 | } | ||
3408 | 143 | |||
3409 | 144 | layers.back().set_render_parameters(disp_frame, false); | ||
3410 | 145 | layers.back().set_buffer(buffer); | ||
3411 | 146 | } | ||
3412 | 147 | |||
3413 | 148 | mga::NativeFence mga::FBTargetLayerList::fb_target_fence() | ||
3414 | 149 | { | ||
3415 | 150 | return layers.back().release_fence(); | ||
3416 | 151 | } | ||
3424 | 152 | 146 | ||
3425 | === modified file 'src/platform/graphics/android/hwc_layerlist.h' | |||
3426 | --- src/platform/graphics/android/hwc_layerlist.h 2014-02-11 03:04:50 +0000 | |||
3427 | +++ src/platform/graphics/android/hwc_layerlist.h 2014-03-17 15:02:33 +0000 | |||
3428 | @@ -39,42 +39,33 @@ | |||
3429 | 39 | namespace android | 39 | namespace android |
3430 | 40 | { | 40 | { |
3431 | 41 | 41 | ||
3433 | 42 | class LayerListBase | 42 | /* this is a partitioned list. renderlist makes up the first renderlist.size() elements |
3434 | 43 | of the list, and there are additional_layers added to the end. | ||
3435 | 44 | std::distance(begin(), additional_layers_begin()) == renderlist.size() | ||
3436 | 45 | std::distance(additional_layers_begin(), end()) == additional_layers | ||
3437 | 46 | std::distance(begin(), end()) == renderlist.size() + additional_layers | ||
3438 | 47 | */ | ||
3439 | 48 | class LayerList | ||
3440 | 43 | { | 49 | { |
3441 | 44 | public: | 50 | public: |
3442 | 51 | LayerList(std::list<std::shared_ptr<Renderable>> const& renderlist, size_t additional_layers); | ||
3443 | 52 | bool update_list_and_check_if_changed( | ||
3444 | 53 | std::list<std::shared_ptr<Renderable>> const& renderlist, | ||
3445 | 54 | size_t additional_layers); | ||
3446 | 55 | |||
3447 | 56 | std::list<HWCLayer>::iterator begin(); | ||
3448 | 57 | std::list<HWCLayer>::iterator additional_layers_begin(); | ||
3449 | 58 | std::list<HWCLayer>::iterator end(); | ||
3450 | 59 | |||
3451 | 45 | std::weak_ptr<hwc_display_contents_1_t> native_list(); | 60 | std::weak_ptr<hwc_display_contents_1_t> native_list(); |
3452 | 46 | NativeFence retirement_fence(); | 61 | NativeFence retirement_fence(); |
3458 | 47 | 62 | private: | |
3459 | 48 | protected: | 63 | LayerList& operator=(LayerList const&) = delete; |
3460 | 49 | LayerListBase(size_t initial_list_size); | 64 | LayerList(LayerList const&) = delete; |
3461 | 50 | 65 | ||
3457 | 51 | void update_representation(size_t needed_size); | ||
3462 | 52 | std::list<HWCLayer> layers; | 66 | std::list<HWCLayer> layers; |
3463 | 53 | |||
3464 | 54 | private: | ||
3465 | 55 | LayerListBase& operator=(LayerListBase const&) = delete; | ||
3466 | 56 | LayerListBase(LayerListBase const&) = delete; | ||
3467 | 57 | |||
3468 | 58 | std::shared_ptr<hwc_display_contents_1_t> hwc_representation; | 67 | std::shared_ptr<hwc_display_contents_1_t> hwc_representation; |
3488 | 59 | }; | 68 | std::list<HWCLayer>::iterator first_additional_layer; |
3470 | 60 | |||
3471 | 61 | class LayerList : public LayerListBase | ||
3472 | 62 | { | ||
3473 | 63 | public: | ||
3474 | 64 | LayerList(); | ||
3475 | 65 | }; | ||
3476 | 66 | |||
3477 | 67 | class FBTargetLayerList : public LayerListBase | ||
3478 | 68 | { | ||
3479 | 69 | public: | ||
3480 | 70 | FBTargetLayerList(); | ||
3481 | 71 | void set_composition_layers(std::list<std::shared_ptr<graphics::Renderable>> const& list); | ||
3482 | 72 | void reset_composition_layers(); | ||
3483 | 73 | NativeFence fb_target_fence(); | ||
3484 | 74 | void set_fb_target(Buffer const&); | ||
3485 | 75 | |||
3486 | 76 | private: | ||
3487 | 77 | bool skip_layers_present{true}; | ||
3489 | 78 | }; | 69 | }; |
3490 | 79 | 70 | ||
3491 | 80 | } | 71 | } |
3492 | 81 | 72 | ||
3493 | === modified file 'src/platform/graphics/android/hwc_layers.cpp' | |||
3494 | --- src/platform/graphics/android/hwc_layers.cpp 2014-02-12 03:14:55 +0000 | |||
3495 | +++ src/platform/graphics/android/hwc_layers.cpp 2014-03-17 15:02:33 +0000 | |||
3496 | @@ -47,7 +47,8 @@ | |||
3497 | 47 | 47 | ||
3498 | 48 | mga::HWCLayer::HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index) | 48 | mga::HWCLayer::HWCLayer(std::shared_ptr<hwc_display_contents_1_t> list, size_t layer_index) |
3499 | 49 | : hwc_layer(&list->hwLayers[layer_index]), | 49 | : hwc_layer(&list->hwLayers[layer_index]), |
3501 | 50 | hwc_list(list) | 50 | hwc_list(list), |
3502 | 51 | associated_buffer(nullptr) //todo: take this as a constructor param | ||
3503 | 51 | { | 52 | { |
3504 | 52 | memset(hwc_layer, 0, sizeof(hwc_layer_1_t)); | 53 | memset(hwc_layer, 0, sizeof(hwc_layer_1_t)); |
3505 | 53 | memset(&visible_rect, 0, sizeof(hwc_rect_t)); | 54 | memset(&visible_rect, 0, sizeof(hwc_rect_t)); |
3506 | @@ -79,9 +80,15 @@ | |||
3507 | 79 | return ((hwc_layer->compositionType == HWC_FRAMEBUFFER) || (hwc_layer->flags == HWC_SKIP_LAYER)); | 80 | return ((hwc_layer->compositionType == HWC_FRAMEBUFFER) || (hwc_layer->flags == HWC_SKIP_LAYER)); |
3508 | 80 | } | 81 | } |
3509 | 81 | 82 | ||
3511 | 82 | mga::NativeFence mga::HWCLayer::release_fence() const | 83 | void mga::HWCLayer::update_fence_and_release_buffer() |
3512 | 83 | { | 84 | { |
3514 | 84 | return hwc_layer->releaseFenceFd; | 85 | if (hwc_layer->compositionType != HWC_FRAMEBUFFER) |
3515 | 86 | { | ||
3516 | 87 | associated_buffer->update_fence(hwc_layer->releaseFenceFd); | ||
3517 | 88 | hwc_layer->releaseFenceFd = -1; | ||
3518 | 89 | hwc_layer->acquireFenceFd = -1; | ||
3519 | 90 | associated_buffer.reset(); | ||
3520 | 91 | } | ||
3521 | 85 | } | 92 | } |
3522 | 86 | 93 | ||
3523 | 87 | void mga::HWCLayer::set_layer_type(LayerType type) | 94 | void mga::HWCLayer::set_layer_type(LayerType type) |
3524 | @@ -129,16 +136,39 @@ | |||
3525 | 129 | 136 | ||
3526 | 130 | void mga::HWCLayer::set_buffer(Buffer const& buffer) | 137 | void mga::HWCLayer::set_buffer(Buffer const& buffer) |
3527 | 131 | { | 138 | { |
3534 | 132 | auto size = buffer.size(); | 139 | associated_buffer.reset(); |
3535 | 133 | auto native_buffer = buffer.native_buffer_handle(); | 140 | associated_buffer = buffer.native_buffer_handle(); |
3536 | 134 | hwc_layer->handle = native_buffer->handle(); | 141 | updated = (hwc_layer->handle != associated_buffer->handle()); |
3537 | 135 | if (!needs_gl_render()) | 142 | |
3538 | 136 | hwc_layer->acquireFenceFd = native_buffer->copy_fence(); | 143 | hwc_layer->handle = associated_buffer->handle(); |
3533 | 137 | hwc_layer->releaseFenceFd = -1; | ||
3539 | 138 | hwc_layer->sourceCrop = | 144 | hwc_layer->sourceCrop = |
3540 | 139 | { | 145 | { |
3541 | 140 | 0, 0, | 146 | 0, 0, |
3544 | 141 | size.width.as_int(), | 147 | associated_buffer->anwb()->width, |
3545 | 142 | size.height.as_int() | 148 | associated_buffer->anwb()->height |
3546 | 143 | }; | 149 | }; |
3547 | 144 | } | 150 | } |
3548 | 151 | |||
3549 | 152 | void mga::HWCLayer::prepare_for_draw() | ||
3550 | 153 | { | ||
3551 | 154 | //we shouldn't be copying the FD unless the HWC has marked this as a buffer its interested in. | ||
3552 | 155 | //we disregard fences that haven't changed, as the hwc will still own the buffer | ||
3553 | 156 | if (updated && (((hwc_layer->compositionType == HWC_OVERLAY) || | ||
3554 | 157 | (hwc_layer->compositionType == HWC_FRAMEBUFFER_TARGET)))) | ||
3555 | 158 | { | ||
3556 | 159 | hwc_layer->acquireFenceFd = associated_buffer->copy_fence(); | ||
3557 | 160 | } | ||
3558 | 161 | //the HWC is not interested in this buffer. we can release the buffer. | ||
3559 | 162 | else if (hwc_layer->compositionType == HWC_FRAMEBUFFER) | ||
3560 | 163 | { | ||
3561 | 164 | hwc_layer->acquireFenceFd = -1; | ||
3562 | 165 | associated_buffer.reset(); | ||
3563 | 166 | } | ||
3564 | 167 | |||
3565 | 168 | hwc_layer->releaseFenceFd = -1; | ||
3566 | 169 | } | ||
3567 | 170 | |||
3568 | 171 | bool mga::HWCLayer::needs_hwc_commit() const | ||
3569 | 172 | { | ||
3570 | 173 | return (updated || needs_gl_render()); | ||
3571 | 174 | } | ||
3572 | 145 | 175 | ||
3573 | === modified file 'src/platform/graphics/android/hwc_layers.h' | |||
3574 | --- src/platform/graphics/android/hwc_layers.h 2014-02-12 03:14:55 +0000 | |||
3575 | +++ src/platform/graphics/android/hwc_layers.h 2014-03-17 15:02:33 +0000 | |||
3576 | @@ -35,10 +35,10 @@ | |||
3577 | 35 | 35 | ||
3578 | 36 | class Renderable; | 36 | class Renderable; |
3579 | 37 | class Buffer; | 37 | class Buffer; |
3580 | 38 | class NativeBuffer; | ||
3581 | 38 | 39 | ||
3582 | 39 | namespace android | 40 | namespace android |
3583 | 40 | { | 41 | { |
3584 | 41 | |||
3585 | 42 | enum LayerType | 42 | enum LayerType |
3586 | 43 | { | 43 | { |
3587 | 44 | gl_rendered, | 44 | gl_rendered, |
3588 | @@ -64,15 +64,18 @@ | |||
3589 | 64 | 64 | ||
3590 | 65 | void set_layer_type(LayerType type); | 65 | void set_layer_type(LayerType type); |
3591 | 66 | void set_render_parameters(geometry::Rectangle screen_position, bool alpha_enabled); | 66 | void set_render_parameters(geometry::Rectangle screen_position, bool alpha_enabled); |
3593 | 67 | void set_buffer(Buffer const&); | 67 | void set_buffer(Buffer const& buffer); |
3594 | 68 | 68 | ||
3596 | 69 | NativeFence release_fence() const; | 69 | void update_fence_and_release_buffer(); |
3597 | 70 | bool needs_gl_render() const; | 70 | bool needs_gl_render() const; |
3599 | 71 | 71 | bool needs_hwc_commit() const; | |
3600 | 72 | void prepare_for_draw(); | ||
3601 | 72 | private: | 73 | private: |
3602 | 73 | hwc_layer_1_t* hwc_layer; | 74 | hwc_layer_1_t* hwc_layer; |
3603 | 74 | std::shared_ptr<hwc_display_contents_1_t> hwc_list; | 75 | std::shared_ptr<hwc_display_contents_1_t> hwc_list; |
3604 | 75 | hwc_rect_t visible_rect; | 76 | hwc_rect_t visible_rect; |
3605 | 77 | std::shared_ptr<NativeBuffer> associated_buffer; | ||
3606 | 78 | bool updated{false}; | ||
3607 | 76 | }; | 79 | }; |
3608 | 77 | } | 80 | } |
3609 | 78 | } | 81 | } |
3610 | 79 | 82 | ||
3611 | === added file 'src/platform/graphics/android/real_hwc_wrapper.cpp' | |||
3612 | --- src/platform/graphics/android/real_hwc_wrapper.cpp 1970-01-01 00:00:00 +0000 | |||
3613 | +++ src/platform/graphics/android/real_hwc_wrapper.cpp 2014-03-17 15:02:33 +0000 | |||
3614 | @@ -0,0 +1,53 @@ | |||
3615 | 1 | /* | ||
3616 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3617 | 3 | * | ||
3618 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3619 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3620 | 6 | * as published by the Free Software Foundation. | ||
3621 | 7 | * | ||
3622 | 8 | * This program is distributed in the hope that it will be useful, | ||
3623 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3624 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3625 | 11 | * GNU Lesser General Public License for more details. | ||
3626 | 12 | * | ||
3627 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3628 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3629 | 15 | * | ||
3630 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
3631 | 17 | */ | ||
3632 | 18 | |||
3633 | 19 | #include "real_hwc_wrapper.h" | ||
3634 | 20 | #include <boost/throw_exception.hpp> | ||
3635 | 21 | #include <stdexcept> | ||
3636 | 22 | #include <sstream> | ||
3637 | 23 | |||
3638 | 24 | namespace mga=mir::graphics::android; | ||
3639 | 25 | |||
3640 | 26 | mga::RealHwcWrapper::RealHwcWrapper(std::shared_ptr<hwc_composer_device_1> const& hwc_device) | ||
3641 | 27 | : hwc_device(hwc_device) | ||
3642 | 28 | { | ||
3643 | 29 | } | ||
3644 | 30 | |||
3645 | 31 | void mga::RealHwcWrapper::prepare(hwc_display_contents_1_t& display_list) const | ||
3646 | 32 | { | ||
3647 | 33 | //note, although we only have a primary display right now, | ||
3648 | 34 | // set the external and virtual displays to null as some drivers check for that | ||
3649 | 35 | hwc_display_contents_1_t* displays[num_displays] {&display_list, nullptr, nullptr}; | ||
3650 | 36 | if (auto rc = hwc_device->prepare(hwc_device.get(), 1, displays)) | ||
3651 | 37 | { | ||
3652 | 38 | std::stringstream ss; | ||
3653 | 39 | ss << "error during hwc prepare(). rc = " << std::hex << rc; | ||
3654 | 40 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | ||
3655 | 41 | } | ||
3656 | 42 | } | ||
3657 | 43 | |||
3658 | 44 | void mga::RealHwcWrapper::set(hwc_display_contents_1_t& display_list) const | ||
3659 | 45 | { | ||
3660 | 46 | hwc_display_contents_1_t* displays[num_displays] {&display_list, nullptr, nullptr}; | ||
3661 | 47 | if (auto rc = hwc_device->set(hwc_device.get(), 1, displays)) | ||
3662 | 48 | { | ||
3663 | 49 | std::stringstream ss; | ||
3664 | 50 | ss << "error during hwc prepare(). rc = " << std::hex << rc; | ||
3665 | 51 | BOOST_THROW_EXCEPTION(std::runtime_error(ss.str())); | ||
3666 | 52 | } | ||
3667 | 53 | } | ||
3668 | 0 | 54 | ||
3669 | === added file 'src/platform/graphics/android/real_hwc_wrapper.h' | |||
3670 | --- src/platform/graphics/android/real_hwc_wrapper.h 1970-01-01 00:00:00 +0000 | |||
3671 | +++ src/platform/graphics/android/real_hwc_wrapper.h 2014-03-17 15:02:33 +0000 | |||
3672 | @@ -0,0 +1,48 @@ | |||
3673 | 1 | /* | ||
3674 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3675 | 3 | * | ||
3676 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3677 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3678 | 6 | * as published by the Free Software Foundation. | ||
3679 | 7 | * | ||
3680 | 8 | * This program is distributed in the hope that it will be useful, | ||
3681 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3682 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3683 | 11 | * GNU Lesser General Public License for more details. | ||
3684 | 12 | * | ||
3685 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3686 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3687 | 15 | * | ||
3688 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
3689 | 17 | */ | ||
3690 | 18 | |||
3691 | 19 | #ifndef MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ | ||
3692 | 20 | #define MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ | ||
3693 | 21 | |||
3694 | 22 | #include "hwc_device.h" | ||
3695 | 23 | #include <memory> | ||
3696 | 24 | #include <hardware/hwcomposer.h> | ||
3697 | 25 | |||
3698 | 26 | namespace mir | ||
3699 | 27 | { | ||
3700 | 28 | namespace graphics | ||
3701 | 29 | { | ||
3702 | 30 | namespace android | ||
3703 | 31 | { | ||
3704 | 32 | |||
3705 | 33 | class RealHwcWrapper : public HwcWrapper | ||
3706 | 34 | { | ||
3707 | 35 | public: | ||
3708 | 36 | RealHwcWrapper(std::shared_ptr<hwc_composer_device_1> const& hwc_device); | ||
3709 | 37 | |||
3710 | 38 | void prepare(hwc_display_contents_1_t&) const override; | ||
3711 | 39 | void set(hwc_display_contents_1_t&) const override; | ||
3712 | 40 | private: | ||
3713 | 41 | static size_t const num_displays{3}; //primary, external, virtual | ||
3714 | 42 | std::shared_ptr<hwc_composer_device_1> const hwc_device; | ||
3715 | 43 | }; | ||
3716 | 44 | |||
3717 | 45 | } | ||
3718 | 46 | } | ||
3719 | 47 | } | ||
3720 | 48 | #endif /* MIR_GRAPHICS_ANDROID_REAL_HWC_WRAPPER_H_ */ | ||
3721 | 0 | 49 | ||
3722 | === modified file 'src/platform/graphics/android/resource_factory.cpp' | |||
3723 | --- src/platform/graphics/android/resource_factory.cpp 2014-02-10 09:07:48 +0000 | |||
3724 | +++ src/platform/graphics/android/resource_factory.cpp 2014-03-17 15:02:33 +0000 | |||
3725 | @@ -30,6 +30,7 @@ | |||
3726 | 30 | #include "hwc_layerlist.h" | 30 | #include "hwc_layerlist.h" |
3727 | 31 | #include "hwc_vsync.h" | 31 | #include "hwc_vsync.h" |
3728 | 32 | #include "android_display.h" | 32 | #include "android_display.h" |
3729 | 33 | #include "real_hwc_wrapper.h" | ||
3730 | 33 | 34 | ||
3731 | 34 | #include <boost/throw_exception.hpp> | 35 | #include <boost/throw_exception.hpp> |
3732 | 35 | #include <stdexcept> | 36 | #include <stdexcept> |
3733 | @@ -93,7 +94,8 @@ | |||
3734 | 93 | { | 94 | { |
3735 | 94 | auto syncer = std::make_shared<mga::HWCVsync>(); | 95 | auto syncer = std::make_shared<mga::HWCVsync>(); |
3736 | 95 | auto file_ops = std::make_shared<mga::RealSyncFileOps>(); | 96 | auto file_ops = std::make_shared<mga::RealSyncFileOps>(); |
3738 | 96 | return std::make_shared<mga::HwcDevice>(hwc_native_device, syncer, file_ops); | 97 | auto wrapper = std::make_shared<mga::RealHwcWrapper>(hwc_native_device); |
3739 | 98 | return std::make_shared<mga::HwcDevice>(hwc_native_device, wrapper, syncer, file_ops); | ||
3740 | 97 | } | 99 | } |
3741 | 98 | 100 | ||
3742 | 99 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_fb_device( | 101 | std::shared_ptr<mga::DisplayDevice> mga::ResourceFactory::create_hwc_fb_device( |
3743 | 100 | 102 | ||
3744 | === modified file 'src/platform/graphics/display_configuration.cpp' | |||
3745 | --- src/platform/graphics/display_configuration.cpp 2014-03-05 02:30:30 +0000 | |||
3746 | +++ src/platform/graphics/display_configuration.cpp 2014-03-17 15:02:33 +0000 | |||
3747 | @@ -19,6 +19,7 @@ | |||
3748 | 19 | #include "mir/graphics/display_configuration.h" | 19 | #include "mir/graphics/display_configuration.h" |
3749 | 20 | 20 | ||
3750 | 21 | #include <ostream> | 21 | #include <ostream> |
3751 | 22 | #include <algorithm> | ||
3752 | 22 | 23 | ||
3753 | 23 | namespace mg = mir::graphics; | 24 | namespace mg = mir::graphics; |
3754 | 24 | 25 | ||
3755 | @@ -196,3 +197,52 @@ | |||
3756 | 196 | return {top_left, {size.height.as_int(), size.width.as_int()}}; | 197 | return {top_left, {size.height.as_int(), size.width.as_int()}}; |
3757 | 197 | } | 198 | } |
3758 | 198 | } | 199 | } |
3759 | 200 | |||
3760 | 201 | bool mg::DisplayConfigurationOutput::valid() const | ||
3761 | 202 | { | ||
3762 | 203 | if (!connected) | ||
3763 | 204 | return !used; | ||
3764 | 205 | |||
3765 | 206 | auto const& f = std::find(pixel_formats.begin(), pixel_formats.end(), | ||
3766 | 207 | current_format); | ||
3767 | 208 | if (f == pixel_formats.end()) | ||
3768 | 209 | return false; | ||
3769 | 210 | |||
3770 | 211 | auto nmodes = modes.size(); | ||
3771 | 212 | if (preferred_mode_index >= nmodes || current_mode_index >= nmodes) | ||
3772 | 213 | return false; | ||
3773 | 214 | |||
3774 | 215 | return true; | ||
3775 | 216 | } | ||
3776 | 217 | |||
3777 | 218 | bool mg::DisplayConfiguration::valid() const | ||
3778 | 219 | { | ||
3779 | 220 | bool all_valid = true; | ||
3780 | 221 | |||
3781 | 222 | for_each_output([&all_valid](DisplayConfigurationOutput const& out) | ||
3782 | 223 | { | ||
3783 | 224 | if (!out.valid()) | ||
3784 | 225 | all_valid = false; | ||
3785 | 226 | }); | ||
3786 | 227 | |||
3787 | 228 | return all_valid; | ||
3788 | 229 | } | ||
3789 | 230 | |||
3790 | 231 | mg::UserDisplayConfigurationOutput::UserDisplayConfigurationOutput( | ||
3791 | 232 | DisplayConfigurationOutput& master) : | ||
3792 | 233 | id(master.id), | ||
3793 | 234 | card_id(master.card_id), | ||
3794 | 235 | type(master.type), | ||
3795 | 236 | pixel_formats(master.pixel_formats), | ||
3796 | 237 | modes(master.modes), | ||
3797 | 238 | preferred_mode_index(master.preferred_mode_index), | ||
3798 | 239 | physical_size_mm(master.physical_size_mm), | ||
3799 | 240 | connected(master.connected), | ||
3800 | 241 | used(master.used), | ||
3801 | 242 | top_left(master.top_left), | ||
3802 | 243 | current_mode_index(master.current_mode_index), | ||
3803 | 244 | current_format(master.current_format), | ||
3804 | 245 | power_mode(master.power_mode), | ||
3805 | 246 | orientation(master.orientation) | ||
3806 | 247 | { | ||
3807 | 248 | } | ||
3808 | 199 | 249 | ||
3809 | === modified file 'src/platform/graphics/mesa/CMakeLists.txt' | |||
3810 | --- src/platform/graphics/mesa/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
3811 | +++ src/platform/graphics/mesa/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
3812 | @@ -32,7 +32,6 @@ | |||
3813 | 32 | internal_native_surface.cpp | 32 | internal_native_surface.cpp |
3814 | 33 | internal_client.cpp | 33 | internal_client.cpp |
3815 | 34 | drm_close_threadsafe.cpp | 34 | drm_close_threadsafe.cpp |
3816 | 35 | overlapping_output_grouping.cpp | ||
3817 | 36 | native_platform.cpp | 35 | native_platform.cpp |
3818 | 37 | anonymous_shm_file.cpp | 36 | anonymous_shm_file.cpp |
3819 | 38 | shm_buffer.cpp | 37 | shm_buffer.cpp |
3820 | @@ -54,6 +53,8 @@ | |||
3821 | 54 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} | 53 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} |
3822 | 55 | ) | 54 | ) |
3823 | 56 | 55 | ||
3824 | 56 | install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/mesa) | ||
3825 | 57 | |||
3826 | 57 | if (MIR_TEST_PLATFORM STREQUAL "mesa") | 58 | if (MIR_TEST_PLATFORM STREQUAL "mesa") |
3827 | 58 | add_custom_command(TARGET mirplatformgraphicsmesa | 59 | add_custom_command(TARGET mirplatformgraphicsmesa |
3828 | 59 | POST_BUILD | 60 | POST_BUILD |
3829 | @@ -61,6 +62,11 @@ | |||
3830 | 61 | COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> libmirplatformgraphics.so | 62 | COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> libmirplatformgraphics.so |
3831 | 62 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} | 63 | WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
3832 | 63 | ) | 64 | ) |
3833 | 65 | |||
3834 | 66 | install(CODE | ||
3835 | 67 | "execute_process( | ||
3836 | 68 | COMMAND ln -sf mir/platformgraphics/mesa/libmirplatformgraphics.so | ||
3837 | 69 | WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | ||
3838 | 70 | )" | ||
3839 | 71 | ) | ||
3840 | 64 | endif() | 72 | endif() |
3841 | 65 | |||
3842 | 66 | install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/mesa) | ||
3843 | 67 | 73 | ||
3844 | === modified file 'src/platform/graphics/mesa/cursor.cpp' | |||
3845 | --- src/platform/graphics/mesa/cursor.cpp 2014-01-22 10:03:11 +0000 | |||
3846 | +++ src/platform/graphics/mesa/cursor.cpp 2014-03-17 15:02:33 +0000 | |||
3847 | @@ -28,15 +28,32 @@ | |||
3848 | 28 | #include <stdexcept> | 28 | #include <stdexcept> |
3849 | 29 | #include <vector> | 29 | #include <vector> |
3850 | 30 | 30 | ||
3851 | 31 | namespace mgm = mir::graphics::mesa; | ||
3852 | 32 | namespace geom = mir::geometry; | ||
3853 | 33 | |||
3854 | 31 | namespace | 34 | namespace |
3855 | 32 | { | 35 | { |
3856 | 33 | #include "black_arrow.c" | 36 | #include "black_arrow.c" |
3857 | 34 | int const width = black_arrow.width; | 37 | int const width = black_arrow.width; |
3858 | 35 | int const height = black_arrow.height; | 38 | int const height = black_arrow.height; |
3859 | 36 | } | ||
3860 | 37 | 39 | ||
3863 | 38 | namespace mgm = mir::graphics::mesa; | 40 | // Transforms a relative position within the display bounds described by \a rect which is rotated with \a orientation |
3864 | 39 | namespace geom = mir::geometry; | 41 | geom::Displacement transform(geom::Rectangle const& rect, geom::Displacement const& vector, MirOrientation orientation) |
3865 | 42 | { | ||
3866 | 43 | switch(orientation) | ||
3867 | 44 | { | ||
3868 | 45 | case mir_orientation_left: | ||
3869 | 46 | return {vector.dy.as_int(), rect.size.width.as_int() -vector.dx.as_int()}; | ||
3870 | 47 | case mir_orientation_inverted: | ||
3871 | 48 | return {rect.size.width.as_int() -vector.dx.as_int(), rect.size.height.as_int() - vector.dy.as_int()}; | ||
3872 | 49 | case mir_orientation_right: | ||
3873 | 50 | return {rect.size.height.as_int() -vector.dy.as_int(), vector.dx.as_int()}; | ||
3874 | 51 | default: | ||
3875 | 52 | case mir_orientation_normal: | ||
3876 | 53 | return vector; | ||
3877 | 54 | } | ||
3878 | 55 | } | ||
3879 | 56 | } | ||
3880 | 40 | 57 | ||
3881 | 41 | mgm::Cursor::GBMBOWrapper::GBMBOWrapper(gbm_device* gbm) : | 58 | mgm::Cursor::GBMBOWrapper::GBMBOWrapper(gbm_device* gbm) : |
3882 | 42 | buffer(gbm_bo_create( | 59 | buffer(gbm_bo_create( |
3883 | @@ -103,7 +120,7 @@ | |||
3884 | 103 | } | 120 | } |
3885 | 104 | 121 | ||
3886 | 105 | void mgm::Cursor::for_each_used_output( | 122 | void mgm::Cursor::for_each_used_output( |
3888 | 106 | std::function<void(KMSOutput&, geom::Rectangle const&)> const& f) | 123 | std::function<void(KMSOutput&, geom::Rectangle const&, MirOrientation orientation)> const& f) |
3889 | 107 | { | 124 | { |
3890 | 108 | current_configuration->with_current_configuration_do( | 125 | current_configuration->with_current_configuration_do( |
3891 | 109 | [this,&f](KMSDisplayConfiguration const& kms_conf) | 126 | [this,&f](KMSDisplayConfiguration const& kms_conf) |
3892 | @@ -115,13 +132,7 @@ | |||
3893 | 115 | uint32_t const connector_id = kms_conf.get_kms_connector_id(conf_output.id); | 132 | uint32_t const connector_id = kms_conf.get_kms_connector_id(conf_output.id); |
3894 | 116 | auto output = output_container.get_kms_output_for(connector_id); | 133 | auto output = output_container.get_kms_output_for(connector_id); |
3895 | 117 | 134 | ||
3903 | 118 | // TODO: Cursor rotation support (conf_output.extents()) | 135 | f(*output, conf_output.extents(), conf_output.orientation); |
3897 | 119 | geom::Rectangle output_rect | ||
3898 | 120 | { | ||
3899 | 121 | conf_output.top_left, | ||
3900 | 122 | conf_output.modes[conf_output.current_mode_index].size | ||
3901 | 123 | }; | ||
3902 | 124 | f(*output, output_rect); | ||
3904 | 125 | } | 136 | } |
3905 | 126 | }); | 137 | }); |
3906 | 127 | }); | 138 | }); |
3907 | @@ -131,15 +142,15 @@ | |||
3908 | 131 | geometry::Point position, | 142 | geometry::Point position, |
3909 | 132 | ForceCursorState force_state) | 143 | ForceCursorState force_state) |
3910 | 133 | { | 144 | { |
3912 | 134 | for_each_used_output([&](KMSOutput& output, geom::Rectangle const& output_rect) | 145 | for_each_used_output([&](KMSOutput& output, geom::Rectangle const& output_rect, MirOrientation orientation) |
3913 | 135 | { | 146 | { |
3914 | 136 | if (output_rect.contains(position)) | 147 | if (output_rect.contains(position)) |
3915 | 137 | { | 148 | { |
3917 | 138 | auto dp = position - output_rect.top_left; | 149 | auto dp = transform(output_rect, position - output_rect.top_left, orientation); |
3918 | 139 | output.move_cursor({dp.dx.as_int(), dp.dy.as_int()}); | 150 | output.move_cursor({dp.dx.as_int(), dp.dy.as_int()}); |
3920 | 140 | if (force_state || !output.has_cursor()) | 151 | if (force_state || !output.has_cursor()) // TODO - or if orientation had changed - then set buffer.. |
3921 | 141 | { | 152 | { |
3923 | 142 | output.set_cursor(buffer); | 153 | output.set_cursor(buffer);// TODO - select rotated buffer image |
3924 | 143 | } | 154 | } |
3925 | 144 | } | 155 | } |
3926 | 145 | else | 156 | else |
3927 | 146 | 157 | ||
3928 | === modified file 'src/platform/graphics/mesa/cursor.h' | |||
3929 | --- src/platform/graphics/mesa/cursor.h 2014-01-22 10:03:11 +0000 | |||
3930 | +++ src/platform/graphics/mesa/cursor.h 2014-03-17 15:02:33 +0000 | |||
3931 | @@ -21,6 +21,7 @@ | |||
3932 | 21 | #define MIR_GRAPHICS_MESA_CURSOR_H_ | 21 | #define MIR_GRAPHICS_MESA_CURSOR_H_ |
3933 | 22 | 22 | ||
3934 | 23 | #include "mir/graphics/cursor.h" | 23 | #include "mir/graphics/cursor.h" |
3935 | 24 | #include "mir_toolkit/common.h" | ||
3936 | 24 | 25 | ||
3937 | 25 | #include <gbm.h> | 26 | #include <gbm.h> |
3938 | 26 | #include <memory> | 27 | #include <memory> |
3939 | @@ -73,7 +74,7 @@ | |||
3940 | 73 | 74 | ||
3941 | 74 | private: | 75 | private: |
3942 | 75 | enum ForceCursorState { UpdateState, ForceState }; | 76 | enum ForceCursorState { UpdateState, ForceState }; |
3944 | 76 | void for_each_used_output(std::function<void(KMSOutput&, geometry::Rectangle const&)> const& f); | 77 | void for_each_used_output(std::function<void(KMSOutput&, geometry::Rectangle const&, MirOrientation orientation)> const& f); |
3945 | 77 | void place_cursor_at(geometry::Point position, ForceCursorState force_state); | 78 | void place_cursor_at(geometry::Point position, ForceCursorState force_state); |
3946 | 78 | 79 | ||
3947 | 79 | KMSOutputContainer& output_container; | 80 | KMSOutputContainer& output_container; |
3948 | 80 | 81 | ||
3949 | === modified file 'src/platform/graphics/mesa/display.cpp' | |||
3950 | --- src/platform/graphics/mesa/display.cpp 2014-03-05 02:30:30 +0000 | |||
3951 | +++ src/platform/graphics/mesa/display.cpp 2014-03-17 15:02:33 +0000 | |||
3952 | @@ -24,7 +24,7 @@ | |||
3953 | 24 | #include "kms_output.h" | 24 | #include "kms_output.h" |
3954 | 25 | #include "kms_page_flipper.h" | 25 | #include "kms_page_flipper.h" |
3955 | 26 | #include "virtual_terminal.h" | 26 | #include "virtual_terminal.h" |
3957 | 27 | #include "overlapping_output_grouping.h" | 27 | #include "mir/graphics/overlapping_output_grouping.h" |
3958 | 28 | 28 | ||
3959 | 29 | #include "mir/graphics/display_report.h" | 29 | #include "mir/graphics/display_report.h" |
3960 | 30 | #include "mir/graphics/gl_context.h" | 30 | #include "mir/graphics/gl_context.h" |
3961 | @@ -128,6 +128,12 @@ | |||
3962 | 128 | 128 | ||
3963 | 129 | void mgm::Display::configure(mg::DisplayConfiguration const& conf) | 129 | void mgm::Display::configure(mg::DisplayConfiguration const& conf) |
3964 | 130 | { | 130 | { |
3965 | 131 | if (!conf.valid()) | ||
3966 | 132 | { | ||
3967 | 133 | BOOST_THROW_EXCEPTION( | ||
3968 | 134 | std::logic_error("Invalid or inconsistent display configuration")); | ||
3969 | 135 | } | ||
3970 | 136 | |||
3971 | 131 | { | 137 | { |
3972 | 132 | std::lock_guard<std::mutex> lg{configuration_mutex}; | 138 | std::lock_guard<std::mutex> lg{configuration_mutex}; |
3973 | 133 | 139 | ||
3974 | 134 | 140 | ||
3975 | === modified file 'src/platform/graphics/mesa/linux_virtual_terminal.cpp' | |||
3976 | --- src/platform/graphics/mesa/linux_virtual_terminal.cpp 2014-01-22 10:03:11 +0000 | |||
3977 | +++ src/platform/graphics/mesa/linux_virtual_terminal.cpp 2014-03-17 15:02:33 +0000 | |||
3978 | @@ -36,11 +36,12 @@ | |||
3979 | 36 | 36 | ||
3980 | 37 | namespace mgm = mir::graphics::mesa; | 37 | namespace mgm = mir::graphics::mesa; |
3981 | 38 | 38 | ||
3984 | 39 | mgm::LinuxVirtualTerminal::LinuxVirtualTerminal( | 39 | mgm::LinuxVirtualTerminal::LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops, |
3985 | 40 | std::shared_ptr<VTFileOperations> const& fops, | 40 | std::unique_ptr<PosixProcessOperations> pops, |
3986 | 41 | int vt_number, | 41 | int vt_number, |
3987 | 42 | std::shared_ptr<DisplayReport> const& report) | 42 | std::shared_ptr<DisplayReport> const& report) |
3988 | 43 | : fops{fops}, | 43 | : fops{fops}, |
3989 | 44 | pops{std::move(pops)}, | ||
3990 | 44 | report{report}, | 45 | report{report}, |
3991 | 45 | vt_fd{fops, open_vt(vt_number)}, | 46 | vt_fd{fops, open_vt(vt_number)}, |
3992 | 46 | prev_kd_mode{0}, | 47 | prev_kd_mode{0}, |
3993 | @@ -233,9 +234,9 @@ | |||
3994 | 233 | { | 234 | { |
3995 | 234 | // we should only try to create a new session in order to become the session | 235 | // we should only try to create a new session in order to become the session |
3996 | 235 | // and group leader if we are not already the session leader | 236 | // and group leader if we are not already the session leader |
3998 | 236 | if (getpid() != getsid(0)) | 237 | if (pops->getpid() != pops->getsid(0)) |
3999 | 237 | { | 238 | { |
4001 | 238 | if (getpid() == getpgid(0) && setpgid(0, getpgid(getppid())) < 0) | 239 | if (pops->getpid() == pops->getpgid(0) && pops->setpgid(0, pops->getpgid(pops->getppid())) < 0) |
4002 | 239 | { | 240 | { |
4003 | 240 | BOOST_THROW_EXCEPTION( | 241 | BOOST_THROW_EXCEPTION( |
4004 | 241 | boost::enable_error_info( | 242 | boost::enable_error_info( |
4005 | @@ -244,7 +245,7 @@ | |||
4006 | 244 | } | 245 | } |
4007 | 245 | 246 | ||
4008 | 246 | /* become process group leader */ | 247 | /* become process group leader */ |
4010 | 247 | if (setsid() < 0) | 248 | if (pops->setsid() < 0) |
4011 | 248 | { | 249 | { |
4012 | 249 | BOOST_THROW_EXCEPTION( | 250 | BOOST_THROW_EXCEPTION( |
4013 | 250 | boost::enable_error_info( | 251 | boost::enable_error_info( |
4014 | 251 | 252 | ||
4015 | === modified file 'src/platform/graphics/mesa/linux_virtual_terminal.h' | |||
4016 | --- src/platform/graphics/mesa/linux_virtual_terminal.h 2014-01-22 10:03:11 +0000 | |||
4017 | +++ src/platform/graphics/mesa/linux_virtual_terminal.h 2014-03-17 15:02:33 +0000 | |||
4018 | @@ -55,10 +55,30 @@ | |||
4019 | 55 | VTFileOperations& operator=(VTFileOperations const&) = delete; | 55 | VTFileOperations& operator=(VTFileOperations const&) = delete; |
4020 | 56 | }; | 56 | }; |
4021 | 57 | 57 | ||
4022 | 58 | class PosixProcessOperations | ||
4023 | 59 | { | ||
4024 | 60 | public: | ||
4025 | 61 | virtual ~PosixProcessOperations() = default; | ||
4026 | 62 | |||
4027 | 63 | virtual pid_t getpid() const = 0; | ||
4028 | 64 | virtual pid_t getppid() const = 0; | ||
4029 | 65 | virtual pid_t getpgid(pid_t process) const = 0; | ||
4030 | 66 | virtual pid_t getsid(pid_t process) const = 0; | ||
4031 | 67 | |||
4032 | 68 | virtual int setpgid(pid_t process, pid_t group) = 0; | ||
4033 | 69 | virtual pid_t setsid() = 0; | ||
4034 | 70 | |||
4035 | 71 | protected: | ||
4036 | 72 | PosixProcessOperations() = default; | ||
4037 | 73 | PosixProcessOperations(PosixProcessOperations const&) = delete; | ||
4038 | 74 | PosixProcessOperations& operator=(PosixProcessOperations const&) = delete; | ||
4039 | 75 | }; | ||
4040 | 76 | |||
4041 | 58 | class LinuxVirtualTerminal : public VirtualTerminal | 77 | class LinuxVirtualTerminal : public VirtualTerminal |
4042 | 59 | { | 78 | { |
4043 | 60 | public: | 79 | public: |
4044 | 61 | LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops, | 80 | LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops, |
4045 | 81 | std::unique_ptr<PosixProcessOperations> pops, | ||
4046 | 62 | int vt_number, | 82 | int vt_number, |
4047 | 63 | std::shared_ptr<DisplayReport> const& report); | 83 | std::shared_ptr<DisplayReport> const& report); |
4048 | 64 | ~LinuxVirtualTerminal() noexcept(true); | 84 | ~LinuxVirtualTerminal() noexcept(true); |
4049 | @@ -89,6 +109,7 @@ | |||
4050 | 89 | 109 | ||
4051 | 90 | 110 | ||
4052 | 91 | std::shared_ptr<VTFileOperations> const fops; | 111 | std::shared_ptr<VTFileOperations> const fops; |
4053 | 112 | std::unique_ptr<PosixProcessOperations> const pops; | ||
4054 | 92 | std::shared_ptr<DisplayReport> const report; | 113 | std::shared_ptr<DisplayReport> const report; |
4055 | 93 | FDWrapper const vt_fd; | 114 | FDWrapper const vt_fd; |
4056 | 94 | int prev_kd_mode; | 115 | int prev_kd_mode; |
4057 | 95 | 116 | ||
4058 | === modified file 'src/platform/graphics/mesa/native_platform.cpp' | |||
4059 | --- src/platform/graphics/mesa/native_platform.cpp 2014-03-04 04:19:26 +0000 | |||
4060 | +++ src/platform/graphics/mesa/native_platform.cpp 2014-03-17 15:02:33 +0000 | |||
4061 | @@ -25,8 +25,13 @@ | |||
4062 | 25 | #include "mir/graphics/platform_ipc_package.h" | 25 | #include "mir/graphics/platform_ipc_package.h" |
4063 | 26 | #include "mir/graphics/nested_context.h" | 26 | #include "mir/graphics/nested_context.h" |
4064 | 27 | 27 | ||
4065 | 28 | #include "internal_client.h" | ||
4066 | 29 | #include "internal_native_display.h" | ||
4067 | 30 | |||
4068 | 28 | #include <boost/exception/errinfo_errno.hpp> | 31 | #include <boost/exception/errinfo_errno.hpp> |
4069 | 29 | #include <boost/throw_exception.hpp> | 32 | #include <boost/throw_exception.hpp> |
4070 | 33 | |||
4071 | 34 | #include <mutex> | ||
4072 | 30 | #include <stdexcept> | 35 | #include <stdexcept> |
4073 | 31 | 36 | ||
4074 | 32 | namespace mg = mir::graphics; | 37 | namespace mg = mir::graphics; |
4075 | @@ -42,6 +47,11 @@ | |||
4076 | 42 | nested_context->drm_set_gbm_device(gbm.device); | 47 | nested_context->drm_set_gbm_device(gbm.device); |
4077 | 43 | } | 48 | } |
4078 | 44 | 49 | ||
4079 | 50 | mgm::NativePlatform::~NativePlatform() | ||
4080 | 51 | { | ||
4081 | 52 | finish_internal_native_display(); | ||
4082 | 53 | } | ||
4083 | 54 | |||
4084 | 45 | std::shared_ptr<mg::GraphicBufferAllocator> mgm::NativePlatform::create_buffer_allocator( | 55 | std::shared_ptr<mg::GraphicBufferAllocator> mgm::NativePlatform::create_buffer_allocator( |
4085 | 46 | std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) | 56 | std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) |
4086 | 47 | { | 57 | { |
4087 | @@ -82,7 +92,8 @@ | |||
4088 | 82 | 92 | ||
4089 | 83 | std::shared_ptr<mg::InternalClient> mgm::NativePlatform::create_internal_client() | 93 | std::shared_ptr<mg::InternalClient> mgm::NativePlatform::create_internal_client() |
4090 | 84 | { | 94 | { |
4092 | 85 | BOOST_THROW_EXCEPTION(std::runtime_error("MesaNativePlatform::create_internal_client is not implemented yet!")); | 95 | auto nd = ensure_internal_native_display(get_ipc_package()); |
4093 | 96 | return std::make_shared<mgm::InternalClient>(nd); | ||
4094 | 86 | } | 97 | } |
4095 | 87 | 98 | ||
4096 | 88 | void mgm::NativePlatform::fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const | 99 | void mgm::NativePlatform::fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const |
4097 | @@ -98,9 +109,45 @@ | |||
4098 | 98 | } | 109 | } |
4099 | 99 | 110 | ||
4100 | 100 | packer->pack_stride(buffer->stride()); | 111 | packer->pack_stride(buffer->stride()); |
4101 | 112 | packer->pack_flags(native_handle->flags); | ||
4102 | 113 | packer->pack_size(buffer->size()); | ||
4103 | 101 | } | 114 | } |
4104 | 102 | 115 | ||
4105 | 103 | extern "C" std::shared_ptr<mg::NativePlatform> create_native_platform(std::shared_ptr<mg::DisplayReport> const& /*report*/) | 116 | extern "C" std::shared_ptr<mg::NativePlatform> create_native_platform(std::shared_ptr<mg::DisplayReport> const& /*report*/) |
4106 | 104 | { | 117 | { |
4107 | 105 | return std::make_shared<mgm::NativePlatform>(); | 118 | return std::make_shared<mgm::NativePlatform>(); |
4108 | 106 | } | 119 | } |
4109 | 120 | |||
4110 | 121 | namespace | ||
4111 | 122 | { | ||
4112 | 123 | std::shared_ptr<mgm::InternalNativeDisplay> native_display = nullptr; | ||
4113 | 124 | std::mutex native_display_guard; | ||
4114 | 125 | } | ||
4115 | 126 | |||
4116 | 127 | bool mgm::NativePlatform::internal_native_display_in_use() | ||
4117 | 128 | { | ||
4118 | 129 | std::unique_lock<std::mutex> lg(native_display_guard); | ||
4119 | 130 | return native_display != nullptr; | ||
4120 | 131 | } | ||
4121 | 132 | |||
4122 | 133 | std::shared_ptr<mgm::InternalNativeDisplay> mgm::NativePlatform::internal_native_display() | ||
4123 | 134 | { | ||
4124 | 135 | std::unique_lock<std::mutex> lg(native_display_guard); | ||
4125 | 136 | return native_display; | ||
4126 | 137 | } | ||
4127 | 138 | |||
4128 | 139 | std::shared_ptr<mgm::InternalNativeDisplay> mgm::NativePlatform::ensure_internal_native_display( | ||
4129 | 140 | std::shared_ptr<mg::PlatformIPCPackage> const& package) | ||
4130 | 141 | { | ||
4131 | 142 | std::unique_lock<std::mutex> lg(native_display_guard); | ||
4132 | 143 | if (!native_display) | ||
4133 | 144 | native_display = std::make_shared<mgm::InternalNativeDisplay>(package); | ||
4134 | 145 | return native_display; | ||
4135 | 146 | } | ||
4136 | 147 | |||
4137 | 148 | void mgm::NativePlatform::finish_internal_native_display() | ||
4138 | 149 | { | ||
4139 | 150 | std::unique_lock<std::mutex> lg(native_display_guard); | ||
4140 | 151 | native_display.reset(); | ||
4141 | 152 | } | ||
4142 | 153 | |||
4143 | 107 | 154 | ||
4144 | === modified file 'src/platform/graphics/mesa/native_platform.h' | |||
4145 | --- src/platform/graphics/mesa/native_platform.h 2014-01-22 10:03:11 +0000 | |||
4146 | +++ src/platform/graphics/mesa/native_platform.h 2014-03-17 15:02:33 +0000 | |||
4147 | @@ -30,20 +30,30 @@ | |||
4148 | 30 | { | 30 | { |
4149 | 31 | namespace mesa | 31 | namespace mesa |
4150 | 32 | { | 32 | { |
4151 | 33 | class InternalNativeDisplay; | ||
4152 | 34 | |||
4153 | 33 | class NativePlatform : public graphics::NativePlatform | 35 | class NativePlatform : public graphics::NativePlatform |
4154 | 34 | { | 36 | { |
4155 | 35 | public: | 37 | public: |
4156 | 38 | virtual ~NativePlatform(); | ||
4157 | 39 | |||
4158 | 36 | void initialize(std::shared_ptr<NestedContext> const& nested_context); | 40 | void initialize(std::shared_ptr<NestedContext> const& nested_context); |
4159 | 37 | std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator( | 41 | std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator( |
4160 | 38 | std::shared_ptr<BufferInitializer> const& buffer_initializer) override; | 42 | std::shared_ptr<BufferInitializer> const& buffer_initializer) override; |
4161 | 39 | std::shared_ptr<PlatformIPCPackage> get_ipc_package() override; | 43 | std::shared_ptr<PlatformIPCPackage> get_ipc_package() override; |
4162 | 40 | std::shared_ptr<InternalClient> create_internal_client() override; | 44 | std::shared_ptr<InternalClient> create_internal_client() override; |
4163 | 41 | void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const override; | 45 | void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const override; |
4164 | 46 | |||
4165 | 47 | static std::shared_ptr<InternalNativeDisplay> internal_native_display(); | ||
4166 | 48 | static bool internal_native_display_in_use(); | ||
4167 | 42 | 49 | ||
4168 | 43 | private: | 50 | private: |
4169 | 44 | int drm_fd; | 51 | int drm_fd; |
4170 | 45 | std::shared_ptr<NestedContext> nested_context; | 52 | std::shared_ptr<NestedContext> nested_context; |
4171 | 46 | helpers::GBMHelper gbm; | 53 | helpers::GBMHelper gbm; |
4172 | 54 | |||
4173 | 55 | static std::shared_ptr<InternalNativeDisplay> ensure_internal_native_display(std::shared_ptr<PlatformIPCPackage> const& package); | ||
4174 | 56 | static void finish_internal_native_display(); | ||
4175 | 47 | }; | 57 | }; |
4176 | 48 | } | 58 | } |
4177 | 49 | } | 59 | } |
4178 | 50 | 60 | ||
4179 | === modified file 'src/platform/graphics/mesa/platform.cpp' | |||
4180 | --- src/platform/graphics/mesa/platform.cpp 2014-02-12 03:14:55 +0000 | |||
4181 | +++ src/platform/graphics/mesa/platform.cpp 2014-03-17 15:02:33 +0000 | |||
4182 | @@ -17,6 +17,7 @@ | |||
4183 | 17 | */ | 17 | */ |
4184 | 18 | 18 | ||
4185 | 19 | #include "platform.h" | 19 | #include "platform.h" |
4186 | 20 | #include "native_platform.h" | ||
4187 | 20 | #include "buffer_allocator.h" | 21 | #include "buffer_allocator.h" |
4188 | 21 | #include "display.h" | 22 | #include "display.h" |
4189 | 22 | #include "internal_client.h" | 23 | #include "internal_client.h" |
4190 | @@ -89,6 +90,34 @@ | |||
4191 | 89 | } | 90 | } |
4192 | 90 | }; | 91 | }; |
4193 | 91 | 92 | ||
4194 | 93 | struct RealPosixProcessOperations : public mgm::PosixProcessOperations | ||
4195 | 94 | { | ||
4196 | 95 | pid_t getpid() const override | ||
4197 | 96 | { | ||
4198 | 97 | return ::getpid(); | ||
4199 | 98 | } | ||
4200 | 99 | pid_t getppid() const override | ||
4201 | 100 | { | ||
4202 | 101 | return ::getppid(); | ||
4203 | 102 | } | ||
4204 | 103 | pid_t getpgid(pid_t process) const override | ||
4205 | 104 | { | ||
4206 | 105 | return ::getpgid(process); | ||
4207 | 106 | } | ||
4208 | 107 | pid_t getsid(pid_t process) const override | ||
4209 | 108 | { | ||
4210 | 109 | return ::getsid(process); | ||
4211 | 110 | } | ||
4212 | 111 | int setpgid(pid_t process, pid_t group) override | ||
4213 | 112 | { | ||
4214 | 113 | return ::setpgid(process, group); | ||
4215 | 114 | } | ||
4216 | 115 | pid_t setsid() override | ||
4217 | 116 | { | ||
4218 | 117 | return ::setsid(); | ||
4219 | 118 | } | ||
4220 | 119 | }; | ||
4221 | 120 | |||
4222 | 92 | } | 121 | } |
4223 | 93 | 122 | ||
4224 | 94 | std::shared_ptr<mgm::InternalNativeDisplay> mgm::Platform::internal_native_display; | 123 | std::shared_ptr<mgm::InternalNativeDisplay> mgm::Platform::internal_native_display; |
4225 | @@ -169,8 +198,10 @@ | |||
4226 | 169 | extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& options, std::shared_ptr<DisplayReport> const& report) | 198 | extern "C" std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& options, std::shared_ptr<DisplayReport> const& report) |
4227 | 170 | { | 199 | { |
4228 | 171 | auto real_fops = std::make_shared<RealVTFileOperations>(); | 200 | auto real_fops = std::make_shared<RealVTFileOperations>(); |
4229 | 201 | auto real_pops = std::unique_ptr<RealPosixProcessOperations>(new RealPosixProcessOperations{}); | ||
4230 | 172 | auto vt = std::make_shared<mgm::LinuxVirtualTerminal>( | 202 | auto vt = std::make_shared<mgm::LinuxVirtualTerminal>( |
4231 | 173 | real_fops, | 203 | real_fops, |
4232 | 204 | std::move(real_pops), | ||
4233 | 174 | options->get<int>("vt"), // TODO This option is mesa specific | 205 | options->get<int>("vt"), // TODO This option is mesa specific |
4234 | 175 | report); | 206 | report); |
4235 | 176 | 207 | ||
4236 | @@ -179,6 +210,12 @@ | |||
4237 | 179 | 210 | ||
4238 | 180 | extern "C" int mir_server_mesa_egl_native_display_is_valid(MirMesaEGLNativeDisplay* display) | 211 | extern "C" int mir_server_mesa_egl_native_display_is_valid(MirMesaEGLNativeDisplay* display) |
4239 | 181 | { | 212 | { |
4242 | 182 | return ((mgm::Platform::internal_display_clients_present) && | 213 | bool nested_internal_display_in_use = mgm::NativePlatform::internal_native_display_in_use(); |
4243 | 183 | (display == mgm::Platform::internal_native_display.get())); | 214 | bool host_internal_display_in_use = mgm::Platform::internal_display_clients_present; |
4244 | 215 | |||
4245 | 216 | if (host_internal_display_in_use) | ||
4246 | 217 | return (display == mgm::Platform::internal_native_display.get()); | ||
4247 | 218 | else if (nested_internal_display_in_use) | ||
4248 | 219 | return (display == mgm::NativePlatform::internal_native_display().get()); | ||
4249 | 220 | return 0; | ||
4250 | 184 | } | 221 | } |
4251 | 185 | 222 | ||
4252 | === modified file 'src/platform/graphics/mesa/real_kms_display_configuration.cpp' | |||
4253 | --- src/platform/graphics/mesa/real_kms_display_configuration.cpp 2014-03-05 02:30:30 +0000 | |||
4254 | +++ src/platform/graphics/mesa/real_kms_display_configuration.cpp 2014-03-17 15:02:33 +0000 | |||
4255 | @@ -66,11 +66,6 @@ | |||
4256 | 66 | return static_cast<mg::DisplayConfigurationOutputType>(connector_type); | 66 | return static_cast<mg::DisplayConfigurationOutputType>(connector_type); |
4257 | 67 | } | 67 | } |
4258 | 68 | 68 | ||
4259 | 69 | bool format_available_in_pixel_formats(MirPixelFormat format, mg::DisplayConfigurationOutput const& output) | ||
4260 | 70 | { | ||
4261 | 71 | return output.pixel_formats.end() != find(output.pixel_formats.begin(), output.pixel_formats.end(), format); | ||
4262 | 72 | } | ||
4263 | 73 | |||
4264 | 74 | } | 69 | } |
4265 | 75 | 70 | ||
4266 | 76 | mgm::RealKMSDisplayConfiguration::RealKMSDisplayConfiguration(int drm_fd) | 71 | mgm::RealKMSDisplayConfiguration::RealKMSDisplayConfiguration(int drm_fd) |
4267 | @@ -112,36 +107,13 @@ | |||
4268 | 112 | f(output); | 107 | f(output); |
4269 | 113 | } | 108 | } |
4270 | 114 | 109 | ||
4275 | 115 | void mgm::RealKMSDisplayConfiguration::configure_output( | 110 | void mgm::RealKMSDisplayConfiguration::for_each_output( |
4276 | 116 | DisplayConfigurationOutputId id, bool used, | 111 | std::function<void(UserDisplayConfigurationOutput&)> f) |
4273 | 117 | geometry::Point top_left, size_t mode_index, | ||
4274 | 118 | MirPixelFormat format, MirPowerMode power_mode, MirOrientation orientation) | ||
4277 | 119 | { | 112 | { |
4303 | 120 | auto iter = find_output_with_id(id); | 113 | for (auto& output : outputs) |
4304 | 121 | 114 | { | |
4305 | 122 | if (iter != outputs.end()) | 115 | UserDisplayConfigurationOutput user(output); |
4306 | 123 | { | 116 | f(user); |
4282 | 124 | auto& output = *iter; | ||
4283 | 125 | |||
4284 | 126 | if (used && mode_index >= output.modes.size()) | ||
4285 | 127 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid mode_index for used output")); | ||
4286 | 128 | |||
4287 | 129 | if (used && !valid_pixel_format(format)) | ||
4288 | 130 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid format for used output")); | ||
4289 | 131 | |||
4290 | 132 | if (used && !format_available_in_pixel_formats(format, output)) | ||
4291 | 133 | BOOST_THROW_EXCEPTION(std::runtime_error("Format not available for used output")); | ||
4292 | 134 | |||
4293 | 135 | output.used = used; | ||
4294 | 136 | output.top_left = top_left; | ||
4295 | 137 | output.current_mode_index = mode_index; | ||
4296 | 138 | output.current_format = format; | ||
4297 | 139 | output.power_mode = power_mode; | ||
4298 | 140 | output.orientation = orientation; | ||
4299 | 141 | } | ||
4300 | 142 | else | ||
4301 | 143 | { | ||
4302 | 144 | BOOST_THROW_EXCEPTION(std::runtime_error("Trying to configure invalid output")); | ||
4307 | 145 | } | 117 | } |
4308 | 146 | } | 118 | } |
4309 | 147 | 119 | ||
4310 | 148 | 120 | ||
4311 | === modified file 'src/platform/graphics/mesa/real_kms_display_configuration.h' | |||
4312 | --- src/platform/graphics/mesa/real_kms_display_configuration.h 2014-03-05 02:30:30 +0000 | |||
4313 | +++ src/platform/graphics/mesa/real_kms_display_configuration.h 2014-03-17 15:02:33 +0000 | |||
4314 | @@ -39,10 +39,7 @@ | |||
4315 | 39 | 39 | ||
4316 | 40 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const override; | 40 | void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const override; |
4317 | 41 | void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const override; | 41 | void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const override; |
4322 | 42 | void configure_output(DisplayConfigurationOutputId id, bool used, | 42 | void for_each_output(std::function<void(UserDisplayConfigurationOutput&)> f) override; |
4319 | 43 | geometry::Point top_left, size_t mode_index, | ||
4320 | 44 | MirPixelFormat format, MirPowerMode power_mode, | ||
4321 | 45 | MirOrientation orientation) override; | ||
4323 | 46 | 43 | ||
4324 | 47 | uint32_t get_kms_connector_id(DisplayConfigurationOutputId id) const; | 44 | uint32_t get_kms_connector_id(DisplayConfigurationOutputId id) const; |
4325 | 48 | size_t get_kms_mode_index(DisplayConfigurationOutputId id, size_t conf_mode_index) const; | 45 | size_t get_kms_mode_index(DisplayConfigurationOutputId id, size_t conf_mode_index) const; |
4326 | 49 | 46 | ||
4327 | === renamed file 'src/platform/graphics/mesa/overlapping_output_grouping.cpp' => 'src/platform/graphics/overlapping_output_grouping.cpp' | |||
4328 | --- src/platform/graphics/mesa/overlapping_output_grouping.cpp 2014-01-22 10:03:11 +0000 | |||
4329 | +++ src/platform/graphics/overlapping_output_grouping.cpp 2014-03-17 15:02:33 +0000 | |||
4330 | @@ -16,7 +16,7 @@ | |||
4331 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4332 | 17 | */ | 17 | */ |
4333 | 18 | 18 | ||
4335 | 19 | #include "overlapping_output_grouping.h" | 19 | #include "mir/graphics/overlapping_output_grouping.h" |
4336 | 20 | 20 | ||
4337 | 21 | #include "mir/graphics/display_configuration.h" | 21 | #include "mir/graphics/display_configuration.h" |
4338 | 22 | #include "mir/geometry/rectangle.h" | 22 | #include "mir/geometry/rectangle.h" |
4339 | @@ -25,7 +25,6 @@ | |||
4340 | 25 | #include <unordered_set> | 25 | #include <unordered_set> |
4341 | 26 | 26 | ||
4342 | 27 | namespace mg = mir::graphics; | 27 | namespace mg = mir::graphics; |
4343 | 28 | namespace mgm = mir::graphics::mesa; | ||
4344 | 29 | namespace geom = mir::geometry; | 28 | namespace geom = mir::geometry; |
4345 | 30 | 29 | ||
4346 | 31 | namespace | 30 | namespace |
4347 | @@ -33,7 +32,7 @@ | |||
4348 | 33 | 32 | ||
4349 | 34 | struct DCOutputHash | 33 | struct DCOutputHash |
4350 | 35 | { | 34 | { |
4352 | 36 | size_t operator()(mg::DisplayConfigurationOutput const& o) const { return o.id.as_value(); }; | 35 | size_t operator()(mg::DisplayConfigurationOutput const& o) const { return o.id.as_value(); } |
4353 | 37 | }; | 36 | }; |
4354 | 38 | 37 | ||
4355 | 39 | struct DCOutputEqual | 38 | struct DCOutputEqual |
4356 | @@ -51,7 +50,7 @@ | |||
4357 | 51 | * OverlappingOutputGroup * | 50 | * OverlappingOutputGroup * |
4358 | 52 | **************************/ | 51 | **************************/ |
4359 | 53 | 52 | ||
4361 | 54 | geom::Rectangle mgm::OverlappingOutputGroup::bounding_rectangle() const | 53 | geom::Rectangle mg::OverlappingOutputGroup::bounding_rectangle() const |
4362 | 55 | { | 54 | { |
4363 | 56 | geom::Rectangles rectangles; | 55 | geom::Rectangles rectangles; |
4364 | 57 | 56 | ||
4365 | @@ -61,7 +60,7 @@ | |||
4366 | 61 | return rectangles.bounding_rectangle(); | 60 | return rectangles.bounding_rectangle(); |
4367 | 62 | } | 61 | } |
4368 | 63 | 62 | ||
4370 | 64 | void mgm::OverlappingOutputGroup::for_each_output( | 63 | void mg::OverlappingOutputGroup::for_each_output( |
4371 | 65 | std::function<void(DisplayConfigurationOutput const&)> const& f) const | 64 | std::function<void(DisplayConfigurationOutput const&)> const& f) const |
4372 | 66 | { | 65 | { |
4373 | 67 | for (auto const& output : outputs) | 66 | for (auto const& output : outputs) |
4374 | @@ -72,7 +71,7 @@ | |||
4375 | 72 | * OverlappingOutputGrouping * | 71 | * OverlappingOutputGrouping * |
4376 | 73 | *****************************/ | 72 | *****************************/ |
4377 | 74 | 73 | ||
4379 | 75 | mgm::OverlappingOutputGrouping::OverlappingOutputGrouping(DisplayConfiguration const& conf) | 74 | mg::OverlappingOutputGrouping::OverlappingOutputGrouping(DisplayConfiguration const& conf) |
4380 | 76 | { | 75 | { |
4381 | 77 | conf.for_each_output([&](DisplayConfigurationOutput const& conf_output) | 76 | conf.for_each_output([&](DisplayConfigurationOutput const& conf_output) |
4382 | 78 | { | 77 | { |
4383 | @@ -85,14 +84,14 @@ | |||
4384 | 85 | 84 | ||
4385 | 86 | } | 85 | } |
4386 | 87 | 86 | ||
4388 | 88 | void mgm::OverlappingOutputGrouping::for_each_group( | 87 | void mg::OverlappingOutputGrouping::for_each_group( |
4389 | 89 | std::function<void(OverlappingOutputGroup const& group)> const& f) | 88 | std::function<void(OverlappingOutputGroup const& group)> const& f) |
4390 | 90 | { | 89 | { |
4391 | 91 | for (auto const& g : groups) | 90 | for (auto const& g : groups) |
4392 | 92 | f(g); | 91 | f(g); |
4393 | 93 | } | 92 | } |
4394 | 94 | 93 | ||
4396 | 95 | void mgm::OverlappingOutputGrouping::add_output(DisplayConfigurationOutput const& conf_output) | 94 | void mg::OverlappingOutputGrouping::add_output(DisplayConfigurationOutput const& conf_output) |
4397 | 96 | { | 95 | { |
4398 | 97 | std::vector<size_t> overlapping_groups; | 96 | std::vector<size_t> overlapping_groups; |
4399 | 98 | 97 | ||
4400 | 99 | 98 | ||
4401 | === modified file 'src/platform/options/default_configuration.cpp' | |||
4402 | --- src/platform/options/default_configuration.cpp 2014-03-04 14:19:36 +0000 | |||
4403 | +++ src/platform/options/default_configuration.cpp 2014-03-17 15:02:33 +0000 | |||
4404 | @@ -34,7 +34,6 @@ | |||
4405 | 34 | char const* const mo::scene_report_opt = "scene-report"; | 34 | char const* const mo::scene_report_opt = "scene-report"; |
4406 | 35 | char const* const mo::input_report_opt = "input-report"; | 35 | char const* const mo::input_report_opt = "input-report"; |
4407 | 36 | char const* const mo::host_socket_opt = "host-socket"; | 36 | char const* const mo::host_socket_opt = "host-socket"; |
4408 | 37 | char const* const mo::standalone_opt = "standalone"; | ||
4409 | 38 | char const* const mo::frontend_threads_opt = "ipc-thread-pool"; | 37 | char const* const mo::frontend_threads_opt = "ipc-thread-pool"; |
4410 | 39 | char const* const mo::name_opt = "name"; | 38 | char const* const mo::name_opt = "name"; |
4411 | 40 | char const* const mo::offscreen_opt = "offscreen"; | 39 | char const* const mo::offscreen_opt = "offscreen"; |
4412 | @@ -70,12 +69,10 @@ | |||
4413 | 70 | namespace po = boost::program_options; | 69 | namespace po = boost::program_options; |
4414 | 71 | 70 | ||
4415 | 72 | add_options() | 71 | add_options() |
4416 | 73 | (standalone_opt, po::value<bool>(), | ||
4417 | 74 | "Run mir in standalone mode. [bool:default=false]") | ||
4418 | 75 | (host_socket_opt, po::value<std::string>(), | 72 | (host_socket_opt, po::value<std::string>(), |
4420 | 76 | "Host socket filename. [string:default={$MIR_SOCKET,$XDG_RUNTIME_DIR/mir_socket}]") | 73 | "Host socket filename") |
4421 | 77 | (server_socket_opt, po::value<std::string>()->default_value(::mir::default_server_socket), | 74 | (server_socket_opt, po::value<std::string>()->default_value(::mir::default_server_socket), |
4423 | 78 | "Socket filename.") | 75 | "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]") |
4424 | 79 | (no_server_socket_opt, "Do not provide a socket filename for client connections") | 76 | (no_server_socket_opt, "Do not provide a socket filename for client connections") |
4425 | 80 | (platform_graphics_lib, po::value<std::string>()->default_value(default_platform_graphics_lib), | 77 | (platform_graphics_lib, po::value<std::string>()->default_value(default_platform_graphics_lib), |
4426 | 81 | "Library to use for platform graphics support") | 78 | "Library to use for platform graphics support") |
4427 | 82 | 79 | ||
4428 | === modified file 'src/server/CMakeLists.txt' | |||
4429 | --- src/server/CMakeLists.txt 2014-02-28 13:51:43 +0000 | |||
4430 | +++ src/server/CMakeLists.txt 2014-03-17 15:02:33 +0000 | |||
4431 | @@ -94,7 +94,7 @@ | |||
4432 | 94 | ) | 94 | ) |
4433 | 95 | endif() | 95 | endif() |
4434 | 96 | 96 | ||
4436 | 97 | set(MIRSERVER_ABI 16) | 97 | set(MIRSERVER_ABI 17) |
4437 | 98 | 98 | ||
4438 | 99 | set_target_properties( | 99 | set_target_properties( |
4439 | 100 | mirserver | 100 | mirserver |
4440 | 101 | 101 | ||
4441 | === modified file 'src/server/compositor/buffer_bundle.h' | |||
4442 | --- src/server/compositor/buffer_bundle.h 2014-02-10 09:07:48 +0000 | |||
4443 | +++ src/server/compositor/buffer_bundle.h 2014-03-17 15:02:33 +0000 | |||
4444 | @@ -46,6 +46,7 @@ | |||
4445 | 46 | virtual void allow_framedropping(bool dropping_allowed) = 0; | 46 | virtual void allow_framedropping(bool dropping_allowed) = 0; |
4446 | 47 | virtual void force_requests_to_complete() = 0; | 47 | virtual void force_requests_to_complete() = 0; |
4447 | 48 | virtual void resize(const geometry::Size &newsize) = 0; | 48 | virtual void resize(const geometry::Size &newsize) = 0; |
4448 | 49 | virtual int buffers_ready_for_compositor() const = 0; | ||
4449 | 49 | protected: | 50 | protected: |
4450 | 50 | BufferBundle() = default; | 51 | BufferBundle() = default; |
4451 | 51 | BufferBundle(BufferBundle const&) = delete; | 52 | BufferBundle(BufferBundle const&) = delete; |
4452 | 52 | 53 | ||
4453 | === modified file 'src/server/compositor/buffer_stream_surfaces.cpp' | |||
4454 | --- src/server/compositor/buffer_stream_surfaces.cpp 2014-02-10 09:07:48 +0000 | |||
4455 | +++ src/server/compositor/buffer_stream_surfaces.cpp 2014-03-17 15:02:33 +0000 | |||
4456 | @@ -83,3 +83,8 @@ | |||
4457 | 83 | { | 83 | { |
4458 | 84 | buffer_bundle->allow_framedropping(allow); | 84 | buffer_bundle->allow_framedropping(allow); |
4459 | 85 | } | 85 | } |
4460 | 86 | |||
4461 | 87 | int mc::BufferStreamSurfaces::buffers_ready_for_compositor() const | ||
4462 | 88 | { | ||
4463 | 89 | return buffer_bundle->buffers_ready_for_compositor(); | ||
4464 | 90 | } | ||
4465 | 86 | 91 | ||
4466 | === modified file 'src/server/compositor/buffer_stream_surfaces.h' | |||
4467 | --- src/server/compositor/buffer_stream_surfaces.h 2014-02-10 09:07:48 +0000 | |||
4468 | +++ src/server/compositor/buffer_stream_surfaces.h 2014-03-17 15:02:33 +0000 | |||
4469 | @@ -50,6 +50,7 @@ | |||
4470 | 50 | void resize(geometry::Size const& size) override; | 50 | void resize(geometry::Size const& size) override; |
4471 | 51 | void allow_framedropping(bool) override; | 51 | void allow_framedropping(bool) override; |
4472 | 52 | void force_requests_to_complete() override; | 52 | void force_requests_to_complete() override; |
4473 | 53 | int buffers_ready_for_compositor() const override; | ||
4474 | 53 | 54 | ||
4475 | 54 | protected: | 55 | protected: |
4476 | 55 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; | 56 | BufferStreamSurfaces(const BufferStreamSurfaces&) = delete; |
4477 | 56 | 57 | ||
4478 | === modified file 'src/server/compositor/bypass.cpp' | |||
4479 | --- src/server/compositor/bypass.cpp 2014-03-04 04:19:26 +0000 | |||
4480 | +++ src/server/compositor/bypass.cpp 2014-03-17 15:02:33 +0000 | |||
4481 | @@ -16,84 +16,46 @@ | |||
4482 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> |
4483 | 17 | */ | 17 | */ |
4484 | 18 | 18 | ||
4486 | 19 | #include "mir/compositor/compositing_criteria.h" | 19 | #include "mir/graphics/renderable.h" |
4487 | 20 | #include "mir/graphics/display_buffer.h" | 20 | #include "mir/graphics/display_buffer.h" |
4488 | 21 | #include "bypass.h" | 21 | #include "bypass.h" |
4489 | 22 | 22 | ||
4490 | 23 | using namespace mir; | 23 | using namespace mir; |
4491 | 24 | using namespace mir::compositor; | 24 | using namespace mir::compositor; |
4492 | 25 | using namespace mir::graphics; | ||
4493 | 25 | 26 | ||
4494 | 26 | BypassFilter::BypassFilter(const graphics::DisplayBuffer &display_buffer) | 27 | BypassFilter::BypassFilter(const graphics::DisplayBuffer &display_buffer) |
4495 | 27 | : display_buffer(display_buffer) | 28 | : display_buffer(display_buffer) |
4496 | 28 | { | 29 | { |
4497 | 29 | const geometry::Rectangle &rect = display_buffer.view_area(); | ||
4498 | 30 | int width = rect.size.width.as_int(); | ||
4499 | 31 | int height = rect.size.height.as_int(); | ||
4500 | 32 | |||
4501 | 33 | /* | ||
4502 | 34 | * For a surface to exactly fit the display_buffer, its transformation | ||
4503 | 35 | * will look exactly like this: | ||
4504 | 36 | */ | ||
4505 | 37 | fullscreen[0][0] = width; | ||
4506 | 38 | fullscreen[0][1] = 0.0f; | ||
4507 | 39 | fullscreen[0][2] = 0.0f; | ||
4508 | 40 | fullscreen[0][3] = 0.0f; | ||
4509 | 41 | |||
4510 | 42 | fullscreen[1][0] = 0.0f; | ||
4511 | 43 | fullscreen[1][1] = height; | ||
4512 | 44 | fullscreen[1][2] = 0.0f; | ||
4513 | 45 | fullscreen[1][3] = 0.0f; | ||
4514 | 46 | |||
4515 | 47 | fullscreen[2][0] = 0.0f; | ||
4516 | 48 | fullscreen[2][1] = 0.0f; | ||
4517 | 49 | fullscreen[2][2] = 0.0f; | ||
4518 | 50 | fullscreen[2][3] = 0.0f; | ||
4519 | 51 | |||
4520 | 52 | fullscreen[3][0] = rect.top_left.x.as_int() + width / 2; | ||
4521 | 53 | fullscreen[3][1] = rect.top_left.y.as_int() + height / 2; | ||
4522 | 54 | fullscreen[3][2] = 0.0f; | ||
4523 | 55 | fullscreen[3][3] = 1.0f; | ||
4524 | 56 | } | 30 | } |
4525 | 57 | 31 | ||
4527 | 58 | bool BypassFilter::operator()(const CompositingCriteria &criteria) | 32 | bool BypassFilter::operator()(const Renderable &renderable) |
4528 | 59 | { | 33 | { |
4529 | 60 | if (!all_orthogonal) | 34 | if (!all_orthogonal) |
4530 | 61 | return false; | 35 | return false; |
4531 | 62 | 36 | ||
4532 | 63 | const glm::mat4 &trans = criteria.transformation(); | ||
4533 | 64 | bool orthogonal = | ||
4534 | 65 | trans[0][1] == 0.0f && | ||
4535 | 66 | trans[0][2] == 0.0f && | ||
4536 | 67 | trans[0][3] == 0.0f && | ||
4537 | 68 | trans[1][0] == 0.0f && | ||
4538 | 69 | trans[1][2] == 0.0f && | ||
4539 | 70 | trans[1][3] == 0.0f && | ||
4540 | 71 | trans[2][0] == 0.0f && | ||
4541 | 72 | trans[2][1] == 0.0f && | ||
4542 | 73 | trans[2][2] == 0.0f && | ||
4543 | 74 | trans[2][3] == 0.0f && | ||
4544 | 75 | trans[3][2] == 0.0f && | ||
4545 | 76 | trans[3][3] == 1.0f; | ||
4546 | 77 | |||
4547 | 78 | // Any weird transformations? Then we can't risk any bypass | 37 | // Any weird transformations? Then we can't risk any bypass |
4549 | 79 | if (!orthogonal) | 38 | static const glm::mat4 identity; |
4550 | 39 | if (renderable.transformation() != identity) | ||
4551 | 80 | { | 40 | { |
4552 | 81 | all_orthogonal = false; | 41 | all_orthogonal = false; |
4553 | 82 | return false; | 42 | return false; |
4554 | 83 | } | 43 | } |
4555 | 84 | 44 | ||
4556 | 45 | auto const& view_area = display_buffer.view_area(); | ||
4557 | 46 | |||
4558 | 85 | // Not weirdly transformed but also not on this monitor? Don't care... | 47 | // Not weirdly transformed but also not on this monitor? Don't care... |
4559 | 86 | // This will also check the surface is not hidden and has been posted. | 48 | // This will also check the surface is not hidden and has been posted. |
4561 | 87 | if (!criteria.should_be_rendered_in(display_buffer.view_area())) | 49 | if (!renderable.should_be_rendered_in(view_area)) |
4562 | 88 | return false; | 50 | return false; |
4563 | 89 | 51 | ||
4564 | 90 | topmost_fits = false; | 52 | topmost_fits = false; |
4565 | 91 | 53 | ||
4567 | 92 | if (criteria.alpha() != 1.0f || criteria.shaped()) | 54 | if (renderable.alpha() != 1.0f || renderable.shaped()) |
4568 | 93 | return false; | 55 | return false; |
4569 | 94 | 56 | ||
4570 | 95 | // Transformed perfectly to fit the monitor? Bypass! | 57 | // Transformed perfectly to fit the monitor? Bypass! |
4572 | 96 | topmost_fits = criteria.transformation() == fullscreen; | 58 | topmost_fits = renderable.screen_position() == view_area; |
4573 | 97 | return topmost_fits; | 59 | return topmost_fits; |
4574 | 98 | } | 60 | } |
4575 | 99 | 61 | ||
4576 | @@ -102,13 +64,12 @@ | |||
4577 | 102 | return all_orthogonal && topmost_fits; | 64 | return all_orthogonal && topmost_fits; |
4578 | 103 | } | 65 | } |
4579 | 104 | 66 | ||
4582 | 105 | void BypassMatch::operator()(const CompositingCriteria &, | 67 | void BypassMatch::operator()(const Renderable &r) |
4581 | 106 | compositor::BufferStream &stream) | ||
4583 | 107 | { | 68 | { |
4585 | 108 | latest = &stream; | 69 | latest = &r; |
4586 | 109 | } | 70 | } |
4587 | 110 | 71 | ||
4589 | 111 | compositor::BufferStream *BypassMatch::topmost_fullscreen() const | 72 | const Renderable *BypassMatch::topmost_fullscreen() const |
4590 | 112 | { | 73 | { |
4591 | 113 | return latest; | 74 | return latest; |
4592 | 114 | } | 75 | } |
4593 | 115 | 76 | ||
4594 | === modified file 'src/server/compositor/bypass.h' | |||
4595 | --- src/server/compositor/bypass.h 2014-03-04 04:19:26 +0000 | |||
4596 | +++ src/server/compositor/bypass.h 2014-03-17 15:02:33 +0000 | |||
4597 | @@ -20,7 +20,6 @@ | |||
4598 | 20 | #define MIR_COMPOSITOR_BYPASS_H_ | 20 | #define MIR_COMPOSITOR_BYPASS_H_ |
4599 | 21 | 21 | ||
4600 | 22 | #include "mir/compositor/scene.h" | 22 | #include "mir/compositor/scene.h" |
4601 | 23 | #include "glm/glm.hpp" | ||
4602 | 24 | 23 | ||
4603 | 25 | namespace mir | 24 | namespace mir |
4604 | 26 | { | 25 | { |
4605 | @@ -30,32 +29,29 @@ | |||
4606 | 30 | } | 29 | } |
4607 | 31 | namespace compositor | 30 | namespace compositor |
4608 | 32 | { | 31 | { |
4609 | 33 | class CompositingCriteria; | ||
4610 | 34 | 32 | ||
4611 | 35 | class BypassFilter : public FilterForScene | 33 | class BypassFilter : public FilterForScene |
4612 | 36 | { | 34 | { |
4613 | 37 | public: | 35 | public: |
4614 | 38 | BypassFilter(const graphics::DisplayBuffer &display_buffer); | 36 | BypassFilter(const graphics::DisplayBuffer &display_buffer); |
4616 | 39 | bool operator()(const CompositingCriteria &criteria) override; | 37 | bool operator()(const graphics::Renderable &) override; |
4617 | 40 | bool fullscreen_on_top() const; | 38 | bool fullscreen_on_top() const; |
4618 | 41 | 39 | ||
4619 | 42 | private: | 40 | private: |
4620 | 43 | bool all_orthogonal = true; | 41 | bool all_orthogonal = true; |
4621 | 44 | bool topmost_fits = false; | 42 | bool topmost_fits = false; |
4622 | 45 | glm::mat4 fullscreen; | ||
4623 | 46 | const graphics::DisplayBuffer &display_buffer; | 43 | const graphics::DisplayBuffer &display_buffer; |
4624 | 47 | }; | 44 | }; |
4625 | 48 | 45 | ||
4626 | 49 | class BypassMatch : public OperatorForScene | 46 | class BypassMatch : public OperatorForScene |
4627 | 50 | { | 47 | { |
4628 | 51 | public: | 48 | public: |
4632 | 52 | void operator()(const CompositingCriteria &, | 49 | void operator()(const graphics::Renderable &) override; |
4633 | 53 | compositor::BufferStream &stream) override; | 50 | const graphics::Renderable *topmost_fullscreen() const; |
4631 | 54 | compositor::BufferStream *topmost_fullscreen() const; | ||
4634 | 55 | 51 | ||
4635 | 56 | private: | 52 | private: |
4638 | 57 | // This has to be a pointer. We have no control over BufferStream lifetime | 53 | // This has to be a pointer. We have no control over Renderable lifetime |
4639 | 58 | compositor::BufferStream *latest = nullptr; | 54 | const graphics::Renderable *latest = nullptr; |
4640 | 59 | }; | 55 | }; |
4641 | 60 | 56 | ||
4642 | 61 | } // namespace compositor | 57 | } // namespace compositor |
4643 | 62 | 58 | ||
4644 | === modified file 'src/server/compositor/compositing_screencast.cpp' | |||
4645 | --- src/server/compositor/compositing_screencast.cpp 2014-02-05 16:32:31 +0000 | |||
4646 | +++ src/server/compositor/compositing_screencast.cpp 2014-03-17 15:02:33 +0000 | |||
4647 | @@ -60,15 +60,21 @@ | |||
4648 | 60 | } | 60 | } |
4649 | 61 | 61 | ||
4650 | 62 | mf::ScreencastSessionId mc::CompositingScreencast::create_session( | 62 | mf::ScreencastSessionId mc::CompositingScreencast::create_session( |
4652 | 63 | graphics::DisplayConfigurationOutputId output_id) | 63 | geom::Rectangle const& region, |
4653 | 64 | geom::Size const& size, | ||
4654 | 65 | MirPixelFormat const pixel_format) | ||
4655 | 64 | { | 66 | { |
4660 | 65 | geom::Rectangle extents; | 67 | if (size.width.as_int() == 0 || |
4661 | 66 | MirPixelFormat pixel_format; | 68 | size.height.as_int() == 0 || |
4662 | 67 | std::tie(extents,pixel_format) = output_info_for(output_id); | 69 | region.size.width.as_int() == 0 || |
4663 | 68 | 70 | region.size.height.as_int() == 0 || | |
4664 | 71 | pixel_format == mir_pixel_format_invalid) | ||
4665 | 72 | { | ||
4666 | 73 | BOOST_THROW_EXCEPTION(std::runtime_error("Invalid parameters")); | ||
4667 | 74 | } | ||
4668 | 69 | std::lock_guard<decltype(session_mutex)> lock{session_mutex}; | 75 | std::lock_guard<decltype(session_mutex)> lock{session_mutex}; |
4669 | 70 | auto const id = next_available_session_id(); | 76 | auto const id = next_available_session_id(); |
4671 | 71 | session_contexts[id] = create_session_context(extents, pixel_format); | 77 | session_contexts[id] = create_session_context(region, size, pixel_format); |
4672 | 72 | 78 | ||
4673 | 73 | return id; | 79 | return id; |
4674 | 74 | } | 80 | } |
4675 | @@ -115,43 +121,14 @@ | |||
4676 | 115 | BOOST_THROW_EXCEPTION(std::runtime_error("Too many screencast sessions!")); | 121 | BOOST_THROW_EXCEPTION(std::runtime_error("Too many screencast sessions!")); |
4677 | 116 | } | 122 | } |
4678 | 117 | 123 | ||
4679 | 118 | std::pair<geom::Rectangle,MirPixelFormat> | ||
4680 | 119 | mc::CompositingScreencast::output_info_for( | ||
4681 | 120 | graphics::DisplayConfigurationOutputId output_id) | ||
4682 | 121 | { | ||
4683 | 122 | auto const conf = display->configuration(); | ||
4684 | 123 | geom::Rectangle extents; | ||
4685 | 124 | MirPixelFormat pixel_format{mir_pixel_format_invalid}; | ||
4686 | 125 | |||
4687 | 126 | conf->for_each_output( | ||
4688 | 127 | [&](mg::DisplayConfigurationOutput const& output) | ||
4689 | 128 | { | ||
4690 | 129 | if (output.id == output_id && | ||
4691 | 130 | output.connected && output.used && | ||
4692 | 131 | output.current_mode_index < output.modes.size()) | ||
4693 | 132 | { | ||
4694 | 133 | extents = output.extents(); | ||
4695 | 134 | pixel_format = output.current_format; | ||
4696 | 135 | } | ||
4697 | 136 | }); | ||
4698 | 137 | |||
4699 | 138 | if (extents == geom::Rectangle() || | ||
4700 | 139 | pixel_format == mir_pixel_format_invalid) | ||
4701 | 140 | { | ||
4702 | 141 | BOOST_THROW_EXCEPTION( | ||
4703 | 142 | std::runtime_error("Invalid output for screen capture")); | ||
4704 | 143 | } | ||
4705 | 144 | |||
4706 | 145 | return {extents, pixel_format}; | ||
4707 | 146 | } | ||
4708 | 147 | |||
4709 | 148 | std::shared_ptr<mc::detail::ScreencastSessionContext> | 124 | std::shared_ptr<mc::detail::ScreencastSessionContext> |
4710 | 149 | mc::CompositingScreencast::create_session_context( | 125 | mc::CompositingScreencast::create_session_context( |
4711 | 150 | geometry::Rectangle const& rect, | 126 | geometry::Rectangle const& rect, |
4712 | 127 | geometry::Size const& size, | ||
4713 | 151 | MirPixelFormat pixel_format) | 128 | MirPixelFormat pixel_format) |
4714 | 152 | { | 129 | { |
4715 | 153 | mg::BufferProperties buffer_properties{ | 130 | mg::BufferProperties buffer_properties{ |
4717 | 154 | rect.size, | 131 | size, |
4718 | 155 | pixel_format, | 132 | pixel_format, |
4719 | 156 | mg::BufferUsage::hardware}; | 133 | mg::BufferUsage::hardware}; |
4720 | 157 | 134 | ||
4721 | 158 | 135 | ||
4722 | === modified file 'src/server/compositor/compositing_screencast.h' | |||
4723 | --- src/server/compositor/compositing_screencast.h 2014-02-05 16:32:31 +0000 | |||
4724 | +++ src/server/compositor/compositing_screencast.h 2014-03-17 15:02:33 +0000 | |||
4725 | @@ -48,16 +48,18 @@ | |||
4726 | 48 | std::shared_ptr<DisplayBufferCompositorFactory> const& db_compositor_factory); | 48 | std::shared_ptr<DisplayBufferCompositorFactory> const& db_compositor_factory); |
4727 | 49 | 49 | ||
4728 | 50 | frontend::ScreencastSessionId create_session( | 50 | frontend::ScreencastSessionId create_session( |
4730 | 51 | graphics::DisplayConfigurationOutputId output_id); | 51 | geometry::Rectangle const& region, |
4731 | 52 | geometry::Size const& size, | ||
4732 | 53 | MirPixelFormat pixel_format); | ||
4733 | 52 | void destroy_session(frontend::ScreencastSessionId id); | 54 | void destroy_session(frontend::ScreencastSessionId id); |
4734 | 53 | std::shared_ptr<graphics::Buffer> capture(frontend::ScreencastSessionId id); | 55 | std::shared_ptr<graphics::Buffer> capture(frontend::ScreencastSessionId id); |
4735 | 54 | 56 | ||
4736 | 55 | private: | 57 | private: |
4737 | 56 | frontend::ScreencastSessionId next_available_session_id(); | 58 | frontend::ScreencastSessionId next_available_session_id(); |
4738 | 57 | std::pair<geometry::Rectangle,MirPixelFormat> output_info_for( | ||
4739 | 58 | graphics::DisplayConfigurationOutputId output_id); | ||
4740 | 59 | std::shared_ptr<detail::ScreencastSessionContext> | 59 | std::shared_ptr<detail::ScreencastSessionContext> |
4742 | 60 | create_session_context(geometry::Rectangle const& rect, MirPixelFormat pixel_format); | 60 | create_session_context(geometry::Rectangle const& rect, |
4743 | 61 | geometry::Size const& size, | ||
4744 | 62 | MirPixelFormat pixel_format); | ||
4745 | 61 | 63 | ||
4746 | 62 | std::mutex session_mutex; | 64 | std::mutex session_mutex; |
4747 | 63 | std::shared_ptr<graphics::Display> const display; | 65 | std::shared_ptr<graphics::Display> const display; |
4748 | 64 | 66 | ||
4749 | === modified file 'src/server/compositor/default_configuration.cpp' | |||
4750 | --- src/server/compositor/default_configuration.cpp 2014-02-28 13:51:43 +0000 | |||
4751 | +++ src/server/compositor/default_configuration.cpp 2014-03-17 15:02:33 +0000 | |||
4752 | @@ -25,6 +25,7 @@ | |||
4753 | 25 | #include "compositing_screencast.h" | 25 | #include "compositing_screencast.h" |
4754 | 26 | 26 | ||
4755 | 27 | #include "mir/frontend/screencast.h" | 27 | #include "mir/frontend/screencast.h" |
4756 | 28 | #include "mir/options/configuration.h" | ||
4757 | 28 | 29 | ||
4758 | 29 | #include <boost/throw_exception.hpp> | 30 | #include <boost/throw_exception.hpp> |
4759 | 30 | 31 | ||
4760 | @@ -59,10 +60,12 @@ | |||
4761 | 59 | return compositor( | 60 | return compositor( |
4762 | 60 | [this]() | 61 | [this]() |
4763 | 61 | { | 62 | { |
4768 | 62 | return std::make_shared<mc::MultiThreadedCompositor>(the_display(), | 63 | return std::make_shared<mc::MultiThreadedCompositor>( |
4769 | 63 | the_scene(), | 64 | the_display(), |
4770 | 64 | the_display_buffer_compositor_factory(), | 65 | the_scene(), |
4771 | 65 | the_compositor_report()); | 66 | the_display_buffer_compositor_factory(), |
4772 | 67 | the_compositor_report(), | ||
4773 | 68 | !the_options()->is_set(options::host_socket_opt)); | ||
4774 | 66 | }); | 69 | }); |
4775 | 67 | } | 70 | } |
4776 | 68 | 71 | ||
4777 | 69 | 72 | ||
4778 | === modified file 'src/server/compositor/default_display_buffer_compositor.cpp' | |||
4779 | --- src/server/compositor/default_display_buffer_compositor.cpp 2014-03-04 04:19:26 +0000 | |||
4780 | +++ src/server/compositor/default_display_buffer_compositor.cpp 2014-03-17 15:02:33 +0000 | |||
4781 | @@ -21,7 +21,7 @@ | |||
4782 | 21 | 21 | ||
4783 | 22 | #include "rendering_operator.h" | 22 | #include "rendering_operator.h" |
4784 | 23 | #include "mir/compositor/scene.h" | 23 | #include "mir/compositor/scene.h" |
4786 | 24 | #include "mir/compositor/compositing_criteria.h" | 24 | #include "mir/graphics/renderable.h" |
4787 | 25 | #include "mir/graphics/display_buffer.h" | 25 | #include "mir/graphics/display_buffer.h" |
4788 | 26 | #include "mir/graphics/buffer.h" | 26 | #include "mir/graphics/buffer.h" |
4789 | 27 | #include "mir/compositor/buffer_stream.h" | 27 | #include "mir/compositor/buffer_stream.h" |
4790 | @@ -46,10 +46,10 @@ | |||
4791 | 46 | occlusions(occlusions) | 46 | occlusions(occlusions) |
4792 | 47 | { | 47 | { |
4793 | 48 | } | 48 | } |
4795 | 49 | bool operator()(mc::CompositingCriteria const& info) | 49 | bool operator()(mg::Renderable const& r) |
4796 | 50 | { | 50 | { |
4799 | 51 | return info.should_be_rendered_in(enclosing_region) && | 51 | return r.should_be_rendered_in(enclosing_region) && |
4800 | 52 | !occlusions.occluded(info); | 52 | !occlusions.occluded(r); |
4801 | 53 | } | 53 | } |
4802 | 54 | 54 | ||
4803 | 55 | mir::geometry::Rectangle const& enclosing_region; | 55 | mir::geometry::Rectangle const& enclosing_region; |
4804 | @@ -80,7 +80,7 @@ | |||
4805 | 80 | } | 80 | } |
4806 | 81 | 81 | ||
4807 | 82 | 82 | ||
4809 | 83 | void mc::DefaultDisplayBufferCompositor::composite() | 83 | bool mc::DefaultDisplayBufferCompositor::composite() |
4810 | 84 | { | 84 | { |
4811 | 85 | report->began_frame(this); | 85 | report->began_frame(this); |
4812 | 86 | 86 | ||
4813 | @@ -104,9 +104,15 @@ | |||
4814 | 104 | return !env || env[0] != '0'; | 104 | return !env || env[0] != '0'; |
4815 | 105 | }()}; | 105 | }()}; |
4816 | 106 | bool bypassed = false; | 106 | bool bypassed = false; |
4817 | 107 | bool uncomposited_buffers{false}; | ||
4818 | 107 | 108 | ||
4819 | 108 | if (bypass_env && display_buffer.can_bypass()) | 109 | if (bypass_env && display_buffer.can_bypass()) |
4820 | 109 | { | 110 | { |
4821 | 111 | // It would be *really* nice not to lock the scene for a composite pass. | ||
4822 | 112 | // (C.f. lp:1234018) | ||
4823 | 113 | // A compositor shouldn't know anything about navigating the scene, | ||
4824 | 114 | // it should be passed a collection of objects to render. (And any | ||
4825 | 115 | // locks managed by the scene - which can just lock what is needed.) | ||
4826 | 110 | std::unique_lock<Scene> lock(*scene); | 116 | std::unique_lock<Scene> lock(*scene); |
4827 | 111 | 117 | ||
4828 | 112 | mc::BypassFilter filter(display_buffer); | 118 | mc::BypassFilter filter(display_buffer); |
4829 | @@ -118,11 +124,12 @@ | |||
4830 | 118 | if (filter.fullscreen_on_top()) | 124 | if (filter.fullscreen_on_top()) |
4831 | 119 | { | 125 | { |
4832 | 120 | auto bypass_buf = | 126 | auto bypass_buf = |
4835 | 121 | match.topmost_fullscreen()->lock_compositor_buffer( | 127 | match.topmost_fullscreen()->buffer(local_frameno); |
4834 | 122 | local_frameno); | ||
4836 | 123 | 128 | ||
4837 | 124 | if (bypass_buf->can_bypass()) | 129 | if (bypass_buf->can_bypass()) |
4838 | 125 | { | 130 | { |
4839 | 131 | uncomposited_buffers = match.topmost_fullscreen()->buffers_ready_for_compositor() > 1; | ||
4840 | 132 | |||
4841 | 126 | lock.unlock(); | 133 | lock.unlock(); |
4842 | 127 | display_buffer.post_update(bypass_buf); | 134 | display_buffer.post_update(bypass_buf); |
4843 | 128 | bypassed = true; | 135 | bypassed = true; |
4844 | @@ -150,14 +157,24 @@ | |||
4845 | 150 | 157 | ||
4846 | 151 | renderer->set_rotation(display_buffer.orientation()); | 158 | renderer->set_rotation(display_buffer.orientation()); |
4847 | 152 | renderer->begin(); | 159 | renderer->begin(); |
4849 | 153 | mc::RenderingOperator applicator(*renderer, save_resource, local_frameno); | 160 | mc::RenderingOperator applicator(*renderer, save_resource, local_frameno, uncomposited_buffers); |
4850 | 154 | FilterForVisibleSceneInRegion selector(view_area, occlusion_match); | 161 | FilterForVisibleSceneInRegion selector(view_area, occlusion_match); |
4851 | 155 | scene->for_each_if(selector, applicator); | 162 | scene->for_each_if(selector, applicator); |
4852 | 156 | renderer->end(); | 163 | renderer->end(); |
4853 | 157 | 164 | ||
4854 | 158 | display_buffer.post_update(); | 165 | display_buffer.post_update(); |
4855 | 166 | |||
4856 | 167 | // This is a frig to avoid lp:1286190 | ||
4857 | 168 | if (size_of_last_pass) | ||
4858 | 169 | { | ||
4859 | 170 | uncomposited_buffers |= saved_resources.empty(); | ||
4860 | 171 | } | ||
4861 | 172 | |||
4862 | 173 | size_of_last_pass = saved_resources.size(); | ||
4863 | 174 | // End of frig | ||
4864 | 159 | } | 175 | } |
4865 | 160 | 176 | ||
4866 | 161 | report->finished_frame(bypassed, this); | 177 | report->finished_frame(bypassed, this); |
4867 | 178 | return uncomposited_buffers; | ||
4868 | 162 | } | 179 | } |
4869 | 163 | 180 | ||
4870 | 164 | 181 | ||
4871 | === modified file 'src/server/compositor/default_display_buffer_compositor.h' | |||
4872 | --- src/server/compositor/default_display_buffer_compositor.h 2014-01-22 10:03:11 +0000 | |||
4873 | +++ src/server/compositor/default_display_buffer_compositor.h 2014-03-17 15:02:33 +0000 | |||
4874 | @@ -44,7 +44,7 @@ | |||
4875 | 44 | std::shared_ptr<Renderer> const& renderer, | 44 | std::shared_ptr<Renderer> const& renderer, |
4876 | 45 | std::shared_ptr<CompositorReport> const& report); | 45 | std::shared_ptr<CompositorReport> const& report); |
4877 | 46 | 46 | ||
4879 | 47 | void composite() override; | 47 | bool composite() override; |
4880 | 48 | 48 | ||
4881 | 49 | private: | 49 | private: |
4882 | 50 | graphics::DisplayBuffer& display_buffer; | 50 | graphics::DisplayBuffer& display_buffer; |
4883 | @@ -53,6 +53,7 @@ | |||
4884 | 53 | std::shared_ptr<Renderer> const renderer; | 53 | std::shared_ptr<Renderer> const renderer; |
4885 | 54 | std::shared_ptr<CompositorReport> const report; | 54 | std::shared_ptr<CompositorReport> const report; |
4886 | 55 | 55 | ||
4887 | 56 | int size_of_last_pass = 0; | ||
4888 | 56 | unsigned long local_frameno; | 57 | unsigned long local_frameno; |
4889 | 57 | }; | 58 | }; |
4890 | 58 | 59 | ||
4891 | 59 | 60 | ||
4892 | === modified file 'src/server/compositor/default_display_buffer_compositor_factory.cpp' | |||
4893 | --- src/server/compositor/default_display_buffer_compositor_factory.cpp 2014-01-31 05:10:46 +0000 | |||
4894 | +++ src/server/compositor/default_display_buffer_compositor_factory.cpp 2014-03-17 15:02:33 +0000 | |||
4895 | @@ -17,8 +17,8 @@ | |||
4896 | 17 | */ | 17 | */ |
4897 | 18 | 18 | ||
4898 | 19 | #include "default_display_buffer_compositor_factory.h" | 19 | #include "default_display_buffer_compositor_factory.h" |
4901 | 20 | #include "renderer_factory.h" | 20 | #include "mir/compositor/renderer_factory.h" |
4902 | 21 | #include "renderer.h" | 21 | #include "mir/compositor/renderer.h" |
4903 | 22 | #include "mir/graphics/display_buffer.h" | 22 | #include "mir/graphics/display_buffer.h" |
4904 | 23 | 23 | ||
4905 | 24 | #include "default_display_buffer_compositor.h" | 24 | #include "default_display_buffer_compositor.h" |
4906 | 25 | 25 | ||
4907 | === modified file 'src/server/compositor/gl_renderer.cpp' | |||
4908 | --- src/server/compositor/gl_renderer.cpp 2014-03-04 04:19:26 +0000 | |||
4909 | +++ src/server/compositor/gl_renderer.cpp 2014-03-17 15:02:33 +0000 | |||
4910 | @@ -15,11 +15,12 @@ | |||
4911 | 15 | * Authored By: Alexandros Frantzis <alexandros.frantzis@canonical.com> | 15 | * Authored By: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4912 | 16 | */ | 16 | */ |
4913 | 17 | 17 | ||
4916 | 18 | #include "gl_renderer.h" | 18 | #include "mir/compositor/gl_renderer.h" |
4915 | 19 | #include "mir/compositor/compositing_criteria.h" | ||
4917 | 20 | #include "mir/compositor/buffer_stream.h" | 19 | #include "mir/compositor/buffer_stream.h" |
4918 | 20 | #include "mir/graphics/renderable.h" | ||
4919 | 21 | #include "mir/graphics/buffer.h" | 21 | #include "mir/graphics/buffer.h" |
4920 | 22 | 22 | ||
4921 | 23 | #define GLM_FORCE_RADIANS | ||
4922 | 23 | #include <glm/gtc/matrix_transform.hpp> | 24 | #include <glm/gtc/matrix_transform.hpp> |
4923 | 24 | #include <glm/gtc/type_ptr.hpp> | 25 | #include <glm/gtc/type_ptr.hpp> |
4924 | 25 | 26 | ||
4925 | @@ -42,9 +43,13 @@ | |||
4926 | 42 | "uniform mat4 screen_to_gl_coords;\n" | 43 | "uniform mat4 screen_to_gl_coords;\n" |
4927 | 43 | "uniform mat4 display_transform;\n" | 44 | "uniform mat4 display_transform;\n" |
4928 | 44 | "uniform mat4 transform;\n" | 45 | "uniform mat4 transform;\n" |
4929 | 46 | "uniform vec2 centre;\n" | ||
4930 | 45 | "varying vec2 v_texcoord;\n" | 47 | "varying vec2 v_texcoord;\n" |
4931 | 46 | "void main() {\n" | 48 | "void main() {\n" |
4933 | 47 | " gl_Position = display_transform * screen_to_gl_coords * transform * vec4(position, 1.0);\n" | 49 | " vec4 mid = vec4(centre, 0.0, 0.0);\n" |
4934 | 50 | " vec4 transformed = (transform * (vec4(position, 1.0) - mid)) + mid;\n" | ||
4935 | 51 | " transformed.z = 0.0;\n" // avoid clipping while we lack depth/perspective | ||
4936 | 52 | " gl_Position = display_transform * screen_to_gl_coords * transformed;\n" | ||
4937 | 48 | " v_texcoord = texcoord;\n" | 53 | " v_texcoord = texcoord;\n" |
4938 | 49 | "}\n" | 54 | "}\n" |
4939 | 50 | }; | 55 | }; |
4940 | @@ -61,39 +66,6 @@ | |||
4941 | 61 | "}\n" | 66 | "}\n" |
4942 | 62 | }; | 67 | }; |
4943 | 63 | 68 | ||
4944 | 64 | struct VertexAttributes | ||
4945 | 65 | { | ||
4946 | 66 | glm::vec3 position; | ||
4947 | 67 | glm::vec2 texcoord; | ||
4948 | 68 | }; | ||
4949 | 69 | |||
4950 | 70 | /* | ||
4951 | 71 | * The texture coordinates are y-inverted to account for the difference in the | ||
4952 | 72 | * texture and renderable pixel data row order. In particular, GL textures | ||
4953 | 73 | * expect pixel data in rows starting from the bottom and moving up the image, | ||
4954 | 74 | * whereas our renderables provide data in rows starting from the top and | ||
4955 | 75 | * moving down the image. | ||
4956 | 76 | */ | ||
4957 | 77 | VertexAttributes vertex_attribs[4] = | ||
4958 | 78 | { | ||
4959 | 79 | { | ||
4960 | 80 | glm::vec3{-0.5f, -0.5f, 0.0f}, | ||
4961 | 81 | glm::vec2{0.0f, 0.0f} | ||
4962 | 82 | }, | ||
4963 | 83 | { | ||
4964 | 84 | glm::vec3{-0.5f, 0.5f, 0.0f}, | ||
4965 | 85 | glm::vec2{0.0f, 1.0f}, | ||
4966 | 86 | }, | ||
4967 | 87 | { | ||
4968 | 88 | glm::vec3{0.5f, -0.5f, 0.0f}, | ||
4969 | 89 | glm::vec2{1.0f, 0.0f}, | ||
4970 | 90 | }, | ||
4971 | 91 | { | ||
4972 | 92 | glm::vec3{0.5f, 0.5f, 0.0f}, | ||
4973 | 93 | glm::vec2{1.0f, 1.0f} | ||
4974 | 94 | } | ||
4975 | 95 | }; | ||
4976 | 96 | |||
4977 | 97 | typedef void(*MirGLGetObjectInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); | 69 | typedef void(*MirGLGetObjectInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); |
4978 | 98 | typedef void(*MirGLGetObjectiv)(GLuint, GLenum, GLint *); | 70 | typedef void(*MirGLGetObjectiv)(GLuint, GLenum, GLint *); |
4979 | 99 | 71 | ||
4980 | @@ -126,9 +98,9 @@ | |||
4981 | 126 | program(0), | 98 | program(0), |
4982 | 127 | position_attr_loc(0), | 99 | position_attr_loc(0), |
4983 | 128 | texcoord_attr_loc(0), | 100 | texcoord_attr_loc(0), |
4984 | 101 | centre_uniform_loc(0), | ||
4985 | 129 | transform_uniform_loc(0), | 102 | transform_uniform_loc(0), |
4986 | 130 | alpha_uniform_loc(0), | 103 | alpha_uniform_loc(0), |
4987 | 131 | vertex_attribs_vbo(0), | ||
4988 | 132 | rotation(NAN) // ensure the first set_rotation succeeds | 104 | rotation(NAN) // ensure the first set_rotation succeeds |
4989 | 133 | { | 105 | { |
4990 | 134 | /* | 106 | /* |
4991 | @@ -189,16 +161,10 @@ | |||
4992 | 189 | alpha_uniform_loc = glGetUniformLocation(program, "alpha"); | 161 | alpha_uniform_loc = glGetUniformLocation(program, "alpha"); |
4993 | 190 | position_attr_loc = glGetAttribLocation(program, "position"); | 162 | position_attr_loc = glGetAttribLocation(program, "position"); |
4994 | 191 | texcoord_attr_loc = glGetAttribLocation(program, "texcoord"); | 163 | texcoord_attr_loc = glGetAttribLocation(program, "texcoord"); |
4995 | 164 | centre_uniform_loc = glGetUniformLocation(program, "centre"); | ||
4996 | 192 | 165 | ||
4997 | 193 | glUniform1i(tex_loc, 0); | 166 | glUniform1i(tex_loc, 0); |
4998 | 194 | 167 | ||
4999 | 195 | /* Create VBO */ | ||
5000 | 196 | glGenBuffers(1, &vertex_attribs_vbo); |
Did you test your feature/code change/bug fix ? what device(s) ?
- code has been run through CI testing on lp:mir/devel, running on desktop, n10, n4 & n7
Did you break mir server API or ABI and have the relevant bumps to .so and debian docs been made ?
- ABI for server, so name bumped
Did you break mir client API or ABI and have you followed up with the known clients & announced on mir-devel mailing list ?
- ABI for server broke, relevant MP's are in place