Skip to content

Commit 1cf52a0

Browse files
cubanismoairlied
authored andcommitted
drm: define NVIDIA DRM format modifiers for GB20x
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. Fixes: 6cc6e08 ("drm/nouveau/kms: add support for GB20x") Signed-off-by: James Jones <[email protected]> Reviewed-by: Faith Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Cc: [email protected] Link: https://patch.msgid.link/[email protected]
1 parent ebe7556 commit 1cf52a0

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

include/uapi/drm/drm_fourcc.h

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -979,14 +979,20 @@ extern "C" {
979979
* 2 = Gob Height 8, Turing+ Page Kind mapping
980980
* 3 = Reserved for future use.
981981
*
982-
* 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further
983-
* bit remapping step that occurs at an even lower level than the
984-
* page kind and block linear swizzles. This causes the layout of
985-
* surfaces mapped in those SOC's GPUs to be incompatible with the
986-
* equivalent mapping on other GPUs in the same system.
987-
*
988-
* 0 = Tegra K1 - Tegra Parker/TX2 Layout.
989-
* 1 = Desktop GPU and Tegra Xavier+ Layout
982+
* 22:22 s Sector layout. There is a further bit remapping step that occurs
983+
* 26:27 at an even lower level than the page kind and block linear
984+
* swizzles. This causes the bit arrangement of surfaces in memory
985+
* to differ subtly, and prevents direct sharing of surfaces between
986+
* GPUs with different layouts.
987+
*
988+
* 0 = Tegra K1 - Tegra Parker/TX2 Layout
989+
* 1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout
990+
* 2 = GB20x(Blackwell 2)+ 8 bpp surface layout
991+
* 3 = GB20x(Blackwell 2)+ 16 bpp surface layout
992+
* 4 = Reserved for future use.
993+
* 5 = Reserved for future use.
994+
* 6 = Reserved for future use.
995+
* 7 = Reserved for future use.
990996
*
991997
* 25:23 c Lossless Framebuffer Compression type.
992998
*
@@ -1001,14 +1007,15 @@ extern "C" {
10011007
* 6 = Reserved for future use
10021008
* 7 = Reserved for future use
10031009
*
1004-
* 55:25 - Reserved for future use. Must be zero.
1010+
* 55:28 - Reserved for future use. Must be zero.
10051011
*/
10061012
#define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \
10071013
fourcc_mod_code(NVIDIA, (0x10 | \
10081014
((h) & 0xf) | \
10091015
(((k) & 0xff) << 12) | \
10101016
(((g) & 0x3) << 20) | \
10111017
(((s) & 0x1) << 22) | \
1018+
(((s) & 0x6) << 25) | \
10121019
(((c) & 0x7) << 23)))
10131020

10141021
/* To grandfather in prior block linear format modifiers to the above layout,

0 commit comments

Comments
 (0)