<div dir="ltr"><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Aug 11, 2025 at 5:57 PM James Jones <<a href="mailto:jajones@nvidia.com">jajones@nvidia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The layout of bits within the individual tiles<br>
(referred to as sectors in the<br>
DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D() macro)<br>
changed for 8 and 16-bit surfaces starting in<br>
Blackwell 2 GPUs (With the exception of GB10).<br>
To denote the difference, extend the sector field<br>
in the parametric format modifier definition used<br>
to generate modifier values for NVIDIA hardware.<br>
<br>
Without this change, it would be impossible to<br>
differentiate the two layouts based on modifiers,<br>
and as a result software could attempt to share<br>
surfaces directly between pre-GB20x and GB20x<br>
cards, resulting in corruption when the surface<br>
was accessed on one of the GPUs after being<br>
populated with content by the other.<br>
<br>
Of note: This change causes the<br>
DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D() macro to<br>
evaluate its "s" parameter twice, with the side<br>
effects that entails. I surveyed all usage of the<br>
modifier in the kernel and Mesa code, and that<br>
does not appear to be problematic in any current<br>
usage, but I thought it was worth calling out.<br>
<br>
Signed-off-by: James Jones <<a href="mailto:jajones@nvidia.com" target="_blank">jajones@nvidia.com</a>><br></blockquote><div><br></div><div><div>Reviewed-by: Faith Ekstrand <<a href="mailto:faith.ekstrand@collabora.com">faith.ekstrand@collabora.com</a>></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 include/uapi/drm/drm_fourcc.h | 25 ++++++++++++++++---------<br>
 1 file changed, 16 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h<br>
index ea91aa8afde9..e527b24bd824 100644<br>
--- a/include/uapi/drm/drm_fourcc.h<br>
+++ b/include/uapi/drm/drm_fourcc.h<br>
@@ -979,14 +979,20 @@ extern "C" {<br>
  *               2 = Gob Height 8, Turing+ Page Kind mapping<br>
  *               3 = Reserved for future use.<br>
  *<br>
- * 22:22 s     Sector layout.  On Tegra GPUs prior to Xavier, there is a further<br>
- *             bit remapping step that occurs at an even lower level than the<br>
- *             page kind and block linear swizzles.  This causes the layout of<br>
- *             surfaces mapped in those SOC's GPUs to be incompatible with the<br>
- *             equivalent mapping on other GPUs in the same system.<br>
- *<br>
- *               0 = Tegra K1 - Tegra Parker/TX2 Layout.<br>
- *               1 = Desktop GPU and Tegra Xavier+ Layout<br>
+ * 22:22 s     Sector layout.  There is a further bit remapping step that occurs<br>
+ * 26:27       at an even lower level than the page kind and block linear<br>
+ *             swizzles.  This causes the bit arrangement of surfaces in memory<br>
+ *             to differ subtly, and prevents direct sharing of surfaces between<br>
+ *             GPUs with different layouts.<br>
+ *<br>
+ *               0 = Tegra K1 - Tegra Parker/TX2 Layout<br>
+ *               1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout<br>
+ *               2 = GB20x(Blackwell 2)+ 8 bpp surface layout<br>
+ *               3 = GB20x(Blackwell 2)+ 16 bpp surface layout<br>
+ *               4 = Reserved for future use.<br>
+ *               5 = Reserved for future use.<br>
+ *               6 = Reserved for future use.<br>
+ *               7 = Reserved for future use.<br>
  *<br>
  * 25:23 c     Lossless Framebuffer Compression type.<br>
  *<br>
@@ -1001,7 +1007,7 @@ extern "C" {<br>
  *               6 = Reserved for future use<br>
  *               7 = Reserved for future use<br>
  *<br>
- * 55:25 -     Reserved for future use.  Must be zero.<br>
+ * 55:28 -     Reserved for future use.  Must be zero.<br>
  */<br>
 #define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \<br>
        fourcc_mod_code(NVIDIA, (0x10 | \<br>
@@ -1009,6 +1015,7 @@ extern "C" {<br>
                                 (((k) & 0xff) << 12) | \<br>
                                 (((g) & 0x3) << 20) | \<br>
                                 (((s) & 0x1) << 22) | \<br>
+                                (((s) & 0x6) << 25) | \<br>
                                 (((c) & 0x7) << 23)))<br>
<br>
 /* To grandfather in prior block linear format modifiers to the above layout,<br>
-- <br>
2.50.1<br>
<br>
</blockquote></div></div>