Commit Graph

130 Commits

Author SHA1 Message Date
Faith Ekstrand
9724028c15 nil: Add a nil_sample_offset() helper
Fixes: 8f1697b12d ("nil: Use D3D sample modes by default")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31727>
2024-10-18 04:56:26 +00:00
Faith Ekstrand
8f1697b12d nil: Use D3D sample modes by default
Only the D3D modes work with RASTER_SAMPLES_MODE or with variable
shading rates.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31585>
2024-10-10 23:16:57 +00:00
Faith Ekstrand
097f8b2c7d nil: Add D3D sample layouts
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31585>
2024-10-10 23:16:57 +00:00
Faith Ekstrand
f8c0377421 nil: Add a helper to get samples from a SampleLayout
Fixes: 6a84d5439d ("nvk: Move the ANTI_ALIAS_CONTROL logic to the MME")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31585>
2024-10-10 23:16:57 +00:00
Faith Ekstrand
b99f28b7d6 nil: Add tiled memcpy helpers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30044>
2024-09-28 02:46:28 +00:00
Mohamed Ahmed
1c131de30e nil: Add level_layer_size_B() helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30044>
2024-09-28 02:46:28 +00:00
Mohamed Ahmed
7314177245 nil: Expose px_to_B helpers to C
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30044>
2024-09-28 02:46:28 +00:00
Faith Ekstrand
c6adb0ac68 nil: Add a couple Extent4D and Offset4D methods
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30044>
2024-09-28 02:46:28 +00:00
Faith Ekstrand
891d8be5ac nvk,nil: Replace gob_height_is_8 and is_tiled with a new GOBType enum
This gives us the possibility of describing other GOB formats in the
future.  This also cleans things up a bit as it replaces all of the uses
of GOB_WIDTH/DEPTH with an extent which we can change in the future.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31410>
2024-09-27 20:59:37 +00:00
Faith Ekstrand
112481d576 nil: Assert array_len == 0 in Extent4D<Bytes>::size_B()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31191>
2024-09-16 21:51:29 +00:00
Faith Ekstrand
7527b22fd6 nil: Return a more accurate size in level_size_B
This gives us the tightest bounds we can while still taking into account
all of the array and other strides.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31191>
2024-09-16 21:51:29 +00:00
Faith Ekstrand
1a50108e52 nil: Rework calculations of the sizes of miplevels
What we actually want here is the size of the 1/2/3D part of the level,
not the array part.  This means a little more code duplication but the
result is also way more clear.  This shouldn't be a functional change as
Extent4D<units::Bytes>::size_B() doesn't take array_len into account.

This means we no longer call Image::level_size_B() for layout. Instead,
Image::level_size_B() should mirror this code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31191>
2024-09-16 21:51:29 +00:00
Mohamed Ahmed
af15cceff4 nvk: Use stride in the explicit modifier case for linear images
Fixes: f1fdffa1b2 (nvk: Support image creation with modifiers)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31045>
2024-09-06 19:37:09 +00:00
Faith Ekstrand
b78a691ce2 nil,nvk: Disable modifiers for B10G11R11_UFLOAT and E5B9G9R9_UFLOAT
The CTS tests fail due to precision issues (arguably a CTS bug) but it
also doesn't make a lot of sense to advertise modifiers on them at all.

Fixes: cd428e01d7 ("nvk: Advertise VK_EXT_image_drm_format_modifier")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30861>
2024-08-27 05:33:10 +00:00
Karol Herbst
f7f343796f meson: centralize checking for new enough meson for rust support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30414>
2024-07-31 16:22:43 +00:00
Karol Herbst
03ecda08de meson: centralize rust handling
This bumps the req for everything, but I think that's fine, because one
part restricting to a lower rust version doesn't make much sense as we are
also not doing it generally for C or C++.

This also makes it easier for packagers to know what requires rust.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30414>
2024-07-31 16:22:43 +00:00
Faith Ekstrand
c8d8e2249a nil: Add a helper for populating the null descriptor
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30303>
2024-07-23 01:35:11 +00:00
Daniel Stone
e05415a82e format: Generate endian-independent format aliases
Instead of having a hardcoded list of endian-independent format aliases
in the header, generate them from the format definitions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29649>
2024-07-19 13:50:42 +00:00
Mohamed Ahmed
6063f96c61 nil: Support creating images with DRM modifiers
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
2024-05-14 04:04:34 +00:00
Mohamed Ahmed
e1bd4127f3 nil: Add some helpers for DRM format modifiers
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
2024-05-14 04:04:34 +00:00
Faith Ekstrand
b7773f96f9 nil: Default to NV_MMU_PTE_KIND_GENERIC_MEMORY on Turing+
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
2024-05-14 04:04:34 +00:00
Mohamed Ahmed
873a044cb3 nil: Add a nil_image::compressed bit
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
2024-05-14 04:04:34 +00:00
Faith Ekstrand
73c87dbc0c nil: Use the right PTE kind for Z32 pre-Turing
This got lost in the Rust rewrite.

Fixes: 426553d61d ("nil: Re-implement nil_image in Rust")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
2024-05-14 04:04:34 +00:00
Faith Ekstrand
42b85780c6 nil: Advertise S8_UINT on MaxwellB+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24596>
2024-04-19 15:43:14 -05:00
Faith Ekstrand
58b5f6b678 nil: Be more speicific about Maxwell in the format table
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24596>
2024-04-19 15:43:14 -05:00
Faith Ekstrand
4821c49ca7 nil: add s8 pte kind
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24596>
2024-04-19 15:43:14 -05:00
Faith Ekstrand
208f8ed429 nil: Use the enums from the hwref headers for PTE kinds
This isn't an exact translation.  It's identical to the previous values
for all uncompressed items but I fixed some of the compressed ones
(which we don't currently use) based on the enum names.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24596>
2024-04-19 15:43:14 -05:00
Faith Ekstrand
20c1a69125 nouveau/headers: Move the classes into a submodule for Rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28756>
2024-04-19 18:56:02 +00:00
Faith Ekstrand
e297fb1bd5 nil: cbindgen is required
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28794>
2024-04-17 23:16:31 -05:00
Dylan Baker
706691a715 nouveau: require cbindgen >= 0.25
So we can use the --depfile option, and not have to worry about new
files. Since it's Rust, the expectation is that you're going to have up
to date dependencies anyway.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28754>
2024-04-16 01:10:13 +00:00
Faith Ekstrand
6b383ca810 nil: Enforce units via Rust types
We add a units generic parameter to Extent4D and Offset4D and then make
every helper take and return the right type.  The mul and div_* helpers
only half-enforce types but it's better than nothing.  We leave them
non-public so no one outside extent.rs uses them.

Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand
c3b33de33c nil: Take a format in el_to_B()
Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand
5a075785ac nil: Drop the nil_extent/offset4d() helpers
They're only used one place each in NVK and we can just use a struct
initializer instead.

Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand
bc0de7a2cf nil: Add Extent/Offset4D::new() helpers
We're about to add a PhantomData to Extent/Offset4D and that'll make it
harder to construct.  Adding a helper lets us more easily construct them
elsewhere in the code.

Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand
fc90d4eed9 nil: Make the Rust library the primary build target
This just shuffles around the meson to make it so that the Rust library
is the final build target, not a C library.  We're still building
fundamentally the same amount of stuff because nil_format_table.c is
still C (C is really good at tables that go in the .data section) and we
still need a wrapper rlib for bindgen.  Howver, the Rust library is now
the main thing.  When the time comes to start using NIL from other Rust
code, this will mean that we can just build an rlib and it will have
everything.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Faith Ekstrand
571b77fee7 nil: Delete unused USAGE bits
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Daniel Almeida
5577128c83 nil: Rewrite the TIC code in Rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Daniel Almeida
426553d61d nil: Re-implement nil_image in Rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand
9fdcd217a4 nil: Rename nil_tiling::gob_height_8 to gob_height_is_8
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand
c13e7b01f9 nvk: Stop using nvk_extent4d short names
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Daniel Almeida
1713b02da7 nil: Rewrite nil_format in rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Daniel Almeida
303dc12214 nil: Add the start of a Rust library
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand
299f32736a nil: Move to a single header file
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand
cdaa8e67e3 nil: Move nil_tic_format to nil_format_table.h
This gets it out of nil_format.c/h and decouples things a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand
0e4b5e0b00 nil: Drop unneeded types from formats
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28453>
2024-03-30 00:03:46 +00:00
Faith Ekstrand
4c59398615 nil: Remove 2-bit SNORM from the format table
Initially I left it in place because I didn't want to disturb the table
beyond what was in nv50_formats.c.  However, we've moved past that now
and these formats are permanently broken so it's easiest to just remove
them from the table rather than have them in the table and then have C
code which disables them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28453>
2024-03-30 00:03:46 +00:00
Faith Ekstrand
4ca6ad7f8c nil: Drop bogus color formats from non-renderable luminance/alpha formats
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28453>
2024-03-30 00:03:46 +00:00
Faith Ekstrand
7b6b5aa0c6 nil: Switch to using the CSV generated table
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28453>
2024-03-30 00:03:45 +00:00
Faith Ekstrand
bc0ce3848f nil: Re-organize the format table
For normal color formats, sort them by largest component size then by
number of components.  This should make things easier to find.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28453>
2024-03-30 00:03:45 +00:00
Faith Ekstrand
70843be321 nil: Add a CSV version of the format table
This is much more readable than the macro mess we had before.  Most
notably because we no longer have this mess of #defines for format
support flags and instead have a character per flag and every every
supported flag is there every time.  This makes it way easier to figure
out what we're actually claiming a format can do.

This conversion was tested with a patch that did a memcmp() of this
table against the old one to ensure that the two tables are bit-for-bit
identical.  Later commits may modify the table in various ways but this
conversion to a CSV file is lossless.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28453>
2024-03-30 00:03:45 +00:00