mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: raspberrypi: cfe: Fix mapping of dmabuf buffers
@ 2024-11-01 11:55 Tomi Valkeinen
  2024-11-03  0:25 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Valkeinen @ 2024-11-01 11:55 UTC (permalink / raw)
  To: Raspberry Pi Kernel Maintenance, Mauro Carvalho Chehab,
	Florian Fainelli, Broadcom internal kernel review list,
	Sakari Ailus, Naushir Patuck, Hans Verkuil, Laurent Pinchart
  Cc: Mauro Carvalho Chehab, linux-media, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, Tomi Valkeinen

When using buffers from DRM, DMA-API gives a warning about: "mapping sg
segment longer than device claims to support [len=307200] [max=65536]"

Add a call to vb2_dma_contig_set_max_seg_size() to tell the DMA-API
about the supported segment size (which is UINT_MAX).

Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
index 045910de6c57..e52d8b20df40 100644
--- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
@@ -2341,6 +2341,12 @@ static int cfe_probe(struct platform_device *pdev)
 		goto err_cfe_put;
 	}
 
+	ret = vb2_dma_contig_set_max_seg_size(&pdev->dev, UINT_MAX);
+	if (ret) {
+		dev_err(&pdev->dev, "Unable to set max_seg_size\n");
+		goto err_cfe_put;
+	}
+
 	/* TODO: Enable clock only when running. */
 	cfe->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(cfe->clk))

---
base-commit: 698b6e3163bafd61e1b7d13572e2c42974ac85ec
change-id: 20241101-rp1-cfe-fixes-seg-size-b70309da74a2

Best regards,
-- 
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: raspberrypi: cfe: Fix mapping of dmabuf buffers
  2024-11-01 11:55 [PATCH] media: raspberrypi: cfe: Fix mapping of dmabuf buffers Tomi Valkeinen
@ 2024-11-03  0:25 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2024-11-03  0:25 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Raspberry Pi Kernel Maintenance, Mauro Carvalho Chehab,
	Florian Fainelli, Broadcom internal kernel review list,
	Sakari Ailus, Naushir Patuck, Hans Verkuil,
	Mauro Carvalho Chehab, linux-media, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

Hi Tomi,

Thank you for the patch.

On Fri, Nov 01, 2024 at 01:55:15PM +0200, Tomi Valkeinen wrote:
> When using buffers from DRM, DMA-API gives a warning about: "mapping sg
> segment longer than device claims to support [len=307200] [max=65536]"
> 
> Add a call to vb2_dma_contig_set_max_seg_size() to tell the DMA-API
> about the supported segment size (which is UINT_MAX).
> 
> Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> index 045910de6c57..e52d8b20df40 100644
> --- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> +++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> @@ -2341,6 +2341,12 @@ static int cfe_probe(struct platform_device *pdev)
>  		goto err_cfe_put;
>  	}
>  
> +	ret = vb2_dma_contig_set_max_seg_size(&pdev->dev, UINT_MAX);
> +	if (ret) {
> +		dev_err(&pdev->dev, "Unable to set max_seg_size\n");

Maybe dev_err_probe() ? Or drop the error message, as
vb2_dma_contig_set_max_seg_size() already prints an error.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +		goto err_cfe_put;
> +	}
> +
>  	/* TODO: Enable clock only when running. */
>  	cfe->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(cfe->clk))
> 
> ---
> base-commit: 698b6e3163bafd61e1b7d13572e2c42974ac85ec
> change-id: 20241101-rp1-cfe-fixes-seg-size-b70309da74a2

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-03  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-01 11:55 [PATCH] media: raspberrypi: cfe: Fix mapping of dmabuf buffers Tomi Valkeinen
2024-11-03  0:25 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®