fix ipp bugs:
authorchenli <chenli@rockchip.com>
Tue, 5 Jul 2011 12:18:18 +0000 (20:18 +0800)
committerchenli <chenli@rockchip.com>
Tue, 5 Jul 2011 12:24:16 +0000 (20:24 +0800)
1. return -EINVAL if scaling ratio is unsupported
2. check the input virtual width

drivers/staging/rk29/ipp/rk29-ipp.c

index dd9ca8b39ca62e6a6832b43f27dd5e54bac09c7f..e823974ab1f8f799c4a492e5a0a7a0f316388966 100755 (executable)
@@ -258,6 +258,18 @@ int ipp_check_param(const struct rk29_ipp_req *req)
                return  -EINVAL;\r
        }\r
 \r
+       //check src_vir_w\r
+       if(unlikely(req->src_vir_w < req->src0.w)){\r
+               ERR("invalid src_vir_w\n");\r
+               return  -EINVAL;\r
+       }\r
+\r
+       //check dst_vir_w\r
+       if(unlikely(req->dst_vir_w < req->dst0.w)){\r
+               ERR("invalid dst_vir_w\n");\r
+               return  -EINVAL;\r
+       }\r
+\r
        //check src address\r
        if (unlikely(req->src0.YrgbMst== 0) )\r
        {\r
@@ -304,7 +316,7 @@ int ipp_blit(const struct rk29_ipp_req *req)
 \r
        drvdata->ipp_result = -1;\r
 \r
-       //When ipp_blit_async is called in kernel space req->complete should NOt be NULL, otherwise req->complete should be NULL\r
+       //When ipp_blit_async is called in kernel space req->complete should NOT be NULL, otherwise req->complete should be NULL\r
        if(req->complete)\r
        {\r
                drvdata->ipp_irq_callback = req->complete;\r
@@ -613,7 +625,7 @@ int ipp_blit(const struct rk29_ipp_req *req)
                        }\r
                        else\r
                        {\r
-                               printk("invalid pre_scale operation! pre_scale_w should not be more than 8!\n");\r
+                               printk("invalid pre_scale operation! Down scaling ratio should not be more than 16!\n");\r
                                goto error_scale;\r
                        }\r
                }\r
@@ -625,7 +637,7 @@ int ipp_blit(const struct rk29_ipp_req *req)
                        }\r
                        else\r
                        {\r
-                               printk("invalid pre_scale operation! pre_scale_h should not be more than 8!\n");\r
+                               printk("invalid pre_scale operation! Down scaling ratio should not be more than 16!\n");\r
                                goto error_scale;\r
                        }\r
                }\r
@@ -861,11 +873,13 @@ int ipp_blit(const struct rk29_ipp_req *req)
 \r
 error_status:\r
 error_scale:\r
+       ret = -EINVAL;\r
        ipp_soft_reset();\r
        ipp_power_off(NULL);\r
 erorr_input:\r
 error_noerror:\r
        drvdata->ipp_result = ret;\r
+       //printk("ipp_blit done\n");\r
        return ret;\r
 }\r
 \r
@@ -1327,7 +1341,8 @@ uint32_t size = 8*1024*1024;
                */\r
 \r
                /*6.call IPP driver in the kernel space and the user space at the same time*/\r
-               \r
+                       ipp_req.src_vir_w = 280;\r
+               ipp_req.dst_vir_w = 800;\r
                do\r
                {\r
                         ret = ipp_blit_sync(&ipp_req);\r
@@ -1337,6 +1352,10 @@ uint32_t size = 8*1024*1024;
 \r
                printk("error! ret =%d\n",ret);\r
 \r
+               ipp_req.src_vir_w = 480;\r
+               ipp_req.dst_vir_w = 600;\r
+\r
+               ipp_blit_sync(&ipp_req);\r
                /*7.suspand and resume*/\r
                /*\r
                //do\r