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

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

Issue 821023003: [Ozone-DRI] Listen for swap events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async-swap
Patch Set: Added comment 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 | « no previous file | 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_ 5 #ifndef UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_
6 #define UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_ 6 #define UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <xf86drmMode.h> 10 #include <xf86drmMode.h>
11 11
12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h"
12 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h" 14 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h"
13 #include "ui/ozone/platform/dri/overlay_plane.h" 15 #include "ui/ozone/platform/dri/overlay_plane.h"
14 #include "ui/ozone/platform/dri/scoped_drm_types.h" 16 #include "ui/ozone/platform/dri/scoped_drm_types.h"
15 17
16 namespace ui { 18 namespace ui {
17 19
18 class DriWrapper; 20 class DriWrapper;
21 class PageFlipObserver;
19 22
20 // Wrapper around a CRTC. 23 // Wrapper around a CRTC.
21 // 24 //
22 // One CRTC can be paired up with one or more connectors. The simplest 25 // One CRTC can be paired up with one or more connectors. The simplest
23 // configuration represents one CRTC driving one monitor, while pairing up a 26 // configuration represents one CRTC driving one monitor, while pairing up a
24 // CRTC with multiple connectors results in hardware mirroring. 27 // CRTC with multiple connectors results in hardware mirroring.
25 class CrtcController { 28 class CrtcController : public base::SupportsWeakPtr<CrtcController> {
26 public: 29 public:
27 CrtcController(DriWrapper* drm, uint32_t crtc, uint32_t connector); 30 CrtcController(DriWrapper* drm, uint32_t crtc, uint32_t connector);
28 ~CrtcController(); 31 ~CrtcController();
29 32
30 uint32_t crtc() const { return crtc_; } 33 uint32_t crtc() const { return crtc_; }
31 uint32_t connector() const { return connector_; } 34 uint32_t connector() const { return connector_; }
32 DriWrapper* drm() const { return drm_; } 35 DriWrapper* drm() const { return drm_; }
33 bool is_disabled() const { return is_disabled_; } 36 bool is_disabled() const { return is_disabled_; }
34 bool page_flip_pending() const { return page_flip_pending_; } 37 bool page_flip_pending() const { return page_flip_pending_; }
35 uint64_t time_of_last_flip() const { return time_of_last_flip_; } 38 uint64_t time_of_last_flip() const { return time_of_last_flip_; }
(...skipping 21 matching lines...) Expand all
57 // represents the number of seconds while |useconds| represents the 60 // represents the number of seconds while |useconds| represents the
58 // microseconds (< 1 second) in the timestamp. 61 // microseconds (< 1 second) in the timestamp.
59 void OnPageFlipEvent(unsigned int frame, 62 void OnPageFlipEvent(unsigned int frame,
60 unsigned int seconds, 63 unsigned int seconds,
61 unsigned int useconds); 64 unsigned int useconds);
62 65
63 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); 66 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer);
64 bool UnsetCursor(); 67 bool UnsetCursor();
65 bool MoveCursor(const gfx::Point& location); 68 bool MoveCursor(const gfx::Point& location);
66 69
70 void AddObserver(PageFlipObserver* observer);
71 void RemoveObserver(PageFlipObserver* observer);
72
67 private: 73 private:
68 DriWrapper* drm_; // Not owned. 74 DriWrapper* drm_; // Not owned.
69 75
70 HardwareDisplayPlaneManager* overlay_plane_manager_; // Not owned. 76 HardwareDisplayPlaneManager* overlay_plane_manager_; // Not owned.
71 77
72 // Buffers need to be declared first so that they are destroyed last. Needed 78 // Buffers need to be declared first so that they are destroyed last. Needed
73 // since the controllers may reference the buffers. 79 // since the controllers may reference the buffers.
74 OverlayPlaneList current_planes_; 80 OverlayPlaneList current_planes_;
75 OverlayPlaneList pending_planes_; 81 OverlayPlaneList pending_planes_;
76 scoped_refptr<ScanoutBuffer> cursor_buffer_; 82 scoped_refptr<ScanoutBuffer> cursor_buffer_;
(...skipping 13 matching lines...) Expand all
90 // is set to false. Otherwise it is true. 96 // is set to false. Otherwise it is true.
91 bool is_disabled_; 97 bool is_disabled_;
92 98
93 // True if a successful SchedulePageFlip occurred. Reset to false by a modeset 99 // True if a successful SchedulePageFlip occurred. Reset to false by a modeset
94 // operation or when the OnPageFlipEvent callback is triggered. 100 // operation or when the OnPageFlipEvent callback is triggered.
95 bool page_flip_pending_; 101 bool page_flip_pending_;
96 102
97 // The time of the last page flip event as reported by the kernel callback. 103 // The time of the last page flip event as reported by the kernel callback.
98 uint64_t time_of_last_flip_; 104 uint64_t time_of_last_flip_;
99 105
106 ObserverList<PageFlipObserver> observers_;
107
100 DISALLOW_COPY_AND_ASSIGN(CrtcController); 108 DISALLOW_COPY_AND_ASSIGN(CrtcController);
101 }; 109 };
102 110
103 } // namespace ui 111 } // namespace ui
104 112
105 #endif // UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_ 113 #endif // UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/dri/crtc_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698