[PATCH i-g-t v5 2/3] lib/igt_kms: loosen duplicate check in igt_display_refresh
Kamil Konieczny
kamil.konieczny at linux.intel.com
Thu Jan 30 12:59:37 UTC 2025
Hi Jessica,
On 2025-01-28 at 19:29:48 -0800, Jessica Zhang wrote:
> From: Esha Bharadwaj <quic_ebharadw at quicinc.com>
See one nit about documentaion below.
>
> Change the duplicate check in igt_display_refresh() so it allows for
> pipes to be shared by encoders that are valid clones of each other.
>
please correct Bhanuprakash e-mail
Cc: Bhanuprakash Modem <bhanuprakash.modem at gmail.com>
Juha-Pekka or Swati or Karthik - could you find someone from KMS team and
help with review of this and next patch? Thanks!
Cc: Swati Sharma <swati2.sharma at intel.com>
Cc: Karthik B S <karthik.b.s at intel.com>
> Signed-off-by: Esha Bharadwaj <quic_ebharadw at quicinc.com>
> Signed-off-by: Jessica Zhang <quic_jesszhan at quicinc.com>
> ---
> lib/igt_kms.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
> lib/igt_kms.h | 1 +
> 2 files changed, 47 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 4b14c94e226a9a103bc3a3bc26099566a6eb274b..5471f906a98f62aec285bf50d9c48f2ec6c1009e 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3339,6 +3339,48 @@ int kmstest_get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)
> igt_assert(0);
> }
>
Please document each new library function.
Reagrds,
Kamil
> +bool igt_output_is_valid_clone(int drm_fd, igt_output_t *target, igt_output_t *clone)
> +{
> + drmModeEncoder *target_enc;
> + drmModeEncoder *clone_enc;
> + drmModeRes *resources = drmModeGetResources(drm_fd);
> + uint32_t clone_mask;
> +
> + if (!target || !clone)
> + return false;
> +
> + target_enc = target->config.encoder;
> + clone_enc = clone->config.encoder;
> +
> + if (!target_enc || !clone_enc)
> + return false;
> +
> + clone_mask = 1 << kmstest_get_encoder_idx(resources, clone_enc);
> +
> + return ((target_enc->possible_clones & clone_mask) == clone_mask);
> +}
> +
> +static bool igt_output_has_duplicates(igt_display_t *display, igt_output_t *output,
> + unsigned long pipes_in_use, int start_idx)
> +{
> + igt_output_t *clone_output;
> +
> + for (int j = start_idx + 1; j < display->n_outputs; j++) {
> + clone_output = &display->outputs[j];
> +
> + /*
> + * Check that any encoders with duplicated pipes
> + * are possible clones of each other. If they
> + * aren't, report the pipe as duplicated
> + */
> + if ((pipes_in_use & (1 << output->pending_pipe)) &&
> + !igt_output_is_valid_clone(display->drm_fd, output, clone_output))
> + return true;
> + }
> +
> + return false;
> +}
> +
> static void igt_display_refresh(igt_display_t *display)
> {
> igt_output_t *output;
> @@ -3346,13 +3388,14 @@ static void igt_display_refresh(igt_display_t *display)
>
> unsigned long pipes_in_use = 0;
>
> - /* Check that two outputs aren't trying to use the same pipe */
> + /* Check that two non-clone outputs aren't trying to use the same pipe */
> for (i = 0; i < display->n_outputs; i++) {
> output = &display->outputs[i];
>
> if (output->pending_pipe != PIPE_NONE) {
> - if (pipes_in_use & (1 << output->pending_pipe))
> - goto report_dup;
> + if (igt_output_has_duplicates(display, output,
> + pipes_in_use, i))
> + goto report_dup;
>
> pipes_in_use |= 1 << output->pending_pipe;
> }
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index e4f7b6c62fd536aa4ea3eb3153d8e1935cf560fd..932e5818364ca74cb86b1ba58c5f3ede0b8abf18 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -554,6 +554,7 @@ igt_plane_t *igt_output_get_plane_type_index(igt_output_t *output,
> int plane_type, int index);
> igt_output_t *igt_output_from_connector(igt_display_t *display,
> drmModeConnector *connector);
> +bool igt_output_is_valid_clone(int drm_fd, igt_output_t *target, igt_output_t *clone);
> void igt_output_refresh(igt_output_t *output);
> drmModeModeInfo *igt_std_1024_mode_get(int vrefresh);
> void igt_output_set_writeback_fb(igt_output_t *output, struct igt_fb *fb);
>
> --
> 2.34.1
>
More information about the igt-dev
mailing list