drm/malidp: Pass along the format info from .fb_create() malidp_verify_afbc_framebuffer_size()
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user