Merge lp:~brandontschaefer/mir/server-gamma-kms into lp:mir
- server-gamma-kms
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Cemil Azizoglu |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3691 |
Proposed branch: | lp:~brandontschaefer/mir/server-gamma-kms |
Merge into: | lp:mir |
Diff against target: |
955 lines (+379/-34) 34 files modified
include/common/mir_toolkit/common.h (+9/-0) include/platform/mir/graphics/display_configuration.h (+7/-0) include/platform/mir/graphics/gamma_curves.h (+42/-0) src/platform/graphics/CMakeLists.txt (+1/-0) src/platform/graphics/display_configuration.cpp (+3/-1) src/platform/graphics/gamma_curves.cpp (+38/-0) src/platform/symbols.map (+1/-0) src/platforms/android/server/display_configuration.cpp (+3/-1) src/platforms/android/server/fb_device.cpp (+3/-1) src/platforms/android/server/hwc_blanking_control.cpp (+3/-1) src/platforms/mesa/server/kms/display.cpp (+2/-0) src/platforms/mesa/server/kms/kms_output.h (+1/-0) src/platforms/mesa/server/kms/real_kms_display_configuration.cpp (+32/-1) src/platforms/mesa/server/kms/real_kms_display_configuration.h (+1/-0) src/platforms/mesa/server/kms/real_kms_output.cpp (+31/-0) src/platforms/mesa/server/kms/real_kms_output.h (+1/-0) src/platforms/mesa/server/x11/graphics/display_configuration.cpp (+3/-1) src/server/graphics/nested/nested_display_configuration.cpp (+11/-4) src/server/graphics/nested/nested_display_configuration.h (+2/-0) tests/include/mir/test/doubles/mock_drm.h (+5/-0) tests/mir_test/display_config_matchers.cpp (+9/-3) tests/mir_test_doubles/mock_drm.cpp (+12/-0) tests/mir_test_doubles/stub_display_configuration.cpp (+12/-4) tests/unit-tests/graphics/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/test_default_display_configuration_policy.cpp (+3/-1) tests/unit-tests/graphics/test_display_configuration.cpp (+3/-1) tests/unit-tests/graphics/test_gamma_curves.cpp (+67/-0) tests/unit-tests/graphics/test_overlapping_output_grouping.cpp (+3/-1) tests/unit-tests/platforms/mesa/kms/mock_kms_output.h (+1/-0) tests/unit-tests/platforms/mesa/kms/test_cursor.cpp (+9/-3) tests/unit-tests/platforms/mesa/kms/test_display.cpp (+6/-1) tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp (+27/-9) tests/unit-tests/platforms/mesa/kms/test_real_kms_output.cpp (+24/-0) tests/unit-tests/scene/test_mediating_display_changer.cpp (+3/-1) |
To merge this branch: | bzr merge lp:~brandontschaefer/mir/server-gamma-kms |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cemil Azizoglu (community) | Approve | ||
Mir CI Bot | continuous-integration | Approve | |
Kevin DuBois (community) | Approve | ||
Review via email: mp+304016@code.launchpad.net |
Commit message
Gamma support for KMS. Other platforms unsupported
Description of the change
The setup for server side gamma support for kms. Unsupported for other platforms.
Mir CI Bot (mir-ci-bot) wrote : | # |
Brandon Schaefer (brandontschaefer) wrote : | # |
I need to fix up some vivid+overlay things (will do soon)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3658
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel van Vugt (vanvugt) wrote : | # |
^^^
Syntax errors on vivid again. Remember to test with gcc-4.9/vivid.
Kevin DuBois (kdub) wrote : | # |
needs fixings:
46: typo
30: DisplayGamma, would be better if the vectors for the color components couldnt be of different lengths, eg, instead of DisplayGamma, it could just be "std::vector<
280: ret checked, but not used
nits:
47/48 and 57/58 would be nice to group members and functions together (although just a stylistic thing really)
263: whitespace addition
Brandon Schaefer (brandontschaefer) wrote : | # |
Also note that cross-compiler script is broken for me at lease in yakkety:
http://
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3659
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3660
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3661
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3662
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3663
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3664
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3665
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
+ red_ (bytes_red.size() / 2),
+ green_(
+ blue_ (bytes_red.size() / 2)
spacing, plus would be better to use sizeof() instead of just 2.
+ DisplayGamma(
+ std::string const& bytes_green,
+ std::string const& bytes_blue);
Seeing as this is in the public API, the constructors should be generic, and IIRC from IRC, the string constructor was to help with unflattening the IPC. It might just be better to have it take 3 vectors, and check their sizes.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3666
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3667
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
alright, getting there :)
We don't need to specify the rule-of-5 stuff, as its all defaulted anyways.
We don't really need the rvalue constructor of triple vectors, just the const& is sufficient. Then we also don't need the private function to check the sizes.
The vectors themselves could also be public again. std::vector has nicer semantics than the red(), green(), blue(), and size() interface, plus we have to provide less symbols then.
Also, DisplayConfigur
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3668
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Kevin DuBois (kdub) wrote : | # |
the gamma struct looks good to me.
src/platform/
needs an update still, but after that, lgtm
Kevin DuBois (kdub) wrote : | # |
> the gamma struct looks good to me.
I still think that GammaCurves or GammaLookupTable is a bit more illustrative of what the struct contains, but not a blocker.
>
> src/platform/
> needs an update still, but after that, lgtm
Brandon Schaefer (brandontschaefer) wrote : | # |
Opps yeah forgot to change the name annd fixing the symbols table
Kevin DuBois (kdub) wrote : | # |
alright, looks good to me
Kevin DuBois (kdub) wrote : | # |
hmm, might also be wise to validate the sizes again in void mgm::RealKMSOut
GammaCurves curve;
curve.red = { 1 };
set_gamma(curve)
and that would probably cause problems with the driver.
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3669
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3671
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3672
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3672
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
ABORTED: https:/
ABORTED: https:/
ABORTED: https:/
ABORTED: https:/
ABORTED: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3672
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'include/common/mir_toolkit/common.h' |
2 | --- include/common/mir_toolkit/common.h 2016-08-09 06:44:52 +0000 |
3 | +++ include/common/mir_toolkit/common.h 2016-09-02 16:51:45 +0000 |
4 | @@ -247,6 +247,15 @@ |
5 | mir_pointer_confined_to_surface, |
6 | } MirPointerConfinementState; |
7 | |
8 | +/** |
9 | + * Supports gamma correction |
10 | + */ |
11 | +typedef enum MirOutputGammaSupported |
12 | +{ |
13 | + mir_output_gamma_unsupported, |
14 | + mir_output_gamma_supported |
15 | +} MirOutputGammaSupported; |
16 | + |
17 | /**@}*/ |
18 | |
19 | #endif |
20 | |
21 | === modified file 'include/platform/mir/graphics/display_configuration.h' |
22 | --- include/platform/mir/graphics/display_configuration.h 2016-08-09 06:44:52 +0000 |
23 | +++ include/platform/mir/graphics/display_configuration.h 2016-09-02 16:51:45 +0000 |
24 | @@ -23,6 +23,7 @@ |
25 | #include "mir/geometry/size.h" |
26 | #include "mir/geometry/rectangle.h" |
27 | #include "mir/geometry/point.h" |
28 | +#include "mir/graphics/gamma_curves.h" |
29 | #include "mir_toolkit/common.h" |
30 | |
31 | #include <functional> |
32 | @@ -120,6 +121,10 @@ |
33 | /** Subpixel arrangement of this output */ |
34 | MirSubpixelArrangement subpixel_arrangement; |
35 | |
36 | + /** The current gamma for the display */ |
37 | + GammaCurves gamma; |
38 | + MirOutputGammaSupported gamma_supported; |
39 | + |
40 | /** The logical rectangle occupied by the output, based on its position, |
41 | current mode and orientation (rotation) */ |
42 | geometry::Rectangle extents() const; |
43 | @@ -149,6 +154,8 @@ |
44 | float& scale; |
45 | MirFormFactor& form_factor; |
46 | MirSubpixelArrangement& subpixel_arrangement; |
47 | + GammaCurves& gamma; |
48 | + MirOutputGammaSupported const& gamma_supported; |
49 | |
50 | UserDisplayConfigurationOutput(DisplayConfigurationOutput& master); |
51 | geometry::Rectangle extents() const; |
52 | |
53 | === added file 'include/platform/mir/graphics/gamma_curves.h' |
54 | --- include/platform/mir/graphics/gamma_curves.h 1970-01-01 00:00:00 +0000 |
55 | +++ include/platform/mir/graphics/gamma_curves.h 2016-09-02 16:51:45 +0000 |
56 | @@ -0,0 +1,42 @@ |
57 | +/* |
58 | + * Copyright © 2016 Canonical Ltd. |
59 | + * |
60 | + * This program is free software: you can redistribute it and/or modify it |
61 | + * under the terms of the GNU Lesser General Public License version 3, |
62 | + * as published by the Free Software Foundation. |
63 | + * |
64 | + * This program is distributed in the hope that it will be useful, |
65 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
66 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
67 | + * GNU Lesser General Public License for more details. |
68 | + * |
69 | + * You should have received a copy of the GNU Lesser General Public License |
70 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
71 | + * |
72 | + * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com> |
73 | + */ |
74 | + |
75 | +#include <cstdint> |
76 | +#include <vector> |
77 | + |
78 | +namespace mir |
79 | +{ |
80 | +namespace graphics |
81 | +{ |
82 | + |
83 | +class GammaCurves |
84 | +{ |
85 | +public: |
86 | + GammaCurves() = default; |
87 | + |
88 | + GammaCurves(std::vector<uint16_t> const& red, |
89 | + std::vector<uint16_t> const& green, |
90 | + std::vector<uint16_t> const& blue); |
91 | + |
92 | + std::vector<uint16_t> red; |
93 | + std::vector<uint16_t> green; |
94 | + std::vector<uint16_t> blue; |
95 | +}; |
96 | + |
97 | +} |
98 | +} |
99 | |
100 | === modified file 'src/platform/graphics/CMakeLists.txt' |
101 | --- src/platform/graphics/CMakeLists.txt 2016-06-02 05:33:50 +0000 |
102 | +++ src/platform/graphics/CMakeLists.txt 2016-09-02 16:51:45 +0000 |
103 | @@ -7,6 +7,7 @@ |
104 | egl_resources.cpp |
105 | egl_error.cpp |
106 | display_configuration.cpp |
107 | + gamma_curves.cpp |
108 | buffer_basic.cpp |
109 | pixel_format_utils.cpp |
110 | overlapping_output_grouping.cpp |
111 | |
112 | === modified file 'src/platform/graphics/display_configuration.cpp' |
113 | --- src/platform/graphics/display_configuration.cpp 2016-08-09 06:44:52 +0000 |
114 | +++ src/platform/graphics/display_configuration.cpp 2016-09-02 16:51:45 +0000 |
115 | @@ -321,7 +321,9 @@ |
116 | orientation(master.orientation), |
117 | scale(master.scale), |
118 | form_factor(master.form_factor), |
119 | - subpixel_arrangement(master.subpixel_arrangement) |
120 | + subpixel_arrangement(master.subpixel_arrangement), |
121 | + gamma(master.gamma), |
122 | + gamma_supported(master.gamma_supported) |
123 | { |
124 | } |
125 | |
126 | |
127 | === added file 'src/platform/graphics/gamma_curves.cpp' |
128 | --- src/platform/graphics/gamma_curves.cpp 1970-01-01 00:00:00 +0000 |
129 | +++ src/platform/graphics/gamma_curves.cpp 2016-09-02 16:51:45 +0000 |
130 | @@ -0,0 +1,38 @@ |
131 | +/* |
132 | + * Copyright © 2016 Canonical Ltd. |
133 | + * |
134 | + * This program is free software: you can redistribute it and/or modify it |
135 | + * under the terms of the GNU Lesser General Public License version 3, |
136 | + * as published by the Free Software Foundation. |
137 | + * |
138 | + * This program is distributed in the hope that it will be useful, |
139 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
140 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
141 | + * GNU Lesser General Public License for more details. |
142 | + * |
143 | + * You should have received a copy of the GNU Lesser General Public License |
144 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
145 | + * |
146 | + * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com> |
147 | + */ |
148 | + |
149 | +#include "mir/graphics/gamma_curves.h" |
150 | + |
151 | +#include <boost/throw_exception.hpp> |
152 | +#include <stdexcept> |
153 | + |
154 | +namespace mg = mir::graphics; |
155 | + |
156 | +mg::GammaCurves::GammaCurves(std::vector<uint16_t> const& red, |
157 | + std::vector<uint16_t> const& green, |
158 | + std::vector<uint16_t> const& blue) : |
159 | + red(red), |
160 | + green(green), |
161 | + blue(blue) |
162 | +{ |
163 | + if (red.size() != green.size() || |
164 | + green.size() != blue.size()) |
165 | + { |
166 | + BOOST_THROW_EXCEPTION(std::logic_error("Different gamma LUT sizes")); |
167 | + } |
168 | +} |
169 | |
170 | === modified file 'src/platform/symbols.map' |
171 | --- src/platform/symbols.map 2016-08-22 14:36:40 +0000 |
172 | +++ src/platform/symbols.map 2016-09-02 16:51:45 +0000 |
173 | @@ -56,6 +56,7 @@ |
174 | mir::graphics::EventHandlerRegister::register_fd_handler*; |
175 | mir::graphics::EventHandlerRegister::register_signal_handler*; |
176 | mir::graphics::EventHandlerRegister::unregister_fd_handler*; |
177 | + mir::graphics::GammaCurves::GammaCurves*; |
178 | mir::graphics::GLConfig::depth_buffer_bits*; |
179 | mir::graphics::GLConfig::?GLConfig*; |
180 | mir::graphics::GLConfig::GLConfig*; |
181 | |
182 | === modified file 'src/platforms/android/server/display_configuration.cpp' |
183 | --- src/platforms/android/server/display_configuration.cpp 2016-08-09 06:44:52 +0000 |
184 | +++ src/platforms/android/server/display_configuration.cpp 2016-09-02 16:51:45 +0000 |
185 | @@ -66,7 +66,9 @@ |
186 | mir_orientation_normal, |
187 | scale, |
188 | form_factor, |
189 | - subpixel_arrangement |
190 | + subpixel_arrangement, |
191 | + {}, |
192 | + mir_output_gamma_unsupported |
193 | }; |
194 | } |
195 | } |
196 | |
197 | === modified file 'src/platforms/android/server/fb_device.cpp' |
198 | --- src/platforms/android/server/fb_device.cpp 2016-08-09 06:44:52 +0000 |
199 | +++ src/platforms/android/server/fb_device.cpp 2016-09-02 16:51:45 +0000 |
200 | @@ -89,7 +89,9 @@ |
201 | mir_orientation_normal, |
202 | 1.0f, |
203 | mir_form_factor_phone, |
204 | - mir_subpixel_arrangement_unknown |
205 | + mir_subpixel_arrangement_unknown, |
206 | + {}, |
207 | + mir_output_gamma_unsupported |
208 | }; |
209 | } |
210 | |
211 | |
212 | === modified file 'src/platforms/android/server/hwc_blanking_control.cpp' |
213 | --- src/platforms/android/server/hwc_blanking_control.cpp 2016-08-24 02:09:08 +0000 |
214 | +++ src/platforms/android/server/hwc_blanking_control.cpp 2016-09-02 16:51:45 +0000 |
215 | @@ -176,7 +176,9 @@ |
216 | mir_orientation_normal, |
217 | 1.0f, |
218 | form_factor, |
219 | - mir_subpixel_arrangement_unknown |
220 | + mir_subpixel_arrangement_unknown, |
221 | + {}, |
222 | + mir_output_gamma_unsupported |
223 | }; |
224 | } |
225 | |
226 | |
227 | === modified file 'src/platforms/mesa/server/kms/display.cpp' |
228 | --- src/platforms/mesa/server/kms/display.cpp 2016-08-05 07:41:14 +0000 |
229 | +++ src/platforms/mesa/server/kms/display.cpp 2016-09-02 16:51:45 +0000 |
230 | @@ -207,6 +207,7 @@ |
231 | if (!comp) |
232 | { |
233 | kms_output->set_power_mode(conf_output.power_mode); |
234 | + kms_output->set_gamma(conf_output.gamma); |
235 | kms_outputs.push_back(kms_output); |
236 | } |
237 | |
238 | @@ -395,6 +396,7 @@ |
239 | |
240 | kms_output->clear_crtc(); |
241 | kms_output->set_power_mode(conf_output.power_mode); |
242 | + kms_output->set_gamma(conf_output.gamma); |
243 | } |
244 | }); |
245 | } |
246 | |
247 | === modified file 'src/platforms/mesa/server/kms/kms_output.h' |
248 | --- src/platforms/mesa/server/kms/kms_output.h 2016-01-29 08:18:22 +0000 |
249 | +++ src/platforms/mesa/server/kms/kms_output.h 2016-09-02 16:51:45 +0000 |
250 | @@ -62,6 +62,7 @@ |
251 | virtual bool has_cursor() const = 0; |
252 | |
253 | virtual void set_power_mode(MirPowerMode mode) = 0; |
254 | + virtual void set_gamma(GammaCurves const& gamma) = 0; |
255 | |
256 | protected: |
257 | KMSOutput() = default; |
258 | |
259 | === modified file 'src/platforms/mesa/server/kms/real_kms_display_configuration.cpp' |
260 | --- src/platforms/mesa/server/kms/real_kms_display_configuration.cpp 2016-08-24 02:09:08 +0000 |
261 | +++ src/platforms/mesa/server/kms/real_kms_display_configuration.cpp 2016-09-02 16:51:45 +0000 |
262 | @@ -26,6 +26,7 @@ |
263 | #include <boost/throw_exception.hpp> |
264 | #include <stdexcept> |
265 | #include <algorithm> |
266 | +#include <system_error> |
267 | |
268 | namespace mg = mir::graphics; |
269 | namespace mgm = mir::graphics::mesa; |
270 | @@ -174,6 +175,27 @@ |
271 | |
272 | return conf_mode_index; |
273 | } |
274 | + |
275 | +mg::GammaCurves mgm::RealKMSDisplayConfiguration::get_drm_gamma( |
276 | + drmModeCrtc const* crtc) const |
277 | +{ |
278 | + uint32_t gamma_size = crtc->gamma_size; |
279 | + uint16_t red[gamma_size]; |
280 | + uint16_t green[gamma_size]; |
281 | + uint16_t blue[gamma_size]; |
282 | + |
283 | + int ret; |
284 | + if ((ret = drmModeCrtcGetGamma(drm_fd, crtc->crtc_id, gamma_size, red, green, blue)) != 0) |
285 | + { |
286 | + BOOST_THROW_EXCEPTION( |
287 | + std::system_error(errno, std::system_category(), "drmModeCrtcGetGamma Failed")); |
288 | + } |
289 | + |
290 | + return {std::vector<uint16_t>(red, red + gamma_size), |
291 | + std::vector<uint16_t>(green, green + gamma_size), |
292 | + std::vector<uint16_t>(blue, blue + gamma_size)}; |
293 | +} |
294 | + |
295 | void mgm::RealKMSDisplayConfiguration::update() |
296 | { |
297 | kms::DRMModeResources resources{drm_fd}; |
298 | @@ -205,13 +227,19 @@ |
299 | mir_pixel_format_xrgb_8888}; |
300 | |
301 | drmModeModeInfo current_mode_info = drmModeModeInfo(); |
302 | + GammaCurves gamma; |
303 | |
304 | /* Get information about the current mode */ |
305 | if (connector.encoder_id) |
306 | { |
307 | auto encoder = resources.encoder(connector.encoder_id); |
308 | if (encoder->crtc_id) |
309 | + { |
310 | current_mode_info = resources.crtc(encoder->crtc_id)->mode; |
311 | + |
312 | + auto crtc = resources.crtc(encoder->crtc_id); |
313 | + gamma = get_drm_gamma(crtc.get()); |
314 | + } |
315 | } |
316 | |
317 | /* Add all the available modes and find the current and preferred one */ |
318 | @@ -241,7 +269,9 @@ |
319 | physical_size, connected, false, geom::Point(), |
320 | current_mode_index, mir_pixel_format_xrgb_8888, |
321 | mir_power_mode_on, mir_orientation_normal, |
322 | - 1.0f, mir_form_factor_monitor, kms_subpixel_to_mir_subpixel(connector.subpixel)}); |
323 | + 1.0f, mir_form_factor_monitor, |
324 | + kms_subpixel_to_mir_subpixel(connector.subpixel), |
325 | + gamma, mir_output_gamma_supported}); |
326 | } |
327 | else |
328 | { |
329 | @@ -269,6 +299,7 @@ |
330 | output.connected = connected; |
331 | output.current_format = mir_pixel_format_xrgb_8888; |
332 | output.subpixel_arrangement = kms_subpixel_to_mir_subpixel(connector.subpixel); |
333 | + output.gamma = gamma; |
334 | } |
335 | } |
336 | |
337 | |
338 | === modified file 'src/platforms/mesa/server/kms/real_kms_display_configuration.h' |
339 | --- src/platforms/mesa/server/kms/real_kms_display_configuration.h 2016-05-26 02:12:27 +0000 |
340 | +++ src/platforms/mesa/server/kms/real_kms_display_configuration.h 2016-09-02 16:51:45 +0000 |
341 | @@ -53,6 +53,7 @@ |
342 | void add_or_update_output(kms::DRMModeResources const& resources, drmModeConnector const& connector); |
343 | std::vector<DisplayConfigurationOutput>::iterator find_output_with_id(DisplayConfigurationOutputId id); |
344 | std::vector<DisplayConfigurationOutput>::const_iterator find_output_with_id(DisplayConfigurationOutputId id) const; |
345 | + GammaCurves get_drm_gamma(drmModeCrtc const* crtc) const; |
346 | |
347 | int drm_fd; |
348 | DisplayConfigurationCard card; |
349 | |
350 | === modified file 'src/platforms/mesa/server/kms/real_kms_output.cpp' |
351 | --- src/platforms/mesa/server/kms/real_kms_output.cpp 2016-08-26 07:35:52 +0000 |
352 | +++ src/platforms/mesa/server/kms/real_kms_output.cpp 2016-09-02 16:51:45 +0000 |
353 | @@ -23,6 +23,9 @@ |
354 | #include "mir/log.h" |
355 | #include <string.h> // strcmp |
356 | |
357 | +#include <boost/throw_exception.hpp> |
358 | +#include <system_error> |
359 | + |
360 | namespace mg = mir::graphics; |
361 | namespace mgm = mg::mesa; |
362 | namespace mgk = mg::kms; |
363 | @@ -271,3 +274,31 @@ |
364 | dpms_enum_id, mode); |
365 | } |
366 | } |
367 | + |
368 | +void mgm::RealKMSOutput::set_gamma(mg::GammaCurves const& gamma) |
369 | +{ |
370 | + if (!ensure_crtc()) |
371 | + { |
372 | + fatal_error("Output %s has no associated CRTC to set gamma on", |
373 | + mgk::connector_name(connector).c_str()); |
374 | + } |
375 | + |
376 | + if (gamma.red.size() != gamma.green.size() || |
377 | + gamma.green.size() != gamma.blue.size()) |
378 | + { |
379 | + BOOST_THROW_EXCEPTION( |
380 | + std::invalid_argument("set_gamma: mismatch gamma LUT sizes")); |
381 | + } |
382 | + |
383 | + if (drmModeCrtcSetGamma( |
384 | + drm_fd, |
385 | + current_crtc->crtc_id, |
386 | + gamma.red.size(), |
387 | + const_cast<uint16_t*>(gamma.red.data()), |
388 | + const_cast<uint16_t*>(gamma.green.data()), |
389 | + const_cast<uint16_t*>(gamma.blue.data())) != 0) |
390 | + { |
391 | + BOOST_THROW_EXCEPTION( |
392 | + std::system_error(errno, std::system_category(), "drmModeCrtcSetGamma Failed")); |
393 | + } |
394 | +} |
395 | |
396 | === modified file 'src/platforms/mesa/server/kms/real_kms_output.h' |
397 | --- src/platforms/mesa/server/kms/real_kms_output.h 2016-05-26 02:12:27 +0000 |
398 | +++ src/platforms/mesa/server/kms/real_kms_output.h 2016-09-02 16:51:45 +0000 |
399 | @@ -57,6 +57,7 @@ |
400 | bool has_cursor() const override; |
401 | |
402 | void set_power_mode(MirPowerMode mode) override; |
403 | + void set_gamma(GammaCurves const& gamma) override; |
404 | |
405 | private: |
406 | bool ensure_crtc(); |
407 | |
408 | === modified file 'src/platforms/mesa/server/x11/graphics/display_configuration.cpp' |
409 | --- src/platforms/mesa/server/x11/graphics/display_configuration.cpp 2016-08-09 06:44:52 +0000 |
410 | +++ src/platforms/mesa/server/x11/graphics/display_configuration.cpp 2016-09-02 16:51:45 +0000 |
411 | @@ -43,7 +43,9 @@ |
412 | orientation, |
413 | 1.0f, |
414 | mir_form_factor_monitor, |
415 | - mir_subpixel_arrangement_unknown}, |
416 | + mir_subpixel_arrangement_unknown, |
417 | + {}, |
418 | + mir_output_gamma_unsupported}, |
419 | card{mg::DisplayConfigurationCardId{0}, 1} |
420 | { |
421 | } |
422 | |
423 | === modified file 'src/server/graphics/nested/nested_display_configuration.cpp' |
424 | --- src/server/graphics/nested/nested_display_configuration.cpp 2016-08-09 06:44:52 +0000 |
425 | +++ src/server/graphics/nested/nested_display_configuration.cpp 2016-09-02 16:51:45 +0000 |
426 | @@ -111,7 +111,9 @@ |
427 | mir_output.orientation, |
428 | local_config.scale, |
429 | local_config.form_factor, |
430 | - local_config.subpixel_arrangement |
431 | + local_config.subpixel_arrangement, |
432 | + local_config.gamma, |
433 | + local_config.gamma_supported |
434 | }; |
435 | |
436 | f(output); |
437 | @@ -170,13 +172,16 @@ |
438 | mir_output.orientation, |
439 | local_config.scale, |
440 | local_config.form_factor, |
441 | - local_config.subpixel_arrangement |
442 | + local_config.subpixel_arrangement, |
443 | + local_config.gamma, |
444 | + local_config.gamma_supported |
445 | }; |
446 | UserDisplayConfigurationOutput user(output); |
447 | |
448 | f(user); |
449 | |
450 | - set_local_config_for(mir_output.output_id, {user.scale, user.form_factor , user.subpixel_arrangement}); |
451 | + set_local_config_for(mir_output.output_id, {user.scale, user.form_factor, user.subpixel_arrangement, |
452 | + user.gamma, user.gamma_supported}); |
453 | |
454 | mir_output.current_mode = output.current_mode_index; |
455 | mir_output.current_format = output.current_format; |
456 | @@ -198,7 +203,9 @@ |
457 | { |
458 | std::lock_guard<std::mutex> lock{local_config_mutex}; |
459 | |
460 | - constexpr LocalOutputConfig default_values {1.0f, mir_form_factor_monitor, mir_subpixel_arrangement_unknown }; |
461 | + LocalOutputConfig const default_values {1.0f, mir_form_factor_monitor, |
462 | + mir_subpixel_arrangement_unknown, |
463 | + {}, mir_output_gamma_unsupported}; |
464 | |
465 | bool inserted; |
466 | decltype(local_config)::iterator keypair; |
467 | |
468 | === modified file 'src/server/graphics/nested/nested_display_configuration.h' |
469 | --- src/server/graphics/nested/nested_display_configuration.h 2016-08-09 06:44:52 +0000 |
470 | +++ src/server/graphics/nested/nested_display_configuration.h 2016-09-02 16:51:45 +0000 |
471 | @@ -60,6 +60,8 @@ |
472 | float scale; |
473 | MirFormFactor form_factor; |
474 | MirSubpixelArrangement subpixel_arrangement; |
475 | + GammaCurves gamma; |
476 | + MirOutputGammaSupported gamma_supported; |
477 | }; |
478 | std::unordered_map<uint32_t, LocalOutputConfig> mutable local_config; |
479 | |
480 | |
481 | === modified file 'tests/include/mir/test/doubles/mock_drm.h' |
482 | --- tests/include/mir/test/doubles/mock_drm.h 2016-08-24 02:09:08 +0000 |
483 | +++ tests/include/mir/test/doubles/mock_drm.h 2016-09-02 16:51:45 +0000 |
484 | @@ -149,6 +149,11 @@ |
485 | MOCK_METHOD1(drmFreeBusid, void (const char*)); |
486 | MOCK_METHOD1(drmGetDeviceNameFromFd, char*(int fd)); |
487 | |
488 | + MOCK_METHOD6(drmModeCrtcGetGamma, int(int fd, uint32_t crtc_id, uint32_t size, |
489 | + uint16_t* red, uint16_t* green, uint16_t* blue)); |
490 | + MOCK_METHOD6(drmModeCrtcSetGamma, int(int fd, uint32_t crtc_id, uint32_t size, |
491 | + uint16_t* red, uint16_t* green, uint16_t* blue)); |
492 | + |
493 | FakeDRMResources fake_drm; |
494 | }; |
495 | |
496 | |
497 | === modified file 'tests/mir_test/display_config_matchers.cpp' |
498 | --- tests/mir_test/display_config_matchers.cpp 2016-08-09 06:44:52 +0000 |
499 | +++ tests/mir_test/display_config_matchers.cpp 2016-09-02 16:51:45 +0000 |
500 | @@ -85,7 +85,9 @@ |
501 | static_cast<MirOrientation>(protobuf_output.orientation()), |
502 | 1.0f, |
503 | mir_form_factor_monitor, |
504 | - mir_subpixel_arrangement_unknown |
505 | + mir_subpixel_arrangement_unknown, |
506 | + {}, |
507 | + mir_output_gamma_unsupported |
508 | }; |
509 | |
510 | /* Modes */ |
511 | @@ -154,7 +156,9 @@ |
512 | static_cast<MirOrientation>(client_output.orientation), |
513 | 1.0f, |
514 | mir_form_factor_monitor, |
515 | - mir_subpixel_arrangement_unknown |
516 | + mir_subpixel_arrangement_unknown, |
517 | + {}, |
518 | + mir_output_gamma_unsupported |
519 | }; |
520 | |
521 | /* Modes */ |
522 | @@ -216,7 +220,9 @@ |
523 | mir_output_get_orientation(client_output), |
524 | 1.0f, |
525 | mir_form_factor_monitor, |
526 | - mir_subpixel_arrangement_unknown |
527 | + mir_subpixel_arrangement_unknown, |
528 | + {}, |
529 | + mir_output_gamma_unsupported |
530 | }; |
531 | |
532 | /* Modes */ |
533 | |
534 | === modified file 'tests/mir_test_doubles/mock_drm.cpp' |
535 | --- tests/mir_test_doubles/mock_drm.cpp 2016-08-24 02:09:08 +0000 |
536 | +++ tests/mir_test_doubles/mock_drm.cpp 2016-09-02 16:51:45 +0000 |
537 | @@ -330,6 +330,18 @@ |
538 | connectors, count, mode); |
539 | } |
540 | |
541 | +int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, |
542 | + uint16_t* red, uint16_t* green, uint16_t* blue) |
543 | +{ |
544 | + return global_mock->drmModeCrtcGetGamma(fd, crtc_id, size, red, green, blue); |
545 | +} |
546 | + |
547 | +int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, |
548 | + uint16_t* red, uint16_t* green, uint16_t* blue) |
549 | +{ |
550 | + return global_mock->drmModeCrtcSetGamma(fd, crtc_id, size, red, green, blue); |
551 | +} |
552 | + |
553 | void drmModeFreeResources(drmModeResPtr ptr) |
554 | { |
555 | global_mock->drmModeFreeResources(ptr); |
556 | |
557 | === modified file 'tests/mir_test_doubles/stub_display_configuration.cpp' |
558 | --- tests/mir_test_doubles/stub_display_configuration.cpp 2016-08-09 06:44:52 +0000 |
559 | +++ tests/mir_test_doubles/stub_display_configuration.cpp 2016-09-02 16:51:45 +0000 |
560 | @@ -90,7 +90,9 @@ |
561 | mir_orientation_normal, |
562 | 1.0f, |
563 | mir_form_factor_monitor, |
564 | - subpixel_arrangement |
565 | + subpixel_arrangement, |
566 | + {}, |
567 | + mir_output_gamma_unsupported |
568 | } |
569 | { |
570 | } |
571 | @@ -116,7 +118,9 @@ |
572 | mir_orientation_normal, |
573 | 1.0f, |
574 | mir_form_factor_monitor, |
575 | - mir_subpixel_arrangement_unknown |
576 | + mir_subpixel_arrangement_unknown, |
577 | + {}, |
578 | + mir_output_gamma_unsupported |
579 | } |
580 | { |
581 | if (modes.empty()) |
582 | @@ -218,7 +222,9 @@ |
583 | mir_orientation_normal, |
584 | 1.0f, |
585 | mir_form_factor_monitor, |
586 | - mir_subpixel_arrangement_unknown |
587 | + mir_subpixel_arrangement_unknown, |
588 | + {}, |
589 | + mir_output_gamma_unsupported |
590 | }; |
591 | |
592 | outputs.push_back(output); |
593 | @@ -248,7 +254,9 @@ |
594 | mir_orientation_normal, |
595 | 1.0f, |
596 | mir_form_factor_monitor, |
597 | - mir_subpixel_arrangement_unknown |
598 | + mir_subpixel_arrangement_unknown, |
599 | + {}, |
600 | + mir_output_gamma_unsupported |
601 | }; |
602 | |
603 | outputs.push_back(output); |
604 | |
605 | === modified file 'tests/unit-tests/graphics/CMakeLists.txt' |
606 | --- tests/unit-tests/graphics/CMakeLists.txt 2016-08-30 21:12:15 +0000 |
607 | +++ tests/unit-tests/graphics/CMakeLists.txt 2016-09-02 16:51:45 +0000 |
608 | @@ -3,6 +3,7 @@ |
609 | ${CMAKE_CURRENT_SOURCE_DIR}/test_egl_extensions.cpp |
610 | ${CMAKE_CURRENT_SOURCE_DIR}/test_egl_error.cpp |
611 | ${CMAKE_CURRENT_SOURCE_DIR}/test_default_display_configuration_policy.cpp |
612 | + ${CMAKE_CURRENT_SOURCE_DIR}/test_gamma_curves.cpp |
613 | ${CMAKE_CURRENT_SOURCE_DIR}/test_buffer_id.cpp |
614 | ${CMAKE_CURRENT_SOURCE_DIR}/test_buffer_properties.cpp |
615 | ${CMAKE_CURRENT_SOURCE_DIR}/test_pixel_format_utils.cpp |
616 | |
617 | === modified file 'tests/unit-tests/graphics/test_default_display_configuration_policy.cpp' |
618 | --- tests/unit-tests/graphics/test_default_display_configuration_policy.cpp 2016-08-09 06:44:52 +0000 |
619 | +++ tests/unit-tests/graphics/test_default_display_configuration_policy.cpp 2016-09-02 16:51:45 +0000 |
620 | @@ -65,7 +65,9 @@ |
621 | mir_orientation_normal, |
622 | 1.0f, |
623 | mir_form_factor_monitor, |
624 | - mir_subpixel_arrangement_unknown |
625 | + mir_subpixel_arrangement_unknown, |
626 | + {}, |
627 | + mir_output_gamma_unsupported |
628 | }; |
629 | } |
630 | |
631 | |
632 | === modified file 'tests/unit-tests/graphics/test_display_configuration.cpp' |
633 | --- tests/unit-tests/graphics/test_display_configuration.cpp 2016-08-09 06:44:52 +0000 |
634 | +++ tests/unit-tests/graphics/test_display_configuration.cpp 2016-09-02 16:51:45 +0000 |
635 | @@ -50,7 +50,9 @@ |
636 | mir_orientation_normal, |
637 | 1.0f, |
638 | mir_form_factor_monitor, |
639 | - mir_subpixel_arrangement_unknown |
640 | + mir_subpixel_arrangement_unknown, |
641 | + {}, |
642 | + mir_output_gamma_unsupported |
643 | }; |
644 | |
645 | } |
646 | |
647 | === added file 'tests/unit-tests/graphics/test_gamma_curves.cpp' |
648 | --- tests/unit-tests/graphics/test_gamma_curves.cpp 1970-01-01 00:00:00 +0000 |
649 | +++ tests/unit-tests/graphics/test_gamma_curves.cpp 2016-09-02 16:51:45 +0000 |
650 | @@ -0,0 +1,67 @@ |
651 | +/* |
652 | + * Copyright © 2016 Canonical Ltd. |
653 | + * |
654 | + * This program is free software: you can redistribute it and/or modify |
655 | + * it under the terms of the GNU General Public License version 3 as |
656 | + * published by the Free Software Foundation. |
657 | + * |
658 | + * This program is distributed in the hope that it will be useful, |
659 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
660 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
661 | + * GNU General Public License for more details. |
662 | + * |
663 | + * You should have received a copy of the GNU General Public License |
664 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
665 | + * |
666 | + * Authored by: Brandon Schaefer <brandon.schaefer@gmail.com> |
667 | + */ |
668 | + |
669 | +#include "mir/graphics/gamma_curves.h" |
670 | + |
671 | +#include <gtest/gtest.h> |
672 | +#include <gmock/gmock.h> |
673 | + |
674 | +namespace mg = mir::graphics; |
675 | + |
676 | +namespace |
677 | +{ |
678 | +std::vector<uint16_t> const r{1}; |
679 | +std::vector<uint16_t> const g{2}; |
680 | +std::vector<uint16_t> const b{3}; |
681 | +} |
682 | + |
683 | +class MockGammaCurves : public testing::Test |
684 | +{ |
685 | +public: |
686 | + MockGammaCurves() : |
687 | + gamma(r, g, b) |
688 | + { |
689 | + } |
690 | + |
691 | + mg::GammaCurves gamma; |
692 | +}; |
693 | + |
694 | +TEST_F(MockGammaCurves, test_uint16_gamma_curves_size) |
695 | +{ |
696 | + EXPECT_THAT(gamma.red.size(), r.size()); |
697 | +} |
698 | + |
699 | +TEST_F(MockGammaCurves, test_uint16_gamma_curves_rgb_correct) |
700 | +{ |
701 | + ASSERT_THAT(gamma.red.size(), r.size()); |
702 | + EXPECT_THAT(gamma.red[0], r[0]); |
703 | + EXPECT_THAT(gamma.green[0], g[0]); |
704 | + EXPECT_THAT(gamma.blue[0], b[0]); |
705 | +} |
706 | + |
707 | +TEST(GammaCurvesEmpty, test_gamma_curves_empty) |
708 | +{ |
709 | + mg::GammaCurves gamma; |
710 | + |
711 | + EXPECT_THAT(gamma.red.size(), 0); |
712 | +} |
713 | + |
714 | +TEST(GammaCurvesEmpty, test_invalid_lut_size_gamma_curves_throw) |
715 | +{ |
716 | + EXPECT_THROW({ mg::GammaCurves({1}, {2, 3}, {4, 5, 6}); }, std::logic_error); |
717 | +} |
718 | |
719 | === modified file 'tests/unit-tests/graphics/test_overlapping_output_grouping.cpp' |
720 | --- tests/unit-tests/graphics/test_overlapping_output_grouping.cpp 2016-08-11 08:04:19 +0000 |
721 | +++ tests/unit-tests/graphics/test_overlapping_output_grouping.cpp 2016-09-02 16:51:45 +0000 |
722 | @@ -97,7 +97,9 @@ |
723 | info.orientation, |
724 | 1.0f, |
725 | mir_form_factor_monitor, |
726 | - mir_subpixel_arrangement_unknown |
727 | + mir_subpixel_arrangement_unknown, |
728 | + {}, |
729 | + mir_output_gamma_unsupported |
730 | }; |
731 | |
732 | f(output); |
733 | |
734 | === modified file 'tests/unit-tests/platforms/mesa/kms/mock_kms_output.h' |
735 | --- tests/unit-tests/platforms/mesa/kms/mock_kms_output.h 2016-01-29 08:18:22 +0000 |
736 | +++ tests/unit-tests/platforms/mesa/kms/mock_kms_output.h 2016-09-02 16:51:45 +0000 |
737 | @@ -45,6 +45,7 @@ |
738 | MOCK_CONST_METHOD0(has_cursor, bool()); |
739 | |
740 | MOCK_METHOD1(set_power_mode, void(MirPowerMode)); |
741 | + MOCK_METHOD1(set_gamma, void(mir::graphics::GammaCurves const&)); |
742 | }; |
743 | |
744 | } // namespace test |
745 | |
746 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_cursor.cpp' |
747 | --- tests/unit-tests/platforms/mesa/kms/test_cursor.cpp 2016-08-11 08:04:19 +0000 |
748 | +++ tests/unit-tests/platforms/mesa/kms/test_cursor.cpp 2016-09-02 16:51:45 +0000 |
749 | @@ -114,7 +114,9 @@ |
750 | mir_orientation_normal, |
751 | 1.0f, |
752 | mir_form_factor_monitor, |
753 | - mir_subpixel_arrangement_unknown |
754 | + mir_subpixel_arrangement_unknown, |
755 | + {}, |
756 | + mir_output_gamma_unsupported |
757 | }, |
758 | { |
759 | mg::DisplayConfigurationOutputId{11}, |
760 | @@ -136,7 +138,9 @@ |
761 | mir_orientation_normal, |
762 | 1.0f, |
763 | mir_form_factor_monitor, |
764 | - mir_subpixel_arrangement_unknown |
765 | + mir_subpixel_arrangement_unknown, |
766 | + {}, |
767 | + mir_output_gamma_unsupported |
768 | }, |
769 | { |
770 | mg::DisplayConfigurationOutputId{12}, |
771 | @@ -158,7 +162,9 @@ |
772 | mir_orientation_right, |
773 | 1.0f, |
774 | mir_form_factor_monitor, |
775 | - mir_subpixel_arrangement_unknown |
776 | + mir_subpixel_arrangement_unknown, |
777 | + {}, |
778 | + mir_output_gamma_unsupported |
779 | }}} |
780 | { |
781 | } |
782 | |
783 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_display.cpp' |
784 | --- tests/unit-tests/platforms/mesa/kms/test_display.cpp 2016-07-18 03:23:51 +0000 |
785 | +++ tests/unit-tests/platforms/mesa/kms/test_display.cpp 2016-09-02 16:51:45 +0000 |
786 | @@ -235,6 +235,12 @@ |
787 | EXPECT_CALL(mock_gbm, gbm_surface_create(mock_gbm.fake_gbm.device,_,_,_,_)) |
788 | .Times(Exactly(1)); |
789 | |
790 | + /* Get the DRM gamma ramp */ |
791 | + EXPECT_CALL(mock_drm, drmModeCrtcGetGamma(mock_drm.fake_drm.fd(), |
792 | + crtc_id, fake.crtc.gamma_size, |
793 | + _, _, _)) |
794 | + .Times(Exactly(1)); |
795 | + |
796 | /* Create an EGL window surface backed by the gbm surface */ |
797 | EXPECT_CALL(mock_egl, eglCreateWindowSurface(mock_egl.fake_egl_display, |
798 | mock_egl.fake_configs[0], |
799 | @@ -280,7 +286,6 @@ |
800 | .Times(Exactly(1)) |
801 | .WillOnce(Return(0)); |
802 | |
803 | - |
804 | auto display = create_display(create_platform()); |
805 | } |
806 | |
807 | |
808 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp' |
809 | --- tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp 2016-08-24 02:09:08 +0000 |
810 | +++ tests/unit-tests/platforms/mesa/kms/test_display_configuration.cpp 2016-09-02 16:51:45 +0000 |
811 | @@ -235,7 +235,9 @@ |
812 | mir_orientation_normal, |
813 | 1.0f, |
814 | mir_form_factor_monitor, |
815 | - mir_subpixel_arrangement_unknown |
816 | + mir_subpixel_arrangement_unknown, |
817 | + {}, |
818 | + mir_output_gamma_unsupported |
819 | }, |
820 | { |
821 | mg::DisplayConfigurationOutputId{connector1_id}, |
822 | @@ -254,7 +256,9 @@ |
823 | mir_orientation_normal, |
824 | 1.0f, |
825 | mir_form_factor_monitor, |
826 | - mir_subpixel_arrangement_unknown |
827 | + mir_subpixel_arrangement_unknown, |
828 | + {}, |
829 | + mir_output_gamma_unsupported |
830 | }, |
831 | { |
832 | mg::DisplayConfigurationOutputId{connector2_id}, |
833 | @@ -273,7 +277,9 @@ |
834 | mir_orientation_normal, |
835 | 1.0f, |
836 | mir_form_factor_monitor, |
837 | - mir_subpixel_arrangement_unknown |
838 | + mir_subpixel_arrangement_unknown, |
839 | + {}, |
840 | + mir_output_gamma_unsupported |
841 | } |
842 | }; |
843 | |
844 | @@ -581,7 +587,9 @@ |
845 | mir_orientation_normal, |
846 | 1.0f, |
847 | mir_form_factor_monitor, |
848 | - mir_subpixel_arrangement_unknown |
849 | + mir_subpixel_arrangement_unknown, |
850 | + {}, |
851 | + mir_output_gamma_unsupported |
852 | }, |
853 | { |
854 | mg::DisplayConfigurationOutputId(connector_ids[1]), |
855 | @@ -600,7 +608,9 @@ |
856 | mir_orientation_normal, |
857 | 1.0f, |
858 | mir_form_factor_monitor, |
859 | - mir_subpixel_arrangement_unknown |
860 | + mir_subpixel_arrangement_unknown, |
861 | + {}, |
862 | + mir_output_gamma_unsupported |
863 | }, |
864 | }; |
865 | |
866 | @@ -623,7 +633,9 @@ |
867 | mir_orientation_normal, |
868 | 1.0f, |
869 | mir_form_factor_monitor, |
870 | - mir_subpixel_arrangement_unknown |
871 | + mir_subpixel_arrangement_unknown, |
872 | + {}, |
873 | + mir_output_gamma_unsupported |
874 | }, |
875 | { |
876 | mg::DisplayConfigurationOutputId(connector_ids[1]), |
877 | @@ -642,7 +654,9 @@ |
878 | mir_orientation_normal, |
879 | 1.0f, |
880 | mir_form_factor_monitor, |
881 | - mir_subpixel_arrangement_unknown |
882 | + mir_subpixel_arrangement_unknown, |
883 | + {}, |
884 | + mir_output_gamma_unsupported |
885 | }, |
886 | }; |
887 | |
888 | @@ -774,7 +788,9 @@ |
889 | mir_orientation_normal, |
890 | 1.0f, |
891 | mir_form_factor_monitor, |
892 | - mir_subpixel_arrangement_unknown |
893 | + mir_subpixel_arrangement_unknown, |
894 | + {}, |
895 | + mir_output_gamma_unsupported |
896 | }, |
897 | }; |
898 | |
899 | @@ -798,7 +814,9 @@ |
900 | mir_orientation_normal, |
901 | 1.0f, |
902 | mir_form_factor_monitor, |
903 | - mir_subpixel_arrangement_unknown |
904 | + mir_subpixel_arrangement_unknown, |
905 | + {}, |
906 | + mir_output_gamma_unsupported |
907 | }, |
908 | }; |
909 | |
910 | |
911 | === modified file 'tests/unit-tests/platforms/mesa/kms/test_real_kms_output.cpp' |
912 | --- tests/unit-tests/platforms/mesa/kms/test_real_kms_output.cpp 2016-08-05 06:20:59 +0000 |
913 | +++ tests/unit-tests/platforms/mesa/kms/test_real_kms_output.cpp 2016-09-02 16:51:45 +0000 |
914 | @@ -367,3 +367,27 @@ |
915 | output.clear_crtc(); |
916 | }, std::runtime_error); |
917 | } |
918 | + |
919 | +TEST_F(RealKMSOutputTest, drm_set_gamma) |
920 | +{ |
921 | + using namespace testing; |
922 | + |
923 | + uint32_t const fb_id{67}; |
924 | + |
925 | + setup_outputs_connected_crtc(); |
926 | + |
927 | + mgm::RealKMSOutput output{mock_drm.fake_drm.fd(), connector_ids[0], |
928 | + mt::fake_shared(mock_page_flipper)}; |
929 | + |
930 | + mg::GammaCurves gamma{{1}, {2}, {3}}; |
931 | + |
932 | + EXPECT_CALL(mock_drm, drmModeCrtcSetGamma(mock_drm.fake_drm.fd(), crtc_ids[0], |
933 | + gamma.red.size(), |
934 | + const_cast<uint16_t*>(gamma.red.data()), |
935 | + const_cast<uint16_t*>(gamma.green.data()), |
936 | + const_cast<uint16_t*>(gamma.blue.data()))) |
937 | + .Times(1); |
938 | + |
939 | + EXPECT_TRUE(output.set_crtc(fb_id)); |
940 | + output.set_gamma(gamma); |
941 | +} |
942 | |
943 | === modified file 'tests/unit-tests/scene/test_mediating_display_changer.cpp' |
944 | --- tests/unit-tests/scene/test_mediating_display_changer.cpp 2016-08-09 06:44:52 +0000 |
945 | +++ tests/unit-tests/scene/test_mediating_display_changer.cpp 2016-09-02 16:51:45 +0000 |
946 | @@ -72,7 +72,9 @@ |
947 | mir_orientation_normal, |
948 | 1.0f, |
949 | mir_form_factor_phone, |
950 | - mir_subpixel_arrangement_unknown |
951 | + mir_subpixel_arrangement_unknown, |
952 | + {}, |
953 | + mir_output_gamma_unsupported |
954 | }; |
955 | } |
956 |
FAILED: Continuous integration, rev:3656 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1532/ /mir-jenkins. ubuntu. com/job/ build-mir/ 1915/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/1975 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1966 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1966 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 1966 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 1939 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 1939/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1939 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1939/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 1939 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 1939/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 1939/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 1939/console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1939 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 1939/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1532/rebuild
https:/