From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org, imre.deak@intel.com,
Lyude Paul <lyude@redhat.com>
Subject: Re: [PATCH] drm/mst: remove mgr parameter and debug logging from drm_dp_get_vc_payload_bw()
Date: Thu, 02 Jan 2025 13:50:02 +0200 [thread overview]
Message-ID: <871pxlo2ol.fsf@intel.com> (raw)
In-Reply-To: <20250102101552.315814-1-jani.nikula@intel.com>
On Thu, 02 Jan 2025, Jani Nikula <jani.nikula@intel.com> wrote:
> The struct drm_dp_mst_topology_mgr *mgr parameter is only used for debug
> logging in case the passed in link rate or lane count are zero. There's
> no further error checking as such, and the function returns 0.
>
> There should be no case where the parameters are zero. The returned
> value is generally used as a divisor, and if we were hitting this, we'd
> be seeing division by zero.
>
> Just remove the debug logging altogether, along with the mgr parameter,
> so that the function can be used in non-MST contexts without the
> topology manager.
>
> v2: Also remove drm_dp_mst_helper_tests_init as unnecessary (Imre)
>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Reviewed-by: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Maarten, Maxime, Thomas, ack for merging this via drm-intel along with
the rest of the series?
BR,
Jani.
> ---
> drivers/gpu/drm/display/drm_dp_mst_topology.c | 10 ++--------
> drivers/gpu/drm/i915/display/intel_dp_mst.c | 3 +--
> drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 +--
> drivers/gpu/drm/tests/drm_dp_mst_helper_test.c | 17 +----------------
> include/drm/display/drm_dp_mst_helper.h | 3 +--
> 5 files changed, 6 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index f8cd094efa3c..06c91c5b7f7c 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> @@ -3572,8 +3572,7 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr,
> }
>
> /**
> - * drm_dp_get_vc_payload_bw - get the VC payload BW for an MST link
> - * @mgr: The &drm_dp_mst_topology_mgr to use
> + * drm_dp_get_vc_payload_bw - get the VC payload BW for an MTP link
> * @link_rate: link rate in 10kbits/s units
> * @link_lane_count: lane count
> *
> @@ -3584,17 +3583,12 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr,
> *
> * Returns the BW / timeslot value in 20.12 fixed point format.
> */
> -fixed20_12 drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
> - int link_rate, int link_lane_count)
> +fixed20_12 drm_dp_get_vc_payload_bw(int link_rate, int link_lane_count)
> {
> int ch_coding_efficiency =
> drm_dp_bw_channel_coding_efficiency(drm_dp_is_uhbr_rate(link_rate));
> fixed20_12 ret;
>
> - if (link_rate == 0 || link_lane_count == 0)
> - drm_dbg_kms(mgr->dev, "invalid link rate/lane count: (%d / %d)\n",
> - link_rate, link_lane_count);
> -
> /* See DP v2.0 2.6.4.2, 2.7.6.3 VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */
> ret.full = DIV_ROUND_DOWN_ULL(mul_u32_u32(link_rate * link_lane_count,
> ch_coding_efficiency),
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index fffd199999e0..ca091ed291d5 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -244,8 +244,7 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
> crtc_state->fec_enable = !intel_dp_is_uhbr(crtc_state);
> }
>
> - mst_state->pbn_div = drm_dp_get_vc_payload_bw(&intel_dp->mst_mgr,
> - crtc_state->port_clock,
> + mst_state->pbn_div = drm_dp_get_vc_payload_bw(crtc_state->port_clock,
> crtc_state->lane_count);
>
> max_dpt_bpp = intel_dp_mst_max_dpt_bpp(crtc_state, dsc);
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index 8097249612bc..62d72b7a8d04 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -992,8 +992,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
> if (!mst_state->pbn_div.full) {
> struct nouveau_encoder *outp = mstc->mstm->outp;
>
> - mst_state->pbn_div = drm_dp_get_vc_payload_bw(&mstm->mgr,
> - outp->dp.link_bw, outp->dp.link_nr);
> + mst_state->pbn_div = drm_dp_get_vc_payload_bw(outp->dp.link_bw, outp->dp.link_nr);
> }
>
> slots = drm_dp_atomic_find_time_slots(state, &mstm->mgr, mstc->port, asyh->dp.pbn);
> diff --git a/drivers/gpu/drm/tests/drm_dp_mst_helper_test.c b/drivers/gpu/drm/tests/drm_dp_mst_helper_test.c
> index 89cd9e4f4d32..9e0e2fb65944 100644
> --- a/drivers/gpu/drm/tests/drm_dp_mst_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_dp_mst_helper_test.c
> @@ -199,10 +199,8 @@ static const struct drm_dp_mst_calc_pbn_div_test drm_dp_mst_calc_pbn_div_dp1_4_c
> static void drm_test_dp_mst_calc_pbn_div(struct kunit *test)
> {
> const struct drm_dp_mst_calc_pbn_div_test *params = test->param_value;
> - /* mgr->dev is only needed by drm_dbg_kms(), but it's not called for the test cases. */
> - struct drm_dp_mst_topology_mgr *mgr = test->priv;
>
> - KUNIT_EXPECT_EQ(test, drm_dp_get_vc_payload_bw(mgr, params->link_rate, params->lane_count).full,
> + KUNIT_EXPECT_EQ(test, drm_dp_get_vc_payload_bw(params->link_rate, params->lane_count).full,
> params->expected.full);
> }
>
> @@ -568,21 +566,8 @@ static struct kunit_case drm_dp_mst_helper_tests[] = {
> { }
> };
>
> -static int drm_dp_mst_helper_tests_init(struct kunit *test)
> -{
> - struct drm_dp_mst_topology_mgr *mgr;
> -
> - mgr = kunit_kzalloc(test, sizeof(*mgr), GFP_KERNEL);
> - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, mgr);
> -
> - test->priv = mgr;
> -
> - return 0;
> -}
> -
> static struct kunit_suite drm_dp_mst_helper_test_suite = {
> .name = "drm_dp_mst_helper",
> - .init = drm_dp_mst_helper_tests_init,
> .test_cases = drm_dp_mst_helper_tests,
> };
>
> diff --git a/include/drm/display/drm_dp_mst_helper.h b/include/drm/display/drm_dp_mst_helper.h
> index a80ba457a858..e39de161c938 100644
> --- a/include/drm/display/drm_dp_mst_helper.h
> +++ b/include/drm/display/drm_dp_mst_helper.h
> @@ -867,8 +867,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector,
> struct drm_dp_mst_topology_mgr *mgr,
> struct drm_dp_mst_port *port);
>
> -fixed20_12 drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
> - int link_rate, int link_lane_count);
> +fixed20_12 drm_dp_get_vc_payload_bw(int link_rate, int link_lane_count);
>
> int drm_dp_calc_pbn_mode(int clock, int bpp);
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-01-02 11:50 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 21:33 [PATCH v2 00/16] drm/i915/dp: 128b/132b uncompressed SST Jani Nikula
2024-12-19 21:33 ` [PATCH v2 01/16] drm/mst: remove mgr parameter and debug logging from drm_dp_get_vc_payload_bw() Jani Nikula
2024-12-31 15:24 ` Imre Deak
2025-01-02 10:15 ` [PATCH] " Jani Nikula
2025-01-02 11:50 ` Jani Nikula [this message]
2024-12-19 21:33 ` [PATCH v2 02/16] drm/i915/mst: drop connector parameter from intel_dp_mst_bw_overhead() Jani Nikula
2024-12-31 15:26 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 03/16] drm/i915/mst: drop connector parameter from intel_dp_mst_compute_m_n() Jani Nikula
2024-12-31 15:27 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 04/16] drm/i915/mst: change return value of mst_stream_find_vcpi_slots_for_bpp() Jani Nikula
2024-12-31 15:34 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 05/16] drm/i915/mst: remove crtc_state->pbn Jani Nikula
2024-12-31 15:35 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 06/16] drm/i915/mst: split out a helper for figuring out the TU Jani Nikula
2024-12-31 15:51 ` Imre Deak
2025-01-02 10:19 ` Jani Nikula
2024-12-19 21:33 ` [PATCH v2 07/16] drm/i915/mst: adapt intel_dp_mtp_tu_compute_config() for 128b/132b SST Jani Nikula
2024-12-31 16:16 ` Imre Deak
2025-01-02 10:30 ` Jani Nikula
2025-01-02 13:40 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 08/16] drm/i915/ddi: enable 128b/132b TRANS_DDI_FUNC_CTL mode for UHBR SST Jani Nikula
2024-12-31 16:21 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 09/16] drm/i915/ddi: 128b/132b SST also needs DP_TP_CTL_MODE_MST Jani Nikula
2024-12-31 16:27 ` Imre Deak
2024-12-19 21:33 ` [PATCH v2 10/16] drm/i915/ddi: write payload for 128b/132b SST Jani Nikula
2024-12-31 16:41 ` Imre Deak
2025-01-02 10:52 ` Jani Nikula
2025-01-02 13:54 ` Imre Deak
2024-12-19 21:34 ` [PATCH v2 11/16] drm/i915/ddi: initialize 128b/132b SST DP2 VFREQ registers Jani Nikula
2024-12-31 16:44 ` Imre Deak
2024-12-31 16:52 ` Imre Deak
2025-01-02 9:39 ` Jani Nikula
2025-01-02 12:09 ` Imre Deak
2024-12-19 21:34 ` [PATCH v2 12/16] drm/i915/ddi: enable ACT handling for 128b/132b SST Jani Nikula
2025-01-02 15:59 ` Imre Deak
2024-12-19 21:34 ` [PATCH v2 13/16] drm/i915/ddi: start distinguishing 128b/132b SST and MST at state readout Jani Nikula
2025-01-02 14:41 ` Imre Deak
2025-01-03 11:30 ` Jani Nikula
2024-12-19 21:34 ` [PATCH v2 14/16] drm/i915/ddi: handle 128b/132b SST in intel_ddi_read_func_ctl() Jani Nikula
2025-01-02 14:45 ` Imre Deak
2024-12-19 21:34 ` [PATCH v2 15/16] drm/i915/ddi: disable trancoder port select for 128b/132b SST Jani Nikula
2025-01-02 15:03 ` Imre Deak
2024-12-19 21:34 ` [PATCH v2 16/16] drm/i915/dp: compute config for 128b/132b SST w/o DSC Jani Nikula
2025-01-02 15:13 ` Imre Deak
2025-01-03 11:35 ` Jani Nikula
2025-02-04 15:38 ` Imre Deak
2025-02-04 15:50 ` Jani Nikula
2024-12-19 21:40 ` ✓ CI.Patch_applied: success for drm/i915/dp: 128b/132b uncompressed SST (rev2) Patchwork
2024-12-19 21:41 ` ✗ CI.checkpatch: warning " Patchwork
2024-12-19 21:42 ` ✓ CI.KUnit: success " Patchwork
2024-12-19 22:00 ` ✓ CI.Build: " Patchwork
2024-12-19 22:02 ` ✓ CI.Hooks: " Patchwork
2024-12-19 22:04 ` ✗ CI.checksparse: warning " Patchwork
2024-12-19 22:43 ` ✓ Xe.CI.BAT: success " Patchwork
2024-12-20 22:05 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-02 10:23 ` ✓ CI.Patch_applied: success for drm/i915/dp: 128b/132b uncompressed SST (rev3) Patchwork
2025-01-02 10:24 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-02 10:25 ` ✓ CI.KUnit: success " Patchwork
2025-01-02 10:43 ` ✓ CI.Build: " Patchwork
2025-01-02 10:45 ` ✓ CI.Hooks: " Patchwork
2025-01-02 10:47 ` ✗ CI.checksparse: warning " Patchwork
2025-01-02 11:21 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-02 12:47 ` ✗ Xe.CI.Full: failure " 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=871pxlo2ol.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).