From 2cf014504a8af33fedc75ef0b108e0ef1cdd1602 Mon Sep 17 00:00:00 2001 From: Markus Pfau Date: Mon, 8 Aug 2016 19:22:11 +0200 Subject: [PATCH] output omx_pts from aml video device --- drivers/amlogic/amports/video.c | 8 +- include/linux/amlogic/amports/amstream.h | 113 ++++++++++++----------- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/drivers/amlogic/amports/video.c b/drivers/amlogic/amports/video.c index 4d9598ca58201b..d6f35cc485ecda 100644 --- a/drivers/amlogic/amports/video.c +++ b/drivers/amlogic/amports/video.c @@ -3533,7 +3533,10 @@ static long amvideo_ioctl(struct file *file, omx_pts = pts; } break; - + case AMSTREAM_IOC_GET_OMX_VPTS: + put_user(omx_pts, (unsigned long __user *)arg); + break; + case AMSTREAM_IOC_TRICKMODE: if (arg == TRICKMODE_I) { trickmode_i = 1; @@ -5715,6 +5718,9 @@ module_param(cur_dev_idx, uint, 0664); MODULE_PARM_DESC(new_frame_count, "\n new_frame_count\n"); module_param(new_frame_count, uint, 0664); +MODULE_PARM_DESC(omx_pts, "\n omx_pts\n"); +module_param(omx_pts, uint, 0664); + MODULE_DESCRIPTION("AMLOGIC video output driver"); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Tim Yao "); diff --git a/include/linux/amlogic/amports/amstream.h b/include/linux/amlogic/amports/amstream.h index 7138b774ae2d16..ef3aa2d0a4c138 100644 --- a/include/linux/amlogic/amports/amstream.h +++ b/include/linux/amlogic/amports/amstream.h @@ -19,43 +19,43 @@ * */ -#ifndef AMSTREAM_H -#define AMSTREAM_H +#ifndef AMSTREAM_H +#define AMSTREAM_H //#include #include "ve.h" #ifdef __KERNEL__ -#define PORT_FLAG_IN_USE 0x0001 -#define PORT_FLAG_VFORMAT 0x0002 -#define PORT_FLAG_AFORMAT 0x0004 -#define PORT_FLAG_FORMAT (PORT_FLAG_VFORMAT | PORT_FLAG_AFORMAT) -#define PORT_FLAG_VID 0x0008 +#define PORT_FLAG_IN_USE 0x0001 +#define PORT_FLAG_VFORMAT 0x0002 +#define PORT_FLAG_AFORMAT 0x0004 +#define PORT_FLAG_FORMAT (PORT_FLAG_VFORMAT | PORT_FLAG_AFORMAT) +#define PORT_FLAG_VID 0x0008 #define PORT_FLAG_AID 0x0010 #define PORT_FLAG_SID 0x0020 #define PORT_FLAG_UD 0x0040 #define PORT_FLAG_DRM 0x0080 #define PORT_FLAG_ID (PORT_FLAG_VID | PORT_FLAG_AID | PORT_FLAG_SID | PORT_FLAG_UD) #define PORT_FLAG_INITED 0x100 - -#define PORT_TYPE_VIDEO 0x01 -#define PORT_TYPE_AUDIO 0x02 -#define PORT_TYPE_MPTS 0x04 -#define PORT_TYPE_MPPS 0x08 -#define PORT_TYPE_ES 0x10 + +#define PORT_TYPE_VIDEO 0x01 +#define PORT_TYPE_AUDIO 0x02 +#define PORT_TYPE_MPTS 0x04 +#define PORT_TYPE_MPPS 0x08 +#define PORT_TYPE_ES 0x10 #define PORT_TYPE_RM 0x20 #define PORT_TYPE_SUB 0x40 #define PORT_TYPE_SUB_RD 0x80 -#define PORT_TYPE_HEVC 0x100 +#define PORT_TYPE_HEVC 0x100 #define PORT_TYPE_USERDATA 0x200 #endif - -#define AMSTREAM_IOC_MAGIC 'S' - -#define AMSTREAM_IOC_VB_START _IOW(AMSTREAM_IOC_MAGIC, 0x00, int) -#define AMSTREAM_IOC_VB_SIZE _IOW(AMSTREAM_IOC_MAGIC, 0x01, int) -#define AMSTREAM_IOC_AB_START _IOW(AMSTREAM_IOC_MAGIC, 0x02, int) -#define AMSTREAM_IOC_AB_SIZE _IOW(AMSTREAM_IOC_MAGIC, 0x03, int) + +#define AMSTREAM_IOC_MAGIC 'S' + +#define AMSTREAM_IOC_VB_START _IOW(AMSTREAM_IOC_MAGIC, 0x00, int) +#define AMSTREAM_IOC_VB_SIZE _IOW(AMSTREAM_IOC_MAGIC, 0x01, int) +#define AMSTREAM_IOC_AB_START _IOW(AMSTREAM_IOC_MAGIC, 0x02, int) +#define AMSTREAM_IOC_AB_SIZE _IOW(AMSTREAM_IOC_MAGIC, 0x03, int) #define AMSTREAM_IOC_VFORMAT _IOW(AMSTREAM_IOC_MAGIC, 0x04, int) #define AMSTREAM_IOC_AFORMAT _IOW(AMSTREAM_IOC_MAGIC, 0x05, int) #define AMSTREAM_IOC_VID _IOW(AMSTREAM_IOC_MAGIC, 0x06, int) @@ -63,11 +63,11 @@ #define AMSTREAM_IOC_VB_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x08, unsigned long) #define AMSTREAM_IOC_AB_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x09, unsigned long) #define AMSTREAM_IOC_SYSINFO _IOW(AMSTREAM_IOC_MAGIC, 0x0a, int) -#define AMSTREAM_IOC_ACHANNEL _IOW(AMSTREAM_IOC_MAGIC, 0x0b, int) -#define AMSTREAM_IOC_SAMPLERATE _IOW(AMSTREAM_IOC_MAGIC, 0x0c, int) +#define AMSTREAM_IOC_ACHANNEL _IOW(AMSTREAM_IOC_MAGIC, 0x0b, int) +#define AMSTREAM_IOC_SAMPLERATE _IOW(AMSTREAM_IOC_MAGIC, 0x0c, int) #define AMSTREAM_IOC_DATAWIDTH _IOW(AMSTREAM_IOC_MAGIC, 0x0d, int) #define AMSTREAM_IOC_TSTAMP _IOW(AMSTREAM_IOC_MAGIC, 0x0e, unsigned long) -#define AMSTREAM_IOC_VDECSTAT _IOR(AMSTREAM_IOC_MAGIC, 0x0f, unsigned long) +#define AMSTREAM_IOC_VDECSTAT _IOR(AMSTREAM_IOC_MAGIC, 0x0f, unsigned long) #define AMSTREAM_IOC_ADECSTAT _IOR(AMSTREAM_IOC_MAGIC, 0x10, unsigned long) #define AMSTREAM_IOC_PORT_INIT _IO(AMSTREAM_IOC_MAGIC, 0x11) @@ -85,7 +85,7 @@ #define AMSTREAM_IOC_SET_DEC_RESET _IOW(AMSTREAM_IOC_MAGIC, 0x1c, int) #define AMSTREAM_IOC_TS_SKIPBYTE _IOW(AMSTREAM_IOC_MAGIC, 0x1d, int) #define AMSTREAM_IOC_SUB_TYPE _IOW(AMSTREAM_IOC_MAGIC, 0x1e, int) -#define AMSTREAM_IOC_CLEAR_VIDEO _IOW(AMSTREAM_IOC_MAGIC, 0x1f, int) +#define AMSTREAM_IOC_CLEAR_VIDEO _IOW(AMSTREAM_IOC_MAGIC, 0x1f, int) #define AMSTREAM_IOC_APTS _IOR(AMSTREAM_IOC_MAGIC, 0x40, unsigned long) #define AMSTREAM_IOC_VPTS _IOR(AMSTREAM_IOC_MAGIC, 0x41, unsigned long) @@ -102,7 +102,7 @@ #define AMSTREAM_IOC_SET_VIDEO_AXIS _IOW(AMSTREAM_IOC_MAGIC, 0x4c, unsigned long) #define AMSTREAM_IOC_GET_VIDEO_CROP _IOR(AMSTREAM_IOC_MAGIC, 0x4d, unsigned long) #define AMSTREAM_IOC_SET_VIDEO_CROP _IOW(AMSTREAM_IOC_MAGIC, 0x4e, unsigned long) -#define AMSTREAM_IOC_PCRID _IOW(AMSTREAM_IOC_MAGIC, 0x4f, int) +#define AMSTREAM_IOC_PCRID _IOW(AMSTREAM_IOC_MAGIC, 0x4f, int) // VPP.VE IOCTL command list #define AMSTREAM_IOC_VE_BEXT _IOW(AMSTREAM_IOC_MAGIC, 0x20, struct ve_bext_s ) @@ -130,16 +130,16 @@ #define AMSTREAM_IOC_SUB_INFO _IOR(AMSTREAM_IOC_MAGIC, 0x51, unsigned long) #define AMSTREAM_IOC_GET_BLACKOUT_POLICY _IOR(AMSTREAM_IOC_MAGIC, 0x52, unsigned long) #define AMSTREAM_IOC_SET_BLACKOUT_POLICY _IOW(AMSTREAM_IOC_MAGIC, 0x53, unsigned long) -#define AMSTREAM_IOC_GET_SCREEN_MODE _IOR(AMSTREAM_IOC_MAGIC, 0x58, int) -#define AMSTREAM_IOC_SET_SCREEN_MODE _IOW(AMSTREAM_IOC_MAGIC, 0x59, int) -#define AMSTREAM_IOC_GET_VIDEO_DISCONTINUE_REPORT _IOR(AMSTREAM_IOC_MAGIC, 0x5a, int) -#define AMSTREAM_IOC_SET_VIDEO_DISCONTINUE_REPORT _IOW(AMSTREAM_IOC_MAGIC, 0x5b, int) +#define AMSTREAM_IOC_GET_SCREEN_MODE _IOR(AMSTREAM_IOC_MAGIC, 0x58, int) +#define AMSTREAM_IOC_SET_SCREEN_MODE _IOW(AMSTREAM_IOC_MAGIC, 0x59, int) +#define AMSTREAM_IOC_GET_VIDEO_DISCONTINUE_REPORT _IOR(AMSTREAM_IOC_MAGIC, 0x5a, int) +#define AMSTREAM_IOC_SET_VIDEO_DISCONTINUE_REPORT _IOW(AMSTREAM_IOC_MAGIC, 0x5b, int) #define AMSTREAM_IOC_VF_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x60, unsigned long) #define AMSTREAM_IOC_CLEAR_VBUF _IO(AMSTREAM_IOC_MAGIC, 0x80) -#define AMSTREAM_IOC_APTS_LOOKUP _IOR(AMSTREAM_IOC_MAGIC, 0x81, unsigned long) -#define GET_FIRST_APTS_FLAG _IOR(AMSTREAM_IOC_MAGIC, 0x82, long) - +#define AMSTREAM_IOC_APTS_LOOKUP _IOR(AMSTREAM_IOC_MAGIC, 0x81, unsigned long) +#define GET_FIRST_APTS_FLAG _IOR(AMSTREAM_IOC_MAGIC, 0x82, long) + #define AMSTREAM_IOC_GET_SYNC_ADISCON_DIFF _IOR(AMSTREAM_IOC_MAGIC, 0x83, unsigned long) #define AMSTREAM_IOC_GET_SYNC_VDISCON_DIFF _IOR(AMSTREAM_IOC_MAGIC, 0x84, unsigned long) #define AMSTREAM_IOC_SET_SYNC_ADISCON_DIFF _IOW(AMSTREAM_IOC_MAGIC, 0x85, unsigned long) @@ -149,7 +149,7 @@ #define AMSTREAM_IOC_SET_VSYNC_UPINT _IOW(AMSTREAM_IOC_MAGIC, 0x89, unsigned long) #define AMSTREAM_IOC_GET_VSYNC_SLOW_FACTOR _IOW(AMSTREAM_IOC_MAGIC, 0x8a, unsigned long) #define AMSTREAM_IOC_SET_VSYNC_SLOW_FACTOR _IOW(AMSTREAM_IOC_MAGIC, 0x8b, unsigned long) -#define AMSTREAM_IOC_SET_DEMUX _IOW(AMSTREAM_IOC_MAGIC, 0x90, unsigned long) +#define AMSTREAM_IOC_SET_DEMUX _IOW(AMSTREAM_IOC_MAGIC, 0x90, unsigned long) #define AMSTREAM_IOC_SET_DRMMODE _IOW(AMSTREAM_IOC_MAGIC, 0x91, unsigned long) #define AMSTREAM_IOC_TSTAMP_uS64 _IOW(AMSTREAM_IOC_MAGIC, 0x95, unsigned long) @@ -170,6 +170,7 @@ #define AMSTREAM_IOC_GET_SUBTITLE_INFO _IOR(AMSTREAM_IOC_MAGIC, 0xad, unsigned long) #define AMSTREAM_IOC_SET_SUBTITLE_INFO _IOW(AMSTREAM_IOC_MAGIC, 0xae, unsigned long) #define AMSTREAM_IOC_SET_OMX_VPTS _IOW(AMSTREAM_IOC_MAGIC, 0xaf, unsigned long) +#define AMSTREAM_IOC_GET_OMX_VPTS _IOW(AMSTREAM_IOC_MAGIC, 0xb0, unsigned long) #define TRICKMODE_NONE 0x00 #define TRICKMODE_I 0x01 #define TRICKMODE_FFFB 0x02 @@ -227,22 +228,22 @@ struct buf_status { #define DECODER_ERROR_MASK (0xffff<<16) -struct vdec_status { - unsigned int width; - unsigned int height; - unsigned int fps; - unsigned int error_count; - unsigned int status; -}; - -struct adec_status { - unsigned int channels; - unsigned int sample_rate; - unsigned int resolution; - unsigned int error_count; - unsigned int status; -}; - +struct vdec_status { + unsigned int width; + unsigned int height; + unsigned int fps; + unsigned int error_count; + unsigned int status; +}; + +struct adec_status { + unsigned int channels; + unsigned int sample_rate; + unsigned int resolution; + unsigned int error_count; + unsigned int status; +}; + struct am_io_param { union { int data; @@ -254,8 +255,8 @@ struct am_io_param { union { char buf[1]; struct buf_status status; - struct vdec_status vstatus; - struct adec_status astatus; + struct vdec_status vstatus; + struct adec_status astatus; }; }; struct audio_info { @@ -320,14 +321,14 @@ void tsdemux_set_ops(struct tsdemux_ops *ops); int tsdemux_set_reset_flag(void); #endif /*ENABLE_DEMUX_DRIVER*/ -void set_vdec_func(int (*vdec_func)(struct vdec_status *)); -void set_adec_func(int (*adec_func)(struct adec_status *)); +void set_vdec_func(int (*vdec_func)(struct vdec_status *)); +void set_adec_func(int (*adec_func)(struct adec_status *)); void set_trickmode_func(int (*trickmode_func)(unsigned long trickmode)); void wakeup_sub_poll(void); int wakeup_userdata_poll(int wp, int start_phyaddr, int buf_size); int get_sub_type(void); #endif - + typedef struct tcon_gamma_table_s { u16 data[256]; } tcon_gamma_table_t; @@ -346,4 +347,4 @@ typedef struct tcon_rgb_ogo_s { } tcon_rgb_ogo_t; #endif /* AMSTREAM_H */ - +