intel/isl: Add support for setting component write disables
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 13 May 2017 06:12:12 +0000 (23:12 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 26 May 2017 14:58:01 +0000 (07:58 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/isl/isl.h
src/intel/isl/isl_surface_state.c

index 8131f45ae4758df6d93c8f0f46c428a8066bc331..acc9e77d3e7be58a860cc96882b3b225e769c2e0 100644 (file)
@@ -589,6 +589,21 @@ typedef uint64_t isl_surf_usage_flags_t;
 #define ISL_SURF_USAGE_CCS_BIT                 (1u << 15)
 /** @} */
 
+/**
+ * @defgroup Channel Mask
+ *
+ * These #define values are chosen to match the values of
+ * RENDER_SURFACE_STATE::Color Buffer Component Write Disables
+ *
+ * @{
+ */
+typedef uint8_t isl_channel_mask_t;
+#define ISL_CHANNEL_BLUE_BIT  (1 << 0)
+#define ISL_CHANNEL_GREEN_BIT (1 << 1)
+#define ISL_CHANNEL_RED_BIT   (1 << 2)
+#define ISL_CHANNEL_ALPHA_BIT (1 << 3)
+/** @} */
+
 /**
  * @brief A channel select (also known as texture swizzle) value
  */
@@ -1009,6 +1024,11 @@ struct isl_surf_fill_state_info {
     */
    union isl_color_value clear_color;
 
+   /**
+    * Surface write disables for gen4-5
+    */
+   isl_channel_mask_t write_disables;
+
    /* Intra-tile offset */
    uint16_t x_offset_sa, y_offset_sa;
 };
index fa464694862895ff8ba8d8a23f48cb0e3151f4d3..d63b245ef23a54d1f9d3ddf1c9f0d38bcf5689a6 100644 (file)
@@ -256,6 +256,12 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
 
    s.SurfaceFormat = info->view->format;
 
+#if GEN_GEN <= 5
+   s.ColorBufferComponentWriteDisables = info->write_disables;
+#else
+   assert(info->write_disables == 0);
+#endif
+
 #if GEN_IS_HASWELL
    s.IntegerSurfaceFormat = isl_format_has_int_channel(s.SurfaceFormat);
 #endif