From: Jani Nikula <jani.nikula@intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
intel-gfx@lists.freedesktop.org
Cc: stanislav.lisovskiy@intel.com, imre.deak@intel.com,
ankit.k.nautiyal@intel.com
Subject: Re: [PATCH 5/5] drm/i915/dp: Ignore max_requested_bpc if its too low for DSC
Date: Thu, 26 Sep 2024 12:16:22 +0300 [thread overview]
Message-ID: <87setm22s9.fsf@intel.com> (raw)
In-Reply-To: <20231213091632.431557-6-ankit.k.nautiyal@intel.com>
On Wed, 13 Dec 2023, Ankit Nautiyal <ankit.k.nautiyal@intel.com> wrote:
> At the moment, while choosing the input bpc for DSC, we take into
> account the max_requested_bpc property. This creates a problem, if the
> max_requested_bpc is lower than the minimum bpc required by source with
> DSC.
>
> So consider max_requested_bpc if its within the limits that we can
> support with DSC.
>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_dp.c | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index e8aa2f469142..0014aa5ea652 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1638,6 +1638,16 @@ int intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915)
> return 12;
> }
>
> +static int
> +intel_dp_dsc_limit_max_bpc(int max_requested_bpc, int src_dsc_max_bpc, int src_dsc_min_bpc)
> +{
> + /* Consider max_requested_bpc only if src can support it with DSC */
> + if (max_requested_bpc >= src_dsc_min_bpc)
> + return min(src_dsc_max_bpc, max_requested_bpc);
> +
> + return src_dsc_max_bpc;
> +}
> +
> int intel_dp_dsc_compute_max_bpp(const struct intel_connector *connector,
> u8 max_req_bpc)
> {
> @@ -1651,7 +1661,8 @@ int intel_dp_dsc_compute_max_bpp(const struct intel_connector *connector,
> if (!dsc_max_bpc)
> return dsc_max_bpc;
>
> - dsc_max_bpc = min(dsc_max_bpc, max_req_bpc);
> + dsc_max_bpc = intel_dp_dsc_limit_max_bpc(max_req_bpc, dsc_max_bpc,
> + intel_dp_dsc_min_src_input_bpc(i915));
Somehow that doesn't read so well.
I think something like this would improve clarity:
dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915);
max_req_bpc = clamp(max_req_bpc, dsc_min_bpc, dsc_max_bpc);
i.e. clamp the request to reasonable limits. That's more like regular
input checking. That should be done *everywhere* when
conn_state->max_requested_bpc is used.
Then min(dsc_max_bpc, max_req_bpc) is no longer needed because
max_req_bpc <= dsc_max_bpc is guaranteed.
IOW this becomes:
dsc_max_bpc = clamp(max_req_bpc, dsc_min_bpc, dsc_max_bpc);
BR,
Jani.
>
> num_bpc = drm_dp_dsc_sink_supported_input_bpcs(connector->dp.dsc_dpcd,
> dsc_bpc);
> @@ -2039,8 +2050,11 @@ bool is_dsc_pipe_bpp_sufficient(struct drm_i915_private *i915,
> {
> int dsc_max_bpc, dsc_min_bpc, dsc_max_pipe_bpp, dsc_min_pipe_bpp;
>
> - dsc_max_bpc = min(intel_dp_dsc_max_src_input_bpc(i915), conn_state->max_requested_bpc);
> dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
> + dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915);
> +
> + dsc_max_bpc = intel_dp_dsc_limit_max_bpc(conn_state->max_requested_bpc,
> + dsc_max_bpc, dsc_min_bpc);
>
> dsc_max_pipe_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp);
> dsc_min_pipe_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp);
> @@ -2100,14 +2114,14 @@ static int intel_dp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
> }
> }
>
> + dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
> dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915);
> if (!dsc_max_bpc)
> return -EINVAL;
>
> - dsc_max_bpc = min(dsc_max_bpc, max_req_bpc);
> + dsc_max_bpc = intel_dp_dsc_limit_max_bpc(max_req_bpc, dsc_max_bpc, dsc_min_bpc);
> dsc_max_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp);
>
> - dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
> dsc_min_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp);
>
> /*
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-09-26 9:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 9:16 [PATCH 0/5] DP DSC min/max src bpc fixes Ankit Nautiyal
2023-12-13 9:16 ` [PATCH 1/5] drm/i915/dp: Simplify checks for helper intel_dp_dsc_max_src_input_bpc Ankit Nautiyal
2024-09-26 8:39 ` Kandpal, Suraj
2023-12-13 9:16 ` [PATCH 2/5] drm/i915/dp: Fix the max DSC bpc supported by source Ankit Nautiyal
2024-01-02 15:19 ` Sharma, Swati2
2023-12-13 9:16 ` [PATCH 3/5] drm/i915/dp: Return int from dsc_max/min_src_input_bpc helpers Ankit Nautiyal
2024-09-26 8:53 ` Kandpal, Suraj
2023-12-13 9:16 ` [PATCH 4/5] drm/i915/dp_mst: Use helpers to get dsc min/max input bpc Ankit Nautiyal
2023-12-13 9:16 ` [PATCH 5/5] drm/i915/dp: Ignore max_requested_bpc if its too low for DSC Ankit Nautiyal
2024-09-26 9:16 ` Jani Nikula [this message]
2024-10-03 10:48 ` Nautiyal, Ankit K
2023-12-13 17:44 ` ✗ Fi.CI.SPARSE: warning for DP DSC min/max src bpc fixes (rev7) Patchwork
2023-12-13 18:03 ` ✓ Fi.CI.BAT: success " Patchwork
2023-12-13 19:01 ` ✓ Fi.CI.IGT: " Patchwork
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=87setm22s9.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stanislav.lisovskiy@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 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.