intel/isl: Add gen12 depth/stencil surface alignments
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 19 Jan 2018 08:48:33 +0000 (00:48 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 17 Oct 2019 21:47:23 +0000 (14:47 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/intel/Makefile.sources
src/intel/isl/isl.c
src/intel/isl/isl_gen12.c [new file with mode: 0644]
src/intel/isl/isl_gen12.h [new file with mode: 0644]
src/intel/isl/meson.build

index ebe4efee992ab1237b04844c8b281028400088da..02f0f27a9be04fbbd09f59b62b9e6550db923338 100644 (file)
@@ -221,6 +221,8 @@ ISL_GEN11_FILES = \
        isl/isl_surface_state.c
 
 ISL_GEN12_FILES = \
+       isl/isl_gen12.c \
+       isl/isl_gen12.h \
        isl/isl_emit_depth_stencil.c \
        isl/isl_surface_state.c
 
index a647bf0d8143d54e47144c732047afe7db3df1e1..d2bc8a118531d38ca8c43c5858c602c949053020 100644 (file)
@@ -33,6 +33,7 @@
 #include "isl_gen7.h"
 #include "isl_gen8.h"
 #include "isl_gen9.h"
+#include "isl_gen12.h"
 #include "isl_priv.h"
 
 void
@@ -637,7 +638,10 @@ isl_choose_image_alignment_el(const struct isl_device *dev,
       return;
    }
 
-   if (ISL_DEV_GEN(dev) >= 9) {
+   if (ISL_DEV_GEN(dev) >= 12) {
+      isl_gen12_choose_image_alignment_el(dev, info, tiling, dim_layout,
+                                          msaa_layout, image_align_el);
+   } else if (ISL_DEV_GEN(dev) >= 9) {
       isl_gen9_choose_image_alignment_el(dev, info, tiling, dim_layout,
                                          msaa_layout, image_align_el);
    } else if (ISL_DEV_GEN(dev) >= 8) {
diff --git a/src/intel/isl/isl_gen12.c b/src/intel/isl/isl_gen12.c
new file mode 100644 (file)
index 0000000..44dd462
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018 Intel Corporation
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice (including the next
+ *  paragraph) shall be included in all copies or substantial portions of the
+ *  Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ *  IN THE SOFTWARE.
+ */
+
+#include "isl_gen9.h"
+#include "isl_gen12.h"
+#include "isl_priv.h"
+
+void
+isl_gen12_choose_image_alignment_el(const struct isl_device *dev,
+                                    const struct isl_surf_init_info *restrict info,
+                                    enum isl_tiling tiling,
+                                    enum isl_dim_layout dim_layout,
+                                    enum isl_msaa_layout msaa_layout,
+                                    struct isl_extent3d *image_align_el)
+{
+   /* Handled by isl_choose_image_alignment_el */
+   assert(info->format != ISL_FORMAT_HIZ);
+
+   if (isl_surf_usage_is_depth(info->usage)) {
+      /* The alignment parameters for depth buffers are summarized in the
+       * following table:
+       *
+       *     Surface Format  |    MSAA     | Align Width | Align Height
+       *    -----------------+-------------+-------------+--------------
+       *       D16_UNORM     | 1x, 4x, 16x |      8      |      8
+       *     ----------------+-------------+-------------+--------------
+       *       D16_UNORM     |   2x, 8x    |     16      |      4
+       *     ----------------+-------------+-------------+--------------
+       *         other       |     any     |      8      |      4
+       *    -----------------+-------------+-------------+--------------
+       */
+      assert(isl_is_pow2(info->samples));
+      *image_align_el =
+         info->format != ISL_FORMAT_R16_UNORM ?
+         isl_extent3d(8, 4, 1) :
+         (info->samples == 2 || info->samples == 8 ?
+          isl_extent3d(16, 4, 1) : isl_extent3d(8, 8, 1));
+   } else if (isl_surf_usage_is_stencil(info->usage)) {
+      *image_align_el = isl_extent3d(16, 8, 1);
+   } else {
+      isl_gen9_choose_image_alignment_el(dev, info, tiling, dim_layout,
+                                         msaa_layout, image_align_el);
+   }
+}
diff --git a/src/intel/isl/isl_gen12.h b/src/intel/isl/isl_gen12.h
new file mode 100644 (file)
index 0000000..a281f14
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 Intel Corporation
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice (including the next
+ *  paragraph) shall be included in all copies or substantial portions of the
+ *  Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ *  IN THE SOFTWARE.
+ */
+
+#ifndef ISL_GEN12_H
+#define ISL_GEN12_H
+
+#include "isl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void
+isl_gen12_choose_image_alignment_el(const struct isl_device *dev,
+                                    const struct isl_surf_init_info *restrict info,
+                                    enum isl_tiling tiling,
+                                    enum isl_dim_layout dim_layout,
+                                    enum isl_msaa_layout msaa_layout,
+                                    struct isl_extent3d *image_align_el);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ISL_GEN12_H */
index 2e0f65cb670f654ec85eb118e47ad1b9fcf43f2d..d3003ac6a014aac65d29b04389844e5d7abd52c1 100644 (file)
@@ -48,10 +48,16 @@ isl_gen9_files = files(
   'isl_gen9.h',
 )
 
+isl_gen12_files = files(
+  'isl_gen12.c',
+  'isl_gen12.h',
+)
+
 isl_gen_libs = []
 foreach g : [['40', isl_gen4_files], ['50', []], ['60', isl_gen6_files],
              ['70', isl_gen7_files], ['75', []], ['80', isl_gen8_files],
-             ['90', isl_gen9_files], ['100', []], ['110', []], ['120', []]]
+             ['90', isl_gen9_files], ['100', []], ['110', []],
+             ['120', isl_gen12_files]]
   _gen = g[0]
   isl_gen_libs += static_library(
     'isl_gen@0@'.format(_gen),