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

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..f38436158a6b765f15c6bdbe478a998a93187ae9 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_info_size = drm_plane->count_format_info;
plane_ids.insert(drm_plane->plane_id);
std::unique_ptr<HardwareDisplayPlane> plane(
CreatePlane(drm_plane->plane_id, drm_plane->possible_crtcs));
@@ -107,7 +108,12 @@ 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_info> supported_format_info(format_info_size);
+ for (uint32_t j = 0; j < format_info_size; j++)
+ supported_format_info[j] = drm_plane->format_info[j];
+
+ if (plane->Initialize(drm, supported_formats,
+ supported_format_info, 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 +131,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_info>(),
+ true, false)) {
planes_.push_back(std::move(dummy_plane));
}
}
@@ -308,4 +315,18 @@ bool HardwareDisplayPlaneManager::IsFormatSupported(uint32_t fourcc_format,
return format_supported;
}
+uint32_t HardwareDisplayPlaneManager::GetFormatModifiers(uint32_t crtc_id, uint32_t format,
+ uint64_t *modifiers, uint32_t count) {
+ int crtc_index = LookupCrtcIndex(crtc_id);
+
+ for (const auto& plane : planes_) {
+ if (plane->CanUseForCrtc(crtc_index) &&
+ plane->type() == HardwareDisplayPlane::kPrimary) {
+ return plane->ModifiersForFormat(format, modifiers, count);
+ }
+ }
+
+ return 0;
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698