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

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

Issue 1310083007: [Ozone-DRM] Move vsync logic into DrmWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread
Patch Set: fix Created 5 years, 3 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_window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_window.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc
index 1b33a1e6419b7bf166900546fdb4e67e59cdd327..caf179ea70786cec666df23fc9de7adcc8417d87 100644
--- a/ui/ozone/platform/drm/gpu/drm_window.cc
+++ b/ui/ozone/platform/drm/gpu/drm_window.cc
@@ -4,11 +4,13 @@
#include "ui/ozone/platform/drm/gpu/drm_window.h"
+#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
+#include "ui/ozone/platform/drm/gpu/crtc_controller.h"
#include "ui/ozone/platform/drm/gpu/drm_buffer.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
@@ -182,6 +184,28 @@ const OverlayPlane* DrmWindow::GetLastModesetBuffer() {
return OverlayPlane::GetPrimaryPlane(last_submitted_planes_);
}
+void DrmWindow::GetVSyncParameters(
+ const gfx::VSyncProvider::UpdateVSyncCallback& callback) const {
+ if (!controller_)
+ return;
+
+ // If we're in mirror mode the 2 CRTCs should have similar modes with the same
+ // refresh rates.
+ CrtcController* crtc = controller_->crtc_controllers()[0];
+ // The value is invalid, so we can't update the parameters.
+ if (controller_->GetTimeOfLastFlip() == 0 || crtc->mode().vrefresh == 0)
+ return;
+
+ // Stores the time of the last refresh.
+ base::TimeTicks timebase =
+ base::TimeTicks::FromInternalValue(controller_->GetTimeOfLastFlip());
+ // Stores the refresh rate.
+ base::TimeDelta interval =
+ base::TimeDelta::FromSeconds(1) / crtc->mode().vrefresh;
+
+ callback.Run(timebase, interval);
+}
+
void DrmWindow::ResetCursor(bool bitmap_only) {
if (!controller_)
return;
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698