diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2013-12-16 11:11:16 -0600 |
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2014-03-05 13:32:11 -0300 |
| commit | 7c1f018047cc125b539fa21e5f8d6c4e949b6d86 (patch) | |
| tree | 13e0639687346f6c3dfec6c54423b07cc958152f | |
| parent | 73f7d9167c32f0014d625025b1f9f665ff548397 (diff) | |
| download | meta-freescale-7c1f018047cc125b539fa21e5f8d6c4e949b6d86.tar.gz | |
imx-test: Unify package used by MX23, MX28, MX5 and MX6
Change-Id: Ic898b2562b08272ce6934321ed36ad9cf0a38c05
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
8 files changed, 36 insertions, 3470 deletions
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test.inc b/meta-fsl-arm/recipes-bsp/imx-test/imx-test.inc index 78e14d870..5dce80668 100644 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test.inc +++ b/meta-fsl-arm/recipes-bsp/imx-test/imx-test.inc | |||
| @@ -11,7 +11,7 @@ DEPENDS_mxs = "virtual/kernel" | |||
| 11 | LICENSE = "GPLv2" | 11 | LICENSE = "GPLv2" |
| 12 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" | 12 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" |
| 13 | 13 | ||
| 14 | INC_PR = "r7" | 14 | PE = "1" |
| 15 | 15 | ||
| 16 | PLATFORM_mx6 = "IMX6Q" | 16 | PLATFORM_mx6 = "IMX6Q" |
| 17 | PLATFORM_mx6sl = "IMX6S" | 17 | PLATFORM_mx6sl = "IMX6S" |
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0001-ENGR00158471-fix-ipu-unit-test-application-missing-i.patch b/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0001-ENGR00158471-fix-ipu-unit-test-application-missing-i.patch deleted file mode 100644 index 31e8b269b..000000000 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0001-ENGR00158471-fix-ipu-unit-test-application-missing-i.patch +++ /dev/null | |||
| @@ -1,3355 +0,0 @@ | |||
| 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 | ||
| 5 | |||
| 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 | ||
| 10 | |||
| 11 | Signed-off-by: Lily Zhang <r58066@freescale.com> | ||
| 12 | |||
| 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 | ||
| 17 | @@ -1,8 +1,8 @@ | ||
| 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 | ||
| 21 | |||
| 22 | -SRCS = mxc_ipudev_test.c utils.c | ||
| 23 | -CFLAGS += -lm -lrt | ||
| 24 | +SRCS = mxc_ipudev_test.c utils.c test_pattern.c | ||
| 25 | +CFLAGS += -lipu -lIpuScreenLayer -lm -lrt | ||
| 26 | |||
| 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 | ||
| 33 | @@ -27,35 +27,22 @@ | ||
| 34 | # IPU_ROTATE_90_RIGHT_HFLIP = 6, | ||
| 35 | # IPU_ROTATE_90_LEFT = 7, | ||
| 36 | # | ||
| 37 | -# priority ref: | ||
| 38 | -# IPU_TASK_PRIORITY_NORMAL = 0 | ||
| 39 | -# IPU_TASK_PRIORITY_HIGH = 1 | ||
| 40 | +# mode ref: | ||
| 41 | +# TASK_ENC = 0x1 | ||
| 42 | +# TASK_VF = 0x2 | ||
| 43 | +# TASK_PP = 0x4 | ||
| 44 | +# TASK_VDI_VF = 0x8 | ||
| 45 | +# NORMAL_MODE = 0x10 | ||
| 46 | +# STREAM_MODE = 0x20 | ||
| 47 | # | ||
| 48 | -# task_id ref: | ||
| 49 | -# IPU_TASK_ID_ANY = 0 | ||
| 50 | -# IPU_TASK_ID_VF = 1 | ||
| 51 | -# IPU_TASK_ID_PP = 2 | ||
| 52 | -# | ||
| 53 | -# timeout: ms | ||
| 54 | -# | ||
| 55 | -# de-interlace motion ref: | ||
| 56 | +# video de-interlace motion ref: | ||
| 57 | # MEDIUM_MOTION = 0 | ||
| 58 | # LOW_MOTION = 1 | ||
| 59 | # HIGH_MOTION = 2 | ||
| 60 | # | ||
| 61 | -# overlay alpha mode ref: | ||
| 62 | -# IPU_ALPHA_MODE_GLOBAL = 0 | ||
| 63 | -# IPU_ALPHA_MODE_LOCAL = 1 | ||
| 64 | -# | ||
| 65 | - | ||
| 66 | -#### priority | ||
| 67 | -priority=0 | ||
| 68 | - | ||
| 69 | -#### task_id | ||
| 70 | -task_id=0 | ||
| 71 | |||
| 72 | -#### timeout | ||
| 73 | -timeout=1000 | ||
| 74 | +#### mode | ||
| 75 | +mode=0x24 | ||
| 76 | |||
| 77 | #### operation frame count | ||
| 78 | fcount=50 | ||
| 79 | @@ -70,45 +57,20 @@ in_fmt=I420 | ||
| 80 | #input crop | ||
| 81 | in_posx=0 | ||
| 82 | in_posy=0 | ||
| 83 | -in_crop_w=0 | ||
| 84 | -in_crop_h=0 | ||
| 85 | -#deinterlace | ||
| 86 | -deinterlace_en=0 | ||
| 87 | +in_win_w=0 | ||
| 88 | +in_win_h=0 | ||
| 89 | +#input motion(video de-interlace) | ||
| 90 | motion_sel=0 | ||
| 91 | |||
| 92 | -#### overlay | ||
| 93 | -overlay_en=0 | ||
| 94 | -ov_width=320 | ||
| 95 | -ov_height=240 | ||
| 96 | -ov_fmt=I420 | ||
| 97 | -#overlay crop | ||
| 98 | -ov_posx=0 | ||
| 99 | -ov_posy=0 | ||
| 100 | -ov_crop_w=0 | ||
| 101 | -ov_crop_h=0 | ||
| 102 | -#overlay alpha | ||
| 103 | -alpha_mode=0 | ||
| 104 | -alpha_value=0 | ||
| 105 | -#overlay colorkey | ||
| 106 | -colorkey_en=0 | ||
| 107 | -colorkey_value=0x555555 | ||
| 108 | - | ||
| 109 | #### output | ||
| 110 | out_width=1024 | ||
| 111 | out_height=768 | ||
| 112 | out_fmt=UYVY | ||
| 113 | out_rot=0 | ||
| 114 | -#output crop | ||
| 115 | +#output to framebuffer | ||
| 116 | +out_to_fb=1 | ||
| 117 | +out_fb_num=2 | ||
| 118 | out_posx=0 | ||
| 119 | out_posy=0 | ||
| 120 | -out_crop_w=0 | ||
| 121 | -out_crop_h=0 | ||
| 122 | - | ||
| 123 | -#output target | ||
| 124 | -out_to_fb=1 | ||
| 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 | ||
| 131 | +#output to file | ||
| 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 @@ | ||
| 138 | */ | ||
| 139 | |||
| 140 | #include <stdio.h> | ||
| 141 | -#include <fcntl.h> | ||
| 142 | #include <stdlib.h> | ||
| 143 | -#include <stdint.h> | ||
| 144 | +#include <errno.h> | ||
| 145 | #include <unistd.h> | ||
| 146 | +#include <fcntl.h> | ||
| 147 | +#include <stdint.h> | ||
| 148 | #include <string.h> | ||
| 149 | #include <signal.h> | ||
| 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" | ||
| 156 | |||
| 157 | -#define FB_BUFS 3 | ||
| 158 | int ctrl_c_rev = 0; | ||
| 159 | + | ||
| 160 | void ctrl_c_handler(int signum, siginfo_t *info, void *myact) | ||
| 161 | { | ||
| 162 | ctrl_c_rev = 1; | ||
| 163 | } | ||
| 164 | |||
| 165 | -int process_cmdline(int argc, char **argv, ipu_test_handle_t *test_handle) | ||
| 166 | +void output_to_file_cb(void * arg, int index) | ||
| 167 | +{ | ||
| 168 | + ipu_test_handle_t * test_handle = (ipu_test_handle_t *)arg; | ||
| 169 | + | ||
| 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"); | ||
| 175 | + } | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +int process_cmdline(int argc, char **argv, ipu_test_handle_t * test_handle) | ||
| 179 | { | ||
| 180 | int i; | ||
| 181 | - struct ipu_task *t = &test_handle->task; | ||
| 182 | |||
| 183 | if (argc == 1) | ||
| 184 | return -1; | ||
| 185 | |||
| 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]); | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + if (test_handle->test_pattern) | ||
| 206 | + return 0; | ||
| 207 | + if (test_handle->query_task || test_handle->kill_task) | ||
| 208 | + return 0; | ||
| 209 | |||
| 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)) | ||
| 217 | return -1; | ||
| 218 | |||
| 219 | return 0; | ||
| 220 | } | ||
| 221 | |||
| 222 | -static unsigned int fmt_to_bpp(unsigned int pixelformat) | ||
| 223 | +int query_ipu_task(void) | ||
| 224 | { | ||
| 225 | - unsigned int bpp; | ||
| 226 | - | ||
| 227 | - switch (pixelformat) | ||
| 228 | - { | ||
| 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: | ||
| 236 | - bpp = 16; | ||
| 237 | - break; | ||
| 238 | - case IPU_PIX_FMT_BGR24: | ||
| 239 | - case IPU_PIX_FMT_RGB24: | ||
| 240 | - case IPU_PIX_FMT_YUV444: | ||
| 241 | - bpp = 24; | ||
| 242 | - break; | ||
| 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: | ||
| 248 | - bpp = 32; | ||
| 249 | - break; | ||
| 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: | ||
| 255 | - bpp = 12; | ||
| 256 | - break; | ||
| 257 | - default: | ||
| 258 | - bpp = 8; | ||
| 259 | - break; | ||
| 260 | - } | ||
| 261 | - return bpp; | ||
| 262 | + int i; | ||
| 263 | + ipu_lib_ctl_task_t task; | ||
| 264 | + | ||
| 265 | + for (i = 0; i< MAX_TASK_NUM; i++) { | ||
| 266 | + task.index = 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"); | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + return 0; | ||
| 290 | } | ||
| 291 | |||
| 292 | -static void dump_ipu_task(struct ipu_task *t) | ||
| 293 | +int kill_ipu_task(int index) | ||
| 294 | { | ||
| 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"); | ||
| 308 | - else | ||
| 309 | - printf("\thigh motion\n"); | ||
| 310 | - } | ||
| 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"); | ||
| 331 | - else | ||
| 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); | ||
| 335 | - } | ||
| 336 | + ipu_lib_ctl_task_t task; | ||
| 337 | + | ||
| 338 | + task.index = index; | ||
| 339 | + mxc_ipu_lib_task_control(IPU_CTL_TASK_KILL, (void *)(&task), NULL); | ||
| 340 | + | ||
| 341 | + return 0; | ||
| 342 | } | ||
| 343 | |||
| 344 | int main(int argc, char *argv[]) | ||
| 345 | { | ||
| 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; | ||
| 368 | - int blank; | ||
| 369 | + | ||
| 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; | ||
| 375 | |||
| 376 | /*for ctrl-c*/ | ||
| 377 | sigemptyset(&act.sa_mask); | ||
| 378 | @@ -177,270 +153,127 @@ int main(int argc, char *argv[]) | ||
| 379 | |||
| 380 | if((ret = sigaction(SIGINT, &act, NULL)) < 0) { | ||
| 381 | printf("install sigal error\n"); | ||
| 382 | - return ret; | ||
| 383 | + goto done; | ||
| 384 | } | ||
| 385 | |||
| 386 | - memset(&test_handle, 0, sizeof(ipu_test_handle_t)); | ||
| 387 | - | ||
| 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", | ||
| 391 | - argv[0]); | ||
| 392 | + "Usage: %s\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" \ | ||
| 398 | + "-Q\n\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"); | ||
| 421 | return -1; | ||
| 422 | } | ||
| 423 | |||
| 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]); | ||
| 427 | - ret = -1; | ||
| 428 | - goto err0; | ||
| 429 | - } | ||
| 430 | - | ||
| 431 | - fd_ipu = open("/dev/mxc_ipu", O_RDWR, 0); | ||
| 432 | - if (fd_ipu < 0) { | ||
| 433 | - printf("open ipu dev fail\n"); | ||
| 434 | - ret = -1; | ||
| 435 | - goto err1; | ||
| 436 | - } | ||
| 437 | - | ||
| 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); | ||
| 442 | - if (ret < 0) { | ||
| 443 | - printf("ioctl IPU_ALLOC fail\n"); | ||
| 444 | - goto err2; | ||
| 445 | - } | ||
| 446 | - inbuf = mmap(0, isize, PROT_READ | PROT_WRITE, | ||
| 447 | - MAP_SHARED, fd_ipu, t->input.paddr); | ||
| 448 | - if (!inbuf) { | ||
| 449 | - printf("mmap fail\n"); | ||
| 450 | - ret = -1; | ||
| 451 | - goto err3; | ||
| 452 | - } | ||
| 453 | + system("echo 0,0 > /sys/class/graphics/fb0/pan"); | ||
| 454 | |||
| 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); | ||
| 459 | - if (ret < 0) { | ||
| 460 | - printf("ioctl IPU_ALLOC fail\n"); | ||
| 461 | - goto err4; | ||
| 462 | - } | ||
| 463 | - vdibuf = mmap(0, isize, PROT_READ | PROT_WRITE, | ||
| 464 | - MAP_SHARED, fd_ipu, t->input.paddr_n); | ||
| 465 | - if (!vdibuf) { | ||
| 466 | - printf("mmap fail\n"); | ||
| 467 | - ret = -1; | ||
| 468 | - goto err5; | ||
| 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"); | ||
| 472 | + return ret; | ||
| 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); | ||
| 478 | + else { | ||
| 479 | + printf("Pls set input file\n"); | ||
| 480 | + return -1; | ||
| 481 | } | ||
| 482 | } | ||
| 483 | |||
| 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); | ||
| 489 | - if (ret < 0) { | ||
| 490 | - printf("ioctl IPU_ALLOC fail\n"); | ||
| 491 | - goto err6; | ||
| 492 | - } | ||
| 493 | - ovbuf = mmap(0, ovsize, PROT_READ | PROT_WRITE, | ||
| 494 | - MAP_SHARED, fd_ipu, t->overlay.paddr); | ||
| 495 | - if (!ovbuf) { | ||
| 496 | - printf("mmap fail\n"); | ||
| 497 | - ret = -1; | ||
| 498 | - goto err7; | ||
| 499 | - } | ||
| 500 | - | ||
| 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); | ||
| 506 | - | ||
| 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); | ||
| 511 | - if (ret < 0) { | ||
| 512 | - printf("ioctl IPU_ALLOC fail\n"); | ||
| 513 | - goto err8; | ||
| 514 | - } | ||
| 515 | - alpbuf = mmap(0, alpsize, PROT_READ | PROT_WRITE, | ||
| 516 | - MAP_SHARED, fd_ipu, t->overlay.alpha.loc_alp_paddr); | ||
| 517 | - if (!alpbuf) { | ||
| 518 | - printf("mmap fail\n"); | ||
| 519 | - ret = -1; | ||
| 520 | - goto err9; | ||
| 521 | - } | ||
| 522 | - | ||
| 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; | ||
| 532 | } | ||
| 533 | } | ||
| 534 | |||
| 535 | - if (test_handle.show_to_fb) { | ||
| 536 | - int found = 0, i; | ||
| 537 | - char fb_dev[] = "/dev/fb0"; | ||
| 538 | - char fb_name[16]; | ||
| 539 | - | ||
| 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); | ||
| 548 | - | ||
| 549 | - for (i=0; i<5; i++) { | ||
| 550 | - fb_dev[7] = '0'; | ||
| 551 | - fb_dev[7] += i; | ||
| 552 | - fd_fb = open(fb_dev, O_RDWR, 0); | ||
| 553 | - if (fd_fb > 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); | ||
| 557 | - found = 1; | ||
| 558 | - break; | ||
| 559 | - } else | ||
| 560 | - close(fd_fb); | ||
| 561 | - } | ||
| 562 | - } | ||
| 563 | - | ||
| 564 | - if (!found) { | ||
| 565 | - printf("can not find fb dev %s\n", fb_name); | ||
| 566 | - ret = -1; | ||
| 567 | - goto err10; | ||
| 568 | - } | ||
| 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]); | ||
| 572 | + return -1; | ||
| 573 | + } | ||
| 574 | |||
| 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); | ||
| 583 | - | ||
| 584 | - ret = ioctl(fd_fb, FBIOPUT_VSCREENINFO, &fb_var); | ||
| 585 | - if (ret < 0) { | ||
| 586 | - printf("fb ioctl FBIOPUT_VSCREENINFO fail\n"); | ||
| 587 | - goto err11; | ||
| 588 | - } | ||
| 589 | - ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var); | ||
| 590 | - ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix); | ||
| 591 | - | ||
| 592 | - for (i=0; i<FB_BUFS; i++) | ||
| 593 | - outpaddr[i] = fb_fix.smem_start + | ||
| 594 | - i * fb_var.yres * fb_fix.line_length; | ||
| 595 | - | ||
| 596 | - blank = FB_BLANK_UNBLANK; | ||
| 597 | - ioctl(fd_fb, FBIOBLANK, blank); | ||
| 598 | - } else { | ||
| 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); | ||
| 603 | - if (ret < 0) { | ||
| 604 | - printf("ioctl IPU_ALLOC fail\n"); | ||
| 605 | - goto err10; | ||
| 606 | - } | ||
| 607 | - outbuf = mmap(0, osize, PROT_READ | PROT_WRITE, | ||
| 608 | - MAP_SHARED, fd_ipu, t->output.paddr); | ||
| 609 | - if (!outbuf) { | ||
| 610 | - printf("mmap fail\n"); | ||
| 611 | - ret = -1; | ||
| 612 | - goto err11; | ||
| 613 | - } | ||
| 614 | + if (test_handle.outfile && !test_handle.output.show_to_fb) | ||
| 615 | + test_handle.file_out = fopen(test_handle.outfile, "wb"); | ||
| 616 | |||
| 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); | ||
| 620 | - ret = -1; | ||
| 621 | - goto err12; | ||
| 622 | - } | ||
| 623 | + ret = mxc_ipu_lib_task_init(&(test_handle.input), NULL, &(test_handle.output), | ||
| 624 | + test_handle.mode, test_handle.ipu_handle); | ||
| 625 | + if (ret < 0) { | ||
| 626 | + printf("mxc_ipu_lib_task_init failed!\n"); | ||
| 627 | + goto done; | ||
| 628 | } | ||
| 629 | |||
| 630 | again: | ||
| 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; | ||
| 636 | - goto again; | ||
| 637 | - } | ||
| 638 | - if (ret == IPU_CHECK_ERR_SPLIT_INPUTH_OVER) { | ||
| 639 | - t->input.crop.h -= 8; | ||
| 640 | - goto again; | ||
| 641 | - } | ||
| 642 | - if (ret == IPU_CHECK_ERR_SPLIT_OUTPUTW_OVER) { | ||
| 643 | - t->output.crop.w -= 8; | ||
| 644 | - goto again; | ||
| 645 | - } | ||
| 646 | - if (ret == IPU_CHECK_ERR_SPLIT_OUTPUTH_OVER) { | ||
| 647 | - t->output.crop.h -= 8; | ||
| 648 | - goto again; | ||
| 649 | - } | ||
| 650 | - ret = -1; | ||
| 651 | - printf("ipu task check fail\n"); | ||
| 652 | - goto err13; | ||
| 653 | - } | ||
| 654 | - } | ||
| 655 | - dump_ipu_task(t); | ||
| 656 | - | ||
| 657 | -task_begin: | ||
| 658 | - if (t->input.deinterlace.enable && | ||
| 659 | - (t->input.deinterlace.motion != HIGH_MOTION)) | ||
| 660 | - if (fread(vdibuf, 1, isize, file_in) < isize) { | ||
| 661 | - ret = -1; | ||
| 662 | - printf("Can not read enough data from input file\n"); | ||
| 663 | - goto err13; | ||
| 664 | - } | ||
| 665 | - | ||
| 666 | while((done_cnt < test_handle.fcount) && (ctrl_c_rev == 0)) { | ||
| 667 | gettimeofday(&begin, NULL); | ||
| 668 | - | ||
| 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); | ||
| 673 | - } else | ||
| 674 | - ret = fread(inbuf, 1, isize, file_in); | ||
| 675 | - if (ret < isize) { | ||
| 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) { | ||
| 678 | ret = -1; | ||
| 679 | - printf("Can not read enough data from input file\n"); | ||
| 680 | - break; | ||
| 681 | - } | ||
| 682 | - | ||
| 683 | - if (test_handle.show_to_fb) | ||
| 684 | - t->output.paddr = outpaddr[done_cnt % FB_BUFS]; | ||
| 685 | - | ||
| 686 | - ret = ioctl(fd_ipu, IPU_QUEUE_TASK, t); | ||
| 687 | - if (ret < 0) { | ||
| 688 | - printf("ioct IPU_QUEUE_TASK fail\n"); | ||
| 689 | + printf("Can not read enough data from input file!\n"); | ||
| 690 | break; | ||
| 691 | } | ||
| 692 | - | ||
| 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); | ||
| 696 | - if (ret < 0) { | ||
| 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) { | ||
| 701 | + ret = -1; | ||
| 702 | + printf("Can not read enough data from input file!\n"); | ||
| 703 | break; | ||
| 704 | } | ||
| 705 | - } else { | ||
| 706 | - ret = fwrite(outbuf, 1, osize, file_out); | ||
| 707 | - if (ret < osize) { | ||
| 708 | + first_time = 0; | ||
| 709 | + done_cnt++; | ||
| 710 | + total_cnt++; | ||
| 711 | + } | ||
| 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) { | ||
| 715 | ret = -1; | ||
| 716 | - printf("Can not write enough data into output file\n"); | ||
| 717 | + printf("Can not read enough data from input file!\n"); | ||
| 718 | break; | ||
| 719 | } | ||
| 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) { | ||
| 723 | + ret = -1; | ||
| 724 | + printf("Can not read enough data from input file!\n"); | ||
| 725 | + break; | ||
| 726 | + } | ||
| 727 | + done_cnt++; | ||
| 728 | + total_cnt++; | ||
| 729 | + } | ||
| 730 | + first_time = 0; | ||
| 731 | + done_cnt++; | ||
| 732 | + total_cnt++; | ||
| 733 | } | ||
| 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) | ||
| 736 | + break; | ||
| 737 | done_cnt++; | ||
| 738 | total_cnt++; | ||
| 739 | |||
| 740 | @@ -455,63 +288,23 @@ task_begin: | ||
| 741 | run_time += (sec * 1000000) + usec; | ||
| 742 | } | ||
| 743 | |||
| 744 | - if (ret >= 0) { | ||
| 745 | - done_loop++; | ||
| 746 | - if ((done_loop < test_handle.loop_cnt) && (ctrl_c_rev == 0)) { | ||
| 747 | - done_cnt = 0; | ||
| 748 | - fseek(file_in, 0L, SEEK_SET); | ||
| 749 | - goto task_begin; | ||
| 750 | - } | ||
| 751 | + done_loop++; | ||
| 752 | + if ((done_loop < test_handle.loop_cnt) && (ctrl_c_rev == 0)) { | ||
| 753 | + done_cnt = 0; | ||
| 754 | + fseek(file_in, 0L, SEEK_SET); | ||
| 755 | + goto again; | ||
| 756 | } | ||
| 757 | |||
| 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)); | ||
| 761 | + | ||
| 762 | + mxc_ipu_lib_task_uninit(test_handle.ipu_handle); | ||
| 763 | + | ||
| 764 | +done: | ||
| 765 | + fclose(file_in); | ||
| 766 | + if (test_handle.file_out) | ||
| 767 | + fclose(test_handle.file_out); | ||
| 768 | + | ||
| 769 | + system("echo 0,0 > /sys/class/graphics/fb0/pan"); | ||
| 770 | |||
| 771 | -err13: | ||
| 772 | - if (fd_fb) { | ||
| 773 | - blank = FB_BLANK_POWERDOWN; | ||
| 774 | - ioctl(fd_fb, FBIOBLANK, blank); | ||
| 775 | - } | ||
| 776 | - if (file_out) | ||
| 777 | - fclose(file_out); | ||
| 778 | -err12: | ||
| 779 | - if (outbuf) | ||
| 780 | - munmap(outbuf, osize); | ||
| 781 | -err11: | ||
| 782 | - if (fd_fb) | ||
| 783 | - close(fd_fb); | ||
| 784 | - if (t->output.paddr) | ||
| 785 | - ioctl(fd_ipu, IPU_FREE, &t->output.paddr); | ||
| 786 | -err10: | ||
| 787 | - if (alpbuf) | ||
| 788 | - munmap(alpbuf, alpsize); | ||
| 789 | -err9: | ||
| 790 | - if (t->overlay.alpha.loc_alp_paddr) | ||
| 791 | - ioctl(fd_ipu, IPU_FREE, &t->overlay.alpha.loc_alp_paddr); | ||
| 792 | -err8: | ||
| 793 | - if (ovbuf) | ||
| 794 | - munmap(ovbuf, ovsize); | ||
| 795 | -err7: | ||
| 796 | - if (t->overlay.paddr) | ||
| 797 | - ioctl(fd_ipu, IPU_FREE, &t->overlay.paddr); | ||
| 798 | -err6: | ||
| 799 | - if (vdibuf) | ||
| 800 | - munmap(vdibuf, isize); | ||
| 801 | -err5: | ||
| 802 | - if (t->input.paddr_n) | ||
| 803 | - ioctl(fd_ipu, IPU_FREE, &t->input.paddr_n); | ||
| 804 | -err4: | ||
| 805 | - if (inbuf) | ||
| 806 | - munmap(inbuf, isize); | ||
| 807 | -err3: | ||
| 808 | - if (t->input.paddr) | ||
| 809 | - ioctl(fd_ipu, IPU_FREE, &t->input.paddr); | ||
| 810 | -err2: | ||
| 811 | - if (fd_ipu) | ||
| 812 | - close(fd_ipu); | ||
| 813 | -err1: | ||
| 814 | - if (file_in) | ||
| 815 | - fclose(file_in); | ||
| 816 | -err0: | ||
| 817 | return ret; | ||
| 818 | } | ||
| 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 | ||
| 823 | @@ -23,15 +23,35 @@ | ||
| 824 | #define __MXC_IPUDEV_TEST_H__ | ||
| 825 | |||
| 826 | #include <linux/ipu.h> | ||
| 827 | +#include <linux/videodev.h> | ||
| 828 | +#include "mxc_ipu_hl_lib.h" | ||
| 829 | |||
| 830 | typedef struct { | ||
| 831 | - struct ipu_task task; | ||
| 832 | + ipu_lib_handle_t * ipu_handle; | ||
| 833 | int fcount; | ||
| 834 | int loop_cnt; | ||
| 835 | - int show_to_fb; | ||
| 836 | + int mode; | ||
| 837 | + int test_pattern; | ||
| 838 | + int block_width; | ||
| 839 | + int query_task; | ||
| 840 | + int kill_task; | ||
| 841 | + int kill_task_idx; | ||
| 842 | char outfile[128]; | ||
| 843 | + FILE * file_out; | ||
| 844 | + ipu_lib_input_param_t input; | ||
| 845 | + ipu_lib_output_param_t output; | ||
| 846 | } ipu_test_handle_t; | ||
| 847 | |||
| 848 | +enum { | ||
| 849 | + NO_OV = 0x00, | ||
| 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, | ||
| 854 | + COPY_TV = 0x10, | ||
| 855 | +}; | ||
| 856 | + | ||
| 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); | ||
| 859 | |||
| 860 | #endif | ||
| 861 | diff --git a/test/mxc_ipudev_test/test_pattern.c b/test/mxc_ipudev_test/test_pattern.c | ||
| 862 | new file mode 100644 | ||
| 863 | index 0000000..c968548 | ||
| 864 | --- /dev/null | ||
| 865 | +++ b/test/mxc_ipudev_test/test_pattern.c | ||
| 866 | @@ -0,0 +1,2014 @@ | ||
| 867 | +/* | ||
| 868 | + * Copyright 2009-2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 869 | + * | ||
| 870 | + */ | ||
| 871 | + | ||
| 872 | +/* | ||
| 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: | ||
| 876 | + * | ||
| 877 | + * http://www.opensource.org/licenses/lgpl-license.html | ||
| 878 | + * http://www.gnu.org/copyleft/lgpl.html | ||
| 879 | + */ | ||
| 880 | + | ||
| 881 | +/*! | ||
| 882 | + * @file test_pattern.c | ||
| 883 | + * | ||
| 884 | + * @brief IPU device lib test pattern implementation | ||
| 885 | + * | ||
| 886 | + * @ingroup IPU | ||
| 887 | + */ | ||
| 888 | + | ||
| 889 | +#include <stdio.h> | ||
| 890 | +#include <stdlib.h> | ||
| 891 | +#include <fcntl.h> | ||
| 892 | +#include <string.h> | ||
| 893 | +#include <stdint.h> | ||
| 894 | +#include <unistd.h> | ||
| 895 | +#include <time.h> | ||
| 896 | +#include <errno.h> | ||
| 897 | +#include <pthread.h> | ||
| 898 | +#include <math.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" | ||
| 907 | +#endif | ||
| 908 | + | ||
| 909 | +/* | ||
| 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.;*/ | ||
| 913 | + | ||
| 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)) | ||
| 920 | +#define BUF_CNT 5 | ||
| 921 | + | ||
| 922 | +extern int ctrl_c_rev; | ||
| 923 | + | ||
| 924 | +static int get_system_rev(unsigned int * system_rev) | ||
| 925 | +{ | ||
| 926 | + FILE *fp; | ||
| 927 | + char buf[1024]; | ||
| 928 | + int nread; | ||
| 929 | + char *tmp, *rev; | ||
| 930 | + int ret = -1; | ||
| 931 | + | ||
| 932 | + fp = fopen("/proc/cpuinfo", "r"); | ||
| 933 | + if (fp == NULL) { | ||
| 934 | + printf("Open /proc/cpuinfo failed!\n"); | ||
| 935 | + return ret; | ||
| 936 | + } | ||
| 937 | + | ||
| 938 | + nread = fread(buf, 1, sizeof(buf), fp); | ||
| 939 | + fclose(fp); | ||
| 940 | + if ((nread == 0) || (nread == sizeof(buf))) { | ||
| 941 | + fclose(fp); | ||
| 942 | + return ret; | ||
| 943 | + } | ||
| 944 | + | ||
| 945 | + buf[nread] = '\0'; | ||
| 946 | + | ||
| 947 | + tmp = strstr(buf, "Revision"); | ||
| 948 | + if (tmp != NULL) { | ||
| 949 | + rev = index(tmp, ':'); | ||
| 950 | + if (rev != NULL) { | ||
| 951 | + rev++; | ||
| 952 | + *system_rev = strtoul(rev, NULL, 16); | ||
| 953 | + ret = 0; | ||
| 954 | + } | ||
| 955 | + } | ||
| 956 | + | ||
| 957 | + return ret; | ||
| 958 | +} | ||
| 959 | + | ||
| 960 | +void gen_fill_pattern(char * buf, int in_width, int in_height) | ||
| 961 | +{ | ||
| 962 | + int y_size = in_width * in_height; | ||
| 963 | + int h_step = in_height / 16; | ||
| 964 | + int w_step = in_width / 16; | ||
| 965 | + int h, w; | ||
| 966 | + uint32_t y_color = 0; | ||
| 967 | + int32_t u_color = 0; | ||
| 968 | + int32_t v_color = 0; | ||
| 969 | + uint32_t rgb = 0; | ||
| 970 | + static int32_t alpha = 0; | ||
| 971 | + static int inc_alpha = 1; | ||
| 972 | + | ||
| 973 | + for (h = 0; h < in_height; h++) { | ||
| 974 | + int32_t rgb_temp = rgb; | ||
| 975 | + | ||
| 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; | ||
| 980 | + | ||
| 981 | + u_color = u(rgb_temp); | ||
| 982 | + u_color = (u_color * alpha) / 255; | ||
| 983 | + u_color += 128; | ||
| 984 | + | ||
| 985 | + v_color = v(rgb_temp); | ||
| 986 | + v_color = (v_color * alpha) / 255; | ||
| 987 | + v_color += 128; | ||
| 988 | + | ||
| 989 | + rgb_temp++; | ||
| 990 | + if (rgb_temp > 255) | ||
| 991 | + rgb_temp = 0; | ||
| 992 | + } | ||
| 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; | ||
| 997 | + } | ||
| 998 | + } | ||
| 999 | + if ((h > 0) && (h % h_step == 0)) { | ||
| 1000 | + rgb += 16; | ||
| 1001 | + if (rgb > 255) | ||
| 1002 | + rgb = 0; | ||
| 1003 | + } | ||
| 1004 | + | ||
| 1005 | + } | ||
| 1006 | + if (inc_alpha) { | ||
| 1007 | + alpha+=4; | ||
| 1008 | + if (alpha >= 255) { | ||
| 1009 | + inc_alpha = 0; | ||
| 1010 | + } | ||
| 1011 | + } else { | ||
| 1012 | + alpha-=4; | ||
| 1013 | + if (alpha <= 0) { | ||
| 1014 | + inc_alpha = 1; | ||
| 1015 | + } | ||
| 1016 | + } | ||
| 1017 | +} | ||
| 1018 | + | ||
| 1019 | +void gen_fill_alpha_in_separate_buffer(void * alpha_buf, int alpha_size, | ||
| 1020 | + char alpha) | ||
| 1021 | +{ | ||
| 1022 | + memset(alpha_buf, alpha, alpha_size); | ||
| 1023 | +} | ||
| 1024 | + | ||
| 1025 | +void fill_alpha_buffer(char *alpha_buf, int left, int top, | ||
| 1026 | + int right, int bottom, int disp_w, char alpha_val) | ||
| 1027 | +{ | ||
| 1028 | + char *pPointAlphaValue; | ||
| 1029 | + int x, y; | ||
| 1030 | + | ||
| 1031 | + for (y = top; y < bottom; y++) { | ||
| 1032 | + for (x = left; x < right; x++) { | ||
| 1033 | + pPointAlphaValue = (char *)(alpha_buf + | ||
| 1034 | + disp_w * y + x); | ||
| 1035 | + *pPointAlphaValue = alpha_val; | ||
| 1036 | + } | ||
| 1037 | + } | ||
| 1038 | +} | ||
| 1039 | + | ||
| 1040 | +void gen_fill_alpha_in_pixel(void * buf, unsigned int pixel_format, | ||
| 1041 | + int buf_size, char alpha) | ||
| 1042 | +{ | ||
| 1043 | + int i; | ||
| 1044 | + char* p_alpha; | ||
| 1045 | + | ||
| 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++) { | ||
| 1049 | + if (i % 4 == 3) { | ||
| 1050 | + p_alpha = (char *)(buf + i); | ||
| 1051 | + *p_alpha = alpha; | ||
| 1052 | + } | ||
| 1053 | + } | ||
| 1054 | + } else if (pixel_format == v4l2_fourcc('A', 'B', 'G', 'R')) { | ||
| 1055 | + for (i = 0; i < buf_size; i++) { | ||
| 1056 | + if (i % 4 == 0) { | ||
| 1057 | + p_alpha = (char *)(buf + i); | ||
| 1058 | + *p_alpha = alpha; | ||
| 1059 | + } | ||
| 1060 | + } | ||
| 1061 | + } else { | ||
| 1062 | + printf("Unsupported pixel format with alpha value!\n"); | ||
| 1063 | + } | ||
| 1064 | +} | ||
| 1065 | + | ||
| 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) | ||
| 1068 | +{ | ||
| 1069 | + unsigned char* p_alpha; | ||
| 1070 | + | ||
| 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); | ||
| 1076 | + } else { | ||
| 1077 | + printf("Unsupported pixel format with alpha value!\n"); | ||
| 1078 | + return; | ||
| 1079 | + } | ||
| 1080 | + *p_alpha = alpha; | ||
| 1081 | +} | ||
| 1082 | + | ||
| 1083 | +int foreground_fb(void) | ||
| 1084 | +{ | ||
| 1085 | + int fd_fb; | ||
| 1086 | + struct fb_fix_screeninfo fb_fix; | ||
| 1087 | + | ||
| 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) { | ||
| 1091 | + close(fd_fb); | ||
| 1092 | + return 2; | ||
| 1093 | + } | ||
| 1094 | + | ||
| 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) { | ||
| 1098 | + close(fd_fb); | ||
| 1099 | + return 1; | ||
| 1100 | + } | ||
| 1101 | + | ||
| 1102 | + return 0; | ||
| 1103 | +} | ||
| 1104 | + | ||
| 1105 | +int dc_fb(void) | ||
| 1106 | +{ | ||
| 1107 | + int fd_fb; | ||
| 1108 | + struct fb_fix_screeninfo fb_fix; | ||
| 1109 | + | ||
| 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) { | ||
| 1113 | + close(fd_fb); | ||
| 1114 | + return 0; | ||
| 1115 | + } | ||
| 1116 | + | ||
| 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) { | ||
| 1120 | + close(fd_fb); | ||
| 1121 | + return 1; | ||
| 1122 | + } | ||
| 1123 | + | ||
| 1124 | + return -1; | ||
| 1125 | +} | ||
| 1126 | + | ||
| 1127 | +int fd_fb_alloc = 0; | ||
| 1128 | + | ||
| 1129 | +int dma_memory_alloc(int size, int cnt, dma_addr_t paddr[], void * vaddr[]) | ||
| 1130 | +{ | ||
| 1131 | + int i, ret = 0; | ||
| 1132 | + | ||
| 1133 | + if ((fd_fb_alloc = open("/dev/fb0", O_RDWR, 0)) < 0) { | ||
| 1134 | + printf("Unable to open /dev/fb0\n"); | ||
| 1135 | + ret = -1; | ||
| 1136 | + goto done; | ||
| 1137 | + } | ||
| 1138 | + | ||
| 1139 | + for (i=0;i<cnt;i++) { | ||
| 1140 | + /*alloc mem from DMA zone*/ | ||
| 1141 | + /*input as request mem size */ | ||
| 1142 | + paddr[i] = 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"); | ||
| 1150 | + ret = -1; | ||
| 1151 | + goto done; | ||
| 1152 | + } else if ( ioctl(fd_fb_alloc, FBIO_ALLOC, &(paddr[i])) < 0) { | ||
| 1153 | + printf("Unable alloc mem from /dev/fb2\n"); | ||
| 1154 | + ret = -1; | ||
| 1155 | + goto done; | ||
| 1156 | + } | ||
| 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"); | ||
| 1162 | + ret = -1; | ||
| 1163 | + goto done; | ||
| 1164 | + } else if ( ioctl(fd_fb_alloc, FBIO_ALLOC, &(paddr[i])) < 0) { | ||
| 1165 | + printf("Unable alloc mem from /dev/fb2\n"); | ||
| 1166 | + ret = -1; | ||
| 1167 | + goto done; | ||
| 1168 | + } | ||
| 1169 | + } | ||
| 1170 | + } | ||
| 1171 | + | ||
| 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"); | ||
| 1176 | + ret = -1; | ||
| 1177 | + goto done; | ||
| 1178 | + } | ||
| 1179 | + } | ||
| 1180 | +done: | ||
| 1181 | + return ret; | ||
| 1182 | +} | ||
| 1183 | + | ||
| 1184 | +void dma_memory_free(int size, int cnt, dma_addr_t paddr[], void * vaddr[]) | ||
| 1185 | +{ | ||
| 1186 | + int i; | ||
| 1187 | + | ||
| 1188 | + for (i=0;i<cnt;i++) { | ||
| 1189 | + if (vaddr[i]) | ||
| 1190 | + munmap(vaddr[i], size); | ||
| 1191 | + if (paddr[i]) | ||
| 1192 | + ioctl(fd_fb_alloc, FBIO_FREE, &(paddr[i])); | ||
| 1193 | + } | ||
| 1194 | +} | ||
| 1195 | + | ||
| 1196 | +int copy_test(ipu_test_handle_t * test_handle) | ||
| 1197 | +{ | ||
| 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; | ||
| 1203 | + | ||
| 1204 | + if ((fd_fb = open("/dev/fb0", O_RDWR, 0)) < 0) { | ||
| 1205 | + printf("Unable to open /dev/fb0\n"); | ||
| 1206 | + ret = -1; | ||
| 1207 | + goto done; | ||
| 1208 | + } | ||
| 1209 | + | ||
| 1210 | + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) { | ||
| 1211 | + printf("Get FB var info failed!\n"); | ||
| 1212 | + ret = -1; | ||
| 1213 | + goto done; | ||
| 1214 | + } | ||
| 1215 | + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) { | ||
| 1216 | + printf("Get FB fix info failed!\n"); | ||
| 1217 | + ret = -1; | ||
| 1218 | + goto done; | ||
| 1219 | + } | ||
| 1220 | + screen_size = fb_var.yres * fb_fix.line_length; | ||
| 1221 | + ret = dma_memory_alloc(screen_size, 1, fake_fb_paddr, fake_fb); | ||
| 1222 | + if ( ret < 0) { | ||
| 1223 | + printf("dma_memory_alloc failed\n"); | ||
| 1224 | + goto done; | ||
| 1225 | + } | ||
| 1226 | + | ||
| 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'); | ||
| 1236 | + } else { | ||
| 1237 | + test_handle->output.fmt = v4l2_fourcc('R', 'G', 'B', 'P'); | ||
| 1238 | + test_handle->input.fmt = v4l2_fourcc('R', 'G', 'B', 'P'); | ||
| 1239 | + } | ||
| 1240 | + test_handle->input.user_def_paddr[0] = fake_fb_paddr[0]; | ||
| 1241 | + test_handle->output.user_def_paddr[0] = fb_fix.smem_start; | ||
| 1242 | + | ||
| 1243 | + ret = mxc_ipu_lib_task_init(&(test_handle->input), NULL, &(test_handle->output), | ||
| 1244 | + test_handle->mode, test_handle->ipu_handle); | ||
| 1245 | + if (ret < 0) { | ||
| 1246 | + printf("mxc_ipu_lib_task_init failed!\n"); | ||
| 1247 | + goto err; | ||
| 1248 | + } | ||
| 1249 | + | ||
| 1250 | + while((done_cnt < test_handle->fcount) && (ctrl_c_rev == 0)) { | ||
| 1251 | + static int j = 0; | ||
| 1252 | + if ((j % 3) == 0) | ||
| 1253 | + memset(fake_fb[0], 0, screen_size); | ||
| 1254 | + if ((j % 3) == 1) | ||
| 1255 | + memset(fake_fb[0], 0x80, screen_size); | ||
| 1256 | + if ((j % 3) == 2) | ||
| 1257 | + memset(fake_fb[0], 0xff, screen_size); | ||
| 1258 | + j++; | ||
| 1259 | + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, 0, 0, 0, NULL, NULL) < 0) | ||
| 1260 | + break; | ||
| 1261 | + done_cnt++; | ||
| 1262 | + sleep(1); | ||
| 1263 | + } | ||
| 1264 | + | ||
| 1265 | + mxc_ipu_lib_task_uninit(test_handle->ipu_handle); | ||
| 1266 | + | ||
| 1267 | +err: | ||
| 1268 | + dma_memory_free(screen_size, 1, fake_fb_paddr, fake_fb); | ||
| 1269 | +done: | ||
| 1270 | + return ret; | ||
| 1271 | +} | ||
| 1272 | + | ||
| 1273 | +int color_bar(int overlay, ipu_test_handle_t * test_handle) | ||
| 1274 | +{ | ||
| 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; | ||
| 1286 | + | ||
| 1287 | + get_system_rev(&system_rev); | ||
| 1288 | + if (((system_rev & 0xff000) == 0x37000) || | ||
| 1289 | + (((system_rev & 0xff000) == 0x51000)) || | ||
| 1290 | + (((system_rev & 0xff000) == 0x53000))) | ||
| 1291 | + ipu_version = 3; | ||
| 1292 | + else | ||
| 1293 | + ipu_version = 1; | ||
| 1294 | + | ||
| 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"); | ||
| 1298 | + ret = -1; | ||
| 1299 | + goto done; | ||
| 1300 | + } | ||
| 1301 | + if ((ipu_version == 1) && overlay) { | ||
| 1302 | + printf("currently ipuv1 would not support overlay!\n"); | ||
| 1303 | + ret = -1; | ||
| 1304 | + goto done; | ||
| 1305 | + } | ||
| 1306 | + | ||
| 1307 | + if ((fd_fb = open("/dev/fb0", O_RDWR, 0)) < 0) { | ||
| 1308 | + printf("Unable to open /dev/fb0\n"); | ||
| 1309 | + ret = -1; | ||
| 1310 | + goto done; | ||
| 1311 | + } | ||
| 1312 | + | ||
| 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"); | ||
| 1317 | + ret = -1; | ||
| 1318 | + goto done; | ||
| 1319 | + } | ||
| 1320 | + | ||
| 1321 | + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) { | ||
| 1322 | + printf("Get FB var info failed!\n"); | ||
| 1323 | + ret = -1; | ||
| 1324 | + goto done; | ||
| 1325 | + } | ||
| 1326 | + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) { | ||
| 1327 | + printf("Get FB fix info failed!\n"); | ||
| 1328 | + ret = -1; | ||
| 1329 | + goto done; | ||
| 1330 | + } | ||
| 1331 | + | ||
| 1332 | + if(fb_var.yres_virtual != 3*fb_var.yres) | ||
| 1333 | + { | ||
| 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"); | ||
| 1337 | + ret = -1; | ||
| 1338 | + goto done; | ||
| 1339 | + } | ||
| 1340 | + } | ||
| 1341 | + | ||
| 1342 | + screen_size = fb_var.yres * fb_fix.line_length; | ||
| 1343 | + fb[0] = mmap(NULL, 3 * screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, | ||
| 1344 | + fd_fb, 0); | ||
| 1345 | + if (fb[0] == MAP_FAILED) { | ||
| 1346 | + printf("fb buf0 mmap failed, errno %d!\n", errno); | ||
| 1347 | + ret = -1; | ||
| 1348 | + goto done; | ||
| 1349 | + } | ||
| 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); | ||
| 1354 | + | ||
| 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'); | ||
| 1363 | + else | ||
| 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; | ||
| 1371 | + if (overlay){ | ||
| 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'); | ||
| 1377 | + else | ||
| 1378 | + ov.fmt = v4l2_fourcc('R', 'G', 'B', 'P'); | ||
| 1379 | + | ||
| 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; | ||
| 1389 | + | ||
| 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; | ||
| 1402 | + | ||
| 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; | ||
| 1416 | + | ||
| 1417 | + /* | ||
| 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. | ||
| 1422 | + */ | ||
| 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; | ||
| 1427 | + } | ||
| 1428 | + ov.key_color_en = 0; | ||
| 1429 | + ov.alpha = 128; | ||
| 1430 | + ov.key_color = 0x808080; | ||
| 1431 | + } else { | ||
| 1432 | + /* one output case -- full screen */ | ||
| 1433 | + test_handle->output.width = fb_var.xres; | ||
| 1434 | + test_handle->output.height = fb_var.yres; | ||
| 1435 | + } | ||
| 1436 | + | ||
| 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); | ||
| 1440 | + if ( ret < 0) { | ||
| 1441 | + printf("dma_memory_alloc failed\n"); | ||
| 1442 | + goto done; | ||
| 1443 | + } | ||
| 1444 | + | ||
| 1445 | + if (overlay) { | ||
| 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"); | ||
| 1449 | + ret = -1; | ||
| 1450 | + goto done; | ||
| 1451 | + } | ||
| 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"); | ||
| 1456 | + ret = -1; | ||
| 1457 | + goto done; | ||
| 1458 | + } | ||
| 1459 | + ov.user_def_paddr[0] = ov_fake_fb_paddr; | ||
| 1460 | + ov.user_def_paddr[1] = ov.user_def_paddr[0]; | ||
| 1461 | + | ||
| 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"); | ||
| 1467 | + ret = -1; | ||
| 1468 | + goto done; | ||
| 1469 | + } | ||
| 1470 | + ov_alpha_fake_fb = mmap(NULL, ov_alpha_fake_fb_size, | ||
| 1471 | + PROT_READ | PROT_WRITE, | ||
| 1472 | + MAP_SHARED, | ||
| 1473 | + fd_fb, | ||
| 1474 | + ov_alpha_fake_fb_paddr); | ||
| 1475 | + if (ov_alpha_fake_fb == MAP_FAILED) { | ||
| 1476 | + printf("mmap failed!\n"); | ||
| 1477 | + ret = -1; | ||
| 1478 | + goto done; | ||
| 1479 | + } | ||
| 1480 | + ov.user_def_alpha_paddr[0] = ov_alpha_fake_fb_paddr; | ||
| 1481 | + ov.user_def_alpha_paddr[1] = ov_alpha_fake_fb_paddr; | ||
| 1482 | + } | ||
| 1483 | + } | ||
| 1484 | + | ||
| 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); | ||
| 1490 | + done_cnt = i = 1; | ||
| 1491 | + | ||
| 1492 | + if (overlay) | ||
| 1493 | + ret = mxc_ipu_lib_task_init(&(test_handle->input), &ov, &(test_handle->output), | ||
| 1494 | + test_handle->mode, test_handle->ipu_handle); | ||
| 1495 | + else | ||
| 1496 | + ret = mxc_ipu_lib_task_init(&(test_handle->input), NULL, &(test_handle->output), | ||
| 1497 | + test_handle->mode, test_handle->ipu_handle); | ||
| 1498 | + if (ret < 0) { | ||
| 1499 | + printf("mxc_ipu_lib_task_init failed!\n"); | ||
| 1500 | + goto done; | ||
| 1501 | + } | ||
| 1502 | + | ||
| 1503 | + while((done_cnt < test_handle->fcount) && (ctrl_c_rev == 0)) { | ||
| 1504 | + if (overlay) { | ||
| 1505 | + if (overlay == IC_GLB_ALP_OV) { | ||
| 1506 | + if (done_cnt % 50 == 0) { | ||
| 1507 | + static int j = 0; | ||
| 1508 | + if ((j % 3) == 0) | ||
| 1509 | + memset(ov_fake_fb, 0, | ||
| 1510 | + ov_fake_fb_size); | ||
| 1511 | + if ((j % 3) == 1) | ||
| 1512 | + memset(ov_fake_fb, 0x80, | ||
| 1513 | + ov_fake_fb_size); | ||
| 1514 | + if ((j % 3) == 2) | ||
| 1515 | + memset(ov_fake_fb, 0xff, | ||
| 1516 | + ov_fake_fb_size); | ||
| 1517 | + j++; | ||
| 1518 | + } | ||
| 1519 | + /* fb show sequence should be 0->1->2->0 */ | ||
| 1520 | + memcpy(fb[done_cnt%3], ov_fake_fb, | ||
| 1521 | + ov_fake_fb_size); | ||
| 1522 | + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], ov_fake_fb_paddr, 0, NULL, NULL) < 0) | ||
| 1523 | + break; | ||
| 1524 | + } else if (overlay == IC_LOC_PIX_ALP_OV) { | ||
| 1525 | + if (done_cnt == 1) { | ||
| 1526 | + /* RGBA32 red */ | ||
| 1527 | + /* 2 planes */ | ||
| 1528 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1529 | + if (k % 4 == 0) | ||
| 1530 | + memset(ov_fake_fb + k, | ||
| 1531 | + 0xFF, 1); | ||
| 1532 | + else | ||
| 1533 | + memset(ov_fake_fb + k, | ||
| 1534 | + 0x00, 1); | ||
| 1535 | + | ||
| 1536 | + if (k % 4 == 3) | ||
| 1537 | + memset(ov_fake_fb + k, | ||
| 1538 | + 0x80, 1); | ||
| 1539 | + } | ||
| 1540 | + } else if (done_cnt == 1*fcount/9) { | ||
| 1541 | + /* video plane */ | ||
| 1542 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1543 | + if (k % 4 == 3) | ||
| 1544 | + memset(ov_fake_fb + k, | ||
| 1545 | + 0x00, 1); | ||
| 1546 | + } | ||
| 1547 | + } else if (done_cnt == 2*fcount/9) { | ||
| 1548 | + /* graphic plane */ | ||
| 1549 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1550 | + if (k % 4 == 3) | ||
| 1551 | + memset(ov_fake_fb + k, | ||
| 1552 | + 0xFF, 1); | ||
| 1553 | + } | ||
| 1554 | + } else if (done_cnt == fcount/3) { | ||
| 1555 | + /* RGBA32 green */ | ||
| 1556 | + /* 2 planes */ | ||
| 1557 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1558 | + if (k % 4 == 1) | ||
| 1559 | + memset(ov_fake_fb + k, | ||
| 1560 | + 0xFF, 1); | ||
| 1561 | + else | ||
| 1562 | + memset(ov_fake_fb + k, | ||
| 1563 | + 0x00, 1); | ||
| 1564 | + | ||
| 1565 | + if (k % 4 == 3) | ||
| 1566 | + memset(ov_fake_fb + k, | ||
| 1567 | + 0x80, 1); | ||
| 1568 | + } | ||
| 1569 | + } else if (done_cnt == 4*fcount/9) { | ||
| 1570 | + /* video plane */ | ||
| 1571 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1572 | + if (k % 4 == 3) | ||
| 1573 | + memset(ov_fake_fb + k, | ||
| 1574 | + 0x00, 1); | ||
| 1575 | + } | ||
| 1576 | + } else if (done_cnt == 5*fcount/9) { | ||
| 1577 | + /* graphic plane */ | ||
| 1578 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1579 | + if (k % 4 == 3) | ||
| 1580 | + memset(ov_fake_fb + k, | ||
| 1581 | + 0xFF, 1); | ||
| 1582 | + } | ||
| 1583 | + } else if (done_cnt == 2*fcount/3) { | ||
| 1584 | + /* RGBA32 blue */ | ||
| 1585 | + /* 2 planes */ | ||
| 1586 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1587 | + if (k % 4 == 2) | ||
| 1588 | + memset(ov_fake_fb + k, | ||
| 1589 | + 0xFF, 1); | ||
| 1590 | + else | ||
| 1591 | + memset(ov_fake_fb + k, | ||
| 1592 | + 0x00, 1); | ||
| 1593 | + | ||
| 1594 | + if (k % 4 == 3) | ||
| 1595 | + memset(ov_fake_fb + k, | ||
| 1596 | + 0x80, 1); | ||
| 1597 | + } | ||
| 1598 | + } else if (done_cnt == 7*fcount/9) { | ||
| 1599 | + /* video plane */ | ||
| 1600 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1601 | + if (k % 4 == 3) | ||
| 1602 | + memset(ov_fake_fb + k, | ||
| 1603 | + 0x00, 1); | ||
| 1604 | + } | ||
| 1605 | + } else if (done_cnt == 8*fcount/9) { | ||
| 1606 | + /* graphic plane */ | ||
| 1607 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1608 | + if (k % 4 == 3) | ||
| 1609 | + memset(ov_fake_fb + k, | ||
| 1610 | + 0xFF, 1); | ||
| 1611 | + } | ||
| 1612 | + } | ||
| 1613 | + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], ov_fake_fb_paddr, 0, NULL, NULL) < 0) | ||
| 1614 | + break; | ||
| 1615 | + } else if (overlay == IC_LOC_SEP_ALP_OV) { | ||
| 1616 | + if (done_cnt == 1) { | ||
| 1617 | + /* RGB565 red */ | ||
| 1618 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1619 | + if (k % 2 == 1) | ||
| 1620 | + memset(ov_fake_fb + k, | ||
| 1621 | + 0xF8, 1); | ||
| 1622 | + else | ||
| 1623 | + memset(ov_fake_fb + k, | ||
| 1624 | + 0x00, 1); | ||
| 1625 | + } | ||
| 1626 | + /* 2 planes */ | ||
| 1627 | + memset(ov_alpha_fake_fb, 0x80, | ||
| 1628 | + ov_alpha_fake_fb_size); | ||
| 1629 | + } else if (done_cnt == 1*fcount/9) { | ||
| 1630 | + /* video plane */ | ||
| 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++) { | ||
| 1640 | + if (k % 2 == 1) | ||
| 1641 | + memset(ov_fake_fb + k, | ||
| 1642 | + 0x07, 1); | ||
| 1643 | + else | ||
| 1644 | + memset(ov_fake_fb + k, | ||
| 1645 | + 0xE0, 1); | ||
| 1646 | + } | ||
| 1647 | + /* 2 planes */ | ||
| 1648 | + memset(ov_alpha_fake_fb, 0x80, | ||
| 1649 | + ov_alpha_fake_fb_size); | ||
| 1650 | + } else if (done_cnt == 4*fcount/9) { | ||
| 1651 | + /* video plane */ | ||
| 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) { | ||
| 1659 | + /* RGB565 blue */ | ||
| 1660 | + for (k = 0; k < ov_fake_fb_size; k++) { | ||
| 1661 | + if (k % 2 == 0) | ||
| 1662 | + memset(ov_fake_fb + k, | ||
| 1663 | + 0x1F, 1); | ||
| 1664 | + else | ||
| 1665 | + memset(ov_fake_fb + k, | ||
| 1666 | + 0x00, 1); | ||
| 1667 | + } | ||
| 1668 | + /* 2 planes */ | ||
| 1669 | + memset(ov_alpha_fake_fb, 0x80, | ||
| 1670 | + ov_alpha_fake_fb_size); | ||
| 1671 | + } else if (done_cnt == 7*fcount/9) { | ||
| 1672 | + /* video plane */ | ||
| 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); | ||
| 1679 | + } | ||
| 1680 | + memcpy(fb[done_cnt%3], ov_fake_fb, | ||
| 1681 | + ov_fake_fb_size); | ||
| 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) | ||
| 1683 | + break; | ||
| 1684 | + } | ||
| 1685 | + } else { | ||
| 1686 | + if (mxc_ipu_lib_task_buf_update(test_handle->ipu_handle, paddr[i], 0, 0, NULL, NULL) < 0) | ||
| 1687 | + break; | ||
| 1688 | + } | ||
| 1689 | + | ||
| 1690 | + i++; | ||
| 1691 | + if (i == BUF_CNT) | ||
| 1692 | + i = 0; | ||
| 1693 | + done_cnt++; | ||
| 1694 | + gen_fill_pattern(buf[i], test_handle->input.width, test_handle->input.height); | ||
| 1695 | + /* make the input framerate < 60Hz*/ | ||
| 1696 | + usleep(15000); | ||
| 1697 | + } | ||
| 1698 | + | ||
| 1699 | + mxc_ipu_lib_task_uninit(test_handle->ipu_handle); | ||
| 1700 | + | ||
| 1701 | +done: | ||
| 1702 | + dma_memory_free(size, BUF_CNT, paddr, buf); | ||
| 1703 | + if (fd_fb) | ||
| 1704 | + close(fd_fb); | ||
| 1705 | + | ||
| 1706 | + return ret; | ||
| 1707 | +} | ||
| 1708 | + | ||
| 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) | ||
| 1711 | +{ | ||
| 1712 | + static int angle = 0; | ||
| 1713 | + static double steps = 0.0; | ||
| 1714 | + struct mxcfb_pos pos; | ||
| 1715 | + int need_change = 0; | ||
| 1716 | + double ra; | ||
| 1717 | + double nx, ny; | ||
| 1718 | + | ||
| 1719 | + if (angle == 0) | ||
| 1720 | + angle = angle_start; | ||
| 1721 | + steps += 0.1; | ||
| 1722 | + ra = ((double)angle)*3.1415926/180.0; | ||
| 1723 | + nx = *x + steps*cos(ra); | ||
| 1724 | + ny = *y + steps*sin(ra); | ||
| 1725 | + if (nx < 0) { | ||
| 1726 | + if (ny < *y) /* x+, y-*/ | ||
| 1727 | + angle = 360 - angle_start; | ||
| 1728 | + else /* x+, y+ */ | ||
| 1729 | + angle = angle_start; | ||
| 1730 | + need_change = 1; | ||
| 1731 | + } else if (nx > (limit_w - block_width)) { | ||
| 1732 | + if (ny < *y) /* x-, y-*/ | ||
| 1733 | + angle = 180 + angle_start; | ||
| 1734 | + else /* x-, y+ */ | ||
| 1735 | + angle = 180 - angle_start; | ||
| 1736 | + need_change = 1; | ||
| 1737 | + } else if (ny < 0) { | ||
| 1738 | + if (nx < *x) /* x-, y+*/ | ||
| 1739 | + angle = 180 - angle_start; | ||
| 1740 | + else /* x+, y+ */ | ||
| 1741 | + angle = angle_start; | ||
| 1742 | + need_change = 1; | ||
| 1743 | + } else if (ny > (limit_h - block_width)) { | ||
| 1744 | + if (nx < *x) /* x-, y-*/ | ||
| 1745 | + angle = 180 + angle_start; | ||
| 1746 | + else /* x+, y- */ | ||
| 1747 | + angle = 360 - angle_start; | ||
| 1748 | + need_change = 1; | ||
| 1749 | + } | ||
| 1750 | + | ||
| 1751 | + if (need_change) { | ||
| 1752 | + steps = 0.0; | ||
| 1753 | + ra = ((double)angle)*3.1415926/180.0; | ||
| 1754 | + nx = *x; | ||
| 1755 | + ny = *y; | ||
| 1756 | + //printf("change angle to %d\n", angle); | ||
| 1757 | + //printf("pos %d, %d\n", *x, *y); | ||
| 1758 | + } | ||
| 1759 | + | ||
| 1760 | + pos.x = nx; | ||
| 1761 | + pos.y = ny; | ||
| 1762 | + ioctl(fd_fb, MXCFB_SET_OVERLAY_POS, &pos); | ||
| 1763 | + *x = nx; | ||
| 1764 | + *y = ny; | ||
| 1765 | + | ||
| 1766 | + return need_change; | ||
| 1767 | +} | ||
| 1768 | + | ||
| 1769 | +/* | ||
| 1770 | + * This call-back function provide one method to update | ||
| 1771 | + * framebuffer by pan_display. | ||
| 1772 | + */ | ||
| 1773 | +void hop_block_output_cb(void * arg, int index) | ||
| 1774 | +{ | ||
| 1775 | + int fd_fb = *((int *)arg); | ||
| 1776 | + struct fb_var_screeninfo fb_var; | ||
| 1777 | + | ||
| 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*/ | ||
| 1782 | + if (index == 0) | ||
| 1783 | + fb_var.yoffset = fb_var.yres; | ||
| 1784 | + else if (index == 1) | ||
| 1785 | + fb_var.yoffset = 0; | ||
| 1786 | + else | ||
| 1787 | + fb_var.yoffset = 2 * fb_var.yres; | ||
| 1788 | + | ||
| 1789 | + ioctl(fd_fb, FBIOPAN_DISPLAY, &fb_var); | ||
| 1790 | +} | ||
| 1791 | + | ||
| 1792 | +int hop_block(ipu_test_handle_t * test_handle) | ||
| 1793 | +{ | ||
| 1794 | + int ret = 0, x = 0, y = 0, fd_fb = 0, next_update_idx = 0; | ||
| 1795 | + int lcd_w, lcd_h; | ||
| 1796 | + int blank; | ||
| 1797 | + char random_color; | ||
| 1798 | + int start_angle, screen_size; | ||
| 1799 | + void * buf; | ||
| 1800 | + struct mxcfb_pos pos; | ||
| 1801 | + struct fb_var_screeninfo fb_var; | ||
| 1802 | + struct fb_fix_screeninfo fb_fix; | ||
| 1803 | + | ||
| 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"); | ||
| 1807 | + ret = -1; | ||
| 1808 | + goto done; | ||
| 1809 | + } | ||
| 1810 | + | ||
| 1811 | + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) { | ||
| 1812 | + printf("Get FB fix info failed!\n"); | ||
| 1813 | + ret = -1; | ||
| 1814 | + goto done; | ||
| 1815 | + } | ||
| 1816 | + | ||
| 1817 | + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) { | ||
| 1818 | + printf("Get FB var info failed!\n"); | ||
| 1819 | + ret = -1; | ||
| 1820 | + goto done; | ||
| 1821 | + } | ||
| 1822 | + lcd_w = fb_var.xres; | ||
| 1823 | + lcd_h = fb_var.yres; | ||
| 1824 | + screen_size = fb_var.yres_virtual * fb_fix.line_length; | ||
| 1825 | + | ||
| 1826 | + buf = mmap(NULL, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, | ||
| 1827 | + fd_fb, 0); | ||
| 1828 | + if (buf == MAP_FAILED) { | ||
| 1829 | + printf("mmap failed!\n"); | ||
| 1830 | + ret = -1; | ||
| 1831 | + goto done; | ||
| 1832 | + } | ||
| 1833 | + memset(buf, 0, screen_size); | ||
| 1834 | + close(fd_fb); | ||
| 1835 | + | ||
| 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"); | ||
| 1840 | + ret = -1; | ||
| 1841 | + goto done; | ||
| 1842 | + } | ||
| 1843 | + } else { | ||
| 1844 | + if ((fd_fb = open("/dev/fb1", O_RDWR, 0)) < 0) { | ||
| 1845 | + printf("Unable to open /dev/fb1\n"); | ||
| 1846 | + ret = -1; | ||
| 1847 | + goto done; | ||
| 1848 | + } | ||
| 1849 | + } | ||
| 1850 | + | ||
| 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"); | ||
| 1858 | + ret = -1; | ||
| 1859 | + goto done; | ||
| 1860 | + } | ||
| 1861 | + | ||
| 1862 | + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) { | ||
| 1863 | + printf("Get FB fix info failed!\n"); | ||
| 1864 | + ret = -1; | ||
| 1865 | + goto done; | ||
| 1866 | + } | ||
| 1867 | + | ||
| 1868 | + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) { | ||
| 1869 | + printf("Get FB var info failed!\n"); | ||
| 1870 | + ret = -1; | ||
| 1871 | + goto done; | ||
| 1872 | + } | ||
| 1873 | + blank = FB_BLANK_UNBLANK; | ||
| 1874 | + if ( ioctl(fd_fb, FBIOBLANK, blank) < 0) { | ||
| 1875 | + printf("UNBLANK FB failed!\n"); | ||
| 1876 | + ret = -1; | ||
| 1877 | + goto done; | ||
| 1878 | + } | ||
| 1879 | + | ||
| 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'); | ||
| 1889 | + else | ||
| 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; | ||
| 1896 | + | ||
| 1897 | + ret = mxc_ipu_lib_task_init(&(test_handle->input), NULL, &(test_handle->output), | ||
| 1898 | + test_handle->mode, test_handle->ipu_handle); | ||
| 1899 | + if (ret < 0) { | ||
| 1900 | + printf("mxc_ipu_lib_task_init failed!\n"); | ||
| 1901 | + goto done; | ||
| 1902 | + } | ||
| 1903 | + | ||
| 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); | ||
| 1913 | + | ||
| 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) | ||
| 1916 | + goto err; | ||
| 1917 | + | ||
| 1918 | + while(ctrl_c_rev == 0) { | ||
| 1919 | + usleep(100000); | ||
| 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) | ||
| 1926 | + break; | ||
| 1927 | + } | ||
| 1928 | + } | ||
| 1929 | + | ||
| 1930 | + /* ipu need reset position to 0,0 */ | ||
| 1931 | + pos.x = 0; | ||
| 1932 | + pos.y = 0; | ||
| 1933 | + ioctl(fd_fb, MXCFB_SET_OVERLAY_POS, &pos); | ||
| 1934 | + | ||
| 1935 | + blank = FB_BLANK_POWERDOWN; | ||
| 1936 | + if ( ioctl(fd_fb, FBIOBLANK, blank) < 0) { | ||
| 1937 | + printf("POWERDOWN FB failed!\n"); | ||
| 1938 | + ret = -1; | ||
| 1939 | + goto done; | ||
| 1940 | + } | ||
| 1941 | +err: | ||
| 1942 | + mxc_ipu_lib_task_uninit(test_handle->ipu_handle); | ||
| 1943 | + | ||
| 1944 | +done: | ||
| 1945 | + if (fd_fb) | ||
| 1946 | + close(fd_fb); | ||
| 1947 | + return ret; | ||
| 1948 | +} | ||
| 1949 | + | ||
| 1950 | +void * thread_func_color_bar(void *arg) | ||
| 1951 | +{ | ||
| 1952 | + int ret; | ||
| 1953 | + ipu_test_handle_t test_handle; | ||
| 1954 | + ipu_lib_handle_t ipu_handle; | ||
| 1955 | + | ||
| 1956 | + memset(&ipu_handle, 0, sizeof(ipu_lib_handle_t)); | ||
| 1957 | + memset(&test_handle, 0, sizeof(ipu_test_handle_t)); | ||
| 1958 | + | ||
| 1959 | + test_handle.ipu_handle = &ipu_handle; | ||
| 1960 | + ret = color_bar(NO_OV, &test_handle); | ||
| 1961 | + | ||
| 1962 | + pthread_exit((void*)ret); | ||
| 1963 | + | ||
| 1964 | + return NULL; | ||
| 1965 | +} | ||
| 1966 | + | ||
| 1967 | +void * thread_func_hop_block(void *arg) | ||
| 1968 | +{ | ||
| 1969 | + int ret; | ||
| 1970 | + | ||
| 1971 | + ret = hop_block((ipu_test_handle_t *)arg); | ||
| 1972 | + | ||
| 1973 | + pthread_exit((void*)ret); | ||
| 1974 | + | ||
| 1975 | + return NULL; | ||
| 1976 | +} | ||
| 1977 | + | ||
| 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 */ | ||
| 1986 | +sem_t * semIDUnit; | ||
| 1987 | +const char* semNameUnit="IPU_SL_unit_test"; | ||
| 1988 | + | ||
| 1989 | +/* Vittual address of shared memory in current process */ | ||
| 1990 | +int * vshmUnitTest =NULL; | ||
| 1991 | + | ||
| 1992 | +int getFBInfor(int * pfbWidth, int * pfbHeight, int * pfbBPP ) | ||
| 1993 | +{ | ||
| 1994 | + int ret, fd_fb; | ||
| 1995 | + struct fb_var_screeninfo fb_var; | ||
| 1996 | + struct fb_fix_screeninfo fb_fix; | ||
| 1997 | + | ||
| 1998 | + ret = 0; | ||
| 1999 | + /* get fb info */ | ||
| 2000 | + if ((fd_fb = open(PRIMARYFBDEV, O_RDWR, 0)) < 0) { | ||
| 2001 | + printf("Unable to open /dev/fb0\n"); | ||
| 2002 | + ret = -1; | ||
| 2003 | + goto getFBInfor_err1; | ||
| 2004 | + } | ||
| 2005 | + | ||
| 2006 | + if ( ioctl(fd_fb, FBIOGET_FSCREENINFO, &fb_fix) < 0) { | ||
| 2007 | + printf("Get FB fix info failed!\n"); | ||
| 2008 | + ret = -1; | ||
| 2009 | + goto getFBInfor_err2; | ||
| 2010 | + } | ||
| 2011 | + | ||
| 2012 | + if ( ioctl(fd_fb, FBIOGET_VSCREENINFO, &fb_var) < 0) { | ||
| 2013 | + printf("Get FB var info failed!\n"); | ||
| 2014 | + ret = -1; | ||
| 2015 | + goto getFBInfor_err2; | ||
| 2016 | + } | ||
| 2017 | + *pfbWidth = fb_var.xres; | ||
| 2018 | + *pfbHeight = fb_var.yres; | ||
| 2019 | + *pfbBPP = fb_var.bits_per_pixel; | ||
| 2020 | +getFBInfor_err2: | ||
| 2021 | + close(fd_fb); | ||
| 2022 | +getFBInfor_err1: | ||
| 2023 | + return ret; | ||
| 2024 | +} | ||
| 2025 | +void * first_layer_thread_func(void *arg) | ||
| 2026 | +{ | ||
| 2027 | + int i, ret; | ||
| 2028 | + ScreenLayer first_layer; | ||
| 2029 | + int fb_width, fb_height, fb_bpp; | ||
| 2030 | + int op_type = NO_OV; | ||
| 2031 | + | ||
| 2032 | + if(arg) | ||
| 2033 | + op_type = *((int *)arg); | ||
| 2034 | + | ||
| 2035 | + ret = getFBInfor(&fb_width, &fb_height, &fb_bpp); | ||
| 2036 | + if(ret == -1) | ||
| 2037 | + { | ||
| 2038 | + printf("Can not get fb information. \n"); | ||
| 2039 | + goto err; | ||
| 2040 | + } | ||
| 2041 | + | ||
| 2042 | + memset(&first_layer, 0, sizeof(ScreenLayer)); | ||
| 2043 | + if (fb_bpp == 24) | ||
| 2044 | + first_layer.fmt = v4l2_fourcc('B', 'G', 'R', '3'); | ||
| 2045 | + else | ||
| 2046 | + first_layer.fmt = v4l2_fourcc('R', 'G', 'B', 'P'); | ||
| 2047 | + | ||
| 2048 | + if (op_type & COPY_TV) | ||
| 2049 | + first_layer.fmt = v4l2_fourcc('U', 'Y', 'V', 'Y'); | ||
| 2050 | + | ||
| 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); | ||
| 2056 | + goto err; | ||
| 2057 | + } | ||
| 2058 | + | ||
| 2059 | + i = 0; | ||
| 2060 | + while (i < 50 && !ctrl_c_rev) { | ||
| 2061 | + if (i % 3 == 0) | ||
| 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); | ||
| 2067 | + i++; | ||
| 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); | ||
| 2071 | + goto err1; | ||
| 2072 | + } | ||
| 2073 | + } else { | ||
| 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); | ||
| 2078 | + goto err1; | ||
| 2079 | + } | ||
| 2080 | + } | ||
| 2081 | + sem_post(semIDUnit); | ||
| 2082 | + } | ||
| 2083 | + sleep(2); | ||
| 2084 | + } | ||
| 2085 | +err1: | ||
| 2086 | + while(vshmUnitTest[1] || vshmUnitTest[2])sleep(1); | ||
| 2087 | + DestoryScreenLayer(&first_layer); | ||
| 2088 | +err: | ||
| 2089 | + printf("First layer has been destroyed! \n"); | ||
| 2090 | + return NULL; | ||
| 2091 | +} | ||
| 2092 | + | ||
| 2093 | +void * second_layer_thread_func(void *arg) | ||
| 2094 | +{ | ||
| 2095 | + ScreenLayer second_layer; | ||
| 2096 | + LoadParam param; | ||
| 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; | ||
| 2104 | + char alpha_val; | ||
| 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; | ||
| 2110 | + | ||
| 2111 | + ret = getFBInfor(&fb_width, &fb_height, &fb_bpp); | ||
| 2112 | + if(ret == -1) | ||
| 2113 | + { | ||
| 2114 | + printf("Can not get fb information. \n"); | ||
| 2115 | + goto err; | ||
| 2116 | + } | ||
| 2117 | + | ||
| 2118 | + memset(&second_layer, 0, sizeof(ScreenLayer)); | ||
| 2119 | + | ||
| 2120 | + i=100; | ||
| 2121 | + while(i) | ||
| 2122 | + { | ||
| 2123 | + i--; | ||
| 2124 | + second_layer.pPrimary = GetPrimarySLHandle(PRIMARYFBDEV); | ||
| 2125 | + if(second_layer.pPrimary == NULL) | ||
| 2126 | + usleep(200*1000); | ||
| 2127 | + else | ||
| 2128 | + break; | ||
| 2129 | + } | ||
| 2130 | + if(i==0) | ||
| 2131 | + { | ||
| 2132 | + printf("Should create primary layer firstly. \n"); | ||
| 2133 | + ret = -1; | ||
| 2134 | + goto err; | ||
| 2135 | + } | ||
| 2136 | + | ||
| 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'); | ||
| 2150 | + else | ||
| 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); | ||
| 2157 | + goto err; | ||
| 2158 | + } | ||
| 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); | ||
| 2170 | + goto err1; | ||
| 2171 | + } | ||
| 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); | ||
| 2175 | + goto err1; | ||
| 2176 | + } | ||
| 2177 | + | ||
| 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); | ||
| 2185 | + goto err1; | ||
| 2186 | + } | ||
| 2187 | + } | ||
| 2188 | + | ||
| 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; | ||
| 2201 | + | ||
| 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; | ||
| 2216 | + } | ||
| 2217 | + | ||
| 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); | ||
| 2222 | + if ( ret < 0) { | ||
| 2223 | + printf("dma_memory_alloc failed\n"); | ||
| 2224 | + goto err1; | ||
| 2225 | + } | ||
| 2226 | + | ||
| 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; | ||
| 2231 | + int sec, usec; | ||
| 2232 | + | ||
| 2233 | + if (ctrl_c_rev) | ||
| 2234 | + break; | ||
| 2235 | + | ||
| 2236 | + param.srcPaddr = paddr_2nd[i%bufcnt]; | ||
| 2237 | + gen_fill_pattern(buf_2nd[i%bufcnt], param.srcWidth, param.srcHeight); | ||
| 2238 | + | ||
| 2239 | + gettimeofday(&frame_begin, NULL); | ||
| 2240 | + gettimeofday(&load_begin, NULL); | ||
| 2241 | + | ||
| 2242 | + if ((ret = LoadScreenLayer(&second_layer, ¶m, i%bufcnt)) != E_RET_SUCCESS) { | ||
| 2243 | + printf("LoadScreenLayer err %d\n", ret); | ||
| 2244 | + goto err2; | ||
| 2245 | + } | ||
| 2246 | + | ||
| 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); | ||
| 2251 | + goto err2; | ||
| 2252 | + } | ||
| 2253 | + } | ||
| 2254 | + gettimeofday(&load_end, NULL); | ||
| 2255 | + | ||
| 2256 | + sec = load_end.tv_sec - load_begin.tv_sec; | ||
| 2257 | + usec = load_end.tv_usec - load_begin.tv_usec; | ||
| 2258 | + | ||
| 2259 | + if (usec < 0) { | ||
| 2260 | + sec--; | ||
| 2261 | + usec = usec + 1000000; | ||
| 2262 | + } | ||
| 2263 | + load_time += (sec * 1000000) + usec; | ||
| 2264 | + | ||
| 2265 | + gettimeofday(&frame_end, NULL); | ||
| 2266 | + | ||
| 2267 | + sec = frame_end.tv_sec - frame_begin.tv_sec; | ||
| 2268 | + usec = frame_end.tv_usec - frame_begin.tv_usec; | ||
| 2269 | + | ||
| 2270 | + if (usec < 0) { | ||
| 2271 | + sec--; | ||
| 2272 | + usec = usec + 1000000; | ||
| 2273 | + } | ||
| 2274 | + show_time += (sec * 1000000) + usec; | ||
| 2275 | + | ||
| 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) { | ||
| 2280 | + alpha_val = 0x80; | ||
| 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) { | ||
| 2285 | + alpha_val = 0x00; | ||
| 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) { | ||
| 2290 | + alpha_val = 0xFF; | ||
| 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); | ||
| 2294 | + } | ||
| 2295 | + } | ||
| 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) { | ||
| 2300 | + alpha_val = 0x80; | ||
| 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) { | ||
| 2305 | + alpha_val = 0x00; | ||
| 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) { | ||
| 2310 | + alpha_val = 0xFF; | ||
| 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); | ||
| 2314 | + } | ||
| 2315 | + } | ||
| 2316 | + | ||
| 2317 | + gettimeofday(&frame_begin, NULL); | ||
| 2318 | + gettimeofday(&update_begin, NULL); | ||
| 2319 | + | ||
| 2320 | + if ((ret = FlipScreenLayerBuf(&second_layer, i%bufcnt)) != E_RET_SUCCESS) { | ||
| 2321 | + printf("FlipScreenLayerBuf err %d\n", ret); | ||
| 2322 | + goto err2; | ||
| 2323 | + } | ||
| 2324 | + | ||
| 2325 | + sem_wait(semIDUnit); | ||
| 2326 | + if (!vshmUnitTest[2]) { | ||
| 2327 | + if ((ret = UpdateScreenLayer(&second_layer)) != E_RET_SUCCESS) { | ||
| 2328 | + printf("UpdateScreenLayer err %d\n",ret); | ||
| 2329 | + goto err2; | ||
| 2330 | + } | ||
| 2331 | + } | ||
| 2332 | + sem_post(semIDUnit); | ||
| 2333 | + | ||
| 2334 | + gettimeofday(&update_end, NULL); | ||
| 2335 | + | ||
| 2336 | + sec = update_end.tv_sec - update_begin.tv_sec; | ||
| 2337 | + usec = update_end.tv_usec - update_begin.tv_usec; | ||
| 2338 | + | ||
| 2339 | + if (usec < 0) { | ||
| 2340 | + sec--; | ||
| 2341 | + usec = usec + 1000000; | ||
| 2342 | + } | ||
| 2343 | + update_time += (sec * 1000000) + usec; | ||
| 2344 | + | ||
| 2345 | + gettimeofday(&frame_end, NULL); | ||
| 2346 | + | ||
| 2347 | + sec = frame_end.tv_sec - frame_begin.tv_sec; | ||
| 2348 | + usec = frame_end.tv_usec - frame_begin.tv_usec; | ||
| 2349 | + | ||
| 2350 | + if (usec < 0) { | ||
| 2351 | + sec--; | ||
| 2352 | + usec = usec + 1000000; | ||
| 2353 | + } | ||
| 2354 | + show_time += (sec * 1000000) + usec; | ||
| 2355 | + } | ||
| 2356 | + | ||
| 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); | ||
| 2360 | + | ||
| 2361 | +err2: | ||
| 2362 | + dma_memory_free(buf_size, bufcnt, paddr_2nd, buf_2nd); | ||
| 2363 | +err1: | ||
| 2364 | + DestoryScreenLayer(&second_layer); | ||
| 2365 | +err: | ||
| 2366 | + sem_wait(semIDUnit); | ||
| 2367 | + vshmUnitTest[1] = 0; | ||
| 2368 | + sem_post(semIDUnit); | ||
| 2369 | + printf("Second layer has been destroyed! \n"); | ||
| 2370 | + return NULL; | ||
| 2371 | +} | ||
| 2372 | + | ||
| 2373 | +void * third_layer_thread_func(void *arg) | ||
| 2374 | +{ | ||
| 2375 | + ScreenLayer third_layer; | ||
| 2376 | + LoadParam param; | ||
| 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; | ||
| 2383 | + char alpha_val; | ||
| 2384 | + int fb_width, fb_height, fb_bpp; | ||
| 2385 | + int show_time = 0; | ||
| 2386 | + | ||
| 2387 | + ret = getFBInfor(&fb_width, &fb_height, &fb_bpp); | ||
| 2388 | + if(ret == -1) | ||
| 2389 | + { | ||
| 2390 | + printf("Can not get fb information. \n"); | ||
| 2391 | + goto err; | ||
| 2392 | + } | ||
| 2393 | + | ||
| 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'); | ||
| 2406 | + else | ||
| 2407 | + third_layer.fmt = v4l2_fourcc('R', 'G', 'B', 'P'); | ||
| 2408 | + i=100; | ||
| 2409 | + while(i) | ||
| 2410 | + { | ||
| 2411 | + i--; | ||
| 2412 | + third_layer.pPrimary = GetPrimarySLHandle(PRIMARYFBDEV); | ||
| 2413 | + if(third_layer.pPrimary == NULL) | ||
| 2414 | + usleep(20*1000); | ||
| 2415 | + else | ||
| 2416 | + break; | ||
| 2417 | + } | ||
| 2418 | + if(i==0) | ||
| 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); | ||
| 2425 | + goto err; | ||
| 2426 | + } | ||
| 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); | ||
| 2438 | + goto err1; | ||
| 2439 | + } | ||
| 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); | ||
| 2443 | + goto err1; | ||
| 2444 | + } | ||
| 2445 | + | ||
| 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); | ||
| 2462 | + if ( ret < 0) { | ||
| 2463 | + printf("dma_memory_alloc failed\n"); | ||
| 2464 | + goto err1; | ||
| 2465 | + } | ||
| 2466 | + | ||
| 2467 | + for (i=0;i<FRM_CNT;i++) { | ||
| 2468 | + struct timeval frame_begin,frame_end; | ||
| 2469 | + int sec, usec; | ||
| 2470 | + | ||
| 2471 | + if (ctrl_c_rev) | ||
| 2472 | + break; | ||
| 2473 | + | ||
| 2474 | + param.srcPaddr = paddr_3th[i%BUFCNT_3TH]; | ||
| 2475 | + gen_fill_pattern(buf_3th[i%BUFCNT_3TH], param.srcWidth, param.srcHeight); | ||
| 2476 | + | ||
| 2477 | + gettimeofday(&frame_begin, NULL); | ||
| 2478 | + | ||
| 2479 | + if ((ret = LoadScreenLayer(&third_layer, ¶m, i%BUFCNT_3TH)) != E_RET_SUCCESS) { | ||
| 2480 | + printf("LoadScreenLayer err %d\n", ret); | ||
| 2481 | + goto err2; | ||
| 2482 | + } | ||
| 2483 | + | ||
| 2484 | + gettimeofday(&frame_end, NULL); | ||
| 2485 | + | ||
| 2486 | + sec = frame_end.tv_sec - frame_begin.tv_sec; | ||
| 2487 | + usec = frame_end.tv_usec - frame_begin.tv_usec; | ||
| 2488 | + | ||
| 2489 | + if (usec < 0) { | ||
| 2490 | + sec--; | ||
| 2491 | + usec = usec + 1000000; | ||
| 2492 | + } | ||
| 2493 | + show_time += (sec * 1000000) + usec; | ||
| 2494 | + | ||
| 2495 | + /* Fill local alpha buffer */ | ||
| 2496 | + if (op_type & IC_LOC_SEP_ALP_OV) { | ||
| 2497 | + if(i < FRM_CNT/3) | ||
| 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); | ||
| 2503 | + } | ||
| 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) { | ||
| 2508 | + alpha_val = 0x80; | ||
| 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) { | ||
| 2513 | + alpha_val = 0x00; | ||
| 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) { | ||
| 2518 | + alpha_val = 0xFF; | ||
| 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); | ||
| 2522 | + } | ||
| 2523 | + } | ||
| 2524 | + | ||
| 2525 | + gettimeofday(&frame_begin, NULL); | ||
| 2526 | + | ||
| 2527 | + if ((ret = FlipScreenLayerBuf(&third_layer, i%BUFCNT_3TH)) != E_RET_SUCCESS) { | ||
| 2528 | + printf("FlipScreenLayerBuf err %d\n", ret); | ||
| 2529 | + goto err2; | ||
| 2530 | + } | ||
| 2531 | + | ||
| 2532 | + if ((ret = UpdateScreenLayer(&third_layer)) != E_RET_SUCCESS) { | ||
| 2533 | + printf("UpdateScreenLayer err %d\n",ret); | ||
| 2534 | + goto err2; | ||
| 2535 | + } | ||
| 2536 | + | ||
| 2537 | + gettimeofday(&frame_end, NULL); | ||
| 2538 | + | ||
| 2539 | + sec = frame_end.tv_sec - frame_begin.tv_sec; | ||
| 2540 | + usec = frame_end.tv_usec - frame_begin.tv_usec; | ||
| 2541 | + | ||
| 2542 | + if (usec < 0) { | ||
| 2543 | + sec--; | ||
| 2544 | + usec = usec + 1000000; | ||
| 2545 | + } | ||
| 2546 | + show_time += (sec * 1000000) + usec; | ||
| 2547 | + | ||
| 2548 | + /* screenlayer should not update fast than lcd refresh rate*/ | ||
| 2549 | + usleep(10000); | ||
| 2550 | + } | ||
| 2551 | + | ||
| 2552 | + printf("3rd layer avg frame time %d us\n", show_time/i); | ||
| 2553 | + | ||
| 2554 | +err2: | ||
| 2555 | + dma_memory_free(buf_size, BUFCNT_3TH, paddr_3th, buf_3th); | ||
| 2556 | +err1: | ||
| 2557 | + DestoryScreenLayer(&third_layer); | ||
| 2558 | +err: | ||
| 2559 | + sem_wait(semIDUnit); | ||
| 2560 | + vshmUnitTest[2] = 0; | ||
| 2561 | + sem_post(semIDUnit); | ||
| 2562 | + printf("Third layer has been destroyed! \n"); | ||
| 2563 | + return NULL; | ||
| 2564 | +} | ||
| 2565 | + | ||
| 2566 | +int screenlayer_test(int three_layer, int op_type) | ||
| 2567 | +{ | ||
| 2568 | + pthread_t first_layer_thread; | ||
| 2569 | + pthread_t second_layer_thread; | ||
| 2570 | + pthread_t third_layer_thread; | ||
| 2571 | + int ret; | ||
| 2572 | + int shmIDUnit; | ||
| 2573 | + struct stat shmStat; | ||
| 2574 | + char shmNameUnit[32]="shm_name_unit_test"; | ||
| 2575 | + | ||
| 2576 | + ret = 0; | ||
| 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"); | ||
| 2580 | + ret = -1; | ||
| 2581 | + goto done; | ||
| 2582 | + } | ||
| 2583 | + | ||
| 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"); | ||
| 2587 | + ret = -1; | ||
| 2588 | + sem_close(semIDUnit); | ||
| 2589 | + goto done; | ||
| 2590 | + } | ||
| 2591 | + /* Get special size shm */ | ||
| 2592 | + ftruncate(shmIDUnit,3 * sizeof(int)); | ||
| 2593 | + /* Connect to the shm */ | ||
| 2594 | + fstat(shmIDUnit, &shmStat); | ||
| 2595 | + | ||
| 2596 | + if(vshmUnitTest == NULL) | ||
| 2597 | + vshmUnitTest = (int *)mmap(NULL,shmStat.st_size,PROT_READ|PROT_WRITE,MAP_SHARED,shmIDUnit,0); | ||
| 2598 | + | ||
| 2599 | + if(vshmUnitTest == MAP_FAILED || vshmUnitTest ==NULL) | ||
| 2600 | + { | ||
| 2601 | + ret = -1; | ||
| 2602 | + sem_close(semIDUnit); | ||
| 2603 | + shm_unlink(shmNameUnit); | ||
| 2604 | + goto done; | ||
| 2605 | + } | ||
| 2606 | + memset(vshmUnitTest, 0, 3 *sizeof(int)); | ||
| 2607 | + | ||
| 2608 | + /* create first layer */ | ||
| 2609 | + printf("Display to primary layer!\n"); | ||
| 2610 | + pthread_create(&first_layer_thread, NULL, first_layer_thread_func, NULL); | ||
| 2611 | + | ||
| 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); | ||
| 2616 | + | ||
| 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); | ||
| 2622 | + } | ||
| 2623 | + | ||
| 2624 | + while(!ctrl_c_rev)usleep(100000); | ||
| 2625 | + | ||
| 2626 | + if (three_layer) | ||
| 2627 | + pthread_join(third_layer_thread, NULL); | ||
| 2628 | + pthread_join(second_layer_thread, NULL); | ||
| 2629 | + pthread_join(first_layer_thread, NULL); | ||
| 2630 | + | ||
| 2631 | + sem_unlink(semNameUnit); | ||
| 2632 | + shm_unlink(shmNameUnit); | ||
| 2633 | +done: | ||
| 2634 | + return ret; | ||
| 2635 | +} | ||
| 2636 | +/* | ||
| 2637 | +** ProcessA: First_layer & second_layer | ||
| 2638 | +** ProcessB: Third_layer | ||
| 2639 | +*/ | ||
| 2640 | +int screenlayer_test_ipc(int process_num, int three_layer, int op_type) | ||
| 2641 | +{ | ||
| 2642 | + pthread_t first_layer_thread; | ||
| 2643 | + pthread_t second_layer_thread; | ||
| 2644 | + pthread_t third_layer_thread; | ||
| 2645 | + int ret; | ||
| 2646 | + int shmIDUnit; | ||
| 2647 | + struct stat shmStat; | ||
| 2648 | + char shmNameUnit[32]="shm_name_unit_test"; | ||
| 2649 | + | ||
| 2650 | + ret = 0; | ||
| 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"); | ||
| 2654 | + ret = -1; | ||
| 2655 | + goto done; | ||
| 2656 | + } | ||
| 2657 | + | ||
| 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"); | ||
| 2661 | + ret = -1; | ||
| 2662 | + sem_close(semIDUnit); | ||
| 2663 | + goto done; | ||
| 2664 | + } | ||
| 2665 | + /* Get special size shm */ | ||
| 2666 | + ftruncate(shmIDUnit,3 * sizeof(int)); | ||
| 2667 | + /* Connect to the shm */ | ||
| 2668 | + fstat(shmIDUnit, &shmStat); | ||
| 2669 | + | ||
| 2670 | + if(vshmUnitTest == NULL) | ||
| 2671 | + vshmUnitTest = (int *)mmap(NULL,shmStat.st_size,PROT_READ|PROT_WRITE,MAP_SHARED,shmIDUnit,0); | ||
| 2672 | + | ||
| 2673 | + if(vshmUnitTest == MAP_FAILED || vshmUnitTest ==NULL) | ||
| 2674 | + { | ||
| 2675 | + ret = -1; | ||
| 2676 | + sem_close(semIDUnit); | ||
| 2677 | + shm_unlink(shmNameUnit); | ||
| 2678 | + goto done; | ||
| 2679 | + } | ||
| 2680 | + memset(vshmUnitTest, 0, 3 *sizeof(int)); | ||
| 2681 | + vshmUnitTest[1] = 1; | ||
| 2682 | + | ||
| 2683 | + /* Two process cases*/ | ||
| 2684 | + if(process_num == 2) | ||
| 2685 | + { | ||
| 2686 | + if(three_layer) vshmUnitTest[2] = 1; | ||
| 2687 | + /* Process A */ | ||
| 2688 | + if(fork() != 0) | ||
| 2689 | + { | ||
| 2690 | + /* create first layer */ | ||
| 2691 | + printf("Display to primary layer!\n"); | ||
| 2692 | + pthread_create(&first_layer_thread, NULL, first_layer_thread_func, &op_type); | ||
| 2693 | + | ||
| 2694 | + if(three_layer) | ||
| 2695 | + { | ||
| 2696 | + /* create second layer */ | ||
| 2697 | + sleep(2); | ||
| 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); | ||
| 2701 | + } | ||
| 2702 | + | ||
| 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"); | ||
| 2707 | + exit(0); | ||
| 2708 | + }else{ | ||
| 2709 | + /* Process B */ | ||
| 2710 | + sleep(2); | ||
| 2711 | + if(three_layer) | ||
| 2712 | + { | ||
| 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); | ||
| 2717 | + } else | ||
| 2718 | + { | ||
| 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); | ||
| 2723 | + } | ||
| 2724 | + printf("SL IPC: Process B has been exited. \n"); | ||
| 2725 | + } | ||
| 2726 | + sem_unlink(semNameUnit); | ||
| 2727 | + shm_unlink(shmNameUnit); | ||
| 2728 | + exit(0); | ||
| 2729 | + }else if(process_num ==3) | ||
| 2730 | + { | ||
| 2731 | + vshmUnitTest[2] = 1; | ||
| 2732 | + /* Process A */ | ||
| 2733 | + if(fork()!=0) | ||
| 2734 | + { | ||
| 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"); | ||
| 2742 | + exit(0); | ||
| 2743 | + }else{ | ||
| 2744 | + /* Process B */ | ||
| 2745 | + if(fork()==0) | ||
| 2746 | + { | ||
| 2747 | + /* create second layer */ | ||
| 2748 | + sleep(2); | ||
| 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"); | ||
| 2755 | + exit(0); | ||
| 2756 | + } | ||
| 2757 | + else | ||
| 2758 | + { | ||
| 2759 | + /* Process C */ | ||
| 2760 | + /* create third layer */ | ||
| 2761 | + sleep(2); | ||
| 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"); | ||
| 2768 | + exit(0); | ||
| 2769 | + } | ||
| 2770 | + | ||
| 2771 | + } | ||
| 2772 | + } | ||
| 2773 | + | ||
| 2774 | +done: | ||
| 2775 | + return ret; | ||
| 2776 | +} | ||
| 2777 | +#endif | ||
| 2778 | + | ||
| 2779 | +int run_test_pattern(int pattern, ipu_test_handle_t * test_handle) | ||
| 2780 | +{ | ||
| 2781 | + if (pattern == 1) { | ||
| 2782 | + printf("Color bar test with full-screen:\n"); | ||
| 2783 | + return color_bar(NO_OV, test_handle); | ||
| 2784 | + } | ||
| 2785 | + if (pattern == 2) { | ||
| 2786 | + printf("Hopping block test:\n"); | ||
| 2787 | + return hop_block(test_handle); | ||
| 2788 | + } | ||
| 2789 | + if (pattern == 3) { | ||
| 2790 | + int ret=0; | ||
| 2791 | + int ret1=0; | ||
| 2792 | + int ret2=0; | ||
| 2793 | + pthread_t thread1; | ||
| 2794 | + pthread_t thread2; | ||
| 2795 | + | ||
| 2796 | + printf("Hopping block + color bar thread test:\n"); | ||
| 2797 | + | ||
| 2798 | + pthread_create(&thread2, NULL, thread_func_hop_block, test_handle); | ||
| 2799 | + pthread_create(&thread1, NULL, thread_func_color_bar, NULL); | ||
| 2800 | + | ||
| 2801 | + sleep(1); | ||
| 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) | ||
| 2806 | + ret = 0; | ||
| 2807 | + else | ||
| 2808 | + ret = -1; | ||
| 2809 | + return ret; | ||
| 2810 | + } | ||
| 2811 | + if (pattern == 4) { | ||
| 2812 | + printf("Color bar IC global alpha overlay test:\n"); | ||
| 2813 | + return color_bar(IC_GLB_ALP_OV, test_handle); | ||
| 2814 | + } | ||
| 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); | ||
| 2818 | + } | ||
| 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); | ||
| 2822 | + } | ||
| 2823 | + if (pattern == 7) { | ||
| 2824 | + printf("Copy test:\n"); | ||
| 2825 | + return copy_test(test_handle); | ||
| 2826 | + } | ||
| 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); | ||
| 2831 | + } | ||
| 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); | ||
| 2835 | + } | ||
| 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); | ||
| 2839 | + } | ||
| 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); | ||
| 2843 | + } | ||
| 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); | ||
| 2847 | + } | ||
| 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); | ||
| 2851 | + } | ||
| 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); | ||
| 2855 | + } | ||
| 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); | ||
| 2859 | + } | ||
| 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); | ||
| 2863 | + } | ||
| 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); | ||
| 2867 | + } | ||
| 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); | ||
| 2871 | + } | ||
| 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); | ||
| 2875 | + } | ||
| 2876 | +#endif | ||
| 2877 | + | ||
| 2878 | + printf("No such test pattern %d\n", pattern); | ||
| 2879 | + return -1; | ||
| 2880 | +} | ||
| 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) | ||
| 2886 | |||
| 2887 | int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 2888 | { | ||
| 2889 | - struct ipu_task *t = &test_handle->task; | ||
| 2890 | char *str; | ||
| 2891 | |||
| 2892 | /* general */ | ||
| 2893 | - str = strstr(buf, "priority"); | ||
| 2894 | + str = strstr(buf, "mode"); | ||
| 2895 | if (str != NULL) { | ||
| 2896 | str = index(buf, '='); | ||
| 2897 | if (str != NULL) { | ||
| 2898 | str++; | ||
| 2899 | if (*str != '\0') { | ||
| 2900 | - t->priority = strtol(str, NULL, 10); | ||
| 2901 | - printf("priority\t= %d\n", t->priority); | ||
| 2902 | - } | ||
| 2903 | - return 0; | ||
| 2904 | - } | ||
| 2905 | - } | ||
| 2906 | - | ||
| 2907 | - str = strstr(buf, "task_id"); | ||
| 2908 | - if (str != NULL) { | ||
| 2909 | - str = index(buf, '='); | ||
| 2910 | - if (str != NULL) { | ||
| 2911 | - str++; | ||
| 2912 | - if (*str != '\0') { | ||
| 2913 | - t->task_id = strtol(str, NULL, 10); | ||
| 2914 | - printf("task_id\t\t= %d\n", t->task_id); | ||
| 2915 | - } | ||
| 2916 | - return 0; | ||
| 2917 | - } | ||
| 2918 | - } | ||
| 2919 | - | ||
| 2920 | - str = strstr(buf, "timeout"); | ||
| 2921 | - if (str != NULL) { | ||
| 2922 | - str = index(buf, '='); | ||
| 2923 | - if (str != NULL) { | ||
| 2924 | - str++; | ||
| 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); | ||
| 2930 | } | ||
| 2931 | return 0; | ||
| 2932 | } | ||
| 2933 | @@ -127,8 +100,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 2934 | if (str != NULL) { | ||
| 2935 | str++; | ||
| 2936 | if (*str != '\0') { | ||
| 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); | ||
| 2941 | } | ||
| 2942 | return 0; | ||
| 2943 | } | ||
| 2944 | @@ -140,8 +113,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 2945 | if (str != NULL) { | ||
| 2946 | str++; | ||
| 2947 | if (*str != '\0') { | ||
| 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); | ||
| 2952 | } | ||
| 2953 | return 0; | ||
| 2954 | } | ||
| 2955 | @@ -153,7 +126,7 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 2956 | if (str != NULL) { | ||
| 2957 | str++; | ||
| 2958 | if (*str != '\0') { | ||
| 2959 | - t->input.format = | ||
| 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); | ||
| 2963 | } | ||
| 2964 | @@ -167,10 +140,10 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 2965 | if (str != NULL) { | ||
| 2966 | str++; | ||
| 2967 | if (*str != '\0') { | ||
| 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); | ||
| 2974 | } | ||
| 2975 | return 0; | ||
| 2976 | } | ||
| 2977 | @@ -182,55 +155,40 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 2978 | if (str != NULL) { | ||
| 2979 | str++; | ||
| 2980 | if (*str != '\0') { | ||
| 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); | ||
| 2987 | } | ||
| 2988 | return 0; | ||
| 2989 | } | ||
| 2990 | } | ||
| 2991 | |||
| 2992 | - str = strstr(buf, "in_crop_w"); | ||
| 2993 | + str = strstr(buf, "in_win_w"); | ||
| 2994 | if (str != NULL) { | ||
| 2995 | str = index(buf, '='); | ||
| 2996 | if (str != NULL) { | ||
| 2997 | str++; | ||
| 2998 | if (*str != '\0') { | ||
| 2999 | - t->input.crop.w = | ||
| 3000 | + test_handle->input.input_crop_win.win_w = | ||
| 3001 | strtol(str, NULL, 10); | ||
| 3002 | - printf("in_crop_w\t= %d\n", | ||
| 3003 | - t->input.crop.w); | ||
| 3004 | + printf("in_win_w\t= %d\n", | ||
| 3005 | + test_handle->input.input_crop_win.win_w); | ||
| 3006 | } | ||
| 3007 | return 0; | ||
| 3008 | } | ||
| 3009 | } | ||
| 3010 | |||
| 3011 | - str = strstr(buf, "in_crop_h"); | ||
| 3012 | + str = strstr(buf, "in_win_h"); | ||
| 3013 | if (str != NULL) { | ||
| 3014 | str = index(buf, '='); | ||
| 3015 | if (str != NULL) { | ||
| 3016 | str++; | ||
| 3017 | if (*str != '\0') { | ||
| 3018 | - t->input.crop.h = | ||
| 3019 | + test_handle->input.input_crop_win.win_h = | ||
| 3020 | strtol(str, NULL, 10); | ||
| 3021 | - printf("in_crop_h\t= %d\n", | ||
| 3022 | - t->input.crop.h); | ||
| 3023 | - } | ||
| 3024 | - return 0; | ||
| 3025 | - } | ||
| 3026 | - } | ||
| 3027 | - | ||
| 3028 | - str = strstr(buf, "deinterlace_en"); | ||
| 3029 | - if (str != NULL) { | ||
| 3030 | - str = index(buf, '='); | ||
| 3031 | - if (str != NULL) { | ||
| 3032 | - str++; | ||
| 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); | ||
| 3040 | } | ||
| 3041 | return 0; | ||
| 3042 | } | ||
| 3043 | @@ -242,184 +200,10 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 3044 | if (str != NULL) { | ||
| 3045 | str++; | ||
| 3046 | if (*str != '\0') { | ||
| 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); | ||
| 3052 | - } | ||
| 3053 | - return 0; | ||
| 3054 | - } | ||
| 3055 | - } | ||
| 3056 | - | ||
| 3057 | - /* overlay */ | ||
| 3058 | - str = strstr(buf, "overlay_en"); | ||
| 3059 | - if (str != NULL) { | ||
| 3060 | - str = index(buf, '='); | ||
| 3061 | - if (str != NULL) { | ||
| 3062 | - str++; | ||
| 3063 | - if (*str != '\0') { | ||
| 3064 | - t->overlay_en = strtol(str, NULL, 10); | ||
| 3065 | - printf("overlay_en\t= %d\n", t->overlay_en); | ||
| 3066 | - } | ||
| 3067 | - return 0; | ||
| 3068 | - } | ||
| 3069 | - } | ||
| 3070 | - | ||
| 3071 | - str = strstr(buf, "ov_width"); | ||
| 3072 | - if (str != NULL) { | ||
| 3073 | - str = index(buf, '='); | ||
| 3074 | - if (str != NULL) { | ||
| 3075 | - str++; | ||
| 3076 | - if (*str != '\0') { | ||
| 3077 | - t->overlay.width = strtol(str, NULL, 10); | ||
| 3078 | - printf("ov_width\t= %d\n", t->overlay.width); | ||
| 3079 | - } | ||
| 3080 | - return 0; | ||
| 3081 | - } | ||
| 3082 | - } | ||
| 3083 | - | ||
| 3084 | - str = strstr(buf, "ov_height"); | ||
| 3085 | - if (str != NULL) { | ||
| 3086 | - str = index(buf, '='); | ||
| 3087 | - if (str != NULL) { | ||
| 3088 | - str++; | ||
| 3089 | - if (*str != '\0') { | ||
| 3090 | - t->overlay.height = strtol(str, NULL, 10); | ||
| 3091 | - printf("ov_height\t= %d\n", t->overlay.height); | ||
| 3092 | - } | ||
| 3093 | - return 0; | ||
| 3094 | - } | ||
| 3095 | - } | ||
| 3096 | - | ||
| 3097 | - str = strstr(buf, "ov_fmt"); | ||
| 3098 | - if (str != NULL) { | ||
| 3099 | - str = index(buf, '='); | ||
| 3100 | - if (str != NULL) { | ||
| 3101 | - str++; | ||
| 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); | ||
| 3106 | - } | ||
| 3107 | - return 0; | ||
| 3108 | - } | ||
| 3109 | - } | ||
| 3110 | - | ||
| 3111 | - str = strstr(buf, "ov_posx"); | ||
| 3112 | - if (str != NULL) { | ||
| 3113 | - str = index(buf, '='); | ||
| 3114 | - if (str != NULL) { | ||
| 3115 | - str++; | ||
| 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); | ||
| 3121 | - } | ||
| 3122 | - return 0; | ||
| 3123 | - } | ||
| 3124 | - } | ||
| 3125 | - | ||
| 3126 | - str = strstr(buf, "ov_posy"); | ||
| 3127 | - if (str != NULL) { | ||
| 3128 | - str = index(buf, '='); | ||
| 3129 | - if (str != NULL) { | ||
| 3130 | - str++; | ||
| 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); | ||
| 3136 | - } | ||
| 3137 | - return 0; | ||
| 3138 | - } | ||
| 3139 | - } | ||
| 3140 | - | ||
| 3141 | - str = strstr(buf, "ov_crop_w"); | ||
| 3142 | - if (str != NULL) { | ||
| 3143 | - str = index(buf, '='); | ||
| 3144 | - if (str != NULL) { | ||
| 3145 | - str++; | ||
| 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); | ||
| 3151 | - } | ||
| 3152 | - return 0; | ||
| 3153 | - } | ||
| 3154 | - } | ||
| 3155 | - | ||
| 3156 | - str = strstr(buf, "ov_crop_h"); | ||
| 3157 | - if (str != NULL) { | ||
| 3158 | - str = index(buf, '='); | ||
| 3159 | - if (str != NULL) { | ||
| 3160 | - str++; | ||
| 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); | ||
| 3166 | - } | ||
| 3167 | - return 0; | ||
| 3168 | - } | ||
| 3169 | - } | ||
| 3170 | - | ||
| 3171 | - str = strstr(buf, "alpha_mode"); | ||
| 3172 | - if (str != NULL) { | ||
| 3173 | - str = index(buf, '='); | ||
| 3174 | - if (str != NULL) { | ||
| 3175 | - str++; | ||
| 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); | ||
| 3181 | - } | ||
| 3182 | - return 0; | ||
| 3183 | - } | ||
| 3184 | - } | ||
| 3185 | - | ||
| 3186 | - str = strstr(buf, "alpha_value"); | ||
| 3187 | - if (str != NULL) { | ||
| 3188 | - str = index(buf, '='); | ||
| 3189 | - if (str != NULL) { | ||
| 3190 | - str++; | ||
| 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); | ||
| 3196 | - } | ||
| 3197 | - return 0; | ||
| 3198 | - } | ||
| 3199 | - } | ||
| 3200 | - | ||
| 3201 | - str = strstr(buf, "colorkey_en"); | ||
| 3202 | - if (str != NULL) { | ||
| 3203 | - str = index(buf, '='); | ||
| 3204 | - if (str != NULL) { | ||
| 3205 | - str++; | ||
| 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); | ||
| 3211 | - } | ||
| 3212 | - return 0; | ||
| 3213 | - } | ||
| 3214 | - } | ||
| 3215 | - | ||
| 3216 | - str = strstr(buf, "colorkey_value"); | ||
| 3217 | - if (str != NULL) { | ||
| 3218 | - str = index(buf, '='); | ||
| 3219 | - if (str != NULL) { | ||
| 3220 | - str++; | ||
| 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); | ||
| 3227 | } | ||
| 3228 | return 0; | ||
| 3229 | } | ||
| 3230 | @@ -432,8 +216,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 3231 | if (str != NULL) { | ||
| 3232 | str++; | ||
| 3233 | if (*str != '\0') { | ||
| 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); | ||
| 3238 | } | ||
| 3239 | return 0; | ||
| 3240 | } | ||
| 3241 | @@ -445,8 +229,8 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 3242 | if (str != NULL) { | ||
| 3243 | str++; | ||
| 3244 | if (*str != '\0') { | ||
| 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); | ||
| 3249 | } | ||
| 3250 | return 0; | ||
| 3251 | } | ||
| 3252 | @@ -458,7 +242,7 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 3253 | if (str != NULL) { | ||
| 3254 | str++; | ||
| 3255 | if (*str != '\0') { | ||
| 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); | ||
| 3260 | } | ||
| 3261 | @@ -472,77 +256,60 @@ int parse_options(char *buf, ipu_test_handle_t *test_handle) | ||
| 3262 | if (str != NULL) { | ||
| 3263 | str++; | ||
| 3264 | if (*str != '\0') { | ||
| 3265 | - t->output.rotate = strtol(str, NULL, 10); | ||
| 3266 | - printf("out_rot\t\t= %d\n", t->output.rotate); | ||
| 3267 | - } | ||
| 3268 | - return 0; | ||
| 3269 | - } | ||
| 3270 | - } | ||
| 3271 | - | ||
| 3272 | - str = strstr(buf, "out_posx"); | ||
| 3273 | - if (str != NULL) { | ||
| 3274 | - str = index(buf, '='); | ||
| 3275 | - if (str != NULL) { | ||
| 3276 | - str++; | ||
| 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); | ||
| 3282 | } | ||
| 3283 | return 0; | ||
| 3284 | } | ||
| 3285 | } | ||
| 3286 | |||
| 3287 | - str = strstr(buf, "out_posy"); | ||
| 3288 | + str = strstr(buf, "out_to_fb"); | ||
| 3289 | if (str != NULL) { | ||
| 3290 | str = index(buf, '='); | ||
| 3291 | if (str != NULL) { | ||
| 3292 | str++; | ||
| 3293 | if (*str != '\0') { | ||
| 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); | ||
| 3298 | } | ||
| 3299 | return 0; | ||
| 3300 | } | ||
| 3301 | } | ||
| 3302 | |||
| 3303 | - str = strstr(buf, "out_crop_w"); | ||
| 3304 | + str = strstr(buf, "out_fb_num"); | ||
| 3305 | if (str != NULL) { | ||
| 3306 | str = index(buf, '='); | ||
| 3307 | if (str != NULL) { | ||
| 3308 | str++; | ||
| 3309 | if (*str != '\0') { | ||
| 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); | ||
| 3316 | } | ||
| 3317 | return 0; | ||
| 3318 | } | ||
| 3319 | } | ||
| 3320 | |||
| 3321 | - str = strstr(buf, "out_crop_h"); | ||
| 3322 | + str = strstr(buf, "out_posx"); | ||
| 3323 | if (str != NULL) { | ||
| 3324 | str = index(buf, '='); | ||
| 3325 | if (str != NULL) { | ||
| 3326 | str++; | ||
| 3327 | if (*str != '\0') { | ||
| 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); | ||
| 3334 | } | ||
| 3335 | return 0; | ||
| 3336 | } | ||
| 3337 | } | ||
| 3338 | |||
| 3339 | - str = strstr(buf, "out_to_fb"); | ||
| 3340 | + str = strstr(buf, "out_posy"); | ||
| 3341 | if (str != NULL) { | ||
| 3342 | str = index(buf, '='); | ||
| 3343 | if (str != NULL) { | ||
| 3344 | str++; | ||
| 3345 | if (*str != '\0') { | ||
| 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); | ||
| 3350 | } | ||
| 3351 | return 0; | ||
| 3352 | } | ||
| 3353 | -- | ||
| 3354 | 1.7.1 | ||
| 3355 | |||
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0002-ENGR00170223-vpu-Fix-encoder-with-rotation-90-or-270.patch b/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0002-ENGR00170223-vpu-Fix-encoder-with-rotation-90-or-270.patch deleted file mode 100644 index fa187e7eb..000000000 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0002-ENGR00170223-vpu-Fix-encoder-with-rotation-90-or-270.patch +++ /dev/null | |||
| @@ -1,34 +0,0 @@ | |||
| 1 | From 5dd6dccd751ea754f78a4a57d359625a82bf4018 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sammy He <r62914@freescale.com> | ||
| 3 | Date: Thu, 15 Dec 2011 21:43:18 +0800 | ||
| 4 | Subject: [PATCH 2/3] ENGR00170223 vpu: Fix encoder with rotation 90 or 270 incorrect issue | ||
| 5 | |||
| 6 | The source stride isn't set correctly, this cause rotation 90 or 270 | ||
| 7 | is wrong. The patch will fix it. | ||
| 8 | |||
| 9 | Signed-off-by: Sammy He <r62914@freescale.com> | ||
| 10 | |||
| 11 | diff --git a/test/mxc_vpu_test/enc.c b/test/mxc_vpu_test/enc.c | ||
| 12 | index 02cd118..b0bde05 100644 | ||
| 13 | --- a/test/mxc_vpu_test/enc.c | ||
| 14 | +++ b/test/mxc_vpu_test/enc.c | ||
| 15 | @@ -346,13 +346,11 @@ encoder_allocate_framebuffer(struct encode *enc) | ||
| 16 | } | ||
| 17 | |||
| 18 | /* Must be a multiple of 16 */ | ||
| 19 | - if (enc->cmdl->rot_angle == 90 || enc->cmdl->rot_angle == 270) { | ||
| 20 | + if (enc->cmdl->rot_angle == 90 || enc->cmdl->rot_angle == 270) | ||
| 21 | enc_stride = (enc->enc_picheight + 15 ) & ~15; | ||
| 22 | - src_stride = (enc->src_picheight + 15 ) & ~15; | ||
| 23 | - } else { | ||
| 24 | + else | ||
| 25 | enc_stride = (enc->enc_picwidth + 15) & ~15; | ||
| 26 | - src_stride = (enc->src_picwidth + 15 ) & ~15; | ||
| 27 | - } | ||
| 28 | + src_stride = (enc->src_picwidth + 15 ) & ~15; | ||
| 29 | |||
| 30 | ret = vpu_EncRegisterFrameBuffer(handle, fb, fbcount, enc_stride, src_stride, | ||
| 31 | subSampBaseA, subSampBaseB); | ||
| 32 | -- | ||
| 33 | 1.7.1 | ||
| 34 | |||
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0003-ENGR00162747-fix-asrc-sample-rate-convert-issue.patch b/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0003-ENGR00162747-fix-asrc-sample-rate-convert-issue.patch deleted file mode 100644 index 065cab1c9..000000000 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/0003-ENGR00162747-fix-asrc-sample-rate-convert-issue.patch +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | From fb5ee30ae43d97665229c646f0441cc6f8270145 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chen Liangjun <b36089@freescale.com> | ||
| 3 | Date: Thu, 15 Dec 2011 14:20:16 +0800 | ||
| 4 | Subject: [PATCH 3/3] ENGR00162747 fix asrc sample rate convert issue | ||
| 5 | |||
| 6 | The original code assume that when input file length reach 0, the output | ||
| 7 | length should reach 0 too. Because of precision of algorithm calculating | ||
| 8 | the output file length, when convert 96k to 88.2k, the output file | ||
| 9 | length does not reach 0 when input length is 0. So the delete queue operation | ||
| 10 | of output buffer is blocked when there is no input buffer setuped and a | ||
| 11 | timeout error happens. | ||
| 12 | |||
| 13 | The new code break out of the "while(info->data_length>=0)" before the delete | ||
| 14 | queue operation of output buffer to make sure every time a delete output | ||
| 15 | queue operation happens, there is a input buffer set already. | ||
| 16 | |||
| 17 | Signed-off-by: Chen Liangjun <b36089@freescale.com> | ||
| 18 | |||
| 19 | diff --git a/test/mxc_asrc_test/mxc_asrc_test.c b/test/mxc_asrc_test/mxc_asrc_test.c | ||
| 20 | index 8e29fd2..e34fe95 100644 | ||
| 21 | --- a/test/mxc_asrc_test/mxc_asrc_test.c | ||
| 22 | +++ b/test/mxc_asrc_test/mxc_asrc_test.c | ||
| 23 | @@ -252,6 +252,8 @@ int play_file(int fd_asrc, struct audio_info_s *info) | ||
| 24 | |||
| 25 | if ((err = ioctl(fd_asrc, ASRC_STATUS, &flags)) < 0) | ||
| 26 | goto ERROR; | ||
| 27 | + if (info->data_len == 0) | ||
| 28 | + break; | ||
| 29 | |||
| 30 | if ((err = ioctl(fd_asrc, ASRC_DQ_OUTBUF, &outbuf)) < 0) | ||
| 31 | goto ERROR; | ||
| 32 | @@ -348,6 +350,8 @@ int play_file(int fd_asrc, struct audio_info_s *info) | ||
| 33 | memcpy(output_p, p, outbuf.length); | ||
| 34 | output_p = output_p + outbuf.length; | ||
| 35 | info->output_data_len -= outbuf.length; | ||
| 36 | + if (info->output_data_len == 0) | ||
| 37 | + break; | ||
| 38 | if ((err = ioctl(fd_asrc, ASRC_Q_OUTBUF, &outbuf)) < 0) | ||
| 39 | goto ERROR; | ||
| 40 | if ((err = ioctl(fd_asrc, ASRC_DQ_INBUF, &inbuf)) < 0) | ||
| 41 | @@ -357,6 +361,8 @@ int play_file(int fd_asrc, struct audio_info_s *info) | ||
| 42 | |||
| 43 | if ((err = ioctl(fd_asrc, ASRC_Q_INBUF, &inbuf)) < 0) | ||
| 44 | goto ERROR; | ||
| 45 | + if ((err = ioctl(fd_asrc, ASRC_START_CONV, &inbuf)) < 0) | ||
| 46 | + goto ERROR; | ||
| 47 | } | ||
| 48 | err = ioctl(fd_asrc, ASRC_STOP_CONV, &pair_index); | ||
| 49 | |||
| 50 | -- | ||
| 51 | 1.7.1 | ||
| 52 | |||
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/revert_epdc_hdr_change.patch b/meta-fsl-arm/recipes-bsp/imx-test/imx-test/revert_epdc_hdr_change.patch new file mode 100644 index 000000000..4fb0564af --- /dev/null +++ b/meta-fsl-arm/recipes-bsp/imx-test/imx-test/revert_epdc_hdr_change.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From e559eb0a9573b9011c03efaf42364dce67af893a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Lauren Post <lauren.post@freescale.com> | ||
| 3 | Date: Tue, 10 Sep 2013 10:58:28 -0500 | ||
| 4 | Subject: [PATCH] ENGR00279068-2 epdc_test_driver: Update header name change | ||
| 5 | of mxc_epdc.h | ||
| 6 | |||
| 7 | Upstream-Status: Pending | ||
| 8 | |||
| 9 | Signed-off-by: Lauren Post <lauren.post@freescale.com> | ||
| 10 | Signed-off-by: Frank Li <Frank.li@freescale.com> | ||
| 11 | --- | ||
| 12 | module_test/epdc_test_driver.c | 4 ++-- | ||
| 13 | 1 file changed, 1 insertions(+), 1 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/module_test/epdc_test_driver.c b/module_test/epdc_test_driver.c | ||
| 16 | index fb15aec..447246f 100644 | ||
| 17 | --- a/module_test/epdc_test_driver.c | ||
| 18 | +++ b/module_test/epdc_test_driver.c | ||
| 19 | @@ -36,7 +36,7 @@ | ||
| 20 | |||
| 21 | #include <linux/device.h> | ||
| 22 | #include <linux/mxcfb.h> | ||
| 23 | -#include <linux/mxcfb_epdc.h> | ||
| 24 | +#include <linux/mxcfb_epdc_kernel.h> | ||
| 25 | |||
| 26 | /* major number of device */ | ||
| 27 | static int gMajor; | ||
| 28 | -- | ||
| 29 | 1.7.9.5 | ||
| 30 | |||
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test_11.09.01.bb b/meta-fsl-arm/recipes-bsp/imx-test/imx-test_11.09.01.bb deleted file mode 100644 index 54a03f753..000000000 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test_11.09.01.bb +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | include imx-test.inc | ||
| 2 | |||
| 3 | PR = "${INC_PR}.0" | ||
| 4 | |||
| 5 | COMPATIBLE_MACHINE = "(mx5)" | ||
| 6 | |||
| 7 | SRC_URI += "file://0001-ENGR00158471-fix-ipu-unit-test-application-missing-i.patch \ | ||
| 8 | file://0002-ENGR00170223-vpu-Fix-encoder-with-rotation-90-or-270.patch \ | ||
| 9 | file://0003-ENGR00162747-fix-asrc-sample-rate-convert-issue.patch \ | ||
| 10 | file://clocks.sh" | ||
| 11 | |||
| 12 | SRC_URI[md5sum] = "5512dc0340cb71087c78f13bb6710ee0" | ||
| 13 | SRC_URI[sha256sum] = "b788ac9c787b665c49596726e0095cef9ad835be4c616d2454543ae5f41a81af" | ||
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test_2.6.35.3-1.1.0.bb b/meta-fsl-arm/recipes-bsp/imx-test/imx-test_2.6.35.3-1.1.0.bb deleted file mode 100644 index 26262762c..000000000 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test_2.6.35.3-1.1.0.bb +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | include imx-test.inc | ||
| 2 | |||
| 3 | DEPENDS = "virtual/kernel" | ||
| 4 | |||
| 5 | PR = "${INC_PR}.0" | ||
| 6 | PE = "1" | ||
| 7 | |||
| 8 | SRC_URI += " file://clocks.sh" | ||
| 9 | |||
| 10 | SRC_URI[md5sum] = "e30d557aea2ef3cc5840a3cfc81364bc" | ||
| 11 | SRC_URI[sha256sum] = "ce7dc16bc2e7e56d9394d8d899a4cdd73e416f8cec4d4a8acec946c8922028bf" | ||
| 12 | |||
| 13 | COMPATIBLE_MACHINE = "(mx28)" | ||
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test_3.10.17-1.0.0.bb b/meta-fsl-arm/recipes-bsp/imx-test/imx-test_3.10.17-1.0.0.bb index 80f4049c0..386f5b715 100644 --- a/meta-fsl-arm/recipes-bsp/imx-test/imx-test_3.10.17-1.0.0.bb +++ b/meta-fsl-arm/recipes-bsp/imx-test/imx-test_3.10.17-1.0.0.bb | |||
| @@ -6,9 +6,12 @@ include imx-test.inc | |||
| 6 | SRC_URI = "${FSL_MIRROR}/${PN}-${PV}_beta.tar.gz" | 6 | SRC_URI = "${FSL_MIRROR}/${PN}-${PV}_beta.tar.gz" |
| 7 | S="${WORKDIR}/${PN}-${PV}_beta" | 7 | S="${WORKDIR}/${PN}-${PV}_beta" |
| 8 | 8 | ||
| 9 | PE = "1" | 9 | SRC_URI_append_mx5 = " file://revert_epdc_hdr_change.patch \ |
| 10 | file://clocks.sh" | ||
| 11 | SRC_URI_append_mxs = " file://revert_epdc_hdr_change.patch \ | ||
| 12 | file://clocks.sh" | ||
| 10 | 13 | ||
| 11 | SRC_URI[md5sum] = "fd3de6e882a7b5425853083ec8d4951e" | 14 | SRC_URI[md5sum] = "fd3de6e882a7b5425853083ec8d4951e" |
| 12 | SRC_URI[sha256sum] = "1e86cfe800fbf2db2a52ce0155ab2d2ba70913a30974b3f66879198eaf9da21b" | 15 | SRC_URI[sha256sum] = "1e86cfe800fbf2db2a52ce0155ab2d2ba70913a30974b3f66879198eaf9da21b" |
| 13 | 16 | ||
| 14 | COMPATIBLE_MACHINE = "(mx6)" | 17 | COMPATIBLE_MACHINE = "(mxs|mx5|mx6)" |
