Now Reading
A Nouveau graphics driver replace [LWN.net]

A Nouveau graphics driver replace [LWN.net]

2023-12-01 16:02:11

Welcome to LWN.web

The next subscription-only content material has been made accessible to you
by an LWN subscriber. Hundreds of subscribers rely upon LWN for the
finest information from the Linux and free software program communities. Should you take pleasure in this
article, please contemplate subscribing to LWN. Thanks
for visiting LWN.web!

By Jonathan Corbet
December 1, 2023


LPC

Assist for NVIDIA graphics processors has historically been a sore level
for Linux customers; NVIDIA has not felt the necessity to cooperate with the kernel
neighborhood or make free drivers accessible, and the reverse-engineered
Nouveau driver has typically struggled to maintain up with product releases. There
have, nevertheless, been indicators of enchancment lately. On the 2023 Linux
Plumbers Conference
, graphics subsystem maintainer Dave Airlie supplied
an replace on the state of assist for NVIDIA GPUs and what stays to be
accomplished.

The kernel neighborhood’s relationship with NVIDIA “has gone up and down” over
the years, Airlie started. Lately, although, the corporate has rearchitected
its merchandise, including a big RISC-V processor (the GPU system processor, or
GSP) and transferring a lot of the performance as soon as dealt with by drivers into the
GSP firmware. The corporate permits that firmware for use by Linux and shipped
by distributors. This association brings a number of benefits; for
instance, it’s now potential for the kernel to do reclocking of NVIDIA GPUs,
operating them at full pace similar to the proprietary drivers can.
It’s, he mentioned, an enormous enchancment over the Nouveau-only firmware that was
supplied beforehand.

[Dave Airlie]

There are a variety of disadvantages too, although. The firmware supplies no
secure ABI, and plenty of the calls it supplies aren’t documented. The
firmware information themselves are massive, within the vary of 20-30MB, and two of
them are required for any given gadget. That considerably bloats a
system’s /boot listing and initramfs picture (which should present
each model of the firmware that the kernel would possibly want), and forces the
Nouveau builders to be strict and cautious about choosing up firmware
updates.

Nouveau work has taken a little bit of a setback since longtime developer Ben
Skeggs left the venture, however he did handle to do plenty of refactoring
earlier than he went. Nouveau now has preliminary GSP assist for one firmware
model; that code was merged in for the 6.7-rc1 launch. It is just
enabled for the Ada
collection of GPUs by default; with a command-line argument it may be made to
work with Turing
and Ampere
gadgets as effectively. It’s lacking some options, together with fault dealing with
(which “should not be too exhausting” so as to add) and sensor monitoring, which does not
work in any respect.

NVIDIA’s firmware, Airlie mentioned, comes with a set of are information that, in
flip, outline buildings that change over time. To take care of these modifications,
the driving force goes to want some kind of automated ABI era; he famous
that the builders engaged on the Apple M1 GPU driver have run into the
similar downside. This downside may very well be made simpler to sort out, he prompt,
if the driving force have been, just like the M1 driver, to be rewritten in Rust.

Subsequent steps

Supporting the GSP firmware is just the start, although; at this level,
Airlie took a step again and talked in regards to the activity of constructing a helpful GPU
driver typically. Years in the past, a graphics card got here with some video RAM
and a graphics
translation table (GTT)
. The driving force would map system reminiscence into the
graphics card; person area may then submit buffer handles that will be
relocated for the graphics gadget. This strategy works, he mentioned, however it’s
sluggish.

Present GPUs have full digital reminiscence, as an alternative, which saves plenty of that
overhead. The kernel has grown a lot of subsystems for working with
this digital reminiscence, together with the graphics
execution manager (GEM)
for buffer-object administration, the translation
table manager (TTM)
for discrete video-RAM buffer-object administration,
and a bunch of synchronization and fencing code. Initially, the DRM
subsystem would tie the allocation of a buffer to an allocation of digital
reminiscence on the similar time; that was straightforward to do and sufficed to implement
OpenGL. However, he mentioned, the graphics world moved on from there.

Particularly, Vulkan got here alongside. It
introduced the idea of sparse reminiscence and, with it, digital reminiscence that’s
managed by person area. Vulkan can deal with each synchronous and asynchronous
virtual-area updates, however it “will get sophisticated”. Varied drivers began
inventing their very own virtual-area administration; as a approach of bringing that work
again collectively, the VM_BIND
API was developed.

That is in keeping with a recurring sample, Airlie mentioned. The DRM
builders work to share widespread code between graphics drivers, however the
driver builders hold attempting to reinvent wheels, a bent that must be
resisted. The subsystem did effectively with regard to mode setting, he mentioned, however
much less effectively on the acceleration facet; there’s a “widespread GPU scheduler” that
is just utilized by one driver, for instance. Equally, there are plenty of
drivers implementing VM_BIND by doing their very own virtual-area administration.

In response, Airlie got here up with the “good concept” of getting someone else
to jot down a typical virtual-area supervisor, known as GPUVM, impressed by the
amdgpu code. It’s meant to be helpful for all drivers; it’s utilized by
the Nouveau, Xe (Intel’s new driver), and Panfrost drivers now. Hopefully
the amdgpu and MSM drivers will decide it up as effectively. The most effective half is that
there are a number of builders who perceive it and can assist to maintain it
from going off within the unsuitable route. GPUVM has been by way of plenty of
iterations, he mentioned, offering “plenty of studying experiences”.

For example, he talked about the issue of fence signaling. A fence
signifies when a collection of GPU operations has been accomplished; waits for
these fences should be time-bounded, or the memory-management subsystem
would possibly impasse. In brief, a GPU can simply pin down all of a system’s RAM
if given the chance. There’s a shrinker that may be known as when
reminiscence will get tight, however it must watch for fences to be signaled to
know when reminiscence may be freed. If the code that set the fence decides to
allocate extra reminiscence whereas that is occurring, a impasse outcomes.

See Also

To keep away from this final result, builders should strictly restrict the operations
that may be carried out in fence-signaling crucial sections; care should additionally
be taken earlier than buying any locks. It might be good to have the ability to replace
the web page tables throughout this code, however that bumped into impasse issues and
needed to be backed out.

Returning to Nouveau, Airlie mentioned that the preliminary VM_BIND API, utilizing
GPUVM, synchronous objects, and integration with the scheduler, was merged
for the 6.6 launch. There are plenty of enhancements within the works that
ought to land in 6.8. At this level, he mentioned, we’ve the core of a contemporary
GPU driver for NVIDIA {hardware} — for graphics, at the very least. Extra work will likely be
required earlier than Nouveau can assist compute functions.

On the user-space facet, Religion Ekstrand has been creating the NVK Vulkan
driver for Nouveau; this driver just lately reached
Vulkan 1.0 conformance
. This work concerned creating a brand new
compiler, known as NAK, that has simply been merged into Mesa; this compiler
yields much better efficiency (from 20 frames per second to over 1000) than
the previous “codegen” compiler did. Naturally, this compiler is written in
Rust. The following step, Airlie concluded, is to maneuver ahead to
Vulkan 1.3.

Video
and slides
from the discuss can be found.

[Thanks to the Linux Foundation, LWN’s travel sponsor, for supporting our
travel to this event.]




(Log in to submit feedback)

Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top