From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Kunal Joshi" <kunal1.joshi@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Ankit Nautiyal" <ankit.k.nautiyal@intel.com>,
"Bhanuprakash Modem" <bhanuprakash.modem@intel.com>
Subject: [PATCH i-g-t 3/6] lib/igt_kms: add support for forcing bigjoiner on particular connector
Date: Wed, 17 Apr 2024 17:13:23 +0530 [thread overview]
Message-ID: <20240417114326.2245087-4-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20240417114326.2245087-1-kunal1.joshi@intel.com>
add kmstest_force_connector_bigjoiner function which
force bigjoiner on provided connector as well as resets on exit.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
---
lib/igt_kms.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 2 ++
2 files changed, 89 insertions(+)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 3216fe7e4..5332a7a9a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1458,6 +1458,11 @@ static void reset_connectors_at_exit(int sig)
igt_reset_connectors();
}
+static void reset_force_joiner_state_at_exit(int sig)
+{
+ igt_reset_force_joiner_state();
+}
+
static char *kmstest_connector_dirname(int idx,
uint32_t connector_type,
uint32_t connector_type_id,
@@ -1607,6 +1612,30 @@ static bool connector_attr_set_sysfs(int drm_fd,
return true;
}
+static bool connector_attr_set_debugfs(int drm_fd,
+ drmModeConnector *connector,
+ const char *attr, const char *value,
+ const char *reset_value)
+{
+ char name[80];
+ int idx, dir;
+
+ snprintf(name, sizeof(name), "%s-%d",
+ kmstest_connector_type_str(connector->connector_type),
+ connector->connector_type_id);
+ dir = igt_debugfs_connector_dir(drm_fd, name, O_DIRECTORY);
+ if (dir < 0)
+ return false;
+
+ if (!connector_attr_set(idx, connector, dir,
+ igt_sysfs_set, attr, value, reset_value))
+ return false;
+
+ igt_debug("Connector %s/%s is now %s\n", name, attr, value);
+
+ return true;
+}
+
static void dump_connector_attrs(void)
{
char name[80];
@@ -1690,6 +1719,49 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
return true;
}
+static bool force_connector_bigjoiner(int drm_fd,
+ drmModeConnector *connector,
+ const char *value)
+{
+ return connector_attr_set_debugfs(drm_fd, connector,
+ "i915_bigjoiner_force_enable", value, "0");
+}
+
+/**
+ * kmstest_force_connector_bigjoiner:
+ * @fd: drm file descriptor
+ * @connector: connector
+ *
+ * Enable force bigjoiner state on the specified connector
+ * and install exit handler for resetting
+ *
+ * Returns: True on success
+ */
+bool kmstest_force_connector_bigjoiner(int drm_fd, drmModeConnector *connector)
+{
+ const char *value;
+ drmModeConnector *temp;
+
+ if (!is_intel_device(drm_fd))
+ return false;
+
+ value = "1";
+
+ if (!force_connector_bigjoiner(drm_fd, connector, value))
+ return false;
+
+ dump_connector_attrs();
+
+ igt_install_exit_handler(reset_force_joiner_state_at_exit);
+
+ /* To allow callers to always use GetConnectorCurrent we need to force a
+ * redetection here. */
+ temp = drmModeGetConnector(drm_fd, connector->connector_id);
+ drmModeFreeConnector(temp);
+
+ return true;
+}
+
/**
* kmstest_force_edid:
* @drm_fd: drm file descriptor
@@ -5367,6 +5439,21 @@ void igt_reset_connectors(void)
}
}
+void igt_reset_force_joiner_state(void)
+{
+ /*
+ * reset force joiner state on the connectors stored in
+ * i915_bigjoiner_force_enable debugfs attr of the forced connectors
+ */
+ for (int i = 0; i < ARRAY_SIZE(connector_attrs); i++) {
+ struct igt_connector_attr *c = &connector_attrs[i];
+
+ if (!c->attr)
+ continue;
+ c->set(c->dir, c->attr, c->reset_value);
+ }
+}
+
/**
* igt_watch_uevents:
*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6d13e5851..8951fccfd 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -262,6 +262,7 @@ struct edid;
bool kmstest_force_connector(int fd, drmModeConnector *connector,
enum kmstest_force_connector_state state);
+bool kmstest_force_connector_bigjoiner(int drm_fd, drmModeConnector *connector);
void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
const struct edid *edid);
@@ -1083,6 +1084,7 @@ void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force);
void igt_enable_connectors(int drm_fd);
void igt_reset_connectors(void);
+void igt_reset_force_joiner_state(void);
uint32_t kmstest_get_vbl_flag(int crtc_offset);
--
2.25.1
next prev parent reply other threads:[~2024-04-17 11:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 11:43 [PATCH i-g-t 0/6] cleanup and fixes for kms_big_joiner Kunal Joshi
2024-04-17 11:43 ` [PATCH i-g-t 1/6] tests/intel/kms_big_joiner: fix crash in multi joiner test Kunal Joshi
2024-04-17 11:43 ` [PATCH i-g-t 2/6] tests/intel/kms_big_joiner: add missing commit after reset Kunal Joshi
2024-04-17 11:43 ` Kunal Joshi [this message]
2024-04-17 13:03 ` [PATCH i-g-t 3/6] lib/igt_kms: add support for forcing bigjoiner on particular connector Modem, Bhanuprakash
2024-04-17 11:43 ` [PATCH i-g-t 4/6] tests/intel/kms_big_joiner: use kmstest_force_connector_bigjoiner Kunal Joshi
2024-04-17 11:43 ` [PATCH i-g-t 5/6] lib/igt_kms: remove unused igt_force_and_check_bigjoiner_status Kunal Joshi
2024-04-17 11:43 ` [PATCH i-g-t 6/6] HAX: Do not merge Kunal Joshi
2024-04-17 19:58 ` ✗ Fi.CI.BAT: failure for cleanup and fixes for kms_big_joiner Patchwork
2024-04-17 20:06 ` ✓ CI.xeBAT: success " Patchwork
2024-04-19 9:14 ` ✓ 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=20240417114326.2245087-4-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=ville.syrjala@linux.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