Skip to content

Commit e3c5074

Browse files
committed
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 <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: Liviu Dudau <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a34cc7b commit e3c5074

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/gpu/drm/arm/malidp_drv.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,10 @@ malidp_verify_afbc_framebuffer_caps(struct drm_device *dev,
306306
static bool
307307
malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
308308
struct drm_file *file,
309+
const struct drm_format_info *info,
309310
const struct drm_mode_fb_cmd2 *mode_cmd)
310311
{
311312
int n_superblocks = 0;
312-
const struct drm_format_info *info;
313313
struct drm_gem_object *objs = NULL;
314314
u32 afbc_superblock_size = 0, afbc_superblock_height = 0;
315315
u32 afbc_superblock_width = 0, afbc_size = 0;
@@ -325,9 +325,6 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
325325
return false;
326326
}
327327

328-
info = drm_get_format_info(dev, mode_cmd->pixel_format,
329-
mode_cmd->modifier[0]);
330-
331328
n_superblocks = (mode_cmd->width / afbc_superblock_width) *
332329
(mode_cmd->height / afbc_superblock_height);
333330

@@ -367,10 +364,11 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
367364

368365
static bool
369366
malidp_verify_afbc_framebuffer(struct drm_device *dev, struct drm_file *file,
367+
const struct drm_format_info *info,
370368
const struct drm_mode_fb_cmd2 *mode_cmd)
371369
{
372370
if (malidp_verify_afbc_framebuffer_caps(dev, mode_cmd))
373-
return malidp_verify_afbc_framebuffer_size(dev, file, mode_cmd);
371+
return malidp_verify_afbc_framebuffer_size(dev, file, info, mode_cmd);
374372

375373
return false;
376374
}
@@ -381,7 +379,7 @@ malidp_fb_create(struct drm_device *dev, struct drm_file *file,
381379
const struct drm_mode_fb_cmd2 *mode_cmd)
382380
{
383381
if (mode_cmd->modifier[0]) {
384-
if (!malidp_verify_afbc_framebuffer(dev, file, mode_cmd))
382+
if (!malidp_verify_afbc_framebuffer(dev, file, info, mode_cmd))
385383
return ERR_PTR(-EINVAL);
386384
}
387385

0 commit comments

Comments
 (0)