[PATCH v9 02/13] drm/mediatek: Implement Display Stream Compression support
AngeloGioacchino Del Regno
angelogioacchino.delregno at collabora.com
Mon Sep 21 03:05:59 PDT 2026
On 9/19/26 08:52, Chaoyi Chen wrote:
> Hi,
>
> On 9/16/2026 7:08 PM, AngeloGioacchino Del Regno wrote:
>> Add a real driver for the Display Stream Compression (DSC) Display
>> Controller IP, implementing support for DSC v1.1 to v1.2.
>>
>> In order to do this, it was necessary to remove the basic DSC IP
>> bypass setup from mtk_ddp_comp: this functionality is retained in
>> the new mtk_disp_dsc driver, which checks if DSC was actually
>> requested by other components (with the only one that currently
>> supports this being DSI) and, if not, it will set BYPASS mode in
>> the DSC IP.
>>
>> Like before, the BYPASS mode is set before starting the DSC IP,
>> but unlike before, this is being done in the component start
>> callback instead of the config one.
>> Notably, the config callback is called by mtk_crtc always
>> immediately before the calling start callback, so the order of
>> register writes is retained.
>> The only real difference is that now this is being done through
>> CPU writes instead of CMDQ, but since that's called only once
>> and since it's just three registers, the performance impact will
>> not be minimal and not even measurable.
>>
>> As anticipated, DSC handling was also introduced in the mtk_dsi
>> driver: when performing dsi_host_attach, the driver now checks
>> if the DSI panel adds the DSC configuration structure to the
>> mipi_dsi_device structure and, if it does, it will store a
>> pointer in the driver-local mtk_dsi structure's `dsc` member.
>>
>> The DSI driver will then check whether the DSC configuration
>> that comes from the panel is valid (in regard to MediaTek DSI)
>> and will call the DRM API's DSC helpers to calculate and set
>> all of the const and RC parameters for the actual DSC setup.
>>
>> For the time being, even though the latest MediaTek SoCs do
>> support DSC v1.2, only DSC v1.1 pre-scr support is implemented
>> as an initial contribution (which is rather big, and 1.2 would
>> make it even bigger - but that can anyway be implemented later).
>>
>> As a last step for validation of DSC parameters in DSI, a check
>> for the hdisplay against DSC slice sidth and one for vdisplay
>> against DSC slice height was added to the mode_valid callback,
>> making sure that H/V are, as expected, multiples of slice W/H.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
>> ---
>> drivers/gpu/drm/mediatek/Makefile | 1 +
>> drivers/gpu/drm/mediatek/mtk_crtc.c | 21 ++
>> drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 43 +--
>> drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 9 +
>> drivers/gpu/drm/mediatek/mtk_disp_drv.h | 8 +
>> drivers/gpu/drm/mediatek/mtk_disp_dsc.c | 449 ++++++++++++++++++++++++
>> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +
>> drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 +
>> drivers/gpu/drm/mediatek/mtk_dsi.c | 151 +++++++-
>> 9 files changed, 635 insertions(+), 50 deletions(-)
>> create mode 100644 drivers/gpu/drm/mediatek/mtk_disp_dsc.c
>>
>
> [...]
>
>> +
>> + dsc->simple_422 = false;
>> + dsc->convert_rgb = true;
>> + dsc->vbr_enable = false;
>> +
>> + drm_dsc_set_const_params(dsc);
>> + drm_dsc_set_rc_buf_thresh(dsc);
>> +
>> + ret = drm_dsc_setup_rc_params(dsc, DRM_DSC_1_2_444);
>> + if (ret) {
>> + dev_err(dev, "Cannot find DSC RC params\n");
>> + return ret;
>> + }
>> +
>
> Just out of curiosity, is there a reason the DSC v1.1 rc parameters
> aren't used here?
>
I was using the v1.1 RC parameters before, but Nikolai found out that some panels
actually require that, even when v1.2 support is not declared.
Besides, he also validated that v1.2 works for him, and works for me as well, so
I opted to use those ones instead, as the v1.1 pre_scr params were working for me
but not for him.
This will be improved in the future, as choosing any of the two will leave us with
something working and something broken... but I plan to make those improvements
only after at least this basic support finds his way upstream.
Cheers,
Angelo
More information about the linux-arm-kernel
mailing list