From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 3/3] tests: add igt_is_dsc_supported_by_source()
Date: Tue, 30 May 2023 20:13:58 +0530 [thread overview]
Message-ID: <20230530144358.355304-4-swati2.sharma@intel.com> (raw)
In-Reply-To: <20230530144358.355304-1-swati2.sharma@intel.com>
Instead of assuming dsc is supported on gen11+ platforms,
lets use has_dsc flag in i915_capability to check hardware
support.
v2: -moved changes to lib (Ankit)
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
lib/igt_dsc.c | 23 +++++++++++++++++++++++
lib/igt_dsc.h | 1 +
tests/i915/kms_dsc.c | 2 +-
tests/i915/kms_dsc_helper.c | 10 ++++++++++
tests/i915/kms_dsc_helper.h | 1 +
tests/kms_invalid_mode.c | 3 +--
6 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 6cbd8bae..e24abc8f 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -8,6 +8,7 @@
#include <string.h>
#include "igt_dsc.h"
#include "igt_sysfs.h"
+#include "igt_core.h"
static bool check_dsc_debugfs(int drmfd, char *connector_name, const char *check_str)
{
@@ -41,6 +42,28 @@ static int write_dsc_debugfs(int drmfd, char *connector_name, const char *file_n
return ret;
}
+/*
+ * igt_is_dsc_supported_by_source:
+ * @drmfd: A drm file descriptor
+ *
+ * Returns: True if DSC is supported by source, false otherwise.
+ */
+bool igt_is_dsc_supported_by_source(int drmfd)
+{
+ char buf[4096];
+ int dir, res;
+
+ dir = igt_debugfs_dir(drmfd);
+ igt_assert(dir >= 0);
+
+ res = igt_debugfs_simple_read(dir, "i915_capabilities",
+ buf, sizeof(buf));
+ igt_require(res > 0);
+ close(dir);
+
+ return strstr(buf, "has_dsc: yes");
+}
+
/*
* igt_is_dsc_supported_by_sink:
* @drmfd: A drm file descriptor
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index 241fc0ac..b58743b5 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -9,6 +9,7 @@
#include "igt_fb.h"
#include "igt_kms.h"
+bool igt_is_dsc_supported_by_source(int drmfd);
bool igt_is_dsc_supported_by_sink(int drmfd, char *connector_name);
bool igt_is_fec_supported(int drmfd, char *connector_name);
bool igt_is_dsc_enabled(int drmfd, char *connector_name);
diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index d142fae2..b46c4449 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -265,7 +265,7 @@ igt_main
igt_install_exit_handler(kms_dsc_exit_handler);
igt_display_require(&data.display, data.drm_fd);
igt_display_require_output(&data.display);
- igt_require(data.disp_ver >= 11);
+ igt_require(is_dsc_supported_by_source(data.drm_fd));
}
igt_describe("Tests basic display stream compression functionality if supported "
diff --git a/tests/i915/kms_dsc_helper.c b/tests/i915/kms_dsc_helper.c
index c90d833d..61f76dde 100644
--- a/tests/i915/kms_dsc_helper.c
+++ b/tests/i915/kms_dsc_helper.c
@@ -53,6 +53,16 @@ void kms_dsc_exit_handler(int sig)
restore_force_dsc_en();
}
+bool is_dsc_supported_by_source(int drmfd)
+{
+ if (!igt_is_dsc_supported_by_source(drmfd)) {
+ igt_debug("DSC not supported by source\n");
+ return false;
+ }
+
+ return true;
+}
+
bool is_dsc_supported_by_sink(int drmfd, igt_output_t *output)
{
if (!igt_is_dsc_supported_by_sink(drmfd, output->name)) {
diff --git a/tests/i915/kms_dsc_helper.h b/tests/i915/kms_dsc_helper.h
index f66191c7..2109bd76 100644
--- a/tests/i915/kms_dsc_helper.h
+++ b/tests/i915/kms_dsc_helper.h
@@ -27,6 +27,7 @@ void save_force_dsc_en(int drmfd, igt_output_t *output);
void restore_force_dsc_en(void);
void kms_dsc_exit_handler(int sig);
bool is_dsc_supported_by_sink(int drmfd, igt_output_t *output);
+bool is_dsc_supported_by_source(int drmfd);
bool check_gen11_dp_constraint(int drmfd, igt_output_t *output, enum pipe pipe);
bool check_gen11_bpc_constraint(int drmfd, igt_output_t *output, int input_bpc);
void force_dsc_output_format(int drmfd, igt_output_t *output,
diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 63da3a1c..e4ab65f2 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -60,9 +60,8 @@ can_bigjoiner(data_t *data)
if (intel_display_ver(devid) > 12) {
igt_debug("Platform supports uncompressed bigjoiner\n");
return true;
- } else if (intel_display_ver(devid) >= 11) {
+ } else if (igt_is_dsc_supported_by_source(data->drm_fd))
return igt_is_dsc_supported_by_sink(data->drm_fd, data->output->name);
- }
return false;
}
--
2.25.1
next prev parent reply other threads:[~2023-05-30 14:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 14:43 [igt-dev] [PATCH i-g-t v2 0/3] check dsc hardware capability Swati Sharma
2023-05-30 14:43 ` [igt-dev] [PATCH i-g-t v2 1/3] tests: s/igt_is_dsc_supported/igt_is_dsc_supported_by_sink Swati Sharma
2023-05-30 14:43 ` [igt-dev] [PATCH i-g-t v2 2/3] tests: s/check_dsc_on_connector/is_dsc_supported_by_sink Swati Sharma
2023-05-30 14:43 ` Swati Sharma [this message]
2023-05-30 17:03 ` [igt-dev] [PATCH i-g-t v2 3/3] tests: add igt_is_dsc_supported_by_source() Kamil Konieczny
2023-05-30 19:51 ` [igt-dev] ✓ Fi.CI.BAT: success for check dsc hardware capability Patchwork
2023-05-31 20:53 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230530144358.355304-4-swati2.sharma@intel.com \
--to=swati2.sharma@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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