nir: Rename num_shared to shared_size
[mesa.git] / src / intel / common / gen_l3_config.c
index 328aa5bebda4a0d4fcaf1cb36774343d444dffc6..347d7976226c36e02eea50f399f1b7b81ed32b19 100644 (file)
@@ -165,6 +165,14 @@ static const struct gen_l3_config tgl_l3_configs[] = {
 };
 DECLARE_L3_LIST(tgl);
 
+/**
+ * DG1 validated L3 configurations.  \sa dg1_l3_configs.
+ */
+static const struct gen_l3_config dg1_l3_configs[] = {
+   /* No configurations. L3FullWayAllocationEnable is always set. */
+};
+DECLARE_L3_LIST(dg1);
+
 /**
  * Return a zero-terminated array of validated L3 configurations for the
  * specified device.
@@ -191,7 +199,10 @@ get_l3_list(const struct gen_device_info *devinfo)
       return &icl_l3_list;
 
    case 12:
-      return &tgl_l3_list;
+      if (devinfo->is_dg1)
+         return &dg1_l3_list;
+      else
+         return &tgl_l3_list;
 
    default:
       unreachable("Not implemented");
@@ -294,10 +305,15 @@ gen_get_default_l3_config(const struct gen_device_info *devinfo)
     * default configuration.
     */
    const struct gen_l3_list *const list = get_l3_list(devinfo);
-   const struct gen_l3_config *const cfg = &list->configs[0];
-   assert(cfg == gen_get_l3_config(devinfo,
-                    gen_get_default_l3_weights(devinfo, false, false)));
-   return cfg;
+   assert(list->length > 0 || devinfo->gen >= 12);
+   if (list->length > 0) {
+      const struct gen_l3_config *const cfg = &list->configs[0];
+      assert(cfg == gen_get_l3_config(devinfo,
+                       gen_get_default_l3_weights(devinfo, false, false)));
+      return cfg;
+   } else {
+      return NULL;
+   }
 }
 
 /**
@@ -323,6 +339,7 @@ gen_get_l3_config(const struct gen_device_info *devinfo,
       }
    }
 
+   assert(cfg_best || devinfo->gen >= 12);
    return cfg_best;
 }
 
@@ -354,6 +371,10 @@ unsigned
 gen_get_l3_config_urb_size(const struct gen_device_info *devinfo,
                            const struct gen_l3_config *cfg)
 {
+   /* We don't have to program the URB size in DG1, it's a fixed value. */
+   if (devinfo->is_dg1)
+      return devinfo->urb.size;
+
    /* From the SKL "L3 Allocation and Programming" documentation:
     *
     * "URB is limited to 1008KB due to programming restrictions.  This is not