From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: imre.deak@intel.com, Kunal Joshi <kunal1.joshi@intel.com>
Subject: [PATCH i-g-t 3/6] lib/igt_kms: allow set and reset value to be same
Date: Thu, 12 Sep 2024 11:58:36 +0530 [thread overview]
Message-ID: <20240912062839.760661-4-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240912062839.760661-1-kunal1.joshi@intel.com>
allow set and reset value to be same, let the caller handle
this scenario instead.
example scenario where this is required.
i915_dp_force_link_rate should be auto before starting test
should be auto at exit
v2: handle the scenario at caller side
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
lib/igt_kms.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 863eb5331..a7f8d0f83 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1557,7 +1557,8 @@ static void connector_attr_free(struct igt_connector_attr *c)
static bool connector_attr_set(int idx, drmModeConnector *connector,
int dir, igt_connector_attr_set set,
const char *attr, const char *value,
- const char *reset_value)
+ const char *reset_value,
+ bool allow_set_equals_reset)
{
struct igt_connector_attr *c;
@@ -1573,7 +1574,7 @@ static bool connector_attr_set(int idx, drmModeConnector *connector,
return false;
}
- if (!strcmp(c->value, c->reset_value))
+ if (!allow_set_equals_reset && !strcmp(c->value, c->reset_value))
connector_attr_free(c);
return true;
@@ -1582,7 +1583,8 @@ static bool connector_attr_set(int idx, drmModeConnector *connector,
static bool connector_attr_set_sysfs(int drm_fd,
drmModeConnector *connector,
const char *attr, const char *value,
- const char *reset_value)
+ const char *reset_value,
+ bool allow_set_equals_reset)
{
char name[80];
int idx, dir;
@@ -1600,7 +1602,8 @@ static bool connector_attr_set_sysfs(int drm_fd,
return false;
if (!connector_attr_set(idx, connector, dir,
- igt_sysfs_set, attr, value, reset_value))
+ igt_sysfs_set, attr, value, reset_value,
+ allow_set_equals_reset))
return false;
igt_debug("Connector %s/%s is now %s\n", name, attr, value);
@@ -1611,7 +1614,8 @@ static bool connector_attr_set_sysfs(int drm_fd,
static bool connector_attr_set_debugfs(int drm_fd,
drmModeConnector *connector,
const char *attr, const char *value,
- const char *reset_value)
+ const char *reset_value,
+ bool allow_set_equals_reset)
{
char name[80];
int idx, dir;
@@ -1630,7 +1634,7 @@ static bool connector_attr_set_debugfs(int drm_fd,
if (!connector_attr_set(idx, connector, dir,
igt_sysfs_set, attr,
- value, reset_value))
+ value, reset_value, allow_set_equals_reset))
return false;
igt_info("Connector %s/%s is now %s\n", name, attr, value);
@@ -1662,7 +1666,8 @@ static bool force_connector(int drm_fd,
const char *value)
{
return connector_attr_set_sysfs(drm_fd, connector,
- "status", value, "detect");
+ "status", value, "detect",
+ false);
}
/**
@@ -1727,7 +1732,7 @@ static bool force_connector_bigjoiner(int drm_fd,
{
return connector_attr_set_debugfs(drm_fd, connector,
"i915_bigjoiner_force_enable",
- value, "0");
+ value, "0", false);
}
/**
--
2.43.0
next prev parent reply other threads:[~2024-09-12 6:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 6:28 [PATCH i-g-t 0/6] add test to validate fallback Kunal Joshi
2024-09-12 6:28 ` [PATCH i-g-t 1/6] lib/igt_kms: add DP link management helper functions Kunal Joshi
2024-09-12 11:15 ` Joshi, Kunal1
2024-09-18 14:29 ` Imre Deak
2024-09-12 6:28 ` [PATCH i-g-t 2/6] lib/igt_kms: add helper to set connector link status Kunal Joshi
2024-09-12 6:28 ` Kunal Joshi [this message]
2024-09-18 14:33 ` [PATCH i-g-t 3/6] lib/igt_kms: allow set and reset value to be same Imre Deak
2024-09-12 6:28 ` [PATCH i-g-t 4/6] lib/igt_kms: add function to reset link params Kunal Joshi
2024-09-18 14:35 ` Imre Deak
2024-09-12 6:28 ` [PATCH i-g-t 5/6] tests/intel/kms_dp_fallback: add test for validating fallback Kunal Joshi
2024-09-18 15:22 ` Imre Deak
2024-09-12 6:28 ` [PATCH i-g-t 6/6] HAX: Do not merge Kunal Joshi
2024-09-12 8:07 ` ✗ GitLab.Pipeline: warning for add test to validate fallback (rev5) Patchwork
2024-09-12 8:35 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-09-12 8:35 ` ✗ CI.xeBAT: " Patchwork
2024-09-12 14:26 ` ✗ CI.xeFULL: " 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=20240912062839.760661-4-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=imre.deak@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