[Mesa-dev] [PATCH 1/6] intel/isl: Add a format_supports_multisampling helper

Pohjolainen, Topi topi.pohjolainen at gmail.com
Tue Sep 6 05:39:06 UTC 2016


On Fri, Sep 02, 2016 at 03:50:42PM -0700, Jason Ekstrand wrote:
> ---
>  src/intel/isl/isl.h        |  2 ++
>  src/intel/isl/isl_format.c | 30 ++++++++++++++++++++++++++++++
>  src/intel/isl/isl_gen6.c   | 19 +------------------
>  src/intel/isl/isl_gen7.c   | 16 +---------------
>  src/intel/isl/isl_gen8.c   |  4 +---
>  5 files changed, 35 insertions(+), 36 deletions(-)
> 
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
> index ecedc05..cb7c22d 100644
> --- a/src/intel/isl/isl.h
> +++ b/src/intel/isl/isl.h
> @@ -989,6 +989,8 @@ bool isl_format_supports_vertex_fetch(const struct brw_device_info *devinfo,
>                                        enum isl_format format);
>  bool isl_format_supports_lossless_compression(const struct brw_device_info *devinfo,
>                                                enum isl_format format);
> +bool isl_format_supports_multisampling(const struct brw_device_info *devinfo,
> +                                       enum isl_format format);
>  
>  bool isl_format_has_unorm_channel(enum isl_format fmt) ATTRIBUTE_CONST;
>  bool isl_format_has_snorm_channel(enum isl_format fmt) ATTRIBUTE_CONST;
> diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
> index 8507cc5..5d43fe7 100644
> --- a/src/intel/isl/isl_format.c
> +++ b/src/intel/isl/isl_format.c
> @@ -429,6 +429,36 @@ isl_format_supports_lossless_compression(const struct brw_device_info *devinfo,
>     return format_gen(devinfo) >= format_info[format].lossless_compression;
>  }
>  
> +bool
> +isl_format_supports_multisampling(const struct brw_device_info *devinfo,
> +                                  enum isl_format format)
> +{
> +   /* From the Sandybridge PRM, Volume 4 Part 1 p72, SURFACE_STATE, Surface
> +    * Format:
> +    *
> +    *    If Number of Multisamples is set to a value other than
> +    *    MULTISAMPLECOUNT_1, this field cannot be set to the following
> +    *    formats:
> +    *
> +    *       - any format with greater than 64 bits per element
> +    *       - any compressed texture format (BC*)
> +    *       - any YCRCB* format
> +    *
> +    * The restriction on the format's size is removed on Broadwell.  Also,
> +    * there is an exception for HiZ which we treat as a compressed format and
> +    * is allowed to be multisampled on Broadwell and earlier.
> +    */
> +   if (devinfo->gen < 8 && isl_format_get_layout(format)->bpb > 64) {
> +      return false;
> +   } else if (isl_format_is_compressed(format)) {
> +      return false;

I'm merely studying here a little while waiting for jenkins: HiZ case hits
this condition with ISL_TXC_HIZ. Where is the exception you mention in the
comment?

> +   } else if (isl_format_is_yuv(format)) {
> +      return false;
> +   } else {
> +      return true;
> +   }
> +}
> +
>  static inline bool
>  isl_format_has_channel_type(enum isl_format fmt, enum isl_base_type type)
>  {
> diff --git a/src/intel/isl/isl_gen6.c b/src/intel/isl/isl_gen6.c
> index 2c52e38..b30998d 100644
> --- a/src/intel/isl/isl_gen6.c
> +++ b/src/intel/isl/isl_gen6.c
> @@ -30,8 +30,6 @@ gen6_choose_msaa_layout(const struct isl_device *dev,
>                    enum isl_tiling tiling,
>                    enum isl_msaa_layout *msaa_layout)
>  {
> -   const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
> -
>     assert(ISL_DEV_GEN(dev) == 6);
>     assert(info->samples >= 1);
>  
> @@ -40,22 +38,7 @@ gen6_choose_msaa_layout(const struct isl_device *dev,
>        return false;
>     }
>  
> -   /* From the Sandybridge PRM, Volume 4 Part 1 p72, SURFACE_STATE, Surface
> -    * Format:
> -    *
> -    *    If Number of Multisamples is set to a value other than
> -    *    MULTISAMPLECOUNT_1, this field cannot be set to the following
> -    *    formats:
> -    *
> -    *       - any format with greater than 64 bits per element
> -    *       - any compressed texture format (BC*)
> -    *       - any YCRCB* format
> -    */
> -   if (fmtl->bpb > 64)
> -      return false;
> -   if (isl_format_is_compressed(info->format))
> -      return false;
> -   if (isl_format_is_yuv(info->format))
> +   if (!isl_format_supports_multisampling(dev->info, info->format))
>        return false;
>  
>     /* From the Sandybridge PRM, Volume 4 Part 1 p85, SURFACE_STATE, Number of
> diff --git a/src/intel/isl/isl_gen7.c b/src/intel/isl/isl_gen7.c
> index 02273f8..7b40291 100644
> --- a/src/intel/isl/isl_gen7.c
> +++ b/src/intel/isl/isl_gen7.c
> @@ -30,8 +30,6 @@ gen7_choose_msaa_layout(const struct isl_device *dev,
>                          enum isl_tiling tiling,
>                          enum isl_msaa_layout *msaa_layout)
>  {
> -   const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
> -
>     bool require_array = false;
>     bool require_interleaved = false;
>  
> @@ -43,19 +41,7 @@ gen7_choose_msaa_layout(const struct isl_device *dev,
>        return true;
>     }
>  
> -   /* From the Ivybridge PRM, Volume 4 Part 1 p63, SURFACE_STATE, Surface
> -    * Format:
> -    *
> -    *    If Number of Multisamples is set to a value other than
> -    *    MULTISAMPLECOUNT_1, this field cannot be set to the following
> -    *    formats: any format with greater than 64 bits per element, any
> -    *    compressed texture format (BC*), and any YCRCB* format.
> -    */
> -   if (fmtl->bpb > 64)
> -      return false;
> -   if (isl_format_is_compressed(info->format))
> -      return false;
> -   if (isl_format_is_yuv(info->format))
> +   if (!isl_format_supports_multisampling(dev->info, info->format))
>        return false;
>  
>     /* From the Ivybridge PRM, Volume 4 Part 1 p73, SURFACE_STATE, Number of
> diff --git a/src/intel/isl/isl_gen8.c b/src/intel/isl/isl_gen8.c
> index b456d70..0049614 100644
> --- a/src/intel/isl/isl_gen8.c
> +++ b/src/intel/isl/isl_gen8.c
> @@ -79,9 +79,7 @@ gen8_choose_msaa_layout(const struct isl_device *dev,
>     /* More obvious restrictions */
>     if (isl_surf_usage_is_display(info->usage))
>        return false;
> -   if (isl_format_is_compressed(info->format))
> -      return false;
> -   if (isl_format_is_yuv(info->format))
> +   if (!isl_format_supports_multisampling(dev->info, info->format))
>        return false;
>  
>     if (isl_surf_usage_is_depth_or_stencil(info->usage) ||
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list