[Mesa-dev] [PATCH 15/29] intel/blorp: Support the RGB workaround on more formats

Pohjolainen, Topi topi.pohjolainen at gmail.com
Tue Mar 6 08:02:04 UTC 2018


On Fri, Jan 26, 2018 at 05:59:44PM -0800, Jason Ekstrand wrote:
> Previously we only supported UINT formats because that's what blorp_copy
> required.  If we want to use it in blorp_blit, however, we need to
> support everything.

Patches 13, 14 and 15 are:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> ---
>  src/intel/blorp/blorp_blit.c | 73 ++++++++++++++++++++++++++++++++------------
>  1 file changed, 53 insertions(+), 20 deletions(-)
> 
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
> index cd2d3b4..a0e110f 100644
> --- a/src/intel/blorp/blorp_blit.c
> +++ b/src/intel/blorp/blorp_blit.c
> @@ -1622,6 +1622,56 @@ struct blt_coords {
>     struct blt_axis x, y;
>  };
>  
> +static enum isl_format
> +get_red_format_for_rgb_format(enum isl_format format)
> +{
> +   const struct isl_format_layout *fmtl = isl_format_get_layout(format);
> +
> +   switch (fmtl->channels.r.bits) {
> +   case 8:
> +      switch (fmtl->channels.r.type) {
> +      case ISL_UNORM:
> +         return ISL_FORMAT_R8_UNORM;
> +      case ISL_SNORM:
> +         return ISL_FORMAT_R8_SNORM;
> +      case ISL_UINT:
> +         return ISL_FORMAT_R8_UINT;
> +      case ISL_SINT:
> +         return ISL_FORMAT_R8_SINT;
> +      default:
> +         unreachable("Invalid 8-bit RGB channel type");
> +      }
> +   case 16:
> +      switch (fmtl->channels.r.type) {
> +      case ISL_UNORM:
> +         return ISL_FORMAT_R16_UNORM;
> +      case ISL_SNORM:
> +         return ISL_FORMAT_R16_SNORM;
> +      case ISL_SFLOAT:
> +         return ISL_FORMAT_R16_FLOAT;
> +      case ISL_UINT:
> +         return ISL_FORMAT_R16_UINT;
> +      case ISL_SINT:
> +         return ISL_FORMAT_R16_SINT;
> +      default:
> +         unreachable("Invalid 8-bit RGB channel type");
> +      }
> +   case 32:
> +      switch (fmtl->channels.r.type) {
> +      case ISL_SFLOAT:
> +         return ISL_FORMAT_R32_FLOAT;
> +      case ISL_UINT:
> +         return ISL_FORMAT_R32_UINT;
> +      case ISL_SINT:
> +         return ISL_FORMAT_R32_SINT;
> +      default:
> +         unreachable("Invalid 8-bit RGB channel type");
> +      }
> +   default:
> +      unreachable("Invalid number of red channel bits");
> +   }
> +}
> +
>  static void
>  surf_fake_rgb_with_red(const struct isl_device *isl_dev,
>                         struct brw_blorp_surface_info *info)
> @@ -1632,26 +1682,9 @@ surf_fake_rgb_with_red(const struct isl_device *isl_dev,
>     info->surf.phys_level0_sa.width *= 3;
>     info->tile_x_sa *= 3;
>  
> -   enum isl_format red_format;
> -   switch (info->view.format) {
> -   case ISL_FORMAT_R8G8B8_UNORM:
> -      red_format = ISL_FORMAT_R8_UNORM;
> -      break;
> -   case ISL_FORMAT_R8G8B8_UINT:
> -      red_format = ISL_FORMAT_R8_UINT;
> -      break;
> -   case ISL_FORMAT_R16G16B16_UNORM:
> -      red_format = ISL_FORMAT_R16_UNORM;
> -      break;
> -   case ISL_FORMAT_R16G16B16_UINT:
> -      red_format = ISL_FORMAT_R16_UINT;
> -      break;
> -   case ISL_FORMAT_R32G32B32_UINT:
> -      red_format = ISL_FORMAT_R32_UINT;
> -      break;
> -   default:
> -      unreachable("Invalid RGB copy destination format");
> -   }
> +   enum isl_format red_format =
> +      get_red_format_for_rgb_format(info->view.format);
> +
>     assert(isl_format_get_layout(red_format)->channels.r.type ==
>            isl_format_get_layout(info->view.format)->channels.r.type);
>     assert(isl_format_get_layout(red_format)->channels.r.bits ==
> -- 
> 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