From: "Joshi, Kunal1" <kunal1.joshi@intel.com>
To: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: Karthik B S <karthik.b.s@intel.com>
Subject: Re: [PATCH i-g-t 2/4] lib/igt_kms: add helpers to enable/disable force joiner
Date: Tue, 5 Mar 2024 18:20:22 +0530 [thread overview]
Message-ID: <e9d8e085-145b-4059-a5ac-70c3deff8598@intel.com> (raw)
In-Reply-To: <3919e872-a25b-425c-b467-ac340f0999f0@intel.com>
Hello Bhanu,
Thanks for taking a look.
On 3/5/2024 5:14 PM, Modem, Bhanuprakash wrote:
> Hi Kunal,
>
> On 03-03-2024 10:52 pm, Kunal Joshi wrote:
>> add helped to enable/disable force joiner and for
>> checking current state enabled/disabled
>>
>> Cc: Karthik B S <karthik.b.s@intel.com>
>> Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
>> Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com>
>> ---
>> lib/igt_kms.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>> lib/igt_kms.h | 2 ++
>> 2 files changed, 50 insertions(+)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 89956b9d5..e6952f56a 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -6242,6 +6242,54 @@ bool igt_check_bigjoiner_support(igt_display_t
>> *display)
>> return true;
>> }
>> +/**
>> + * Checks if the force big joiner is enabled for a specific connector.
>> + *
>> + * @param drmfd The file descriptor of the DRM device.
>> + * @param connector_name The name of the connector.
>> + * Returns:
>> + * 1 if the force big joiner is enabled, 0 if disabled, and -1 on
>> error.
>> + */
>> +int igt_check_force_bigjoiner_status(int drmfd, char *connector_name)
>> +{
>> + char buf[512];
>> + int debugfs_fd, ret;
>> +
>> + debugfs_fd = igt_debugfs_connector_dir(drmfd, connector_name,
>> O_RDONLY);
>
> We must guard "debugfs_fd" with igt_assert() or igt_require().
Will address in next revision.
>
>> + ret = igt_debugfs_simple_read(debugfs_fd,
>> "i915_bigjoiner_force_enable",
>> + buf, sizeof(buf));
>> + if (ret < 0) {
>> + igt_info("Could not read debugfs %s\n",
>> + strerror(-ret));
>> + return -1;
>> + }
>> + if (strstr(buf, "Bigjoiner enable: 1"))
>> + return 1;
>> + else if (strstr(buf, "Bigjoiner enable: 0"))
>> + return 0;
>> + else
>> + return -1;
>> +}
>> +
>> +/**
>> + * Forces the enable/disable state of big joiner for a specific
>> connector.
>> + *
>> + * @param drmfd The file descriptor of the DRM device.
>> + * @param connector_name The name of the connector.
>> + * @param enable The desired state of big joiner (true for enable,
>> false for disable).
>> + * Returns:
>> + * >=0 on success, otherwise an error code.
>
> IMHO, let's make return value as bool. Return True if write success
> else False.
Yes we can do like that way too, will address in next revision
>
>> + */
>> +int igt_force_bigjoiner_enable(int drmfd, char *connector_name, bool
>> enable)
>> +{
>> + int debugfs_fd, ret;
>> +
>> + debugfs_fd = igt_debugfs_connector_dir(drmfd, connector_name,
>> O_DIRECTORY);
> ----------------------------------------------------------------------^
> This could be O_RDWR or O_WRONLY?
No O_RDWR and O_WRONLY are for files not for directories.
>
> - Bhanu
>
>> + ret = igt_sysfs_write(debugfs_fd, "i915_bigjoiner_force_enable",
>> enable ? "1" : "0", 1);
>> + close(debugfs_fd);
>> + return ret;
>> +}
>> +
>> /**
>> * igt_parse_mode_string:
>> * @mode_string: modeline string
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> index bab8487d3..b28022db4 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -1215,6 +1215,8 @@ bool igt_bigjoiner_possible(drmModeModeInfo
>> *mode, int max_dotclock);
>> bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
>> int max_dotclock);
>> bool igt_check_bigjoiner_support(igt_display_t *display);
>> +int igt_check_force_bigjoiner_status(int drmfd, char *connector_name);
>> +int igt_force_bigjoiner_enable(int drmfd, char *connector_name, bool
>> enable);
>> bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo
>> *mode);
>> bool intel_pipe_output_combo_valid(igt_display_t *display);
>> bool igt_check_output_is_dp_mst(igt_output_t *output);
Thanks and Regards
Kunal Joshi
next prev parent reply other threads:[~2024-03-05 12:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-03 17:22 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-03 17:22 ` [PATCH i-g-t 1/4] lib/igt_kms: move bigjoiner_mode_found to lib Kunal Joshi
2024-03-03 17:22 ` [PATCH i-g-t 2/4] lib/igt_kms: add helpers to enable/disable force joiner Kunal Joshi
2024-03-05 11:44 ` Modem, Bhanuprakash
2024-03-05 12:50 ` Joshi, Kunal1 [this message]
2024-03-03 17:22 ` [PATCH i-g-t 3/4] tests/intel/kms_big_joiner: revamp kms_big_joiner Kunal Joshi
2024-03-05 11:44 ` Modem, Bhanuprakash
2024-03-05 13:14 ` Joshi, Kunal1
2024-03-05 17:34 ` Kamil Konieczny
2024-03-03 17:22 ` [PATCH i-g-t 4/4] tests/intel-ci/fast-feedback: HAX PATCH DO NOT MERGE Kunal Joshi
2024-03-03 17:46 ` ✓ CI.xeBAT: success for revamp big joiner test (rev3) Patchwork
2024-03-03 18:07 ` ✗ Fi.CI.BAT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-03-01 8:25 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-03-01 8:26 ` [PATCH i-g-t 2/4] lib/igt_kms: add helpers to enable/disable force joiner Kunal Joshi
2024-02-29 18:10 [PATCH i-g-t 0/4] revamp big joiner test Kunal Joshi
2024-02-29 18:10 ` [PATCH i-g-t 2/4] lib/igt_kms: add helpers to enable/disable force joiner Kunal Joshi
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=e9d8e085-145b-4059-a5ac-70c3deff8598@intel.com \
--to=kunal1.joshi@intel.com \
--cc=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@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