From: Faith Ekstrand <faith@gfxstrand.net>
To: James Jones <jajones@nvidia.com>
Cc: Danilo Krummrich <dakr@kernel.org>, Lyude Paul <lyude@redhat.com>,
Faith Ekstrand <faith.ekstrand@collabora.com>,
nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Joel Fernandes <joelagnelf@nvidia.com>
Subject: Re: [PATCH 1/3] drm: define NVIDIA DRM format modifiers for GB20x
Date: Fri, 22 Aug 2025 12:16:31 -0400 [thread overview]
Message-ID: <CAOFGe94vHrKX6jSGCuesRNUJPXzYBASK4WvqYYFg=EHTFcs8MQ@mail.gmail.com> (raw)
In-Reply-To: <20250811220017.1337-2-jajones@nvidia.com>
On Mon, Aug 11, 2025 at 5:57 PM James Jones <jajones@nvidia.com> wrote:
>
> The layout of bits within the individual tiles
> (referred to as sectors in the
> DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D() macro)
> changed for 8 and 16-bit surfaces starting in
> Blackwell 2 GPUs (With the exception of GB10).
> To denote the difference, extend the sector field
> in the parametric format modifier definition used
> to generate modifier values for NVIDIA hardware.
>
> Without this change, it would be impossible to
> differentiate the two layouts based on modifiers,
> and as a result software could attempt to share
> surfaces directly between pre-GB20x and GB20x
> cards, resulting in corruption when the surface
> was accessed on one of the GPUs after being
> populated with content by the other.
>
> Of note: This change causes the
> DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D() macro to
> evaluate its "s" parameter twice, with the side
> effects that entails. I surveyed all usage of the
> modifier in the kernel and Mesa code, and that
> does not appear to be problematic in any current
> usage, but I thought it was worth calling out.
>
> Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
>
> ---
> include/uapi/drm/drm_fourcc.h | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index ea91aa8afde9..e527b24bd824 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -979,14 +979,20 @@ extern "C" {
> * 2 = Gob Height 8, Turing+ Page Kind mapping
> * 3 = Reserved for future use.
> *
> - * 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further
> - * bit remapping step that occurs at an even lower level than the
> - * page kind and block linear swizzles. This causes the layout of
> - * surfaces mapped in those SOC's GPUs to be incompatible with the
> - * equivalent mapping on other GPUs in the same system.
> - *
> - * 0 = Tegra K1 - Tegra Parker/TX2 Layout.
> - * 1 = Desktop GPU and Tegra Xavier+ Layout
> + * 22:22 s Sector layout. There is a further bit remapping step that occurs
> + * 26:27 at an even lower level than the page kind and block linear
> + * swizzles. This causes the bit arrangement of surfaces in memory
> + * to differ subtly, and prevents direct sharing of surfaces between
> + * GPUs with different layouts.
> + *
> + * 0 = Tegra K1 - Tegra Parker/TX2 Layout
> + * 1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout
> + * 2 = GB20x(Blackwell 2)+ 8 bpp surface layout
> + * 3 = GB20x(Blackwell 2)+ 16 bpp surface layout
> + * 4 = Reserved for future use.
> + * 5 = Reserved for future use.
> + * 6 = Reserved for future use.
> + * 7 = Reserved for future use.
> *
> * 25:23 c Lossless Framebuffer Compression type.
> *
> @@ -1001,7 +1007,7 @@ extern "C" {
> * 6 = Reserved for future use
> * 7 = Reserved for future use
> *
> - * 55:25 - Reserved for future use. Must be zero.
> + * 55:28 - Reserved for future use. Must be zero.
> */
> #define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \
> fourcc_mod_code(NVIDIA, (0x10 | \
> @@ -1009,6 +1015,7 @@ extern "C" {
> (((k) & 0xff) << 12) | \
> (((g) & 0x3) << 20) | \
> (((s) & 0x1) << 22) | \
> + (((s) & 0x6) << 25) | \
> (((c) & 0x7) << 23)))
>
> /* To grandfather in prior block linear format modifiers to the above layout,
> --
> 2.50.1
>
next prev parent reply other threads:[~2025-08-22 16:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 22:00 [PATCH 0/3] drm/nouveau: Advertise correct modifiers on GB20x James Jones
2025-08-11 22:00 ` [PATCH 1/3] drm: define NVIDIA DRM format modifiers for GB20x James Jones
2025-08-22 15:51 ` Faith Ekstrand
2025-08-22 16:16 ` Faith Ekstrand [this message]
2025-09-02 13:41 ` Danilo Krummrich
2025-08-11 22:00 ` [PATCH 2/3] drm/nouveau/disp: Always accept linear modifier James Jones
2025-08-22 16:17 ` Faith Ekstrand
2025-08-22 20:55 ` Danilo Krummrich
2025-08-22 21:11 ` James Jones
2025-08-22 21:14 ` Danilo Krummrich
2025-08-22 23:14 ` Danilo Krummrich
2025-08-11 22:00 ` [PATCH 3/3] drm/nouveau: Advertise correct modifiers on GB20x James Jones
2025-08-22 15:48 ` Faith Ekstrand
2025-08-22 17:03 ` James Jones
2025-08-22 17:10 ` Faith Ekstrand
2025-08-22 20:44 ` [PATCH 0/3] " Faith Ekstrand
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='CAOFGe94vHrKX6jSGCuesRNUJPXzYBASK4WvqYYFg=EHTFcs8MQ@mail.gmail.com' \
--to=faith@gfxstrand.net \
--cc=airlied@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith.ekstrand@collabora.com \
--cc=jajones@nvidia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=simona@ffwll.ch \
/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;
as well as URLs for NNTP newsgroup(s).