Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Govindapillai <vinod.govindapillai@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: vinod.govindapillai@intel.com, santhosh.reddy.guddati@intel.com,
	swati2.sharma@intel.com, jani.nikula@intel.com
Subject: [PATCH i-g-t v3 08/11] tests/intel/kms_fbcon_fbt: refactor the code to get the right fbc status
Date: Thu, 16 Apr 2026 12:25:56 +0300	[thread overview]
Message-ID: <20260416092559.88735-9-vinod.govindapillai@intel.com> (raw)
In-Reply-To: <20260416092559.88735-1-vinod.govindapillai@intel.com>

As FBC can be enabled in multiple pipes, to check the fbc status of a pipe,
we need to read the FBC status from the corresponding crtc debugfs entry.
As a step towards that, update all the feature virtual function definitions
so that we can access all the relevant parameters needed for reading the
crtc debugfs entry.

Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
---
 tests/intel/kms_fbcon_fbt.c | 102 ++++++++++++++++++------------------
 1 file changed, 52 insertions(+), 50 deletions(-)

diff --git a/tests/intel/kms_fbcon_fbt.c b/tests/intel/kms_fbcon_fbt.c
index 78c6cc4b2..5863c9e68 100644
--- a/tests/intel/kms_fbcon_fbt.c
+++ b/tests/intel/kms_fbcon_fbt.c
@@ -80,12 +80,12 @@ static void wait_user(const char *msg)
 	igt_debug_wait_for_keypress("fbt");
 }
 
-static bool fbc_supported_on_chipset(int device, int debugfs_fd)
+static bool fbc_supported_on_chipset(struct drm_info *drm)
 {
 	char buf[FBC_STATUS_BUF_LEN];
 	int ret;
 
-	ret = igt_debugfs_simple_read(debugfs_fd, "i915_fbc_status",
+	ret = igt_debugfs_simple_read(drm->debugfs_fd, "i915_fbc_status",
 				      buf, sizeof(buf));
 	if (ret < 0)
 		return false;
@@ -99,20 +99,20 @@ static bool connector_can_fbc(drmModeConnectorPtr connector)
 	return true;
 }
 
-static void fbc_print_status(int debugfs_fd)
+static void fbc_print_status(struct drm_info *drm)
 {
 	static char buf[FBC_STATUS_BUF_LEN];
 
-	igt_debugfs_simple_read(debugfs_fd, "i915_fbc_status", buf,
+	igt_debugfs_simple_read(drm->debugfs_fd, "i915_fbc_status", buf,
 				sizeof(buf));
 	igt_debug("FBC status: %s\n", buf);
 }
 
-static bool fbc_check_status(int debugfs_fd, bool enabled)
+static bool fbc_check_status(struct drm_info *drm, bool enabled)
 {
 	char buf[FBC_STATUS_BUF_LEN];
 
-	igt_debugfs_simple_read(debugfs_fd, "i915_fbc_status", buf,
+	igt_debugfs_simple_read(drm->debugfs_fd, "i915_fbc_status", buf,
 				sizeof(buf));
 	if (enabled)
 		return strstr(buf, "FBC enabled\n");
@@ -120,25 +120,27 @@ static bool fbc_check_status(int debugfs_fd, bool enabled)
 		return strstr(buf, "FBC disabled");
 }
 
-static bool fbc_wait_until_enabled(int debugfs_fd)
+static bool fbc_wait_until_enabled(struct drm_info *drm)
 {
-	bool r = igt_wait(fbc_check_status(debugfs_fd, true), 5000, 1);
-	fbc_print_status(debugfs_fd);
+	bool r = igt_wait(fbc_check_status(drm, true), 5000, 1);
+
+	fbc_print_status(drm);
 	return r;
 }
 
-static bool fbc_is_disabled(int debugfs_fd)
+static bool fbc_is_disabled(struct drm_info *drm)
 {
-	bool r = fbc_check_status(debugfs_fd, false);
+	bool r = fbc_check_status(drm, false);
 
-	fbc_print_status(debugfs_fd);
+	fbc_print_status(drm);
 	return r;
 }
 
-static bool fbc_wait_until_disabled(int debugfs_fd)
+static bool fbc_wait_until_disabled(struct drm_info *drm)
 {
-	bool r = igt_wait(fbc_check_status(debugfs_fd, false), 5000, 1);
-	fbc_print_status(debugfs_fd);
+	bool r = igt_wait(fbc_check_status(drm, false), 5000, 1);
+
+	fbc_print_status(drm);
 	return r;
 }
 
@@ -181,7 +183,7 @@ static bool fbc_wait_until_update(struct drm_info *drm)
 	 * relies on a tiled and fenceable framebuffer to track modifications.
 	 */
 	if (intel_gen(intel_get_drm_devid(drm->fd)) >= 9) {
-		if (!fbc_wait_until_enabled(drm->debugfs_fd))
+		if (!fbc_wait_until_enabled(drm))
 			return false;
 		/*
 		 * Skip cursor blinking check when running in simulation mode.
@@ -193,7 +195,7 @@ static bool fbc_wait_until_update(struct drm_info *drm)
 
 		return fbc_check_cursor_blinking(drm);
 	} else {
-		return fbc_wait_until_disabled(drm->debugfs_fd);
+		return fbc_wait_until_disabled(drm);
 	}
 }
 
@@ -242,34 +244,34 @@ static bool connector_can_psr(drmModeConnectorPtr connector)
 	return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
 }
 
-static void psr_print_status(int debugfs_fd)
+static void psr_print_status(struct drm_info *drm)
 {
 	static char buf[PSR_STATUS_MAX_LEN];
 
-	igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status", buf,
+	igt_debugfs_simple_read(drm->debugfs_fd, "i915_edp_psr_status", buf,
 				sizeof(buf));
 	igt_debug("PSR status: %s\n", buf);
 }
 
-static bool psr_wait_until_enabled(int debugfs_fd)
+static bool psr_wait_until_enabled(struct drm_info *drm)
 {
-	bool r = psr_wait_entry(debugfs_fd, PSR_MODE_1, NULL);
+	bool r = psr_wait_entry(drm->debugfs_fd, PSR_MODE_1, NULL);
 
-	psr_print_status(debugfs_fd);
+	psr_print_status(drm);
 	return r;
 }
 
-static bool psr_is_disabled(int debugfs_fd)
+static bool psr_is_disabled(struct drm_info *drm)
 {
-	bool r = psr_disabled_check(debugfs_fd);
+	bool r = psr_disabled_check(drm->debugfs_fd);
 
-	psr_print_status(debugfs_fd);
+	psr_print_status(drm);
 	return r;
 }
 
-static bool psr_supported_on_chipset(int device, int debugfs_fd)
+static bool psr_supported_on_chipset(struct drm_info *drm)
 {
-	return psr_sink_support(device, debugfs_fd, PSR_MODE_1, NULL);
+	return psr_sink_support(drm->fd, drm->debugfs_fd, PSR_MODE_1, NULL);
 }
 
 static bool psr_wait_until_update(struct drm_info *drm)
@@ -277,24 +279,24 @@ static bool psr_wait_until_update(struct drm_info *drm)
 	return psr_long_wait_update(drm->debugfs_fd, PSR_MODE_1, NULL);
 }
 
-static void disable_features(int device, int debugfs_fd)
+static void disable_features(struct drm_info *drm)
 {
-	igt_set_module_param_int(device, "enable_fbc", 0);
-	if (psr_sink_support(device, debugfs_fd, PSR_MODE_1, NULL))
-		psr_disable(device, debugfs_fd, NULL);
+	igt_set_module_param_int(drm->fd, "enable_fbc", 0);
+	if (psr_sink_support(drm->fd, drm->debugfs_fd, PSR_MODE_1, NULL))
+		psr_disable(drm->fd, drm->debugfs_fd, NULL);
 }
 
-static inline void fbc_modparam_enable(int device, int debugfs_fd)
+static inline void fbc_modparam_enable(struct drm_info *drm)
 {
-	igt_set_module_param_int(device, "enable_fbc", 1);
+	igt_set_module_param_int(drm->fd, "enable_fbc", 1);
 }
 
-static inline void psr_debugfs_enable(int device, int debugfs_fd)
+static inline void psr_debugfs_enable(struct drm_info *drm)
 {
-	psr_enable(device, debugfs_fd, PSR_MODE_1, NULL);
+	psr_enable(drm->fd, drm->debugfs_fd, PSR_MODE_1, NULL);
 }
 
-static void fbc_skips_on_fbcon(int debugfs_fd)
+static void fbc_skips_on_fbcon(struct drm_info *drm)
 {
 	const char *reasons[] = {
 		"pixel format not supported",
@@ -312,7 +314,7 @@ static void fbc_skips_on_fbcon(int debugfs_fd)
 	char buf[FBC_STATUS_BUF_LEN];
 	int i;
 
-	igt_debugfs_simple_read(debugfs_fd, "i915_fbc_status", buf, sizeof(buf));
+	igt_debugfs_simple_read(drm->debugfs_fd, "i915_fbc_status", buf, sizeof(buf));
 	if (strstr(buf, "FBC enabled\n"))
 		return;
 
@@ -322,7 +324,7 @@ static void fbc_skips_on_fbcon(int debugfs_fd)
 	igt_skip_on_f(skip, "fbcon modeset is not compatible with FBC\n");
 }
 
-static void psr_skips_on_fbcon(int debugfs_fd)
+static void psr_skips_on_fbcon(struct drm_info *drm)
 {
 	/*
 	 * Unless fbcon enables interlaced mode all other PSR restrictions
@@ -334,14 +336,14 @@ static void psr_skips_on_fbcon(int debugfs_fd)
 }
 
 struct feature {
-	bool (*supported_on_chipset)(int device, int debugfs_fd);
-	bool (*wait_until_enabled)(int debugfs_fd);
-	bool (*is_disabled)(int debugfs_fd);
+	bool (*supported_on_chipset)(struct drm_info *drm);
+	bool (*wait_until_enabled)(struct drm_info *drm);
+	bool (*is_disabled)(struct drm_info *drm);
 	bool (*wait_until_update)(struct drm_info *drm);
 	bool (*connector_possible_fn)(drmModeConnectorPtr connector);
-	void (*enable)(int device, int debugfs_fd);
+	void (*enable)(struct drm_info *drm);
 	/* skip test if feature can't be enabled due fbcon modeset */
-	void (*skips_on_fbcon)(int debugfs_fd);
+	void (*skips_on_fbcon)(struct drm_info *drm);
 } fbc = {
 	.supported_on_chipset = fbc_supported_on_chipset,
 	.wait_until_enabled = fbc_wait_until_enabled,
@@ -372,24 +374,24 @@ static void subtest(struct drm_info *drm, struct feature *feature, bool suspend)
 {
 	kmstest_set_vt_graphics_mode();
 
-	igt_require(feature->supported_on_chipset(drm->fd, drm->debugfs_fd));
+	igt_require(feature->supported_on_chipset(drm));
 
-	disable_features(drm->fd, drm->debugfs_fd);
-	feature->enable(drm->fd, drm->debugfs_fd);
+	disable_features(drm);
+	feature->enable(drm);
 
 	kmstest_unset_all_crtcs(drm->fd, drm->res);
 	wait_user("Modes unset.");
-	igt_assert(feature->is_disabled(drm->debugfs_fd));
+	igt_assert(feature->is_disabled(drm));
 
 	set_mode_for_one_screen(drm, feature->connector_possible_fn);
 	wait_user("Screen set.");
-	igt_assert(feature->wait_until_enabled(drm->debugfs_fd));
+	igt_assert(feature->wait_until_enabled(drm));
 
 	if (suspend) {
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		sleep(5);
-		igt_assert(feature->wait_until_enabled(drm->debugfs_fd));
+		igt_assert(feature->wait_until_enabled(drm));
 	}
 
 	restore_fbcon(drm);
@@ -398,7 +400,7 @@ static void subtest(struct drm_info *drm, struct feature *feature, bool suspend)
 	sleep(3);
 
 	wait_user("Back to fbcon.");
-	feature->skips_on_fbcon(drm->debugfs_fd);
+	feature->skips_on_fbcon(drm);
 	igt_assert(feature->wait_until_update(drm));
 
 	if (suspend) {
-- 
2.43.0


  parent reply	other threads:[~2026-04-16  9:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  9:25 [PATCH i-g-t v3 00/11] updates to fbc tests Vinod Govindapillai
2026-04-16  9:25 ` [PATCH i-g-t v3 01/11] lib/i915/fbc: extract intel_fbc_get_fbc_status() Vinod Govindapillai
2026-04-30  2:56   ` Reddy Guddati, Santhosh
2026-04-16  9:25 ` [PATCH i-g-t v3 02/11] tests/intel/kms_frontbuffer_tracking: use intel_fbc_get_fbc_status() Vinod Govindapillai
2026-04-30  3:18   ` Reddy Guddati, Santhosh
2026-04-16  9:25 ` [PATCH i-g-t v3 03/11] tests/intel/kms_frontbuffer_tracking: update the outdated fbc status reasons Vinod Govindapillai
2026-04-30  3:37   ` Reddy Guddati, Santhosh
2026-04-30  7:05     ` Govindapillai, Vinod
2026-04-30  8:30       ` Jani Nikula
2026-04-16  9:25 ` [PATCH i-g-t v3 04/11] tests/intel/kms_frontbuffer_tracking: consolidate fbc tests skip checks Vinod Govindapillai
2026-04-30  4:35   ` Reddy Guddati, Santhosh
2026-04-30  7:12     ` Govindapillai, Vinod
2026-04-16  9:25 ` [PATCH i-g-t v3 05/11] tests/intel/kms_frontbuffer_tracking: use a bigger buffer for fbc status Vinod Govindapillai
2026-04-30  3:45   ` Reddy Guddati, Santhosh
2026-04-16  9:25 ` [PATCH i-g-t v3 06/11] tests/intel/kms_fbcon_fbt: " Vinod Govindapillai
2026-04-30  3:46   ` Reddy Guddati, Santhosh
2026-04-16  9:25 ` [PATCH i-g-t v3 07/11] tests/intel/kms_fbcon_fbt: update the outdated fbc skip reasons Vinod Govindapillai
2026-04-30  3:56   ` Reddy Guddati, Santhosh
2026-04-30  7:11     ` Govindapillai, Vinod
2026-04-16  9:25 ` Vinod Govindapillai [this message]
2026-04-16  9:25 ` [PATCH i-g-t v3 09/11] tests/intel/kms_fbcon_fbt: find and store the crtc index Vinod Govindapillai
2026-04-16  9:25 ` [PATCH i-g-t v3 10/11] tests/intel/kms_fbcon_fbt: find the correct fbc status of a pipe Vinod Govindapillai
2026-04-16  9:25 ` [PATCH i-g-t v3 11/11] tests/intel/kms_fbcon_fbt: use common routine to skip tests on fbc status Vinod Govindapillai
2026-04-30  4:06   ` Reddy Guddati, Santhosh
2026-04-16 16:24 ` ✓ i915.CI.BAT: success for updates to fbc tests (rev3) Patchwork
2026-04-16 16:24 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-16 18:08 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-17  4:43 ` ✗ i915.CI.Full: " 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=20260416092559.88735-9-vinod.govindapillai@intel.com \
    --to=vinod.govindapillai@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=santhosh.reddy.guddati@intel.com \
    --cc=swati2.sharma@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