Re: [PATCH v7 19/19] gpu: drm: meson: Fix DMA segment size limits and maximize allocation boundaries

From: Nicolas Dufresne

Date: Mon Jul 13 2026 - 10:15:39 EST


Le lundi 13 juillet 2026 à 17:37 +0530, Anand Moon a écrit :
> When importing DMABUFs exported by the Amlogic video decoder driver
> (meson_vdec) for hardware-accelerated rendering paths, the DMA core
> subsystem throws constraint validation warnings. This occurs because the
> display controller master device lacks explicit DMA layout configuration,
> causing it to fall back to a default 64KB maximum segment size limit.
>
> Address these architectural constraints during the master bind sequence:
>
> 1. Initialize and validate a 32-bit coherent DMA allocation window by
>    invoking dma_set_mask_and_coherent() with a DMA_BIT_MASK(32) argument.
> 2. Maximize the contiguous scatter-gather allocation segment boundary
>    check constraint to UINT_MAX using the dma_set_max_seg_size() helper.
>
> This guarantees that large video bitstream frame buffers can be imported
> and scanned out across sub-driver domains without triggering allocation
> warnings or page boundary splits.
>
> Cc: Nicolas Dufresne <nicolas@xxxxxxxxxxxx>
> Signed-off-by: Anand Moon <linux.amoon@xxxxxxxxx>

Acked-by: Nicolas Dufresne <nicolas@xxxxxxxxxxxx>

> ---
>  drivers/gpu/drm/meson/meson_drv.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 49ff9f1f16d32..899e70bca4ce2 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -202,6 +202,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
>   if (IS_ERR(drm))
>   return PTR_ERR(drm);
>  
> + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
> + if (ret)
> + goto free_drm;
> +
> + dma_set_max_seg_size(dev, UINT_MAX);
> +
>   priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>   if (!priv) {
>   ret = -ENOMEM;

Attachment: signature.asc
Description: This is a digitally signed message part