Re: [Mesa-dev] [PATCH 1/5] i965: Enable non-CCS_E fast-clears on gen9+

2017-06-15 Thread Jason Ekstrand
On Thu, Jun 15, 2017 at 12:31 AM, Michael Schellenberger Costa <
mschellenbergerco...@googlemail.com> wrote:

> Hi Jason
>
> On 15.06.2017 03:54, Jason Ekstrand wrote:
> > Sky Lake and above can fast-clear exactly the same set of formats as
> > older hardware.  The only restriction is that you can't *texture* from
> > it unless the format supports CCS_E but you can fast-clear and render to
> > it just fine.  All of the code exists and now that we have sane resolves,
> > we can trivially turn it on.
> >
> > Reviewed-by: Topi Pohjolainen 
>

All,

Please disregard this patch.  It's woefully incomplete.  There's a lot more
code that needs to be deleted before we can turn on CCS_D for sRGB on gen9.


> > ---
> >  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 18 --
> >  1 file changed, 4 insertions(+), 14 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > index 02e74ca..c19d2d5 100644
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > @@ -207,13 +207,7 @@ intel_miptree_supports_non_msrt_fast_clear(struct
> brw_context *brw,
> > if (!brw->format_supported_as_render_target[mt->format])
> >return false;
> Can you just do
>
> return brw->format_supported_as_render_target[mt->format];
>
> now the second clause is gone.
>

Sure, but this pattern of "if (...) return false;" is really nice for this
sort of funciton.  Converting the last one in a chain to "return thing"
doesn't do anything for clarity.


> Michael
>
> >
> > -   if (brw->gen >= 9) {
> > -  mesa_format linear_format = _mesa_get_srgb_format_linear(
> mt->format);
> > -  const enum isl_format isl_format =
> > - brw_isl_format_for_mesa_format(linear_format);
> > -  return isl_format_supports_ccs_e(>screen->devinfo,
> isl_format);
> > -   } else
> > -  return true;
> > +   return true;
> >  }
> >
> >  /* On Gen9 support for color buffer compression was extended to single
> > @@ -257,16 +251,12 @@ intel_miptree_supports_lossless_compressed(struct
> brw_context *brw,
> > if (_mesa_get_format_datatype(mt->format) == GL_FLOAT)
> >return false;
> >
> > -   /* Fast clear mechanism and lossless compression go hand in hand. */
> > +   /* Fast clear support is a pre-requisite for lossless compression */
> > if (!intel_miptree_supports_non_msrt_fast_clear(brw, mt))
> >return false;
> >
> > -   /* Fast clear can be also used to clear srgb surfaces by using
> equivalent
> > -* linear format. This trick, however, can't be extended to be used
> with
> > -* lossless compression and therefore a check is needed to see if
> the format
> > -* really is linear.
> > -*/
> > -   return _mesa_get_srgb_format_linear(mt->format) == mt->format;
> > +   enum isl_format isl_format = brw_isl_format_for_mesa_
> format(mt->format);
> > +   return isl_format_supports_ccs_e(>screen->devinfo, isl_format);
> >  }
> >
> >  /**
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] i965: Enable non-CCS_E fast-clears on gen9+

2017-06-15 Thread Michael Schellenberger Costa
Hi Jason


On 15.06.2017 03:54, Jason Ekstrand wrote:
> Sky Lake and above can fast-clear exactly the same set of formats as
> older hardware.  The only restriction is that you can't *texture* from
> it unless the format supports CCS_E but you can fast-clear and render to
> it just fine.  All of the code exists and now that we have sane resolves,
> we can trivially turn it on.
>
> Reviewed-by: Topi Pohjolainen 
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 18 --
>  1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 02e74ca..c19d2d5 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -207,13 +207,7 @@ intel_miptree_supports_non_msrt_fast_clear(struct 
> brw_context *brw,
> if (!brw->format_supported_as_render_target[mt->format])
>return false;
Can you just do

return brw->format_supported_as_render_target[mt->format];

now the second clause is gone.
Michael

>  
> -   if (brw->gen >= 9) {
> -  mesa_format linear_format = _mesa_get_srgb_format_linear(mt->format);
> -  const enum isl_format isl_format =
> - brw_isl_format_for_mesa_format(linear_format);
> -  return isl_format_supports_ccs_e(>screen->devinfo, isl_format);
> -   } else
> -  return true;
> +   return true;
>  }
>  
>  /* On Gen9 support for color buffer compression was extended to single
> @@ -257,16 +251,12 @@ intel_miptree_supports_lossless_compressed(struct 
> brw_context *brw,
> if (_mesa_get_format_datatype(mt->format) == GL_FLOAT)
>return false;
>  
> -   /* Fast clear mechanism and lossless compression go hand in hand. */
> +   /* Fast clear support is a pre-requisite for lossless compression */
> if (!intel_miptree_supports_non_msrt_fast_clear(brw, mt))
>return false;
>  
> -   /* Fast clear can be also used to clear srgb surfaces by using equivalent
> -* linear format. This trick, however, can't be extended to be used with
> -* lossless compression and therefore a check is needed to see if the 
> format
> -* really is linear.
> -*/
> -   return _mesa_get_srgb_format_linear(mt->format) == mt->format;
> +   enum isl_format isl_format = brw_isl_format_for_mesa_format(mt->format);
> +   return isl_format_supports_ccs_e(>screen->devinfo, isl_format);
>  }
>  
>  /**

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/5] i965: Enable non-CCS_E fast-clears on gen9+

2017-06-14 Thread Jason Ekstrand
Sky Lake and above can fast-clear exactly the same set of formats as
older hardware.  The only restriction is that you can't *texture* from
it unless the format supports CCS_E but you can fast-clear and render to
it just fine.  All of the code exists and now that we have sane resolves,
we can trivially turn it on.

Reviewed-by: Topi Pohjolainen 
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 02e74ca..c19d2d5 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -207,13 +207,7 @@ intel_miptree_supports_non_msrt_fast_clear(struct 
brw_context *brw,
if (!brw->format_supported_as_render_target[mt->format])
   return false;
 
-   if (brw->gen >= 9) {
-  mesa_format linear_format = _mesa_get_srgb_format_linear(mt->format);
-  const enum isl_format isl_format =
- brw_isl_format_for_mesa_format(linear_format);
-  return isl_format_supports_ccs_e(>screen->devinfo, isl_format);
-   } else
-  return true;
+   return true;
 }
 
 /* On Gen9 support for color buffer compression was extended to single
@@ -257,16 +251,12 @@ intel_miptree_supports_lossless_compressed(struct 
brw_context *brw,
if (_mesa_get_format_datatype(mt->format) == GL_FLOAT)
   return false;
 
-   /* Fast clear mechanism and lossless compression go hand in hand. */
+   /* Fast clear support is a pre-requisite for lossless compression */
if (!intel_miptree_supports_non_msrt_fast_clear(brw, mt))
   return false;
 
-   /* Fast clear can be also used to clear srgb surfaces by using equivalent
-* linear format. This trick, however, can't be extended to be used with
-* lossless compression and therefore a check is needed to see if the format
-* really is linear.
-*/
-   return _mesa_get_srgb_format_linear(mt->format) == mt->format;
+   enum isl_format isl_format = brw_isl_format_for_mesa_format(mt->format);
+   return isl_format_supports_ccs_e(>screen->devinfo, isl_format);
 }
 
 /**
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev