Chromium Code Reviews| 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 #include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" | 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" |
| 6 | 6 |
| 7 #include <drm_fourcc.h> | |
|
dnicoara
2015/08/25 18:19:13
Empty line between different include types (system
kalyank
2015/08/25 18:31:55
Done.
| |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 9 | 10 |
| 11 #ifndef DRM_PLANE_TYPE_OVERLAY | |
| 12 #define DRM_PLANE_TYPE_OVERLAY 0 | |
| 13 #endif | |
| 14 | |
| 15 #ifndef DRM_PLANE_TYPE_PRIMARY | |
| 16 #define DRM_PLANE_TYPE_PRIMARY 1 | |
| 17 #endif | |
| 18 | |
| 19 #ifndef DRM_PLANE_TYPE_CURSOR | |
| 20 #define DRM_PLANE_TYPE_CURSOR 2 | |
| 21 #endif | |
| 22 | |
| 10 namespace ui { | 23 namespace ui { |
| 11 | 24 |
| 25 namespace { | |
| 26 | |
| 27 const char* kTypePropName = "type"; | |
| 28 HardwareDisplayPlane::Type GetPlaneType(int value) { | |
| 29 switch (value) { | |
| 30 case DRM_PLANE_TYPE_CURSOR: | |
| 31 return HardwareDisplayPlane::kCursor; | |
| 32 case DRM_PLANE_TYPE_PRIMARY: | |
| 33 return HardwareDisplayPlane::kPrimary; | |
| 34 case DRM_PLANE_TYPE_OVERLAY: | |
| 35 return HardwareDisplayPlane::kOverlay; | |
| 36 default: | |
| 37 NOTREACHED(); | |
| 38 return HardwareDisplayPlane::kDummy; | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 } // namespace | |
| 43 | |
| 12 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id, | 44 HardwareDisplayPlane::HardwareDisplayPlane(uint32_t plane_id, |
| 13 uint32_t possible_crtcs) | 45 uint32_t possible_crtcs) |
| 14 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) { | 46 : plane_id_(plane_id), possible_crtcs_(possible_crtcs) { |
| 15 } | 47 } |
| 16 | 48 |
| 17 HardwareDisplayPlane::~HardwareDisplayPlane() { | 49 HardwareDisplayPlane::~HardwareDisplayPlane() { |
| 18 } | 50 } |
| 19 | 51 |
| 20 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { | 52 bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { |
| 21 return possible_crtcs_ & (1 << crtc_index); | 53 return possible_crtcs_ & (1 << crtc_index); |
| 22 } | 54 } |
| 23 | 55 |
| 24 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, | 56 bool HardwareDisplayPlane::Initialize(DrmDevice* drm, |
| 25 const std::vector<uint32_t>& formats) { | 57 const std::vector<uint32_t>& formats, |
| 26 return true; | 58 bool is_dummy) { |
| 59 if (is_dummy) { | |
| 60 type_ = kDummy; | |
| 61 supported_formats_.push_back(DRM_FORMAT_XRGB8888); | |
| 62 return true; | |
| 63 } | |
| 64 | |
| 65 supported_formats_ = formats; | |
| 66 | |
| 67 ScopedDrmObjectPropertyPtr plane_props(drmModeObjectGetProperties( | |
| 68 drm->get_fd(), plane_id_, DRM_MODE_OBJECT_PLANE)); | |
| 69 if (!plane_props) { | |
| 70 PLOG(ERROR) << "Unable to get plane properties."; | |
| 71 return false; | |
| 72 } | |
| 73 | |
| 74 uint32_t count_props = plane_props->count_props; | |
| 75 for (uint32_t i = 0; i < count_props; i++) { | |
| 76 ScopedDrmPropertyPtr property( | |
| 77 drmModeGetProperty(drm->get_fd(), plane_props->props[i])); | |
| 78 if (property && !strcmp(property->name, kTypePropName)) { | |
| 79 type_ = GetPlaneType(plane_props->prop_values[i]); | |
| 80 } | |
| 81 } | |
| 82 | |
| 83 return InitializeProperties(drm, plane_props); | |
| 27 } | 84 } |
| 28 | 85 |
| 29 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { | 86 bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { |
| 30 return true; | 87 return true; |
| 31 } | 88 } |
| 32 | 89 |
| 90 bool HardwareDisplayPlane::InitializeProperties( | |
| 91 DrmDevice* drm, | |
| 92 const ScopedDrmObjectPropertyPtr& plane_props) { | |
| 93 return true; | |
| 94 } | |
| 95 | |
| 33 } // namespace ui | 96 } // namespace ui |
| OLD | NEW |