uint32_t saw, sah, daw, dah;\r
\r
req2 = NULL;\r
+\r
+ #if RGA_TEST\r
+ printk("src.yrgb_addr = %.8x, src.uv_addr = %.8x, src.v_addr = %.8x\n", \r
+ req->src.yrgb_addr, req->src.uv_addr, req->src.v_addr);\r
+ printk("dst.yrgb_addr = %.8x, dst.uv_addr = %.8x, dst.v_addr = %.8x\n", \r
+ req->dst.yrgb_addr, req->dst.uv_addr, req->dst.v_addr); \r
+ #endif\r
\r
saw = req->src.act_w;\r
sah = req->src.act_h;\r
num = 1; \r
} \r
\r
- rga_power_on();\r
+ //rga_power_on();\r
atomic_set(®->int_enable, 1); \r
rga_try_set_reg(num);\r
\r
daw = req->dst.act_w;\r
dah = req->dst.act_h;\r
\r
+ #if RGA_TEST\r
+\r
+ printk("src.yrgb_addr = %.8x, src.uv_addr = %.8x, src.v_addr = %.8x\n", \r
+ req->src.yrgb_addr, req->src.uv_addr, req->src.v_addr);\r
+ printk("dst.yrgb_addr = %.8x, dst.uv_addr = %.8x, dst.v_addr = %.8x\n", \r
+ req->dst.yrgb_addr, req->dst.uv_addr, req->dst.v_addr); \r
+ #endif\r
+\r
do\r
{\r
if((req->render_mode == bitblt_mode) && (((saw>>1) >= daw) || ((sah>>1) >= dah))) \r
num = 1; \r
} \r
\r
- rga_power_on();\r
+ //rga_power_on();\r
atomic_set(®->int_enable, 1); \r
rga_try_set_reg(num);\r
\r
kfree(req2);\r
}\r
\r
- return ret; \r
+ return -EFAULT; \r
}\r
\r
\r
\r
if(((rga_read(RGA_STATUS) & 0x1) != 0))// idle\r
{ \r
- printk("RGA is not idle!\n");\r
+ printk(" INT ERROR RGA is not idle!\n");\r
rga_soft_reset();\r
}\r
\r
mmu_buf = (uint32_t *)kmalloc(1024*8, GFP_KERNEL); \r
if(mmu_buf == NULL) \r
{\r
- ERR("RGA get Pre Scale buff failed. \n");\r
+ printk(KERN_ERR "RGA get Pre Scale buff failed. \n");\r
return -1;\r
}\r
\r
buf_p = (uint32_t *)__get_free_page(GFP_KERNEL); \r
if(buf_p == NULL)\r
{\r
- printk("RGA init pre scale buf falied\n");\r
+ printk(KERN_ERR "RGA init pre scale buf falied\n");\r
return -ENOMEM;\r
}\r
\r
\r
if ((ret = platform_driver_register(&rga_driver)) != 0)\r
{\r
- ERR("Platform device register failed (%d).\n", ret);\r
+ printk(KERN_ERR "Platform device register failed (%d).\n", ret);\r
return ret;\r
}\r
\r
- #if 0\r
- {\r
- uint32_t i;\r
- for(i=0; i<10; i++)\r
- rga_test_0();\r
- }\r
- #endif\r
-\r
//rga_test_0();\r
\r
INFO("Module initialized.\n"); \r
\r
\r
#if 0\r
+\r
+#include "320x240_swap0_Y4200.h"\r
+#include "320x240_swap0_UV4200.h"\r
+#include "320x240_swap0_ABGR8888.h"\r
+\r
+\r
extern struct fb_info * rk_get_fb(int fb_id);\r
EXPORT_SYMBOL(rk_get_fb);\r
\r
extern void rk_direct_fb_show(struct fb_info * fbi);\r
EXPORT_SYMBOL(rk_direct_fb_show);\r
\r
-extern uint32_t ABGR8888_320_240_swap0[240][320];\r
-//unsigned int src_buf[1280*800];\r
unsigned int dst_buf[1280*800];\r
\r
void rga_test_0(void)\r
fb = rk_get_fb(0);\r
\r
memset(&req, 0, sizeof(struct rga_req));\r
- src = ABGR8888_320_240_swap0;\r
+ src = Y4200_320_240_swap0;\r
dst = dst_buf;\r
\r
#if 0\r
req.src.vir_w = 320;\r
req.src.vir_h = 240;\r
req.src.yrgb_addr = (uint32_t)src;\r
- req.src.uv_addr = ((uint32_t)src + 1920*1080);\r
- req.src.format = 0;\r
+ req.src.uv_addr = (uint32_t)UV4200_320_240_swap0;\r
+ req.src.format = 0xa;\r
\r
- req.dst.act_w = 320;\r
- req.dst.act_h = 240;\r
+ req.dst.act_w = 100;\r
+ req.dst.act_h = 80;\r
\r
req.dst.vir_w = 1280;\r
req.dst.vir_h = 800;\r
req.clip.xmax = 1279;\r
req.clip.ymin = 0;\r
req.clip.ymax = 799;\r
- \r
- req.render_mode = color_fill_mode ;\r
- req.color_fill_mode = 0;\r
- req.fg_color = 0xa0a0a0a0;\r
- \r
+ \r
req.rotate_mode = 1;\r
req.scale_mode = 2;\r
\r
fb->var.transp.offset = 24;\r
fb->var.transp.msb_right = 0;\r
\r
+ fb->var.nonstd &= (~0xff);\r
+ fb->var.nonstd |= 1;\r
+\r
fb->fix.smem_start = virt_to_phys(dst);\r
\r
rk_direct_fb_show(fb); \r
#include "rga_mmu_info.h"\r
\r
extern rga_service_info rga_service;\r
-extern int mmu_buf[1024];\r
\r
#define KERNEL_SPACE_VALID 0xc0000000\r
\r
break;\r
}\r
\r
- pfn = pte_pfn(*pte);\r
-\r
- Address = ((pfn << PAGE_SHIFT) | (((unsigned long)((Memory + i) << PAGE_SHIFT)) & ~PAGE_MASK));\r
- \r
+ pfn = pte_pfn(*pte);\r
+ Address = ((pfn << PAGE_SHIFT) | (((unsigned long)((Memory + i) << PAGE_SHIFT)) & ~PAGE_MASK)); \r
pte_unmap_unlock(pte, ptl);\r
-\r
+ \r
+ #if 0\r
/* Free the page table. */\r
if (pages != NULL)\r
{\r
}\r
}\r
}\r
+ #endif\r
\r
pageTable[i] = Address;\r
}\r
{\r
/* Get the physical address from page struct. */\r
pageTable[i] = page_to_phys(pages[i]);\r
- } \r
+ }\r
+\r
+ return 0;\r
}\r
while(0);\r
\r
uint32_t *MMU_Base, *MMU_p;\r
int ret;\r
int status;\r
+ uint32_t uv_size, v_size;\r
\r
struct page **pages = NULL;\r
\r
/* zsq \r
* change the buf address in req struct \r
*/\r
- #if 0 \r
- printk("CMDMemSize is %.8x\n", CMDMemSize);\r
- printk("SrcMemSize is %.8x\n", SrcMemSize);\r
- printk("DstMemSize is %.8x\n", DstMemSize);\r
- printk("CMDStart is %.8x\n", CMDStart);\r
- printk("SrcStart is %.8x\n", SrcStart);\r
- printk("DstStart is %.8x\n", DstStart);\r
- #endif\r
\r
- req->mmu_info.base_addr = (virt_to_phys(MMU_Base)>>2); \r
+ req->mmu_info.base_addr = (virt_to_phys(MMU_Base)>>2);\r
\r
+ uv_size = (req->src.uv_addr - (SrcStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+ v_size = (req->src.v_addr - (SrcStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+ \r
req->src.yrgb_addr = (req->src.yrgb_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
- req->src.uv_addr = (req->src.uv_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
- req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT); \r
+ req->src.uv_addr = (req->src.uv_addr & (~PAGE_MASK)) | ((CMDMemSize + uv_size) << PAGE_SHIFT);\r
+ req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | ((CMDMemSize + v_size) << PAGE_SHIFT); \r
\r
req->dst.yrgb_addr = (req->dst.yrgb_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize) << PAGE_SHIFT);\r
\r
ret = rga_MapUserMemory(&pages[CMDMemSize + SrcMemSize], &MMU_Base[CMDMemSize + SrcMemSize], DstStart, DstMemSize);\r
if (ret < 0) \r
{\r
- pr_err("rga map dst memory failed");\r
+ pr_err("rga map dst memory failed\n");\r
status = ret;\r
break;\r
}\r
\r
pages = (struct page **)kmalloc(AllSize * sizeof(struct page *), GFP_KERNEL);\r
if(pages == NULL) {\r
- pr_err("RGA MMU malloc pages mem failed");\r
+ pr_err("RGA MMU malloc pages mem failed\n");\r
status = RGA_MALLOC_ERROR; \r
break;\r
}\r
\r
MMU_Base = (uint32_t *)kmalloc(AllSize * sizeof(uint32_t), GFP_KERNEL);\r
if(pages == NULL) {\r
- pr_err("RGA MMU malloc MMU_Base point failed");\r
+ pr_err("RGA MMU malloc MMU_Base point failed\n");\r
status = RGA_MALLOC_ERROR;\r
break; \r
}\r
{\r
ret = rga_MapUserMemory(&pages[CMDMemSize], &MMU_Base[CMDMemSize], DstStart, DstMemSize);\r
if (ret < 0) {\r
- pr_err("rga map dst memory failed");\r
+ pr_err("rga map dst memory failed\n");\r
status = ret;\r
break;\r
}\r
\r
pages = (struct page **)kmalloc(AllSize * sizeof(struct page *), GFP_KERNEL);\r
if(pages == NULL) {\r
- pr_err("RGA MMU malloc pages mem failed");\r
+ pr_err("RGA MMU malloc pages mem failed\n");\r
status = RGA_MALLOC_ERROR;\r
break;\r
}\r
\r
MMU_Base = (uint32_t *)kmalloc(AllSize * sizeof(uint32_t), GFP_KERNEL);\r
if(pages == NULL) {\r
- pr_err("RGA MMU malloc MMU_Base point failed");\r
+ pr_err("RGA MMU malloc MMU_Base point failed\n");\r
status = RGA_MALLOC_ERROR;\r
break;\r
}\r
{\r
ret = rga_MapUserMemory(&pages[CMDMemSize], &MMU_Base[CMDMemSize], DstStart, DstMemSize);\r
if (ret < 0) {\r
- pr_err("rga map dst memory failed");\r
+ pr_err("rga map dst memory failed\n");\r
status = ret;\r
break;\r
}\r
uint32_t AllSize;\r
uint32_t *MMU_Base, *MMU_p;\r
int ret, status;\r
+ uint32_t uv_size, v_size;\r
\r
MMU_Base = NULL;\r
\r
* for the reason of lie to MMU \r
*/\r
req->mmu_info.base_addr = (virt_to_phys(MMU_Base) >> 2);\r
+\r
+ uv_size = (req->src.uv_addr - (SrcStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+ v_size = (req->src.v_addr - (SrcStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
\r
req->src.yrgb_addr = (req->src.yrgb_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
- req->src.uv_addr = (req->src.uv_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
- req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
+ req->src.uv_addr = (req->src.uv_addr & (~PAGE_MASK)) | ((CMDMemSize + uv_size) << PAGE_SHIFT);\r
+ req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | ((CMDMemSize + v_size) << PAGE_SHIFT);\r
+\r
+ uv_size = (req->dst.uv_addr - (DstStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+ v_size = (req->dst.v_addr - (DstStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
\r
req->dst.yrgb_addr = (req->dst.yrgb_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize) << PAGE_SHIFT);\r
+ req->dst.uv_addr = (req->dst.uv_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize + uv_size) << PAGE_SHIFT);\r
+ req->dst.v_addr = (req->dst.v_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize + v_size) << PAGE_SHIFT);\r
+ \r
\r
/*record the malloc buf for the cmd end to release*/\r
reg->MMU_base = MMU_Base;\r
uint32_t *MMU_Base, *MMU_p;\r
int ret;\r
int status;\r
+ uint32_t uv_size, v_size;\r
\r
MMU_Base = NULL;\r
\r
}\r
\r
AllSize = SrcMemSize + DstMemSize + CMDMemSize;\r
-\r
- \r
- #if 0\r
- printk("AllSize = %d\n", AllSize);\r
- printk("SrcSize = %d\n", SrcMemSize);\r
- printk("CMDSize = %d\n", CMDMemSize);\r
- printk("DstSize = %d\n", DstMemSize);\r
- printk("DstStart = %d\n", DstStart);\r
- #endif\r
\r
pages = (struct page **)kmalloc(AllSize * sizeof(struct page *), GFP_KERNEL);\r
if(pages == NULL) \r
\r
req->mmu_info.base_addr = (virt_to_phys(MMU_Base)>>2);\r
\r
+ uv_size = (req->src.uv_addr - (SrcStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+ v_size = (req->src.v_addr - (SrcStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+\r
req->src.yrgb_addr = (req->src.yrgb_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
- req->src.uv_addr = (req->src.uv_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
- req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | (CMDMemSize << PAGE_SHIFT);\r
+ req->src.uv_addr = (req->src.uv_addr & (~PAGE_MASK)) | ((CMDMemSize + uv_size) << PAGE_SHIFT);\r
+ req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | ((CMDMemSize + v_size) << PAGE_SHIFT);\r
+\r
+ uv_size = (req->dst.uv_addr - (DstStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
+ v_size = (req->dst.v_addr - (DstStart << PAGE_SHIFT)) >> PAGE_SHIFT;\r
\r
req->dst.yrgb_addr = (req->dst.yrgb_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize) << PAGE_SHIFT);\r
+ req->dst.uv_addr = (req->dst.uv_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize + uv_size) << PAGE_SHIFT);\r
+ req->dst.v_addr = (req->dst.v_addr & (~PAGE_MASK)) | ((CMDMemSize + SrcMemSize + v_size) << PAGE_SHIFT);\r
\r
/*record the malloc buf for the cmd end to release*/\r
reg->MMU_base = MMU_Base;\r
\r
static int rga_mmu_info_update_patten_buff_mode(struct rga_reg *reg, struct rga_req *req)\r
{\r
- int SrcMemSize, DstMemSize, CMDMemSize;\r
+ int SrcMemSize, CMDMemSize;\r
uint32_t SrcStart, CMDStart;\r
struct page **pages = NULL;\r
uint32_t i;\r
uint32_t *MMU_Base, *MMU_p;\r
int ret, status;\r
\r
+ MMU_Base = MMU_p = 0;\r
+\r
do\r
{\r
\r
return -EINVAL; \r
}\r
\r
- AllSize = SrcMemSize + DstMemSize + CMDMemSize;\r
+ AllSize = SrcMemSize + CMDMemSize;\r
\r
pages = (struct page **)kmalloc(AllSize * sizeof(struct page *), GFP_KERNEL);\r
if(pages == NULL) {\r