freedreno: Introduce a "cpp_shift" value for cpp divs/muls.
[mesa.git] / src / freedreno / fdl / freedreno_layout.h
index e9bc3bdb371dae91b9bde00725304e2fa29aa7bf..aa46859a2c30ef873d4f96d1401ea6e049fffb5c 100644 (file)
@@ -109,6 +109,12 @@ struct fdl_layout {
         */
        uint8_t cpp;
 
+       /**
+        * Left shift necessary to multiply by cpp.  Invalid for NPOT cpp, please
+        * use fdl_cpp_shift() to sanity check you aren't hitting that case.
+        */
+       uint8_t cpp_shift;
+
        uint32_t width0, height0, depth0;
        uint32_t nr_samples;
        enum pipe_format format;
@@ -117,6 +123,13 @@ struct fdl_layout {
        uint32_t base_align; /* Alignment of the base address, in bytes. */
 };
 
+static inline uint32_t
+fdl_cpp_shift(const struct fdl_layout *layout)
+{
+       assert(util_is_power_of_two_or_zero(layout->cpp));
+       return layout->cpp_shift;
+}
+
 static inline uint32_t
 fdl_layer_stride(const struct fdl_layout *layout, unsigned level)
 {