2023-09-12 11:05:01

by Tomasz Figa

[permalink] [raw]
Subject: Re: [EXT] Re: [PATCH] media: videobuf2-dma-sg: limit the sg segment size

On Tue, Sep 12, 2023 at 4:43 PM Hui Fang <[email protected]> wrote:
>
> On Tue, Sep 12, 2023 at 4:11 PM Tomasz Figa <[email protected]> wrote:
> > Is your DMA device restricted only to the bottom-most 4 GB (32-bit DMA
> > address)? If yes, would it make sense to also allocate from that area rather
> > than bouncing the memory?
>
> The DMA device use 32-bit DMA address.
> From user space, can't control the v4l2 buffer address, may still change the
> code of vb2_dma_sg_alloc().

Right. You may want to try modifying vb2_dma_sg_alloc_compacted() to
use dma_alloc_pages() instead of alloc_pages().

Best regards,
Tomasz


2023-09-13 13:24:41

by Hui Fang

[permalink] [raw]
Subject: RE: [EXT] Re: [PATCH] media: videobuf2-dma-sg: limit the sg segment size

On Tue, Sep 12, 2023 at 16:52 PM Tomasz Figa <[email protected]> wrote:
> Right. You may want to try modifying vb2_dma_sg_alloc_compacted() to use
> dma_alloc_pages() instead of alloc_pages().

Thanks for your suggestion, it works. And it's a better resolution since no need
an extra copy from high buffer to low buffer.

BRs,
Fang Hui

2023-09-13 23:35:40

by Tomasz Figa

[permalink] [raw]
Subject: Re: [EXT] Re: [PATCH] media: videobuf2-dma-sg: limit the sg segment size

On Wed, Sep 13, 2023 at 6:14 PM Hui Fang <[email protected]> wrote:
>
> On Tue, Sep 12, 2023 at 16:52 PM Tomasz Figa <[email protected]> wrote:
> > Right. You may want to try modifying vb2_dma_sg_alloc_compacted() to use
> > dma_alloc_pages() instead of alloc_pages().
>
> Thanks for your suggestion, it works. And it's a better resolution since no need
> an extra copy from high buffer to low buffer.

Great to hear! Could you submit a patch? Would appreciate adding

Suggested-by: Tomasz Figa <[email protected]>

above the Signed-off-by line if you don't mind. Thanks.

Best regards,
Tomasz