OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/common/display_snapshot_proxy.h" | 5 #include "ui/ozone/common/display_snapshot_proxy.h" |
6 | 6 |
7 #include "ui/ozone/common/display_mode_proxy.h" | 7 #include "ui/ozone/common/display_mode_proxy.h" |
8 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" | 8 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 bool SameModes(const DisplayMode_Params& lhs, const DisplayMode_Params& rhs) { | 14 bool SameModes(const DisplayMode_Params& lhs, const DisplayMode_Params& rhs) { |
15 return lhs.size == rhs.size && lhs.is_interlaced == rhs.is_interlaced && | 15 return lhs.size == rhs.size && lhs.is_interlaced == rhs.is_interlaced && |
16 lhs.refresh_rate == rhs.refresh_rate; | 16 lhs.refresh_rate == rhs.refresh_rate; |
17 } | 17 } |
18 | 18 |
| 19 // Exclude 4K@60kHz becaseu this doesn't work in most devices/configuration now. |
| 20 // TODO(marcheu|oshima): Revisit this. crbug.com/39397 |
| 21 bool IsModeBlackListed(const DisplayMode_Params& mode_params) { |
| 22 return mode_params.size.width() >= 3840 && mode_params.size.width() >= 2160 && |
| 23 mode_params.refresh_rate >= 60.0f; |
| 24 } |
| 25 |
19 } // namespace | 26 } // namespace |
20 | 27 |
21 DisplaySnapshotProxy::DisplaySnapshotProxy(const DisplaySnapshot_Params& params) | 28 DisplaySnapshotProxy::DisplaySnapshotProxy(const DisplaySnapshot_Params& params) |
22 : DisplaySnapshot(params.display_id, | 29 : DisplaySnapshot(params.display_id, |
23 params.origin, | 30 params.origin, |
24 params.physical_size, | 31 params.physical_size, |
25 params.type, | 32 params.type, |
26 params.is_aspect_preserving_scaling, | 33 params.is_aspect_preserving_scaling, |
27 params.has_overscan, | 34 params.has_overscan, |
28 params.display_name, | 35 params.display_name, |
29 std::vector<const DisplayMode*>(), | 36 std::vector<const DisplayMode*>(), |
30 NULL, | 37 NULL, |
31 NULL), | 38 NULL), |
32 string_representation_(params.string_representation) { | 39 string_representation_(params.string_representation) { |
33 for (size_t i = 0; i < params.modes.size(); ++i) { | 40 for (size_t i = 0; i < params.modes.size(); ++i) { |
34 modes_.push_back(new DisplayModeProxy(params.modes[i])); | 41 const DisplayMode_Params& mode_params = params.modes[i]; |
| 42 if (IsModeBlackListed(mode_params)) |
| 43 continue; |
| 44 modes_.push_back(new DisplayModeProxy(mode_params)); |
35 | 45 |
36 if (params.has_current_mode && | 46 if (params.has_current_mode && |
37 SameModes(params.modes[i], params.current_mode)) | 47 SameModes(params.modes[i], params.current_mode)) |
38 current_mode_ = modes_.back(); | 48 current_mode_ = modes_.back(); |
39 | 49 |
40 if (params.has_native_mode && | 50 if (params.has_native_mode && |
41 SameModes(params.modes[i], params.native_mode)) | 51 SameModes(params.modes[i], params.native_mode)) |
42 native_mode_ = modes_.back(); | 52 native_mode_ = modes_.back(); |
43 } | 53 } |
44 | 54 |
45 product_id_ = params.product_id; | 55 product_id_ = params.product_id; |
46 } | 56 } |
47 | 57 |
48 DisplaySnapshotProxy::~DisplaySnapshotProxy() { | 58 DisplaySnapshotProxy::~DisplaySnapshotProxy() { |
49 } | 59 } |
50 | 60 |
51 std::string DisplaySnapshotProxy::ToString() const { | 61 std::string DisplaySnapshotProxy::ToString() const { |
52 return string_representation_; | 62 return string_representation_; |
53 } | 63 } |
54 | 64 |
55 } // namespace ui | 65 } // namespace ui |
OLD | NEW |