summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/mxs_pxp.c4
-rw-r--r--drivers/media/video/mxs_pxp.h6
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/media/video/mxs_pxp.c b/drivers/media/video/mxs_pxp.c
index 44afef46f116..83c9c52c3b0c 100644
--- a/drivers/media/video/mxs_pxp.c
+++ b/drivers/media/video/mxs_pxp.c
@@ -311,6 +311,10 @@ static int pxp_set_scaling(struct pxps *pxp)
pxp->scaling = 1;
xscale = pxp->srect.width * 0x1000 / pxp->drect.width;
yscale = pxp->srect.height * 0x1000 / pxp->drect.height;
+ if (xscale > PXP_DOWNSCALE_THRESHOLD)
+ xscale = PXP_DOWNSCALE_THRESHOLD;
+ if (yscale > PXP_DOWNSCALE_THRESHOLD)
+ yscale = PXP_DOWNSCALE_THRESHOLD;
s0scale = BF_PXP_S0SCALE_YSCALE(yscale) | BF_PXP_S0SCALE_XSCALE(xscale);
pxp->regs_virt->s0scale = s0scale;
diff --git a/drivers/media/video/mxs_pxp.h b/drivers/media/video/mxs_pxp.h
index d027c358338b..6538388fa4cd 100644
--- a/drivers/media/video/mxs_pxp.h
+++ b/drivers/media/video/mxs_pxp.h
@@ -39,6 +39,12 @@
#define BF_PXP_OUTSIZE_WIDTH(v) BF_PXP_RGBSIZE_WIDTH(v)
#define BF_PXP_OUTSIZE_HEIGHT(v) BF_PXP_RGBSIZE_HEIGHT(v)
+
+/* The maximum down scaling factor is 1/2 */
+#define PXP_DOWNSCALE_THRESHOLD 0x2000
+#else
+/* The maximum down scaling factor is 1/4 */
+#define PXP_DOWNSCALE_THRESHOLD 0x4000
#endif
struct pxp_overlay_registers {