Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Unified Diff: ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc

Issue 2576263002: ozone: Allocate scanout buffer according to KMS modifiers (Closed)
Patch Set: ozone: Allocate scanout buffer according to KMS modifiers Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc
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 61c7c47afc9e74e58829a4585cfcf5e609839928..c53b7c7d86aa4b37137a88d3c095edfe52245c5c 100644
--- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc
+++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc
@@ -92,13 +92,14 @@ bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) {
std::set<uint32_t> plane_ids;
for (uint32_t i = 0; i < num_planes; ++i) {
ScopedDrmPlanePtr drm_plane(
- drmModeGetPlane(drm->get_fd(), plane_resources->planes[i]));
+ drmModeGetPlane2(drm->get_fd(), plane_resources->planes[i]));
if (!drm_plane) {
PLOG(ERROR) << "Failed to get plane " << i;
return false;
}
uint32_t formats_size = drm_plane->count_formats;
+ uint32_t format_modifiers_size = drm_plane->count_format_modifiers;
plane_ids.insert(drm_plane->plane_id);
std::unique_ptr<HardwareDisplayPlane> plane(
CreatePlane(drm_plane->plane_id, drm_plane->possible_crtcs));
@@ -107,7 +108,13 @@ bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) {
for (uint32_t j = 0; j < formats_size; j++)
supported_formats[j] = drm_plane->formats[j];
- if (plane->Initialize(drm, supported_formats, false, false)) {
+ std::vector<struct drm_format_modifier> supported_format_modifiers(
+ format_modifiers_size);
+ for (uint32_t j = 0; j < format_modifiers_size; j++)
Daniele Castagna 2016/12/20 18:03:29 nit: s/uint32_t/size_t
hoegsberg1 2016/12/22 23:05:21 I picked uint32_t deliberately to match format_mod
+ supported_format_modifiers[j] = drm_plane->format_modifiers[j];
+
+ if (plane->Initialize(drm, supported_formats, supported_format_modifiers,
+ false, false)) {
// CRTC controllers always assume they have a cursor plane and the cursor
// plane is updated via cursor specific DRM API. Hence, we dont keep
// track of Cursor plane here to avoid re-using it for any other purpose.
@@ -125,8 +132,9 @@ bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) {
if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) {
std::unique_ptr<HardwareDisplayPlane> dummy_plane(
CreatePlane(resources->crtcs[i] - 1, (1 << i)));
- if (dummy_plane->Initialize(drm, std::vector<uint32_t>(), true,
- false)) {
+ if (dummy_plane->Initialize(drm, std::vector<uint32_t>(),
+ std::vector<struct drm_format_modifier>(),
+ true, false)) {
planes_.push_back(std::move(dummy_plane));
}
}
@@ -308,4 +316,19 @@ bool HardwareDisplayPlaneManager::IsFormatSupported(uint32_t fourcc_format,
return format_supported;
}
+std::vector<uint64_t> HardwareDisplayPlaneManager::GetFormatModifiers(
+ uint32_t crtc_id,
+ uint32_t format) {
+ int crtc_index = LookupCrtcIndex(crtc_id);
+
+ for (const auto& plane : planes_) {
+ if (plane->CanUseForCrtc(crtc_index) &&
+ plane->type() == HardwareDisplayPlane::kPrimary) {
+ return plane->ModifiersForFormat(format);
+ }
+ }
+
+ return std::vector<uint64_t>();
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698