drm/tgm: tdm/pp: add alignmentation to fix cropping problem. 47/145547/2
authorJin-young Jeon <jy0.jeon@samsung.com>
Mon, 7 Aug 2017 06:39:51 +0000 (15:39 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 23 Aug 2017 02:15:37 +0000 (02:15 +0000)
add alignmentation to fix cropping problem
This patch comes from product kernel.

Change-Id: I2901cbe286471ae47932ea7970e5d1025eef0aa9
Signed-off-by: Jin-young Jeon <jy0.jeon@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/tgm/tdm_pp_msc.c

index c5db64d244eea2c4872eaff69f4e1d83046f3b26..2adc8798bff98c8a25ff22d6b6cae6ee4b559239 100644 (file)
@@ -61,6 +61,7 @@
 #define SC_COEF_H_8T   8
 #define SC_COEF_V_4T   4
 #define SC_COEF_DEPTH  3
+#define SC_POS_ALIGN   2
 #define SC_UP_MAX              SC_RATIO(1, 16)
 #define SC_DOWN_MIN            SC_RATIO(4, 1)
 #define SC_DOWN_SWMIN          SC_RATIO(16, 1)
@@ -86,6 +87,7 @@
 container_of(ppdrv, struct sc_context, ppdrv)
 #define sc_read(offset)                readl(ctx->regs + (offset))
 #define sc_write(cfg, offset)  writel(cfg, ctx->regs + (offset))
+#define ROUNDUP(x, y)          ((((x) + ((y) - 1)) / (y)) * (y))
 
 /* definition of csc type */
 enum sc_csc_type {
@@ -1380,6 +1382,28 @@ static inline bool sc_check_fmt_limit(struct tdm_pp_property *property)
 static int sc_ppdrv_check_property(struct device *dev,
                struct tdm_pp_property *property)
 {
+       struct tdm_pp_config *config;
+       struct tdm_pos *pos;
+       struct tdm_sz *sz;
+       int i;
+
+       DRM_DEBUG("%s\n", __func__);
+
+       for_each_pp_ops(i) {
+               config = &property->config[i];
+               pos = &config->pos;
+               pos->w = ROUNDUP(pos->w, SC_POS_ALIGN);
+               pos->h = ROUNDUP(pos->h, SC_POS_ALIGN);
+               sz = &config->sz;
+
+               DRM_DEBUG("sc:prop_id[%d]ops[%s]fmt[0x%x]\n",
+                       property->prop_id, i ? "dst" : "src", config->fmt);
+
+               DRM_DEBUG("sc:pos[%d %d %d %d]sz[%d %d]f[%d]r[%d]\n",
+                       pos->x, pos->y, pos->w, pos->h,
+                       sz->hsize, sz->vsize, config->flip, config->degree);
+       }
+
        return 0;
 }