[PATCH v3] libdrm: modetest: Allow selecting modes by index

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 21 18:42:10 UTC 2020


On Thu, 27 Jun 2019 at 22:37, John Stultz <john.stultz at linaro.org> wrote:
>
> Often there are many similar modes, which cannot be selected
> via modetest due to its simple string matching.
>
> This change adds a mode index in the display output, which can
> then be used to specify a specific modeline to be set.
>
> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> Cc: Rob Clark <robdclark at chromium.org>
> Cc: Bjorn Andersson <bjorn.andersson at linaro.org>
> Cc: Sumit Semwal <sumit.semwal at linaro.org>
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Signed-off-by: John Stultz <john.stultz at linaro.org>
> ---
> v2: Reworked mode_str check per Ilia's suggestion
> v3: Added index < 0 check per Ilia's suggestion
> ---
>  tests/modetest/modetest.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> index 9c85c07b..5e1b623a 100644
> --- a/tests/modetest/modetest.c
> +++ b/tests/modetest/modetest.c
> @@ -204,9 +204,10 @@ static void dump_encoders(struct device *dev)
>         printf("\n");
>  }
>
> -static void dump_mode(drmModeModeInfo *mode)
> +static void dump_mode(drmModeModeInfo *mode, int index)
>  {
> -       printf("  %s %d %d %d %d %d %d %d %d %d %d",
> +       printf("  #%i %s %d %d %d %d %d %d %d %d %d %d",
> +              index,
>                mode->name,
>                mode->vrefresh,
>                mode->hdisplay,

Thanks John.
Resolved a minor conflict in the above hunk and pushed to master.

Emil


More information about the dri-devel mailing list