ozone: fix HDPMLegacy - do the PF after overlays, also clear old overlays
[chromium-blink-merge.git] / ui / ozone / platform / dri / display_mode_dri.cc
blobc3d40d0cbd99e3ba2514df83bc20c5ac39e54684
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
3 // found in the LICENSE file.
5 #include "ui/ozone/platform/dri/display_mode_dri.h"
7 namespace ui {
9 namespace {
11 float GetRefreshRate(const drmModeModeInfo& mode) {
12 if (!mode.htotal || !mode.vtotal)
13 return mode.vrefresh;
15 float clock = mode.clock;
16 float htotal = mode.htotal;
17 float vtotal = mode.vtotal;
19 return (clock * 1000.0f) / (htotal * vtotal);
22 } // namespace
24 DisplayModeDri::DisplayModeDri(const drmModeModeInfo& mode)
25 : DisplayMode(gfx::Size(mode.hdisplay, mode.vdisplay),
26 mode.flags & DRM_MODE_FLAG_INTERLACE,
27 GetRefreshRate(mode)),
28 mode_info_(mode) {
31 DisplayModeDri::~DisplayModeDri() {
34 } // namespace ui