From 7636f034901d3abfb63870d63b3fa82d1e5cedbe Mon Sep 17 00:00:00 2001 From: zsq Date: Mon, 31 Dec 2012 12:53:52 +0800 Subject: [PATCH] add interface for box | fix mmu bug for IMG GPU --- drivers/video/rockchip/rga/RGA_API.h | 3 + drivers/video/rockchip/rga/rga.h | 2 +- drivers/video/rockchip/rga/rga_drv.c | 87 +++++++++++++++++------ drivers/video/rockchip/rga/rga_mmu_info.c | 43 ++--------- 4 files changed, 75 insertions(+), 60 deletions(-) diff --git a/drivers/video/rockchip/rga/RGA_API.h b/drivers/video/rockchip/rga/RGA_API.h index 7b966c30cb08..60e5d1f0ce60 100755 --- a/drivers/video/rockchip/rga/RGA_API.h +++ b/drivers/video/rockchip/rga/RGA_API.h @@ -10,4 +10,7 @@ int32_t RGA_gen_two_pro(struct rga_req *msg, struct rga_req *msg1); + + + #endif diff --git a/drivers/video/rockchip/rga/rga.h b/drivers/video/rockchip/rga/rga.h index 241d28bc120c..680276760432 100755 --- a/drivers/video/rockchip/rga/rga.h +++ b/drivers/video/rockchip/rga/rga.h @@ -469,7 +469,7 @@ typedef struct rga_service_info { #define RGA_BLIT_COMPLETE_EVENT 1 - +long rga_ioctl_kernel(struct rga_req *req); #endif /*_RK29_IPP_DRIVER_H_*/ diff --git a/drivers/video/rockchip/rga/rga_drv.c b/drivers/video/rockchip/rga/rga_drv.c index a37e3c6570f9..2f24c831623b 100755 --- a/drivers/video/rockchip/rga/rga_drv.c +++ b/drivers/video/rockchip/rga/rga_drv.c @@ -77,6 +77,8 @@ ktime_t rga_end; int rga_num = 0; +rga_session *session_global; + struct rga_drvdata { struct miscdevice miscdev; struct device dev; @@ -981,6 +983,49 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg) return ret; } + +long rga_ioctl_kernel(struct rga_req *req) +{ + int ret = 0; + rga_session *session; + + mutex_lock(&rga_service.mutex); + + session = (rga_session *)session_global; + + if (NULL == session) + { + printk("%s [%d] rga thread session is null\n",__FUNCTION__,__LINE__); + mutex_unlock(&rga_service.mutex); + return -EINVAL; + } + + switch (RGA_BLIT_SYNC) + { + case RGA_BLIT_SYNC: + ret = rga_blit_sync(session, req); + break; + case RGA_BLIT_ASYNC: + break; + case RGA_FLUSH: + break; + case RGA_GET_RESULT: + break; + case RGA_GET_VERSION: + //ret = 0; + break; + default: + ERR("unknown ioctl cmd!\n"); + ret = -EINVAL; + break; + } + + mutex_unlock(&rga_service.mutex); + + return ret; +} + + static int rga_open(struct inode *inode, struct file *file) { rga_session *session = kzalloc(sizeof(rga_session), GFP_KERNEL); @@ -1004,6 +1049,8 @@ static int rga_open(struct inode *inode, struct file *file) file->private_data = (void *)session; + session_global = session; + //DBG("*** rga dev opened by pid %d *** \n", session->pid); return nonseekable_open(inode, file); @@ -1263,8 +1310,8 @@ EXPORT_SYMBOL(rk_direct_fb_show); #endif -unsigned int src_buf[320*240]; -unsigned int dst_buf[1024*768]; +unsigned int src_buf[1280*720]; +unsigned int dst_buf[720*480]; void rga_test_0(void) { @@ -1294,10 +1341,10 @@ void rga_test_0(void) src = src_buf; dst = dst_buf; - memset(src_buf, 0x80, 320*240*4); + memset(src_buf, 0x80, 1280*480*4); - dmac_flush_range(&src_buf[0], &src_buf[320*240]); - outer_flush_range(virt_to_phys(&src_buf[0]),virt_to_phys(&src_buf[320*240])); + dmac_flush_range(&src_buf[0], &src_buf[1280*480]); + outer_flush_range(virt_to_phys(&src_buf[0]),virt_to_phys(&src_buf[1280*480])); #if 0 @@ -1308,37 +1355,37 @@ void rga_test_0(void) outer_flush_range(virt_to_phys(&dst_buf[0]),virt_to_phys(&dst_buf[800*480])); #endif - req.src.act_w = 320; - req.src.act_h = 240; + req.src.act_w = 1280; + req.src.act_h = 720; - req.src.vir_w = 320; - req.src.vir_h = 240; + req.src.vir_w = 1280; + req.src.vir_h = 720; req.src.yrgb_addr = (uint32_t)src; req.src.uv_addr = (uint32_t)virt_to_phys(src); req.src.v_addr = (uint32_t)virt_to_phys(src); req.src.format = 0; - req.dst.act_w = 320; - req.dst.act_h = 240; + req.dst.act_w = 720; + req.dst.act_h = 480; - req.dst.vir_w = 1024; - req.dst.vir_h = 768; + req.dst.vir_w = 1280; + req.dst.vir_h = 720; req.dst.x_offset = 0; req.dst.y_offset = 0; - req.dst.yrgb_addr = (uint32_t)dst; + req.dst.yrgb_addr = (uint32_t)virt_to_phys(dst); //req.dst.format = RK_FORMAT_RGB_565; req.clip.xmin = 0; - req.clip.xmax = 1023; + req.clip.xmax = 1279; req.clip.ymin = 0; - req.clip.ymax = 767; + req.clip.ymax = 719; //req.render_mode = color_fill_mode; //req.fg_color = 0x80ffffff; - //req.rotate_mode = 1; - //req.scale_mode = 2; + req.rotate_mode = 1; + req.scale_mode = 2; //req.alpha_rop_flag = 1; //req.alpha_rop_mode = 0x19; @@ -1355,8 +1402,8 @@ void rga_test_0(void) #if 1 fb->var.bits_per_pixel = 32; - fb->var.xres = 1024; - fb->var.yres = 768; + fb->var.xres = 1280; + fb->var.yres = 800; fb->var.red.length = 8; fb->var.red.offset = 0; diff --git a/drivers/video/rockchip/rga/rga_mmu_info.c b/drivers/video/rockchip/rga/rga_mmu_info.c index 4ba0cb816541..83458e398975 100755 --- a/drivers/video/rockchip/rga/rga_mmu_info.c +++ b/drivers/video/rockchip/rga/rga_mmu_info.c @@ -32,6 +32,7 @@ extern rga_service_info rga_service; #define V7_VATOPA_GET_NS(X) ((X>>9) & 1) #define V7_VATOPA_GET_SS(X) ((X>>1) & 1) +#if 0 static unsigned int armv7_va_to_pa(unsigned int v_addr) { unsigned int p_addr; @@ -48,6 +49,7 @@ static unsigned int armv7_va_to_pa(unsigned int v_addr) else return (V7_VATOPA_GET_SS(p_addr) ? 0xFFFFFFFF : V7_VATOPA_GET_PADDR(p_addr)); } +#endif static int rga_mem_size_cal(uint32_t Mem, uint32_t MemSize, uint32_t *StartAddr) { @@ -245,7 +247,7 @@ static int rga_MapUserMemory(struct page **pages, uint32_t i; uint32_t status; uint32_t Address; - uint32_t temp; + //uint32_t temp; status = 0; Address = 0; @@ -352,20 +354,6 @@ static int rga_MapUserMemory(struct page **pages, } #endif - for (i = 0; i < pageCount; i++) - { - /* Flush the data cache. */ -#ifdef ANDROID - dma_sync_single_for_device( - NULL, - page_to_phys(pages[i]), - PAGE_SIZE, - DMA_TO_DEVICE); -#else - flush_dcache_page(pages[i]); -#endif - } - /* Fill the page table. */ for(i=0; i 0 && pages != NULL) - { - for (i = 0; i < result; i++) - { - if (pages[i] == NULL) - { - break; - } -#ifdef ANDROID - dma_sync_single_for_device( - NULL, - page_to_phys(pages[i]), - PAGE_SIZE, - DMA_FROM_DEVICE); -#endif - page_cache_release(pages[i]); - } - } - } - + return status; } -- 2.34.1