On Tue, Jul 01, 2025 at 12:07:09PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrj...@linux.intel.com>
> 
> Plumb the format info from .fb_create() all the way to
> malidp_verify_afbc_framebuffer_size() to avoid the
> redundant lookup.
> 
> Cc: Liviu Dudau <liviu.du...@arm.com>
> Reviewed-by: Thomas Zimmermann <tzimmerm...@suse.de>
> Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>

Reviewed-by: Liviu Dudau <liviu.du...@arm.com>

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c 
> b/drivers/gpu/drm/arm/malidp_drv.c
> index 8b920566f2e8..bc5f5e9798c3 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -306,10 +306,10 @@ malidp_verify_afbc_framebuffer_caps(struct drm_device 
> *dev,
>  static bool
>  malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
>                                   struct drm_file *file,
> +                                 const struct drm_format_info *info,
>                                   const struct drm_mode_fb_cmd2 *mode_cmd)
>  {
>       int n_superblocks = 0;
> -     const struct drm_format_info *info;
>       struct drm_gem_object *objs = NULL;
>       u32 afbc_superblock_size = 0, afbc_superblock_height = 0;
>       u32 afbc_superblock_width = 0, afbc_size = 0;
> @@ -325,9 +325,6 @@ malidp_verify_afbc_framebuffer_size(struct drm_device 
> *dev,
>               return false;
>       }
>  
> -     info = drm_get_format_info(dev, mode_cmd->pixel_format,
> -                                mode_cmd->modifier[0]);
> -
>       n_superblocks = (mode_cmd->width / afbc_superblock_width) *
>               (mode_cmd->height / afbc_superblock_height);
>  
> @@ -367,10 +364,11 @@ malidp_verify_afbc_framebuffer_size(struct drm_device 
> *dev,
>  
>  static bool
>  malidp_verify_afbc_framebuffer(struct drm_device *dev, struct drm_file *file,
> +                            const struct drm_format_info *info,
>                              const struct drm_mode_fb_cmd2 *mode_cmd)
>  {
>       if (malidp_verify_afbc_framebuffer_caps(dev, mode_cmd))
> -             return malidp_verify_afbc_framebuffer_size(dev, file, mode_cmd);
> +             return malidp_verify_afbc_framebuffer_size(dev, file, info, 
> mode_cmd);
>  
>       return false;
>  }
> @@ -381,7 +379,7 @@ malidp_fb_create(struct drm_device *dev, struct drm_file 
> *file,
>                const struct drm_mode_fb_cmd2 *mode_cmd)
>  {
>       if (mode_cmd->modifier[0]) {
> -             if (!malidp_verify_afbc_framebuffer(dev, file, mode_cmd))
> +             if (!malidp_verify_afbc_framebuffer(dev, file, info, mode_cmd))
>                       return ERR_PTR(-EINVAL);
>       }
>  
> -- 
> 2.49.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Reply via email to