IEP: re-caculate the uv address when 4k video input in iommu enable case.
authorAlpha Lin <alpha.lin@rock-chips.com>
Tue, 15 Sep 2015 11:01:29 +0000 (19:01 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Wed, 23 Sep 2015 10:13:18 +0000 (18:13 +0800)
In above case, old code will generate a fault address for
uv address if 4k video input or output.

Change-Id: I22e9793fbaa2da250097ba69a3fd4fdf58585b78
Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
drivers/video/rockchip/iep/hw_iep_reg.c

index 9df61660b9e0ffbddb9e89d268d27f3d4ac7140e..d44d0c89015181207a1d4720fa4c04c9d99d131b 100644 (file)
@@ -1494,6 +1494,8 @@ static int iep_reg_address_translate(iep_service_info *pservice, struct iep_reg
 void iep_config(iep_session *session, struct IEP_MSG *iep_msg)
 {
        struct iep_reg *reg = kzalloc(sizeof(struct iep_reg), GFP_KERNEL);
+       int w;
+       int h;
 
        reg->session = session;
        iep_msg->base = reg->reg;
@@ -1567,6 +1569,16 @@ void iep_config(iep_session *session, struct IEP_MSG *iep_msg)
                }
        }
 #endif
+       /* workaround for iommu enable case when 4k video input */
+       w = (iep_msg->src.act_w + 15) & (0xfffffff0);
+       h = (iep_msg->src.act_h + 15) & (0xfffffff0);
+       if (w > 1920 && iep_msg->src.format == IEP_FORMAT_YCbCr_420_SP)
+               reg->reg[33] = reg->reg[32] + w * h;
+
+       w = (iep_msg->dst.act_w + 15) & (0xfffffff0);
+       h = (iep_msg->dst.act_h + 15) & (0xfffffff0);
+       if (w > 1920 && iep_msg->dst.format == IEP_FORMAT_YCbCr_420_SP)
+               reg->reg[45] = reg->reg[44] + w * h;
 
        mutex_lock(&iep_service.lock);