Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: <igt-dev@lists.freedesktop.org>, Petri Latvala <adrinael@adrinael.net>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>,
	Simon Ser <contact@emersion.fr>, Rob Clark <robdclark@gmail.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: [PATCH i-g-t v2 4/6] lib: Add support for solid_fill and pixel_source plane properties
Date: Tue, 23 Jan 2024 15:28:57 -0800	[thread overview]
Message-ID: <20240123-solid-fill-v2-4-4ecd2cf767fe@quicinc.com> (raw)
In-Reply-To: <20240123-solid-fill-v2-0-4ecd2cf767fe@quicinc.com>

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@quicinc.com>
---
 lib/igt_kms.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
 lib/igt_kms.h |  4 ++++
 2 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 1b4d0d7612a2..238b0a834adf 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",
@@ -3417,6 +3419,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 +3655,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 +3672,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 +4944,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.0


  parent reply	other threads:[~2024-01-23 23:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 23:28 [PATCH i-g-t v2 0/6] Add tests for solid fill planes Jessica Zhang
2024-01-23 23:28 ` [PATCH i-g-t v2 1/6] tests/kms_atomic: Free pipe_crc object Jessica Zhang
2024-01-23 23:28 ` [PATCH i-g-t v2 2/6] drm-uapi: Sync with drm-next Jessica Zhang
2024-01-23 23:28 ` [PATCH i-g-t v2 3/6] drm-uapi: Add drm_mode_solid_fill Jessica Zhang
2024-01-24  8:47   ` Pekka Paalanen
2024-01-23 23:28 ` Jessica Zhang [this message]
2024-01-24  9:03   ` [PATCH i-g-t v2 4/6] lib: Add support for solid_fill and pixel_source plane properties Modem, Bhanuprakash
2024-01-25  1:29     ` Jessica Zhang
2024-01-23 23:28 ` [PATCH i-g-t v2 5/6] tests/kms_atomic: Add solid fill plane subtest Jessica Zhang
2024-01-24  9:13   ` Pekka Paalanen
2024-02-02 18:14     ` Jessica Zhang
2024-02-05 10:35       ` Pekka Paalanen
2024-02-28 18:28         ` Jessica Zhang
2024-02-29 13:14           ` Pekka Paalanen
2024-01-23 23:28 ` [PATCH i-g-t v2 6/6] tests/kms_atomic: Add subtest for solid fill cursor planes Jessica Zhang
2024-01-23 23:56 ` ✓ CI.xeBAT: success for Add tests for solid fill planes (rev2) Patchwork
2024-01-23 23:58 ` ✓ Fi.CI.BAT: " Patchwork
2024-01-24  8:41 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240123-solid-fill-v2-4-4ecd2cf767fe@quicinc.com \
    --to=quic_jesszhan@quicinc.com \
    --cc=adrinael@adrinael.net \
    --cc=contact@emersion.fr \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=pekka.paalanen@collabora.com \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox