[Mesa-dev] [RFC v5 12/19] intel/isl: Add ISL tiling -> modifier conversion

Jason Ekstrand jason at jlekstrand.net
Mon Nov 13 23:14:35 UTC 2017


On Mon, Nov 6, 2017 at 2:02 PM, Louis-Francis Ratté-Boulianne <
lfrb at collabora.com> wrote:

> From: Daniel Stone <daniels at collabora.com>
>
> Given a tiling mode and an aux usage, return the DRM modifier.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  src/intel/isl/isl.h     |  6 +++++-
>  src/intel/isl/isl_drm.c | 17 +++++++++++++++++
>  2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
> index e3acb0ec28..b255f15a5d 100644
> --- a/src/intel/isl/isl.h
> +++ b/src/intel/isl/isl.h
> @@ -1551,7 +1551,7 @@ isl_tiling_is_std_y(enum isl_tiling tiling)
>  uint32_t
>  isl_tiling_to_i915_tiling(enum isl_tiling tiling);
>
> -enum isl_tiling
> +enum isl_tiling
>  isl_tiling_from_i915_tiling(uint32_t tiling);
>
>  const struct isl_drm_modifier_info * ATTRIBUTE_CONST
> @@ -1583,6 +1583,10 @@ isl_drm_modifier_get_default_aux_state(uint64_t
> modifier)
>                                             ISL_AUX_STATE_COMPRESSED_NO_
> CLEAR;
>  }
>
> +uint64_t ATTRIBUTE_CONST
> +isl_drm_modifier_from_tiling(enum isl_tiling tiling,
> +                             enum isl_aux_usage aux_usage);
> +
>  struct isl_extent2d ATTRIBUTE_CONST
>  isl_get_interleaved_msaa_px_size_sa(uint32_t samples);
>
> diff --git a/src/intel/isl/isl_drm.c b/src/intel/isl/isl_drm.c
> index eb3c6f5913..a40142c6ec 100644
> --- a/src/intel/isl/isl_drm.c
> +++ b/src/intel/isl/isl_drm.c
> @@ -30,6 +30,10 @@
>  #include "isl.h"
>  #include "common/gen_device_info.h"
>
> +#ifndef DRM_FORMAT_MOD_INVALID
> +#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
> +#endif
> +
>

We include the copy of drm_foucc.h we have stashed in mesa, so you can just
assume this is defined.


>  uint32_t
>  isl_tiling_to_i915_tiling(enum isl_tiling tiling)
>  {
> @@ -106,3 +110,16 @@ isl_drm_modifier_get_info(uint64_t modifier)
>
>     return NULL;
>  }
> +
> +uint64_t
> +isl_drm_modifier_from_tiling(enum isl_tiling tiling,
> +                             enum isl_aux_usage aux_usage)
> +{
> +   for (unsigned i = 0; i < ARRAY_SIZE(modifier_info); i++) {
> +      if (modifier_info[i].tiling == tiling &&
> +          modifier_info[i].aux_usage == aux_usage)
> +         return modifier_info[i].modifier;
> +   }
> +
> +   return DRM_FORMAT_MOD_INVALID;
> +}
> --
> 2.13.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171113/1181bda9/attachment.html>


More information about the mesa-dev mailing list