[PATCH i-g-t 4/5] lib/kms: Get right pipe for a drm plane from crtc array

Mohammed Khajapasha mohammed.khajapasha at intel.com
Sat Jun 13 19:25:42 UTC 2020


Get right pipe for a drm plane from crtc array.
The drm plane possible crtc bit mask is based on crtc index
in drm mode config.

Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha at intel.com>
---
 lib/igt_kms.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 2b1cf878..999e35ce 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1971,7 +1971,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)
 	for_each_pipe(display, i) {
 		igt_pipe_t *pipe = &display->pipes[i];
 		igt_plane_t *plane;
-		int p = 1;
+		int p = 1, k = 0;
 		int j, type;
 		uint8_t last_plane = 0, n_planes = 0;
 
@@ -1982,12 +1982,18 @@ void igt_display_require(igt_display_t *display, int drm_fd)
 
 		igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
 
+		/* Get valid crtc index from crtcs */
+		for(k = 0; k < resources->count_crtcs; k++) {
+			if(pipe->crtc_id == resources->crtcs[k])
+				break;
+		}
+
 		/* count number of valid planes */
 		for (j = 0; j < display->n_planes; j++) {
 			drmModePlane *drm_plane = display->planes[j].drm_plane;
 			igt_assert(drm_plane);
 
-			if (drm_plane->possible_crtcs & (1 << i))
+			if (drm_plane->possible_crtcs & (1 << k))
 				n_planes++;
 		}
 
@@ -2001,7 +2007,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)
 			igt_plane_t *global_plane = &display->planes[j];
 			drmModePlane *drm_plane = global_plane->drm_plane;
 
-			if (!(drm_plane->possible_crtcs & (1 << i)))
+			if (!(drm_plane->possible_crtcs & (1 << k)))
 				continue;
 
 			type = global_plane->type;
-- 
2.24.1



More information about the Intel-gfx-trybot mailing list