@@ -101,6 +101,7 @@ static int
komeda_fb_none_afbc_size_check(struct komeda_dev *mdev,
struct komeda_fb *kfb,
const struct drm_format_info *info,
+ struct drm_gem_object **objs,
struct drm_file *file,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
@@ -110,12 +111,7 @@ komeda_fb_none_afbc_size_check(struct komeda_dev *mdev,
u64 min_size;
for (i = 0; i < info->num_planes; i++) {
- obj = drm_gem_object_lookup(file, mode_cmd->handles[i]);
- if (!obj) {
- DRM_DEBUG_KMS("Failed to lookup GEM object\n");
- return -ENOENT;
- }
- fb->obj[i] = obj;
+ obj = objs[i];
block_h = drm_format_info_block_height(info, i);
if ((fb->pitches[i] * block_h) % mdev->chip.bus_width) {
@@ -175,14 +171,23 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
}
ret = komeda_fb_afbc_size_check(kfb, info, file, mode_cmd);
} else {
+ struct drm_gem_object *objs[4];
+
if (komeda_fb_check_src_coords(kfb, 0, 0, kfb->base.width,
kfb->base.height)) {
kfree(kfb);
return ERR_PTR(-EINVAL);
}
+ ret = drm_gem_fb_lookup(dev, file, mode_cmd, objs);
+ if (ret < 0) {
+ kfree(kfb);
+ return ERR_PTR(ret);
+ }
- ret = komeda_fb_none_afbc_size_check(mdev, kfb, info, file,
- mode_cmd);
+ ret = komeda_fb_none_afbc_size_check(mdev, kfb, info, objs,
+ file, mode_cmd);
+ for (i = 0; i < info->num_planes; ++i)
+ kfb->base.obj[i] = objs[i];
}
if (ret < 0)
goto err_cleanup;
Ultimately we want lookups happening only once in komeda's fb_create implementation. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> --- .../arm/display/komeda/komeda_framebuffer.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-)