Chromium Code Reviews| 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_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_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 | 11 |
| 12 #include <deque> | 12 #include <deque> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <unordered_map> | 15 #include <unordered_map> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/callback.h" | 18 #include "base/callback.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "ui/gfx/swap_result.h" | 20 #include "ui/gfx/swap_result.h" |
| 21 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" | 21 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
| 22 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" | 22 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" |
| 23 #include "ui/ozone/public/swap_completion_callback.h" | |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 25 class Point; | 26 class Point; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace ui { | 29 namespace ui { |
| 29 | 30 |
| 30 class CrtcController; | 31 class CrtcController; |
| 31 class ScanoutBuffer; | 32 class ScanoutBuffer; |
| 32 class DrmDevice; | 33 class DrmDevice; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 // | | | 80 // | | |
| 80 // ---------------------- | 81 // ---------------------- |
| 81 // | CRTC1 | | 82 // | CRTC1 | |
| 82 // ---------------------- | 83 // ---------------------- |
| 83 // | 84 // |
| 84 // Note that it is possible to have more connectors than CRTCs which means that | 85 // Note that it is possible to have more connectors than CRTCs which means that |
| 85 // only a subset of connectors can be active independently, showing different | 86 // only a subset of connectors can be active independently, showing different |
| 86 // framebuffers. Though, in this case, it would be possible to have all | 87 // framebuffers. Though, in this case, it would be possible to have all |
| 87 // connectors active if some use the same CRTC to mirror the display. | 88 // connectors active if some use the same CRTC to mirror the display. |
| 88 class HardwareDisplayController { | 89 class HardwareDisplayController { |
| 89 typedef base::Callback<void(gfx::SwapResult)> PageFlipCallback; | 90 // typedef base::Callback<void(gfx::SwapResult)> SwapCompletionOnceCallback; |
|
dnicoara
2017/05/15 20:22:14
nit: Delete line
| |
| 90 | 91 |
| 91 public: | 92 public: |
| 92 HardwareDisplayController(std::unique_ptr<CrtcController> controller, | 93 HardwareDisplayController(std::unique_ptr<CrtcController> controller, |
| 93 const gfx::Point& origin); | 94 const gfx::Point& origin); |
| 94 ~HardwareDisplayController(); | 95 ~HardwareDisplayController(); |
| 95 | 96 |
| 96 // Performs the initial CRTC configuration. If successful, it will display the | 97 // Performs the initial CRTC configuration. If successful, it will display the |
| 97 // framebuffer for |primary| with |mode|. | 98 // framebuffer for |primary| with |mode|. |
| 98 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); | 99 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); |
| 99 | 100 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 111 // object the event belongs to. | 112 // object the event belongs to. |
| 112 // | 113 // |
| 113 // Between this call and the callback, the framebuffers used in this call | 114 // Between this call and the callback, the framebuffers used in this call |
| 114 // should not be modified in any way as it would cause screen tearing if the | 115 // should not be modified in any way as it would cause screen tearing if the |
| 115 // hardware performed the flip. Note that the frontbuffer should also not | 116 // hardware performed the flip. Note that the frontbuffer should also not |
| 116 // be modified as it could still be displayed. | 117 // be modified as it could still be displayed. |
| 117 // | 118 // |
| 118 // Note that this function does not block. Also, this function should not be | 119 // Note that this function does not block. Also, this function should not be |
| 119 // called again before the page flip occurrs. | 120 // called again before the page flip occurrs. |
| 120 void SchedulePageFlip(const OverlayPlaneList& plane_list, | 121 void SchedulePageFlip(const OverlayPlaneList& plane_list, |
| 121 const PageFlipCallback& callback); | 122 SwapCompletionOnceCallback callback); |
| 122 | 123 |
| 123 // Returns true if the page flip with the |plane_list| would succeed. This | 124 // Returns true if the page flip with the |plane_list| would succeed. This |
| 124 // doesn't change any state. | 125 // doesn't change any state. |
| 125 bool TestPageFlip(const OverlayPlaneList& plane_list); | 126 bool TestPageFlip(const OverlayPlaneList& plane_list); |
| 126 | 127 |
| 127 bool IsFormatSupported(uint32_t fourcc_format, uint32_t z_order) const; | 128 bool IsFormatSupported(uint32_t fourcc_format, uint32_t z_order) const; |
| 128 | 129 |
| 129 // Return the supported modifiers for |fourcc_format| for this | 130 // Return the supported modifiers for |fourcc_format| for this |
| 130 // controller. | 131 // controller. |
| 131 std::vector<uint64_t> GetFormatModifiers(uint32_t fourcc_format); | 132 std::vector<uint64_t> GetFormatModifiers(uint32_t fourcc_format); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 154 | 155 |
| 155 const std::vector<std::unique_ptr<CrtcController>>& crtc_controllers() const { | 156 const std::vector<std::unique_ptr<CrtcController>>& crtc_controllers() const { |
| 156 return crtc_controllers_; | 157 return crtc_controllers_; |
| 157 } | 158 } |
| 158 | 159 |
| 159 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; | 160 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; |
| 160 | 161 |
| 161 private: | 162 private: |
| 162 bool ActualSchedulePageFlip(const OverlayPlaneList& plane_list, | 163 bool ActualSchedulePageFlip(const OverlayPlaneList& plane_list, |
| 163 bool test_only, | 164 bool test_only, |
| 164 const PageFlipCallback& callback); | 165 SwapCompletionOnceCallback callback); |
| 165 | 166 |
| 166 std::unordered_map<DrmDevice*, std::unique_ptr<HardwareDisplayPlaneList>> | 167 std::unordered_map<DrmDevice*, std::unique_ptr<HardwareDisplayPlaneList>> |
| 167 owned_hardware_planes_; | 168 owned_hardware_planes_; |
| 168 | 169 |
| 169 // Stores the CRTC configuration. This is used to identify monitors and | 170 // Stores the CRTC configuration. This is used to identify monitors and |
| 170 // configure them. | 171 // configure them. |
| 171 std::vector<std::unique_ptr<CrtcController>> crtc_controllers_; | 172 std::vector<std::unique_ptr<CrtcController>> crtc_controllers_; |
| 172 | 173 |
| 173 // Location of the controller on the screen. | 174 // Location of the controller on the screen. |
| 174 gfx::Point origin_; | 175 gfx::Point origin_; |
| 175 | 176 |
| 176 bool is_disabled_; | 177 bool is_disabled_; |
| 177 | 178 |
| 178 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 179 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
| 179 }; | 180 }; |
| 180 | 181 |
| 181 } // namespace ui | 182 } // namespace ui |
| 182 | 183 |
| 183 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 184 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
| OLD | NEW |