[PATCH i-g-t 1/3] lib/igt_kms: Add lib changes to check if joiner is enabled for a pipe
Karthik B S
karthik.b.s at intel.com
Wed Feb 12 10:42:12 UTC 2025
On 2/12/2025 1:06 PM, Jeevan B wrote:
> Added a library change to check if joiner is enabled or not for the
> given pipe.
>
> v2: Update function name and logic to check joiner enabled for
> exact pipe.
> v3: Update commit message and rename function name and variable
> name.
> v4: Update string from %X to %x.
>
> Signed-off-by: Jeevan B <jeevan.b at intel.com>
> ---
> lib/igt_kms.c | 31 +++++++++++++++++++++++++++++++
> lib/igt_kms.h | 1 +
> 2 files changed, 32 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 90f44b4d3..3caba7d77 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6406,6 +6406,37 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
> return found;
> }
>
> +/**
> + * igt_is_joiner_enabled_for_pipe:
> + * @drmfd: A drm file descriptor
> + * @pipe: display pipe
> + *
> + * Returns: True if joiner is enabled, false otherwise.
> + */
> +bool igt_is_joiner_enabled_for_pipe(int drmfd, enum pipe pipe)
> +{
> + char buf[16384], master_str[64], slave_str[64];
> + int dir, res;
> + int pipe_mask = 0b11;
This throws up an error with checkpatch. Please use the decimal
representation or could be defined by using bit wise operators to make
it more intuitive. (Your call either ways)
Also may be we could add a TODO to move these lib functions to the
joiner specific library file once we have those patches merged.
With these fixes,
Reviewed-by: Karthik B S <karthik.b.s at intel.com>
> +
> +
> + dir = igt_debugfs_dir(drmfd);
> + igt_assert(dir >= 0);
> +
> + res = igt_debugfs_simple_read(dir, "i915_display_info",
> + buf, sizeof(buf));
> + close(dir);
> + igt_assert(res >= 0);
> + pipe_mask <<= pipe;
> +
> + snprintf(master_str, sizeof(master_str),
> + "Linked to 0x%x pipes as a master", pipe_mask);
> + snprintf(slave_str, sizeof(slave_str),
> + "Linked to 0x%x pipes as a slave", pipe_mask);
> +
> + return (strstr(buf, master_str) && strstr(buf, slave_str));
> +}
> +
> /**
> * igt_ultrajoiner_possible:
> * @mode: libdrm mode
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8810123fb..1cfacf87d 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1245,6 +1245,7 @@ int igt_get_max_dotclock(int fd);
> bool igt_bigjoiner_possible(int drm_fd, drmModeModeInfo *mode, int max_dotclock);
> bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
> int max_dotclock, drmModeModeInfo *mode);
> +bool igt_is_joiner_enabled_for_pipe(int drmfd, enum pipe pipe);
> bool igt_ultrajoiner_possible(drmModeModeInfo *mode, int max_dotclock);
> bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
> int max_dotclock, drmModeModeInfo *mode);
More information about the igt-dev
mailing list