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/platform/dri/display_snapshot_dri.h" | 5 #include "ui/ozone/platform/dri/display_snapshot_dri.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <xf86drmMode.h> | 9 #include <xf86drmMode.h> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 case DRM_MODE_CONNECTOR_HDMIA: | 36 case DRM_MODE_CONNECTOR_HDMIA: |
37 case DRM_MODE_CONNECTOR_HDMIB: | 37 case DRM_MODE_CONNECTOR_HDMIB: |
38 return DISPLAY_CONNECTION_TYPE_HDMI; | 38 return DISPLAY_CONNECTION_TYPE_HDMI; |
39 default: | 39 default: |
40 return DISPLAY_CONNECTION_TYPE_UNKNOWN; | 40 return DISPLAY_CONNECTION_TYPE_UNKNOWN; |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 bool IsAspectPreserving(DriWrapper* drm, drmModeConnector* connector) { | 44 bool IsAspectPreserving(DriWrapper* drm, drmModeConnector* connector) { |
45 ScopedDrmPropertyPtr property(drm->GetProperty(connector, "scaling mode")); | 45 ScopedDrmPropertyPtr property(drm->GetProperty(connector, "scaling mode")); |
46 if (property) { | 46 if (!property) |
47 for (int j = 0; j < property->count_enums; ++j) { | 47 return false; |
48 if (property->enums[j].value == | 48 |
49 connector->prop_values[property->prop_id] && | 49 for (int props_i = 0; props_i < connector->count_props; ++props_i) { |
50 strcmp(property->enums[j].name, "Full aspect") == 0) | 50 if (connector->props[props_i] != property->prop_id) |
| 51 continue; |
| 52 |
| 53 for (int enums_i = 0; enums_i < property->count_enums; ++enums_i) { |
| 54 if (property->enums[enums_i].value == connector->prop_values[props_i] && |
| 55 strcmp(property->enums[enums_i].name, "Full aspect") == 0) |
51 return true; | 56 return true; |
52 } | 57 } |
53 } | 58 } |
54 | 59 |
55 return false; | 60 return false; |
56 } | 61 } |
57 | 62 |
58 } // namespace | 63 } // namespace |
59 | 64 |
60 DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm, | 65 DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return base::StringPrintf( | 123 return base::StringPrintf( |
119 "[type=%d, connector=%" PRIu32 ", crtc=%" PRIu32 ", mode=%s, dim=%s]", | 124 "[type=%d, connector=%" PRIu32 ", crtc=%" PRIu32 ", mode=%s, dim=%s]", |
120 type_, | 125 type_, |
121 connector_, | 126 connector_, |
122 crtc_, | 127 crtc_, |
123 current_mode_ ? current_mode_->ToString().c_str() : "NULL", | 128 current_mode_ ? current_mode_->ToString().c_str() : "NULL", |
124 physical_size_.ToString().c_str()); | 129 physical_size_.ToString().c_str()); |
125 } | 130 } |
126 | 131 |
127 } // namespace ui | 132 } // namespace ui |
OLD | NEW |