From 8a0cfce5105db5c575217f05c00f22699b9905cb Mon Sep 17 00:00:00 2001 From: Brian Zhu Date: Wed, 16 Jan 2019 05:12:00 +0800 Subject: [PATCH] vpp: add two layers support for each chips [1/6] PD#SWPL-85 Problem: Need support two video layers feature Solution: 1.Add vd2 mif config 2.Add vd2 pps calculation and config 3.Add vd2 axis/crop/screen mode interface by sysfs and ioctl 4.Add layer query/alloc/free interface Verify: Verify on U212 Change-Id: I71fc9ab2ae0230c3e84c4b790e77d2c790951642 Signed-off-by: Brian Zhu Conflicts: drivers/amlogic/media/video_sink/video.c drivers/amlogic/media/video_sink/video_keeper.c drivers/amlogic/media/video_sink/video_priv.h drivers/amlogic/media/video_sink/vpp.c include/linux/amlogic/media/video_sink/video.h include/linux/amlogic/media/video_sink/vpp.h --- drivers/amlogic/media/video_sink/video.c | 40 +++++--------------- drivers/amlogic/media/video_sink/vpp.c | 19 +++++++++- include/linux/amlogic/media/utils/amstream.h | 25 ++++++++++++ 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index e91c55b0dd39..42328cdcf26a 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -4029,6 +4029,9 @@ static void vsync_toggle_frame(struct vframe_s *vf, int line) memcpy(&gPic_info[0], &vf->pic_mode, sizeof(struct vframe_pic_mode_s)); + if (iret == VppFilter_Success_and_Changed) + video_property_changed = 1; + /* apply new vpp settings */ frame_par_ready_to_set = 1; @@ -7839,33 +7842,6 @@ SET_FILTER: u32 set_value = 0; force_flush |= vpp_zorder_check(); - /* for sr core0, put it between prebld & pps as default */ - if (cur_frame_par && - (cur_frame_par->sr_core_support & - SUPER_CORE0_SUPPORT)) - if (cur_frame_par->sr0_position) - vpp_misc_set |= - PREBLD_SR0_VD1_SCALER; - else - vpp_misc_set &= - ~SR0_AFTER_DNLP; - else - vpp_misc_set |= - PREBLD_SR0_VD1_SCALER; - /* for sr core1, put it before post blend as default */ - if (cur_frame_par && - (cur_frame_par->sr_core_support & - SUPER_CORE1_SUPPORT)) - if (cur_frame_par->sr1_position) - vpp_misc_set |= - DNLP_SR1_CM; - else - vpp_misc_set &= - ~SR1_AFTER_POSTBLEN; - else - vpp_misc_set |= - DNLP_SR1_CM; - /* for sr core0, put it between prebld & pps as default */ if (cur_frame_par && (cur_frame_par->sr_core_support & @@ -9181,7 +9157,12 @@ static long amvideo_ioctl(struct file *file, unsigned int cmd, ulong arg) put_user(disable_videopip, (u32 __user *)argp); break; case AMSTREAM_IOC_GET_VIDEO_DISABLE: - put_user(disable_video, (u32 __user *)argp); + if (layer->layer_id == 0) + put_user(disable_video, (u32 __user *)argp); +#ifdef VIDEO_PIP + else if (layer->layer_id == 1) + put_user(disable_videopip, (u32 __user *)argp); +#endif break; case AMSTREAM_IOC_SET_VIDEOPIP_DISABLE: @@ -13120,9 +13101,6 @@ MODULE_PARM_DESC(underflow, "\n Underflow count\n"); module_param(next_peek_underflow, uint, 0664); MODULE_PARM_DESC(skip, "\n Underflow count\n"); -module_param(hdmiin_frame_check, uint, 0664); -MODULE_PARM_DESC(hdmiin_frame_check, "\n hdmiin_frame_check\n"); - module_param(step_enable, uint, 0664); MODULE_PARM_DESC(step_enable, "\n step_enable\n"); diff --git a/drivers/amlogic/media/video_sink/vpp.c b/drivers/amlogic/media/video_sink/vpp.c index 1c89853f8c85..93787f418a7c 100644 --- a/drivers/amlogic/media/video_sink/vpp.c +++ b/drivers/amlogic/media/video_sink/vpp.c @@ -2976,7 +2976,10 @@ int vpp_set_filters( if (!input) return ret; - WARN_ON(vinfo == NULL); + if (vpp_flags & VPP_FLAG_INTERLACE_IN) + vskip_step = 2; + else + vskip_step = 1; /* use local var to avoid the input data be overwriten */ memcpy(&local_input, input, sizeof(struct disp_info_s)); @@ -3063,6 +3066,20 @@ int vpp_set_filters( if (vf->type & VIDTYPE_VSCALE_DISABLE) vpp_flags |= VPP_FLAG_VSCALE_DISABLE; +#ifndef TV_3D_FUNCTION_OPEN + if (vf->type & VIDTYPE_COMPRESS) { + src_width = vf->compWidth; + src_height = vf->compHeight; + } else { + src_width = vf->width; + src_height = vf->height; + } +#endif + + if ((vf->ratio_control & DISP_RATIO_ADAPTED_PICMODE) + && !disable_adapted) { + if (vf->pic_mode.screen_mode != 0xff) + wide_mode = vf->pic_mode.screen_mode; if ((vf->ratio_control & DISP_RATIO_ADAPTED_PICMODE) && !disable_adapted) { diff --git a/include/linux/amlogic/media/utils/amstream.h b/include/linux/amlogic/media/utils/amstream.h index 1343d436ffb2..0d690f28fc18 100644 --- a/include/linux/amlogic/media/utils/amstream.h +++ b/include/linux/amlogic/media/utils/amstream.h @@ -119,6 +119,31 @@ #define AMSTREAM_IOC_GET_3D_TYPE _IOW((_A_M), 0x3d, unsigned int) #define AMSTREAM_IOC_GET_SOURCE_VIDEO_3D_TYPE _IOW((_A_M), 0x3e, unsigned int) +#define AMSTREAM_IOC_GLOBAL_GET_VIDEOPIP_OUTPUT _IOR((_A_M), 0x2b, int) +#define AMSTREAM_IOC_GLOBAL_SET_VIDEOPIP_OUTPUT _IOW((_A_M), 0x2c, int) +#define AMSTREAM_IOC_GET_VIDEOPIP_DISABLE _IOR((_A_M), 0x2d, int) +#define AMSTREAM_IOC_SET_VIDEOPIP_DISABLE _IOW((_A_M), 0x2e, int) +#define AMSTREAM_IOC_GET_VIDEOPIP_AXIS _IOR((_A_M), 0x2f, int) +#define AMSTREAM_IOC_SET_VIDEOPIP_AXIS _IOW((_A_M), 0x30, int) +#define AMSTREAM_IOC_GET_VIDEOPIP_CROP _IOR((_A_M), 0x31, int) +#define AMSTREAM_IOC_SET_VIDEOPIP_CROP _IOW((_A_M), 0x32, int) +#define AMSTREAM_IOC_GET_PIP_SCREEN_MODE _IOR((_A_M), 0x33, int) +#define AMSTREAM_IOC_SET_PIP_SCREEN_MODE _IOW((_A_M), 0x34, int) +#define AMSTREAM_IOC_GET_PIP_ZORDER _IOW((_A_M), 0x35, unsigned int) +#define AMSTREAM_IOC_SET_PIP_ZORDER _IOW((_A_M), 0x36, unsigned int) + +#define AMSTREAM_IOC_GET_ZORDER _IOW((_A_M), 0x37, unsigned int) +#define AMSTREAM_IOC_SET_ZORDER _IOW((_A_M), 0x38, unsigned int) + +#define AMSTREAM_IOC_QUERY_LAYER _IOW((_A_M), 0x39, unsigned int) +#define AMSTREAM_IOC_ALLOC_LAYER _IOW((_A_M), 0x3a, unsigned int) +#define AMSTREAM_IOC_FREE_LAYER _IOW((_A_M), 0x3b, unsigned int) + +/* VPP.3D IOCTL command list^M */ +#define AMSTREAM_IOC_SET_3D_TYPE _IOW((_A_M), 0x3c, unsigned int) +#define AMSTREAM_IOC_GET_3D_TYPE _IOW((_A_M), 0x3d, unsigned int) +#define AMSTREAM_IOC_GET_SOURCE_VIDEO_3D_TYPE _IOW((_A_M), 0x3e, unsigned int) + #define AMSTREAM_IOC_APTS _IOR((_A_M), 0x40, int) #define AMSTREAM_IOC_VPTS _IOR((_A_M), 0x41, int) #define AMSTREAM_IOC_PCRSCR _IOR((_A_M), 0x42, int)