All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Jessica Zhang <quic_jesszhan@quicinc.com>
Cc: quic_khsieh@quicinc.com, swboyd@chromium.org,
	igt-dev@lists.freedesktop.org, nganji@codeaurora.org,
	seanpaul@chromium.org, aravindh@codeaurora.org
Subject: Re: [igt-dev] [PATCH i-g-t v2] tests/kms_plane_scaling: Increase buffer size if driver doesn't support larger scale factors
Date: Thu, 9 Dec 2021 13:26:53 +0200	[thread overview]
Message-ID: <YbHn/Vc69yVCevzZ@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20211209002716.209-1-quic_jesszhan@quicinc.com>

On Wed, Dec 08, 2021 at 04:27:16PM -0800, Jessica Zhang wrote:
> Catch edge cases where driver doesn't support larger scale factors or
> pipe doesn't support scaling.
> 
> Currently, a 20x20 framebuffer is passed in to be upscaled. However,
> this will cause issues with other drivers as they may not support larger
> scale factors or may not support scaling at all for certain planes.
> 
> This avoids failures due to invalid scale factor by trying
> the original 20x20 framebuffer commit, then trying to commit larger
> framebuffers up to and including unity scale.
> 
> Changes since V1:
> - try_commit_with_fb_size: Changed igt_try_commit2 to
>   igt_display_try_commit_atomic instead to avoid redundant commits
> - try_commit_with_fb_size: Moved calls to clear framebuffer to outside
>   of success condition and moved cleanup_crtc back to outside of method
> 
> Tested-on: Qualcomm RB5 (sdm845)
> 
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
>  tests/kms_plane_scaling.c | 55 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 46 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 85db11ee..971c1532 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright © 2013,2014 Intel Corporation
> + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the "Software"),
> @@ -118,6 +119,32 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
>  	igt_display_commit2(display, COMMIT_ATOMIC);
>  }
>  
> +static int try_commit_with_fb_size(int width, int height, igt_rotation_t rot,
> +		                            igt_display_t *display, data_t *d,
> +                                   igt_plane_t *plane,
> +		                            drmModeModeInfo *mode)
> +{
> +	int ret;
> +
> +	/* Check min to full resolution upscaling */
> +	igt_fb_set_position(&d->fb[0], plane, 0, 0);
> +	igt_fb_set_size(&d->fb[0], plane, width, height);
> +	igt_plane_set_position(plane, 0, 0);
> +	igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
> +	igt_plane_set_rotation(plane, rot);
> +
> +	ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY |
> +		                                DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> +
> +	if (!ret)
> +		igt_display_commit2(display, COMMIT_ATOMIC);

Now this looks more understandable but I still have one "why"
remaining: Why test_only the commit if you're anyway going to perform
the commit? You could just have this as one try_commit, without
test_only, and let it perform it, as there's nothing done differently
here based on success/failure.



-- 
Petri Latvala


> +
> +	igt_plane_set_fb(plane, NULL);
> +	igt_plane_set_position(plane, 0, 0);
> +
> +	return ret;
> +}
> +
>  static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
>  					 uint32_t pixel_format,
>  					 uint64_t modifier, enum pipe pipe,
> @@ -126,6 +153,7 @@ static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
>  {
>  	igt_display_t *display = &d->display;
>  	int width, height;
> +	int commit_ret;
>  	drmModeModeInfo *mode;
>  
>  	cleanup_crtc(d);
> @@ -139,16 +167,25 @@ static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane,
>  		       pixel_format, modifier, 0.0, 1.0, 0.0, &d->fb[0]);
>  	igt_plane_set_fb(plane, &d->fb[0]);
>  
> -	/* Check min to full resolution upscaling */
> -	igt_fb_set_position(&d->fb[0], plane, 0, 0);
> -	igt_fb_set_size(&d->fb[0], plane, width, height);
> -	igt_plane_set_position(plane, 0, 0);
> -	igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
> -	igt_plane_set_rotation(plane, rot);
> -	igt_display_commit2(display, COMMIT_ATOMIC);
> +	commit_ret = try_commit_with_fb_size(width, height, rot, display,
> +                                        d, plane, mode);
>  
> -	igt_plane_set_fb(plane, NULL);
> -	igt_plane_set_position(plane, 0, 0);
> +	if(commit_ret == -ERANGE) {
> +		igt_debug("Scaling for %dx%d plane not supported, trying scale factor of 4x\n", width, height);
> +		width = height = mode->vdisplay / 4;
> +		commit_ret = try_commit_with_fb_size(width, height, rot, display,
> +                                            d, plane, mode);
> +	}
> +
> +	if (commit_ret == -ERANGE) {
> +		igt_debug("Scale factor of 4x (or scaling in general) not supported, trying unity scale\n");
> +		width = mode->hdisplay;
> +		height = mode->vdisplay;
> +		commit_ret = try_commit_with_fb_size(width, height, rot, display,
> +                                            d, plane, mode);
> +	}
> +
> +	igt_assert_eq(commit_ret, 0);
>  }
>  
>  static const igt_rotation_t rotations[] = {
> -- 
> 2.34.1
> 

  reply	other threads:[~2021-12-09 11:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  0:27 [igt-dev] [PATCH i-g-t v2] tests/kms_plane_scaling: Increase buffer size if driver doesn't support larger scale factors Jessica Zhang
2021-12-09 11:26 ` Petri Latvala [this message]
2021-12-09 20:54   ` Jessica Zhang
2021-12-10  6:11     ` Petri Latvala
2021-12-14  0:50       ` Jessica Zhang
2021-12-14  9:43         ` Petri Latvala
2021-12-15 19:59           ` Jessica Zhang
2021-12-09 19:28 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_scaling: Increase buffer size if driver doesn't support larger scale factors (rev2) Patchwork
2021-12-10  4:02 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-12-15 22:51 [igt-dev] [PATCH i-g-t v2] tests/kms_plane_scaling: Increase buffer size if driver doesn't support larger scale factors Jessica Zhang
2021-12-17 12:34 ` Petri Latvala
2021-12-23 16:20   ` Jessica Zhang
2021-12-23 19:00     ` Jessica Zhang

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=YbHn/Vc69yVCevzZ@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=aravindh@codeaurora.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nganji@codeaurora.org \
    --cc=quic_jesszhan@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=seanpaul@chromium.org \
    --cc=swboyd@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.