From: zsq Date: Tue, 1 Apr 2014 09:58:21 +0000 (+0800) Subject: fix rga2 yuv 420p uv swap bug X-Git-Tag: firefly_0821_release~5664 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9596d0ed7557d7aac140ee25d9335969b6a15705;p=firefly-linux-kernel-4.4.55.git fix rga2 yuv 420p uv swap bug --- diff --git a/drivers/video/rockchip/rga2/rga2_drv.c b/drivers/video/rockchip/rga2/rga2_drv.c index 5af573b33fdd..64ea4f2aa04b 100755 --- a/drivers/video/rockchip/rga2/rga2_drv.c +++ b/drivers/video/rockchip/rga2/rga2_drv.c @@ -693,12 +693,14 @@ static int rga2_convert_dma_buf(struct rga2_req *req) } ion_phys(rga2_drvdata->ion_client, hdl, &phy_addr, &len); req->src.yrgb_addr = phy_addr; - req->src.uv_addr = req->src.yrgb_addr + (req->src.vir_w * req->src.vir_h); + req->src.uv_addr = req->src.yrgb_addr + (req->dst.vir_w * req->dst.vir_h); + req->src.v_addr = req->src.uv_addr + (req->dst.vir_w * req->dst.vir_h)/4; ion_free(rga2_drvdata->ion_client, hdl); } else { req->src.yrgb_addr = req->src.uv_addr; - req->src.uv_addr = req->src.yrgb_addr + (req->src.vir_w * req->src.vir_h); + req->src.uv_addr = req->src.yrgb_addr + (req->dst.vir_w * req->dst.vir_h); + req->src.v_addr = req->src.uv_addr + (req->dst.vir_w * req->dst.vir_h)/4; } if(req->dst.yrgb_addr) { @@ -711,11 +713,13 @@ static int rga2_convert_dma_buf(struct rga2_req *req) ion_phys(rga2_drvdata->ion_client, hdl, &phy_addr, &len); req->dst.yrgb_addr = phy_addr; req->dst.uv_addr = req->dst.yrgb_addr + (req->dst.vir_w * req->dst.vir_h); + req->dst.v_addr = req->dst.uv_addr + (req->dst.vir_w * req->dst.vir_h)/4; ion_free(rga2_drvdata->ion_client, hdl); } else { req->dst.yrgb_addr = req->dst.uv_addr; - req->dst.uv_addr = req->dst.yrgb_addr + (req->src.vir_w * req->src.vir_h); + req->dst.uv_addr = req->dst.yrgb_addr + (req->dst.vir_w * req->dst.vir_h); + req->dst.v_addr = req->dst.uv_addr + (req->dst.vir_w * req->dst.vir_h)/4; } return 0; diff --git a/drivers/video/rockchip/rga2/rga2_reg_info.c b/drivers/video/rockchip/rga2/rga2_reg_info.c index eff8fed668f0..b80ac018ee2c 100644 --- a/drivers/video/rockchip/rga2/rga2_reg_info.c +++ b/drivers/video/rockchip/rga2/rga2_reg_info.c @@ -535,8 +535,23 @@ RGA2_set_reg_dst_info(u8 *base, struct rga2_req *msg) } *bRGA_DST_BASE0 = (RK_U32)yrgb_addr; - *bRGA_DST_BASE1 = (RK_U32)u_addr; - *bRGA_DST_BASE2 = (RK_U32)v_addr; + + if((msg->dst.format == RGA2_FORMAT_YCbCr_420_P) || (msg->dst.format == RGA2_FORMAT_YCrCb_420_P)) + { + if(dst_cbcr_swp == 0) { + *bRGA_DST_BASE1 = (RK_U32)v_addr; + *bRGA_DST_BASE2 = (RK_U32)u_addr; + } + else { + *bRGA_DST_BASE1 = (RK_U32)u_addr; + *bRGA_DST_BASE2 = (RK_U32)v_addr; + } + } + else { + *bRGA_DST_BASE1 = (RK_U32)u_addr; + *bRGA_DST_BASE2 = (RK_U32)v_addr; + } + *bRGA_SRC_BASE3 = (RK_U32)s_y_lt_addr; }