[PATCHv4,11/36] drm/komeda: Explicitly require 1 plane for AFBC
diff mbox series

Message ID 20191213155907.16581-12-andrzej.p@collabora.com
State New
Headers show
Series
  • AFBC support for Rockchip
Related show

Commit Message

Andrzej Pietrasiewicz Dec. 13, 2019, 3:58 p.m. UTC
Apparently komeda silently assumes that there is only 1 plane in an AFBC
buffer. Make this assumption explicit.

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

Patch
diff mbox series

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index ce96389e3c40..157b73005ef8 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -170,6 +170,11 @@  komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 	info = kfb->base.format;
 
 	if (kfb->base.modifier) {
+		if (info->num_planes != 1) {
+			DRM_DEBUG_KMS("AFBC requires exactly 1 plane.\n");
+			kfree(kfb);
+			return ERR_PTR(-EINVAL);
+		}
 		ret = komeda_fb_afbc_size_check(kfb, info, file, mode_cmd);
 	} else {
 		if (komeda_fb_check_src_coords(kfb, 0, 0, kfb->base.width,