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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 return false; | 60 return false; |
61 } | 61 } |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm, | 65 DisplaySnapshotDri::DisplaySnapshotDri(DriWrapper* drm, |
66 drmModeConnector* connector, | 66 drmModeConnector* connector, |
67 drmModeCrtc* crtc, | 67 drmModeCrtc* crtc, |
68 uint32_t index) | 68 uint32_t index) |
69 : DisplaySnapshot(index, | 69 : DisplaySnapshot(index, |
70 false, | |
71 gfx::Point(crtc->x, crtc->y), | 70 gfx::Point(crtc->x, crtc->y), |
72 gfx::Size(connector->mmWidth, connector->mmHeight), | 71 gfx::Size(connector->mmWidth, connector->mmHeight), |
73 GetDisplayType(connector), | 72 GetDisplayType(connector), |
74 IsAspectPreserving(drm, connector), | 73 IsAspectPreserving(drm, connector), |
75 false, | 74 false, |
76 std::string(), | 75 std::string(), |
77 std::vector<const DisplayMode*>(), | 76 std::vector<const DisplayMode*>(), |
78 NULL, | 77 NULL, |
79 NULL), | 78 NULL), |
80 connector_(connector->connector_id), | 79 connector_(connector->connector_id), |
81 crtc_(crtc->crtc_id), | 80 crtc_(crtc->crtc_id), |
82 dpms_property_(drm->GetProperty(connector, "DPMS")) { | 81 dpms_property_(drm->GetProperty(connector, "DPMS")) { |
83 if (!dpms_property_) | 82 if (!dpms_property_) |
84 VLOG(1) << "Failed to find the DPMS property for connector " | 83 VLOG(1) << "Failed to find the DPMS property for connector " |
85 << connector->connector_id; | 84 << connector->connector_id; |
86 | 85 |
87 ScopedDrmPropertyBlobPtr edid_blob(drm->GetPropertyBlob(connector, "EDID")); | 86 ScopedDrmPropertyBlobPtr edid_blob(drm->GetPropertyBlob(connector, "EDID")); |
88 | 87 |
89 if (edid_blob) { | 88 if (edid_blob) { |
90 std::vector<uint8_t> edid( | 89 std::vector<uint8_t> edid( |
91 static_cast<uint8_t*>(edid_blob->data), | 90 static_cast<uint8_t*>(edid_blob->data), |
92 static_cast<uint8_t*>(edid_blob->data) + edid_blob->length); | 91 static_cast<uint8_t*>(edid_blob->data) + edid_blob->length); |
93 | 92 |
94 has_proper_display_id_ = GetDisplayIdFromEDID(edid, index, &display_id_); | 93 if (!GetDisplayIdFromEDID(edid, index, &display_id_)) |
| 94 display_id_ = index; |
| 95 |
95 ParseOutputDeviceData(edid, NULL, &display_name_); | 96 ParseOutputDeviceData(edid, NULL, &display_name_); |
96 ParseOutputOverscanFlag(edid, &overscan_flag_); | 97 ParseOutputOverscanFlag(edid, &overscan_flag_); |
97 } else { | 98 } else { |
98 VLOG(1) << "Failed to get EDID blob for connector " | 99 VLOG(1) << "Failed to get EDID blob for connector " |
99 << connector->connector_id; | 100 << connector->connector_id; |
100 } | 101 } |
101 | 102 |
102 for (int i = 0; i < connector->count_modes; ++i) { | 103 for (int i = 0; i < connector->count_modes; ++i) { |
103 drmModeModeInfo& mode = connector->modes[i]; | 104 drmModeModeInfo& mode = connector->modes[i]; |
104 modes_.push_back(new DisplayModeDri(mode)); | 105 modes_.push_back(new DisplayModeDri(mode)); |
(...skipping 18 matching lines...) Expand all Loading... |
123 return base::StringPrintf( | 124 return base::StringPrintf( |
124 "[type=%d, connector=%" PRIu32 ", crtc=%" PRIu32 ", mode=%s, dim=%s]", | 125 "[type=%d, connector=%" PRIu32 ", crtc=%" PRIu32 ", mode=%s, dim=%s]", |
125 type_, | 126 type_, |
126 connector_, | 127 connector_, |
127 crtc_, | 128 crtc_, |
128 current_mode_ ? current_mode_->ToString().c_str() : "NULL", | 129 current_mode_ ? current_mode_->ToString().c_str() : "NULL", |
129 physical_size_.ToString().c_str()); | 130 physical_size_.ToString().c_str()); |
130 } | 131 } |
131 | 132 |
132 } // namespace ui | 133 } // namespace ui |
OLD | NEW |