summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorRafael Antognolli <[email protected]>2017-08-10 09:36:28 -0700
committerRafael Antognolli <[email protected]>2018-04-05 07:42:45 -0700
commitab633c2d6108afc55c7c9f5436296832bdb18492 (patch)
treea64bce5012fa542017adc63d04dd4c63138d725c /src/mesa
parent14260e7c60d936e94905a06e51e4e61c1b37a1e6 (diff)
i965/miptree: Add space to store the clear value in the aux surface.
Similarly to vulkan where we store the clear value in the aux surface, we can do the same in GL. v2: Remove unneeded extra function. v3: Use clear_value_state_size instead of clear_value_size. v4: - rename to clear_color_state_size - store clear_color_bo and clear_color_offset in the aux buf struct v5: Unreference clear color bo (Jordan) Signed-off-by: Rafael Antognolli <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c17
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.h16
2 files changed, 33 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 23cb40f3226..d11ae65243f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1211,6 +1211,7 @@ intel_miptree_aux_buffer_free(struct intel_miptree_aux_buffer *aux_buf)
return;
brw_bo_unreference(aux_buf->bo);
+ brw_bo_unreference(aux_buf->clear_color_bo);
free(aux_buf);
}
@@ -1678,6 +1679,17 @@ intel_alloc_aux_buffer(struct brw_context *brw,
return false;
buf->size = aux_surf->size;
+
+ const struct gen_device_info *devinfo = &brw->screen->devinfo;
+ if (devinfo->gen >= 10) {
+ /* On CNL, instead of setting the clear color in the SURFACE_STATE, we
+ * will set a pointer to a dword somewhere that contains the color. So,
+ * allocate the space for the clear color value here on the aux buffer.
+ */
+ buf->clear_color_offset = buf->size;
+ buf->size += brw->isl_dev.ss.clear_color_state_size;
+ }
+
buf->pitch = aux_surf->row_pitch;
buf->qpitch = isl_surf_get_array_pitch_sa_rows(aux_surf);
@@ -1692,6 +1704,11 @@ intel_alloc_aux_buffer(struct brw_context *brw,
return NULL;
}
+ if (devinfo->gen >= 10) {
+ buf->clear_color_bo = buf->bo;
+ brw_bo_reference(buf->clear_color_bo);
+ }
+
buf->surf = *aux_surf;
return buf;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 07c85807e80..54d36400757 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -180,6 +180,22 @@ struct intel_miptree_aux_buffer
* @see 3DSTATE_HIER_DEPTH_BUFFER.SurfaceQPitch
*/
uint32_t qpitch;
+
+ /**
+ * Buffer object containing the indirect clear color.
+ *
+ * @see create_ccs_buf_for_image
+ * @see RENDER_SURFACE_STATE.ClearValueAddress
+ */
+ struct brw_bo *clear_color_bo;
+
+ /**
+ * Offset into bo where the clear color can be found.
+ *
+ * @see create_ccs_buf_for_image
+ * @see RENDER_SURFACE_STATE.ClearValueAddress
+ */
+ uint32_t clear_color_offset;
};
struct intel_mipmap_tree