void hdmi_update_impl(void) { HDMI_LOG("hdmi_update_impl\n"); int t = 0; //int ret = 0; //MdpkBitbltConfig pmdp; //int lcm_physical_rotation = 0; int pixelSize = p->hdmi_width * p->hdmi_height; int dataSize = pixelSize * hdmi_bpp; RET_VOID_IF_NOLOG(p->output_mode == HDMI_OUTPUT_MODE_DPI_BYPASS); if(pixelSize == 0) { HDMI_LOG("ignored[resolution is null]\n"); return; } //HDMI_FUNC(); if(down_interruptible(&hdmi_update_mutex)) { HDMI_LOG("[HDMI] can't get semaphore in\n"); return; } if (IS_HDMI_NOT_ON()) { goto done; } if(IS_HDMI_IN_VIDEO_MODE()) { goto done; } DBG_OnTriggerHDMI(); //LCD_WaitForNotBusy(); if(temp_va != 0 && hdmi_va != 0) { DdpkBitbltConfig pddp; int dstOffset; memset((void*)&pddp, 0, sizeof(DdpkBitbltConfig)); pddp.srcX = pddp.srcY = 0; pddp.srcW = p->lcm_width; pddp.srcH = p->lcm_height; pddp.srcWStride = p->lcm_width; pddp.srcHStride = p->lcm_height; pddp.srcAddr[0] = temp_va; pddp.srcFormat = eRGB888_K; pddp.srcBufferSize[0] = p->lcm_width*p->lcm_height*3; pddp.srcPlaneNum = 1; pddp.dstX = 0; pddp.dstY = 0; pddp.dstFormat = eARGB8888_K; pddp.pitch = p->hdmi_width; pddp.dstWStride = p->hdmi_width; pddp.dstHStride = p->hdmi_height; pddp.dstPlaneNum = 1; pddp.orientation = 0; switch(pddp.orientation) { case 90: case 270: #if 1 { pddp.dstW = ALIGN_TO(p->lcm_height * p->hdmi_height / p->lcm_width * 95 / 100, 4); pddp.dstH = ALIGN_TO(p->hdmi_height * 95 /100, 4); break; } #endif // fall through now case 0: case 180: { pddp.dstW = ALIGN_TO(p->hdmi_width * 95 / 100, 4); pddp.dstH = ALIGN_TO(p->hdmi_height * 95 /100, 4); break; } default: HDMI_LOG("Unknown orientation %d\n", pddp.orientation); return; } dstOffset = (p->hdmi_height - pddp.dstH ) / 2 * p->hdmi_width * hdmi_bpp + (p->hdmi_width - pddp.dstW) / 2 * hdmi_bpp; pddp.dstAddr[0] = hdmi_va;// + hdmi_buffer_write_id * p->hdmi_width * p->hdmi_height * hdmi_bpp + dstOffset; pddp.dstBufferSize[0] = p->hdmi_width*p->hdmi_height*hdmi_bpp; t = get_current_time_us(); DDPK_Bitblt_Config(DDPK_CH_HDMI_0, &pddp); DDPK_Bitblt(DDPK_CH_HDMI_0); } //HDMI_LOG("dstw=%d, dsth=%d, ori=%d\n", p.dstW, p.dstH, p.orientation); DBG_OnHDMIDone(); HDMI_LOG("cost %d us\n", get_current_time_us() - t); //hdmi_buffer_read_id = hdmi_buffer_write_id; //hdmi_buffer_write_id = (hdmi_buffer_write_id+1) % hdmi_params->intermediat_buffer_num; done: up(&hdmi_update_mutex); return; }
void ddpk_testfunc_2( unsigned long channel) { static void* src_buffer[DDPKBITBLIT_CHNL_COUNT] = { 0 }; unsigned long src_w = 100; unsigned long src_h = 100; unsigned long src_size = src_w * src_h * 4; static void* dst_buffer[DDPKBITBLIT_CHNL_COUNT] = { 0 }; unsigned long dst_w = 200; unsigned long dst_h = 200; unsigned long dst_size = dst_w * dst_h * 4; DdpkBitbltConfig config; unsigned long src_pa, dst_pa; if( src_buffer[channel] != NULL ){ iounmap( src_buffer[channel] ); } src_pa = FB_START; src_buffer[channel] = ioremap( src_pa, src_size ); DDPK_DEBUG("src_buffer[%lu] = 0x%08X(PA) ==> 0x%08X\n", channel, (unsigned int)src_pa, (unsigned int)src_buffer[channel] ); if( dst_buffer[channel] != NULL ){ iounmap( dst_buffer[channel] ); } dst_pa = ( (FB_START + src_size) + 0xFFF ) & (~0xFFF); dst_buffer[channel] = ioremap( dst_pa, dst_size ); DDPK_DEBUG("dst_buffer[%lu] = 0x%08X(PA) ==> 0x%08X\n", channel, (unsigned int)dst_pa, (unsigned int)dst_buffer[channel] ); { DDPK_DEBUG("DDPK_Bitblt_Config()\n"); config.srcX = 0; config.srcY = 0; config.srcW = src_w; config.srcWStride = src_w; config.srcH = src_h; config.srcHStride = src_h; config.srcAddr[0] = (unsigned int)src_buffer[channel]; config.srcFormat = eARGB8888_K; config.srcBufferSize[0] = src_size; config.srcPlaneNum = 1; // config.srcMemType = DDPK_MEMTYPE_PHYMEM; config.dstW = dst_w; config.dstH = dst_h; config.dstAddr[0] = (unsigned int)dst_buffer[channel]; config.dstFormat = eARGB8888_K; config.pitch = dst_w; config.dstBufferSize[0] = dst_size; config.dstPlaneNum = 1; // config.dstMemType = DDPK_MEMTYPE_PHYMEM; config.orientation = 2; // config.doImageProcess = 1; // config.u4SrcOffsetXFloat = 0;//0x100 stands for 1, 0x40 stands for 0.25 , etc... // config.u4SrcOffsetYFloat = 0;//0x100 stands for 1, 0x40 stands for 0.25 , etc... DDPK_Bitblt_Config( channel, &config ); } { int ret = 0; DDPK_DEBUG("DDPK_Bitblt()\n"); ret = DDPK_Bitblt( channel ); DDPK_DEBUG("DDPK_Bitblt() return %d\n", ret ); } }
int ddp_mem_test2(void) { int result = 0; unsigned int* pSrc; unsigned int* pDst; #if 0 DdpkBitbltConfig pddp; #endif pSrc= vmalloc(DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP); if(pSrc==0) { printk("[DDP] error: dma_alloc_coherent error! dma memory not available.\n"); return 0; } else { printk("[ddp] pSrc=0x%x \n", (unsigned int)pSrc); } memcpy((void*)pSrc, data_rgb888_64x64, DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP); pDst= vmalloc(DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP); if(pDst==0) { printk("[DDP] error: dma_alloc_coherent error! dma memory not available.\n"); return 0; } else { printk("[ddp] pDst=0x%x\n", (unsigned int)pDst); } memset((void*)pDst, 0, DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP); /* disp_power_on(DISP_MODULE_ROT); disp_power_on(DISP_MODULE_SCL); disp_power_on(DISP_MODULE_WDMA0); */ // config port to virtual { M4U_PORT_STRUCT sPort; sPort.ePortID = M4U_PORT_LCD_W; sPort.Virtuality = 1; sPort.Security = 0; sPort.Distance = 1; sPort.Direction = 0; m4u_config_port(&sPort); } //config #if 0 pddp.srcX = 0; pddp.srcY = 0; pddp.srcW = DDP_TEST_WIDTH; pddp.srcWStride = DDP_TEST_WIDTH; pddp.srcH = DDP_TEST_HEIGHT; pddp.srcHStride = DDP_TEST_HEIGHT; pddp.srcAddr[0] = (unsigned int)pSrc; pddp.srcFormat = eRGB888_K; pddp.srcPlaneNum = 1; pddp.srcBufferSize[0] = DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP; pddp.dstX = 0; pddp.dstY = 0; pddp.dstW = DDP_TEST_WIDTH; pddp.dstWStride = DDP_TEST_WIDTH; pddp.dstH = DDP_TEST_HEIGHT; pddp.dstHStride = DDP_TEST_HEIGHT; pddp.dstAddr[0] = (unsigned int)pDst; pddp.dstFormat = eRGB888_K; pddp.pitch = DDP_TEST_WIDTH; pddp.dstPlaneNum = 1; pddp.dstBufferSize[0] = DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP; pddp.orientation = 0; result = DDPK_Bitblt_Config( DDPK_CH_HDMI_0, &pddp ); if(result) { printk("[DDP] error: DDPK_Bitblt_Config fail!, ret=%d\n", result); } printk("DDP, DDPK_Bitblt module setting: \n"); disp_dump_reg(DISP_MODULE_ROT); disp_dump_reg(DISP_MODULE_SCL); disp_dump_reg(DISP_MODULE_WDMA0); disp_dump_reg(DISP_MODULE_CONFIG); result = DDPK_Bitblt( DDPK_CH_HDMI_0); if(result) { printk("[DDP] error: DDPK_Bitblt() fail, result=%d \n", result); } #endif // result verify { unsigned int diff_cnt = 0; unsigned int t=0; unsigned int size = DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP; for(t=0;t<size;t++) { if( *((unsigned char*)pSrc+t) != *((unsigned char*)data_rgb888_64x64+t) ) { diff_cnt++; printk("t=%d, diff_cnt=%d, dst=0x%x, gold=0x%x \n", t, diff_cnt, *((unsigned char*)pSrc+t), *((unsigned char*)data_rgb888_64x64+t) ); } } if(diff_cnt == 0) printk("ddp_mem_test src compare result: success \n"); else { printk("[DDP] error: ddp_mem_test src compare result: fail \n"); printk("detail, %d, %d, %%%d \n", diff_cnt, size, diff_cnt*100/size); result = -1; } } { unsigned int diff_cnt = 0; unsigned int t=0; unsigned int size = DDP_TEST_WIDTH*DDP_TEST_HEIGHT*DDP_TEST_BPP; for(t=0;t<size;t++) { if( *((unsigned char*)pDst+t) != *((unsigned char*)data_rgb888_64x64_golden+t) ) { diff_cnt++; printk("t=%d, diff_cnt=%d, dst=0x%x, gold=0x%x \n", t, diff_cnt, *((unsigned char*)pDst+t), *((unsigned char*)data_rgb888_64x64_golden+t) ); } } if(diff_cnt == 0) printk("ddp_mem_test result: success \n"); else { printk("[DDP] error: ddp_mem_test result: fail \n"); printk("detail, %d, %d, %%%d \n", diff_cnt, size, diff_cnt*100/size); result = -1; } } /* disp_power_off(DISP_MODULE_ROT); disp_power_off(DISP_MODULE_SCL); disp_power_off(DISP_MODULE_WDMA0); */ //dealloc memory vfree(pSrc); vfree(pDst); return result; }
void ddpk_testfunc_1( unsigned long channel) { static void* src_buffer[DDPKBITBLIT_CHNL_COUNT] = { 0 }; unsigned long src_w = 100; unsigned long src_h = 100; unsigned long src_size = src_w * src_h * 4; static void* dst_buffer[DDPKBITBLIT_CHNL_COUNT] = { 0 }; unsigned long dst_w = TEST_OUT_WIDTH; unsigned long dst_h = TEST_OUT_HEIGHT; unsigned long dst_size = dst_w * dst_h * 4; DdpkBitbltConfig config; char* psrc = (char*)src_buffer[channel]; char* pdst = (char*)dst_buffer[channel]; int i = 0; int j = 0; DDPK_DEBUG("ddpk_testfunc_1() +++++++++\n"); if( src_buffer[channel] != NULL ) vfree( src_buffer[channel] ); src_buffer[channel] = vmalloc( src_size ); DDPK_DEBUG("src_buffer[%lu] = 0x%08X\n", channel, (unsigned int)src_buffer[channel] ); if( dst_buffer[channel] != NULL ) vfree( dst_buffer[channel] ); dst_buffer[channel] = vmalloc( dst_size ); DDPK_DEBUG("dst_buffer[%lu] = 0x%08X\n", channel, (unsigned int)dst_buffer[channel] ); for (j = 0; j < 100; j++) { for (i = 0; i < 100; i++) { #if 0 if (j < 50) { *psrc = 255; psrc++; *psrc = 0; psrc++; *psrc = 0; psrc++; *psrc = 255; psrc++; } else { *psrc = 0; psrc++; *psrc = 255; psrc++; *psrc = 0; psrc++; *psrc = 255; psrc++; } #else if (j < 50) { psrc[4*(j*100+i)+0] = 255; psrc[4*(j*100+i)+1] = 0; psrc[4*(j*100+i)+2] = 0; psrc[4*(j*100+i)+3] = 255; } else { psrc[4*(j*100+i)+0] = 0; psrc[4*(j*100+i)+1] = 255; psrc[4*(j*100+i)+2] = 0; psrc[4*(j*100+i)+3] = 255; } #endif } } for (j = 0; j < TEST_OUT_HEIGHT; j++) { for (i = 0; i < TEST_OUT_WIDTH; i++) { /* *pdst = 0; pdst++; *pdst = 0; pdst++; *pdst = 0; pdst++; *pdst = 0; pdst++; */ pdst[4*(j*TEST_OUT_WIDTH+i)+0] = 0; pdst[4*(j*TEST_OUT_WIDTH+i)+1] = 0; pdst[4*(j*TEST_OUT_WIDTH+i)+2] = 0; pdst[4*(j*TEST_OUT_WIDTH+i)+3] = 0; } } dump_pixel(0, (char*)src_buffer[channel], TEST_OUT_WIDTH, 0, 0); dump_pixel(0, (char*)src_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH/2-1, TEST_OUT_HEIGHT/4-1); dump_pixel(0, (char*)src_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH-1, TEST_OUT_HEIGHT/2-1); dump_pixel(0, (char*)src_buffer[channel], TEST_OUT_WIDTH, 0, TEST_OUT_HEIGHT/2); dump_pixel(0, (char*)src_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH/2-1, TEST_OUT_HEIGHT*3/4-1); dump_pixel(0, (char*)src_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH-1, TEST_OUT_HEIGHT-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, 0, 0); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH/2-1, TEST_OUT_HEIGHT/4-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH-1, TEST_OUT_HEIGHT/2-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, 0, TEST_OUT_HEIGHT/2); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH/2-1, TEST_OUT_HEIGHT*3/4-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH-1, TEST_OUT_HEIGHT-1); { DDPK_DEBUG("DDPK_Bitblt_Config()\n"); config.srcX = 0; config.srcY = 0; config.srcW = src_w; config.srcWStride = src_w; config.srcH = src_h; config.srcHStride = src_h; config.srcAddr[0] = (unsigned int)src_buffer[channel]; config.srcAddr[1] = 0; config.srcAddr[2] = 0; config.srcFormat = eARGB8888_K; config.srcBufferSize[0] = src_size; config.srcBufferSize[1] = 0; config.srcBufferSize[2] = 0; config.srcPlaneNum = 1; // config.srcMemType = DDPK_MEMTYPE_VMALLOC; config.dstX = 0; config.dstY = 0; config.dstW = dst_w; config.dstWStride = dst_w; config.dstH = dst_h; config.dstHStride = dst_h; config.dstAddr[0] = (unsigned int)dst_buffer[channel]; config.dstAddr[1] = 0; config.dstAddr[2] = 0; config.dstFormat = eABGR8888_K; config.pitch = dst_w; config.dstBufferSize[0] = dst_size; config.dstBufferSize[1] = 0; config.dstBufferSize[2] = 0; config.dstPlaneNum = 1; // config.dstMemType = DDPK_MEMTYPE_VMALLOC; config.orientation = 0; // config.u4SrcOffsetXFloat = 0;//0x100 stands for 1, 0x40 stands for 0.25 , etc... // config.u4SrcOffsetYFloat = 0;//0x100 stands for 1, 0x40 stands for 0.25 , etc... DDPK_Bitblt_Config( channel, &config ); } { int ret = 0; DDPK_DEBUG("DDPK_Bitblt()\n"); ret = DDPK_Bitblt( channel ); DDPK_DEBUG("DDPK_Bitblt() return %d\n", ret ); } dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, 0, 0); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH/2-1, TEST_OUT_HEIGHT/4-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH-1, TEST_OUT_HEIGHT/2-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, 0, TEST_OUT_HEIGHT/2); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH/2-1, TEST_OUT_HEIGHT*3/4-1); dump_pixel(1, (char*)dst_buffer[channel], TEST_OUT_WIDTH, TEST_OUT_WIDTH-1, TEST_OUT_HEIGHT-1); DDPK_DEBUG("ddpk_testfunc_1() ------------\n"); }