Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1294)

Unified Diff: ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc

Issue 2894523007: Use display::DisplayMode in ozone/drm/gpu (Closed)
Patch Set: review nits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h ('k') | ui/ozone/platform/drm/gpu/drm_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc b/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
index 100c7a405ecd97318359373e24ee1c4173cf6ba6..faf5086b5c67e830c40edd80eeb060c0adb1042d 100644
--- a/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
+++ b/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/memory/ptr_util.h"
+#include "ui/display/types/display_mode.h"
#include "ui/display/types/gamma_ramp_rgb_entry.h"
#include "ui/ozone/platform/drm/common/drm_util.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
@@ -41,19 +42,22 @@ class DisplayComparator {
uint32_t connector_;
};
+bool MatchMode(const display::DisplayMode& display_mode,
+ const drmModeModeInfo& m) {
+ return display_mode.size() == ModeSize(m) &&
+ display_mode.refresh_rate() == ModeRefreshRate(m) &&
+ display_mode.is_interlaced() == ModeIsInterlaced(m);
+}
+
bool FindMatchingMode(const std::vector<drmModeModeInfo> modes,
- const DisplayMode_Params& mode_params,
+ const display::DisplayMode& display_mode,
drmModeModeInfo* mode) {
for (const drmModeModeInfo& m : modes) {
- DisplayMode_Params params = CreateDisplayModeParams(m);
- if (mode_params.size == params.size &&
- mode_params.refresh_rate == params.refresh_rate &&
- mode_params.is_interlaced == params.is_interlaced) {
+ if (MatchMode(display_mode, m)) {
*mode = m;
return true;
}
}
-
return false;
}
@@ -131,7 +135,7 @@ void DrmGpuDisplayManager::RelinquishDisplayControl() {
bool DrmGpuDisplayManager::ConfigureDisplay(
int64_t display_id,
- const DisplayMode_Params& mode_param,
+ const display::DisplayMode& display_mode,
const gfx::Point& origin) {
DrmDisplay* display = FindDisplay(display_id);
if (!display) {
@@ -140,23 +144,24 @@ bool DrmGpuDisplayManager::ConfigureDisplay(
}
drmModeModeInfo mode;
- bool mode_found = FindMatchingMode(display->modes(), mode_param, &mode);
+ bool mode_found = FindMatchingMode(display->modes(), display_mode, &mode);
if (!mode_found) {
// If the display doesn't have the mode natively, then lookup the mode from
// other displays and try using it on the current display (some displays
// support panel fitting and they can use different modes even if the mode
// isn't explicitly declared).
for (const auto& other_display : displays_) {
- mode_found = FindMatchingMode(other_display->modes(), mode_param, &mode);
+ mode_found =
+ FindMatchingMode(other_display->modes(), display_mode, &mode);
if (mode_found)
break;
}
}
if (!mode_found) {
- LOG(ERROR) << "Failed to find mode: size=" << mode_param.size.ToString()
- << " is_interlaced=" << mode_param.is_interlaced
- << " refresh_rate=" << mode_param.refresh_rate;
+ LOG(ERROR) << "Failed to find mode: size=" << display_mode.size().ToString()
+ << " is_interlaced=" << display_mode.is_interlaced()
+ << " refresh_rate=" << display_mode.refresh_rate();
return false;
}
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h ('k') | ui/ozone/platform/drm/gpu/drm_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698