1 From ac950224284d2b7d47d935783bb0fabcc8b9c866 Mon Sep 17 00:00:00 2001
2 From: Lily Zhang <r58066@freescale.com>
3 Date: Mon, 12 Dec 2011 08:51:43 +0800
4 Subject: [PATCH 1/3] ENGR00158471 fix ipu unit test application missing issue
6 Revert "ENGR00155135 ipudev test: test for processing driver".
7 ENGR00155135 should not be applied to 2.6.35 11.09 release since
8 ipu processing driver is not integrated into MX53 2.6.35 kernel.
9 This patch is only for imx_2.6.35_11.09.01 branch
11 Signed-off-by: Lily Zhang <r58066@freescale.com>
13 diff --git a/test/mxc_ipudev_test/Makefile b/test/mxc_ipudev_test/Makefile
14 index 813393f..12c7889 100644
15 --- a/test/mxc_ipudev_test/Makefile
16 +++ b/test/mxc_ipudev_test/Makefile
18 # list of platforms which want this test case
19 -INCLUDE_LIST:=IMX51 IMX53 IMX6Q
20 +INCLUDE_LIST:=IMX31_3STACK IMX35_3STACK IMX37_3STACK IMX51 IMX53
22 -SRCS = mxc_ipudev_test.c utils.c
24 +SRCS = mxc_ipudev_test.c utils.c test_pattern.c
25 +CFLAGS += -lipu -lIpuScreenLayer -lm -lrt
27 ifeq ($(PLATFORM),$(findstring $(PLATFORM),$(INCLUDE_LIST)))
28 OBJS = $(OBJDIR)/mxc_ipudev_test.out
29 diff --git a/test/mxc_ipudev_test/ipudev_config_file b/test/mxc_ipudev_test/ipudev_config_file
30 index 6541b13..d6fe358 100644
31 --- a/test/mxc_ipudev_test/ipudev_config_file
32 +++ b/test/mxc_ipudev_test/ipudev_config_file
34 # IPU_ROTATE_90_RIGHT_HFLIP = 6,
35 # IPU_ROTATE_90_LEFT = 7,
38 -# IPU_TASK_PRIORITY_NORMAL = 0
39 -# IPU_TASK_PRIORITY_HIGH = 1
49 -# IPU_TASK_ID_ANY = 0
55 -# de-interlace motion ref:
56 +# video de-interlace motion ref:
61 -# overlay alpha mode ref:
62 -# IPU_ALPHA_MODE_GLOBAL = 0
63 -# IPU_ALPHA_MODE_LOCAL = 1
77 #### operation frame count
79 @@ -70,45 +57,20 @@ in_fmt=I420
89 +#input motion(video de-interlace)
107 -colorkey_value=0x555555
115 +#output to framebuffer
125 -#if out_to_fb == 1, then out_filename ref to fb
126 -# ipu0 1st display overlay: ipu0-1st-ovfb
127 -# ipu0 2nd display: ipu0-2nd-fb
128 -# ipu1 1st display overlay: ipu1-1st-ovfb
129 -# ipu1 2nd display: ipu1-2nd-fb
130 -out_filename=ipu0-1st-ovfb
132 +out_filename=output.dat
133 diff --git a/test/mxc_ipudev_test/mxc_ipudev_test.c b/test/mxc_ipudev_test/mxc_ipudev_test.c
134 index 7f916f7..4823171 100644
135 --- a/test/mxc_ipudev_test/mxc_ipudev_test.c
136 +++ b/test/mxc_ipudev_test/mxc_ipudev_test.c
137 @@ -21,154 +21,130 @@
150 -#include <sys/ioctl.h>
151 -#include <sys/mman.h>
152 -#include <sys/types.h>
153 -#include <sys/stat.h>
154 -#include <linux/mxcfb.h>
155 #include "mxc_ipudev_test.h"
160 void ctrl_c_handler(int signum, siginfo_t *info, void *myact)
165 -int process_cmdline(int argc, char **argv, ipu_test_handle_t *test_handle)
166 +void output_to_file_cb(void * arg, int index)
168 + ipu_test_handle_t * test_handle = (ipu_test_handle_t *)arg;
170 + if (test_handle->file_out)
171 + if(fwrite(test_handle->ipu_handle->outbuf_start[index], 1,
172 + test_handle->ipu_handle->ofr_size,
173 + test_handle->file_out) < test_handle->ipu_handle->ofr_size) {
174 + printf("Can not write enough data into output file!\n");
178 +int process_cmdline(int argc, char **argv, ipu_test_handle_t * test_handle)
181 - struct ipu_task *t = &test_handle->task;
186 - for (i = 1; i < argc; i++)
187 - if (strcmp(argv[i], "-C") == 0)
188 + for (i = 1; i < argc; i++) {
189 + if (strcmp(argv[i], "-C") == 0) {
190 parse_config_file(argv[++i], test_handle);
191 + } else if (strcmp(argv[i], "-P") == 0) {
192 + test_handle->test_pattern = atoi(argv[++i]);
193 + } else if (strcmp(argv[i], "-bw") == 0) {
194 + test_handle->block_width = atoi(argv[++i]);
195 + if (test_handle->block_width < 16)
196 + test_handle->block_width = 16;
197 + } else if (strcmp(argv[i], "-Q") == 0)
198 + test_handle->query_task = 1;
199 + else if (strcmp(argv[i], "-K") == 0) {
200 + test_handle->kill_task = 1;
201 + test_handle->kill_task_idx = atoi(argv[++i]);
205 + if (test_handle->test_pattern)
207 + if (test_handle->query_task || test_handle->kill_task)
210 - if ((t->input.width == 0) || (t->input.height == 0) ||
211 - (t->output.width == 0) ||
212 - (t->output.height == 0)
213 + if ((test_handle->input.width == 0) || (test_handle->input.height == 0) ||
214 + (test_handle->output.width == 0) ||
215 + (test_handle->output.height == 0)
216 || (test_handle->fcount < 1))
222 -static unsigned int fmt_to_bpp(unsigned int pixelformat)
223 +int query_ipu_task(void)
227 - switch (pixelformat)
229 - case IPU_PIX_FMT_RGB565:
230 - /*interleaved 422*/
231 - case IPU_PIX_FMT_YUYV:
232 - case IPU_PIX_FMT_UYVY:
233 - /*non-interleaved 422*/
234 - case IPU_PIX_FMT_YUV422P:
235 - case IPU_PIX_FMT_YVU422P:
238 - case IPU_PIX_FMT_BGR24:
239 - case IPU_PIX_FMT_RGB24:
240 - case IPU_PIX_FMT_YUV444:
243 - case IPU_PIX_FMT_BGR32:
244 - case IPU_PIX_FMT_BGRA32:
245 - case IPU_PIX_FMT_RGB32:
246 - case IPU_PIX_FMT_RGBA32:
247 - case IPU_PIX_FMT_ABGR32:
250 - /*non-interleaved 420*/
251 - case IPU_PIX_FMT_YUV420P:
252 - case IPU_PIX_FMT_YVU420P:
253 - case IPU_PIX_FMT_YUV420P2:
254 - case IPU_PIX_FMT_NV12:
263 + ipu_lib_ctl_task_t task;
265 + for (i = 0; i< MAX_TASK_NUM; i++) {
267 + mxc_ipu_lib_task_control(IPU_CTL_TASK_QUERY, (void *)(&task), NULL);
268 + if (task.task_pid) {
269 + printf("\ntask %d:\n", i);
270 + printf("\tpid: %d\n", task.task_pid);
271 + printf("\tmode:\n");
272 + if (task.task_mode & IC_ENC)
273 + printf("\t\tIC_ENC\n");
274 + if (task.task_mode & IC_VF)
275 + printf("\t\tIC_VF\n");
276 + if (task.task_mode & IC_PP)
277 + printf("\t\tIC_PP\n");
278 + if (task.task_mode & ROT_ENC)
279 + printf("\t\tROT_ENC\n");
280 + if (task.task_mode & ROT_VF)
281 + printf("\t\tROT_VF\n");
282 + if (task.task_mode & ROT_PP)
283 + printf("\t\tROT_PP\n");
284 + if (task.task_mode & VDI_IC_VF)
285 + printf("\t\tVDI_IC_VF\n");
292 -static void dump_ipu_task(struct ipu_task *t)
293 +int kill_ipu_task(int index)
295 - printf("====== ipu task ======\n");
296 - printf("input:\n");
297 - printf("\tforamt: 0x%x\n", t->input.format);
298 - printf("\twidth: %d\n", t->input.width);
299 - printf("\theight: %d\n", t->input.height);
300 - printf("\tcrop.w = %d\n", t->input.crop.w);
301 - printf("\tcrop.h = %d\n", t->input.crop.h);
302 - printf("\tcrop.pos.x = %d\n", t->input.crop.pos.x);
303 - printf("\tcrop.pos.y = %d\n", t->input.crop.pos.y);
304 - if (t->input.deinterlace.enable) {
305 - printf("deinterlace enabled with:\n");
306 - if (t->input.deinterlace.motion != HIGH_MOTION)
307 - printf("\tlow/medium motion\n");
309 - printf("\thigh motion\n");
311 - printf("output:\n");
312 - printf("\tforamt: 0x%x\n", t->output.format);
313 - printf("\twidth: %d\n", t->output.width);
314 - printf("\theight: %d\n", t->output.height);
315 - printf("\troate: %d\n", t->output.rotate);
316 - printf("\tcrop.w = %d\n", t->output.crop.w);
317 - printf("\tcrop.h = %d\n", t->output.crop.h);
318 - printf("\tcrop.pos.x = %d\n", t->output.crop.pos.x);
319 - printf("\tcrop.pos.y = %d\n", t->output.crop.pos.y);
320 - if (t->overlay_en) {
321 - printf("overlay:\n");
322 - printf("\tforamt: 0x%x\n", t->overlay.format);
323 - printf("\twidth: %d\n", t->overlay.width);
324 - printf("\theight: %d\n", t->overlay.height);
325 - printf("\tcrop.w = %d\n", t->overlay.crop.w);
326 - printf("\tcrop.h = %d\n", t->overlay.crop.h);
327 - printf("\tcrop.pos.x = %d\n", t->overlay.crop.pos.x);
328 - printf("\tcrop.pos.y = %d\n", t->overlay.crop.pos.y);
329 - if (t->overlay.alpha.mode == IPU_ALPHA_MODE_LOCAL)
330 - printf("combine with local alpha\n");
332 - printf("combine with global alpha %d\n", t->overlay.alpha.gvalue);
333 - if (t->overlay.colorkey.enable)
334 - printf("colorkey enabled with 0x%x\n", t->overlay.colorkey.value);
336 + ipu_lib_ctl_task_t task;
338 + task.index = index;
339 + mxc_ipu_lib_task_control(IPU_CTL_TASK_KILL, (void *)(&task), NULL);
344 int main(int argc, char *argv[])
346 - ipu_test_handle_t test_handle;
347 - struct ipu_task *t = &test_handle.task;
348 - int ret = 0, done_cnt = 0;
349 + int ret = 0, next_update_idx = 0, done_cnt = 0, first_time = 1;
350 int done_loop = 0, total_cnt = 0;
351 - struct sigaction act;
352 + ipu_lib_handle_t ipu_handle;
353 + ipu_test_handle_t test_handle;
354 FILE * file_in = NULL;
355 - FILE * file_out = NULL;
356 + struct sigaction act;
357 struct timeval begin, end;
358 int sec, usec, run_time = 0;
359 - int fd_ipu = 0, fd_fb = 0;
360 - int isize = 0, ovsize = 0;
361 - int alpsize = 0, osize = 0;
362 - void *inbuf = NULL, *vdibuf = NULL;
363 - void *ovbuf = NULL, *alpbuf = NULL;
364 - void *outbuf = NULL;
365 - dma_addr_t outpaddr[FB_BUFS];
366 - struct fb_var_screeninfo fb_var;
367 - struct fb_fix_screeninfo fb_fix;
370 + memset(&ipu_handle, 0, sizeof(ipu_lib_handle_t));
371 + memset(&test_handle, 0, sizeof(ipu_test_handle_t));
372 + test_handle.ipu_handle = &ipu_handle;
373 + test_handle.mode = OP_NORMAL_MODE;
374 + test_handle.block_width = 80;
377 sigemptyset(&act.sa_mask);
378 @@ -177,270 +153,127 @@ int main(int argc, char *argv[])
380 if((ret = sigaction(SIGINT, &act, NULL)) < 0) {
381 printf("install sigal error\n");
386 - memset(&test_handle, 0, sizeof(ipu_test_handle_t));
388 if (process_cmdline(argc, argv, &test_handle) < 0) {
389 printf("\nMXC IPU device Test\n\n" \
390 - "Usage: %s -C <config file> <input raw file>\n",
393 + "-C <config file>\n" \
394 + "-P <test pattern>\n" \
395 + "[-bw <block width for pattern 3>]\n" \
396 + "<input raw file>\n\n" \
397 + "Query ipu task runing:\n" \
399 + "Kill ipu task:\n" \
400 + "-K <task_index>\n", argv[0]);
401 + printf("\ntest pattern:\n" \
402 + "1: video pattern with user define dma buffer queue, one full-screen output\n" \
403 + "2: hopping block screen save\n" \
404 + "3: color bar + hopping block\n" \
405 + "4: color bar IC global alpha overlay\n" \
406 + "5: color bar IC separate local alpha overlay\n" \
407 + "6: color bar IC local alpha within pixel overlay\n" \
408 + "7: ipu dma copy test\n" \
409 + "8: 2 screen layer test using IC global alpha blending\n" \
410 + "9: 3 screen layer test using IC global alpha blending\n" \
411 + "10: 2 screen layer test using IC local alpha blending with alpha value in separate buffer\n" \
412 + "11: 3 screen layer test using IC local alpha blending with alpha value in separate buffer\n" \
413 + "12: 2 screen layer test using IC local alpha blending with alpha value in pixel\n" \
414 + "13: 3 screen layer test using IC local alpha blending with alpha value in pixel\n" \
415 + "14: 2 screen layer test IPC ProcessA + ProcessB with globla alpha blending\n" \
416 + "15: 2 screen layer test IPC ProcessA + ProcessB with local alpha blending\n" \
417 + "16: 3 screen layer test IPC ProcessA(first_layer + sencond_layer) + ProcessB(third_layer) with globla alpha blending\n" \
418 + "17: 3 screen layer test IPC ProcessA(first_layer + sencond_layer) + ProcessB(third_layer) with local alpha blending\n" \
419 + "18: 3 screen layer test IPC ProcessA(first_layer) ProcessB(sencond_layer) ProcessC(third_layer) with local alpha blending\n" \
420 + "19: 2 screen layer test IPC ProcessA(first_layer) ProcessB(sencond_layer) with local alpha blending plus tv copy\n\n");
424 - file_in = fopen(argv[argc-1], "rb");
425 - if (file_in == NULL){
426 - printf("there is no such file for reading %s\n", argv[argc-1]);
431 - fd_ipu = open("/dev/mxc_ipu", O_RDWR, 0);
433 - printf("open ipu dev fail\n");
438 - isize = t->input.paddr =
439 - t->input.width * t->input.height
440 - * fmt_to_bpp(t->input.format)/8;
441 - ret = ioctl(fd_ipu, IPU_ALLOC, &t->input.paddr);
443 - printf("ioctl IPU_ALLOC fail\n");
446 - inbuf = mmap(0, isize, PROT_READ | PROT_WRITE,
447 - MAP_SHARED, fd_ipu, t->input.paddr);
449 - printf("mmap fail\n");
453 + system("echo 0,0 > /sys/class/graphics/fb0/pan");
455 - if (t->input.deinterlace.enable &&
456 - (t->input.deinterlace.motion != HIGH_MOTION)) {
457 - t->input.paddr_n = isize;
458 - ret = ioctl(fd_ipu, IPU_ALLOC, &t->input.paddr_n);
460 - printf("ioctl IPU_ALLOC fail\n");
463 - vdibuf = mmap(0, isize, PROT_READ | PROT_WRITE,
464 - MAP_SHARED, fd_ipu, t->input.paddr_n);
466 - printf("mmap fail\n");
469 + if (test_handle.test_pattern) {
470 + ret = run_test_pattern(test_handle.test_pattern, &test_handle);
471 + system("echo 0,0 > /sys/class/graphics/fb0/pan");
473 + } else if (argc < 4) {
474 + if (test_handle.query_task)
475 + return query_ipu_task();
476 + else if (test_handle.kill_task)
477 + return kill_ipu_task(test_handle.kill_task_idx);
479 + printf("Pls set input file\n");
484 - if (t->overlay_en) {
485 - ovsize = t->overlay.paddr =
486 - t->overlay.width * t->overlay.height
487 - * fmt_to_bpp(t->overlay.format)/8;
488 - ret = ioctl(fd_ipu, IPU_ALLOC, &t->overlay.paddr);
490 - printf("ioctl IPU_ALLOC fail\n");
493 - ovbuf = mmap(0, ovsize, PROT_READ | PROT_WRITE,
494 - MAP_SHARED, fd_ipu, t->overlay.paddr);
496 - printf("mmap fail\n");
501 - /*fill overlay buffer with dedicated data*/
502 - memset(ovbuf, 0x00, ovsize/4);
503 - memset(ovbuf+ovsize/4, 0x55, ovsize/4);
504 - memset(ovbuf+ovsize/2, 0xaa, ovsize/4);
505 - memset(ovbuf+ovsize*3/4, 0xff, ovsize/4);
507 - if (t->overlay.alpha.mode == IPU_ALPHA_MODE_LOCAL) {
508 - alpsize = t->overlay.alpha.loc_alp_paddr =
509 - t->overlay.width * t->overlay.height;
510 - ret = ioctl(fd_ipu, IPU_ALLOC, &t->overlay.alpha.loc_alp_paddr);
512 - printf("ioctl IPU_ALLOC fail\n");
515 - alpbuf = mmap(0, alpsize, PROT_READ | PROT_WRITE,
516 - MAP_SHARED, fd_ipu, t->overlay.alpha.loc_alp_paddr);
518 - printf("mmap fail\n");
523 - /*fill loc alpha buffer with dedicated data*/
524 - memset(alpbuf, 0x00, alpsize/4);
525 - memset(alpbuf+alpsize/4, 0x55, alpsize/4);
526 - memset(alpbuf+alpsize/2, 0xaa, alpsize/4);
527 - memset(alpbuf+alpsize*3/4, 0xff, alpsize/4);
528 + if (test_handle.mode & OP_STREAM_MODE) {
529 + if (test_handle.fcount == 1) {
530 + test_handle.mode &= ~(OP_STREAM_MODE);
531 + test_handle.mode |= OP_NORMAL_MODE;
535 - if (test_handle.show_to_fb) {
537 - char fb_dev[] = "/dev/fb0";
540 - if (!strcmp(test_handle.outfile, "ipu0-1st-ovfb"))
541 - memcpy(fb_name, "DISP3 FG", 9);
542 - if (!strcmp(test_handle.outfile, "ipu0-2nd-fb"))
543 - memcpy(fb_name, "DISP3 BG - DI1", 15);
544 - if (!strcmp(test_handle.outfile, "ipu1-1st-ovfb"))
545 - memcpy(fb_name, "DISP4 FG", 9);
546 - if (!strcmp(test_handle.outfile, "ipu1-2nd-fb"))
547 - memcpy(fb_name, "DISP4 BG - DI1", 15);
549 - for (i=0; i<5; i++) {
552 - fd_fb = open(fb_dev, O_RDWR, 0);
554 - ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix);
555 - if (!strcmp(fb_fix.id, fb_name)) {
556 - printf("found fb dev %s\n", fb_dev);
565 - printf("can not find fb dev %s\n", fb_name);
569 + file_in = fopen(argv[argc-1], "rb");
570 + if (file_in == NULL){
571 + printf("there is no such file for reading %s\n", argv[argc-1]);
575 - ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var);
576 - fb_var.xres = t->output.width;
577 - fb_var.xres_virtual = fb_var.xres;
578 - fb_var.yres = t->output.height;
579 - fb_var.yres_virtual = fb_var.yres * FB_BUFS;
580 - fb_var.activate |= FB_ACTIVATE_FORCE;
581 - fb_var.nonstd = t->output.format;
582 - fb_var.bits_per_pixel = fmt_to_bpp(t->output.format);
584 - ret = ioctl(fd_fb, FBIOPUT_VSCREENINFO, &fb_var);
586 - printf("fb ioctl FBIOPUT_VSCREENINFO fail\n");
589 - ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var);
590 - ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix);
592 - for (i=0; i<FB_BUFS; i++)
593 - outpaddr[i] = fb_fix.smem_start +
594 - i * fb_var.yres * fb_fix.line_length;
596 - blank = FB_BLANK_UNBLANK;
597 - ioctl(fd_fb, FBIOBLANK, blank);
599 - osize = t->output.paddr =
600 - t->output.width * t->output.height
601 - * fmt_to_bpp(t->output.format)/8;
602 - ret = ioctl(fd_ipu, IPU_ALLOC, &t->output.paddr);
604 - printf("ioctl IPU_ALLOC fail\n");
607 - outbuf = mmap(0, osize, PROT_READ | PROT_WRITE,
608 - MAP_SHARED, fd_ipu, t->output.paddr);
610 - printf("mmap fail\n");
614 + if (test_handle.outfile && !test_handle.output.show_to_fb)
615 + test_handle.file_out = fopen(test_handle.outfile, "wb");
617 - file_out = fopen(test_handle.outfile, "wb");
618 - if (file_out == NULL) {
619 - printf("can not open output file %s\n", test_handle.outfile);
623 + ret = mxc_ipu_lib_task_init(&(test_handle.input), NULL, &(test_handle.output),
624 + test_handle.mode, test_handle.ipu_handle);
626 + printf("mxc_ipu_lib_task_init failed!\n");
631 - ret = ioctl(fd_ipu, IPU_CHECK_TASK, t);
632 - if (ret != IPU_CHECK_OK) {
633 - if (ret > IPU_CHECK_ERR_MIN) {
634 - if (ret == IPU_CHECK_ERR_SPLIT_INPUTW_OVER) {
635 - t->input.crop.w -= 8;
638 - if (ret == IPU_CHECK_ERR_SPLIT_INPUTH_OVER) {
639 - t->input.crop.h -= 8;
642 - if (ret == IPU_CHECK_ERR_SPLIT_OUTPUTW_OVER) {
643 - t->output.crop.w -= 8;
646 - if (ret == IPU_CHECK_ERR_SPLIT_OUTPUTH_OVER) {
647 - t->output.crop.h -= 8;
651 - printf("ipu task check fail\n");
658 - if (t->input.deinterlace.enable &&
659 - (t->input.deinterlace.motion != HIGH_MOTION))
660 - if (fread(vdibuf, 1, isize, file_in) < isize) {
662 - printf("Can not read enough data from input file\n");
666 while((done_cnt < test_handle.fcount) && (ctrl_c_rev == 0)) {
667 gettimeofday(&begin, NULL);
669 - if (t->input.deinterlace.enable &&
670 - (t->input.deinterlace.motion != HIGH_MOTION)) {
671 - memcpy(inbuf, vdibuf, isize);
672 - ret = fread(vdibuf, 1, isize, file_in);
674 - ret = fread(inbuf, 1, isize, file_in);
676 + if (fread(test_handle.ipu_handle->inbuf_start[next_update_idx], 1, test_handle.ipu_handle->ifr_size, file_in)
677 + < test_handle.ipu_handle->ifr_size) {
679 - printf("Can not read enough data from input file\n");
683 - if (test_handle.show_to_fb)
684 - t->output.paddr = outpaddr[done_cnt % FB_BUFS];
686 - ret = ioctl(fd_ipu, IPU_QUEUE_TASK, t);
688 - printf("ioct IPU_QUEUE_TASK fail\n");
689 + printf("Can not read enough data from input file!\n");
693 - if (test_handle.show_to_fb) {
694 - fb_var.yoffset = (done_cnt % FB_BUFS) * fb_var.yres;
695 - ret = ioctl(fd_fb, FBIOPAN_DISPLAY, &fb_var);
697 - printf("fb ioct FBIOPAN_DISPLAY fail\n");
698 + if (first_time && (test_handle.mode == (TASK_VDI_VF_MODE | OP_NORMAL_MODE)) && (test_handle.input.motion_sel != HIGH_MOTION)) {
699 + if (fread(test_handle.ipu_handle->inbuf_start[1], 1, test_handle.ipu_handle->ifr_size, file_in)
700 + < test_handle.ipu_handle->ifr_size) {
702 + printf("Can not read enough data from input file!\n");
706 - ret = fwrite(outbuf, 1, osize, file_out);
712 + if (first_time && (test_handle.mode & OP_STREAM_MODE)) {
713 + if (fread(test_handle.ipu_handle->inbuf_start[1], 1, test_handle.ipu_handle->ifr_size, file_in)
714 + < test_handle.ipu_handle->ifr_size) {
716 - printf("Can not write enough data into output file\n");
717 + printf("Can not read enough data from input file!\n");
720 + if ((test_handle.mode & TASK_VDI_VF_MODE) && (test_handle.input.motion_sel != HIGH_MOTION)) {
721 + if (fread(test_handle.ipu_handle->inbuf_start[2], 1, test_handle.ipu_handle->ifr_size, file_in)
722 + < test_handle.ipu_handle->ifr_size) {
724 + printf("Can not read enough data from input file!\n");
734 + next_update_idx = mxc_ipu_lib_task_buf_update(test_handle.ipu_handle, 0, 0, 0, output_to_file_cb, &test_handle);
735 + if (next_update_idx < 0)
740 @@ -455,63 +288,23 @@ task_begin:
741 run_time += (sec * 1000000) + usec;
746 - if ((done_loop < test_handle.loop_cnt) && (ctrl_c_rev == 0)) {
748 - fseek(file_in, 0L, SEEK_SET);
752 + if ((done_loop < test_handle.loop_cnt) && (ctrl_c_rev == 0)) {
754 + fseek(file_in, 0L, SEEK_SET);
758 - printf("total frame count %d avg frame time %d us, fps %f\n",
759 - total_cnt, run_time/total_cnt, total_cnt/(run_time/1000000.0));
760 + printf("total frame count %d avg frame time %d us, fps %f\n", total_cnt, run_time/total_cnt, total_cnt/(run_time/1000000.0));
762 + mxc_ipu_lib_task_uninit(test_handle.ipu_handle);
766 + if (test_handle.file_out)
767 + fclose(test_handle.file_out);
769 + system("echo 0,0 > /sys/class/graphics/fb0/pan");
773 - blank = FB_BLANK_POWERDOWN;
774 - ioctl(fd_fb, FBIOBLANK, blank);
780 - munmap(outbuf, osize);
784 - if (t->output.paddr)
785 - ioctl(fd_ipu, IPU_FREE, &t->output.paddr);
788 - munmap(alpbuf, alpsize);
790 - if (t->overlay.alpha.loc_alp_paddr)
791 - ioctl(fd_ipu, IPU_FREE, &t->overlay.alpha.loc_alp_paddr);
794 - munmap(ovbuf, ovsize);
796 - if (t->overlay.paddr)
797 - ioctl(fd_ipu, IPU_FREE, &t->overlay.paddr);
800 - munmap(vdibuf, isize);
802 - if (t->input.paddr_n)
803 - ioctl(fd_ipu, IPU_FREE, &t->input.paddr_n);
806 - munmap(inbuf, isize);
808 - if (t->input.paddr)
809 - ioctl(fd_ipu, IPU_FREE, &t->input.paddr);
819 diff --git a/test/mxc_ipudev_test/mxc_ipudev_test.h b/test/mxc_ipudev_test/mxc_ipudev_test.h
820 index 6ccfbcf..b985b30 100644
821 --- a/test/mxc_ipudev_test/mxc_ipudev_test.h
822 +++ b/test/mxc_ipudev_test/mxc_ipudev_test.h
824 #define __MXC_IPUDEV_TEST_H__
826 #include <linux/ipu.h>
827 +#include <linux/videodev.h>
828 +#include "mxc_ipu_hl_lib.h"
831 - struct ipu_task task;
832 + ipu_lib_handle_t * ipu_handle;
844 + ipu_lib_input_param_t input;
845 + ipu_lib_output_param_t output;
850 + IC_GLB_ALP_OV = 0x01,
851 + IC_LOC_SEP_ALP_OV = 0x02,
852 + IC_LOC_PIX_ALP_OV = 0x04,
853 + DP_LOC_SEP_ALP_OV = 0x08,
857 extern int parse_config_file(char *file_name, ipu_test_handle_t *test_handle);
858 +int run_test_pattern(int pattern, ipu_test_handle_t * test_handle);
861 diff --git a/test/mxc_ipudev_test/test_pattern.c b/test/mxc_ipudev_test/test_pattern.c
863 index 0000000..c968548
865 +++ b/test/mxc_ipudev_test/test_pattern.c
868 + * Copyright 2009-2011 Freescale Semiconductor, Inc. All Rights Reserved.
873 + * The code contained herein is licensed under the GNU Lesser General
874 + * Public License. You may obtain a copy of the GNU Lesser General
875 + * Public License Version 2.1 or later at the following locations:
877 + * http://www.opensource.org/licenses/lgpl-license.html
878 + * http://www.gnu.org/copyleft/lgpl.html
882 + * @file test_pattern.c
884 + * @brief IPU device lib test pattern implementation
897 +#include <pthread.h>
899 +#include <semaphore.h>
900 +#include <sys/mman.h>
901 +#include <sys/ioctl.h>
902 +#include <sys/stat.h>
903 +#include <linux/mxcfb.h>
904 +#include "mxc_ipudev_test.h"
905 +#ifndef BUILD_FOR_ANDROID
906 +#include "ScreenLayer.h"
910 + Y = R * .299 + G * .587 + B * .114;
911 + U = R * -.169 + G * -.332 + B * .500 + 128.;
912 + V = R * .500 + G * -.419 + B * -.0813 + 128.;*/
914 +#define red(x) (((x & 0xE0) >> 5) * 0x24)
915 +#define green(x) (((x & 0x1C) >> 2) * 0x24)
916 +#define blue(x) ((x & 0x3) * 0x55)
917 +#define y(rgb) ((red(rgb)*299L + green(rgb)*587L + blue(rgb)*114L) / 1000)
918 +#define u(rgb) ((((blue(rgb)*500L) - (red(rgb)*169L) - (green(rgb)*332L)) / 1000))
919 +#define v(rgb) (((red(rgb)*500L - green(rgb)*419L - blue(rgb)*81L) / 1000))
922 +extern int ctrl_c_rev;
924 +static int get_system_rev(unsigned int * system_rev)
932 + fp = fopen("/proc/cpuinfo", "r");
934 + printf("Open /proc/cpuinfo failed!\n");
938 + nread = fread(buf, 1, sizeof(buf), fp);
940 + if ((nread == 0) || (nread == sizeof(buf))) {
947 + tmp = strstr(buf, "Revision");
949 + rev = index(tmp, ':');
952 + *system_rev = strtoul(rev, NULL, 16);
960 +void gen_fill_pattern(char * buf, int in_width, int in_height)
962 + int y_size = in_width * in_height;
963 + int h_step = in_height / 16;
964 + int w_step = in_width / 16;
966 + uint32_t y_color = 0;
967 + int32_t u_color = 0;
968 + int32_t v_color = 0;
970 + static int32_t alpha = 0;
971 + static int inc_alpha = 1;
973 + for (h = 0; h < in_height; h++) {
974 + int32_t rgb_temp = rgb;
976 + for (w = 0; w < in_width; w++) {
977 + if (w % w_step == 0) {
978 + y_color = y(rgb_temp);
979 + y_color = (y_color * alpha) / 255;
981 + u_color = u(rgb_temp);
982 + u_color = (u_color * alpha) / 255;
985 + v_color = v(rgb_temp);
986 + v_color = (v_color * alpha) / 255;
990 + if (rgb_temp > 255)
993 + buf[(h*in_width) + w] = y_color;
994 + if (!(h & 0x1) && !(w & 0x1)) {
995 + buf[y_size + (((h*in_width)/4) + (w/2)) ] = u_color;
996 + buf[y_size + y_size/4 + (((h*in_width)/4) + (w/2))] = v_color;
999 + if ((h > 0) && (h % h_step == 0)) {
1008 + if (alpha >= 255) {
1019 +void gen_fill_alpha_in_separate_buffer(void * alpha_buf, int alpha_size,
1022 + memset(alpha_buf, alpha, alpha_size);
1025 +void fill_alpha_buffer(char *alpha_buf, int left, int top,
1026 + int right, int bottom, int disp_w, char alpha_val)
1028 + char *pPointAlphaValue;
1031 + for (y = top; y < bottom; y++) {
1032 + for (x = left; x < right; x++) {
1033 + pPointAlphaValue = (char *)(alpha_buf +
1035 + *pPointAlphaValue = alpha_val;
1040 +void gen_fill_alpha_in_pixel(void * buf, unsigned int pixel_format,
1041 + int buf_size, char alpha)
1046 + if (pixel_format == v4l2_fourcc('R', 'G', 'B', 'A') ||
1047 + pixel_format == v4l2_fourcc('B', 'G', 'R', 'A')) {
1048 + for (i = 0; i < buf_size; i++) {
1050 + p_alpha = (char *)(buf + i);
1054 + } else if (pixel_format == v4l2_fourcc('A', 'B', 'G', 'R')) {
1055 + for (i = 0; i < buf_size; i++) {
1057 + p_alpha = (char *)(buf + i);
1062 + printf("Unsupported pixel format with alpha value!\n");
1066 +void gen_fill_alpha_in_pixel_for_point(void * buf, unsigned int pixel_format,
1067 + int sl_width, int x, int y, char alpha)
1069 + unsigned char* p_alpha;
1071 + if (pixel_format == v4l2_fourcc('R', 'G', 'B', 'A') ||
1072 + pixel_format == v4l2_fourcc('B', 'G', 'R', 'A')) {
1073 + p_alpha = (unsigned char *)(buf + 4*sl_width*y + 4*x + 3);
1074 + } else if (pixel_format == v4l2_fourcc('A', 'B', 'G', 'R')) {
1075 + p_alpha = (unsigned char *)(buf + 4*sl_width*y + 4*x);
1077 + printf("Unsupported pixel format with alpha value!\n");
1083 +int foreground_fb(void)
1086 + struct fb_fix_screeninfo fb_fix;
1088 + fd_fb = open("/dev/fb2", O_RDWR, 0);
1089 + ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix);
1090 + if (strcmp(fb_fix.id, "DISP3 FG") == 0) {
1095 + fd_fb = open("/dev/fb1", O_RDWR, 0);
1096 + ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix);
1097 + if (strcmp(fb_fix.id, "DISP3 FG") == 0) {
1108 + struct fb_fix_screeninfo fb_fix;
1110 + fd_fb = open("/dev/fb0", O_RDWR, 0);
1111 + ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix);
1112 + if (strcmp(fb_fix.id, "DISP3 BG - DI1") == 0) {
1117 + fd_fb = open("/dev/fb1", O_RDWR, 0);
1118 + ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix);
1119 + if (strcmp(fb_fix.id, "DISP3 BG - DI1") == 0) {
1127 +int fd_fb_alloc = 0;
1129 +int dma_memory_alloc(int size, int cnt, dma_addr_t paddr[], void * vaddr[])
1133 + if ((fd_fb_alloc = open("/dev/fb0", O_RDWR, 0)) < 0) {
1134 + printf("Unable to open /dev/fb0\n");
1139 + for (i=0;i<cnt;i++) {
1140 + /*alloc mem from DMA zone*/
1141 + /*input as request mem size */
1143 + if ( ioctl(fd_fb_alloc, FBIO_ALLOC, &(paddr[i])) < 0) {
1144 + printf("Unable alloc mem from /dev/fb0\n");
1145 + close(fd_fb_alloc);
1146 + if ((fd_fb_alloc = open("/dev/fb1", O_RDWR, 0)) < 0) {
1147 + printf("Unable to open /dev/fb1\n");
1148 + if ((fd_fb_alloc = open("/dev/fb2", O_RDWR, 0)) < 0) {
1149 + printf("Unable to open /dev/fb2\n");
1152 + } else if ( ioctl(fd_fb_alloc, FBIO_ALLOC, &(paddr[i])) < 0) {
1153 + printf("Unable alloc mem from /dev/fb2\n");
1157 + } else if ( ioctl(fd_fb_alloc, FBIO_ALLOC, &(paddr[i])) < 0) {
1158 + printf("Unable alloc mem from /dev/fb1\n");
1159 + close(fd_fb_alloc);
1160 + if ((fd_fb_alloc = open("/dev/fb2", O_RDWR, 0)) < 0) {
1161 + printf("Unable to open /dev/fb2\n");
1164 + } else if ( ioctl(fd_fb_alloc, FBIO_ALLOC, &(paddr[i])) < 0) {
1165 + printf("Unable alloc mem from /dev/fb2\n");
1172 + vaddr[i] = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
1173 + fd_fb_alloc, paddr[i]);
1174 + if (vaddr[i] == MAP_FAILED) {
1175 + printf("mmap failed!\n");
1184 +void dma_memory_free(int size, int cnt, dma_addr_t paddr[], void * vaddr[])
1188 + for (i=0;i<cnt;i++) {
1190 + munmap(vaddr[i], size);
1192 + ioctl(fd_fb_alloc, FBIO_FREE, &(paddr[i]));
1196 +int copy_test(ipu_test_handle_t * test_handle)
1198 + int ret = 0, fd_fb = 0, screen_size;
1199 + struct fb_var_screeninfo fb_var;
1200 + struct fb_fix_screeninfo fb_fix;
1201 + void * fake_fb[1];
1202 + int fake_fb_paddr[1], done_cnt = 0;
1204 + if ((fd_fb = open("/dev/fb0", O_RDWR, 0)) < 0) {
1205 + printf("Unable to open /dev/fb0\n");
1210 + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) {
1211 + printf("Get FB var info failed!\n");
1215 + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) {
1216 + printf("Get FB fix info failed!\n");
1220 + screen_size = fb_var.yres * fb_fix.line_length;
1221 + ret = dma_memory_alloc(screen_size, 1, fake_fb_paddr, fake_fb);
1223 + printf("dma_memory_alloc failed\n");
1227 + test_handle->mode = OP_NORMAL_MODE | TASK_PP_MODE;
1228 + test_handle->fcount = 10;
1229 + test_handle->input.width = fb_var.xres;
1230 + test_handle->input.height = fb_var.yres;
1231 + test_handle->output.width = fb_var.xres;
1232 + test_handle->output.height = fb_var.yres;
1233 + if (fb_var.bits_per_pixel == 24) {
1234 + test_handle->output.fmt = v4l2_fourcc('B', 'G', 'R', '3');
1235 + test_handle->input.fmt = v4l2_fourcc('B', 'G', 'R', '3');
1237 + test_handle->output.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
1238 + test_handle->input.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
1240 + test_handle->input.user_def_paddr[0] = fake_fb_paddr[0];
1241 + test_handle->output.user_def_paddr[0] = fb_fix.smem_start;
1243 + ret = mxc_ipu_lib_task_init(&(test_handle->input), NULL, &(test_handle->output),
1244 + test_handle->mode, test_handle->ipu_handle);
1246 + printf("mxc_ipu_lib_task_init failed!\n");
1250 + while((done_cnt < test_handle->fcount) && (ctrl_c_rev == 0)) {
1253 + memset(fake_fb[0], 0, screen_size);
1255 + memset(fake_fb[0], 0x80, screen_size);
1257 + memset(fake_fb[0], 0xff, screen_size);
1259 + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, 0, 0, 0, NULL, NULL) < 0)
1265 + mxc_ipu_lib_task_uninit(test_handle->ipu_handle);
1268 + dma_memory_free(screen_size, 1, fake_fb_paddr, fake_fb);
1273 +int color_bar(int overlay, ipu_test_handle_t * test_handle)
1275 + int ret = 0, fd_fb = 0, size = 0, i, k = 0, done_cnt = 0, fcount = 0;
1276 + void * buf[BUF_CNT] = {0}, * fb[3];
1277 + void * ov_fake_fb = 0, * ov_alpha_fake_fb = 0;
1278 + int ov_fake_fb_paddr = 0, ov_alpha_fake_fb_paddr = 0;
1279 + int paddr[BUF_CNT] = {0};
1280 + struct fb_var_screeninfo fb_var;
1281 + struct fb_fix_screeninfo fb_fix;
1282 + struct mxcfb_gbl_alpha g_alpha;
1283 + unsigned int system_rev = 0, ipu_version;
1284 + ipu_lib_overlay_param_t ov;
1285 + int screen_size, ov_fake_fb_size = 0, ov_alpha_fake_fb_size = 0;
1287 + get_system_rev(&system_rev);
1288 + if (((system_rev & 0xff000) == 0x37000) ||
1289 + (((system_rev & 0xff000) == 0x51000)) ||
1290 + (((system_rev & 0xff000) == 0x53000)))
1295 + if (ipu_version == 1) {
1296 + printf("ipuv1 can not support dispaly 2 output together!\n");
1297 + printf("because ipuv1 ENC channel can not be linked to disp channel!\n");
1301 + if ((ipu_version == 1) && overlay) {
1302 + printf("currently ipuv1 would not support overlay!\n");
1307 + if ((fd_fb = open("/dev/fb0", O_RDWR, 0)) < 0) {
1308 + printf("Unable to open /dev/fb0\n");
1313 + g_alpha.alpha = 128;
1314 + g_alpha.enable = 1;
1315 + if (ioctl(fd_fb, MXCFB_SET_GBL_ALPHA, &g_alpha) < 0) {
1316 + printf("Set global alpha failed\n");
1321 + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) {
1322 + printf("Get FB var info failed!\n");
1326 + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) {
1327 + printf("Get FB fix info failed!\n");
1332 + if(fb_var.yres_virtual != 3*fb_var.yres)
1334 + fb_var.yres_virtual = 3*fb_var.yres;
1335 + if ( ioctl(fd_fb, FBIOPUT_VSCREENINFO, &fb_var) < 0) {
1336 + printf("Get FB var info failed!\n");
1342 + screen_size = fb_var.yres * fb_fix.line_length;
1343 + fb[0] = mmap(NULL, 3 * screen_size, PROT_READ | PROT_WRITE, MAP_SHARED,
1345 + if (fb[0] == MAP_FAILED) {
1346 + printf("fb buf0 mmap failed, errno %d!\n", errno);
1350 + /* ipu use fb base+screen_size as buf0 */
1351 + fb[1] = (void *)((char *)fb[0]);
1352 + fb[0] = (void *)((char *)fb[1] + screen_size);
1353 + fb[2] = (void *)((char *)fb[1] + 2*screen_size);
1355 + /* use I420 input format as fix*/
1356 + test_handle->mode = OP_STREAM_MODE;
1357 + test_handle->fcount = fcount = 511;
1358 + test_handle->input.width = 320;
1359 + test_handle->input.height = 240;
1360 + test_handle->input.fmt = v4l2_fourcc('I', '4', '2', '0');
1361 + if (fb_var.bits_per_pixel == 24)
1362 + test_handle->output.fmt = v4l2_fourcc('B', 'G', 'R', '3');
1364 + test_handle->output.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
1365 + test_handle->output.show_to_fb = 1;
1366 + test_handle->output.fb_disp.fb_num = 0;
1367 + /* ipuv1 only support display on PP & VF task mode */
1368 + if (ipu_version == 1)
1369 + test_handle->mode |= TASK_PP_MODE;
1370 + test_handle->output.rot = 3;
1372 + /* overlay case -- fake fb+overlay show to fb0*/
1373 + ov.width = fb_var.xres;
1374 + ov.height = fb_var.yres;
1375 + if (fb_var.bits_per_pixel == 24)
1376 + ov.fmt = v4l2_fourcc('B', 'G', 'R', '3');
1378 + ov.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
1380 + if (overlay == IC_LOC_SEP_ALP_OV) {
1381 + ov.ov_crop_win.pos.x = fb_var.xres/4;
1382 + ov.ov_crop_win.pos.y = fb_var.yres/4;
1383 + ov.ov_crop_win.win_w = fb_var.xres/2;
1384 + ov.ov_crop_win.win_h = fb_var.yres/2;
1385 + ov.local_alpha_en = 1;
1386 + ov.global_alpha_en = 0;
1387 + ov_fake_fb_size = screen_size;
1388 + ov_alpha_fake_fb_size = ov.width * ov.height;
1390 + test_handle->output.width = fb_var.xres/2;
1391 + test_handle->output.height = fb_var.yres/2;
1392 + test_handle->output.fb_disp.pos.x = fb_var.xres/4;
1393 + test_handle->output.fb_disp.pos.y = fb_var.yres/4;
1394 + } else if (overlay == IC_GLB_ALP_OV) {
1395 + ov.ov_crop_win.pos.x = fb_var.xres/4;
1396 + ov.ov_crop_win.pos.y = fb_var.yres/4;
1397 + ov.ov_crop_win.win_w = fb_var.xres/2;
1398 + ov.ov_crop_win.win_h = fb_var.yres/2;
1399 + ov.local_alpha_en = 0;
1400 + ov.global_alpha_en = 1;
1401 + ov_fake_fb_size = screen_size;
1403 + test_handle->output.width = fb_var.xres/2;
1404 + test_handle->output.height = fb_var.yres/2;
1405 + test_handle->output.fb_disp.pos.x = fb_var.xres/4;
1406 + test_handle->output.fb_disp.pos.y = fb_var.yres/4;
1407 + } else if (overlay == IC_LOC_PIX_ALP_OV) {
1408 + ov.fmt = v4l2_fourcc('R', 'G', 'B', 'A');
1409 + ov.ov_crop_win.pos.x = 0;
1410 + ov.ov_crop_win.pos.y = 0;
1411 + ov.ov_crop_win.win_w = fb_var.xres;
1412 + ov.ov_crop_win.win_h = fb_var.yres;
1413 + ov.global_alpha_en = 0;
1414 + ov.local_alpha_en = 0;
1415 + ov_fake_fb_size = ov.width * ov.height * 4;
1418 + * RGB32A is not the pixel format of FB0(RGB565),
1419 + * so we cannot do memory copy from graphic plane to
1420 + * FB0. We choose to set graphic plane and video plane
1421 + * to be the same resolution with FB0.
1423 + test_handle->output.width = fb_var.xres;
1424 + test_handle->output.height = fb_var.yres;
1425 + test_handle->output.fb_disp.pos.x = 0;
1426 + test_handle->output.fb_disp.pos.y = 0;
1428 + ov.key_color_en = 0;
1430 + ov.key_color = 0x808080;
1432 + /* one output case -- full screen */
1433 + test_handle->output.width = fb_var.xres;
1434 + test_handle->output.height = fb_var.yres;
1437 + /*allocate dma buffers from fb dev*/
1438 + size = test_handle->input.width * test_handle->input.height * 3/2;
1439 + ret = dma_memory_alloc(size, BUF_CNT, paddr, buf);
1441 + printf("dma_memory_alloc failed\n");
1446 + ov_fake_fb_paddr = ov_fake_fb_size;
1447 + if ( ioctl(fd_fb, FBIO_ALLOC, &(ov_fake_fb_paddr)) < 0) {
1448 + printf("Unable alloc mem from /dev/fb0\n");
1452 + ov_fake_fb = mmap(NULL, ov_fake_fb_size, PROT_READ | PROT_WRITE, MAP_SHARED,
1453 + fd_fb, ov_fake_fb_paddr);
1454 + if (ov_fake_fb == MAP_FAILED) {
1455 + printf("mmap failed!\n");
1459 + ov.user_def_paddr[0] = ov_fake_fb_paddr;
1460 + ov.user_def_paddr[1] = ov.user_def_paddr[0];
1462 + if (overlay == IC_LOC_SEP_ALP_OV) {
1463 + ov_alpha_fake_fb_paddr = ov_alpha_fake_fb_size;
1464 + if (ioctl(fd_fb, FBIO_ALLOC,
1465 + &(ov_alpha_fake_fb_paddr)) < 0) {
1466 + printf("Unable alloc mem from /dev/fb0\n");
1470 + ov_alpha_fake_fb = mmap(NULL, ov_alpha_fake_fb_size,
1471 + PROT_READ | PROT_WRITE,
1474 + ov_alpha_fake_fb_paddr);
1475 + if (ov_alpha_fake_fb == MAP_FAILED) {
1476 + printf("mmap failed!\n");
1480 + ov.user_def_alpha_paddr[0] = ov_alpha_fake_fb_paddr;
1481 + ov.user_def_alpha_paddr[1] = ov_alpha_fake_fb_paddr;
1485 + /* we are using stream mode and we set dma addr by ourselves*/
1486 + test_handle->input.user_def_paddr[0] = paddr[0];
1487 + test_handle->input.user_def_paddr[1] = paddr[1];
1488 + gen_fill_pattern(buf[0], test_handle->input.width, test_handle->input.height);
1489 + gen_fill_pattern(buf[1], test_handle->input.width, test_handle->input.height);
1493 + ret = mxc_ipu_lib_task_init(&(test_handle->input), &ov, &(test_handle->output),
1494 + test_handle->mode, test_handle->ipu_handle);
1496 + ret = mxc_ipu_lib_task_init(&(test_handle->input), NULL, &(test_handle->output),
1497 + test_handle->mode, test_handle->ipu_handle);
1499 + printf("mxc_ipu_lib_task_init failed!\n");
1503 + while((done_cnt < test_handle->fcount) && (ctrl_c_rev == 0)) {
1505 + if (overlay == IC_GLB_ALP_OV) {
1506 + if (done_cnt % 50 == 0) {
1509 + memset(ov_fake_fb, 0,
1512 + memset(ov_fake_fb, 0x80,
1515 + memset(ov_fake_fb, 0xff,
1519 + /* fb show sequence should be 0->1->2->0 */
1520 + memcpy(fb[done_cnt%3], ov_fake_fb,
1522 + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], ov_fake_fb_paddr, 0, NULL, NULL) < 0)
1524 + } else if (overlay == IC_LOC_PIX_ALP_OV) {
1525 + if (done_cnt == 1) {
1528 + for (k = 0; k < ov_fake_fb_size; k++) {
1530 + memset(ov_fake_fb + k,
1533 + memset(ov_fake_fb + k,
1537 + memset(ov_fake_fb + k,
1540 + } else if (done_cnt == 1*fcount/9) {
1542 + for (k = 0; k < ov_fake_fb_size; k++) {
1544 + memset(ov_fake_fb + k,
1547 + } else if (done_cnt == 2*fcount/9) {
1548 + /* graphic plane */
1549 + for (k = 0; k < ov_fake_fb_size; k++) {
1551 + memset(ov_fake_fb + k,
1554 + } else if (done_cnt == fcount/3) {
1555 + /* RGBA32 green */
1557 + for (k = 0; k < ov_fake_fb_size; k++) {
1559 + memset(ov_fake_fb + k,
1562 + memset(ov_fake_fb + k,
1566 + memset(ov_fake_fb + k,
1569 + } else if (done_cnt == 4*fcount/9) {
1571 + for (k = 0; k < ov_fake_fb_size; k++) {
1573 + memset(ov_fake_fb + k,
1576 + } else if (done_cnt == 5*fcount/9) {
1577 + /* graphic plane */
1578 + for (k = 0; k < ov_fake_fb_size; k++) {
1580 + memset(ov_fake_fb + k,
1583 + } else if (done_cnt == 2*fcount/3) {
1586 + for (k = 0; k < ov_fake_fb_size; k++) {
1588 + memset(ov_fake_fb + k,
1591 + memset(ov_fake_fb + k,
1595 + memset(ov_fake_fb + k,
1598 + } else if (done_cnt == 7*fcount/9) {
1600 + for (k = 0; k < ov_fake_fb_size; k++) {
1602 + memset(ov_fake_fb + k,
1605 + } else if (done_cnt == 8*fcount/9) {
1606 + /* graphic plane */
1607 + for (k = 0; k < ov_fake_fb_size; k++) {
1609 + memset(ov_fake_fb + k,
1613 + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], ov_fake_fb_paddr, 0, NULL, NULL) < 0)
1615 + } else if (overlay == IC_LOC_SEP_ALP_OV) {
1616 + if (done_cnt == 1) {
1618 + for (k = 0; k < ov_fake_fb_size; k++) {
1620 + memset(ov_fake_fb + k,
1623 + memset(ov_fake_fb + k,
1627 + memset(ov_alpha_fake_fb, 0x80,
1628 + ov_alpha_fake_fb_size);
1629 + } else if (done_cnt == 1*fcount/9) {
1631 + memset(ov_alpha_fake_fb, 0x00,
1632 + ov_alpha_fake_fb_size);
1633 + } else if (done_cnt == 2*fcount/9) {
1634 + /* graphic plane */
1635 + memset(ov_alpha_fake_fb, 0xFF,
1636 + ov_alpha_fake_fb_size);
1637 + } else if (done_cnt == fcount/3) {
1638 + /* RGB565 green */
1639 + for (k = 0; k < ov_fake_fb_size; k++) {
1641 + memset(ov_fake_fb + k,
1644 + memset(ov_fake_fb + k,
1648 + memset(ov_alpha_fake_fb, 0x80,
1649 + ov_alpha_fake_fb_size);
1650 + } else if (done_cnt == 4*fcount/9) {
1652 + memset(ov_alpha_fake_fb, 0x00,
1653 + ov_alpha_fake_fb_size);
1654 + } else if (done_cnt == 5*fcount/9) {
1655 + /* graphic plane */
1656 + memset(ov_alpha_fake_fb, 0xFF,
1657 + ov_alpha_fake_fb_size);
1658 + } else if (done_cnt == 2*fcount/3) {
1660 + for (k = 0; k < ov_fake_fb_size; k++) {
1662 + memset(ov_fake_fb + k,
1665 + memset(ov_fake_fb + k,
1669 + memset(ov_alpha_fake_fb, 0x80,
1670 + ov_alpha_fake_fb_size);
1671 + } else if (done_cnt == 7*fcount/9) {
1673 + memset(ov_alpha_fake_fb, 0x00,
1674 + ov_alpha_fake_fb_size);
1675 + } else if (done_cnt == 8*fcount/9) {
1676 + /* graphic plane */
1677 + memset(ov_alpha_fake_fb, 0xFF,
1678 + ov_alpha_fake_fb_size);
1680 + memcpy(fb[done_cnt%3], ov_fake_fb,
1682 + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], ov_fake_fb_paddr, ov_alpha_fake_fb_paddr, NULL, NULL) < 0)
1686 + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], 0, 0, NULL, NULL) < 0)
1694 + gen_fill_pattern(buf[i], test_handle->input.width, test_handle->input.height);
1695 + /* make the input framerate < 60Hz*/
1699 + mxc_ipu_lib_task_uninit(test_handle->ipu_handle);
1702 + dma_memory_free(size, BUF_CNT, paddr, buf);
1709 +int update_block_pos(int *x, int *y, int angle_start, int block_width,
1710 + int limit_w, int limit_h, int fd_fb)
1712 + static int angle = 0;
1713 + static double steps = 0.0;
1714 + struct mxcfb_pos pos;
1715 + int need_change = 0;
1720 + angle = angle_start;
1722 + ra = ((double)angle)*3.1415926/180.0;
1723 + nx = *x + steps*cos(ra);
1724 + ny = *y + steps*sin(ra);
1726 + if (ny < *y) /* x+, y-*/
1727 + angle = 360 - angle_start;
1729 + angle = angle_start;
1731 + } else if (nx > (limit_w - block_width)) {
1732 + if (ny < *y) /* x-, y-*/
1733 + angle = 180 + angle_start;
1735 + angle = 180 - angle_start;
1737 + } else if (ny < 0) {
1738 + if (nx < *x) /* x-, y+*/
1739 + angle = 180 - angle_start;
1741 + angle = angle_start;
1743 + } else if (ny > (limit_h - block_width)) {
1744 + if (nx < *x) /* x-, y-*/
1745 + angle = 180 + angle_start;
1747 + angle = 360 - angle_start;
1751 + if (need_change) {
1753 + ra = ((double)angle)*3.1415926/180.0;
1756 + //printf("change angle to %d\n", angle);
1757 + //printf("pos %d, %d\n", *x, *y);
1762 + ioctl(fd_fb, MXCFB_SET_OVERLAY_POS, &pos);
1766 + return need_change;
1770 + * This call-back function provide one method to update
1771 + * framebuffer by pan_display.
1773 +void hop_block_output_cb(void * arg, int index)
1775 + int fd_fb = *((int *)arg);
1776 + struct fb_var_screeninfo fb_var;
1778 + ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var);
1779 + /* for buf index 0, its phyaddr is fb buf1*/
1780 + /* for buf index 1, its phyaddr is fb buf0*/
1781 + /* for buf index 2, its phyaddr is fb buf2*/
1783 + fb_var.yoffset = fb_var.yres;
1784 + else if (index == 1)
1785 + fb_var.yoffset = 0;
1787 + fb_var.yoffset = 2 * fb_var.yres;
1789 + ioctl(fd_fb, FBIOPAN_DISPLAY, &fb_var);
1792 +int hop_block(ipu_test_handle_t * test_handle)
1794 + int ret = 0, x = 0, y = 0, fd_fb = 0, next_update_idx = 0;
1797 + char random_color;
1798 + int start_angle, screen_size;
1800 + struct mxcfb_pos pos;
1801 + struct fb_var_screeninfo fb_var;
1802 + struct fb_fix_screeninfo fb_fix;
1804 + /* clear background fb, get the lcd frame info */
1805 + if ((fd_fb = open("/dev/fb0", O_RDWR, 0)) < 0) {
1806 + printf("Unable to open /dev/fb0\n");
1811 + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) {
1812 + printf("Get FB fix info failed!\n");
1817 + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) {
1818 + printf("Get FB var info failed!\n");
1822 + lcd_w = fb_var.xres;
1823 + lcd_h = fb_var.yres;
1824 + screen_size = fb_var.yres_virtual * fb_fix.line_length;
1826 + buf = mmap(NULL, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED,
1828 + if (buf == MAP_FAILED) {
1829 + printf("mmap failed!\n");
1833 + memset(buf, 0, screen_size);
1836 + /* display hop block to overlay */
1837 + if (foreground_fb() == 2) {
1838 + if ((fd_fb = open("/dev/fb2", O_RDWR, 0)) < 0) {
1839 + printf("Unable to open /dev/fb2\n");
1844 + if ((fd_fb = open("/dev/fb1", O_RDWR, 0)) < 0) {
1845 + printf("Unable to open /dev/fb1\n");
1851 + fb_var.xres = test_handle->block_width
1852 + - test_handle->block_width%8;
1853 + fb_var.xres_virtual = fb_var.xres;
1854 + fb_var.yres = test_handle->block_width;
1855 + fb_var.yres_virtual = fb_var.yres * 3;
1856 + if ( ioctl(fd_fb, FBIOPUT_VSCREENINFO, &fb_var) < 0) {
1857 + printf("Set FB var info failed!\n");
1862 + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) {
1863 + printf("Get FB fix info failed!\n");
1868 + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) {
1869 + printf("Get FB var info failed!\n");
1873 + blank = FB_BLANK_UNBLANK;
1874 + if ( ioctl(fd_fb, FBIOBLANK, blank) < 0) {
1875 + printf("UNBLANK FB failed!\n");
1880 + test_handle->mode = OP_STREAM_MODE;
1881 + test_handle->input.width = 400;
1882 + test_handle->input.height = 400;
1883 + test_handle->input.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
1884 + test_handle->output.width = test_handle->block_width
1885 + - test_handle->block_width%8;
1886 + test_handle->output.height = test_handle->block_width;
1887 + if (fb_var.bits_per_pixel == 24)
1888 + test_handle->output.fmt = v4l2_fourcc('B', 'G', 'R', '3');
1890 + test_handle->output.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
1891 + test_handle->output.show_to_fb = 0;
1892 + screen_size = fb_var.yres * fb_fix.line_length;
1893 + test_handle->output.user_def_paddr[0] = fb_fix.smem_start + screen_size;
1894 + test_handle->output.user_def_paddr[1] = fb_fix.smem_start;
1895 + test_handle->output.user_def_paddr[2] = fb_fix.smem_start + 2*screen_size;
1897 + ret = mxc_ipu_lib_task_init(&(test_handle->input), NULL, &(test_handle->output),
1898 + test_handle->mode, test_handle->ipu_handle);
1900 + printf("mxc_ipu_lib_task_init failed!\n");
1904 + srand((unsigned int)time(0));
1905 + random_color = (char)(rand()%255);
1906 + /* for stream mode, fill two input frame to prepare */
1907 + memset(test_handle->ipu_handle->inbuf_start[0], random_color, test_handle->ipu_handle->ifr_size);
1908 + memset(test_handle->ipu_handle->inbuf_start[1], random_color, test_handle->ipu_handle->ifr_size);
1909 + start_angle = rand()%90;
1910 + if (start_angle == 90) start_angle = 89;
1911 + if (start_angle == 0) start_angle = 1;
1912 + printf("Start angle is %d\n", start_angle);
1914 + /* start first frame */
1915 + if((next_update_idx = mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, 0, 0, 0, hop_block_output_cb, &fd_fb)) < 0)
1918 + while(ctrl_c_rev == 0) {
1920 + /* update frame if only hop block hit the LCD frame */
1921 + if(update_block_pos(&x, &y, start_angle, test_handle->block_width, lcd_w, lcd_h, fd_fb)) {
1922 + random_color = (char)(rand()%255);
1923 + memset(test_handle->ipu_handle->inbuf_start[next_update_idx], random_color,
1924 + test_handle->ipu_handle->ifr_size);
1925 + if((next_update_idx = mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, 0, 0, 0, hop_block_output_cb, &fd_fb)) < 0)
1930 + /* ipu need reset position to 0,0 */
1933 + ioctl(fd_fb, MXCFB_SET_OVERLAY_POS, &pos);
1935 + blank = FB_BLANK_POWERDOWN;
1936 + if ( ioctl(fd_fb, FBIOBLANK, blank) < 0) {
1937 + printf("POWERDOWN FB failed!\n");
1942 + mxc_ipu_lib_task_uninit(test_handle->ipu_handle);
1950 +void * thread_func_color_bar(void *arg)
1953 + ipu_test_handle_t test_handle;
1954 + ipu_lib_handle_t ipu_handle;
1956 + memset(&ipu_handle, 0, sizeof(ipu_lib_handle_t));
1957 + memset(&test_handle, 0, sizeof(ipu_test_handle_t));
1959 + test_handle.ipu_handle = &ipu_handle;
1960 + ret = color_bar(NO_OV, &test_handle);
1962 + pthread_exit((void*)ret);
1967 +void * thread_func_hop_block(void *arg)
1971 + ret = hop_block((ipu_test_handle_t *)arg);
1973 + pthread_exit((void*)ret);
1978 +#ifndef BUILD_FOR_ANDROID
1979 +#define PRIMARYFBDEV "/dev/fb0"
1980 +#define OVERLAYFBDEV "/dev/fb2"
1981 +#define BUFCNT_1ST 1
1982 +#define BUFCNT_2ND 3
1983 +#define BUFCNT_3TH 5
1984 +#define FRM_CNT 511
1985 +/* variables for semaphore */
1987 +const char* semNameUnit="IPU_SL_unit_test";
1989 +/* Vittual address of shared memory in current process */
1990 +int * vshmUnitTest =NULL;
1992 +int getFBInfor(int * pfbWidth, int * pfbHeight, int * pfbBPP )
1995 + struct fb_var_screeninfo fb_var;
1996 + struct fb_fix_screeninfo fb_fix;
2000 + if ((fd_fb = open(PRIMARYFBDEV, O_RDWR, 0)) < 0) {
2001 + printf("Unable to open /dev/fb0\n");
2003 + goto getFBInfor_err1;
2006 + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) {
2007 + printf("Get FB fix info failed!\n");
2009 + goto getFBInfor_err2;
2012 + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) {
2013 + printf("Get FB var info failed!\n");
2015 + goto getFBInfor_err2;
2017 + *pfbWidth = fb_var.xres;
2018 + *pfbHeight = fb_var.yres;
2019 + *pfbBPP = fb_var.bits_per_pixel;
2025 +void * first_layer_thread_func(void *arg)
2028 + ScreenLayer first_layer;
2029 + int fb_width, fb_height, fb_bpp;
2030 + int op_type = NO_OV;
2033 + op_type = *((int *)arg);
2035 + ret = getFBInfor(&fb_width, &fb_height, &fb_bpp);
2038 + printf("Can not get fb information. \n");
2042 + memset(&first_layer, 0, sizeof(ScreenLayer));
2044 + first_layer.fmt = v4l2_fourcc('B', 'G', 'R', '3');
2046 + first_layer.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
2048 + if (op_type & COPY_TV)
2049 + first_layer.fmt = v4l2_fourcc('U', 'Y', 'V', 'Y');
2051 + memcpy(first_layer.fbdev, PRIMARYFBDEV, strlen(PRIMARYFBDEV)+1);
2052 + first_layer.pPrimary = NULL;
2053 + if ((ret = CreateScreenLayer(&first_layer, BUFCNT_1ST))
2054 + != E_RET_SUCCESS) {
2055 + printf("CreateScreenLayer first layer err %d\n", ret);
2060 + while (i < 50 && !ctrl_c_rev) {
2062 + memset(first_layer.bufVaddr[0], 0x0, first_layer.bufSize);
2063 + else if (i % 3 == 1)
2064 + memset(first_layer.bufVaddr[0], 0x80, first_layer.bufSize);
2065 + else if (i % 3 == 2)
2066 + memset(first_layer.bufVaddr[0], 0xff, first_layer.bufSize);
2068 + if (op_type & DP_LOC_SEP_ALP_OV) {
2069 + if ((ret = UpdateScreenLayer(&first_layer)) != E_RET_SUCCESS) {
2070 + printf("UpdateScreenLayer err %d\n",ret);
2074 + sem_wait(semIDUnit);
2075 + if (!vshmUnitTest[1] && !vshmUnitTest[2]) {
2076 + if ((ret = UpdateScreenLayer(&first_layer)) != E_RET_SUCCESS) {
2077 + printf("UpdateScreenLayer err %d\n",ret);
2081 + sem_post(semIDUnit);
2086 + while(vshmUnitTest[1] || vshmUnitTest[2])sleep(1);
2087 + DestoryScreenLayer(&first_layer);
2089 + printf("First layer has been destroyed! \n");
2093 +void * second_layer_thread_func(void *arg)
2095 + ScreenLayer second_layer;
2097 + LoadParam sec_param;
2098 + dma_addr_t paddr_2nd[BUFCNT_2ND];
2099 + void * buf_2nd[BUFCNT_2ND];
2100 + MethodAlphaData alpha_data;
2101 + MethodColorKeyData colorkey_data;
2102 + int buf_size, alpha_buf_size, x, y, i, ret, op_type = *((int *)arg);
2103 + int SL_width, SL_height;
2105 + int fb_width, fb_height, fb_bpp;
2106 + int show_time = 0;
2107 + int load_time = 0;
2108 + int update_time = 0;
2109 + int bufcnt = BUFCNT_2ND;
2111 + ret = getFBInfor(&fb_width, &fb_height, &fb_bpp);
2114 + printf("Can not get fb information. \n");
2118 + memset(&second_layer, 0, sizeof(ScreenLayer));
2124 + second_layer.pPrimary = GetPrimarySLHandle(PRIMARYFBDEV);
2125 + if(second_layer.pPrimary == NULL)
2132 + printf("Should create primary layer firstly. \n");
2137 + alpha_buf_size = 0;
2138 + memset(&alpha_data, 0, sizeof(MethodAlphaData));
2139 + memset(&colorkey_data, 0, sizeof(MethodColorKeyData));
2140 + second_layer.screenRect.left = 0;
2141 + second_layer.screenRect.top = 0;
2142 + second_layer.screenRect.right = fb_width;
2143 + second_layer.screenRect.bottom = fb_height;
2144 + SL_width = second_layer.screenRect.right - second_layer.screenRect.left;
2145 + SL_height = second_layer.screenRect.bottom - second_layer.screenRect.top;
2146 + if (op_type & IC_LOC_PIX_ALP_OV)
2147 + second_layer.fmt = v4l2_fourcc('R', 'G', 'B', 'A');
2148 + else if (op_type & COPY_TV) /* for better performance */
2149 + second_layer.fmt = v4l2_fourcc('U', 'Y', 'V', 'Y');
2151 + second_layer.fmt = v4l2_fourcc('B', 'G', 'R', '3');
2152 + if (op_type & IC_LOC_SEP_ALP_OV)
2153 + second_layer.supportSepLocalAlpha = 1;
2154 + if ((ret = CreateScreenLayer(&second_layer, bufcnt))
2155 + != E_RET_SUCCESS) {
2156 + printf("CreateScreenLayer second layer err %d\n", ret);
2159 + /* set alpha and key color */
2160 + if (op_type & IC_GLB_ALP_OV) {
2161 + alpha_data.globalAlphaEnable = 1;
2162 + alpha_data.alpha = 255;
2163 + } else if (op_type & IC_LOC_SEP_ALP_OV)
2164 + alpha_data.sepLocalAlphaEnable = 1;
2165 + colorkey_data.enable = 0;
2166 + colorkey_data.keyColor = 0;
2167 + if ((ret = SetScreenLayer(&second_layer, E_SET_ALPHA, &alpha_data))
2168 + != E_RET_SUCCESS) {
2169 + printf("SetScreenLayer E_SET_ALPHA for second layer err %d\n", ret);
2172 + if ((ret = SetScreenLayer(&second_layer, E_SET_COLORKEY, &colorkey_data))
2173 + != E_RET_SUCCESS) {
2174 + printf("SetScreenLayer E_SET_COLORKEY for second layer err %d\n", ret);
2178 + if (op_type & COPY_TV) {
2179 + MethodTvoutData tvout;
2180 + tvout.tvMode = TVOUT_NTSC;
2181 + tvout.lcd2tvRotation = 0;
2182 + if ((ret = SetScreenLayer(&second_layer, E_COPY_TVOUT, &tvout))
2183 + != E_RET_SUCCESS) {
2184 + printf("SetScreenLayer E_ENABLE_TVTOU for second layer err %d\n", ret);
2189 + param.srcWidth = 320;
2190 + param.srcHeight = 240;
2191 + param.srcFmt = v4l2_fourcc('I', '4', '2', '0');
2192 + param.srcRect.left = 0;
2193 + param.srcRect.top = 0;
2194 + param.srcRect.right = 320;
2195 + param.srcRect.bottom = 240;
2196 + param.destRect.left = 0;
2197 + param.destRect.top = 0;
2198 + param.destRect.right = second_layer.screenRect.right - second_layer.screenRect.left;
2199 + param.destRect.bottom = second_layer.screenRect.bottom - second_layer.screenRect.top;
2200 + param.destRot = 0;
2202 + /* just add third layer to this screenlayer to show the performance*/
2203 + if (op_type & COPY_TV){
2204 + sec_param.srcWidth = 320;
2205 + sec_param.srcHeight = 240;
2206 + sec_param.srcFmt = v4l2_fourcc('I', '4', '2', '0');
2207 + sec_param.srcRect.left = 0;
2208 + sec_param.srcRect.top = 0;
2209 + sec_param.srcRect.right = 320;
2210 + sec_param.srcRect.bottom = 240;
2211 + sec_param.destRect.left = (second_layer.screenRect.right - second_layer.screenRect.left)/2;
2212 + sec_param.destRect.top = 0;
2213 + sec_param.destRect.right = second_layer.screenRect.right - second_layer.screenRect.left;
2214 + sec_param.destRect.bottom = (second_layer.screenRect.bottom - second_layer.screenRect.top)/2;
2215 + sec_param.destRot = 0;
2218 + buf_size = param.srcWidth * param.srcHeight * 3/2;
2219 + if (op_type & IC_LOC_SEP_ALP_OV)
2220 + alpha_buf_size = SL_width * SL_height;
2221 + ret = dma_memory_alloc(buf_size, bufcnt, paddr_2nd, buf_2nd);
2223 + printf("dma_memory_alloc failed\n");
2227 + for (i=0;i<FRM_CNT;i++) {
2228 + struct timeval frame_begin,frame_end;
2229 + struct timeval load_begin,load_end;
2230 + struct timeval update_begin,update_end;
2236 + param.srcPaddr = paddr_2nd[i%bufcnt];
2237 + gen_fill_pattern(buf_2nd[i%bufcnt], param.srcWidth, param.srcHeight);
2239 + gettimeofday(&frame_begin, NULL);
2240 + gettimeofday(&load_begin, NULL);
2242 + if ((ret = LoadScreenLayer(&second_layer, ¶m, i%bufcnt)) != E_RET_SUCCESS) {
2243 + printf("LoadScreenLayer err %d\n", ret);
2247 + if (op_type & COPY_TV){
2248 + sec_param.srcPaddr = paddr_2nd[i%bufcnt];
2249 + if ((ret = LoadScreenLayer(&second_layer, &sec_param, i%bufcnt)) != E_RET_SUCCESS) {
2250 + printf("LoadScreenLayer sec err %d\n", ret);
2254 + gettimeofday(&load_end, NULL);
2256 + sec = load_end.tv_sec - load_begin.tv_sec;
2257 + usec = load_end.tv_usec - load_begin.tv_usec;
2261 + usec = usec + 1000000;
2263 + load_time += (sec * 1000000) + usec;
2265 + gettimeofday(&frame_end, NULL);
2267 + sec = frame_end.tv_sec - frame_begin.tv_sec;
2268 + usec = frame_end.tv_usec - frame_begin.tv_usec;
2272 + usec = usec + 1000000;
2274 + show_time += (sec * 1000000) + usec;
2276 + /* Fill local alpha buffer */
2277 + if (op_type & IC_LOC_SEP_ALP_OV) {
2278 + gen_fill_alpha_in_separate_buffer(second_layer.bufAlphaVaddr[i%bufcnt], alpha_buf_size, 0x80);
2279 + if (i < FRM_CNT/3) {
2281 + for (x=SL_width/4; x<3*SL_width/4; x++)
2282 + for (y=SL_height/4; y<3*SL_height/4; y++)
2283 + LoadAlphaPoint(&second_layer, x, y, alpha_val, i%bufcnt);
2284 + } else if (i < 2*FRM_CNT/3) {
2286 + for (x=SL_width/4; x<3*SL_width/4; x++)
2287 + for (y=SL_height/4; y<3*SL_height/4; y++)
2288 + LoadAlphaPoint(&second_layer, x, y, alpha_val, i%bufcnt);
2289 + } else if (i < FRM_CNT) {
2291 + for (x=SL_width/4; x<3*SL_width/4; x++)
2292 + for (y=SL_height/4; y<3*SL_height/4; y++)
2293 + LoadAlphaPoint(&second_layer, x, y, alpha_val, i%bufcnt);
2296 + /* Change local alpha value in pixel */
2297 + else if (op_type & IC_LOC_PIX_ALP_OV) {
2298 + gen_fill_alpha_in_pixel(second_layer.bufVaddr[i%bufcnt], second_layer.fmt, second_layer.bufSize, 0x80);
2299 + if (i < FRM_CNT/3) {
2301 + for (x=SL_width/4; x<3*SL_width/4; x++)
2302 + for (y=SL_height/4; y<3*SL_height/4; y++)
2303 + gen_fill_alpha_in_pixel_for_point(second_layer.bufVaddr[i%bufcnt], second_layer.fmt, SL_width, x, y, alpha_val);
2304 + } else if (i < 2*FRM_CNT/3) {
2306 + for (x=SL_width/4; x<3*SL_width/4; x++)
2307 + for (y=SL_height/4; y<3*SL_height/4; y++)
2308 + gen_fill_alpha_in_pixel_for_point(second_layer.bufVaddr[i%bufcnt], second_layer.fmt, SL_width, x, y, alpha_val);
2309 + } else if (i < FRM_CNT) {
2311 + for (x=SL_width/4; x<3*SL_width/4; x++)
2312 + for (y=SL_height/4; y<3*SL_height/4; y++)
2313 + gen_fill_alpha_in_pixel_for_point(second_layer.bufVaddr[i%bufcnt], second_layer.fmt, SL_width, x, y, alpha_val);
2317 + gettimeofday(&frame_begin, NULL);
2318 + gettimeofday(&update_begin, NULL);
2320 + if ((ret = FlipScreenLayerBuf(&second_layer, i%bufcnt)) != E_RET_SUCCESS) {
2321 + printf("FlipScreenLayerBuf err %d\n", ret);
2325 + sem_wait(semIDUnit);
2326 + if (!vshmUnitTest[2]) {
2327 + if ((ret = UpdateScreenLayer(&second_layer)) != E_RET_SUCCESS) {
2328 + printf("UpdateScreenLayer err %d\n",ret);
2332 + sem_post(semIDUnit);
2334 + gettimeofday(&update_end, NULL);
2336 + sec = update_end.tv_sec - update_begin.tv_sec;
2337 + usec = update_end.tv_usec - update_begin.tv_usec;
2341 + usec = usec + 1000000;
2343 + update_time += (sec * 1000000) + usec;
2345 + gettimeofday(&frame_end, NULL);
2347 + sec = frame_end.tv_sec - frame_begin.tv_sec;
2348 + usec = frame_end.tv_usec - frame_begin.tv_usec;
2352 + usec = usec + 1000000;
2354 + show_time += (sec * 1000000) + usec;
2357 + printf("2nd layer load avg frame time %d us\n", load_time/i);
2358 + printf("2nd layer update avg frame time %d us\n", update_time/i);
2359 + printf("2nd layer avg frame time %d us\n", show_time/i);
2362 + dma_memory_free(buf_size, bufcnt, paddr_2nd, buf_2nd);
2364 + DestoryScreenLayer(&second_layer);
2366 + sem_wait(semIDUnit);
2367 + vshmUnitTest[1] = 0;
2368 + sem_post(semIDUnit);
2369 + printf("Second layer has been destroyed! \n");
2373 +void * third_layer_thread_func(void *arg)
2375 + ScreenLayer third_layer;
2377 + dma_addr_t paddr_3th[BUFCNT_3TH];
2378 + void * buf_3th[BUFCNT_3TH];
2379 + MethodAlphaData alpha_data;
2380 + MethodColorKeyData colorkey_data;
2381 + int buf_size, alpha_buf_size, i, ret, x, y, op_type = *((int *)arg);
2382 + int SL_width, SL_height;
2384 + int fb_width, fb_height, fb_bpp;
2385 + int show_time = 0;
2387 + ret = getFBInfor(&fb_width, &fb_height, &fb_bpp);
2390 + printf("Can not get fb information. \n");
2394 + alpha_buf_size = 0;
2395 + memset(&third_layer, 0, sizeof(ScreenLayer));
2396 + memset(&alpha_data, 0, sizeof(MethodAlphaData));
2397 + memset(&colorkey_data, 0, sizeof(MethodColorKeyData));
2398 + third_layer.screenRect.left = fb_width*1/4;
2399 + third_layer.screenRect.top = fb_height*1/4;
2400 + third_layer.screenRect.right = fb_width*3/4;
2401 + third_layer.screenRect.bottom = fb_height*3/4;
2402 + SL_width = third_layer.screenRect.right - third_layer.screenRect.left;
2403 + SL_height = third_layer.screenRect.bottom - third_layer.screenRect.top;
2404 + if (op_type & IC_LOC_PIX_ALP_OV)
2405 + third_layer.fmt = v4l2_fourcc('R', 'G', 'B', 'A');
2407 + third_layer.fmt = v4l2_fourcc('R', 'G', 'B', 'P');
2412 + third_layer.pPrimary = GetPrimarySLHandle(PRIMARYFBDEV);
2413 + if(third_layer.pPrimary == NULL)
2419 + printf("Should create primary layer firstly. \n");
2420 + if (op_type & IC_LOC_SEP_ALP_OV)
2421 + third_layer.supportSepLocalAlpha = 1;
2422 + if ((ret = CreateScreenLayer(&third_layer, BUFCNT_3TH))
2423 + != E_RET_SUCCESS) {
2424 + printf("CreateScreenLayer third layer err %d\n", ret);
2427 + /* set alpha and key color */
2428 + if (op_type & IC_GLB_ALP_OV) {
2429 + alpha_data.globalAlphaEnable = 1;
2430 + alpha_data.alpha = 255;
2431 + } else if (op_type & IC_LOC_SEP_ALP_OV)
2432 + alpha_data.sepLocalAlphaEnable = 1;
2433 + colorkey_data.enable = 0;
2434 + colorkey_data.keyColor = 0;
2435 + if ((ret = SetScreenLayer(&third_layer, E_SET_ALPHA, &alpha_data))
2436 + != E_RET_SUCCESS) {
2437 + printf("SetScreenLayer E_SET_ALPHA for third layer err %d\n", ret);
2440 + if ((ret = SetScreenLayer(&third_layer, E_SET_COLORKEY, &colorkey_data))
2441 + != E_RET_SUCCESS) {
2442 + printf("SetScreenLayer E_SET_COLORKEY for third layer err %d\n", ret);
2446 + param.srcWidth = 320;
2447 + param.srcHeight = 240;
2448 + param.srcFmt = v4l2_fourcc('I', '4', '2', '0');
2449 + param.srcRect.left = 0;
2450 + param.srcRect.top = 0;
2451 + param.srcRect.right = 320;
2452 + param.srcRect.bottom = 240;
2453 + param.destRect.left = 0;
2454 + param.destRect.top = 0;
2455 + param.destRect.right = third_layer.screenRect.right - third_layer.screenRect.left;
2456 + param.destRect.bottom = third_layer.screenRect.bottom - third_layer.screenRect.top;
2457 + param.destRot = 0;
2458 + buf_size = param.srcWidth * param.srcHeight * 3/2;
2459 + if (op_type & IC_LOC_SEP_ALP_OV)
2460 + alpha_buf_size = SL_width * SL_height;
2461 + ret = dma_memory_alloc(buf_size, BUFCNT_3TH, paddr_3th, buf_3th);
2463 + printf("dma_memory_alloc failed\n");
2467 + for (i=0;i<FRM_CNT;i++) {
2468 + struct timeval frame_begin,frame_end;
2474 + param.srcPaddr = paddr_3th[i%BUFCNT_3TH];
2475 + gen_fill_pattern(buf_3th[i%BUFCNT_3TH], param.srcWidth, param.srcHeight);
2477 + gettimeofday(&frame_begin, NULL);
2479 + if ((ret = LoadScreenLayer(&third_layer, ¶m, i%BUFCNT_3TH)) != E_RET_SUCCESS) {
2480 + printf("LoadScreenLayer err %d\n", ret);
2484 + gettimeofday(&frame_end, NULL);
2486 + sec = frame_end.tv_sec - frame_begin.tv_sec;
2487 + usec = frame_end.tv_usec - frame_begin.tv_usec;
2491 + usec = usec + 1000000;
2493 + show_time += (sec * 1000000) + usec;
2495 + /* Fill local alpha buffer */
2496 + if (op_type & IC_LOC_SEP_ALP_OV) {
2498 + gen_fill_alpha_in_separate_buffer(third_layer.bufAlphaVaddr[i%BUFCNT_3TH], alpha_buf_size, 0x80);
2499 + else if(i < 2*FRM_CNT/3)
2500 + gen_fill_alpha_in_separate_buffer(third_layer.bufAlphaVaddr[i%BUFCNT_3TH], alpha_buf_size, 0x00);
2501 + else if(i < FRM_CNT)
2502 + gen_fill_alpha_in_separate_buffer(third_layer.bufAlphaVaddr[i%BUFCNT_3TH], alpha_buf_size, 0xFF);
2504 + /* Change local alpha value in pixel */
2505 + else if (op_type & IC_LOC_PIX_ALP_OV) {
2506 + gen_fill_alpha_in_pixel(third_layer.bufVaddr[i%BUFCNT_3TH], third_layer.fmt, third_layer.bufSize, 0x80);
2507 + if (i < FRM_CNT/3) {
2509 + for (x=SL_width/4; x<3*SL_width/4; x++)
2510 + for (y=SL_height/4; y<3*SL_height/4; y++)
2511 + gen_fill_alpha_in_pixel_for_point(third_layer.bufVaddr[i%BUFCNT_3TH], third_layer.fmt, SL_width, x, y, alpha_val);
2512 + } else if (i < 2*FRM_CNT/3) {
2514 + for (x=SL_width/4; x<3*SL_width/4; x++)
2515 + for (y=SL_height/4; y<3*SL_height/4; y++)
2516 + gen_fill_alpha_in_pixel_for_point(third_layer.bufVaddr[i%BUFCNT_3TH], third_layer.fmt, SL_width, x, y, alpha_val);
2517 + } else if (i < FRM_CNT) {
2519 + for (x=SL_width/4; x<3*SL_width/4; x++)
2520 + for (y=SL_height/4; y<3*SL_height/4; y++)
2521 + gen_fill_alpha_in_pixel_for_point(third_layer.bufVaddr[i%BUFCNT_3TH], third_layer.fmt, SL_width, x, y, alpha_val);
2525 + gettimeofday(&frame_begin, NULL);
2527 + if ((ret = FlipScreenLayerBuf(&third_layer, i%BUFCNT_3TH)) != E_RET_SUCCESS) {
2528 + printf("FlipScreenLayerBuf err %d\n", ret);
2532 + if ((ret = UpdateScreenLayer(&third_layer)) != E_RET_SUCCESS) {
2533 + printf("UpdateScreenLayer err %d\n",ret);
2537 + gettimeofday(&frame_end, NULL);
2539 + sec = frame_end.tv_sec - frame_begin.tv_sec;
2540 + usec = frame_end.tv_usec - frame_begin.tv_usec;
2544 + usec = usec + 1000000;
2546 + show_time += (sec * 1000000) + usec;
2548 + /* screenlayer should not update fast than lcd refresh rate*/
2552 + printf("3rd layer avg frame time %d us\n", show_time/i);
2555 + dma_memory_free(buf_size, BUFCNT_3TH, paddr_3th, buf_3th);
2557 + DestoryScreenLayer(&third_layer);
2559 + sem_wait(semIDUnit);
2560 + vshmUnitTest[2] = 0;
2561 + sem_post(semIDUnit);
2562 + printf("Third layer has been destroyed! \n");
2566 +int screenlayer_test(int three_layer, int op_type)
2568 + pthread_t first_layer_thread;
2569 + pthread_t second_layer_thread;
2570 + pthread_t third_layer_thread;
2573 + struct stat shmStat;
2574 + char shmNameUnit[32]="shm_name_unit_test";
2577 + semIDUnit = sem_open(semNameUnit, O_CREAT, 0666, 1);
2578 + if(SEM_FAILED == semIDUnit){
2579 + printf("can not open the semaphore for SL IPC Unit test!\n");
2584 + shmIDUnit = shm_open(shmNameUnit, O_RDWR|O_CREAT, 0666);
2585 + if(shmIDUnit == -1){
2586 + printf("can not open the shared memory for SL IPC Unit test!\n");
2588 + sem_close(semIDUnit);
2591 + /* Get special size shm */
2592 + ftruncate(shmIDUnit,3 * sizeof(int));
2593 + /* Connect to the shm */
2594 + fstat(shmIDUnit, &shmStat);
2596 + if(vshmUnitTest == NULL)
2597 + vshmUnitTest = (int *)mmap(NULL,shmStat.st_size,PROT_READ|PROT_WRITE,MAP_SHARED,shmIDUnit,0);
2599 + if(vshmUnitTest == MAP_FAILED || vshmUnitTest ==NULL)
2602 + sem_close(semIDUnit);
2603 + shm_unlink(shmNameUnit);
2606 + memset(vshmUnitTest, 0, 3 *sizeof(int));
2608 + /* create first layer */
2609 + printf("Display to primary layer!\n");
2610 + pthread_create(&first_layer_thread, NULL, first_layer_thread_func, NULL);
2612 + /* create second layer */
2613 + printf("Add second layer!\n");
2614 + vshmUnitTest[1] = 1;
2615 + pthread_create(&second_layer_thread, NULL, second_layer_thread_func, &op_type);
2617 + if (three_layer) {
2618 + /* create third layer */
2619 + printf("Add third layer!\n");
2620 + vshmUnitTest[2] = 1;
2621 + pthread_create(&third_layer_thread, NULL, third_layer_thread_func, &op_type);
2624 + while(!ctrl_c_rev)usleep(100000);
2627 + pthread_join(third_layer_thread, NULL);
2628 + pthread_join(second_layer_thread, NULL);
2629 + pthread_join(first_layer_thread, NULL);
2631 + sem_unlink(semNameUnit);
2632 + shm_unlink(shmNameUnit);
2637 +** ProcessA: First_layer & second_layer
2638 +** ProcessB: Third_layer
2640 +int screenlayer_test_ipc(int process_num, int three_layer, int op_type)
2642 + pthread_t first_layer_thread;
2643 + pthread_t second_layer_thread;
2644 + pthread_t third_layer_thread;
2647 + struct stat shmStat;
2648 + char shmNameUnit[32]="shm_name_unit_test";
2651 + semIDUnit = sem_open(semNameUnit, O_CREAT, 0666, 1);
2652 + if(SEM_FAILED == semIDUnit){
2653 + printf("can not open the semaphore for SL IPC Unit test!\n");
2658 + shmIDUnit = shm_open(shmNameUnit, O_RDWR|O_CREAT, 0666);
2659 + if(shmIDUnit == -1){
2660 + printf("can not open the shared memory for SL IPC Unit test!\n");
2662 + sem_close(semIDUnit);
2665 + /* Get special size shm */
2666 + ftruncate(shmIDUnit,3 * sizeof(int));
2667 + /* Connect to the shm */
2668 + fstat(shmIDUnit, &shmStat);
2670 + if(vshmUnitTest == NULL)
2671 + vshmUnitTest = (int *)mmap(NULL,shmStat.st_size,PROT_READ|PROT_WRITE,MAP_SHARED,shmIDUnit,0);
2673 + if(vshmUnitTest == MAP_FAILED || vshmUnitTest ==NULL)
2676 + sem_close(semIDUnit);
2677 + shm_unlink(shmNameUnit);
2680 + memset(vshmUnitTest, 0, 3 *sizeof(int));
2681 + vshmUnitTest[1] = 1;
2683 + /* Two process cases*/
2684 + if(process_num == 2)
2686 + if(three_layer) vshmUnitTest[2] = 1;
2690 + /* create first layer */
2691 + printf("Display to primary layer!\n");
2692 + pthread_create(&first_layer_thread, NULL, first_layer_thread_func, &op_type);
2696 + /* create second layer */
2698 + printf("Add second layer!\n");
2699 + pthread_create(&second_layer_thread, NULL, second_layer_thread_func, &op_type);
2700 + pthread_join(second_layer_thread, NULL);
2703 + pthread_join(first_layer_thread, NULL);
2704 + sem_unlink(semNameUnit);
2705 + shm_unlink(shmNameUnit);
2706 + printf("SL IPC: Process A has been exited. \n");
2713 + /* create third layer */
2714 + printf("Add third layer!\n");
2715 + pthread_create(&third_layer_thread, NULL, third_layer_thread_func, &op_type);
2716 + pthread_join(third_layer_thread, NULL);
2719 + /* create second layer */
2720 + printf("Add second layer(two layers case)!\n");
2721 + pthread_create(&second_layer_thread, NULL, second_layer_thread_func, &op_type);
2722 + pthread_join(second_layer_thread, NULL);
2724 + printf("SL IPC: Process B has been exited. \n");
2726 + sem_unlink(semNameUnit);
2727 + shm_unlink(shmNameUnit);
2729 + }else if(process_num ==3)
2731 + vshmUnitTest[2] = 1;
2735 + /* create first layer */
2736 + printf("Display to primary layer!\n");
2737 + pthread_create(&first_layer_thread, NULL, first_layer_thread_func, NULL);
2738 + pthread_join(first_layer_thread, NULL);
2739 + sem_unlink(semNameUnit);
2740 + shm_unlink(shmNameUnit);
2741 + printf("SL IPC: Process A has been exited. \n");
2747 + /* create second layer */
2749 + printf("Add second layer!\n");
2750 + pthread_create(&second_layer_thread, NULL, second_layer_thread_func, &op_type);
2751 + pthread_join(second_layer_thread, NULL);
2752 + sem_unlink(semNameUnit);
2753 + shm_unlink(shmNameUnit);
2754 + printf("SL IPC: Process B has been exited. \n");
2760 + /* create third layer */
2762 + printf("Add third layer!\n");
2763 + pthread_create(&third_layer_thread, NULL, third_layer_thread_func, &op_type);
2764 + pthread_join(third_layer_thread, NULL);
2765 + sem_unlink(semNameUnit);
2766 + shm_unlink(shmNameUnit);
2767 + printf("SL IPC: Process C has been exited. \n");
2779 +int run_test_pattern(int pattern, ipu_test_handle_t * test_handle)
2781 + if (pattern == 1) {
2782 + printf("Color bar test with full-screen:\n");
2783 + return color_bar(NO_OV, test_handle);
2785 + if (pattern == 2) {
2786 + printf("Hopping block test:\n");
2787 + return hop_block(test_handle);
2789 + if (pattern == 3) {
2793 + pthread_t thread1;
2794 + pthread_t thread2;
2796 + printf("Hopping block + color bar thread test:\n");
2798 + pthread_create(&thread2, NULL, thread_func_hop_block, test_handle);
2799 + pthread_create(&thread1, NULL, thread_func_color_bar, NULL);
2802 + pthread_join(thread1, (void*)(&ret1));
2803 + pthread_join(thread2, (void*)(&ret2));
2804 + printf("Hopping block + color bar threads has joied:\n");
2805 + if(ret1==0 && ret2==0)
2811 + if (pattern == 4) {
2812 + printf("Color bar IC global alpha overlay test:\n");
2813 + return color_bar(IC_GLB_ALP_OV, test_handle);
2815 + if (pattern == 5) {
2816 + printf("Color bar IC separate local alpha overlay test:\n");
2817 + return color_bar(IC_LOC_SEP_ALP_OV, test_handle);
2819 + if (pattern == 6) {
2820 + printf("Color bar IC local alpha within pixel overlay test:\n");
2821 + return color_bar(IC_LOC_PIX_ALP_OV, test_handle);
2823 + if (pattern == 7) {
2824 + printf("Copy test:\n");
2825 + return copy_test(test_handle);
2827 +#ifndef BUILD_FOR_ANDROID
2828 + if (pattern == 8) {
2829 + printf("Screen layer with 2 layers test using IC global alpha blending:\n");
2830 + return screenlayer_test(0, IC_GLB_ALP_OV);
2832 + if (pattern == 9) {
2833 + printf("Screen layer with 3 layers test using IC global alpha blending:\n");
2834 + return screenlayer_test(1, IC_GLB_ALP_OV);
2836 + if (pattern == 10) {
2837 + printf("Screen layer with 2 layers test using IC local alpha blending with alpha value in separate buffer:\n");
2838 + return screenlayer_test(0, IC_LOC_SEP_ALP_OV);
2840 + if (pattern == 11) {
2841 + printf("Screen layer with 3 layers test using IC local alpha blending with alpha value in separate buffer:\n");
2842 + return screenlayer_test(1, IC_LOC_SEP_ALP_OV);
2844 + if (pattern == 12) {
2845 + printf("Screen layer with 2 layers test using IC local alpha blending with alpha value in pixel:\n");
2846 + return screenlayer_test(0, IC_LOC_PIX_ALP_OV);
2848 + if (pattern == 13) {
2849 + printf("Screen layer with 3 layers test using IC local alpha blending with alpha value in pixel:\n");
2850 + return screenlayer_test(1, IC_LOC_PIX_ALP_OV);
2852 + if (pattern == 14){
2853 + printf("Screen layer IPC(global alpha): ProcessA(first_layer ) ProcessB(second_layer):\n");
2854 + return screenlayer_test_ipc(2, 0, IC_GLB_ALP_OV);
2856 + if (pattern == 15){
2857 + printf("Screen layer IPC(local alpha): ProcessA(first_layer ) ProcessB(second_layer):\n");
2858 + return screenlayer_test_ipc(2, 0, IC_LOC_SEP_ALP_OV);
2860 + if (pattern == 16){
2861 + printf("Screen layer IPC(global alpha): ProcessA(first_layer + second_layer) ProcessB(third_layer):\n");
2862 + return screenlayer_test_ipc(2, 1, IC_GLB_ALP_OV);
2864 + if (pattern == 17){
2865 + printf("Screen layer IPC(local alpha): ProcessA(first_layer + second_layer) ProcessB(third_layer):\n");
2866 + return screenlayer_test_ipc(2, 1, IC_LOC_SEP_ALP_OV);
2868 + if (pattern == 18){
2869 + printf("Screen layer IPC(local alpha): ProcessA(first_layer) ProcessB(second_layer) ProcessC(third_layer):\n");
2870 + return screenlayer_test_ipc(3, 1, IC_LOC_SEP_ALP_OV);
2872 + if (pattern == 19){
2873 + printf("[No mandatory test]Screen layer IPC(local alpha + tvout): ProcessA(first_layer) ProcessB(second_layer):\n");
2874 + return screenlayer_test_ipc(2, 0, IC_LOC_SEP_ALP_OV | COPY_TV);
2878 + printf("No such test pattern %d\n", pattern);
2881 diff --git a/test/mxc_ipudev_test/utils.c b/test/mxc_ipudev_test/utils.c
2882 index 3c8e11e..504c2af 100644
2883 --- a/test/mxc_ipudev_test/utils.c
2884 +++ b/test/mxc_ipudev_test/utils.c
2885 @@ -51,44 +51,17 @@ char * skip_unwanted(char *ptr)
2887 int parse_options(char *buf, ipu_test_handle_t *test_handle)
2889 - struct ipu_task *t = &test_handle->task;
2893 - str = strstr(buf, "priority");
2894 + str = strstr(buf, "mode");
2896 str = index(buf, '=');
2900 - t->priority = strtol(str, NULL, 10);
2901 - printf("priority\t= %d\n", t->priority);
2907 - str = strstr(buf, "task_id");
2908 - if (str != NULL) {
2909 - str = index(buf, '=');
2910 - if (str != NULL) {
2912 - if (*str != '\0') {
2913 - t->task_id = strtol(str, NULL, 10);
2914 - printf("task_id\t\t= %d\n", t->task_id);
2920 - str = strstr(buf, "timeout");
2921 - if (str != NULL) {
2922 - str = index(buf, '=');
2923 - if (str != NULL) {
2925 - if (*str != '\0') {
2926 - t->timeout = strtol(str, NULL, 10);
2927 - printf("timeout\t\t= %d\n", t->timeout);
2928 + test_handle->mode = strtol(str, NULL, 16);
2929 + printf("mode\t\t= 0x%x\n", test_handle->mode);
2933 @@ -127,8 +100,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
2937 - t->input.width = strtol(str, NULL, 10);
2938 - printf("in_width\t= %d\n", t->input.width);
2939 + test_handle->input.width = strtol(str, NULL, 10);
2940 + printf("in_width\t= %d\n", test_handle->input.width);
2944 @@ -140,8 +113,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
2948 - t->input.height = strtol(str, NULL, 10);
2949 - printf("in_height\t= %d\n", t->input.height);
2950 + test_handle->input.height = strtol(str, NULL, 10);
2951 + printf("in_height\t= %d\n", test_handle->input.height);
2955 @@ -153,7 +126,7 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
2960 + test_handle->input.fmt =
2961 v4l2_fourcc(str[0], str[1], str[2], str[3]);
2962 printf("in_fmt\t\t= %s\n", str);
2964 @@ -167,10 +140,10 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
2968 - t->input.crop.pos.x =
2969 + test_handle->input.input_crop_win.pos.x =
2970 strtol(str, NULL, 10);
2971 printf("in_posx\t\t= %d\n",
2972 - t->input.crop.pos.x);
2973 + test_handle->input.input_crop_win.pos.x);
2977 @@ -182,55 +155,40 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
2981 - t->input.crop.pos.y =
2982 + test_handle->input.input_crop_win.pos.y =
2983 strtol(str, NULL, 10);
2984 printf("in_posy\t\t= %d\n",
2985 - t->input.crop.pos.y);
2986 + test_handle->input.input_crop_win.pos.y);
2992 - str = strstr(buf, "in_crop_w");
2993 + str = strstr(buf, "in_win_w");
2995 str = index(buf, '=');
3000 + test_handle->input.input_crop_win.win_w =
3001 strtol(str, NULL, 10);
3002 - printf("in_crop_w\t= %d\n",
3004 + printf("in_win_w\t= %d\n",
3005 + test_handle->input.input_crop_win.win_w);
3011 - str = strstr(buf, "in_crop_h");
3012 + str = strstr(buf, "in_win_h");
3014 str = index(buf, '=');
3019 + test_handle->input.input_crop_win.win_h =
3020 strtol(str, NULL, 10);
3021 - printf("in_crop_h\t= %d\n",
3028 - str = strstr(buf, "deinterlace_en");
3029 - if (str != NULL) {
3030 - str = index(buf, '=');
3031 - if (str != NULL) {
3033 - if (*str != '\0') {
3034 - t->input.deinterlace.enable =
3035 - strtol(str, NULL, 10);
3036 - printf("deinterlace_en\t= %d\n",
3037 - t->input.deinterlace.enable);
3038 + printf("in_win_h\t= %d\n",
3039 + test_handle->input.input_crop_win.win_h);
3043 @@ -242,184 +200,10 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
3047 - t->input.deinterlace.motion =
3048 + test_handle->input.motion_sel =
3049 strtol(str, NULL, 10);
3050 printf("motion_sel\t= %d\n",
3051 - t->input.deinterlace.motion);
3058 - str = strstr(buf, "overlay_en");
3059 - if (str != NULL) {
3060 - str = index(buf, '=');
3061 - if (str != NULL) {
3063 - if (*str != '\0') {
3064 - t->overlay_en = strtol(str, NULL, 10);
3065 - printf("overlay_en\t= %d\n", t->overlay_en);
3071 - str = strstr(buf, "ov_width");
3072 - if (str != NULL) {
3073 - str = index(buf, '=');
3074 - if (str != NULL) {
3076 - if (*str != '\0') {
3077 - t->overlay.width = strtol(str, NULL, 10);
3078 - printf("ov_width\t= %d\n", t->overlay.width);
3084 - str = strstr(buf, "ov_height");
3085 - if (str != NULL) {
3086 - str = index(buf, '=');
3087 - if (str != NULL) {
3089 - if (*str != '\0') {
3090 - t->overlay.height = strtol(str, NULL, 10);
3091 - printf("ov_height\t= %d\n", t->overlay.height);
3097 - str = strstr(buf, "ov_fmt");
3098 - if (str != NULL) {
3099 - str = index(buf, '=');
3100 - if (str != NULL) {
3102 - if (*str != '\0') {
3103 - t->overlay.format =
3104 - v4l2_fourcc(str[0], str[1], str[2], str[3]);
3105 - printf("ov_fmt\t\t= %s\n", str);
3111 - str = strstr(buf, "ov_posx");
3112 - if (str != NULL) {
3113 - str = index(buf, '=');
3114 - if (str != NULL) {
3116 - if (*str != '\0') {
3117 - t->overlay.crop.pos.x =
3118 - strtol(str, NULL, 10);
3119 - printf("ov_posx\t\t= %d\n",
3120 - t->overlay.crop.pos.x);
3126 - str = strstr(buf, "ov_posy");
3127 - if (str != NULL) {
3128 - str = index(buf, '=');
3129 - if (str != NULL) {
3131 - if (*str != '\0') {
3132 - t->overlay.crop.pos.y =
3133 - strtol(str, NULL, 10);
3134 - printf("ov_posy\t\t= %d\n",
3135 - t->overlay.crop.pos.y);
3141 - str = strstr(buf, "ov_crop_w");
3142 - if (str != NULL) {
3143 - str = index(buf, '=');
3144 - if (str != NULL) {
3146 - if (*str != '\0') {
3147 - t->overlay.crop.w =
3148 - strtol(str, NULL, 10);
3149 - printf("ov_crop_w\t= %d\n",
3150 - t->overlay.crop.w);
3156 - str = strstr(buf, "ov_crop_h");
3157 - if (str != NULL) {
3158 - str = index(buf, '=');
3159 - if (str != NULL) {
3161 - if (*str != '\0') {
3162 - t->overlay.crop.h =
3163 - strtol(str, NULL, 10);
3164 - printf("ov_crop_h\t= %d\n",
3165 - t->overlay.crop.h);
3171 - str = strstr(buf, "alpha_mode");
3172 - if (str != NULL) {
3173 - str = index(buf, '=');
3174 - if (str != NULL) {
3176 - if (*str != '\0') {
3177 - t->overlay.alpha.mode =
3178 - strtol(str, NULL, 10);
3179 - printf("alpha_mode\t= %d\n",
3180 - t->overlay.alpha.mode);
3186 - str = strstr(buf, "alpha_value");
3187 - if (str != NULL) {
3188 - str = index(buf, '=');
3189 - if (str != NULL) {
3191 - if (*str != '\0') {
3192 - t->overlay.alpha.gvalue =
3193 - strtol(str, NULL, 10);
3194 - printf("alpha_value\t= %d\n",
3195 - t->overlay.alpha.gvalue);
3201 - str = strstr(buf, "colorkey_en");
3202 - if (str != NULL) {
3203 - str = index(buf, '=');
3204 - if (str != NULL) {
3206 - if (*str != '\0') {
3207 - t->overlay.colorkey.enable =
3208 - strtol(str, NULL, 10);
3209 - printf("colorkey_en\t= %d\n",
3210 - t->overlay.colorkey.enable);
3216 - str = strstr(buf, "colorkey_value");
3217 - if (str != NULL) {
3218 - str = index(buf, '=');
3219 - if (str != NULL) {
3221 - if (*str != '\0') {
3222 - t->overlay.colorkey.value =
3223 - strtol(str, NULL, 16);
3224 - printf("colorkey_value\t= 0x%x\n",
3225 - t->overlay.colorkey.value);
3226 + test_handle->input.motion_sel);
3230 @@ -432,8 +216,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
3234 - t->output.width = strtol(str, NULL, 10);
3235 - printf("out_width\t= %d\n", t->output.width);
3236 + test_handle->output.width = strtol(str, NULL, 10);
3237 + printf("out_width\t= %d\n", test_handle->output.width);
3241 @@ -445,8 +229,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
3245 - t->output.height = strtol(str, NULL, 10);
3246 - printf("out_height\t= %d\n", t->output.height);
3247 + test_handle->output.height = strtol(str, NULL, 10);
3248 + printf("out_height\t= %d\n", test_handle->output.height);
3252 @@ -458,7 +242,7 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
3256 - t->output.format =
3257 + test_handle->output.fmt =
3258 v4l2_fourcc(str[0], str[1], str[2], str[3]);
3259 printf("out_fmt\t\t= %s\n", str);
3261 @@ -472,77 +256,60 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle)
3265 - t->output.rotate = strtol(str, NULL, 10);
3266 - printf("out_rot\t\t= %d\n", t->output.rotate);
3272 - str = strstr(buf, "out_posx");
3273 - if (str != NULL) {
3274 - str = index(buf, '=');
3275 - if (str != NULL) {
3277 - if (*str != '\0') {
3278 - t->output.crop.pos.x = strtol(str, NULL, 10);
3279 - printf("out_posx\t= %d\n", t->output.crop.pos.x);
3280 + test_handle->output.rot = strtol(str, NULL, 10);
3281 + printf("out_rot\t\t= %d\n", test_handle->output.rot);
3287 - str = strstr(buf, "out_posy");
3288 + str = strstr(buf, "out_to_fb");
3290 str = index(buf, '=');
3294 - t->output.crop.pos.y = strtol(str, NULL, 10);
3295 - printf("out_posy\t= %d\n", t->output.crop.pos.y);
3296 + test_handle->output.show_to_fb = strtol(str, NULL, 10);
3297 + printf("out_to_fb\t= %d\n", test_handle->output.show_to_fb);
3303 - str = strstr(buf, "out_crop_w");
3304 + str = strstr(buf, "out_fb_num");
3306 str = index(buf, '=');
3310 - t->output.crop.w =
3311 - strtol(str, NULL, 10);
3312 - printf("out_crop_w\t= %d\n",
3313 - t->output.crop.w);
3314 + test_handle->output.fb_disp.fb_num = strtol(str, NULL, 10);
3315 + printf("out_fb_num\t= %d\n", test_handle->output.fb_disp.fb_num);
3321 - str = strstr(buf, "out_crop_h");
3322 + str = strstr(buf, "out_posx");
3324 str = index(buf, '=');
3328 - t->output.crop.h =
3329 - strtol(str, NULL, 10);
3330 - printf("out_crop_h\t= %d\n",
3331 - t->output.crop.h);
3332 + test_handle->output.fb_disp.pos.x = strtol(str, NULL, 10);
3333 + printf("out_posx\t= %d\n", test_handle->output.fb_disp.pos.x);
3339 - str = strstr(buf, "out_to_fb");
3340 + str = strstr(buf, "out_posy");
3342 str = index(buf, '=');
3346 - test_handle->show_to_fb = strtol(str, NULL, 10);
3347 - printf("out_to_fb\t= %d\n", test_handle->show_to_fb);
3348 + test_handle->output.fb_disp.pos.y = strtol(str, NULL, 10);
3349 + printf("out_posy\t= %d\n", test_handle->output.fb_disp.pos.y);