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 3f700cbbcf56702eb7f5de0b9b4aa65b03ac3fc0..b1fa2f67d029f6f7404542c46237952975e1c556 100644 |
--- a/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
+++ b/ui/ozone/platform/drm/gpu/hardware_display_plane.cc |
@@ -56,15 +56,21 @@ bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { |
bool HardwareDisplayPlane::Initialize(DrmDevice* drm, |
const std::vector<uint32_t>& formats, |
- bool is_dummy) { |
+ bool is_dummy, |
+ bool test_only) { |
+ supported_formats_ = formats; |
+ |
+ if (test_only) |
+ return true; |
+ |
if (is_dummy) { |
type_ = kDummy; |
- supported_formats_.push_back(DRM_FORMAT_XRGB8888); |
+ if (supported_formats_.empty()) |
dnicoara
2015/08/27 13:21:56
Could you just drop this if-statement and pass in
kalyank
2015/08/27 16:07:10
Done.
|
+ 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) { |
@@ -84,8 +90,22 @@ bool HardwareDisplayPlane::Initialize(DrmDevice* drm, |
return InitializeProperties(drm, plane_props); |
} |
-bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) const { |
- return true; |
+bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) { |
+ if (!format) |
+ return false; |
+ |
+ if (last_used_format_ == format) |
+ return true; |
+ |
+ for (auto& element : supported_formats_) { |
+ if (element == format) { |
+ last_used_format_ = format; |
+ return true; |
+ } |
+ } |
+ |
+ last_used_format_ = 0; |
+ return false; |
} |
bool HardwareDisplayPlane::InitializeProperties( |