media: ti: j721e-csi2rx: Allow passing cache hints from user-space
Subsystems (2)
PATCH 1/1 media: ti: j721e-csi2rx: Allow passing cache hints from user-space
User-space can provide cache hints to enable software managed cache operations or skip certain cache operations using memory flags and buffer flags. This is useful for SoCs such as AM62px which do not support hardware cache coherency.
This is tested on AM62px with yavta capture by passing V4L2_MEMORY_FLAG_NON_COHERENT while using VIDIOC_REQBUFS and V4L2_BUF_FLAG_NO_CACHE_CLEAN while using VIDIOC_QBUF and ~5x reduction in memcpy time is seen for copying captured frame to DDR as shared here [1].
[1]:
--- drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +1 -0
@@ -895,6 +895,7 @@ static int ti_csi2rx_init_vb2q(struct ti_csi2rx_dev *csi) q->dev =dmaengine_get_dma_device (csi->dma.chan); q->lock = &csi->mutex; q->min_queued_buffers =1 ; + q->allow_cache_hints =1 ; ret =vb2_queue_init (q);if (ret)
Signature · 1 line
2.39.1
Hi Devarsh,
Thanks for the patch.
Quoted 5 lines · Devarsh Thakkar
User-space can provide cache hints to enable software managed cache operations or skip certain cache operations using memory flags and buffer flags. This is useful for SoCs such as AM62px which do not support hardware cache coherency.
Quoted 7 lines
This is tested on AM62px with yavta capture by passing
V4L2_MEMORY_FLAG_NON_COHERENTwhile usingVIDIOC_REQBUFSandV4L2_BUF_FLAG_NO_CACHE_CLEANwhile usingVIDIOC_QBUFand ~5x reduction in memcpy time is seen for copying captured frame to DDR as shared here [1].[1]:
nit: might be cleaner to drop the "[1]" reference as a single Link tag is pretty unambiguous.
But in any case,
Quoted 20 lines
Signed-off-by Devarsh Thakkar <[email protected]>--- drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 1 + 1 file changed, 1 insertion(+)drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +1
-0@@ -895,6 +895,7 @@ static int ti_csi2rx_init_vb2q(struct ti_csi2rx_dev *csi) q->dev =dmaengine_get_dma_device (csi->dma.chan); q->lock = &csi->mutex; q->min_queued_buffers =1 ; + q->allow_cache_hints =1 ; ret =vb2_queue_init (q);if (ret)Signature · 1 line
2.39.1
Hi Devarsh,
Thanks for the patch.
Quoted 10 lines · Devarsh Thakkar
User-space can provide cache hints to enable software managed cache operations or skip certain cache operations using memory flags and buffer flags. This is useful for SoCs such as AM62px which do not support hardware cache coherency.
This is tested on AM62px with yavta capture by passing
V4L2_MEMORY_FLAG_NON_COHERENTwhile usingVIDIOC_REQBUFSandV4L2_BUF_FLAG_NO_CACHE_CLEANwhile usingVIDIOC_QBUFand ~5x reduction in memcpy time is seen for copying captured frame to DDR as shared here [1].
The lines may be up to 75 characters long here. Most editors can handle the wrapping for you, I've rewrapped the text in this case and edited it a little, as Jai suggested.
Quoted 20 lines
[1]:
Signed-off-by Devarsh Thakkar <[email protected]>--- drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 1 + 1 file changed, 1 insertion(+)drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +1
-0@@ -895,6 +895,7 @@ static int ti_csi2rx_init_vb2q(struct ti_csi2rx_dev *csi) q->dev =dmaengine_get_dma_device (csi->dma.chan); q->lock = &csi->mutex; q->min_queued_buffers =1 ; + q->allow_cache_hints =1 ; ret =vb2_queue_init (q);if (ret)
Signature · 3 lines
Regards, Sakari Ailus