]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/malidp: Pass along the format info from .fb_create() malidp_verify_afbc_framebuff...
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Jul 2025 09:07:09 +0000 (12:07 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 16 Jul 2025 17:05:19 +0000 (20:05 +0300)
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.dudau@arm.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250701090722.13645-7-ville.syrjala@linux.intel.com
drivers/gpu/drm/arm/malidp_drv.c

index 8b920566f2e89217b4b806738126522f3de4993e..bc5f5e9798c32268fe70021808a3e06c109ce132 100644 (file)
@@ -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);
        }