Index: ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
index fcb888a753192bdda15f3f4cfacba526c982935d..e08c432e1a8b22e0d5a513bf6e28049bf9345783 100644 |
--- a/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
+++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
@@ -15,6 +15,7 @@ |
namespace ui { |
namespace { |
+const char* kTypePropName = "type"; |
const char* kCrtcPropName = "CRTC_ID"; |
const char* kFbPropName = "FB_ID"; |
const char* kCrtcXPropName = "CRTC_X"; |
@@ -26,6 +27,20 @@ const char* kSrcYPropName = "SRC_Y"; |
const char* kSrcWPropName = "SRC_W"; |
const char* kSrcHPropName = "SRC_H"; |
+HardwareDisplayPlane::Type GetPlaneType(int value) { |
+ switch (value) { |
+ case DRM_PLANE_TYPE_CURSOR: |
+ return HardwareDisplayPlane::kCursor; |
+ case DRM_PLANE_TYPE_PRIMARY: |
+ return HardwareDisplayPlane::kPrimary; |
+ case DRM_PLANE_TYPE_OVERLAY: |
+ return HardwareDisplayPlane::kOverlay; |
+ default: |
+ NOTREACHED(); |
+ return HardwareDisplayPlane::kDummy; |
+ } |
+} |
+ |
} // namespace |
HardwareDisplayPlaneAtomic::Property::Property() { |
@@ -91,7 +106,14 @@ bool HardwareDisplayPlaneAtomic::SetPlaneData(drmModePropertySet* property_set, |
bool HardwareDisplayPlaneAtomic::Initialize( |
DrmDevice* drm, |
- const std::vector<uint32_t>& formats) { |
+ const std::vector<uint32_t>& formats, |
+ bool is_dummy) { |
+ if (is_dummy) { |
+ type_ = kDummy; |
+ supported_formats_.push_back(DRM_FORMAT_XRGB8888); |
+ return true; |
+ } |
+ |
ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties( |
drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE)); |
@@ -117,8 +139,14 @@ bool HardwareDisplayPlaneAtomic::Initialize( |
} |
supported_formats_ = formats; |
- if (is_dummy()) |
- supported_formats_.push_back(DRM_FORMAT_XRGB8888); |
+ |
+ for (uint32_t i = 0; i < plane_props->count_props; i++) { |
+ ScopedDrmPropertyPtr property( |
+ drmModeGetProperty(drm->get_fd(), plane_props->props[i])); |
+ if (property && !strcmp(property->name, kTypePropName)) { |
+ type_ = GetPlaneType(plane_props->prop_values[i]); |
+ } |
+ } |
return true; |
} |