1 /* 2 * include/linux/amlogic/media/vfm/vframe_provider.h 3 * 4 * Copyright (C) 2016 Amlogic, Inc. All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 */ 17 18 #ifndef VFRAME_PROVIDER_H 19 #define VFRAME_PROVIDER_H 20 21 /* Standard Linux headers */ 22 #include <linux/list.h> 23 24 /* Amlogic headers */ 25 #include <linux/amlogic/media/vfm/vframe.h> 26 struct vframe_states { 27 int vf_pool_size; 28 int buf_free_num; 29 int buf_recycle_num; 30 int buf_avail_num; 31 } /*vframe_states_t */; 32 33 #define VFRAME_EVENT_RECEIVER_GET 0x01 34 #define VFRAME_EVENT_RECEIVER_PUT 0x02 35 #define VFRAME_EVENT_RECEIVER_FRAME_WAIT 0x04 36 #define VFRAME_EVENT_RECEIVER_POS_CHANGED 0x08 37 #define VFRAME_EVENT_RECEIVER_PARAM_SET 0x10 38 #define VFRAME_EVENT_RECEIVER_RESET 0x20 39 #define VFRAME_EVENT_RECEIVER_FORCE_UNREG 0x40 40 #define VFRAME_EVENT_RECEIVER_GET_AUX_DATA 0x80 41 #define VFRAME_EVENT_RECEIVER_DISP_MODE 0x100 42 #define VFRAME_EVENT_RECEIVER_DOLBY_BYPASS_EL 0x200 43 #define VFRAME_EVENT_RECEIVER_NEED_NO_COMP 0x400 44 #define VFRAME_EVENT_RECEIVER_BUF_COUNT 0x800 45 46 /* for VFRAME_EVENT_RECEIVER_GET_AUX_DATA*/ 47 struct provider_aux_req_s { 48 /*input*/ 49 struct vframe_s *vf; 50 unsigned char bot_flag; 51 /*output*/ 52 char *aux_buf; 53 int aux_size; 54 int dv_enhance_exist; 55 int low_latency; 56 struct tvin_dv_vsif_s dv_vsif;/*dolby vsi info*/ 57 }; 58 59 struct provider_disp_mode_req_s { 60 /*input*/ 61 struct vframe_s *vf; 62 unsigned int req_mode;/*0:get;1:check*/ 63 /*output*/ 64 enum vframe_disp_mode_e disp_mode; 65 }; 66 67 struct vframe_operations_s { 68 struct vframe_s *(*peek)(void *op_arg); 69 struct vframe_s *(*get)(void *op_arg); 70 void (*put)(struct vframe_s *, void *op_arg); 71 int (*event_cb)(int type, void *data, void *private_data); 72 int (*vf_states)(struct vframe_states *states, void *op_arg); 73 }; 74 75 struct vframe_provider_s { 76 const char *name; 77 const struct vframe_operations_s *ops; 78 void *op_arg; 79 struct list_head list; 80 atomic_t use_cnt; 81 void *traceget; 82 void *traceput; 83 } /*vframe_provider_t */; 84 85 extern struct vframe_provider_s *vf_provider_alloc(void); 86 extern void vf_provider_init(struct vframe_provider_s *prov, 87 const char *name, 88 const struct vframe_operations_s *ops, 89 void *op_arg); 90 extern void vf_provider_free(struct vframe_provider_s *prov); 91 92 extern int vf_reg_provider(struct vframe_provider_s *prov); 93 extern void vf_unreg_provider(struct vframe_provider_s *prov); 94 extern int vf_notify_provider(const char *receiver_name, int event_type, 95 void *data); 96 extern int vf_notify_provider_by_name(const char *provider_name, 97 int event_type, void *data); 98 99 void vf_light_reg_provider(struct vframe_provider_s *prov); 100 void vf_light_unreg_provider(struct vframe_provider_s *prov); 101 void vf_ext_light_unreg_provider(struct vframe_provider_s *prov); 102 struct vframe_provider_s *vf_get_provider(const char *name); 103 104 struct vframe_s *vf_peek(const char *receiver); 105 struct vframe_s *vf_get(const char *receiver); 106 void vf_put(struct vframe_s *vf, const char *receiver); 107 int vf_get_states(struct vframe_provider_s *vfp, 108 struct vframe_states *states); 109 int vf_get_states_by_name(const char *receiver_name, 110 struct vframe_states *states); 111 void dump_all_provider(void (*callback)(const char *name)); 112 113 unsigned int get_post_canvas(void); 114 115 struct vframe_s *get_cur_dispbuf(void); 116 int query_video_status(int type, int *value); 117 118 #ifdef CONFIG_V4L_AMLOGIC_VIDEO 119 void v4l_reg_provider(struct vframe_provider_s *prov); 120 void v4l_unreg_provider(void); 121 const struct vframe_provider_s *v4l_get_vfp(void); 122 #endif 123 #endif /* VFRAME_PROVIDER_H */ 124