[Mesa-dev] [RFC v4 17/23] intel/isl: Add field for suboptimal tiling flags

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Mon Oct 16 07:04:27 UTC 2017


The caller might want to discriminate between two possible
sets of tiling flags. For example, some tiling modes might
allow direct scanout, and so should be preferred even if
GPU operations are a little less performant.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
---
 src/intel/isl/isl.c | 33 ++++++++++++++++++++++++---------
 src/intel/isl/isl.h |  3 +++
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 59f512fc05..a5d9d842ba 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -304,6 +304,7 @@ isl_surf_choose_tiling(const struct isl_device *dev,
                        enum isl_tiling *tiling)
 {
    isl_tiling_flags_t tiling_flags = info->tiling_flags;
+   isl_tiling_flags_t suboptimal_tiling_flags = info->suboptimal_tiling_flags;
 
    /* HiZ surfaces always use the HiZ tiling */
    if (info->usage & ISL_SURF_USAGE_HIZ_BIT) {
@@ -323,13 +324,15 @@ isl_surf_choose_tiling(const struct isl_device *dev,
 
    if (ISL_DEV_GEN(dev) >= 6) {
       isl_gen6_filter_tiling(dev, info, &tiling_flags);
+      isl_gen6_filter_tiling(dev, info, &suboptimal_tiling_flags);
    } else {
       isl_gen4_filter_tiling(dev, info, &tiling_flags);
+      isl_gen4_filter_tiling(dev, info, &suboptimal_tiling_flags);
    }
 
-   #define CHOOSE(__tiling) \
+   #define CHOOSE(__flags, __tiling) \
       do { \
-         if (tiling_flags & (1u << (__tiling))) { \
+         if (__flags & (1u << (__tiling))) { \
             *tiling = (__tiling); \
             return true; \
           } \
@@ -345,15 +348,27 @@ isl_surf_choose_tiling(const struct isl_device *dev,
        * memory locality due to the swizzling and alignment restrictions
        * required in tiled surfaces.
        */
-      CHOOSE(ISL_TILING_LINEAR);
+      CHOOSE((tiling_flags | suboptimal_tiling_flags),
+             ISL_TILING_LINEAR);
    }
 
-   CHOOSE(ISL_TILING_Ys);
-   CHOOSE(ISL_TILING_Yf);
-   CHOOSE(ISL_TILING_Y0);
-   CHOOSE(ISL_TILING_X);
-   CHOOSE(ISL_TILING_W);
-   CHOOSE(ISL_TILING_LINEAR);
+   CHOOSE(tiling_flags, ISL_TILING_Ys);
+   CHOOSE(tiling_flags, ISL_TILING_Yf);
+   CHOOSE(tiling_flags, ISL_TILING_Y0);
+   CHOOSE(tiling_flags, ISL_TILING_X);
+   CHOOSE(tiling_flags, ISL_TILING_W);
+   CHOOSE(tiling_flags, ISL_TILING_LINEAR);
+
+   /* Let's try the suboptimal tiling modes if none of the preferred
+    * ones were available. */
+   if (suboptimal_tiling_flags != 0) {
+      CHOOSE(suboptimal_tiling_flags, ISL_TILING_Ys);
+      CHOOSE(suboptimal_tiling_flags, ISL_TILING_Yf);
+      CHOOSE(suboptimal_tiling_flags, ISL_TILING_Y0);
+      CHOOSE(suboptimal_tiling_flags, ISL_TILING_X);
+      CHOOSE(suboptimal_tiling_flags, ISL_TILING_W);
+      CHOOSE(suboptimal_tiling_flags, ISL_TILING_LINEAR);
+   }
 
    #undef CHOOSE
 
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index b255f15a5d..b11daf13d8 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1113,6 +1113,9 @@ struct isl_surf_init_info {
 
    /** Flags that alter how ISL selects isl_surf::tiling.  */
    isl_tiling_flags_t tiling_flags;
+
+   /** Flags that could also be used for isl_surf::tiling but are suboptimal. */
+   isl_tiling_flags_t suboptimal_tiling_flags;
 };
 
 struct isl_surf {
-- 
2.13.0



More information about the mesa-dev mailing list