Index: ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
index 779f3d660417ab2bc845a890e1d361ccd9fe4d32..1530c774a8e795bdb37014e84e7edabfbda33b38 100644 |
--- a/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
+++ b/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
@@ -5,6 +5,7 @@ |
#include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" |
#include <drm.h> |
+#include <drm/drm_fourcc.h> |
#include <xf86drm.h> |
#include "base/logging.h" |
@@ -13,6 +14,25 @@ |
namespace ui { |
+namespace { |
+ |
+const char* kTypePropName = "type"; |
+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 |
+ |
HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id, |
uint32_t possible_crtcs) |
: plane_id_(plane_id), possible_crtcs_(possible_crtcs) { |
@@ -26,12 +46,43 @@ bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { |
} |
bool HardwareDisplayPlane::Initialize(DrmDevice* drm, |
- const std::vector<uint32_t>& formats) { |
- return true; |
+ const std::vector<uint32_t>& formats, |
+ bool is_dummy) { |
+ if (is_dummy) { |
+ type_ = kDummy; |
+ supported_formats_.push_back(DRM_FORMAT_XRGB8888); |
+ return true; |
+ } |
+ |
+ supported_formats_ = formats; |
+ |
+ ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties( |
kalyank
2015/08/22 01:54:37
Sorry, the previous reply got badly formatted.
I r
|
+ drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE)); |
+ if (!plane_props) { |
+ PLOG(ERROR) << "Unable to get plane properties."; |
+ return false; |
+ } |
+ |
+ uint32_t count_props = plane_props->count_props; |
+ for (uint32_t i = 0; i < 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 InitializeProperties(drm, plane_props); |
} |
bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { |
return true; |
} |
+bool HardwareDisplayPlane::InitializeProperties( |
+ DrmDevice* drm, |
+ const ScopedDrmObjectPropertyPtr& plane_props) { |
+ return true; |
+} |
+ |
} // namespace ui |