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 54f59188aba79c9e711776d76a89bfae75056987..a329edc8db79099a4c5f2e7014a5687a971a71ec 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_fourcc.h> |
| +#include <drm_mode.h> |
| #include "base/logging.h" |
| #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| @@ -54,11 +55,14 @@ bool HardwareDisplayPlane::CanUseForCrtc(uint32_t crtc_index) { |
| return possible_crtcs_ & (1 << crtc_index); |
| } |
| -bool HardwareDisplayPlane::Initialize(DrmDevice* drm, |
| - const std::vector<uint32_t>& formats, |
| - bool is_dummy, |
| - bool test_only) { |
| +bool HardwareDisplayPlane::Initialize( |
| + DrmDevice* drm, |
| + const std::vector<uint32_t>& formats, |
| + const std::vector<struct drm_format_modifier>& format_modifiers, |
| + bool is_dummy, |
| + bool test_only) { |
| supported_formats_ = formats; |
| + supported_format_modifiers_ = format_modifiers; |
| if (test_only) |
| return true; |
| @@ -112,6 +116,26 @@ const std::vector<uint32_t>& HardwareDisplayPlane::supported_formats() const { |
| return supported_formats_; |
| } |
| +std::vector<uint64_t> HardwareDisplayPlane::ModifiersForFormat( |
| + uint32_t format) { |
| + uint32_t format_index = 0; |
| + std::vector<uint64_t> modifiers; |
| + |
| + for (const auto& f : supported_formats_) { |
|
Daniele Castagna
2016/12/20 18:03:28
This is a vector of ints. In general, it doesn't m
hoegsberg1
2016/12/22 23:05:21
Sure. I guess that's idiomatic, but it's a lot har
|
| + if (f == format) |
| + break; |
| + format_index++; |
| + } |
| + DCHECK_LT(format_index, supported_formats_.size()); |
| + |
| + for (const auto& modifier : supported_format_modifiers_) { |
|
Daniele Castagna
2016/12/20 18:03:28
No need to use a ref for built in types.
hoegsberg1
2016/12/22 23:05:21
We're iterating through std:vector<struct drm_form
|
| + if (modifier.formats & (1 << format_index)) |
| + modifiers.push_back(modifier.modifier); |
| + } |
| + |
| + return modifiers; |
| +} |
| + |
| bool HardwareDisplayPlane::InitializeProperties( |
| DrmDevice* drm, |
| const ScopedDrmObjectPropertyPtr& plane_props) { |