On Mon, Feb 15, 2016 at 01:27:19PM -0800, Ben Widawsky wrote: > On Thu, Feb 11, 2016 at 08:34:11PM +0200, Topi Pohjolainen wrote: > > v2: Use explicitly against base type of GL_FLOAT instead of > > using _mesa_is_format_integer_color(). Otherwise we miss > > GL_UNSIGNED_NORMALIZED. > > > > Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> > > --- > > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 22 ++++++++++++++++++++++ > > src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 +++ > > 2 files changed, 25 insertions(+) > > > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > index 6c233d8..e9fbeeb 100644 > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > @@ -294,6 +294,28 @@ intel_miptree_is_lossless_compressed(const struct > > brw_context *brw, > > return mt->num_samples <= 1; > > } > > > > +bool > > +intel_miptree_supports_lossless_compressed(mesa_format format) > > +{ > > + /* For now compression is only enabled for integer formats even though > > + * there exist supported floating point formats also. This is a > > heuristic > > + * decision based on current public benchmarks. In none of the cases > > these > > + * formats provided any improvement but a few cases were seen to > > regress. > > + * Hence these are left to to be enabled in the future when they are > > known > > + * to improve things. > > + */ > > + if (_mesa_get_format_datatype(format) == GL_FLOAT) > > + return false; > > + > > + /* In principle, fast clear mechanism and lossless compression go hand > > in > > + * hand. However, 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(format) == format; > > +} > > + > > Hmm. Doesn't this need to use the ccs_e field in surface formats, or did I > miss > something?
It does but I re-used intel_miptree_supports_non_msrt_fast_clear() to check if a format is supported. There you can see the trick Neil introduced: if (brw->gen >= 9) { mesa_format linear_format = _mesa_get_srgb_format_linear(mt->format); const uint32_t brw_format = brw_format_for_mesa_format(linear_format); return brw_losslessly_compressible_format(brw, brw_format); } else ... None of the srgb formats are supported even for fast clear, but Neil found out that we can use fast clear in certain cases even for them. I need to undo the conversion from srgb to linear to know for sure the format is supported for compression. By the time I wrote this there wasn't direct utility for checking if format srgb and therefore I chose to write it that way. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev