[PATCH v7 19/19] gpu: drm: meson: Fix DMA segment size limits and maximize allocation boundaries
Nicolas Dufresne
nicolas at ndufresne.ca
Mon Jul 13 07:04:02 PDT 2026
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 at ndufresne.ca>
> Signed-off-by: Anand Moon <linux.amoon at gmail.com>
Acked-by: Nicolas Dufresne <nicolas at ndufresne.ca>
> ---
> 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20260713/38c790d7/attachment.sig>
More information about the linux-amlogic
mailing list