[Mesa-dev] [PATCH 2/5] nouveau: Stash supported sector layout in screen

James Jones jajones at nvidia.com
Wed Feb 5 20:52:44 UTC 2020


Older Tegra GPUs use a different sector bit
swizzling layout than desktop and Xavier GPUs.
Hence their format modifiers must be
differentiated from those of other GPUs.  As
a precursor to supporting more expressive
block linear format modifiers, deduce the
sector layout used for a given GPU from its
chipset and stash the layout in the nouveau
screen structure.

Signed-off-by: James Jones <jajones at nvidia.com>
---
 src/gallium/drivers/nouveau/nouveau_screen.c | 12 ++++++++++++
 src/gallium/drivers/nouveau/nouveau_screen.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index de9cce3812a..f63af6313e4 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -213,6 +213,18 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
       size = sizeof(nvc0_data);
    }
 
+   switch (dev->chipset) {
+   case 0x0ea: /* TK1, GK20A */
+   case 0x12b: /* TX1, GM20B */
+   case 0x13b: /* TX2, GP10B */
+      screen->tegra_sector_layout = true;
+      break;
+   default:
+      /* Xavier's GPU and everything else */
+      screen->tegra_sector_layout = false;
+      break;
+   }
+
    /*
     * Set default VRAM domain if not overridden
     */
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 40464225c75..0abaf4db0f5 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -58,6 +58,7 @@ struct nouveau_screen {
    int64_t cpu_gpu_time_delta;
 
    bool hint_buf_keep_sysmem_copy;
+   bool tegra_sector_layout;
 
    unsigned vram_domain;
 
-- 
2.17.1



More information about the mesa-dev mailing list