| 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_HARDWARE_DISPLAY_PLANE_MANAGER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_PLANE_MANAGER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_PLANE_MANAGER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_PLANE_MANAGER_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_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "ui/ozone/ozone_export.h" | 15 #include "ui/ozone/ozone_export.h" |
| 16 #include "ui/ozone/platform/dri/hardware_display_plane.h" | 16 #include "ui/ozone/platform/dri/hardware_display_plane.h" |
| 17 #include "ui/ozone/platform/dri/overlay_plane.h" | 17 #include "ui/ozone/platform/dri/overlay_plane.h" |
| 18 #include "ui/ozone/platform/dri/scoped_drm_types.h" | 18 #include "ui/ozone/platform/dri/scoped_drm_types.h" |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class Rect; | 21 class Rect; |
| 22 } // namespace gfx | 22 } // namespace gfx |
| 23 | 23 |
| 24 namespace ui { | 24 namespace ui { |
| 25 | 25 |
| 26 class DriWrapper; | 26 class DrmDevice; |
| 27 class CrtcController; | 27 class CrtcController; |
| 28 | 28 |
| 29 // This contains the list of planes controlled by one HDC on a given DRM fd. | 29 // This contains the list of planes controlled by one HDC on a given DRM fd. |
| 30 // It is owned by the HDC and filled by the CrtcController. | 30 // It is owned by the HDC and filled by the CrtcController. |
| 31 struct OZONE_EXPORT HardwareDisplayPlaneList { | 31 struct OZONE_EXPORT HardwareDisplayPlaneList { |
| 32 HardwareDisplayPlaneList(); | 32 HardwareDisplayPlaneList(); |
| 33 ~HardwareDisplayPlaneList(); | 33 ~HardwareDisplayPlaneList(); |
| 34 | 34 |
| 35 // This is the list of planes to be committed this time. | 35 // This is the list of planes to be committed this time. |
| 36 std::vector<HardwareDisplayPlane*> plane_list; | 36 std::vector<HardwareDisplayPlane*> plane_list; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 bool committed; | 70 bool committed; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class OZONE_EXPORT HardwareDisplayPlaneManager { | 73 class OZONE_EXPORT HardwareDisplayPlaneManager { |
| 74 public: | 74 public: |
| 75 HardwareDisplayPlaneManager(); | 75 HardwareDisplayPlaneManager(); |
| 76 virtual ~HardwareDisplayPlaneManager(); | 76 virtual ~HardwareDisplayPlaneManager(); |
| 77 | 77 |
| 78 // This parses information from the drm driver, adding any new planes | 78 // This parses information from the drm driver, adding any new planes |
| 79 // or crtcs found. | 79 // or crtcs found. |
| 80 bool Initialize(DriWrapper* drm); | 80 bool Initialize(DrmDevice* drm); |
| 81 | 81 |
| 82 // Assign hardware planes from the |planes_| list to |overlay_list| entries, | 82 // Assign hardware planes from the |planes_| list to |overlay_list| entries, |
| 83 // recording the plane IDs in the |plane_list|. Only planes compatible with | 83 // recording the plane IDs in the |plane_list|. Only planes compatible with |
| 84 // |crtc_id| will be used. |overlay_list| must be sorted bottom-to-top. | 84 // |crtc_id| will be used. |overlay_list| must be sorted bottom-to-top. |
| 85 virtual bool AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list, | 85 virtual bool AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list, |
| 86 const OverlayPlaneList& overlay_list, | 86 const OverlayPlaneList& overlay_list, |
| 87 uint32_t crtc_id, | 87 uint32_t crtc_id, |
| 88 CrtcController* crtc); | 88 CrtcController* crtc); |
| 89 | 89 |
| 90 // Commit the plane states in |plane_list|. | 90 // Commit the plane states in |plane_list|. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 105 CrtcController* crtc) = 0; | 105 CrtcController* crtc) = 0; |
| 106 // Finds the plane located at or after |*index| that is not in use and can | 106 // Finds the plane located at or after |*index| that is not in use and can |
| 107 // be used with |crtc_index|. | 107 // be used with |crtc_index|. |
| 108 HardwareDisplayPlane* FindNextUnusedPlane(size_t* index, uint32_t crtc_index); | 108 HardwareDisplayPlane* FindNextUnusedPlane(size_t* index, uint32_t crtc_index); |
| 109 | 109 |
| 110 // Convert |crtc_id| into an index, returning -1 if the ID couldn't be found. | 110 // Convert |crtc_id| into an index, returning -1 if the ID couldn't be found. |
| 111 int LookupCrtcIndex(uint32_t crtc_id); | 111 int LookupCrtcIndex(uint32_t crtc_id); |
| 112 | 112 |
| 113 // Object containing the connection to the graphics device and wraps the API | 113 // Object containing the connection to the graphics device and wraps the API |
| 114 // calls to control it. Not owned. | 114 // calls to control it. Not owned. |
| 115 DriWrapper* drm_; | 115 DrmDevice* drm_; |
| 116 | 116 |
| 117 ScopedVector<HardwareDisplayPlane> planes_; | 117 ScopedVector<HardwareDisplayPlane> planes_; |
| 118 std::vector<uint32_t> crtcs_; | 118 std::vector<uint32_t> crtcs_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManager); | 120 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManager); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace ui | 123 } // namespace ui |
| 124 | 124 |
| 125 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_PLANE_MANAGER_H_ | 125 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_PLANE_MANAGER_H_ |
| OLD | NEW |