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

Side by Side Diff: ui/ozone/platform/dri/crtc_controller.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/channel_observer.h ('k') | ui/ozone/platform/dri/crtc_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_
6 #define UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <xf86drmMode.h>
11
12 #include "ui/ozone/platform/dri/overlay_plane.h"
13 #include "ui/ozone/platform/dri/scoped_drm_types.h"
14
15 namespace ui {
16
17 class DriWrapper;
18
19 // Wrapper around a CRTC.
20 //
21 // One CRTC can be paired up with one or more connectors. The simplest
22 // configuration represents one CRTC driving one monitor, while pairing up a
23 // CRTC with multiple connectors results in hardware mirroring.
24 class CrtcController {
25 public:
26 CrtcController(DriWrapper* drm, uint32_t crtc, uint32_t connector);
27 ~CrtcController();
28
29 uint32_t crtc() const { return crtc_; }
30 uint32_t connector() const { return connector_; }
31 DriWrapper* drm() const { return drm_; }
32 bool is_disabled() const { return is_disabled_; }
33 bool page_flip_pending() const { return page_flip_pending_; }
34 uint64_t time_of_last_flip() const { return time_of_last_flip_; }
35
36 // Perform the initial modesetting operation using |plane| as the buffer for
37 // the primary plane. The CRTC configuration is specified by |mode|.
38 bool Modeset(const OverlayPlane& plane, drmModeModeInfo mode);
39
40 // Disables the controller.
41 bool Disable();
42
43 // Schedule a page flip event and present the overlays in |planes|.
44 bool SchedulePageFlip(const OverlayPlaneList& planes);
45
46 // Called when the page flip event occurred. The event is provided by the
47 // kernel when a VBlank event finished. This allows the controller to
48 // update internal state and propagate the update to the surface.
49 // The tuple (seconds, useconds) represents the event timestamp. |seconds|
50 // represents the number of seconds while |useconds| represents the
51 // microseconds (< 1 second) in the timestamp.
52 void OnPageFlipEvent(unsigned int frame,
53 unsigned int seconds,
54 unsigned int useconds);
55
56 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer);
57 bool UnsetCursor();
58 bool MoveCursor(const gfx::Point& location);
59
60 private:
61 DriWrapper* drm_; // Not owned.
62
63 // Buffers need to be declared first so that they are destroyed last. Needed
64 // since the controllers may reference the buffers.
65 OverlayPlaneList current_planes_;
66 OverlayPlaneList pending_planes_;
67 scoped_refptr<ScanoutBuffer> cursor_buffer_;
68
69 uint32_t crtc_;
70
71 // TODO(dnicoara) Add support for hardware mirroring (multiple connectors).
72 uint32_t connector_;
73
74 drmModeModeInfo mode_;
75
76 // Store the state of the CRTC before we took over. Used to restore the CRTC
77 // once we no longer need it.
78 ScopedDrmCrtcPtr saved_crtc_;
79
80 // Keeps track of the CRTC state. If a surface has been bound, then the value
81 // is set to false. Otherwise it is true.
82 bool is_disabled_;
83
84 // True if a successful SchedulePageFlip occurred. Reset to false by a modeset
85 // operation or when the OnPageFlipEvent callback is triggered.
86 bool page_flip_pending_;
87
88 // The time of the last page flip event as reported by the kernel callback.
89 uint64_t time_of_last_flip_;
90
91 DISALLOW_COPY_AND_ASSIGN(CrtcController);
92 };
93
94 } // namespace ui
95
96 #endif // UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/channel_observer.h ('k') | ui/ozone/platform/dri/crtc_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698