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

Side by Side Diff: ui/gfx/ozone/impl/hardware_display_controller.h

Issue 49303002: [Ozone] Rename software implementation files to use Dri prefix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ifdef Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_OZONE_H_ 5 #ifndef UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_H_
6 #define UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_OZONE_H_ 6 #define UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_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 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" 15 #include "ui/gfx/ozone/impl/dri_wrapper.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 18
19 class SoftwareSurfaceOzone; 19 class DriSurface;
20 20
21 // The HDCOz will handle modesettings and scannout operations for hardware 21 // The HDCOz will handle modesettings and scannout operations for hardware
22 // devices. 22 // devices.
23 // 23 //
24 // In the DRM world there are 3 components that need to be paired up to be able 24 // In the DRM world there are 3 components that need to be paired up to be able
25 // to display an image to the monitor: CRTC (cathode ray tube controller), 25 // to display an image to the monitor: CRTC (cathode ray tube controller),
26 // encoder and connector. The CRTC determines which framebuffer to read, when 26 // encoder and connector. The CRTC determines which framebuffer to read, when
27 // to scanout and where to scanout. Encoders converts the stream from the CRTC 27 // to scanout and where to scanout. Encoders converts the stream from the CRTC
28 // to the appropriate format for the connector. The connector is the physical 28 // to the appropriate format for the connector. The connector is the physical
29 // connection that monitors connect to. 29 // connection that monitors connect to.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // | CRTC1 | 68 // | CRTC1 |
69 // ---------------------- 69 // ----------------------
70 // 70 //
71 // Note that it is possible to have more connectors than CRTCs which means that 71 // Note that it is possible to have more connectors than CRTCs which means that
72 // only a subset of connectors can be active independently, showing different 72 // only a subset of connectors can be active independently, showing different
73 // framebuffers. Though, in this case, it would be possible to have all 73 // framebuffers. Though, in this case, it would be possible to have all
74 // connectors active if some use the same CRTC to mirror the display. 74 // connectors active if some use the same CRTC to mirror the display.
75 // 75 //
76 // TODO(dnicoara) Need to have a way to detect events (such as monitor 76 // TODO(dnicoara) Need to have a way to detect events (such as monitor
77 // connected or disconnected). 77 // connected or disconnected).
78 class HardwareDisplayControllerOzone { 78 class HardwareDisplayController {
79 public: 79 public:
80 // Controller states. The state transitions will happen from top to bottom. 80 // Controller states. The state transitions will happen from top to bottom.
81 enum State { 81 enum State {
82 // When we allocate a HDCO as a stub. At this point there is no connector 82 // When we allocate a HDCO as a stub. At this point there is no connector
83 // and CRTC associated with this device. 83 // and CRTC associated with this device.
84 UNASSOCIATED, 84 UNASSOCIATED,
85 85
86 // When |SetControllerInfo| is called and the HDCO has the information of 86 // When |SetControllerInfo| is called and the HDCO has the information of
87 // the hardware it will control. At this point it knows everything it needs 87 // the hardware it will control. At this point it knows everything it needs
88 // to control the hardware but doesn't have a surface. 88 // to control the hardware but doesn't have a surface.
89 UNINITIALIZED, 89 UNINITIALIZED,
90 90
91 // A surface is associated with the HDCO. This means that the controller can 91 // A surface is associated with the HDCO. This means that the controller can
92 // potentially display the backing surface to the display. Though the 92 // potentially display the backing surface to the display. Though the
93 // surface framebuffer still needs to be registered with the CRTC. 93 // surface framebuffer still needs to be registered with the CRTC.
94 SURFACE_INITIALIZED, 94 SURFACE_INITIALIZED,
95 95
96 // The CRTC now knows about the surface attributes. 96 // The CRTC now knows about the surface attributes.
97 INITIALIZED, 97 INITIALIZED,
98 98
99 // Error state if any of the initialization steps fail. 99 // Error state if any of the initialization steps fail.
100 FAILED, 100 FAILED,
101 }; 101 };
102 102
103 HardwareDisplayControllerOzone(); 103 HardwareDisplayController();
104 104
105 ~HardwareDisplayControllerOzone(); 105 ~HardwareDisplayController();
106 106
107 // Set the hardware configuration for this HDCO. Once this is set, the HDCO is 107 // Set the hardware configuration for this HDCO. Once this is set, the HDCO is
108 // responsible for keeping track of the connector and CRTC and cleaning up 108 // responsible for keeping track of the connector and CRTC and cleaning up
109 // when it is destroyed. 109 // when it is destroyed.
110 void SetControllerInfo(DrmWrapperOzone* drm, 110 void SetControllerInfo(DriWrapper* drm,
111 uint32_t connector_id, 111 uint32_t connector_id,
112 uint32_t crtc_id, 112 uint32_t crtc_id,
113 uint32_t dpms_property_id, 113 uint32_t dpms_property_id,
114 drmModeModeInfo mode); 114 drmModeModeInfo mode);
115 115
116 // Associate the HDCO with a surface implementation and initialize it. 116 // Associate the HDCO with a surface implementation and initialize it.
117 bool BindSurfaceToController(scoped_ptr<SoftwareSurfaceOzone> surface); 117 bool BindSurfaceToController(scoped_ptr<DriSurface> surface);
118 118
119 // Schedules the |surface_|'s framebuffer to be displayed on the next vsync 119 // Schedules the |surface_|'s framebuffer to be displayed on the next vsync
120 // event. The event will be posted on the graphics card file descriptor |fd_| 120 // event. The event will be posted on the graphics card file descriptor |fd_|
121 // and it can be read and processed by |drmHandleEvent|. That function can 121 // and it can be read and processed by |drmHandleEvent|. That function can
122 // define the callback for the page flip event. A generic data argument will 122 // define the callback for the page flip event. A generic data argument will
123 // be presented to the callback. We use that argument to pass in the HDCO 123 // be presented to the callback. We use that argument to pass in the HDCO
124 // object the event belongs to. 124 // object the event belongs to.
125 // 125 //
126 // Between this call and the callback, the framebuffer used in this call 126 // Between this call and the callback, the framebuffer used in this call
127 // should not be modified in any way as it would cause screen tearing if the 127 // should not be modified in any way as it would cause screen tearing if the
128 // hardware performed the flip. Note that the frontbuffer should also not 128 // hardware performed the flip. Note that the frontbuffer should also not
129 // be modified as it could still be displayed. 129 // be modified as it could still be displayed.
130 // 130 //
131 // Note that this function does not block. Also, this function should not be 131 // Note that this function does not block. Also, this function should not be
132 // called again before the page flip occurrs. 132 // called again before the page flip occurrs.
133 // 133 //
134 // Returns true if the page flip was successfully registered, false otherwise. 134 // Returns true if the page flip was successfully registered, false otherwise.
135 bool SchedulePageFlip(); 135 bool SchedulePageFlip();
136 136
137 State get_state() const { return state_; }; 137 State get_state() const { return state_; };
138 138
139 int get_fd() const { return drm_->get_fd(); }; 139 int get_fd() const { return drm_->get_fd(); };
140 140
141 const drmModeModeInfo& get_mode() const { return mode_; }; 141 const drmModeModeInfo& get_mode() const { return mode_; };
142 142
143 SoftwareSurfaceOzone* get_surface() const { return surface_.get(); }; 143 DriSurface* get_surface() const { return surface_.get(); };
144 144
145 private: 145 private:
146 // Object containing the connection to the graphics device and wraps the API 146 // Object containing the connection to the graphics device and wraps the API
147 // calls to control it. 147 // calls to control it.
148 DrmWrapperOzone* drm_; 148 DriWrapper* drm_;
149 149
150 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors. 150 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors.
151 uint32_t connector_id_; 151 uint32_t connector_id_;
152 152
153 uint32_t crtc_id_; 153 uint32_t crtc_id_;
154 154
155 uint32_t dpms_property_id_; 155 uint32_t dpms_property_id_;
156 156
157 // TODO(dnicoara) Need to store all the modes. 157 // TODO(dnicoara) Need to store all the modes.
158 drmModeModeInfo mode_; 158 drmModeModeInfo mode_;
159 159
160 // Saved CRTC state from before we used it. Need it to restore state once we 160 // Saved CRTC state from before we used it. Need it to restore state once we
161 // are finished using this device. 161 // are finished using this device.
162 drmModeCrtc* saved_crtc_; 162 drmModeCrtc* saved_crtc_;
163 163
164 State state_; 164 State state_;
165 165
166 scoped_ptr<SoftwareSurfaceOzone> surface_; 166 scoped_ptr<DriSurface> surface_;
167 167
168 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerOzone); 168 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController);
169 }; 169 };
170 170
171 } // namespace gfx 171 } // namespace gfx
172 172
173 #endif // UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_OZONE_H_ 173 #endif // UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/gfx/ozone/impl/file_surface_factory_ozone.cc ('k') | ui/gfx/ozone/impl/hardware_display_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698