<div dir="ltr"><br><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">8 and 16 bit formats use a different layout on<br>
GB20x than they did on prior chips. Add the<br>
corresponding DRM format modifiers to the list of<br>
modifiers supported by the display engine on such<br>
chips, and filter the supported modifiers for each<br>
format based on its bytes per pixel in<br>
nv50_plane_format_mod_supported().<br>
<br>
Note this logic will need to be updated when GB10<br>
support is added, since it is a GB20x chip that<br>
uses the pre-GB20x sector layout for all formats.<br>
<br>
Signed-off-by: James Jones <<a href="mailto:jajones@nvidia.com" target="_blank">jajones@nvidia.com</a>><br>
---<br>
drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 ++-<br>
drivers/gpu/drm/nouveau/dispnv50/disp.h | 1 +<br>
drivers/gpu/drm/nouveau/dispnv50/wndw.c | 24 +++++++++++++--<br>
drivers/gpu/drm/nouveau/dispnv50/wndwca7e.c | 33 +++++++++++++++++++++<br>
4 files changed, 59 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c<br>
index e97e39abf3a2..12b1dba8e05d 100644<br>
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c<br>
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c<br>
@@ -2867,7 +2867,9 @@ nv50_display_create(struct drm_device *dev)<br>
}<br>
<br>
/* Assign the correct format modifiers */<br>
- if (disp->disp->object.oclass >= TU102_DISP)<br>
+ if (disp->disp->object.oclass >= GB202_DISP)<br>
+ nouveau_display(dev)->format_modifiers = wndwca7e_modifiers;<br>
+ else if (disp->disp->object.oclass >= TU102_DISP)<br>
nouveau_display(dev)->format_modifiers = wndwc57e_modifiers;<br>
else<br>
if (drm-><a href="http://client.device.info" target="_blank">client.device.info</a>.family >= NV_DEVICE_INFO_V0_FERMI)<br>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.h b/drivers/gpu/drm/nouveau/dispnv50/disp.h<br>
index 15f9242b72ac..5d998f0319dc 100644<br>
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.h<br>
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.h<br>
@@ -104,4 +104,5 @@ struct nouveau_encoder *nv50_real_outp(struct drm_encoder *encoder);<br>
extern const u64 disp50xx_modifiers[];<br>
extern const u64 disp90xx_modifiers[];<br>
extern const u64 wndwc57e_modifiers[];<br>
+extern const u64 wndwca7e_modifiers[];<br>
#endif<br>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c<br>
index e2c55f4b9c5a..ef9e410babbf 100644<br>
--- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c<br>
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c<br>
@@ -786,13 +786,14 @@ nv50_wndw_destroy(struct drm_plane *plane)<br>
}<br>
<br>
/* This function assumes the format has already been validated against the plane<br>
- * and the modifier was validated against the device-wides modifier list at FB<br>
+ * and the modifier was validated against the device-wide modifier list at FB<br>
* creation time.<br>
*/<br>
static bool nv50_plane_format_mod_supported(struct drm_plane *plane,<br>
u32 format, u64 modifier)<br>
{<br>
struct nouveau_drm *drm = nouveau_drm(plane->dev);<br>
+ const struct drm_format_info *info = drm_format_info(format);<br>
uint8_t i;<br>
<br>
/* All chipsets can display all formats in linear layout */<br>
@@ -800,13 +801,32 @@ static bool nv50_plane_format_mod_supported(struct drm_plane *plane,<br>
return true;<br>
<br>
if (drm-><a href="http://client.device.info" target="_blank">client.device.info</a>.chipset < 0xc0) {<br>
- const struct drm_format_info *info = drm_format_info(format);<br>
const uint8_t kind = (modifier >> 12) & 0xff;<br>
<br>
if (!format) return false;<br>
<br>
for (i = 0; i < info->num_planes; i++)<br>
if ((info->cpp[i] != 4) && kind != 0x70) return false;<br>
+ } else if (drm-><a href="http://client.device.info" target="_blank">client.device.info</a>.chipset >= 0x1b2) {<br>
+ const uint8_t slayout = ((modifier >> 22) & 0x1) |<br>
+ ((modifier >> 25) & 0x6);<br>
+<br>
+ if (!format)<br>
+ return false;<br>
+<br>
+ /*<br>
+ * Note in practice this implies only formats where cpp is equal<br>
+ * for each plane, or >= 4 for all planes, are supported.<br>
+ */<br>
+ for (i = 0; i < info->num_planes; i++) {<br>
+ if (((info->cpp[i] == 2) && slayout != 3) ||<br>
+ ((info->cpp[i] == 1) && slayout != 2) ||<br>
+ ((info->cpp[i] >= 4) && slayout != 1))<br>
+ return false;<br>
+<br>
+ /* 24-bit not supported. It has yet another layout */<br>
+ WARN_ON(info->cpp[i] == 3);<br></blockquote><div><br></div><div>Should this really be a WARN_ON()? A DRM log message, maybe, but WARN_ON() implies something went funky inside the kernel, not that userspace asked for something it shouldn't.</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>
}<br>
<br>
return true;<br>
diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwca7e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwca7e.c<br>
index 0d8e9a9d1a57..2cec8cfbd546 100644<br>
--- a/drivers/gpu/drm/nouveau/dispnv50/wndwca7e.c<br>
+++ b/drivers/gpu/drm/nouveau/dispnv50/wndwca7e.c<br>
@@ -179,6 +179,39 @@ wndwca7e_ntfy_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)<br>
return 0;<br>
}<br>
<br>
+/****************************************************************<br>
+ * Log2(block height) ----------------------------+ *<br>
+ * Page Kind ----------------------------------+ | *<br>
+ * Gob Height/Page Kind Generation ------+ | | *<br>
+ * Sector layout -------+ | | | *<br>
+ * Compression ------+ | | | | */<br>
+const u64 wndwca7e_modifiers[] = { /* | | | | | */<br>
+ /* 4cpp+ modifiers */<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0x06, 4),<br>
+ DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(0, 3, 2, 0x06, 5),<br>
+ /* All formats support linear */<br>
+ DRM_FORMAT_MOD_LINEAR,<br>
+ DRM_FORMAT_MOD_INVALID<br>
+};<br>
+<br>
static const struct nv50_wndw_func<br>
wndwca7e = {<br>
.acquire = wndwc37e_acquire,<br>
-- <br>
2.50.1<br>
<br>
</blockquote></div></div>