#include #include #include #include #include #include #include "csi_dsp_api.h" #include "csi_dsp_task_defs.h" #include "csi_dsp_post_process_defs.h" #include "CppUTest/TestHarness.h" #include "CppUTest/CommandLineTestRunner.h" #ifdef __cplusplus extern "C" { #endif #include "video_mem.h" #ifdef __cplusplus } #endif struct buf_param{ int with; int height; int stride; int plane_num; }; TEST_GROUP(DspPostProcessTestDmaBuf) { void setup() { instance = csi_dsp_create_instance(0); if(!instance) { FAIL_TEST("create fail\n"); } task= csi_dsp_create_task(instance,CSI_DSP_TASK_SW_TO_SW); if(!task) { FAIL_TEST("task create fail\n"); } if( VMEM_create(&mem_allocor) <0) { FAIL_TEST("open mem_alloc_fd fail\n"); } } void teardown() { csi_dsp_destroy_task(task); csi_dsp_delete_instance(instance); VMEM_destroy(mem_allocor); } void *instance; void *mem_allocor; void *task; int reqDmaBuffer(VmemParams *params) { int pgsize = getpagesize(); params->size = ((params->size+pgsize-1)/pgsize)*pgsize; if(VMEM_allocate(mem_allocor, params)) { return -1; } printf("%s,alloct dma buf @ phy:%lx\n",__FUNCTION__,params->phy_address); if(VMEM_export(mem_allocor,params)) { return -1; } printf("%s,export dma buf @fd:%x\n",__FUNCTION__,params->fd); return 0; } int releaseDmaBuffer(VmemParams *params) { VMEM_free(mem_allocor, params); } int oneRequsetHelper(int with,int height,int stride,int plane_num,char *name) { int i=0; int j=0; int ret =0 ; struct timeval time_enqueue; struct timeval time_dequeue; VmemParams params_in[3]; VmemParams params_out[3]; csi_dsp_algo_load_req_t alog_config={ .algo_id=0, }; if(name != NULL) { if(csi_dsp_task_acquire_algo(task,name)) { FAIL_TEST("algo kernel load fail\n"); } } else { if(csi_dsp_task_load_algo(task,&alog_config)) { FAIL_TEST("algo kernel load fail\n"); } } struct csi_sw_task_req* req=NULL; req =csi_dsp_task_create_request(task); if(req==NULL) { FAIL_TEST("req create fail\n"); } for(i=0;istatus != CSI_DSP_SW_REQ_DONE) { FAIL_TEST("req dequeue fail\n"); } gettimeofday(&time_dequeue, 0); printf("req:%d,start:%d,%d,end:%d,%d\n",req->request_id,time_enqueue.tv_sec,time_enqueue.tv_usec,time_dequeue.tv_sec,time_dequeue.tv_usec); // MEMCMP_EQUAL((void*)buf1.planes[0].buf_vir,(void *)buf2.planes[0].buf_vir,buf1.planes[0].size); // memset((void *)buf2.planes[0].buf_vir,0xff,16); for(i=0;i