diff mbox series

[PATCHv5,06/34] drm/komeda: Move checking src coordinates to komeda_fb_create

Message ID 20191217145020.14645-7-andrzej.p@collabora.com (mailing list archive)
State New, archived
Headers show
Series Add AFBC support for Rockchip | expand

Commit Message

Andrzej Pietrasiewicz Dec. 17, 2019, 2:49 p.m. UTC
Next step towards unifying afbc and non-afbc cases as much as possible.

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

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index 2f993a9cfb8b..5a1e5f621a8f 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -106,9 +106,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) {
@@ -167,10 +164,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;