Skip to contentSkip to conversation

Refine FBC test conditions

PATCH Superseded Mohammed Thasleem 2 participants 10 messages Jun 27, 2025

Subsystems (2)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover Refine FBC test conditions

Refine FBC test conditions.

Mohammed Thasleem (7):
lib/intel_wa: Add check for workaround in GTs lib/i915/intel_fbc: Add fbc supported check based on wa tests/intel/kms_frontbuffer_tracking: Enable the tests support
variations based on the WAs
tests/intel/kms_dirtyfb: Enable the tests support variations based on
the WAs
tests/intel/kms_fbcon_fbt: Enable the tests support variations based
on the WAs
tests/intel/kms_psr: Enable the tests support variations based on the
WAs
tests/intel/kms_psr2_sf: Enable the tests support variations based on
the WAs

 lib/i915/intel_fbc.c                   | 25 ++++++++++++++
 lib/i915/intel_fbc.h                   |  1 +
 lib/intel_wa.c                         | 48 ++++++++++++++++++++++++++
 lib/intel_wa.h                         | 11 ++++++
 lib/meson.build                        |  1 +
 tests/intel/kms_dirtyfb.c              |  5 +--
 tests/intel/kms_fbcon_fbt.c            |  5 +--
 tests/intel/kms_frontbuffer_tracking.c | 12 +++----
 tests/intel/kms_psr.c                  |  6 ++++
 tests/intel/kms_psr2_sf.c              |  5 +++
 10 files changed, 109 insertions(+), 10 deletions(-)
 create mode 100644 lib/intel_wa.c
 create mode 100644 lib/intel_wa.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v7 1/7 lib/intel_wa: Add check for workaround in GTs

This function check the given workaround on available GTs.

v2: Add discription for return. (Kamil)
Rename function to igt_has_intel_wa. (Kamil)
Move lib changes to lib/igt_debugfs. (Kamil)
Dump the whole wa sysfs file and then search for the wa. (Vinod) Use return true/false directly instead assigning value. (Vinod)
v3: Updated return type discription and debugfs_fd failure check. (Kamil)
Return 0 or 1 instead of true or false. (Kamil)
v4: Add check for xe device before execution. (Vinod)
v5: Move igt_has_intel_wa to lib/intel_wa. (Kamil)
v6: Remove unused header and move xe check to intel_is_fbc_supported. (Kamil)
v7: Update the title and move header from .h to .c file. (Kamil)

---
 lib/intel_wa.c  | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/intel_wa.h  | 11 +++++++++++
 lib/meson.build |  1 +
 3 files changed, 60 insertions(+)
 create mode 100644 lib/intel_wa.c
 create mode 100644 lib/intel_wa.h
lib/intel_wa.c new file +48 -0
new file mode 100644
index 000000000..6abeee308
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "igt_debugfs.h"
+#include "igt_sysfs.h"
+#include "intel_wa.h"
+#include "xe/xe_query.h"
+
+/**
+ * igt_has_intel_wa:
+ * @drm_fd:	A drm file descriptor
+ * @check_wa:	Workaround to be checked
+ *
+ * Returns:	0 if no WA, 1 if WA present, -1 on error
+ */
+int igt_has_intel_wa(int drm_fd, const char *check_wa)
+{
+	int debugfs_fd;
+	unsigned int xe;
+	char name[256];
+	char *debugfs_dump, *has_wa;
+
+	debugfs_fd = igt_debugfs_dir(drm_fd);
+	if (debugfs_fd == -1)
+		return -1;
+
+	xe_for_each_gt(drm_fd, xe) {
+		sprintf(name, "gt%d/workarounds", xe);
+		if (!igt_debugfs_exists(drm_fd, name, O_RDONLY))
+			return -1;
+
+		debugfs_dump = igt_sysfs_get(debugfs_fd, name);
+		if (debugfs_dump != NULL) {
+			has_wa = strstr(debugfs_dump, check_wa);
+			free(debugfs_dump);
+			if (has_wa)
+				return 1;
+		}
+	}
+
+	return 0;
+}
lib/intel_wa.h new file +11 -0
new file mode 100644
index 000000000..765a5948e
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#ifndef __INTEL_WA_H__
+#define __INTEL_WA_H__
+
+int igt_has_intel_wa(int drm_fd, const char *check_wa);
+
+#endif /* __INTEL_WA_H__ */
lib/meson.build +1 -0
index 5e4247aad..ef397fe45 100644
@@ -88,6 +88,7 @@ lib_sources = [
 	'intel_aux_pgtable.c',
 	'intel_reg_map.c',
 	'intel_iosf.c',
+        'intel_wa.c',
 	'igt_kms.c',
 	'igt_fb.c',
 	'igt_core.c',
Signature · 1 line
2.34.1
#2 lore raw

Re: [v7,1/7] lib/intel_wa: Add check for workaround in GTs

Quoted 13 lines · Mohammed Thasleem

This function check the given workaround on available GTs.

v2: Add discription for return. (Kamil)
Rename function to igt_has_intel_wa. (Kamil)
Move lib changes to lib/igt_debugfs. (Kamil)
Dump the whole wa sysfs file and then search for the wa. (Vinod) Use return true/false directly instead assigning value. (Vinod)
v3: Updated return type discription and debugfs_fd failure check. (Kamil)
Return 0 or 1 instead of true or false. (Kamil)
v4: Add check for xe device before execution. (Vinod)
v5: Move igt_has_intel_wa to lib/intel_wa. (Kamil)
v6: Remove unused header and move xe check to intel_is_fbc_supported. (Kamil)
v7: Update the title and move header from .h to .c file. (Kamil)

Looks good, two small nits, see below.

Quoted 42 lines
---
 lib/intel_wa.c  | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/intel_wa.h  | 11 +++++++++++
 lib/meson.build |  1 +
 3 files changed, 60 insertions(+)
 create mode 100644 lib/intel_wa.c
 create mode 100644 lib/intel_wa.h
lib/intel_wa.c new file +26 -0
new file mode 100644
index 000000000..6abeee308
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "igt_debugfs.h"
+#include "igt_sysfs.h"
+#include "intel_wa.h"
+#include "xe/xe_query.h"
+
+/**
+ * igt_has_intel_wa:
+ * @drm_fd:	A drm file descriptor
+ * @check_wa:	Workaround to be checked
+ *
+ * Returns:	0 if no WA, 1 if WA present, -1 on error
+ */
+int igt_has_intel_wa(int drm_fd, const char *check_wa)
+{
+	int debugfs_fd;
+	unsigned int xe;
+	char name[256];

lib/intel_wa.c line 36

Quoted 10 lines
lib/intel_wa.c new file +10 -0
+	char *debugfs_dump, *has_wa;
+
+	debugfs_fd = igt_debugfs_dir(drm_fd);
+	if (debugfs_fd == -1)
+		return -1;
+
+	xe_for_each_gt(drm_fd, xe) {
+		sprintf(name, "gt%d/workarounds", xe);
+		if (!igt_debugfs_exists(drm_fd, name, O_RDONLY))
+			return -1;

You should close debugfs_fd before exit. Or remember ret and break loop.

lib/intel_wa.c line 43

Quoted 7 lines
lib/intel_wa.c new file +7 -0
+
+		debugfs_dump = igt_sysfs_get(debugfs_fd, name);
+		if (debugfs_dump != NULL) {
+			has_wa = strstr(debugfs_dump, check_wa);
+			free(debugfs_dump);
+			if (has_wa)
+				return 1;

Same here.

lib/intel_wa.c line 46

Quoted 3 lines
lib/intel_wa.c new file +3 -0
+		}
+	}
+

Same here, close debugfs_fd.

Quoted 24 lines
lib/intel_wa.c new file +2 -0
+	return 0;
+}
lib/intel_wa.h new file +11 -0
new file mode 100644
index 000000000..765a5948e
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#ifndef __INTEL_WA_H__
+#define __INTEL_WA_H__
+
+int igt_has_intel_wa(int drm_fd, const char *check_wa);
+
+#endif /* __INTEL_WA_H__ */
lib/meson.build +0 -0
index 5e4247aad..ef397fe45 100644

lib/meson.build lib_sources = [ · line 91

Quoted 4 lines
lib/meson.build +1 -0
@@ -88,6 +88,7 @@ lib_sources = [
 	'intel_aux_pgtable.c',
 	'intel_reg_map.c',
 	'intel_iosf.c',
+        'intel_wa.c',

Please do not use spaces, this should be one tab.

Regards,
Kamil

Quoted 3 lines
lib/meson.build +0 -0
 	'igt_kms.c',
 	'igt_fb.c',
 	'igt_core.c',
#3 lore raw

PATCH v4 2/7 lib/i915/intel_fbc: Add fbc supported check based on wa

In reply to Mohammed Thasleem

This will check the fbc supported based on given workarunds.

v2: Add intel_wa header file.
v3: Add xe check. (Kamil)
v4: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

---
 lib/i915/intel_fbc.c | 25 +++++++++++++++++++++++++
 lib/i915/intel_fbc.h |  1 +
 2 files changed, 26 insertions(+)
lib/i915/intel_fbc.c +25 -0
index a8ded0a59..722899432 100644
@@ -9,6 +9,7 @@
 #include "igt_psr.h"
 
 #include "intel_fbc.h"
+#include "intel_wa.h"
 
 #define FBC_STATUS_BUF_LEN 128
 
@@ -200,3 +201,27 @@ bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode)
 
 	return fbc_supported;
 }
+
+/**
+ * intel_is_fbc_disabled_by_wa
+ *
+ * @fd: fd of the device
+ *
+ * This function pass the WA to igt_has_intel_wa to check WA on available GTs
+ *
+ * Returns:
+ * true if wa is not equal to 1, and false if wa is equal to 1
+ */
+bool intel_is_fbc_disabled_by_wa(int fd)
+{
+	int wa;
+	const char *wa_fbc_disabled = "16023588340";
+
+	if (!is_xe_device(fd))
+		return true;
+
+	wa = igt_has_intel_wa(fd, wa_fbc_disabled);
+	igt_assert_f(wa >= 0, "WA path not found on GTs\n");
+
+	return wa != 1;
+}
lib/i915/intel_fbc.h +1 -0
index fcafe6049..fe9edcbc3 100644
@@ -19,5 +19,6 @@ bool intel_fbc_is_enabled(int device, enum pipe pipe, int log_level);
 void intel_fbc_max_plane_size(int fd, uint32_t *width, uint32_t *height);
 bool intel_fbc_plane_size_supported(int device, uint32_t width, uint32_t height);
 bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode);
+bool intel_is_fbc_disabled_by_wa(int fd);
 
 #endif
Signature · 1 line
2.34.1
#4 lore raw

Re: [v4,2/7] lib/i915/intel_fbc: Add fbc supported check based on wa

Quoted 5 lines · Mohammed Thasleem

This will check the fbc supported based on given workarunds.

v2: Add intel_wa header file.
v3: Add xe check. (Kamil)
v4: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

Please see comments below.

Quoted 21 lines
---
 lib/i915/intel_fbc.c | 25 +++++++++++++++++++++++++
 lib/i915/intel_fbc.h |  1 +
 2 files changed, 26 insertions(+)
lib/i915/intel_fbc.c +1 -0
index a8ded0a59..722899432 100644
@@ -9,6 +9,7 @@
 #include "igt_psr.h"
 
 #include "intel_fbc.h"
+#include "intel_wa.h"
 
 #define FBC_STATUS_BUF_LEN 128
 

lib/i915/intel_fbc.c bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode) · line 210

Quoted 10 lines
lib/i915/intel_fbc.c +7 -0
@@ -200,3 +201,27 @@ bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode)
 
 	return fbc_supported;
 }
+
+/**
+ * intel_is_fbc_disabled_by_wa
+ *
+ * @fd: fd of the device
+ *
+ * This function pass the WA to igt_has_intel_wa to check WA on available GTs

imho this should be:

* This function check if WA is present on some GT, which in turn make
* FBC not possible

lib/i915/intel_fbc.c bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode) · line 213

Quoted 3 lines
lib/i915/intel_fbc.c +3 -0
+ *
+ * Returns:
+ * true if wa is not equal to 1, and false if wa is equal to 1

imho this should be reversed, also each return value in its own line, so better:

* true: if WA is applied and FBC id disabled
* false: otherwise

lib/i915/intel_fbc.c bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode) · line 213

Quoted 1 line
lib/i915/intel_fbc.c +1 -0
+ * true if wa is not equal to 1, and false if wa is equal to 1

Also, please do not translate C source code into english.

lib/i915/intel_fbc.c bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode) · line 221

Quoted 8 lines
lib/i915/intel_fbc.c +8 -0
+ */
+bool intel_is_fbc_disabled_by_wa(int fd)
+{
+	int wa;
+	const char *wa_fbc_disabled = "16023588340";
+
+	if (!is_xe_device(fd))
+		return true;

Should be:

		return false;

lib/i915/intel_fbc.c bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode) · line 224

Quoted 3 lines
lib/i915/intel_fbc.c +3 -0
+
+	wa = igt_has_intel_wa(fd, wa_fbc_disabled);
+	igt_assert_f(wa >= 0, "WA path not found on GTs\n");

Do you really need this assert here?

lib/i915/intel_fbc.c bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode) · line 227

Quoted 2 lines
lib/i915/intel_fbc.c +2 -0
+
+	return wa != 1;

Should be:

	return wa == 1;

Update also caller sites into:

igt_skip_on_f(data.feature == FEATURE_FBC && intel_is_fbc_disabled_by_wa(data.drm_fd),

	      "WA has disabled FBC on BMG\n");

Also align to first char after '('.

Regards,
Kamil

Quoted 12 lines
lib/i915/intel_fbc.c +1 -0
+}
lib/i915/intel_fbc.h +1 -0
index fcafe6049..fe9edcbc3 100644
@@ -19,5 +19,6 @@ bool intel_fbc_is_enabled(int device, enum pipe pipe, int log_level);
 void intel_fbc_max_plane_size(int fd, uint32_t *width, uint32_t *height);
 bool intel_fbc_plane_size_supported(int device, uint32_t width, uint32_t height);
 bool intel_fbc_supported_for_psr_mode(int disp_ver, enum psr_mode mode);
+bool intel_is_fbc_disabled_by_wa(int fd);
 
 #endif
#5 lore raw

PATCH v6 3/7 tests/intel/kms_frontbuffer_tracking: Enable the tests support variations based on the WAs

In reply to Mohammed Thasleem

This update stops skipping fbc-* tests support variations based on the WAs.

v2: Use WA_FBC_DISABLED instead CHECK_WA. (Vinod)
Update igt_skip_on_f discription. (Vinod)
v3: Remove platform check and make it for xe specific. (Vinod)
Rename function name with is_fbc_support. (Vinod)
v4: Update function name and add igt_skip check. (Vinod)
v5: Move is_fbc_supported to intel_fbc.c (Kunal)
v6: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

---
 tests/intel/kms_frontbuffer_tracking.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tests/intel/kms_frontbuffer_tracking.c +6 -6
index 0809352cb..32d5590ff 100644
@@ -2610,8 +2610,8 @@ static void prepare_subtest_data(const struct test_mode *t,
 static void prepare_subtest_screens(const struct test_mode *t)
 {
 	/* FBC disabled: Wa_16023588340 */
-	igt_skip_on_f((IS_BATTLEMAGE(drm.devid) && t->feature == FEATURE_FBC),
-		      "FBC isn't supported on BMG\n");
+	igt_skip_on_f(t->feature == FEATURE_FBC && !intel_is_fbc_disabled_by_wa(drm.fd),
+		     "WA has disabled FBC on BMG\n");
 
 	if (t->pipes == PIPE_DUAL)
 		enable_both_screens_and_wait(t);
@@ -2658,8 +2658,8 @@ static void prepare_subtest(const struct test_mode *t,
 static void rte_subtest(const struct test_mode *t)
 {
 	/* FBC disabled: Wa_16023588340 */
-	igt_skip_on_f((IS_BATTLEMAGE(drm.devid) && t->feature == FEATURE_FBC),
-		      "FBC isn't supported on BMG\n");
+	igt_skip_on_f(t->feature == FEATURE_FBC && !intel_is_fbc_disabled_by_wa(drm.fd),
+		     "WA has disabled FBC on BMG\n");
 
 	prepare_subtest_data(t, NULL);
 
@@ -4157,8 +4157,8 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
 			t.tiling = opt.tiling;
 
 			/* FBC disabled: Wa_16023588340 */
-			igt_skip_on_f((IS_BATTLEMAGE(drm.devid) && t.feature == FEATURE_FBC),
-				      "FBC isn't supported on BMG\n");
+			igt_skip_on_f(t.feature == FEATURE_FBC && !intel_is_fbc_disabled_by_wa(drm.fd),
+				     "WA has disabled FBC on BMG\n");
 
 			for_each_pipe(&drm.display, pipe) {
 				if (pipe == default_pipe) {
Signature · 1 line
2.34.1
#6 lore raw

PATCH v2 4/7 tests/intel/kms_dirtyfb: Enable the tests support variations based on the WAs

In reply to Mohammed Thasleem

This update stops skipping fbc-* tests support variations based on the WAs.

v2: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

---
 tests/intel/kms_dirtyfb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tests/intel/kms_dirtyfb.c +3 -2
index a5707c5b1..e190fdec3 100644
@@ -381,8 +381,9 @@ igt_main
 					data.mode = igt_output_get_mode(data.output);
 
 					/* FBC disabled: Wa_16023588340 */
-					igt_skip_on_f((IS_BATTLEMAGE(data.devid) && data.feature == FEATURE_FBC),
-						       "FBC isn't supported on BMG\n");
+					igt_skip_on_f(data.feature == FEATURE_FBC &&
+						      !intel_is_fbc_disabled_by_wa(data.drm_fd),
+						      "WA has disabled FBC on BMG\n");
 
 					/* FBC Disp_ver 8 and below supports only I915_FORMAT_MOD_X_TILED */
 					if (data.feature == FEATURE_FBC &&
Signature · 1 line
2.34.1
#7 lore raw

PATCH v2 5/7 tests/intel/kms_fbcon_fbt: Enable the tests support variations based on the WAs

In reply to Mohammed Thasleem

This update stops skipping fbc-* tests support variations based on the WAs.

v2: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

---
 tests/intel/kms_fbcon_fbt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tests/intel/kms_fbcon_fbt.c +3 -2
index fedacec94..eaf611adf 100644
@@ -40,6 +40,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include "i915/intel_fbc.h"
 
 /**
  * SUBTEST: fbc
@@ -455,7 +456,7 @@ igt_main
 		     "tracking infrastructure with fbc enabled.");
 	igt_subtest("fbc") {
 		/* FBC disabled: Wa_16023588340 */
-		igt_require_f(!IS_BATTLEMAGE(drm.devid), "FBC isn't supported on BMG\n");
+		igt_skip_on_f(!intel_is_fbc_disabled_by_wa(drm.fd), "WA has disabled FBC on BMG\n");
 		subtest(&drm, &fbc, false);
 	}
 
@@ -468,7 +469,7 @@ igt_main
 		     "tracking infrastructure with fbc enabled.");
 	igt_subtest("fbc-suspend") {
 		/* FBC disabled: Wa_16023588340 */
-		igt_require_f(!IS_BATTLEMAGE(drm.devid), "FBC isn't supported on BMG\n");
+		igt_skip_on_f(!intel_is_fbc_disabled_by_wa(drm.fd), "WA has disabled FBC on BMG\n");
 		subtest(&drm, &fbc, true);
 	}
 
Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 6/7 tests/intel/kms_psr: Enable the tests support variations based on the WAs

In reply to Mohammed Thasleem

This update stops skipping fbc-* tests support variations based on the WAs.

v2: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

---
 tests/intel/kms_psr.c | 6 ++++++
 1 file changed, 6 insertions(+)
tests/intel/kms_psr.c +6 -0
index da947feb6..1192320a7 100644
@@ -719,6 +719,12 @@ static void test_setup(data_t *data)
 
 	igt_require_f(data->output,
 		      "No available output found\n");
+
+	/* FBC disabled: Wa_16023588340 */
+	igt_skip_on_f(data->op_fbc_mode == FBC_ENABLED &&
+		      !intel_is_fbc_disabled_by_wa(data->drm_fd),
+		      "WA has disabled FBC on BMG\n");
+
 	if (data->op_fbc_mode == FBC_ENABLED)
 		igt_require_f(data->fbc_flag,
 			      "Can't test FBC with PSR\n");
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 7/7 tests/intel/kms_psr2_sf: Enable the tests support variations based on the WAs

In reply to Mohammed Thasleem

This update stops skipping fbc-* tests support variations based on the WAs.

v2: Updated function name with intel_is_fbc_disabled_by_wa. (Kamil)

---
 tests/intel/kms_psr2_sf.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/intel/kms_psr2_sf.c +5 -0
index 68842b020..50582c42a 100644
@@ -561,6 +561,11 @@ static void prepare(data_t *data)
 	igt_plane_set_position(primary, 0, 0);
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
+	/* FBC disabled: Wa_16023588340 */
+	igt_skip_on_f(data->op_fbc_mode == FBC_ENABLED &&
+		      !intel_is_fbc_disabled_by_wa(data->drm_fd),
+		      "WA has disabled FBC on BMG\n");
+
 	if (data->coexist_feature & FEATURE_DSC)
 		igt_require_f(igt_is_dsc_enabled(data->drm_fd, output->name),
 			      "DSC is not enabled\n");
Signature · 1 line
2.34.1