Chromium Code Reviews| 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..ec768491e15d4c3af11c28f372e96eb1bcce321c 100644 |
| --- a/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
| +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
| @@ -13,6 +13,42 @@ |
| namespace ui { |
| +namespace { |
| +#define FOURCC(a, b, c, d) \ |
|
dnicoara
2015/08/25 16:27:13
#defines shouldn't be in a namespace
dnicoara
2015/08/25 16:27:13
What was the issue with including drm_fourcc.h?
kalyank
2015/08/25 16:38:09
Acknowledged.
kalyank
2015/08/25 16:39:47
chromeos_daisy_chromium_compile_only_ng, cast_shel
kalyank
2015/08/25 16:54:36
Done.
dnicoara
2015/08/25 17:35:32
Silly me, I was looking at the wrong version.
I f
kalyank
2015/08/25 17:56:18
Thanks, should have checked that. Waiting for tryb
|
| + ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ |
| + (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) |
| + |
| +#define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') |
| + |
| +#ifndef DRM_PLANE_TYPE_OVERLAY |
| +#define DRM_PLANE_TYPE_OVERLAY 0 |
| +#endif |
| + |
| +#ifndef DRM_PLANE_TYPE_PRIMARY |
| +#define DRM_PLANE_TYPE_PRIMARY 1 |
| +#endif |
| + |
| +#ifndef DRM_PLANE_TYPE_CURSOR |
| +#define DRM_PLANE_TYPE_CURSOR 2 |
| +#endif |
| + |
| +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 +62,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( |
| + 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 |