Commit graph

27 commits

Author SHA1 Message Date
Mohamed Ahmed
146a64524d nouveau/mme: Add unit tests for sharing between compute and 3D scratch registers
Co-developed-by: Mary Guillemard <mary@mary.zone>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Tested-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37671>
2025-10-11 16:58:24 +00:00
Mel Henning
f8b269e799 nouveau/headers: Use previous method for default
If a given generation hasn't removed any methods, then the default case
can defer to the previous generation without changing the output at all.

Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37475>
2025-09-26 19:40:47 +00:00
Mel Henning
246b96829f nouveau/headers: Deduplicate push dump impls
Note that this changes the output so it lists the method as being in the
class where it most recently changed rather than always in the class of
the running gpu. Personally, I find this more useful than the old
behavior.

Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37475>
2025-09-26 19:40:47 +00:00
Mel Henning
e471f20587 nouveau/headers: Split out "cases" in template
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37475>
2025-09-26 19:40:46 +00:00
Mel Henning
7b8017a4b4 nouveau/headers: Mark vk_push_print as cold
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37475>
2025-09-26 19:40:45 +00:00
Mary Guillemard
8b87207135 nouveau/headers: Mark SET_POINT_SIZE as using float
Signed-off-by: Mary Guillemard <mary@mary.zone>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36093>
2025-08-23 10:38:01 +00:00
Faith Ekstrand
7b362ee979 nouveau/class_parser: Add a helper for address expression filtering
This makes it more clear since it's no longer baked into the Rust
codegen.  The new one is also probably a little safer since it doesn't
blindly delete all parens.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36849>
2025-08-20 17:06:50 +00:00
Faith Ekstrand
8680bf0cb1 nouveau/class_parser: Stop shifting by zero
This a clippy warning and generates piles of spam

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36849>
2025-08-20 17:06:50 +00:00
Daniel Almeida
03d79bc09d nouveau/headers: Import the video class headers from NVIDIA
From open-gpu-doc commit c8607fe576b5 ("Add hopper and blackwell
dma-copy class header files").

Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36641>
2025-08-07 20:09:10 +00:00
Faith Ekstrand
31a6e80bb3 nouveau/class_parser: Strip unnecessary parens
Some of the headers (video is a particularly egregious culprit) wrap
defined values in parens, even when they don't need to be.  This changes
the parser to up-front strip all outer pairs of parens to get us down to
the original value.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36641>
2025-08-07 20:09:10 +00:00
Faith Ekstrand
38e871f2e3 nouveau/headers: Skip duplicate enumerants in rust enums and switches
Newer generation copy headers (including Turing) have a few enums with
more than one enumerant having the same value.  Skip these in the
printer and in the Rust bindings.

Cc: 25.2
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36251>
2025-07-21 14:49:42 +00:00
Mel Henning
d43552d365 nouveau/headers: Re-enable rustfmt
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This time we run it on each output file individually.

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36121>
2025-07-14 22:02:42 +00:00
Mel Henning
5e2eea81b9 nouveau/headers: Factor out write_template
This code was copied across each of the scripts.

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36121>
2025-07-14 22:02:42 +00:00
Mel Henning
ad7a5ddfb0 nouveau/headers: Move use statements into template
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36121>
2025-07-14 22:02:42 +00:00
Dave Airlie
153dc0f406 nouveau/headers: add a single field to skip parsing headers.
Newer headers have 2 fields at 0 for one value, just ignore one
for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35484>
2025-06-26 19:21:54 +00:00
Dave Airlie
693b55a4af nouveau/headers: Add stub blackwell class headers
These just have the class define.  We'll replace them with the actual
headers from NVIDIA once we have them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34910>
2025-05-15 00:11:07 +00:00
Faith Ekstrand
da0156be1f nouveau/headers: Re-use Rust method types when possible
We detect whenever a method hasn't changed from one generation to the
next and just `pub use` the older generation's method struct and any
enum types associated.  This keeps each mthd module independently usable
with all necessary types while reducing the number of unique Rust types
and associated trait implementations generated.  This drops the size of
libnvidia_headers.rlib from 84 MiB to 22 MiB and will hopefully make
Rust code a little less expensive to build.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34136>
2025-03-27 15:28:12 +00:00
Faith Ekstrand
e58dd75c0f nouveau/headers: Drop double-underscore from Rust names
There are a couple of these in thea headers and they cause Rust to throw
warnings.  Just fix them instead of disabling the Rust warning.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34136>
2025-03-27 15:28:12 +00:00
Faith Ekstrand
51da40d0db nouveau/headers: Drop unused Rust constants
The only users of the Rust crate use the structs and Mthd impls.  This
reduces the size of libnouveau_headers.rlib from 99 MiB to 84 MiB.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34136>
2025-03-27 15:28:12 +00:00
Faith Ekstrand
5cbf7f5bd7 nouveau/headers: Refactor class_parser
This adds proper Method and Field classes and uses them instead of
the pile of dictionaries we had before.  This is probably faster and
definitely more readable.  I've verified with cl9097.h that this makes
no differenct to the generated C or Rust besides whitespace.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34136>
2025-03-27 15:28:12 +00:00
Faith Ekstrand
279cebf726 nouveau/class_parser: Add more method arrays
A bunch of FSR stuff is arrays.  While we're at it, add a handful of
other things I've seen in blob traces.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31585>
2024-10-10 23:16:57 +00:00
Daniel Almeida
63770a163a nouveau/headers: Add a Rust struct for each method
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28255>
2024-07-20 16:36:30 +00:00
Faith Ekstrand
cda0d6331b nouveau/class_parser.py: Fix the docs for --out-rs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28655>
2024-05-06 22:59:54 +00:00
Faith Ekstrand
56aefac615 nouveau/headers: Add initial Rust bindings
This adds the infrastructure for the nvidia_headers crate.  It currently
only has declarations for the texture headers but QMDs should be trivial
to add as well.  The plan is to organize it as follows:

crate nvidia_headers {
    mod cl9097 {
        // Methods
        mod tex {
            // Texture defines
        }
    }
    mod clc5c0 {
        // Methods
        mod qmd {
            // QMD defines
        }
    }
}

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand
53bc795616 nouveau: Use hyphenated arguments to class_parser.py
This is more consistent with other code generators in Mesa.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Mary Guillemard
d9cd3e4c55 nouveau: nvidia-headers: Add compute array parsing to class_parser.py
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27126>
2024-01-17 21:26:07 +00:00
Faith Ekstrand
ec345567ad nouveau: Rename nvidia-headers to headers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26507>
2023-12-05 03:53:01 +00:00
Renamed from src/nouveau/nvidia-headers/class_parser.py (Browse further)