public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: l.stach@pengutronix.de, nicolas@ndufresne.ca,
	ppaalanen@gmail.com, sumit.semwal@linaro.org, daniel@ffwll.ch,
	robdclark@gmail.com, tfiga@chromium.org,
	sebastian.wick@redhat.com, hverkuil@xs4all.nl,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	linux-media@vger.kernel.org, benjamin.gaignard@collabora.com,
	lmark@codeaurora.org, labbott@redhat.com, Brian.Starkey@arm.com,
	jstultz@google.com, mchehab@kernel.org,
	James Jones <jajones@nvidia.com>
Subject: Re: DMA-heap driver hints
Date: Mon, 23 Jan 2023 15:55:42 +0200	[thread overview]
Message-ID: <Y86R3vQX+vW0+oxw@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230123123756.401692-1-christian.koenig@amd.com>

Hi Christian,

CC'ing James as I think this is related to his work on the unix device
memory allocator ([1]).

[1] https://lore.kernel.org/dri-devel/8b555674-1c5b-c791-4547-2ea7c16aee6c@nvidia.com/

On Mon, Jan 23, 2023 at 01:37:54PM +0100, Christian König wrote:
> Hi guys,
> 
> this is just an RFC! The last time we discussed the DMA-buf coherency
> problem [1] we concluded that DMA-heap first needs a better way to
> communicate to userspace which heap to use for a certain device.
> 
> As far as I know userspace currently just hard codes that information
> which is certainly not desirable considering that we should have this
> inside the kernel as well.
> 
> So what those two patches here do is to first add some
> dma_heap_create_device_link() and  dma_heap_remove_device_link()
> function and then demonstrating the functionality with uvcvideo
> driver.
> 
> The preferred DMA-heap is represented with a symlink in sysfs between
> the device and the virtual DMA-heap device node.

I'll start with a few high-level comments/questions:

- Instead of tying drivers to heaps, have you considered a system where
  a driver would expose constraints, and a heap would then be selected
  based on those constraints ? A tight coupling between heaps and
  drivers means downstream patches to drivers in order to use
  vendor-specific heaps, that sounds painful.

  A constraint-based system would also, I think, be easier to extend
  with additional constraints in the future.

- I assume some drivers will be able to support multiple heaps. How do
  you envision this being implemented ?

- Devices could have different constraints based on particular
  configurations. For instance, a device may require specific memory
  layout for multi-planar YUV formats only (as in allocating the Y and C
  planes of NV12 from different memory banks). A dynamic API may thus be
  needed (but may also be very painful to use from userspace).

> What's still missing is certainly matching userspace for this since I
> wanted to discuss the initial kernel approach first.

https://git.libcamera.org/libcamera/libcamera.git/ would be a good place
to prototype userspace support :-)

> Please take a look and comment.
> 
> Thanks,
> Christian.
> 
> [1] https://lore.kernel.org/all/11a6f97c-e45f-f24b-8a73-48d5a388a2cc@gmail.com/T/

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2023-01-23 13:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 12:37 DMA-heap driver hints Christian König
2023-01-23 12:37 ` [PATCH 1/2] dma-heap: add device link and unlink functions Christian König
2023-01-24  4:45   ` John Stultz
2023-01-23 12:37 ` [PATCH 2/2] media: uvcvideo: expose dma-heap hint to userspace Christian König
2023-01-23 14:00   ` Laurent Pinchart
2023-01-23 23:58   ` kernel test robot
2023-01-24  3:44   ` kernel test robot
2023-01-23 13:55 ` Laurent Pinchart [this message]
2023-01-23 16:29   ` DMA-heap driver hints Christian König
2023-01-23 16:58     ` Laurent Pinchart
2023-01-24  3:56       ` James Jones
2023-01-24  7:48         ` Christian König
2023-01-24 23:14           ` T.J. Mercier
2023-01-25 23:20             ` James Jones
2023-01-24  5:19     ` John Stultz
2023-01-24  7:15       ` Christian König
2023-01-25 18:59         ` John Stultz
2023-01-24  5:07   ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y86R3vQX+vW0+oxw@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Brian.Starkey@arm.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil@xs4all.nl \
    --cc=jajones@nvidia.com \
    --cc=jstultz@google.com \
    --cc=l.stach@pengutronix.de \
    --cc=labbott@redhat.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lmark@codeaurora.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=ppaalanen@gmail.com \
    --cc=robdclark@gmail.com \
    --cc=sebastian.wick@redhat.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox