From 38c67d13993fd5454226934a22be558d2a6a8233 Mon Sep 17 00:00:00 2001
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
Date: Mon, 23 May 2022 11:46:38 +0800
|
Subject: [PATCH 1/3] kms: Use Nth primary plane for Nth CRTC
|
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
---
|
src/ws/atomic_kms_window_system.cpp | 10 ++++++++--
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
diff --git a/src/ws/atomic_kms_window_system.cpp b/src/ws/atomic_kms_window_system.cpp
|
index 1aa7948..b5c2ab5 100644
|
--- a/src/ws/atomic_kms_window_system.cpp
|
+++ b/src/ws/atomic_kms_window_system.cpp
|
@@ -98,6 +98,7 @@ ManagedResource<drmModePlanePtr> get_plane_for_crtc(
|
if (!plane_resources)
|
throw ErrnoError{"Failed to get plane resources"};
|
|
+ auto num_primaries = 0;
|
for (auto i = 0u; i < plane_resources->count_planes; ++i)
|
{
|
auto plane = ManagedResource<drmModePlanePtr>{
|
@@ -107,12 +108,17 @@ ManagedResource<drmModePlanePtr> get_plane_for_crtc(
|
if (!plane)
|
throw ErrnoError{"Failed to get plane"};
|
|
+ if (!is_plane_primary(drm_fd, plane))
|
+ continue;
|
+
|
+ /* Nth primary plane for Nth CRTC */
|
+ if (num_primaries ++ != crtc_index)
|
+ continue;
|
+
|
if (does_plane_support_crtc_index(plane, crtc_index))
|
{
|
ret_plane = std::move(plane);
|
|
- if (is_plane_primary(drm_fd, ret_plane))
|
- break;
|
}
|
}
|
|
--
|
2.20.1
|