[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAObsKAt563VNzDcF4rGkWPcxBPzKcq=Hj5RY6K20FWR43nvUQ@mail.gmail.com>
Date: Mon, 17 Jun 2024 19:01:05 +0200
From: Tomeu Vizoso <tomeu@...euvizoso.net>
To: Daniel Stone <daniel@...ishbar.org>
Cc: Lucas Stach <l.stach@...gutronix.de>, linux-kernel@...r.kernel.org,
Oded Gabbay <ogabbay@...nel.org>, Russell King <linux+etnaviv@...linux.org.uk>,
Christian Gmeiner <christian.gmeiner@...il.com>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, etnaviv@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, Daniel Stone <daniels@...labora.com>
Subject: Re: [PATCH] drm/etnaviv: Create an accel device node if compute-only
Hi Lucas,
Do you have any idea on how not to break userspace if we expose a render node?
Cheers,
Tomeu
On Wed, Jun 12, 2024 at 4:26 PM Tomeu Vizoso <tomeu@...euvizoso.net> wrote:
>
> On Mon, May 20, 2024 at 1:19 PM Daniel Stone <daniel@...ishbar.org> wrote:
> >
> > Hi,
> >
> > On Mon, 20 May 2024 at 08:39, Tomeu Vizoso <tomeu@...euvizoso.net> wrote:
> > > On Fri, May 10, 2024 at 10:34 AM Lucas Stach <l.stach@...gutronix.de> wrote:
> > > > Am Mittwoch, dem 24.04.2024 um 08:37 +0200 schrieb Tomeu Vizoso:
> > > > > If we expose a render node for NPUs without rendering capabilities, the
> > > > > userspace stack will offer it to compositors and applications for
> > > > > rendering, which of course won't work.
> > > > >
> > > > > Userspace is probably right in not questioning whether a render node
> > > > > might not be capable of supporting rendering, so change it in the kernel
> > > > > instead by exposing a /dev/accel node.
> > > > >
> > > > > Before we bring the device up we don't know whether it is capable of
> > > > > rendering or not (depends on the features of its blocks), so first try
> > > > > to probe a rendering node, and if we find out that there is no rendering
> > > > > hardware, abort and retry with an accel node.
> > > >
> > > > On the other hand we already have precedence of compute only DRM
> > > > devices exposing a render node: there are AMD GPUs that don't expose a
> > > > graphics queue and are thus not able to actually render graphics. Mesa
> > > > already handles this in part via the PIPE_CAP_GRAPHICS and I think we
> > > > should simply extend this to not offer a EGL display on screens without
> > > > that capability.
> > >
> > > The problem with this is that the compositors I know don't loop over
> > > /dev/dri files, trying to create EGL screens and moving to the next
> > > one until they find one that works.
> > >
> > > They take the first render node (unless a specific one has been
> > > configured), and assumes it will be able to render with it.
> > >
> > > To me it seems as if userspace expects that /dev/dri/renderD* devices
> > > can be used for rendering and by breaking this assumption we would be
> > > breaking existing software.
> >
> > Mm, it's sort of backwards from that. Compositors just take a
> > non-render DRM node for KMS, then ask GBM+EGL to instantiate a GPU
> > which can work with that. When run in headless mode, we don't take
> > render nodes directly, but instead just create an EGLDisplay or
> > VkPhysicalDevice and work backwards to a render node, rather than
> > selecting a render node and going from there.
> >
> > So from that PoV I don't think it's really that harmful. The only
> > complication is in Mesa, where it would see an etnaviv/amdgpu/...
> > render node and potentially try to use it as a device. As long as Mesa
> > can correctly skip, there should be no userspace API implications.
> >
> > That being said, I'm not entirely sure what the _benefit_ would be of
> > exposing a render node for a device which can't be used by any
> > 'traditional' DRM consumers, i.e. GL/Vulkan/winsys.
>
> What I don't understand yet from Lucas proposal is how this isn't
> going to break existing userspace.
>
> I mean, even if we find a good way of having userspace skip
> non-rendering render nodes, what about existing userspace that isn't
> able to do that? Any updates to newer kernels are going to break them.
>
> Regards,
>
> Tomeu
Powered by blists - more mailing lists