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_PLANE_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <xf86drmMode.h> |
| 12 |
11 #include <vector> | 13 #include <vector> |
12 | 14 |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" | 16 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" |
15 | 17 |
16 namespace ui { | 18 namespace ui { |
17 | 19 |
18 class DrmDevice; | 20 class DrmDevice; |
19 | 21 |
20 class HardwareDisplayPlane { | 22 class HardwareDisplayPlane { |
21 public: | 23 public: |
22 enum Type { kDummy, kPrimary, kOverlay, kCursor }; | 24 enum Type { kDummy, kPrimary, kOverlay, kCursor }; |
23 | 25 |
24 HardwareDisplayPlane(uint32_t plane_id, uint32_t possible_crtcs); | 26 HardwareDisplayPlane(uint32_t plane_id, uint32_t possible_crtcs); |
25 | 27 |
26 virtual ~HardwareDisplayPlane(); | 28 virtual ~HardwareDisplayPlane(); |
27 | 29 |
28 bool Initialize(DrmDevice* drm, | 30 bool Initialize(DrmDevice* drm, |
29 const std::vector<uint32_t>& formats, | 31 const std::vector<uint32_t>& formats, |
| 32 const std::vector<drm_format_modifier>& format_info, |
30 bool is_dummy, | 33 bool is_dummy, |
31 bool test_only); | 34 bool test_only); |
32 | 35 |
33 bool IsSupportedFormat(uint32_t format); | 36 bool IsSupportedFormat(uint32_t format); |
34 | 37 |
| 38 std::vector<uint64_t> ModifiersForFormat(uint32_t format); |
| 39 |
35 bool CanUseForCrtc(uint32_t crtc_index); | 40 bool CanUseForCrtc(uint32_t crtc_index); |
36 | 41 |
37 bool in_use() const { return in_use_; } | 42 bool in_use() const { return in_use_; } |
38 void set_in_use(bool in_use) { in_use_ = in_use; } | 43 void set_in_use(bool in_use) { in_use_ = in_use; } |
39 | 44 |
40 uint32_t plane_id() const { return plane_id_; } | 45 uint32_t plane_id() const { return plane_id_; } |
41 | 46 |
42 Type type() const { return type_; } | 47 Type type() const { return type_; } |
43 | 48 |
44 void set_owning_crtc(uint32_t crtc) { owning_crtc_ = crtc; } | 49 void set_owning_crtc(uint32_t crtc) { owning_crtc_ = crtc; } |
45 uint32_t owning_crtc() const { return owning_crtc_; } | 50 uint32_t owning_crtc() const { return owning_crtc_; } |
46 | 51 |
47 const std::vector<uint32_t>& supported_formats() const; | 52 const std::vector<uint32_t>& supported_formats() const; |
48 | 53 |
49 protected: | 54 protected: |
50 virtual bool InitializeProperties( | 55 virtual bool InitializeProperties( |
51 DrmDevice* drm, | 56 DrmDevice* drm, |
52 const ScopedDrmObjectPropertyPtr& plane_props); | 57 const ScopedDrmObjectPropertyPtr& plane_props); |
53 | 58 |
54 uint32_t plane_id_ = 0; | 59 uint32_t plane_id_ = 0; |
55 uint32_t possible_crtcs_ = 0; | 60 uint32_t possible_crtcs_ = 0; |
56 uint32_t owning_crtc_ = 0; | 61 uint32_t owning_crtc_ = 0; |
57 uint32_t last_used_format_ = 0; | 62 uint32_t last_used_format_ = 0; |
58 bool in_use_ = false; | 63 bool in_use_ = false; |
59 Type type_ = kPrimary; | 64 Type type_ = kPrimary; |
60 std::vector<uint32_t> supported_formats_; | 65 std::vector<uint32_t> supported_formats_; |
| 66 std::vector<drm_format_modifier> supported_format_modifiers_; |
61 | 67 |
62 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlane); | 68 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlane); |
63 }; | 69 }; |
64 | 70 |
65 } // namespace ui | 71 } // namespace ui |
66 | 72 |
67 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_ | 73 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_H_ |
OLD | NEW |