diff options
author | kalyan.kondapally <kalyan.kondapally@intel.com> | 2016-01-11 22:08:02 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-12 06:08:46 +0000 |
commit | d9d2180c73d77efb0079be4338dde1d69cc13f10 (patch) | |
tree | b36e1215d8b42d33207f641ec3a40a8c6a0ded6f | |
parent | 7c8426e2d6ac9c1180fe0b71797eed727538b698 (diff) | |
download | chromium_src-d9d2180c73d77efb0079be4338dde1d69cc13f10.zip chromium_src-d9d2180c73d77efb0079be4338dde1d69cc13f10.tar.gz chromium_src-d9d2180c73d77efb0079be4338dde1d69cc13f10.tar.bz2 |
Ozone: Ability to query supported formats for Scanout.
This patch adds support to query formats supported for scanout
from PlaneManager. This can be used to advertise support for
the right scanout formats in case of GpuMemoryBuffer.
Review URL: https://codereview.chromium.org/1572883003
Cr-Commit-Position: refs/heads/master@{#368808}
4 files changed, 33 insertions, 0 deletions
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane.cc index 7b10d23..bf0f1bb 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane.cc @@ -107,6 +107,10 @@ bool HardwareDisplayPlane::IsSupportedFormat(uint32_t format) { return false; } +const std::vector<uint32_t>& HardwareDisplayPlane::supported_formats() const { + return supported_formats_; +} + bool HardwareDisplayPlane::InitializeProperties( DrmDevice* drm, const ScopedDrmObjectPropertyPtr& plane_props) { diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane.h b/ui/ozone/platform/drm/gpu/hardware_display_plane.h index 93a57e9..798d2f3 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane.h +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane.h @@ -49,6 +49,8 @@ class OZONE_EXPORT HardwareDisplayPlane { void set_owning_crtc(uint32_t crtc) { owning_crtc_ = crtc; } uint32_t owning_crtc() const { return owning_crtc_; } + const std::vector<uint32_t>& supported_formats() const; + protected: virtual bool InitializeProperties( DrmDevice* drm, diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc index 5864402..c4cc7e0 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc @@ -135,6 +135,8 @@ bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) { const scoped_ptr<HardwareDisplayPlane>& r) { return l->plane_id() < r->plane_id(); }); + + PopulateSupportedFormats(); return true; } @@ -182,6 +184,18 @@ bool HardwareDisplayPlaneManager::IsCompatible(HardwareDisplayPlane* plane, return true; } +void HardwareDisplayPlaneManager::PopulateSupportedFormats() { + std::set<uint32_t> supported_formats; + + for (const auto& plane : planes_) { + const std::vector<uint32_t>& formats = plane->supported_formats(); + supported_formats.insert(formats.begin(), formats.end()); + } + + supported_formats_.reserve(supported_formats.size()); + supported_formats_.assign(supported_formats.begin(), supported_formats.end()); +} + void HardwareDisplayPlaneManager::ResetCurrentPlaneList( HardwareDisplayPlaneList* plane_list) const { for (auto* hardware_plane : plane_list->plane_list) { @@ -280,6 +294,11 @@ bool HardwareDisplayPlaneManager::AssignOverlayPlanes( return true; } +const std::vector<uint32_t>& HardwareDisplayPlaneManager::GetSupportedFormats() + const { + return supported_formats_; +} + bool HardwareDisplayPlaneManager::IsFormatSupported(uint32_t fourcc_format, uint32_t z_order, uint32_t crtc_id) const { diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h index a020839..e9b04ec 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h @@ -96,6 +96,10 @@ class OZONE_EXPORT HardwareDisplayPlaneManager { return planes_; } + // Returns all formats which can be scanned out by this PlaneManager. Use + // IsFormatSupported to find if a given format is supported on a particular + // plane for a given crtc. + const std::vector<uint32_t>& GetSupportedFormats() const; bool IsFormatSupported(uint32_t fourcc_format, uint32_t z_order, uint32_t crtc_id) const; @@ -128,12 +132,16 @@ class OZONE_EXPORT HardwareDisplayPlaneManager { void ResetCurrentPlaneList(HardwareDisplayPlaneList* plane_list) const; + // Populates scanout formats supported by all planes. + void PopulateSupportedFormats(); + // Object containing the connection to the graphics device and wraps the API // calls to control it. Not owned. DrmDevice* drm_; std::vector<scoped_ptr<HardwareDisplayPlane>> planes_; std::vector<uint32_t> crtcs_; + std::vector<uint32_t> supported_formats_; DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManager); }; |