| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/drm/gpu/drm_display.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_display.h" |
| 6 | 6 |
| 7 #include <xf86drmMode.h> | 7 #include <xf86drmMode.h> |
| 8 | 8 |
| 9 #include "ui/display/types/gamma_ramp_rgb_entry.h" | 9 #include "ui/display/types/gamma_ramp_rgb_entry.h" |
| 10 #include "ui/ozone/platform/drm/common/drm_util.h" | 10 #include "ui/ozone/platform/drm/common/drm_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return gfx::Size(mode.hdisplay, mode.vdisplay); | 67 return gfx::Size(mode.hdisplay, mode.vdisplay); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 DrmDisplay::DrmDisplay(ScreenManager* screen_manager, | 72 DrmDisplay::DrmDisplay(ScreenManager* screen_manager, |
| 73 int64_t display_id, | 73 int64_t display_id, |
| 74 const scoped_refptr<DrmDevice>& drm, | 74 const scoped_refptr<DrmDevice>& drm, |
| 75 uint32_t crtc, | 75 uint32_t crtc, |
| 76 uint32_t connector, | 76 uint32_t connector, |
| 77 const std::vector<drmModeModeInfo>& modes) | 77 const std::vector<drmModeModeInfo>& modes, |
| 78 const gfx::Point& origin) |
| 78 : screen_manager_(screen_manager), | 79 : screen_manager_(screen_manager), |
| 79 display_id_(display_id), | 80 display_id_(display_id), |
| 80 drm_(drm), | 81 drm_(drm), |
| 81 crtc_(crtc), | 82 crtc_(crtc), |
| 82 connector_(connector), | 83 connector_(connector), |
| 83 modes_(modes) { | 84 modes_(modes), |
| 85 origin_(origin) { |
| 84 } | 86 } |
| 85 | 87 |
| 86 DrmDisplay::~DrmDisplay() { | 88 DrmDisplay::~DrmDisplay() { |
| 87 } | 89 } |
| 88 | 90 |
| 89 bool DrmDisplay::Configure(const drmModeModeInfo* mode, | 91 bool DrmDisplay::Configure(const drmModeModeInfo* mode, |
| 90 const gfx::Point& origin) { | 92 const gfx::Point& origin) { |
| 91 VLOG(1) << "DRM configuring: device=" << drm_->device_path().value() | 93 VLOG(1) << "DRM configuring: device=" << drm_->device_path().value() |
| 92 << " crtc=" << crtc_ << " connector=" << connector_ | 94 << " crtc=" << crtc_ << " connector=" << connector_ |
| 93 << " origin=" << origin.ToString() | 95 << " origin=" << origin.ToString() |
| 94 << " size=" << (mode ? GetDrmModeSize(*mode).ToString() : "0x0"); | 96 << " size=" << (mode ? GetDrmModeSize(*mode).ToString() : "0x0"); |
| 95 | 97 |
| 96 if (mode) { | 98 if (mode) { |
| 97 if (!screen_manager_->ConfigureDisplayController(drm_, crtc_, connector_, | 99 if (!screen_manager_->ConfigureDisplayController(drm_, crtc_, connector_, |
| 98 origin, *mode)) { | 100 origin, *mode)) { |
| 99 VLOG(1) << "Failed to configure: device=" << drm_->device_path().value() | 101 VLOG(1) << "Failed to configure: device=" << drm_->device_path().value() |
| 100 << " crtc=" << crtc_ << " connector=" << connector_; | 102 << " crtc=" << crtc_ << " connector=" << connector_; |
| 101 return false; | 103 return false; |
| 102 } | 104 } |
| 103 } else { | 105 } else { |
| 104 if (!screen_manager_->DisableDisplayController(drm_, crtc_)) { | 106 if (!screen_manager_->DisableDisplayController(drm_, crtc_)) { |
| 105 VLOG(1) << "Failed to disable device=" << drm_->device_path().value() | 107 VLOG(1) << "Failed to disable device=" << drm_->device_path().value() |
| 106 << " crtc=" << crtc_; | 108 << " crtc=" << crtc_; |
| 107 return false; | 109 return false; |
| 108 } | 110 } |
| 109 } | 111 } |
| 110 | 112 |
| 113 origin_ = origin; |
| 111 return true; | 114 return true; |
| 112 } | 115 } |
| 113 | 116 |
| 114 bool DrmDisplay::GetHDCPState(HDCPState* state) { | 117 bool DrmDisplay::GetHDCPState(HDCPState* state) { |
| 115 ScopedDrmConnectorPtr connector(drm_->GetConnector(connector_)); | 118 ScopedDrmConnectorPtr connector(drm_->GetConnector(connector_)); |
| 116 if (!connector) { | 119 if (!connector) { |
| 117 PLOG(ERROR) << "Failed to get connector " << connector_; | 120 PLOG(ERROR) << "Failed to get connector " << connector_; |
| 118 return false; | 121 return false; |
| 119 } | 122 } |
| 120 | 123 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 162 } |
| 160 | 163 |
| 161 void DrmDisplay::SetGammaRamp(const std::vector<GammaRampRGBEntry>& lut) { | 164 void DrmDisplay::SetGammaRamp(const std::vector<GammaRampRGBEntry>& lut) { |
| 162 if (!drm_->SetGammaRamp(crtc_, lut)) { | 165 if (!drm_->SetGammaRamp(crtc_, lut)) { |
| 163 LOG(ERROR) << "Failed to set gamma ramp for display: crtc_id = " << crtc_ | 166 LOG(ERROR) << "Failed to set gamma ramp for display: crtc_id = " << crtc_ |
| 164 << " size = " << lut.size(); | 167 << " size = " << lut.size(); |
| 165 } | 168 } |
| 166 } | 169 } |
| 167 | 170 |
| 168 } // namespace ui | 171 } // namespace ui |
| OLD | NEW |