[PATCH i-g-t v3 3/5] lib: Add support for solid_fill and pixel_source plane properties

Jessica Zhang quic_jesszhan at quicinc.com
Fri Mar 1 20:47:32 UTC 2024


Add corresponding IGT macros for solid_fill and pixel_source DRM
properties, and change IGT commit behavior to allow for NULL FB commits.

Signed-off-by: Jessica Zhang <quic_jesszhan at quicinc.com>
---
 lib/igt_kms.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
 lib/igt_kms.h |  4 ++++
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 1b4d0d7612a2..8e965a3798b6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -669,6 +669,8 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	[IGT_PLANE_HOTSPOT_X] = "HOTSPOT_X",
 	[IGT_PLANE_HOTSPOT_Y] = "HOTSPOT_Y",
 	[IGT_PLANE_FB_ID] = "FB_ID",
+	[IGT_PLANE_SOLID_FILL] = "solid_fill",
+	[IGT_PLANE_PIXEL_SOURCE] = "pixel_source",
 	[IGT_PLANE_CRTC_ID] = "CRTC_ID",
 	[IGT_PLANE_IN_FENCE_FD] = "IN_FENCE_FD",
 	[IGT_PLANE_TYPE] = "type",
@@ -2379,6 +2381,8 @@ static void igt_plane_reset(igt_plane_t *plane)
 	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, 0);
 
 	/* Reset binding to fb and crtc. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_SOLID_FILL, 0);
+	igt_plane_set_prop_enum(plane, IGT_PLANE_PIXEL_SOURCE, "FB");
 	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
 	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
 
@@ -3417,6 +3421,11 @@ static igt_output_t *igt_pipe_get_output(igt_pipe_t *pipe)
 	return NULL;
 }
 
+static uint32_t igt_plane_get_solid_fill_id(igt_plane_t *plane)
+{
+	return plane->values[IGT_PLANE_SOLID_FILL];
+}
+
 static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
 {
 	return plane->values[IGT_PLANE_FB_ID];
@@ -3648,7 +3657,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
 	struct igt_display *display = primary->pipe->display;
 	igt_output_t *output = igt_pipe_get_output(pipe);
 	drmModeModeInfo *mode;
-	uint32_t fb_id, crtc_id;
+	uint32_t fb_id, solid_fill_id, crtc_id;
 	int ret;
 
 	/* Primary planes can't be windowed when using a legacy commit */
@@ -3665,12 +3674,14 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
 
 	crtc_id = pipe->crtc_id;
 	fb_id = output ? igt_plane_get_fb_id(primary) : 0;
-	if (fb_id)
+	solid_fill_id = output ? igt_plane_get_solid_fill_id(primary) : 0;
+
+	if (fb_id || solid_fill_id)
 		mode = igt_output_get_mode(output);
 	else
 		mode = NULL;
 
-	if (fb_id) {
+	if (fb_id || solid_fill_id) {
 		uint32_t src_x = primary->values[IGT_PLANE_SRC_X] >> 16;
 		uint32_t src_y = primary->values[IGT_PLANE_SRC_Y] >> 16;
 
@@ -4935,6 +4946,37 @@ igt_plane_t *igt_output_get_plane_type_index(igt_output_t *output,
 	return igt_pipe_get_plane_type_index(pipe, plane_type, index);
 }
 
+/**
+ * igt_plane_set_solid_fill:
+ * @plane: Plane
+ * @rect: Rect for size and position of @plane
+ * @solid_fill_id: Solid fill property blob ID
+ *
+ * Pairs the solid_fill blob (identified by @solid_fill_id) to a @plane
+ *
+ * The size and position of the solid fill plane will be specified by @rect
+ */
+void igt_plane_set_solid_fill(igt_plane_t *plane, struct drm_mode_rect *rect,
+		int solid_fill_id)
+{
+	igt_pipe_t *pipe = plane->pipe;
+	igt_display_t *display = pipe->display;
+	int width = rect->x2 - rect->x1;
+	int height = rect->y2 - rect->y1;
+
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID,
+			solid_fill_id ? pipe->crtc_id : 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SOLID_FILL, solid_fill_id);
+
+	plane->gem_handle = 0;
+
+	LOG(display, "%s.%d: plane_set_solid_fill(%d)\n", kmstest_pipe_name(pipe->pipe),
+	    plane->index, solid_fill_id);
+
+	igt_plane_set_position(plane, rect->x1, rect->y1);
+	igt_plane_set_size(plane, width, height);
+}
+
 /**
  * igt_plane_set_fb:
  * @plane: Plane
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b3882808b42f..9c05272abe1e 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -330,6 +330,8 @@ enum igt_atomic_plane_properties {
 #define IGT_PLANE_COORD_CHANGED_MASK 0xff
 
        IGT_PLANE_FB_ID,
+       IGT_PLANE_SOLID_FILL,
+       IGT_PLANE_PIXEL_SOURCE,
        IGT_PLANE_CRTC_ID,
        IGT_PLANE_IN_FENCE_FD,
        IGT_PLANE_TYPE,
@@ -537,6 +539,8 @@ igt_output_t *igt_get_single_output_for_pipe(igt_display_t *display, enum pipe p
 
 void igt_pipe_request_out_fence(igt_pipe_t *pipe);
 
+void igt_plane_set_solid_fill(igt_plane_t *plane, struct drm_mode_rect *rect,
+		int solid_fill_id);
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
 void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd);
 void igt_plane_set_pipe(igt_plane_t *plane, igt_pipe_t *pipe);

-- 
2.43.2



More information about the igt-dev mailing list