diff options
author | jungmin <jung-min.oh@samsung.com> | 2010-10-26 22:43:04 +0900 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2010-10-27 14:51:34 -0700 |
commit | 999aaed857c2b96ab63a1d07f4641fd8422c492a (patch) | |
tree | a5cb75d674cdf615c42c28e2cde059f5c444db8a /liboverlay | |
parent | aeb2f937f53195d654aaa3f2f779ce00b1edebb2 (diff) | |
download | device_samsung_crespo-999aaed857c2b96ab63a1d07f4641fd8422c492a.zip device_samsung_crespo-999aaed857c2b96ab63a1d07f4641fd8422c492a.tar.gz device_samsung_crespo-999aaed857c2b96ab63a1d07f4641fd8422c492a.tar.bz2 |
S5PC11X: OVERLAY: Modify to check constraints
Modify constraints check routine according to hw spec
Change-Id: I236efacb457f2b3b79c43f4d510c523e95330706
Signed-off-by: hoony.yu <hoony.yu@samsung.com>
Diffstat (limited to 'liboverlay')
-rw-r--r-- | liboverlay/overlay.cpp | 107 | ||||
-rw-r--r-- | liboverlay/v4l2_utils.h | 7 |
2 files changed, 85 insertions, 29 deletions
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp index 4983e87..1946a24 100644 --- a/liboverlay/overlay.cpp +++ b/liboverlay/overlay.cpp @@ -607,6 +607,8 @@ static overlay_t* overlay_createOverlay(struct overlay_control_device_t *dev, goto error1; } + v4l2_overlay_init_fimc(fd, &g_s5p_fimc); + overlay = new overlay_object(fd, shared_fd, shared->size, w, h, format, num); if (overlay == NULL) { @@ -949,57 +951,104 @@ static int overlay_control_close(struct hw_device_t *dev) return 0; } +static int get_pixel_format_type(unsigned int pixelformat) +{ + switch(pixelformat) { + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_RGB565: + return PFT_RGB; + + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV12T: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_YUV420: + return PFT_YUV420; + + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: + case V4L2_PIX_FMT_YVYU: + case V4L2_PIX_FMT_VYUY: + case V4L2_PIX_FMT_NV16: + case V4L2_PIX_FMT_NV61: + case V4L2_PIX_FMT_YUV422P: + return PFT_YUV422; + + default: + return PFT_YUV444; + } +} + /* check the constraints of destination image size */ static int check_fimc_dst_constraints(s5p_fimc_t *s5p_fimc, unsigned int rotation) { - int ret = 0; int tmp = 0; - if((s5p_fimc->params.dst.height > 0) && (s5p_fimc->params.dst.height < 8)) { + + if((s5p_fimc->params.dst.height > 0) && (s5p_fimc->params.dst.height < 8)) s5p_fimc->params.dst.height = 8; - ret = 1; - } - if(s5p_fimc->params.dst.width %8 != 0) { - tmp = s5p_fimc->params.dst.width - (s5p_fimc->params.dst.width%8); - if(tmp <= 0) { - ret = -1; - } else { - s5p_fimc->params.dst.width = tmp; - ret = 1; + + if(s5p_fimc->hw_ver == 0x50) { + if(s5p_fimc->params.dst.width%2 != 0) { + tmp = s5p_fimc->params.dst.width - (s5p_fimc->params.dst.width%2); + if(tmp <= 0) + return -1; + else + s5p_fimc->params.dst.width = tmp; + } + } else { + if(s5p_fimc->params.dst.width%8 != 0) { + tmp = s5p_fimc->params.dst.width - (s5p_fimc->params.dst.width%8); + if(tmp <= 0) + return -1; + else + s5p_fimc->params.dst.width = tmp; } } - return ret; + + return 1; } /* check the constraints of source image size */ static int check_fimc_src_constraints(s5p_fimc_t *s5p_fimc) { - int ret = 0; + int format_type = 0; if(s5p_fimc->params.src.full_width < 16 || - s5p_fimc->params.src.full_height < 8 ) - ret = -1; + s5p_fimc->params.src.full_height < 8 ) + return -1; + + if(s5p_fimc->params.src.full_width%16 != 0) + return -1; if(s5p_fimc->hw_ver == 0x50) { - if(s5p_fimc->params.src.color_space == V4L2_PIX_FMT_YUV422P) { - if((s5p_fimc->params.src.full_width%2 != 0) || - (s5p_fimc->params.src.full_height%2 != 0)) - ret = -1; + format_type = get_pixel_format_type(s5p_fimc->params.src.color_space); + switch (format_type) { + case PFT_YUV420: + if (s5p_fimc->params.src.height%2 != 0) + s5p_fimc->params.src.height = s5p_fimc->params.src.height + - (s5p_fimc->params.src.height)%2; + + if (s5p_fimc->params.src.width%2 != 0) + s5p_fimc->params.src.width = s5p_fimc->params.src.width + - (s5p_fimc->params.src.width)%2; + break; + + case PFT_YUV422: + if (s5p_fimc->params.src.width%2 != 0) + s5p_fimc->params.src.width = s5p_fimc->params.src.width + - (s5p_fimc->params.src.width)%2; } } else { - if(s5p_fimc->params.src.full_width%16 != 0) - ret = -1; - - if(s5p_fimc->params.src.height < 8) { + if (s5p_fimc->params.src.height < 8) { s5p_fimc->params.src.height = 8; - ret = 1; } - if(s5p_fimc->params.src.width%16 != 0) { - s5p_fimc->params.src.height = s5p_fimc->params.src.height - - (s5p_fimc->params.src.height)%16; - ret = 1; + + if (s5p_fimc->params.src.width%16 != 0) { + s5p_fimc->params.src.width = s5p_fimc->params.src.width + - (s5p_fimc->params.src.width)%16; } } - return ret; + + return 1; } /**************************************************************************** diff --git a/liboverlay/v4l2_utils.h b/liboverlay/v4l2_utils.h index 42bb211..02797c3 100644 --- a/liboverlay/v4l2_utils.h +++ b/liboverlay/v4l2_utils.h @@ -56,6 +56,13 @@ enum { HAL_PIXEL_FORMAT_CUSTOM_MAX }; +enum { + PFT_RGB, + PFT_YUV420, + PFT_YUV422, + PFT_YUV444, +}; + struct mapping_data { int fd; size_t length; |