[Mesa-dev] [PATCH 2/4] freedreno: Use shared drm_find_modifier util

Rob Clark robdclark at gmail.com
Thu Mar 14 12:41:01 UTC 2019


On Thu, Mar 14, 2019 at 12:19 AM Alyssa Rosenzweig <alyssa at rosenzweig.io> wrote:
>
> Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
> Cc: Rob Clark <robdclark at gmail.com>


thanks, r-b

> ---
>  .../drivers/freedreno/freedreno_resource.c    | 20 ++++---------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
> index 36d61d715ef..620ed4cad41 100644
> --- a/src/gallium/drivers/freedreno/freedreno_resource.c
> +++ b/src/gallium/drivers/freedreno/freedreno_resource.c
> @@ -32,6 +32,7 @@
>  #include "util/u_string.h"
>  #include "util/u_surface.h"
>  #include "util/set.h"
> +#include "util/u_drm.h"
>
>  #include "freedreno_resource.h"
>  #include "freedreno_batch_cache.h"
> @@ -830,19 +831,6 @@ has_depth(enum pipe_format format)
>         }
>  }
>
> -static bool
> -find_modifier(uint64_t needle, const uint64_t *haystack, int count)
> -{
> -       int i;
> -
> -       for (i = 0; i < count; i++) {
> -               if (haystack[i] == needle)
> -                       return true;
> -       }
> -
> -       return false;
> -}
> -
>  /**
>   * Create a new texture object, using the given template info.
>   */
> @@ -906,7 +894,7 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
>          PIPE_BIND_LINEAR  | \
>          PIPE_BIND_DISPLAY_TARGET)
>
> -       bool linear = find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
> +       bool linear = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
>         if (tmpl->bind & LINEAR)
>                 linear = true;
>
> @@ -918,9 +906,9 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
>          * except we don't have a format modifier for tiled.  (We probably
>          * should.)
>          */
> -       bool allow_ubwc = find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
> +       bool allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
>         if (tmpl->bind & PIPE_BIND_SHARED)
> -               allow_ubwc = find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
> +               allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
>
>         /* TODO turn on UBWC for all internal buffers
>          * Manhattan benchmark shows artifacts when enabled.  Once this
> --
> 2.20.1
>


More information about the mesa-dev mailing list