Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John Harrison <John.Harrison@Igalia.com>
To: igt-dev@lists.freedesktop.org
Cc: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>,
	Suraj Kandpal <suraj.kandpal@intel.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t v3 3/4] tools/intel_hdcp: Show actual HDCP status
Date: Mon, 13 Apr 2026 16:36:28 -0700	[thread overview]
Message-ID: <20260413233629.771034-4-John.Harrison@Igalia.com> (raw)
In-Reply-To: <20260413233629.771034-1-John.Harrison@Igalia.com>

The 'video player' showed what the requested HDCP mode was but not the
actual status. The menu system does redraw the screen with a special
colour to denote the status, but that is immediately overwritten by
the player thread. So all you get is a very brief full screen flicker
(to be fixed in next patch).

Instead, add the current HDCP status as an extra text line of the
video player's output so it is permanently visible and clear.

Also, move the enable of HDCP inside the mutex lock with the
internal state change. That way, the newly added 'enabled/desired'
line does not update in advance of the 'requested' line (due to the
video player thread being asynchronous and managing to turn HDCP on
while the menu thread is waiting on the mutex lock).

v2: Split into two patches (review feedback by Kamil)
v3: Fix text positions by using helper function

CC: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
CC: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: John Harrison <John.Harrison@Igalia.com>
Acked-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tools/intel_hdcp.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/intel_hdcp.c b/tools/intel_hdcp.c
index 4dfeda594..c12de06df 100644
--- a/tools/intel_hdcp.c
+++ b/tools/intel_hdcp.c
@@ -485,7 +485,8 @@ static void *video_player_thread(void *arg)
 	struct igt_fb fb;
 	cairo_t *cr;
 	igt_plane_t *primary;
-	const char *hdcp_str;
+	const char *hdcp_request;
+	const char *hdcp_status;
 	double bg_r = 0.0, bg_g = 0.0, bg_b = 0.0;
 	enum hdcp_type cur_type, prev_type;
 	data_t *data;
@@ -512,22 +513,24 @@ static void *video_player_thread(void *arg)
 			prev_type = cur_type;
 		}
 
+		hdcp_status = get_hdcp_status(data, data->selected_connector);
+
 		switch (cur_type) {
 		case HDCP_TYPE_1_4:
 			bg_r = 0.0; bg_g = 0.7; bg_b = 0.0;
-			hdcp_str = "HDCP1.4";
+			hdcp_request = "HDCP1.4";
 			break;
 		case HDCP_TYPE_2_2_TYPE_0:
 			bg_r = 0.0; bg_g = 0.45; bg_b = 0.45;
-			hdcp_str = "HDCP2.2 TYPE 0";
+			hdcp_request = "HDCP2.2 TYPE 0";
 			break;
 		case HDCP_TYPE_2_2_TYPE_1:
 			bg_r = 0.45; bg_g = 0.15; bg_b = 0.6;
-			hdcp_str = "HDCP2.2 TYPE 1";
+			hdcp_request = "HDCP2.2 TYPE 1";
 			break;
 		default:
 			bg_r = 0.0; bg_g = 0.0; bg_b = 0.0;
-			hdcp_str = "NO HDCP";
+			hdcp_request = "NO HDCP";
 			break;
 		}
 
@@ -555,7 +558,10 @@ static void *video_player_thread(void *arg)
 		y = draw_text_right(cr, font_size / 2.0, x, y, timer_str );
 
 		/* Draw HDCP status above timer */
-		y = draw_text_right(cr, font_size, x, y, hdcp_str );
+		y = draw_text_right(cr, font_size, x, y, hdcp_status );
+
+		/* Draw HDCP request above status */
+		y = draw_text_right(cr, font_size, x, y, hdcp_request );
 
 		cairo_destroy(cr);
 
@@ -598,8 +604,8 @@ static void stop_video_player(data_t *data)
 
 static void enable_hdcp_type(data_t *data, enum hdcp_type type)
 {
-		set_hdcp_prop(data, CP_DESIRED, type, data->selected_connector);
 		pthread_mutex_lock(&data->lock);
+		set_hdcp_prop(data, CP_DESIRED, type, data->selected_connector);
 		data->hdcp_type = type;
 		data->video_start_time = time(NULL);
 		pthread_mutex_unlock(&data->lock);
-- 
2.43.0


  parent reply	other threads:[~2026-04-13 23:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 23:36 [PATCH i-g-t v3 0/4] tool/intel_hdcp: Fix flickering and show actual HDCP status John Harrison
2026-04-13 23:36 ` [PATCH i-g-t v3 1/4] tools/intel_hdcp: Fix status rendering John Harrison
2026-04-14 15:55   ` Kamil Konieczny
2026-04-13 23:36 ` [PATCH i-g-t v3 2/4] tools/intel_hdcp: Move text rendering into helper function John Harrison
2026-04-14 16:03   ` Kamil Konieczny
2026-04-13 23:36 ` John Harrison [this message]
2026-04-14  2:55   ` [PATCH i-g-t v3 3/4] tools/intel_hdcp: Show actual HDCP status Kandpal, Suraj
2026-04-14 16:04   ` Kamil Konieczny
2026-04-13 23:36 ` [PATCH i-g-t v3 4/4] tools/intel_hdcp: Fix flickering when changing HDCP state John Harrison
2026-04-14  2:56   ` Kandpal, Suraj
2026-04-14  2:55 ` ✓ Xe.CI.BAT: success for tool/intel_hdcp: Fix flickering and show actual HDCP status (rev3) Patchwork
2026-04-14  3:01 ` ✓ i915.CI.BAT: " Patchwork
2026-04-14  6:50 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-14  9:35 ` ✓ i915.CI.Full: " Patchwork
2026-04-14 16:48 ` [PATCH i-g-t v3 0/4] tool/intel_hdcp: Fix flickering and show actual HDCP status Kamil Konieczny
2026-04-14 17:06   ` John Harrison

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=20260413233629.771034-4-John.Harrison@Igalia.com \
    --to=john.harrison@igalia.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=santhosh.reddy.guddati@intel.com \
    --cc=suraj.kandpal@intel.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