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

Side by Side Diff: ui/ozone/platform/drm/gpu/crtc_controller.h

Issue 1091253003: [ozone] Keep the queue of surfaceless buffers inside gl_surface_ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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_DRM_GPU_CRTC_CONTROLLER_H_ 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_ 6 #define UI_OZONE_PLATFORM_DRM_GPU_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" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "ui/ozone/ozone_export.h" 14 #include "ui/ozone/ozone_export.h"
15 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" 15 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h"
16 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" 16 #include "ui/ozone/platform/drm/gpu/overlay_plane.h"
17 #include "ui/ozone/platform/drm/gpu/scoped_drm_types.h" 17 #include "ui/ozone/platform/drm/gpu/scoped_drm_types.h"
18 18
19 namespace ui { 19 namespace ui {
20 20
21 class DrmDevice; 21 class DrmDevice;
22 class PageFlipObserver; 22 class PageFlipRequest;
23 23
24 // Wrapper around a CRTC. 24 // Wrapper around a CRTC.
25 // 25 //
26 // One CRTC can be paired up with one or more connectors. The simplest 26 // One CRTC can be paired up with one or more connectors. The simplest
27 // configuration represents one CRTC driving one monitor, while pairing up a 27 // configuration represents one CRTC driving one monitor, while pairing up a
28 // CRTC with multiple connectors results in hardware mirroring. 28 // CRTC with multiple connectors results in hardware mirroring.
29 class OZONE_EXPORT CrtcController 29 class OZONE_EXPORT CrtcController
30 : public base::SupportsWeakPtr<CrtcController> { 30 : public base::SupportsWeakPtr<CrtcController> {
31 public: 31 public:
32 CrtcController(const scoped_refptr<DrmDevice>& drm, 32 CrtcController(const scoped_refptr<DrmDevice>& drm,
(...skipping 12 matching lines...) Expand all
45 45
46 // Perform the initial modesetting operation using |plane| as the buffer for 46 // Perform the initial modesetting operation using |plane| as the buffer for
47 // the primary plane. The CRTC configuration is specified by |mode|. 47 // the primary plane. The CRTC configuration is specified by |mode|.
48 bool Modeset(const OverlayPlane& plane, drmModeModeInfo mode); 48 bool Modeset(const OverlayPlane& plane, drmModeModeInfo mode);
49 49
50 // Disables the controller. 50 // Disables the controller.
51 bool Disable(); 51 bool Disable();
52 52
53 // Schedule a page flip event and present the overlays in |planes|. 53 // Schedule a page flip event and present the overlays in |planes|.
54 bool SchedulePageFlip(HardwareDisplayPlaneList* plane_list, 54 bool SchedulePageFlip(HardwareDisplayPlaneList* plane_list,
55 const OverlayPlaneList& planes); 55 const OverlayPlaneList& planes,
56 scoped_refptr<PageFlipRequest> page_flip_request);
56 57
57 // Called if the page flip for this CRTC fails after being scheduled. 58 // Called if the page flip for this CRTC fails after being scheduled.
58 void PageFlipFailed(); 59 void PageFlipFailed();
59 60
60 // Called when the page flip event occurred. The event is provided by the 61 // Called when the page flip event occurred. The event is provided by the
61 // kernel when a VBlank event finished. This allows the controller to 62 // kernel when a VBlank event finished. This allows the controller to
62 // update internal state and propagate the update to the surface. 63 // update internal state and propagate the update to the surface.
63 // The tuple (seconds, useconds) represents the event timestamp. |seconds| 64 // The tuple (seconds, useconds) represents the event timestamp. |seconds|
64 // represents the number of seconds while |useconds| represents the 65 // represents the number of seconds while |useconds| represents the
65 // microseconds (< 1 second) in the timestamp. 66 // microseconds (< 1 second) in the timestamp.
66 void OnPageFlipEvent(unsigned int frame, 67 void OnPageFlipEvent(unsigned int frame,
67 unsigned int seconds, 68 unsigned int seconds,
68 unsigned int useconds); 69 unsigned int useconds);
69 70
70 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); 71 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer);
71 bool MoveCursor(const gfx::Point& location); 72 bool MoveCursor(const gfx::Point& location);
72 73
73 void AddObserver(PageFlipObserver* observer);
74 void RemoveObserver(PageFlipObserver* observer);
75
76 private: 74 private:
77 bool ResetCursor(); 75 bool ResetCursor();
78 76
79 scoped_refptr<DrmDevice> drm_; 77 scoped_refptr<DrmDevice> drm_;
80 78
81 HardwareDisplayPlaneManager* overlay_plane_manager_; // Not owned. 79 HardwareDisplayPlaneManager* overlay_plane_manager_; // Not owned.
82 80
83 // Buffers need to be declared first so that they are destroyed last. Needed 81 // Buffers need to be declared first so that they are destroyed last. Needed
84 // since the controllers may reference the buffers. 82 // since the controllers may reference the buffers.
85 OverlayPlaneList current_planes_; 83 OverlayPlaneList current_planes_;
86 OverlayPlaneList pending_planes_; 84 OverlayPlaneList pending_planes_;
87 scoped_refptr<ScanoutBuffer> cursor_buffer_; 85 scoped_refptr<ScanoutBuffer> cursor_buffer_;
86 scoped_refptr<PageFlipRequest> page_flip_request_;
88 87
89 uint32_t crtc_; 88 uint32_t crtc_;
90 89
91 // TODO(dnicoara) Add support for hardware mirroring (multiple connectors). 90 // TODO(dnicoara) Add support for hardware mirroring (multiple connectors).
92 uint32_t connector_; 91 uint32_t connector_;
93 92
94 drmModeModeInfo mode_; 93 drmModeModeInfo mode_;
95 94
96 // Store the state of the CRTC before we took over. Used to restore the CRTC 95 // Store the state of the CRTC before we took over. Used to restore the CRTC
97 // once we no longer need it. 96 // once we no longer need it.
98 ScopedDrmCrtcPtr saved_crtc_; 97 ScopedDrmCrtcPtr saved_crtc_;
99 98
100 // Keeps track of the CRTC state. If a surface has been bound, then the value 99 // Keeps track of the CRTC state. If a surface has been bound, then the value
101 // is set to false. Otherwise it is true. 100 // is set to false. Otherwise it is true.
102 bool is_disabled_; 101 bool is_disabled_;
103 102
104 // True if a successful SchedulePageFlip occurred. Reset to false by a modeset 103 // True if a successful SchedulePageFlip occurred. Reset to false by a modeset
105 // operation or when the OnPageFlipEvent callback is triggered. 104 // operation or when the OnPageFlipEvent callback is triggered.
106 bool page_flip_pending_; 105 bool page_flip_pending_;
107 106
108 // The time of the last page flip event as reported by the kernel callback. 107 // The time of the last page flip event as reported by the kernel callback.
109 uint64_t time_of_last_flip_; 108 uint64_t time_of_last_flip_;
110 109
111 ObserverList<PageFlipObserver> observers_;
112
113 DISALLOW_COPY_AND_ASSIGN(CrtcController); 110 DISALLOW_COPY_AND_ASSIGN(CrtcController);
114 }; 111 };
115 112
116 } // namespace ui 113 } // namespace ui
117 114
118 #endif // UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_ 115 #endif // UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698