media: platform: mtk-mdp: don't try to crop to odd frame sizes
The HW is not able to handle odd frame sizes. Return an error when
trying to crop using an odd frame size.
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Bug: 172974332
Change-Id: I34eadd5822951d8b61cd7e661bcaf3aa3c36c9b4
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
index 11a6a47..655a5bc 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
@@ -460,6 +460,12 @@
return -EINVAL;
}
+ if (r->width & 1 || r->height & 1) {
+ dev_err(&ctx->mdp_dev->pdev->dev,
+ "doesn't support odd frame sizes\n");
+ return -EINVAL;
+ }
+
mtk_mdp_dbg(2, "[%d] type:%d, set wxh:%dx%d", ctx->id, type,
r->width, r->height);