linux/drivers/gpu/drm/msm/msm_dsc_helper.h
Marijn Suijten 14ad809ceb drm/msm/dsi: Use existing per-interface slice count in DSC timing
When configuring the timing of DSI hosts (interfaces) in
dsi_timing_setup() all values written to registers are taking
bonded-mode into account by dividing the original mode width by 2
(half the data is sent over each of the two DSI hosts), but the full
width instead of the interface width is passed as hdisplay parameter to
dsi_update_dsc_timing().

Currently only msm_dsc_get_slices_per_intf() is called within
dsi_update_dsc_timing() with the `hdisplay` argument which clearly
documents that it wants the width of a single interface (which, again,
in bonded DSI mode is half the total width of the mode) resulting in all
subsequent values to be completely off.

However, as soon as we start to pass the halved hdisplay
into dsi_update_dsc_timing() we might as well discard
msm_dsc_get_slices_per_intf() since the value it calculates is already
available in dsc->slice_count which is per-interface by the current
design of MSM DPU/DSI implementations and their use of the DRM DSC
helpers.

Fixes: 08802f515c ("drm/msm/dsi: Add support for DSC configuration")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Patchwork: https://patchwork.freedesktop.org/patch/637648/
Link: https://lore.kernel.org/r/20250217-drm-msm-initial-dualpipe-dsc-fixes-v3-1-913100d6103f@somainline.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2025-02-26 12:15:48 +02:00

27 lines
862 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
*
* Helper methods for MSM-specific DSC calculations that are common between timing engine,
* DSI, and DP.
*/
#ifndef MSM_DSC_HELPER_H_
#define MSM_DSC_HELPER_H_
#include <linux/math.h>
#include <drm/display/drm_dsc_helper.h>
/**
* msm_dsc_get_bytes_per_line() - calculate bytes per line
* @dsc: Pointer to drm dsc config struct
* Returns: Integer value representing bytes per line. DSI and DP need
* to perform further calculations to turn this into pclk_per_intf,
* such as dividing by different values depending on if widebus is enabled.
*/
static inline u32 msm_dsc_get_bytes_per_line(const struct drm_dsc_config *dsc)
{
return dsc->slice_count * dsc->slice_chunk_size;
}
#endif /* MSM_DSC_HELPER_H_ */