Re: Try to address the DMA-buf coherency problem

2023-01-05 Thread Sebastian Wick
On Fri, Dec 9, 2022 at 11:28 AM Christian König wrote: > > Am 09.12.22 um 09:26 schrieb Tomasz Figa: > > [SNIP] > > Although I think the most common case on mainstream Linux today is > > properly allocating for device X (e.g. V4L2 video decoder or DRM-based > > GPU) and hoping that other devices

Re: [Linaro-mm-sig] Re: Try to address the DMA-buf coherency problem

2023-01-05 Thread Daniel Vetter
On Fri, Dec 09, 2022 at 12:07:49PM -0500, Alex Deucher wrote: > On Fri, Dec 9, 2022 at 4:32 AM Pekka Paalanen wrote: > > > > On Fri, 9 Dec 2022 17:26:06 +0900 > > Tomasz Figa wrote: > > > > > On Mon, Dec 5, 2022 at 5:29 PM Christian König > > > wrote: > > > > > > > > Hi Tomasz, > > > > > > > >

Re: Try to address the DMA-buf coherency problem

2023-01-05 Thread Daniel Vetter
On Fri, Dec 02, 2022 at 04:27:08PM +0100, Christian König wrote: > Am 30.11.22 um 11:30 schrieb Daniel Vetter: > > On Fri, Nov 25, 2022 at 11:40:04AM -0500, Nicolas Dufresne wrote: > > > Le mercredi 23 novembre 2022 à 17:33 +0100, Daniel Vetter a écrit : > > > > On Wed, Nov 23, 2022 at 10:33:38AM

Re: Try to address the DMA-buf coherency problem

2022-12-12 Thread Christian König
Am 12.12.22 um 04:00 schrieb Tomasz Figa: [SNIP] What we could do is to force all exporters to use begin/end_cpu_access() even on it's own buffers and look at all the importers when the access is completed. But that would increase the complexity of the handling in the exporter. I feel like

Re: Try to address the DMA-buf coherency problem

2022-12-11 Thread Tomasz Figa
On Fri, Dec 9, 2022 at 6:32 PM Pekka Paalanen wrote: > > On Fri, 9 Dec 2022 17:26:06 +0900 > Tomasz Figa wrote: > > > On Mon, Dec 5, 2022 at 5:29 PM Christian König > > wrote: > > > > > > Hi Tomasz, > > > > > > Am 05.12.22 um 07:41 schrieb Tomasz Figa: > > > > [SNIP] > > > >> In other words

Re: Try to address the DMA-buf coherency problem

2022-12-11 Thread Tomasz Figa
On Fri, Dec 9, 2022 at 7:27 PM Christian König wrote: > > Am 09.12.22 um 09:26 schrieb Tomasz Figa: [snip] > Yes, same what Daniel said as well. We need to provide some more hints > which allocator to use from the kernel. > > >> So if a device driver uses cached system memory on an

Re: Try to address the DMA-buf coherency problem

2022-12-09 Thread Alex Deucher
On Fri, Dec 9, 2022 at 4:32 AM Pekka Paalanen wrote: > > On Fri, 9 Dec 2022 17:26:06 +0900 > Tomasz Figa wrote: > > > On Mon, Dec 5, 2022 at 5:29 PM Christian König > > wrote: > > > > > > Hi Tomasz, > > > > > > Am 05.12.22 um 07:41 schrieb Tomasz Figa: > > > > [SNIP] > > > >> In other words

Re: Try to address the DMA-buf coherency problem

2022-12-09 Thread Christian König
Am 09.12.22 um 09:26 schrieb Tomasz Figa: [SNIP] Although I think the most common case on mainstream Linux today is properly allocating for device X (e.g. V4L2 video decoder or DRM-based GPU) and hoping that other devices would accept the buffers just fine, which isn't a given on most platforms

Re: Try to address the DMA-buf coherency problem

2022-12-09 Thread Pekka Paalanen
On Fri, 9 Dec 2022 17:26:06 +0900 Tomasz Figa wrote: > On Mon, Dec 5, 2022 at 5:29 PM Christian König > wrote: > > > > Hi Tomasz, > > > > Am 05.12.22 um 07:41 schrieb Tomasz Figa: > > > [SNIP] > > >> In other words explicit ownership transfer is not something we would > > >> want as

Re: Try to address the DMA-buf coherency problem

2022-12-09 Thread Tomasz Figa
On Mon, Dec 5, 2022 at 5:29 PM Christian König wrote: > > Hi Tomasz, > > Am 05.12.22 um 07:41 schrieb Tomasz Figa: > > [SNIP] > >> In other words explicit ownership transfer is not something we would > >> want as requirement in the framework, cause otherwise we break tons of > >> use cases which

Re: Try to address the DMA-buf coherency problem

2022-12-06 Thread Christian König
Am 06.12.22 um 19:26 schrieb Nicolas Dufresne: Le lundi 05 décembre 2022 à 09:28 +0100, Christian König a écrit : Hi Tomasz, Am 05.12.22 um 07:41 schrieb Tomasz Figa: [SNIP] In other words explicit ownership transfer is not something we would want as requirement in the framework, cause

Re: Try to address the DMA-buf coherency problem

2022-12-06 Thread Nicolas Dufresne
Le lundi 05 décembre 2022 à 09:28 +0100, Christian König a écrit : > Hi Tomasz, > > Am 05.12.22 um 07:41 schrieb Tomasz Figa: > > [SNIP] > > > In other words explicit ownership transfer is not something we would > > > want as requirement in the framework, cause otherwise we break tons of > > >

Re: Try to address the DMA-buf coherency problem

2022-12-05 Thread Christian König
Hi Tomasz, Am 05.12.22 um 07:41 schrieb Tomasz Figa: [SNIP] In other words explicit ownership transfer is not something we would want as requirement in the framework, cause otherwise we break tons of use cases which require concurrent access to the underlying buffer. When a device driver

Re: Try to address the DMA-buf coherency problem

2022-12-04 Thread Tomasz Figa
Hi Christian, On Thu, Nov 17, 2022 at 9:11 PM Christian König wrote: > > Hi Tomasz, > > Am 17.11.22 um 10:35 schrieb Tomasz Figa: > > Hi Christian and everyone, > > > > On Thu, Nov 3, 2022 at 4:14 AM Christian König > > wrote: > >> Am 02.11.22 um 18:10 schrieb Lucas Stach: > >>> Am Mittwoch,

Re: Try to address the DMA-buf coherency problem

2022-12-02 Thread Christian König
Am 30.11.22 um 11:30 schrieb Daniel Vetter: On Fri, Nov 25, 2022 at 11:40:04AM -0500, Nicolas Dufresne wrote: Le mercredi 23 novembre 2022 à 17:33 +0100, Daniel Vetter a écrit : On Wed, Nov 23, 2022 at 10:33:38AM +0200, Pekka Paalanen wrote: On Tue, 22 Nov 2022 18:33:59 +0100 Christian König

Re: Try to address the DMA-buf coherency problem

2022-11-30 Thread Daniel Vetter
On Fri, Nov 25, 2022 at 11:40:04AM -0500, Nicolas Dufresne wrote: > Le mercredi 23 novembre 2022 à 17:33 +0100, Daniel Vetter a écrit : > > On Wed, Nov 23, 2022 at 10:33:38AM +0200, Pekka Paalanen wrote: > > > On Tue, 22 Nov 2022 18:33:59 +0100 > > > Christian König wrote: > > > > > > > We

Re: Try to address the DMA-buf coherency problem

2022-11-25 Thread Nicolas Dufresne
Le mercredi 23 novembre 2022 à 17:33 +0100, Daniel Vetter a écrit : > On Wed, Nov 23, 2022 at 10:33:38AM +0200, Pekka Paalanen wrote: > > On Tue, 22 Nov 2022 18:33:59 +0100 > > Christian König wrote: > > > > > We should have come up with dma-heaps earlier and make it clear that > > > exporting

Re: Try to address the DMA-buf coherency problem

2022-11-23 Thread Daniel Vetter
On Wed, Nov 23, 2022 at 10:33:38AM +0200, Pekka Paalanen wrote: > On Tue, 22 Nov 2022 18:33:59 +0100 > Christian König wrote: > > > We should have come up with dma-heaps earlier and make it clear that > > exporting a DMA-buf from a device gives you something device specific > > which might or

Re: Try to address the DMA-buf coherency problem

2022-11-23 Thread Pekka Paalanen
On Tue, 22 Nov 2022 18:33:59 +0100 Christian König wrote: > We should have come up with dma-heaps earlier and make it clear that > exporting a DMA-buf from a device gives you something device specific > which might or might not work with others. > > Apart from that I agree, DMA-buf should be

Re: Try to address the DMA-buf coherency problem

2022-11-22 Thread Daniel Vetter
On Tue, 22 Nov 2022 at 18:34, Christian König wrote: > Am 22.11.22 um 15:36 schrieb Daniel Vetter: > > On Fri, Nov 18, 2022 at 11:32:19AM -0800, Rob Clark wrote: > >> On Thu, Nov 17, 2022 at 7:38 AM Nicolas Dufresne > >> wrote: > >>> Le jeudi 17 novembre 2022 à 13:10 +0100, Christian König a

Re: Try to address the DMA-buf coherency problem

2022-11-22 Thread Christian König
Am 22.11.22 um 15:36 schrieb Daniel Vetter: On Fri, Nov 18, 2022 at 11:32:19AM -0800, Rob Clark wrote: On Thu, Nov 17, 2022 at 7:38 AM Nicolas Dufresne wrote: Le jeudi 17 novembre 2022 à 13:10 +0100, Christian König a écrit : DMA-Buf let's the exporter setup the DMA addresses the importer

Re: Try to address the DMA-buf coherency problem

2022-11-22 Thread Daniel Vetter
On Fri, Nov 18, 2022 at 11:32:19AM -0800, Rob Clark wrote: > On Thu, Nov 17, 2022 at 7:38 AM Nicolas Dufresne wrote: > > > > Le jeudi 17 novembre 2022 à 13:10 +0100, Christian König a écrit : > > > > > DMA-Buf let's the exporter setup the DMA addresses the importer uses > > > > > to > > > > > be

Re: Try to address the DMA-buf coherency problem

2022-11-19 Thread Nicolas Dufresne
Le vendredi 18 novembre 2022 à 11:32 -0800, Rob Clark a écrit : > On Thu, Nov 17, 2022 at 7:38 AM Nicolas Dufresne wrote: > > > > Le jeudi 17 novembre 2022 à 13:10 +0100, Christian König a écrit : > > > > > DMA-Buf let's the exporter setup the DMA addresses the importer uses > > > > > to > > >

Re: Try to address the DMA-buf coherency problem

2022-11-18 Thread Rob Clark
On Thu, Nov 17, 2022 at 7:38 AM Nicolas Dufresne wrote: > > Le jeudi 17 novembre 2022 à 13:10 +0100, Christian König a écrit : > > > > DMA-Buf let's the exporter setup the DMA addresses the importer uses to > > > > be able to directly decided where a certain operation should go. E.g. we > > > >

Re: Try to address the DMA-buf coherency problem

2022-11-17 Thread Nicolas Dufresne
Le jeudi 17 novembre 2022 à 13:10 +0100, Christian König a écrit : > > > DMA-Buf let's the exporter setup the DMA addresses the importer uses to > > > be able to directly decided where a certain operation should go. E.g. we > > > have cases where for example a P2P write doesn't even go to memory,

Re: Try to address the DMA-buf coherency problem

2022-11-17 Thread Christian König
Hi Tomasz, Am 17.11.22 um 10:35 schrieb Tomasz Figa: Hi Christian and everyone, On Thu, Nov 3, 2022 at 4:14 AM Christian König wrote: Am 02.11.22 um 18:10 schrieb Lucas Stach: Am Mittwoch, dem 02.11.2022 um 13:21 +0100 schrieb Christian König: [SNIP] It would just be doing this for the

Re: Try to address the DMA-buf coherency problem

2022-11-17 Thread Tomasz Figa
Hi Christian and everyone, On Thu, Nov 3, 2022 at 4:14 AM Christian König wrote: > > Am 02.11.22 um 18:10 schrieb Lucas Stach: > > Am Mittwoch, dem 02.11.2022 um 13:21 +0100 schrieb Christian König: > > [SNIP] > >> It would just be doing this for the importer and exactly that > >> would be bad

Re: Try to address the DMA-buf coherency problem

2022-11-04 Thread Christian König
Am 04.11.22 um 15:58 schrieb Rob Clark: On Wed, Nov 2, 2022 at 5:21 AM Christian König wrote: Hi Lucas, Am 02.11.22 um 12:39 schrieb Lucas Stach: Hi Christian, going to reply in more detail when I have some more time, so just some quick thoughts for now. Am Mittwoch, dem 02.11.2022 um

Re: Try to address the DMA-buf coherency problem

2022-11-04 Thread Rob Clark
On Wed, Nov 2, 2022 at 5:21 AM Christian König wrote: > > Hi Lucas, > > Am 02.11.22 um 12:39 schrieb Lucas Stach: > > Hi Christian, > > > > going to reply in more detail when I have some more time, so just some > > quick thoughts for now. > > > > Am Mittwoch, dem 02.11.2022 um 12:18 +0100 schrieb

Re: Try to address the DMA-buf coherency problem

2022-11-04 Thread Christian König
Am 04.11.22 um 14:38 schrieb Nicolas Dufresne: Le vendredi 04 novembre 2022 à 10:03 +0100, Christian König a écrit : Am 03.11.22 um 23:16 schrieb Nicolas Dufresne: [SNIP] Was there APIs suggested to actually make it manageable by userland to allocate from the GPU? Yes, this what Linux Device

Re: Try to address the DMA-buf coherency problem

2022-11-04 Thread Nicolas Dufresne
Le vendredi 04 novembre 2022 à 10:03 +0100, Christian König a écrit : > Am 03.11.22 um 23:16 schrieb Nicolas Dufresne: > > [SNIP] > > > > Was there APIs suggested to actually make it manageable by userland to > > allocate > > from the GPU? Yes, this what Linux Device Allocator idea is for. Is

Re: Try to address the DMA-buf coherency problem

2022-11-04 Thread Christian König
Am 03.11.22 um 23:16 schrieb Nicolas Dufresne: [SNIP] We already had numerous projects where we reported this practice as bugs to the GStreamer and FFMPEG project because it won't work on x86 with dGPUs. Links ? Remember that I do read every single bugs and emails around GStreamer project. I

Re: Try to address the DMA-buf coherency problem

2022-11-03 Thread Nicolas Dufresne
Le mercredi 02 novembre 2022 à 12:18 +0100, Christian König a écrit : > Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: > > [SNIP] > > > > But the client is just a video player. It doesn't understand how to > > > > allocate BOs for Panfrost or AMD or etnaviv. So without a universal > > > >

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Lucas Stach
Am Mittwoch, dem 02.11.2022 um 20:13 +0100 schrieb Christian König: > Am 02.11.22 um 18:10 schrieb Lucas Stach: > > Am Mittwoch, dem 02.11.2022 um 13:21 +0100 schrieb Christian König: > > [SNIP] > > > It would just be doing this for the importer and exactly that > > > would be bad design because

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Christian König
Am 02.11.22 um 18:10 schrieb Lucas Stach: Am Mittwoch, dem 02.11.2022 um 13:21 +0100 schrieb Christian König: [SNIP] It would just be doing this for the importer and exactly that would be bad design because we then have handling for the display driver outside of the driver. The driver would

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Lucas Stach
Am Mittwoch, dem 02.11.2022 um 13:21 +0100 schrieb Christian König: > Hi Lucas, > > Am 02.11.22 um 12:39 schrieb Lucas Stach: > > Hi Christian, > > > > going to reply in more detail when I have some more time, so just some > > quick thoughts for now. > > > > Am Mittwoch, dem 02.11.2022 um 12:18

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Christian König
Am 02.11.22 um 13:50 schrieb Pekka Paalanen: On Wed, 2 Nov 2022 13:27:18 +0100 Christian König wrote: Am 02.11.22 um 13:19 schrieb Pekka Paalanen: On Wed, 2 Nov 2022 12:18:01 +0100 Christian König wrote: Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: [SNIP] But the client is just a

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Pekka Paalanen
On Wed, 2 Nov 2022 13:27:18 +0100 Christian König wrote: > Am 02.11.22 um 13:19 schrieb Pekka Paalanen: > > On Wed, 2 Nov 2022 12:18:01 +0100 > > Christian König wrote: > > > >> Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: > >>> [SNIP] > > But the client is just a video player. It

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Christian König
Am 02.11.22 um 13:19 schrieb Pekka Paalanen: On Wed, 2 Nov 2022 12:18:01 +0100 Christian König wrote: Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: [SNIP] But the client is just a video player. It doesn't understand how to allocate BOs for Panfrost or AMD or etnaviv. So without a universal

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Christian König
Hi Lucas, Am 02.11.22 um 12:39 schrieb Lucas Stach: Hi Christian, going to reply in more detail when I have some more time, so just some quick thoughts for now. Am Mittwoch, dem 02.11.2022 um 12:18 +0100 schrieb Christian König: Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: [SNIP] As far

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Pekka Paalanen
On Wed, 2 Nov 2022 12:18:01 +0100 Christian König wrote: > Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: > > [SNIP] > >>> But the client is just a video player. It doesn't understand how to > >>> allocate BOs for Panfrost or AMD or etnaviv. So without a universal > >>> allocator (again ...),

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Lucas Stach
Hi Christian, going to reply in more detail when I have some more time, so just some quick thoughts for now. Am Mittwoch, dem 02.11.2022 um 12:18 +0100 schrieb Christian König: > Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: > > [SNIP] > > > > But the client is just a video player. It doesn't

Re: Try to address the DMA-buf coherency problem

2022-11-02 Thread Christian König
Am 01.11.22 um 22:09 schrieb Nicolas Dufresne: [SNIP] But the client is just a video player. It doesn't understand how to allocate BOs for Panfrost or AMD or etnaviv. So without a universal allocator (again ...), 'just allocate on the GPU' isn't a useful response to the client. Well exactly

Re: Try to address the DMA-buf coherency problem

2022-11-01 Thread Nicolas Dufresne
Le mardi 01 novembre 2022 à 18:40 +0100, Christian König a écrit : > Am 28.10.22 um 20:47 schrieb Daniel Stone: > > Hi Christian, > > > > On Fri, 28 Oct 2022 at 18:50, Christian König > > wrote: > > > Am 28.10.22 um 17:46 schrieb Nicolas Dufresne: > > > > Though, its not generically possible to

Re: Try to address the DMA-buf coherency problem

2022-11-01 Thread Christian König
Am 28.10.22 um 20:47 schrieb Daniel Stone: Hi Christian, On Fri, 28 Oct 2022 at 18:50, Christian König wrote: Am 28.10.22 um 17:46 schrieb Nicolas Dufresne: Though, its not generically possible to reverse these roles. If you want to do so, you endup having to do like Android (gralloc) and

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Daniel Stone
Hi Christian, On Fri, 28 Oct 2022 at 18:50, Christian König wrote: > Am 28.10.22 um 17:46 schrieb Nicolas Dufresne: > > Though, its not generically possible to reverse these roles. If you want to > > do > > so, you endup having to do like Android (gralloc) and ChromeOS (minigbm), > > because

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Christian König
Hi Nicolas, Am 28.10.22 um 17:46 schrieb Nicolas Dufresne: Hi, just dropping some real live use case, sorry I'm not really proposing solutions, I believe you are much more knowledgeable in this regard. Well, I think each of us has a lot of specialized knowledge. For example I don't know to

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Nicolas Dufresne
Hi, just dropping some real live use case, sorry I'm not really proposing solutions, I believe you are much more knowledgeable in this regard. Le vendredi 28 octobre 2022 à 16:26 +0200, Christian König a écrit : > Am 28.10.22 um 13:42 schrieb Lucas Stach: > > Am Freitag, dem 28.10.2022 um 10:40

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Christian König
Am 28.10.22 um 13:42 schrieb Lucas Stach: Am Freitag, dem 28.10.2022 um 10:40 +0200 schrieb Christian König: But essentially the right thing to do. The only alternative I can see is to reverse the role of exporter and importer. I don't think that would work generally either, as buffer

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Lucas Stach
Am Freitag, dem 28.10.2022 um 10:40 +0200 schrieb Christian König: > Hi Lucas, > > Am 28.10.22 um 10:09 schrieb Lucas Stach: > > Hi Christian, > > > > Am Donnerstag, dem 20.10.2022 um 14:13 +0200 schrieb Christian König: > > > Hi guys, > > > > > > after finding that we essentially have two

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Christian König
Hi Lucas, Am 28.10.22 um 10:09 schrieb Lucas Stach: Hi Christian, Am Donnerstag, dem 20.10.2022 um 14:13 +0200 schrieb Christian König: Hi guys, after finding that we essentially have two separate worlds for coherent sharing of buffer through DMA-buf I thought I will tackle that problem a

Re: Try to address the DMA-buf coherency problem

2022-10-28 Thread Lucas Stach
Hi Christian, Am Donnerstag, dem 20.10.2022 um 14:13 +0200 schrieb Christian König: > Hi guys, > > after finding that we essentially have two separate worlds for coherent > sharing > of buffer through DMA-buf I thought I will tackle that problem a bit and at > least allow the framework to

Re: Try to address the DMA-buf coherency problem

2022-10-27 Thread Christian König
Am 20.10.22 um 14:13 schrieb Christian König: Hi guys, after finding that we essentially have two separate worlds for coherent sharing of buffer through DMA-buf I thought I will tackle that problem a bit and at least allow the framework to reject attachments which won't work. So those patches

Try to address the DMA-buf coherency problem

2022-10-20 Thread Christian König
Hi guys, after finding that we essentially have two separate worlds for coherent sharing of buffer through DMA-buf I thought I will tackle that problem a bit and at least allow the framework to reject attachments which won't work. So those patches here add a new dma_coherent flag to each DMA-buf