OLD | NEW |
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" | 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/dri/hardware_display_plane_manager.h" | 15 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h" |
16 #include "ui/ozone/platform/dri/overlay_plane.h" | 16 #include "ui/ozone/platform/dri/overlay_plane.h" |
17 #include "ui/ozone/platform/dri/scoped_drm_types.h" | 17 #include "ui/ozone/platform/dri/scoped_drm_types.h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 class DriWrapper; | 21 class DrmDevice; |
22 class PageFlipObserver; | 22 class PageFlipObserver; |
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<DriWrapper>& drm, | 32 CrtcController(const scoped_refptr<DrmDevice>& drm, |
33 uint32_t crtc, | 33 uint32_t crtc, |
34 uint32_t connector); | 34 uint32_t connector); |
35 ~CrtcController(); | 35 ~CrtcController(); |
36 | 36 |
37 uint32_t crtc() const { return crtc_; } | 37 uint32_t crtc() const { return crtc_; } |
38 uint32_t connector() const { return connector_; } | 38 uint32_t connector() const { return connector_; } |
39 const scoped_refptr<DriWrapper>& drm() const { return drm_; } | 39 const scoped_refptr<DrmDevice>& drm() const { return drm_; } |
40 bool is_disabled() const { return is_disabled_; } | 40 bool is_disabled() const { return is_disabled_; } |
41 bool page_flip_pending() const { return page_flip_pending_; } | 41 bool page_flip_pending() const { return page_flip_pending_; } |
42 uint64_t time_of_last_flip() const { return time_of_last_flip_; } | 42 uint64_t time_of_last_flip() const { return time_of_last_flip_; } |
43 | 43 |
44 drmModeCrtc* saved_crtc() const { return saved_crtc_.get(); } | 44 drmModeCrtc* saved_crtc() const { return saved_crtc_.get(); } |
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 |
(...skipping 18 matching lines...) Expand all Loading... |
68 unsigned int useconds); | 68 unsigned int useconds); |
69 | 69 |
70 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); | 70 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); |
71 bool UnsetCursor(); | 71 bool UnsetCursor(); |
72 bool MoveCursor(const gfx::Point& location); | 72 bool MoveCursor(const gfx::Point& location); |
73 | 73 |
74 void AddObserver(PageFlipObserver* observer); | 74 void AddObserver(PageFlipObserver* observer); |
75 void RemoveObserver(PageFlipObserver* observer); | 75 void RemoveObserver(PageFlipObserver* observer); |
76 | 76 |
77 private: | 77 private: |
78 scoped_refptr<DriWrapper> drm_; | 78 scoped_refptr<DrmDevice> drm_; |
79 | 79 |
80 HardwareDisplayPlaneManager* overlay_plane_manager_; // Not owned. | 80 HardwareDisplayPlaneManager* overlay_plane_manager_; // Not owned. |
81 | 81 |
82 // Buffers need to be declared first so that they are destroyed last. Needed | 82 // Buffers need to be declared first so that they are destroyed last. Needed |
83 // since the controllers may reference the buffers. | 83 // since the controllers may reference the buffers. |
84 OverlayPlaneList current_planes_; | 84 OverlayPlaneList current_planes_; |
85 OverlayPlaneList pending_planes_; | 85 OverlayPlaneList pending_planes_; |
86 scoped_refptr<ScanoutBuffer> cursor_buffer_; | 86 scoped_refptr<ScanoutBuffer> cursor_buffer_; |
87 | 87 |
88 uint32_t crtc_; | 88 uint32_t crtc_; |
(...skipping 19 matching lines...) Expand all Loading... |
108 uint64_t time_of_last_flip_; | 108 uint64_t time_of_last_flip_; |
109 | 109 |
110 ObserverList<PageFlipObserver> observers_; | 110 ObserverList<PageFlipObserver> observers_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(CrtcController); | 112 DISALLOW_COPY_AND_ASSIGN(CrtcController); |
113 }; | 113 }; |
114 | 114 |
115 } // namespace ui | 115 } // namespace ui |
116 | 116 |
117 #endif // UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_ | 117 #endif // UI_OZONE_PLATFORM_DRI_CRTC_CONTROLLER_H_ |
OLD | NEW |