[v3,08/13] i965/miptree: Add space to store the clear value in the aux surface.

Submitted by Rafael Antognolli on Feb. 21, 2018, 9:45 p.m.

Details

Message ID 20180221214522.25065-9-rafael.antognolli@intel.com
State New
Headers show
Series "Use clear color address in surface state." ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Rafael Antognolli Feb. 21, 2018, 9:45 p.m.
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.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 6d35c9d3928..7bdd4d89ccc 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1676,6 +1676,16 @@  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->size += brw->isl_dev.ss.clear_value_state_size;
+   }
+
    buf->pitch = aux_surf->row_pitch;
    buf->qpitch = isl_surf_get_array_pitch_sa_rows(aux_surf);
 

Comments

On Wed, Feb 21, 2018 at 1:45 PM, Rafael Antognolli <
rafael.antognolli@intel.com> wrote:

> 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.
>
> Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 6d35c9d3928..7bdd4d89ccc 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -1676,6 +1676,16 @@ 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->size += brw->isl_dev.ss.clear_value_state_size;
>

So, this is a bit sticky...  There are two places that we get CCS buffers.
One is here and the other is when the image gets created through the window
system and has the I915_FORMAT_MOD_Y_TILED_CCS modifier.  In the second
(modifier) case, we need to put the clear color in its own BO.  Yeah,
that's a bit silly but there's not much more we can do.


> +   }
> +
>     buf->pitch = aux_surf->row_pitch;
>     buf->qpitch = isl_surf_get_array_pitch_sa_rows(aux_surf);
>
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>