From: zsq Date: Thu, 29 Mar 2012 09:18:52 +0000 (-0800) Subject: fix RGA sync ret value bug X-Git-Tag: firefly_0821_release~9560^2~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1a55edba584304f05673db9fd55a59d6de57a955;p=firefly-linux-kernel-4.4.55.git fix RGA sync ret value bug --- diff --git a/drivers/video/rockchip/rga/rga_drv.c b/drivers/video/rockchip/rga/rga_drv.c index 9121030d319d..f3a7c8f02a5a 100755 --- a/drivers/video/rockchip/rga/rga_drv.c +++ b/drivers/video/rockchip/rga/rga_drv.c @@ -49,8 +49,6 @@ #include "rga_mmu_info.h" #include "RGA_API.h" -//#include "bug_320x240_swap0_ABGR8888.h" - #define RGA_TEST 0 #define RGA_TEST_TIME 0 @@ -507,9 +505,8 @@ static void rga_service_session_clear(rga_session *session) static void rga_try_set_reg(uint32_t num) { unsigned long flag; + uint32_t offset; - // first get reg from reg list - if (!num) { #if RGA_TEST @@ -525,6 +522,7 @@ static void rga_try_set_reg(uint32_t num) do { struct rga_reg *reg = list_entry(rga_service.waiting.next, struct rga_reg, status_link); + offset = atomic_read(&rga_service.cmd_num); if((rga_read(RGA_STATUS) & 0x1)) { #if RGA_TEST @@ -533,10 +531,7 @@ static void rga_try_set_reg(uint32_t num) #endif if((atomic_read(&rga_service.cmd_num) <= 0xf) && (atomic_read(&rga_service.int_disable) == 0)) - { - uint32_t offset; - - offset = atomic_read(&rga_service.cmd_num); + { rga_copy_reg(reg, offset); rga_reg_from_wait_to_run(reg); @@ -753,14 +748,12 @@ static int rga_blit_sync(rga_session *session, struct rga_req *req) { /* check value if legal */ ret = rga_check_param(req); - if(ret == -EINVAL) - { + if(ret == -EINVAL) { return -EFAULT; } reg = rga_reg_init(session, req); - if(reg == NULL) - { + if(reg == NULL) { return -EFAULT; } num = 1; @@ -786,6 +779,8 @@ static int rga_blit_sync(rga_session *session, struct rga_req *req) rga_end = ktime_sub(rga_end, rga_start); printk("one cmd end time %d\n", (int)ktime_to_us(rga_end)); #endif + + return 0; } while(0); diff --git a/drivers/video/rockchip/rga/rga_mmu_info.c b/drivers/video/rockchip/rga/rga_mmu_info.c index 467e5fcbf6dd..f172aebbb470 100755 --- a/drivers/video/rockchip/rga/rga_mmu_info.c +++ b/drivers/video/rockchip/rga/rga_mmu_info.c @@ -218,6 +218,7 @@ static int rga_MapUserMemory(struct page **pages, uint32_t i; uint32_t status; uint32_t Address; + uint32_t t_mem; status = 0; do @@ -240,7 +241,9 @@ static int rga_MapUserMemory(struct page **pages, for(i=0; imm, (Memory + i) << PAGE_SHIFT); + t_mem = Memory + i; + + vma = find_vma(current->mm, (t_mem) << PAGE_SHIFT); if (vma && (vma->vm_flags & VM_PFNMAP) ) { @@ -248,16 +251,16 @@ static int rga_MapUserMemory(struct page **pages, { pte_t * pte; spinlock_t * ptl; - unsigned long pfn; + unsigned long pfn; - pgd_t * pgd = pgd_offset(current->mm, ((Memory + i)<< PAGE_SHIFT)); - pud_t * pud = pud_offset(pgd, ((Memory + i) << PAGE_SHIFT)); + pgd_t * pgd = pgd_offset(current->mm, ((t_mem)<< PAGE_SHIFT)); + pud_t * pud = pud_offset(pgd, ((t_mem) << PAGE_SHIFT)); if (pud) { - pmd_t * pmd = pmd_offset(pud, ((Memory + i) << PAGE_SHIFT)); + pmd_t * pmd = pmd_offset(pud, ((t_mem) << PAGE_SHIFT)); if (pmd) { - pte = pte_offset_map_lock(current->mm, pmd, ((Memory + i)<< PAGE_SHIFT), &ptl); + pte = pte_offset_map_lock(current->mm, pmd, ((t_mem)<< PAGE_SHIFT), &ptl); if (!pte) { break; @@ -274,7 +277,7 @@ static int rga_MapUserMemory(struct page **pages, } pfn = pte_pfn(*pte); - Address = ((pfn << PAGE_SHIFT) | (((unsigned long)((Memory + i) << PAGE_SHIFT)) & ~PAGE_MASK)); + Address = ((pfn << PAGE_SHIFT) | (((unsigned long)((t_mem) << PAGE_SHIFT)) & ~PAGE_MASK)); pte_unmap_unlock(pte, ptl); #if 0 @@ -381,7 +384,7 @@ static int rga_mmu_info_BitBlt_mode(struct rga_reg *reg, struct rga_req *req) { /* cal src buf mmu info */ SrcMemSize = rga_buf_size_cal(req->src.yrgb_addr, req->src.uv_addr, req->src.v_addr, - req->src.format, req->src.vir_w, req->src.vir_h, + req->src.format, req->src.vir_w, (req->src.act_h + req->src.y_offset), &SrcStart); if(SrcMemSize == 0) { return -EINVAL;