[PATCHv4 08/36] drm/komeda: Move checking src coordinates to komeda_fb_create

Andrzej Pietrasiewicz andrzej.p at collabora.com
Fri Dec 13 15:58:39 UTC 2019


Next step towards unifying afbc and non-afbc cases as much as possible.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p at collabora.com>
---
 .../drm/arm/display/komeda/komeda_framebuffer.c    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index 7487c6cf6636..aa477d1dddc3 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -107,9 +107,6 @@ komeda_fb_none_afbc_size_check(struct komeda_dev *mdev, struct komeda_fb *kfb,
 	u32 i, block_h;
 	u64 min_size;
 
-	if (komeda_fb_check_src_coords(kfb, 0, 0, fb->width, fb->height))
-		return -EINVAL;
-
 	for (i = 0; i < info->num_planes; i++) {
 		obj = drm_gem_object_lookup(file, mode_cmd->handles[i]);
 		if (!obj) {
@@ -168,10 +165,17 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 
 	drm_helper_mode_fill_fb_struct(dev, &kfb->base, mode_cmd);
 
-	if (kfb->base.modifier)
+	if (kfb->base.modifier) {
 		ret = komeda_fb_afbc_size_check(kfb, file, mode_cmd);
-	else
+	} else {
+		if (komeda_fb_check_src_coords(kfb, 0, 0, kfb->base.width,
+					       kfb->base.height)) {
+			kfree(kfb);
+			return ERR_PTR(-EINVAL);
+		}
+
 		ret = komeda_fb_none_afbc_size_check(mdev, kfb, file, mode_cmd);
+	}
 	if (ret < 0)
 		goto err_cleanup;
 
-- 
2.17.1



More information about the dri-devel mailing list