[PATCHv4 11/36] drm/komeda: Explicitly require 1 plane for AFBC

Andrzej Pietrasiewicz
2019-12-13T21:24:59Z

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(+)

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,