#define DISPLAY_CANVAS_MAX_INDEX2 0x15
#include "../common/rdma/rdma.h"
#endif
-#include <linux/amlogic/media/video_sink/video_prot.h>
#include <linux/amlogic/media/video_sink/video.h>
#include <linux/amlogic/media/codec_mm/configs.h>
#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
#include <linux/amlogic/pm.h>
#endif
+
+#define VIDEO_PIP
+
static u32 osd_vpp_misc;
static u32 osd_vpp_misc_mask;
static bool update_osd_vpp_misc;
static struct vframe_receiver_s video_vf_recv;
-#define RECEIVER4OSD_NAME "amvideo4osd"
-static int video4osd_receiver_event_fun(int type, void *data, void *);
+#ifdef VIDEO_PIP
+#define RECEIVERPIP_NAME "videopip"
+static int pip_receiver_event_fun(int type, void *data, void *);
-static const struct vframe_receiver_op_s video4osd_vf_receiver = {
- .event_cb = video4osd_receiver_event_fun
+static const struct vframe_receiver_op_s videopip_vf_receiver = {
+ .event_cb = pip_receiver_event_fun
};
-static struct vframe_receiver_s video4osd_vf_recv;
+static struct vframe_receiver_s videopip_vf_recv;
-static struct vframe_provider_s *osd_prov;
+static struct vpp_frame_par_s *curpip_frame_par, *nextpip_frame_par;
+static struct vpp_frame_par_s pip_frame_parms[2];
+static struct vframe_s *cur_pipbuf;
+static struct vframe_s local_pip;
+static int _videopip_set_disable(u32 val);
+#endif
static struct device *amvideo_dev;
static struct device *amvideo_poll_dev;
#define BRIDGE_IRQ_SET() WRITE_CBUS_REG(ISA_TIMERC, 1)
#endif
-
-
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
-
#define VD1_MEM_POWER_ON() \
do { \
unsigned long flags; \
vpu_mem_power_off_count = VPU_MEM_POWEROFF_DELAY; \
spin_unlock_irqrestore(&delay_work_lock, flags); \
} while (0)
-#else
-#define VD1_MEM_POWER_ON()
-#define VD2_MEM_POWER_ON()
-#define PROT_MEM_POWER_ON()
-#define VD1_MEM_POWER_OFF()
-#define VD2_MEM_POWER_OFF()
-#define PROT_MEM_POWER_OFF()
-#endif
#define VIDEO_LAYER_ON() \
do { \
unsigned long flags; \
spin_lock_irqsave(&video_onoff_lock, flags); \
video_onoff_state = VIDEO_ENABLE_STATE_ON_REQ; \
- video_enabled = 1;\
- video_status_saved = 1;\
+ video_enabled = 1; \
+ video_status_saved = 1; \
spin_unlock_irqrestore(&video_onoff_lock, flags); \
} while (0)
unsigned long flags; \
spin_lock_irqsave(&video_onoff_lock, flags); \
video_onoff_state = VIDEO_ENABLE_STATE_OFF_REQ; \
- video_enabled = 0;\
- video_status_saved = 0;\
+ video_enabled = 0; \
+ video_status_saved = 0; \
spin_unlock_irqrestore(&video_onoff_lock, flags); \
} while (0)
unsigned long flags; \
spin_lock_irqsave(&video2_onoff_lock, flags); \
video2_onoff_state = VIDEO_ENABLE_STATE_ON_REQ; \
+ video2_enabled = 1; \
+ video2_status_saved = 1; \
spin_unlock_irqrestore(&video2_onoff_lock, flags); \
} while (0)
unsigned long flags; \
spin_lock_irqsave(&video2_onoff_lock, flags); \
video2_onoff_state = VIDEO_ENABLE_STATE_OFF_REQ; \
+ video2_enabled = 0; \
+ video2_status_saved = 0; \
spin_unlock_irqrestore(&video2_onoff_lock, flags); \
} while (0)
VIDEO_LAYER_ON(); \
} while (0)
-#if 0 /*TV_3D_FUNCTION_OPEN*/
-#define EnableVideoLayer2() \
- do { \
- VD2_MEM_POWER_ON(); \
- SET_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
- VPP_VD2_PREBLEND | VPP_PREBLEND_EN | \
- (0x1ff << VPP_VD2_ALPHA_BIT)); \
- } while (0)
-#else
#define EnableVideoLayer2() \
do { \
VD2_MEM_POWER_ON(); \
VIDEO_LAYER2_ON(); \
} while (0)
-#endif
+
#define VSYNC_EnableVideoLayer2() \
do { \
VD2_MEM_POWER_ON(); \
#define DisableVideoLayer() \
do { \
CLEAR_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
- VPP_VD1_PREBLEND | VPP_VD2_PREBLEND|\
- VPP_VD2_POSTBLEND | VPP_VD1_POSTBLEND); \
+ VPP_VD1_PREBLEND | VPP_VD1_POSTBLEND); \
if (!legacy_vpp) { \
WRITE_VCBUS_REG( \
VD1_BLEND_SRC_CTRL + cur_dev->vpp_off, 0); \
WRITE_VCBUS_REG(AFBC_ENABLE, 0);\
VIDEO_LAYER_OFF(); \
VD1_MEM_POWER_OFF(); \
- video_prot.video_started = 0; \
if (debug_flag & DEBUG_FLAG_BLACKOUT) { \
pr_info("DisableVideoLayer()\n"); \
} \
} while (0)
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
#define DisableVideoLayer_NoDelay() \
do { \
CLEAR_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
pr_info("DisableVideoLayer_NoDelay()\n"); \
} \
} while (0)
-#else
-#define DisableVideoLayer_NoDelay() DisableVideoLayer()
-#endif
-#if 0 /*TV_3D_FUNCTION_OPEN */
-#define DisableVideoLayer2() \
- do { \
- CLEAR_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
- VPP_VD2_PREBLEND | VPP_PREBLEND_EN | \
- (0x1ff << VPP_VD2_ALPHA_BIT)); \
- WRITE_VCBUS_REG(VD2_AFBC_ENABLE, 0); \
- VD2_MEM_POWER_OFF(); \
- } while (0)
-#else
+
#define DisableVideoLayer2() \
do { \
CLEAR_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
- VPP_VD2_POSTBLEND | VPP_VD2_PREBLEND | \
- (0x1ff << VPP_VD2_ALPHA_BIT)); \
+ VPP_VD2_POSTBLEND | VPP_VD2_PREBLEND); \
VIDEO_LAYER2_OFF(); \
VD2_MEM_POWER_OFF(); \
} while (0)
-#endif
+
#define DisableVideoLayer_PREBELEND() \
do { CLEAR_VCBUS_REG_MASK(VPP_MISC + cur_dev->vpp_off, \
VPP_VD1_PREBLEND | VPP_VD2_PREBLEND); \
} \
} while (0)
-#ifndef CONFIG_AM_VIDEO2
-#define DisableVPP2VideoLayer() \
- CLEAR_VCBUS_REG_MASK(VPP2_MISC, \
- VPP_VD1_PREBLEND | VPP_VD2_PREBLEND | \
- VPP_VD2_POSTBLEND | VPP_VD1_POSTBLEND)
-
-#endif
/*********************************************************/
#if DEBUG_TMP
static struct switch_dev video1_state_sdev = {
};
#endif
+static DEFINE_MUTEX(video_layer_mutex);
+static u32 layer_cap;
-#define MAX_ZOOM_RATIO 300
+static struct disp_info_s glayer_info[MAX_VD_LAYERS];
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
+#define MAX_ZOOM_RATIO 300
#define VPP_PREBLEND_VD_V_END_LIMIT 2304
-#else
-#define VPP_PREBLEND_VD_V_END_LIMIT 1080
-#endif
#define DUR2PTS(x) ((x) - ((x) >> 4))
#define DUR2PTS_RM(x) ((x) & 0xf)
static int vpts_chase_pts_diff;
#endif
-
static int step_enable;
static int step_flag;
-
/*seek values on.video_define.h*/
static int debug_flag;
int get_video_debug_flags(void)
int mem_pd_vd1;
int mem_pd_vd2;
int mem_pd_di_post;
- int mem_pd_prot2;
- int mem_pd_prot3;
};
-
#endif
#define PTS_LOGGING
#endif
static struct amvideocap_req *capture_frame_req;
-static struct video_prot_s video_prot;
-static u32 video_angle;
u32 get_video_angle(void)
{
- return video_angle;
+ return glayer_info[0].angle;
}
EXPORT_SYMBOL(get_video_angle);
int video_scaler_notify(int flag)
{
video_scaler_mode = flag;
- video_property_changed = true;
+ video_property_changed = 1;
return 0;
}
void amvideo_set_scaler_para(int x, int y, int w, int h, int flag)
{
+ struct disp_info_s *layer = &glayer_info[0];
+
mutex_lock(&video_module_mutex);
if (w < 2)
w = 0;
content_top = y;
content_w = w;
content_h = h;
- } else
- vpp_set_video_layer_position(x, y, w, h);
- video_property_changed = true;
+ } else {
+ layer->layer_left = x;
+ layer->layer_top = y;
+ layer->layer_width = w;
+ layer->layer_height = h;
+ }
+ video_property_changed = 1;
mutex_unlock(&video_module_mutex);
}
static u32 rdma_canvas_id;
static u32 next_rdma_canvas_id = 1;
+#ifdef VIDEO_PIP
+static u32 pip_rdma_canvas_id;
+static u32 pip_next_rdma_canvas_id = 1;
+static struct vframe_s *pip_rdma_buf;
+static struct vframe_s *pipbuf_to_put;
+#endif
+
#define DISPBUF_TO_PUT_MAX 8
static struct vframe_s *dispbuf_to_put[DISPBUF_TO_PUT_MAX];
static int dispbuf_to_put_num;
static u32 ori2_start_y_lines;
static u32 ori2_end_y_lines;
-/* wide settings */
-static u32 wide_setting;
-
/* black out policy */
#if defined(CONFIG_JPEGLOGO)
static u32 blackout;
static u32 force_blackout;
/* disable video */
+
+#ifdef VIDEO_PIP
+static u32 pip_frame_count;
+static u32 disable_videopip = VIDEO_DISABLE_FORNEXT;
+static int pip_property_changed;
+static u32 pip_frame_ready_to_set;
+static u32 pip_global_output = 1;
+#if 0
+static u32 pip_v_skip;
+static u32 pip_h_skip;
+static u32 pip_start_x_lines;
+static u32 pip_end_x_lines;
+static u32 pip_start_y_lines;
+static u32 pip_end_y_lines;
+#endif
+static u32 pip_loop;
+#endif
+
static u32 disable_video = VIDEO_DISABLE_NONE;
static u32 video_enabled __nosavedata;
+static u32 video2_enabled __nosavedata;
static u32 video_status_saved __nosavedata;
+static u32 video2_status_saved __nosavedata;
static u32 hold_video;
u32 get_video_enabled(void)
{
cur_dispbuf = buf;
}
-int get_video0_frame_info(struct vframe_s *vf)
-{
- unsigned long flags;
- int ret = -1;
-
- spin_lock_irqsave(&lock, flags);
- if (is_vpp_postblend() && cur_dispbuf && vf) {
- *vf = *cur_dispbuf;
- ret = 0;
- }
- spin_unlock_irqrestore(&lock, flags);
- return ret;
-}
-EXPORT_SYMBOL(get_video0_frame_info);
static struct vframe_s vf_local, vf_local2;
static u32 vsync_pts_inc;
/*********************************************************/
+#ifdef VIDEO_PIP
+static inline struct vframe_s *pip_vf_peek(void)
+{
+ if (pip_loop)
+ return cur_dispbuf;
+ return vf_peek(RECEIVERPIP_NAME);
+}
+
+static inline struct vframe_s *pip_vf_get(void)
+{
+ struct vframe_s *vf = NULL;
+
+ if (pip_loop)
+ return cur_dispbuf;
+
+ vf = vf_get(RECEIVERPIP_NAME);
+
+ if (vf) {
+ /* video_notify_flag |= VIDEO_NOTIFY_PROVIDER_GET; */
+ atomic_set(&vf->use_cnt, 1);
+ }
+ return vf;
+
+}
+
+#if 0
+static int pip_vf_get_states(struct vframe_states *states)
+{
+ int ret = -1;
+ unsigned long flags;
+
+ spin_lock_irqsave(&lock, flags);
+ ret = vf_get_states_by_name(RECEIVERPIP_NAME, states);
+ spin_unlock_irqrestore(&lock, flags);
+ return ret;
+}
+#endif
+
+static inline void pip_vf_put(struct vframe_s *vf)
+{
+ struct vframe_provider_s *vfp = vf_get_provider(RECEIVERPIP_NAME);
+
+ if (pip_loop)
+ return;
+
+ if (vfp && vf && atomic_dec_and_test(&vf->use_cnt)) {
+ vf_put(vf, RECEIVERPIP_NAME);
+ /* video_notify_flag |= VIDEO_NOTIFY_PROVIDER_PUT; */
+ }
+}
+#endif
+
static inline struct vframe_s *video_vf_peek(void)
{
struct vframe_s *vf = vf_peek(RECEIVER_NAME);
}
#endif
+static void update_layer_info(u8 layer_id)
+{
+ struct disp_info_s *layer;
+
+ if (layer_id >= MAX_VD_LAYERS)
+ return;
+
+ if (layer_id == 0) {
+ layer = &glayer_info[0];
+ layer->reverse = reverse;
+ layer->proc_3d_type = process_3d_type;
+ } else if (layer_id == 1) {
+ layer = &glayer_info[1];
+ layer->reverse = reverse;
+ layer->proc_3d_type = 0;
+ }
+}
static void vpp_settings_h(struct vpp_frame_par_s *framePtr)
{
(framePtr->supscl_path == PPS_CORE0_POSTBLEND_CORE1))
r3 >>= framePtr->supsc0_hori_ratio;
- if (platform_type == 1) {
- x_lines = zoom_end_x_lines / (framePtr->hscale_skip_count + 1);
- if (process_3d_type & MODE_3D_OUT_TB) {
- /* vd1 and vd2 do pre blend */
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_H_START_END,
+ x_lines = zoom_end_x_lines / (framePtr->hscale_skip_count + 1);
+ if (process_3d_type & MODE_3D_OUT_TB) {
+ /* vd1 and vd2 do pre blend */
+ VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_H_START_END,
((zoom_start_x_lines & VPP_VD_SIZE_MASK) <<
- VPP_VD1_START_BIT) | (((zoom_end_x_lines) &
+ VPP_VD1_START_BIT) | (((zoom_end_x_lines) &
VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END,
+ VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END,
((zoom_start_x_lines & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | (((zoom_end_x_lines) &
VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- VSYNC_WR_MPEG_REG(VPP_POSTBLEND_VD1_H_START_END +
+ VSYNC_WR_MPEG_REG(VPP_POSTBLEND_VD1_H_START_END +
cur_dev->vpp_off,
((framePtr->VPP_hsc_startp & VPP_VD_SIZE_MASK)
<< VPP_VD1_START_BIT) |
((framePtr->VPP_hsc_endp & VPP_VD_SIZE_MASK)
<< VPP_VD1_END_BIT));
- } else if (process_3d_type & MODE_3D_OUT_LR) {
- /* vd1 and vd2 do pre blend */
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_H_START_END,
+ } else if (process_3d_type & MODE_3D_OUT_LR) {
+ /* vd1 and vd2 do pre blend */
+ VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_H_START_END,
((zoom_start_x_lines & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | (((x_lines >> 1) &
VPP_VD_SIZE_MASK) <<
VPP_VD1_END_BIT));
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END,
+ VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END,
((((x_lines + 1) >> 1) & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | ((x_lines &
VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- VSYNC_WR_MPEG_REG(VPP_POSTBLEND_VD1_H_START_END +
+ VSYNC_WR_MPEG_REG(VPP_POSTBLEND_VD1_H_START_END +
cur_dev->vpp_off,
((framePtr->VPP_hsc_startp & VPP_VD_SIZE_MASK)
<< VPP_VD1_START_BIT) |
((framePtr->VPP_hsc_endp & VPP_VD_SIZE_MASK)
<< VPP_VD1_END_BIT));
- } else{
- if (!legacy_vpp) {
- x_lines = (zoom_end_x_lines -
- zoom_start_x_lines + 1)
- / (framePtr->hscale_skip_count + 1);
- VSYNC_WR_MPEG_REG(
+ } else{
+ if (!legacy_vpp) {
+ x_lines = (zoom_end_x_lines -
+ zoom_start_x_lines + 1)
+ / (framePtr->hscale_skip_count + 1);
+ VSYNC_WR_MPEG_REG(
VPP_PREBLEND_VD1_H_START_END,
((0 & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | (((x_lines - 1) &
VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- }
- VSYNC_WR_MPEG_REG(VPP_POSTBLEND_VD1_H_START_END +
- cur_dev->vpp_off,
- ((framePtr->VPP_hsc_startp & VPP_VD_SIZE_MASK)
- << VPP_VD1_START_BIT) |
- ((framePtr->VPP_hsc_endp & VPP_VD_SIZE_MASK)
- << VPP_VD1_END_BIT));
-
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END +
- cur_dev->vpp_off,
- ((framePtr->VPP_hd_start_lines_ &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- ((framePtr->VPP_hd_end_lines_ &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
}
- } else {
- VSYNC_WR_MPEG_REG(VPP_POSTBLEND_VD1_H_START_END +
+ VSYNC_WR_MPEG_REG(
+ VPP_POSTBLEND_VD1_H_START_END +
cur_dev->vpp_off,
((framePtr->VPP_hsc_startp & VPP_VD_SIZE_MASK)
<< VPP_VD1_START_BIT) |
((framePtr->VPP_hsc_endp & VPP_VD_SIZE_MASK)
<< VPP_VD1_END_BIT));
-
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END +
- cur_dev->vpp_off,
- ((framePtr->VPP_hd_start_lines_ &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- ((framePtr->VPP_hd_end_lines_ &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
+#ifdef VIDEO_PIP
+ if (!cur_pipbuf)
+#endif
+ {
+ VSYNC_WR_MPEG_REG(
+ VPP_BLEND_VD2_H_START_END +
+ cur_dev->vpp_off,
+ ((framePtr->VPP_hd_start_lines_ &
+ VPP_VD_SIZE_MASK)
+ << VPP_VD1_START_BIT) |
+ ((framePtr->VPP_hd_end_lines_ &
+ VPP_VD_SIZE_MASK)
+ << VPP_VD1_END_BIT));
+ }
}
+
VSYNC_WR_MPEG_REG(VPP_HSC_REGION12_STARTP +
cur_dev->vpp_off,
(0 << VPP_REGION1_BIT) |
VPP_hd_start_lines_ = 0;
VPP_hd_end_lines_ = ((vf->type & VIDTYPE_COMPRESS) ?
vf->compWidth : vf->width) - 1;
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_H_START_END +
- cur_dev->vpp_off,
- ((VPP_hd_start_lines_ &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- ((VPP_hd_end_lines_ &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
+
+ VSYNC_WR_MPEG_REG(
+ VPP_BLEND_VD2_H_START_END +
+ cur_dev->vpp_off,
+ ((VPP_hd_start_lines_ &
+ VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
+ ((VPP_hd_end_lines_ &
+ VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
}
}
u32 v_phase;
u32 v_skip_flag = 0;
int x, y, w, h;
+ struct disp_info_s *layer = &glayer_info[0];
r = framePtr->VPP_vsc_endp - framePtr->VPP_vsc_startp;
afbc_enble_flag = 0;
else {
afbc_enble_flag = READ_VCBUS_REG(AFBC_ENABLE) & 0x100;
v_phase = vpp_filter->vpp_vsc_start_phase_step;
- vpp_get_video_layer_position(&x, &y, &w, &h);
+
+ x = layer->layer_left;
+ y = layer->layer_top;
+ w = layer->layer_width;
+ h = layer->layer_height;
if (v_phase * (framePtr->vscale_skip_count + 1) > 0x1000000) {
if ((afbc_enble_flag) && (y < 0)) {
if ((framePtr->VPP_vsc_endp < 0x250) ||
}
}
- if (platform_type == 1) {
- y_lines = zoom_end_y_lines / (framePtr->vscale_skip_count + 1);
- if (process_3d_type & MODE_3D_OUT_TB) {
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END,
+ y_lines = zoom_end_y_lines / (framePtr->vscale_skip_count + 1);
+ if (process_3d_type & MODE_3D_OUT_TB) {
+ VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END,
((zoom_start_y_lines & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | (((y_lines >> 1) &
VPP_VD_SIZE_MASK) <<
VPP_VD1_END_BIT));
- VSYNC_WR_MPEG_REG(
+ VSYNC_WR_MPEG_REG(
VPP_BLEND_VD2_V_START_END,
((((y_lines + 1) >> 1) & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) |
((y_lines & VPP_VD_SIZE_MASK) <<
VPP_VD1_END_BIT));
- } else if (process_3d_type & MODE_3D_OUT_LR) {
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END,
+ } else if (process_3d_type & MODE_3D_OUT_LR) {
+ VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END,
((zoom_start_y_lines & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | ((zoom_end_y_lines &
VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END,
+ VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END,
((zoom_start_y_lines & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) | ((zoom_end_y_lines &
VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- } else {
- if ((framePtr->VPP_post_blend_vd_v_end_ -
- framePtr->VPP_post_blend_vd_v_start_ + 1) >
- VPP_PREBLEND_VD_V_END_LIMIT) {
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END +
+ } else {
+ if ((framePtr->VPP_post_blend_vd_v_end_ -
+ framePtr->VPP_post_blend_vd_v_start_ + 1) >
+ VPP_PREBLEND_VD_V_END_LIMIT) {
+ VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END +
cur_dev->vpp_off,
((framePtr->VPP_post_blend_vd_v_start_
& VPP_VD_SIZE_MASK) <<
((framePtr->VPP_post_blend_vd_v_end_ &
VPP_VD_SIZE_MASK)
<< VPP_VD1_END_BIT));
- } else {
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END +
+ } else {
+ VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END +
cur_dev->vpp_off,
((0 & VPP_VD_SIZE_MASK) <<
VPP_VD1_START_BIT) |
(((VPP_PREBLEND_VD_V_END_LIMIT - 1) &
VPP_VD_SIZE_MASK) <<
VPP_VD1_END_BIT));
- }
-
- if (is_need_framepacking_output()) {
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END +
- cur_dev->vpp_off,
- (((((framePtr->VPP_vd_end_lines_ -
- framepacking_blank + 1) / 2) + framepacking_blank) &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- (((framePtr->VPP_vd_end_lines_) &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- } else {
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END +
- cur_dev->vpp_off,
- ((((framePtr->VPP_vd_end_lines_ + 1) / 2) &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- (((framePtr->VPP_vd_end_lines_) &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- }
-
}
- } else {
- if ((framePtr->VPP_post_blend_vd_v_end_ -
- framePtr->VPP_post_blend_vd_v_start_ + 1) >
- VPP_PREBLEND_VD_V_END_LIMIT) {
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END +
- cur_dev->vpp_off,
- ((framePtr->VPP_post_blend_vd_v_start_
- & VPP_VD_SIZE_MASK) <<
- VPP_VD1_START_BIT) |
- ((framePtr->VPP_post_blend_vd_v_end_ &
- VPP_VD_SIZE_MASK)
- << VPP_VD1_END_BIT));
- } else {
- VSYNC_WR_MPEG_REG(VPP_PREBLEND_VD1_V_START_END +
- cur_dev->vpp_off,
- ((0 & VPP_VD_SIZE_MASK) <<
- VPP_VD1_START_BIT) |
- (((VPP_PREBLEND_VD_V_END_LIMIT - 1) &
- VPP_VD_SIZE_MASK) <<
- VPP_VD1_END_BIT));
- }
- if (is_need_framepacking_output()) {
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END +
- cur_dev->vpp_off,
- (((((framePtr->VPP_vd_end_lines_ -
+#ifdef VIDEO_PIP
+ if (!cur_pipbuf)
+#endif
+ {
+ VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END +
+ cur_dev->vpp_off,
+ ((((framePtr->VPP_vd_end_lines_ + 1) / 2) &
+ VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
+ (((framePtr->VPP_vd_end_lines_) &
+ VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
+ }
+ if (is_need_framepacking_output()) {
+ VSYNC_WR_MPEG_REG(
+ VPP_BLEND_VD2_V_START_END +
+ cur_dev->vpp_off,
+ (((((framePtr->VPP_vd_end_lines_ -
framepacking_blank + 1) / 2) + framepacking_blank) &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- (((framePtr->VPP_vd_end_lines_) &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- } else {
- VSYNC_WR_MPEG_REG(VPP_BLEND_VD2_V_START_END +
- cur_dev->vpp_off,
- ((((framePtr->VPP_vd_end_lines_ + 1) / 2) &
- VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
- (((framePtr->VPP_vd_end_lines_) &
- VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
- }
-
+ VPP_VD_SIZE_MASK) << VPP_VD1_START_BIT) |
+ (((framePtr->VPP_vd_end_lines_) &
+ VPP_VD_SIZE_MASK) << VPP_VD1_END_BIT));
+ }
}
VSYNC_WR_MPEG_REG(VPP_VSC_REGION12_STARTP + cur_dev->vpp_off, 0);
VSYNC_WR_MPEG_REG(VPP_VSC_REGION34_STARTP + cur_dev->vpp_off,
}
#ifdef TV_3D_FUNCTION_OPEN
-
static void zoom_get_horz_pos(struct vframe_s *vf, u32 vpp_3d_mode, u32 *ls,
u32 *le, u32 *rs, u32 *re)
{
u32 crop_sx, crop_ex, crop_sy, crop_ey;
+ struct disp_info_s *layer = &glayer_info[0];
if (!vf)
return;
- vpp_get_video_source_crop(&crop_sy, &crop_sx, &crop_ey, &crop_ex);
+
+ crop_sy = layer->crop_top;
+ crop_sx = layer->crop_left;
+ crop_ey = layer->crop_bottom;
+ crop_ex = layer->crop_right;
switch (vpp_3d_mode) {
case VPP_3D_MODE_LR:
u32 *le, u32 *rs, u32 *re)
{
u32 crop_sx, crop_ex, crop_sy, crop_ey, height;
+ struct disp_info_s *layer = &glayer_info[0];
- vpp_get_video_source_crop(&crop_sy, &crop_sx, &crop_ey, &crop_ex);
+ crop_sy = layer->crop_top;
+ crop_sx = layer->crop_left;
+ crop_ey = layer->crop_bottom;
+ crop_ex = layer->crop_right;
if (vf->type & VIDTYPE_INTERLACE)
height = vf->height >> 1;
((r_aligned - l_aligned) << 16));
}
- VSYNC_WR_MPEG_REG(
- VD2_IF0_LUMA_X0 + cur_dev->viu_off,
- (ls << VDIF_PIC_START_BIT) |
- (le << VDIF_PIC_END_BIT));
+#ifdef VIDEO_PIP
+ if (!cur_pipbuf)
+#endif
+ {
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA_X0 + cur_dev->viu_off,
+ (ls << VDIF_PIC_START_BIT) |
+ (le << VDIF_PIC_END_BIT));
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CHROMA_X0 + cur_dev->viu_off,
- (ls / 2 << VDIF_PIC_START_BIT) |
- (le / 2 << VDIF_PIC_END_BIT));
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA_X0 + cur_dev->viu_off,
+ (ls / 2 << VDIF_PIC_START_BIT) |
+ (le / 2 << VDIF_PIC_END_BIT));
- VSYNC_WR_MPEG_REG(
- VD2_IF0_LUMA_X1 + cur_dev->viu_off,
- (rs << VDIF_PIC_START_BIT) |
- (re << VDIF_PIC_END_BIT));
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA_X1 + cur_dev->viu_off,
+ (rs << VDIF_PIC_START_BIT) |
+ (re << VDIF_PIC_END_BIT));
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CHROMA_X1 + cur_dev->viu_off,
- (rs / 2 << VDIF_PIC_START_BIT) |
- (re / 2 << VDIF_PIC_END_BIT));
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA_X1 + cur_dev->viu_off,
+ (rs / 2 << VDIF_PIC_START_BIT) |
+ (re / 2 << VDIF_PIC_END_BIT));
- VSYNC_WR_MPEG_REG(
- VIU_VD2_FMT_W + cur_dev->viu_off,
- (((zoom_end_x_lines - zoom_start_x_lines +
- 1) >> hscale) << VD1_FMT_LUMA_WIDTH_BIT) |
- (((zoom_end_x_lines / 2 - zoom_start_x_lines / 2 +
- 1) >> hscale) << VD1_FMT_CHROMA_WIDTH_BIT));
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_W + cur_dev->viu_off,
+ (((zoom_end_x_lines - zoom_start_x_lines +
+ 1) >> hscale) << VD1_FMT_LUMA_WIDTH_BIT) |
+ (((zoom_end_x_lines / 2 - zoom_start_x_lines / 2 +
+ 1) >> hscale) << VD1_FMT_CHROMA_WIDTH_BIT));
+ }
}
static void vd2_zoom_display_horz(struct vframe_s *vf, int hscale)
if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) {
int l_aligned;
int r_aligned;
- int h_skip = cur_frame_par->hscale_skip_count + 1;
+ int h_skip = hscale + 1;
int c_skip = 2;
/* After TL1, afbc supports 420/422/444*/
u32 ls, le, rs, re;
- /*if (platform_type == 1) {*/
- if (process_3d_type & MODE_3D_ENABLE) {
- zoom_get_vert_pos(vf,
- cur_frame_par->vpp_3d_mode, &ls,
- &le, &rs, &re);
- } else {
- ls = rs = zoom_start_y_lines;
- le = re = zoom_end_y_lines;
- }
- /*} else {
- if (process_3d_type & MODE_3D_ENABLE) {
- zoom_get_vert_pos(cur_dispbuf,
- cur_frame_par->vpp_3d_mode, &ls,
- &le, &rs, &re);
- } else {
- ls = rs = zoom_start_y_lines;
- le = re = zoom_end_y_lines;
- }
+ if (process_3d_type & MODE_3D_ENABLE) {
+ zoom_get_vert_pos(vf,
+ cur_frame_par->vpp_3d_mode, &ls,
+ &le, &rs, &re);
+ } else {
+ ls = rs = zoom_start_y_lines;
+ le = re = zoom_end_y_lines;
}
-*/
if ((vf) && (vf->type & VIDTYPE_MVC)) {
if (is_need_framepacking_output()) {
VD1_IF0_CHROMA_Y1 + cur_dev->viu_off,
((rs / 2) << VDIF_PIC_START_BIT) |
((re / 2) << VDIF_PIC_END_BIT));
- if (platform_type == 1) {
- /* vd2 */
+
+#ifdef VIDEO_PIP
+ if (!cur_pipbuf)
+#endif
+ {
VSYNC_WR_MPEG_REG(
VD2_IF0_LUMA_Y0 + cur_dev->viu_off,
(ls << VDIF_PIC_START_BIT) |
}
}
-static void vd2_zoom_display_vert(struct vframe_s *vf)
+static void vd2_zoom_display_vert(struct vframe_s *vf, int vscale)
{
u32 ls, le, rs, re;
int b_aligned;
int ori_t_aligned;
int ori_b_aligned;
- int v_skip = cur_frame_par->vscale_skip_count + 1;
+ int v_skip = vscale + 1;
int c_skip = 2;
/* After TL1, afbc supports 420/422/444*/
}
#endif
-/* for sdr/hdr/single dv switch with dual dv */
-static u32 last_el_status;
-/* for dual dv switch with different el size */
-static u32 last_el_w;
-bool has_enhanced_layer(struct vframe_s *vf)
+static inline void vd1_path_select(bool afbc)
{
- struct provider_aux_req_s req;
-
- if (!vf)
- return 0;
- if (vf->source_type != VFRAME_SOURCE_TYPE_OTHERS)
- return 0;
- if (!is_dolby_vision_on())
- return 0;
+ u32 misc_off = cur_dev->vpp_off;
- req.vf = vf;
- req.bot_flag = 0;
- req.aux_buf = NULL;
- req.aux_size = 0;
- req.dv_enhance_exist = 0;
- vf_notify_provider_by_name("dvbldec",
- VFRAME_EVENT_RECEIVER_GET_AUX_DATA,
- (void *)&req);
+ if (!legacy_vpp) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VD1_AFBCD0_MISC_CTRL,
+ /* go field sel */
+ (0 << 20) |
+ /* linebuffer en */
+ (0 << 16) |
+ /* vd1 -> dolby -> vpp top */
+ (0 << 14) |
+ /* axi sel: vd1 mif or afbc */
+ ((afbc ? 1 : 0) << 12) |
+ /* data sel: vd1 & afbc0 (not osd4) */
+ (0 << 11) |
+ /* data sel: afbc0 or vd1 */
+ ((afbc ? 1 : 0) << 10) |
+ /* afbc0 to vd1 (not di) */
+ (0 << 9) |
+ /* vd1 mif to vpp (not di) */
+ (0 << 8) |
+ /* afbc0 gclk ctrl */
+ (0 << 0),
+ 0, 22);
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1))
+ VSYNC_WR_MPEG_REG_BITS(
+ VD1_AFBCD0_MISC_CTRL,
+ /* Vd1_afbc0_mem_sel */
+ (afbc ? 1 : 0),
+ 22, 1);
+
+#ifdef CONFIG_AMLOGIC_MEDIA_DEINTERLACE
+ if (!cpu_after_eq(MESON_CPU_MAJOR_ID_G12A))
+ return;
+ if ((DI_POST_REG_RD(DI_POST_CTRL) & 0x100) != 0) {
+ /* check di_vpp_out_en bit */
+ VSYNC_WR_MPEG_REG_BITS(
+ VD1_AFBCD0_MISC_CTRL,
+ /* vd1 mif to di */
+ 1,
+ 8, 2);
+ VSYNC_WR_MPEG_REG_BITS(
+ VD1_AFBCD0_MISC_CTRL,
+ /* go field select di post */
+ 1,
+ 20, 2);
+ }
+#endif
+ } else {
+#ifdef CONFIG_AMLOGIC_MEDIA_DEINTERLACE
+ if ((DI_POST_REG_RD(DI_POST_CTRL) & 0x100) == 0)
+ /* mif sel */
+#endif
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_MISC_CTRL0 + misc_off,
+ 0, 16, 3);
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_MISC_CTRL0 + misc_off,
+ (afbc ? 1 : 0), 20, 1);
+ }
+}
+
+static inline void vd2_path_select(bool afbc)
+{
+ u32 misc_off = cur_dev->vpp_off;
+
+ if (!legacy_vpp) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_AFBCD1_MISC_CTRL,
+ /* go field sel */
+ (0 << 20) |
+ /* linebuffer en */
+ (0 << 16) |
+ /* TODO: vd2 -> dolby -> vpp top ?? */
+ (0 << 14) |
+ /* axi sel: vd2 mif */
+ ((afbc ? 1 : 0) << 12) |
+ /* data sel: vd2 & afbc1 (not osd4) */
+ (0 << 11) |
+ /* data sel: afbc1 */
+ ((afbc ? 1 : 0) << 10) |
+ /* afbc1 to vd2 (not di) */
+ (0 << 9) |
+ /* vd2 mif to vpp (not di) */
+ (0 << 8) |
+ /* afbc1 gclk ctrl */
+ (0 << 0),
+ 0, 22);
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1))
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_AFBCD1_MISC_CTRL,
+ /* Vd2_afbc0_mem_sel */
+ (afbc ? 1 : 0),
+ 22, 1);
+ } else {
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_MISC_CTRL1 + misc_off,
+ (afbc ? 2 : 0), 0, 2);
+ }
+}
+
+#ifdef VIDEO_PIP
+s32 config_vd_pps(
+ u8 layer_id,
+ struct vpp_frame_par_s *cur_frame_par,
+ struct scaler_setting_s *setting,
+ const struct vinfo_s *info)
+{
+ struct vppfilter_mode_s *vpp_filter;
+
+ if (!cur_frame_par || !info || !setting)
+ return -1;
+
+ vpp_filter = &cur_frame_par->vpp_filter;
+ setting->frame_par = cur_frame_par;
+ setting->id = layer_id;
+ setting->misc_reg_offt = 0;
+ /* enable pps as default */
+ setting->sc_top_enable = true;
+ setting->sc_h_enable = true;
+ setting->sc_v_enable = true;
+
+ if ((vpp_filter->vpp_hsc_start_phase_step == 0x1000000)
+ && (vpp_filter->vpp_vsc_start_phase_step == 0x1000000)
+ && (vpp_filter->vpp_hsc_start_phase_step ==
+ vpp_filter->vpp_hf_start_phase_step)
+ && !vpp_filter->vpp_pre_vsc_en
+ && !vpp_filter->vpp_pre_hsc_en
+ && !cur_frame_par->supsc0_enable
+ && !cur_frame_par->supsc1_enable
+ && bypass_pps)
+ setting->sc_top_enable = false;
+
+ /* old chip: vd2 has no pps */
+ if ((legacy_vpp || is_meson_tl1_cpu())
+ && (setting->id != 0))
+ setting->sc_top_enable = false;
+
+ setting->vinfo_width = info->width;
+ setting->vinfo_height = info->height;
+ return 0;
+}
+
+static inline void vd2_scaler_setting(
+ struct scaler_setting_s *setting)
+{
+ u32 misc_off, i;
+ u32 r1, r2, r3;
+ struct vpp_frame_par_s *frame_par;
+ struct vppfilter_mode_s *vpp_filter;
+
+ if (legacy_vpp || !setting
+ || !setting->frame_par
+ || is_meson_tl1_cpu())
+ return;
+
+ frame_par = setting->frame_par;
+ misc_off = setting->misc_reg_offt;
+ vpp_filter = &frame_par->vpp_filter;
+
+ if (setting->sc_top_enable) {
+ u32 sc_misc_val;
+
+ sc_misc_val = VPP_SC_TOP_EN | VPP_SC_V1OUT_EN;
+ if (setting->sc_h_enable) {
+ sc_misc_val |= (((vpp_filter->vpp_pre_hsc_en & 1)
+ << VPP_SC_PREHORZ_EN_BIT)
+ | VPP_SC_HORZ_EN);
+ sc_misc_val |= ((vpp_filter->vpp_horz_coeff[0] & 7)
+ << VPP_SC_HBANK_LENGTH_BIT);
+ }
+
+ if (setting->sc_v_enable) {
+ sc_misc_val |= (((vpp_filter->vpp_pre_vsc_en & 1)
+ << VPP_SC_PREVERT_EN_BIT)
+ | VPP_SC_VERT_EN);
+ sc_misc_val |= ((vpp_filter->vpp_pre_vsc_en & 1)
+ << VPP_LINE_BUFFER_EN_BIT);
+ sc_misc_val |= ((vpp_filter->vpp_vert_coeff[0] & 7)
+ << VPP_SC_VBANK_LENGTH_BIT);
+ }
+ VSYNC_WR_MPEG_REG(
+ VD2_SC_MISC + misc_off,
+ sc_misc_val);
+ } else {
+ setting->sc_v_enable = false;
+ setting->sc_h_enable = false;
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_SC_MISC + misc_off,
+ 0, VPP_SC_TOP_EN_BIT,
+ VPP_SC_TOP_EN_WID);
+ }
+
+ /* horitontal filter settings */
+ if (setting->sc_h_enable) {
+ if (vpp_filter->vpp_horz_coeff[1] & 0x8000) {
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF_IDX + misc_off,
+ VPP_COEF_HORZ | VPP_COEF_9BIT);
+ } else {
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF_IDX + misc_off,
+ VPP_COEF_HORZ);
+ }
+ for (i = 0; i <
+ (vpp_filter->vpp_horz_coeff[1] & 0xff); i++) {
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF + misc_off,
+ vpp_filter->vpp_horz_coeff[i + 2]);
+ }
+ r1 = frame_par->VPP_hsc_linear_startp
+ - frame_par->VPP_hsc_startp;
+ r2 = frame_par->VPP_hsc_linear_endp
+ - frame_par->VPP_hsc_startp;
+ r3 = frame_par->VPP_hsc_endp
+ - frame_par->VPP_hsc_startp;
+
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_HSC_PHASE_CTRL + misc_off,
+ frame_par->VPP_hf_ini_phase_,
+ VPP_HSC_TOP_INI_PHASE_BIT,
+ VPP_HSC_TOP_INI_PHASE_WID);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_HSC_REGION12_STARTP + misc_off,
+ (0 << VPP_REGION1_BIT) |
+ ((r1 & VPP_REGION_MASK)
+ << VPP_REGION2_BIT));
+ VSYNC_WR_MPEG_REG(
+ VD2_HSC_REGION34_STARTP + misc_off,
+ ((r2 & VPP_REGION_MASK)
+ << VPP_REGION3_BIT) |
+ ((r3 & VPP_REGION_MASK)
+ << VPP_REGION4_BIT));
+ VSYNC_WR_MPEG_REG(
+ VD2_HSC_REGION4_ENDP + misc_off, r3);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_HSC_START_PHASE_STEP + misc_off,
+ vpp_filter->vpp_hf_start_phase_step);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_HSC_REGION1_PHASE_SLOPE + misc_off,
+ vpp_filter->vpp_hf_start_phase_slope);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_HSC_REGION3_PHASE_SLOPE + misc_off,
+ vpp_filter->vpp_hf_end_phase_slope);
+ }
+
+ /* vertical filter settings */
+ if (setting->sc_v_enable) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_VSC_PHASE_CTRL + misc_off,
+ (vpp_filter->vpp_vert_coeff[0] == 2) ? 1 : 0,
+ VPP_PHASECTL_DOUBLELINE_BIT,
+ VPP_PHASECTL_DOUBLELINE_WID);
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF_IDX + misc_off,
+ VPP_COEF_VERT);
+ for (i = 0; i < vpp_filter->vpp_vert_coeff[1]; i++) {
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF + misc_off,
+ vpp_filter->vpp_vert_coeff[i + 2]);
+ }
+
+ /* vertical chroma filter settings */
+ if (vpp_filter->vpp_vert_chroma_filter_en) {
+ const u32 *pCoeff =
+ vpp_filter->vpp_vert_chroma_coeff;
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF_IDX + misc_off,
+ VPP_COEF_VERT_CHROMA
+ |VPP_COEF_SEP_EN);
+ for (i = 0; i < pCoeff[1]; i++)
+ VSYNC_WR_MPEG_REG(
+ VD2_SCALE_COEF + misc_off,
+ pCoeff[i + 2]);
+ }
+
+ r1 = frame_par->VPP_vsc_endp
+ - frame_par->VPP_vsc_startp;
+ VSYNC_WR_MPEG_REG(
+ VD2_VSC_REGION12_STARTP + misc_off, 0);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_VSC_REGION34_STARTP + misc_off,
+ ((r1 & VPP_REGION_MASK)
+ << VPP_REGION3_BIT) |
+ ((r1 & VPP_REGION_MASK)
+ << VPP_REGION4_BIT));
+
+ VSYNC_WR_MPEG_REG(
+ VD2_VSC_REGION4_ENDP + misc_off, r1);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_VSC_START_PHASE_STEP + misc_off,
+ vpp_filter->vpp_vsc_start_phase_step);
+ }
+
+ VSYNC_WR_MPEG_REG(
+ VPP_VD2_HDR_IN_SIZE + misc_off,
+ (frame_par->VPP_pic_in_height_ << 16)
+ | frame_par->VPP_line_in_length_);
+}
+
+s32 config_vd_blend(
+ u8 layer_id,
+ struct vpp_frame_par_s *cur_frame_par,
+ struct vframe_s *vf,
+ u32 layer_alpha,
+ struct blend_setting_s *setting)
+{
+ /* u32 type = 0; */
+ u32 vskip, hskip;
+
+ if (!cur_frame_par || !setting || !vf)
+ return -1;
+
+ setting->frame_par = cur_frame_par;
+ setting->id = layer_id;
+ setting->misc_reg_offt = 0;
+
+ setting->layer_alpha = layer_alpha;
+ setting->preblend_h_start = 0;
+ setting->preblend_h_end = 4096;
+ if ((cur_frame_par->VPP_post_blend_vd_v_end_ -
+ cur_frame_par->VPP_post_blend_vd_v_start_ + 1)
+ > VPP_PREBLEND_VD_V_END_LIMIT) {
+ setting->preblend_v_start =
+ cur_frame_par->VPP_post_blend_vd_v_start_;
+ setting->preblend_v_end =
+ cur_frame_par->VPP_post_blend_vd_v_end_;
+ } else {
+ setting->preblend_v_start = 0;
+ setting->preblend_v_end =
+ VPP_PREBLEND_VD_V_END_LIMIT - 1;
+ }
+
+ setting->preblend_h_size =
+ cur_frame_par->VPP_line_in_length_;
+
+ /* old chip, vd2 has no scaler, so only can use mif setting */
+ if ((setting->id != 0) &&
+ (legacy_vpp || is_meson_tl1_cpu())) {
+ vskip = cur_frame_par->vscale_skip_count;
+ hskip = cur_frame_par->hscale_skip_count;
+
+ setting->postblend_h_start =
+ cur_frame_par->VPP_hd_start_lines_;
+ setting->postblend_h_end =
+ cur_frame_par->VPP_hd_start_lines_ +
+ (cur_frame_par->VPP_line_in_length_ >> hskip) - 1;
+ setting->postblend_v_start =
+ cur_frame_par->VPP_vd_start_lines_;
+ setting->postblend_v_end =
+ cur_frame_par->VPP_vd_start_lines_ +
+ (cur_frame_par->VPP_pic_in_height_ >> vskip) - 1;
+ setting->postblend_h_size =
+ cur_frame_par->VPP_post_blend_h_size_;
+ } else {
+ setting->postblend_h_start =
+ cur_frame_par->VPP_hsc_startp;
+ setting->postblend_h_end =
+ cur_frame_par->VPP_hsc_endp;
+ setting->postblend_v_start =
+ cur_frame_par->VPP_vsc_startp;
+ setting->postblend_v_end =
+ cur_frame_par->VPP_vsc_endp;
+ setting->postblend_h_size =
+ cur_frame_par->VPP_post_blend_h_size_;
+ }
+
+ if (!legacy_vpp) {
+ u32 temp_h = cur_frame_par->VPP_pic_in_height_;
+
+ temp_h <<= 16;
+ setting->preblend_h_size |= temp_h;
+
+ temp_h =
+ cur_frame_par->VPP_post_blend_vd_v_end_ + 1;
+ temp_h <<= 16;
+ setting->postblend_h_size |= temp_h;
+ }
+
+#if 0
+ /* TODO: need remove this work around check for afbc */
+ type = vf->type;
+ if (cur_frame_par->nocomp)
+ type &= ~VIDTYPE_COMPRESS;
+
+ if (type & VIDTYPE_COMPRESS) {
+ u32 v_phase;
+ struct vppfilter_mode_s *vpp_filter =
+ &cur_frame_par->vpp_filter;
+ v_phase = vpp_filter->vpp_vsc_start_phase_step;
+ v_phase *= (cur_frame_par->vscale_skip_count + 1);
+ if ((v_phase > 0x1000000) &&
+ (layer->disp_info.layer_top < 0)) {
+ if ((cur_frame_par->VPP_vsc_endp > 0x6) &&
+ ((cur_frame_par->VPP_vsc_endp < 0x250)
+ || (cur_frame_par->VPP_vsc_endp <
+ cur_frame_par->VPP_post_blend_vd_v_end_/2))) {
+ setting->postblend_v_end -= 6;
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
+static inline void vd2_vpp_blend_setting(
+ struct blend_setting_s *setting)
+{
+ u32 misc_off;
+ u32 vd_size_mask = VPP_VD_SIZE_MASK;
+
+ if (!setting)
+ return;
+
+ /* g12a change to 13 bits */
+ if (!legacy_vpp)
+ vd_size_mask = 0x1fff;
+
+ misc_off = 0;
+
+ /* vd2 preblend size should be same postblend size */
+ /* preblend setting */
+ VSYNC_WR_MPEG_REG(
+ VPP_BLEND_VD2_H_START_END + misc_off,
+ ((setting->postblend_h_start & vd_size_mask)
+ << VPP_VD1_START_BIT) |
+ ((setting->postblend_h_end & vd_size_mask)
+ << VPP_VD1_END_BIT));
+
+ VSYNC_WR_MPEG_REG(
+ VPP_BLEND_VD2_V_START_END + misc_off,
+ ((setting->postblend_v_start & vd_size_mask)
+ << VPP_VD1_START_BIT) |
+ ((setting->postblend_v_end & vd_size_mask)
+ << VPP_VD1_END_BIT));
+}
+
+static inline void proc_vd2_vsc_phase_per_vsync(
+ struct vpp_frame_par_s *frame_par,
+ struct vframe_s *vf,
+ u32 vout_type)
+{
+ struct f2v_vphase_s *vphase;
+ u32 misc_off, vin_type;
+ struct vppfilter_mode_s *vpp_filter;
+
+ if (legacy_vpp || is_meson_tl1_cpu()
+ || !frame_par || !vf)
+ return;
+
+ vpp_filter = &frame_par->vpp_filter;
+ misc_off = 0;
+ vin_type = vf->type & VIDTYPE_TYPEMASK;
+ /* vertical phase */
+ vphase = &frame_par->VPP_vf_ini_phase_
+ [vpp_phase_table[vin_type]
+ [vout_type]];
+ VSYNC_WR_MPEG_REG(
+ VD2_VSC_INI_PHASE + misc_off,
+ ((u32) (vphase->phase) << 8));
+
+ if (vphase->repeat_skip >= 0) {
+ /* skip lines */
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_VSC_PHASE_CTRL + misc_off,
+ skip_tab[vphase->repeat_skip],
+ VPP_PHASECTL_INIRCVNUMT_BIT,
+ VPP_PHASECTL_INIRCVNUM_WID +
+ VPP_PHASECTL_INIRPTNUM_WID);
+ } else {
+ /* repeat first line */
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_VSC_PHASE_CTRL + misc_off,
+ 4,
+ VPP_PHASECTL_INIRCVNUMT_BIT,
+ VPP_PHASECTL_INIRCVNUM_WID);
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_VSC_PHASE_CTRL + misc_off,
+ 1 - vphase->repeat_skip,
+ VPP_PHASECTL_INIRPTNUMT_BIT,
+ VPP_PHASECTL_INIRPTNUM_WID);
+ }
+
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_VSC_PHASE_CTRL + misc_off,
+ (vpp_filter->vpp_vert_coeff[0] == 2) ? 1 : 0,
+ VPP_PHASECTL_DOUBLELINE_BIT,
+ VPP_PHASECTL_DOUBLELINE_WID);
+}
+
+static void pip_toggle_frame(struct vframe_s *vf)
+{
+ u32 first_picture = 0;
+
+ if (vf == NULL)
+ return;
+
+ ori2_start_x_lines = 0;
+ ori2_end_x_lines = ((vf->type & VIDTYPE_COMPRESS) ?
+ vf->compWidth : vf->width) - 1;
+ ori2_start_y_lines = 0;
+ ori2_end_y_lines = ((vf->type & VIDTYPE_COMPRESS) ?
+ vf->compHeight : vf->height) - 1;
+
+ if (debug_flag & DEBUG_FLAG_PRINT_TOGGLE_FRAME)
+ pr_info("%s()\n", __func__);
+
+ if ((vf->width == 0) && (vf->height == 0)) {
+ amlog_level(LOG_LEVEL_ERROR,
+ "Video: invalid frame dimension\n");
+ return;
+ }
+ if (cur_pipbuf
+ && (cur_pipbuf != &local_pip)
+ && (cur_pipbuf != vf)) {
+ pip_frame_count++;
+ if (pip_frame_count == 1)
+ first_picture = 1;
+#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
+ if (is_vsync_rdma_enable()) {
+ if (pip_rdma_buf == cur_pipbuf)
+ pipbuf_to_put = cur_pipbuf;
+ else
+ pip_vf_put(cur_pipbuf);
+ } else {
+ if (pipbuf_to_put) {
+ pip_vf_put(
+ pipbuf_to_put);
+ pipbuf_to_put = NULL;
+ }
+ pip_vf_put(cur_pipbuf);
+ }
+#else
+ pip_vf_put(cur_pipbuf);
+#endif
+ } else if (!cur_pipbuf
+ || (cur_pipbuf == &local_pip))
+ first_picture = 1;
+
+ /* switch buffer */
+ if (vf->type & VIDTYPE_COMPRESS) {
+ VSYNC_WR_MPEG_REG(VD2_AFBC_HEAD_BADDR,
+ vf->compHeadAddr>>4);
+ VSYNC_WR_MPEG_REG(VD2_AFBC_BODY_BADDR,
+ vf->compBodyAddr>>4);
+ }
+ if (vf->canvas0Addr != 0) {
+#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
+ if (vf->canvas0Addr != (u32)-1) {
+ canvas_copy(vf->canvas0Addr & 0xff,
+ disp_canvas_index[pip_rdma_canvas_id][3]);
+ canvas_copy((vf->canvas0Addr >> 8) & 0xff,
+ disp_canvas_index[pip_rdma_canvas_id][4]);
+ canvas_copy((vf->canvas0Addr >> 16) & 0xff,
+ disp_canvas_index[pip_rdma_canvas_id][5]);
+ } else {
+ vframe_canvas_set(&vf->canvas0_config[0],
+ vf->plane_num,
+ &disp_canvas_index[pip_rdma_canvas_id][3]);
+ }
+
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CANVAS0 + cur_dev->viu_off,
+ disp_canvas[pip_rdma_canvas_id][1]);
+
+ pip_next_rdma_canvas_id = pip_rdma_canvas_id ? 0 : 1;
+#endif
+ }
+
+ if (pip_property_changed) {
+ first_picture = 1;
+ pip_property_changed = 0;
+ }
+ if (cur_pipbuf != vf)
+ vf->type_backup = vf->type;
+
+ /* enable new config on the new frames */
+ if ((first_picture) || (cur_pipbuf &&
+ ((cur_pipbuf->bufWidth != vf->bufWidth) ||
+ (cur_pipbuf->width != vf->width) ||
+ (cur_pipbuf->height != vf->height) ||
+ (cur_pipbuf->bitdepth != vf->bitdepth) ||
+ (cur_pipbuf->trans_fmt != vf->trans_fmt) ||
+ (cur_pipbuf->ratio_control != vf->ratio_control) ||
+ ((cur_pipbuf->type_backup & VIDTYPE_INTERLACE) !=
+ (vf->type_backup & VIDTYPE_INTERLACE)) ||
+ (cur_pipbuf->type != vf->type)))) {
+ int iret;
+
+ /* apply new vpp settings */
+ nextpip_frame_par =
+ (&pip_frame_parms[0] == nextpip_frame_par) ?
+ &pip_frame_parms[1] : &pip_frame_parms[0];
+
+ update_layer_info(1);
+ if (legacy_vpp || is_meson_tl1_cpu())
+ iret = vpp_set_filters_no_scaler(
+ &glayer_info[1], vf,
+ nextpip_frame_par, vinfo);
+ else
+ iret = vpp_set_filters(
+ &glayer_info[1], vf,
+ nextpip_frame_par, vinfo,
+ true);
+
+ if (iret == VppFilter_Success_and_Changed)
+ pip_property_changed = 1;
+
+ pip_frame_ready_to_set = 1;
+ }
+
+ if (((vf->type & VIDTYPE_NO_VIDEO_ENABLE) == 0) &&
+ (!pip_property_changed || (vf != cur_pipbuf))) {
+ if (disable_videopip == VIDEO_DISABLE_FORNEXT) {
+ EnableVideoLayer2();
+ disable_videopip = VIDEO_DISABLE_NONE;
+ }
+ if (first_picture &&
+ (disable_videopip !=
+ VIDEO_DISABLE_NORMAL)) {
+ EnableVideoLayer2();
+ }
+ }
+ cur_pipbuf = vf;
+ if (first_picture)
+ pip_frame_ready_to_set = 1;
+}
+
+static void pip_set_dcu(struct vpp_frame_par_s *frame_par, struct vframe_s *vf)
+{
+ u32 r;
+ u32 vphase, vini_phase;
+ u32 pat, loop;
+ static const u32 vpat[MAX_VSKIP_COUNT + 1] = {
+ 0, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
+ u32 u, v;
+ u32 type, bit_mode = 0;
+
+ if (!vf || !frame_par) {
+ pr_err("pip_set_dcu vf is NULL\n");
+ return;
+ }
+
+ type = vf->type;
+ pr_debug("pip_set_dcu %p, type:0x%x\n", vf, type);
+
+ if (frame_par->nocomp)
+ type &= ~VIDTYPE_COMPRESS;
+
+ if (type & VIDTYPE_COMPRESS) {
+ r = (3 << 24) |
+ (vpp_hold_line << 16) |
+ ((legacy_vpp ? 1 : 2) << 14) | /* burst1 */
+ (vf->bitdepth & BITDEPTH_MASK);
+
+ if (frame_par->hscale_skip_count)
+ r |= 0x33;
+ if (frame_par->vscale_skip_count)
+ r |= 0xcc;
+
+#ifdef TV_REVERSE
+ if (reverse)
+ r |= (1<<26) | (1<<27);
+#endif
+ if (vf->bitdepth & BITDEPTH_SAVING_MODE)
+ r |= (1<<28); /* mem_saving_mode */
+ if (type & VIDTYPE_SCATTER)
+ r |= (1<<29);
+ VSYNC_WR_MPEG_REG(VD2_AFBC_MODE, r);
+
+ r = 0x1700;
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1)) {
+ if (vf && (vf->source_type
+ != VFRAME_SOURCE_TYPE_HDMI))
+ r |= (1 << 19); /* dos_uncomp */
+ }
+ VSYNC_WR_MPEG_REG(VD2_AFBC_ENABLE, r);
+
+ r = 0x100;
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1)) {
+ if (type & VIDTYPE_VIU_444)
+ r |= 0;
+ else if (type & VIDTYPE_VIU_422)
+ r |= (1 << 12);
+ else
+ r |= (2 << 12);
+ }
+ VSYNC_WR_MPEG_REG(VD2_AFBC_CONV_CTRL, r);
+
+ u = (vf->bitdepth >> (BITDEPTH_U_SHIFT)) & 0x3;
+ v = (vf->bitdepth >> (BITDEPTH_V_SHIFT)) & 0x3;
+ VSYNC_WR_MPEG_REG(VD2_AFBC_DEC_DEF_COLOR,
+ 0x3FF00000 | /*Y,bit20+*/
+ 0x80 << (u + 10) |
+ 0x80 << v);
+ /* chroma formatter */
+ r = HFORMATTER_EN |
+ (0x8 << VFORMATTER_PHASE_BIT) |
+ VFORMATTER_EN;
+#if 0 /* def CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION */
+ if (is_meson_txlx_package_962X()
+ && !is_dolby_vision_stb_mode()
+ && is_dolby_vision_on()) {
+ r |= HFORMATTER_REPEAT |
+ HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_ALWAYS_RPT |
+ (0 << VFORMATTER_INIPHASE_BIT) |
+ (0x8 << VFORMATTER_PHASE_BIT) |
+ VFORMATTER_EN;
+ } else
+#endif
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1)) {
+ r = HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ (0x8 << VFORMATTER_PHASE_BIT) |
+ VFORMATTER_EN;
+
+ if (is_dolby_vision_on())
+ r |= HFORMATTER_REPEAT |
+ (0xc << VFORMATTER_INIPHASE_BIT);
+ else
+ r |= HFORMATTER_RRT_PIXEL0 |
+ (0 << VFORMATTER_INIPHASE_BIT);
+
+ if (type & VIDTYPE_VIU_444) {
+ r &= ~HFORMATTER_EN;
+ r &= ~VFORMATTER_EN;
+ r &= ~HFORMATTER_YC_RATIO_2_1;
+ } else if (type & VIDTYPE_VIU_422) {
+ r &= ~VFORMATTER_EN;
+ }
+ } else {
+ r = HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ (0x8 << VFORMATTER_PHASE_BIT) |
+ VFORMATTER_EN;
+ if (is_dolby_vision_on())
+ r |= HFORMATTER_REPEAT |
+ (0xc << VFORMATTER_INIPHASE_BIT);
+ else
+ r |= HFORMATTER_RRT_PIXEL0 |
+ (0 << VFORMATTER_INIPHASE_BIT);
+ }
+ VSYNC_WR_MPEG_REG(VD2_AFBC_VD_CFMT_CTRL, r);
+
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1)) {
+ if (type & VIDTYPE_COMPRESS_LOSS)
+ VSYNC_WR_MPEG_REG(
+ VD2_AFBCDEC_IQUANT_ENABLE,
+ ((1 << 11) |
+ (1 << 10) |
+ (1 << 4) |
+ (1 << 0)));
+ else
+ VSYNC_WR_MPEG_REG(
+ VD2_AFBCDEC_IQUANT_ENABLE, 0);
+ }
+
+ vd2_path_select(true);
+ VSYNC_WR_MPEG_REG(VD2_IF0_GEN_REG +
+ cur_dev->viu_off, 0);
+ return;
+ }
+
+ if ((vf->bitdepth & BITDEPTH_Y10) &&
+ (!frame_par->nocomp)) {
+ if (vf->type & VIDTYPE_VIU_444) {
+ bit_mode = 2;
+ } else {
+ if (vf->bitdepth & FULL_PACK_422_MODE)
+ bit_mode = 3;
+ else
+ bit_mode = 1;
+ }
+ } else {
+ bit_mode = 0;
+ }
+ vd2_path_select(false);
+ if (!legacy_vpp) {
+ VSYNC_WR_MPEG_REG_BITS(
+ G12_VD2_IF0_GEN_REG3,
+ (bit_mode & 0x3), 8, 2);
+ } else {
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_IF0_GEN_REG3 + cur_dev->viu_off,
+ (bit_mode&0x3), 8, 2);
+ }
+ if (!(VSYNC_RD_MPEG_REG(VIU_MISC_CTRL1) & 0x1))
+ VSYNC_WR_MPEG_REG(VD2_AFBC_ENABLE, 0);
+ if (type & VIDTYPE_VIU_NV21)
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_IF0_GEN_REG2 +
+ cur_dev->viu_off, 1, 0, 1);
+ else
+ VSYNC_WR_MPEG_REG_BITS(
+ VD2_IF0_GEN_REG2 +
+ cur_dev->viu_off, 0, 0, 1);
+
+ r = (3 << VDIF_URGENT_BIT) |
+ (vpp_hold_line << VDIF_HOLD_LINES_BIT) |
+ VDIF_FORMAT_SPLIT |
+ VDIF_CHRO_RPT_LAST | VDIF_ENABLE;
+ /* | VDIF_RESET_ON_GO_FIELD;*/
+ if (debug_flag & DEBUG_FLAG_GOFIELD_MANUL)
+ r |= 1<<7; /*for manul triggle gofiled.*/
+
+ if ((type & VIDTYPE_VIU_SINGLE_PLANE) == 0)
+ r |= VDIF_SEPARATE_EN;
+ else {
+ if (type & VIDTYPE_VIU_422)
+ r |= VDIF_FORMAT_422;
+ else {
+ r |= VDIF_FORMAT_RGB888_YUV444 |
+ VDIF_DEMUX_MODE_RGB_444;
+ }
+ }
+
+ if (frame_par->hscale_skip_count)
+ r |= VDIF_CHROMA_HZ_AVG | VDIF_LUMA_HZ_AVG;
+
+ VSYNC_WR_MPEG_REG(VD2_IF0_GEN_REG + cur_dev->viu_off, r);
+
+#ifdef TV_REVERSE
+ if (reverse) {
+ VSYNC_WR_MPEG_REG_BITS((VD2_IF0_GEN_REG2 +
+ cur_dev->viu_off), 0xf, 2, 4);
+ } else {
+ VSYNC_WR_MPEG_REG_BITS((VD2_IF0_GEN_REG2 +
+ cur_dev->viu_off), 0, 2, 4);
+ }
+#endif
+
+ /* chroma formatter */
+ if (type & VIDTYPE_VIU_444) {
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ HFORMATTER_YC_RATIO_1_1);
+ } else if (type & VIDTYPE_VIU_FIELD) {
+ vini_phase = 0xc << VFORMATTER_INIPHASE_BIT;
+ vphase = ((type & VIDTYPE_VIU_422) ? 0x10 : 0x08)
+ << VFORMATTER_PHASE_BIT;
+ if (is_meson_gxtvbb_cpu() || is_meson_txl_cpu() ||
+ is_meson_txlx_cpu()) {
+ if ((vf->width >= 3840) &&
+ (vf->height >= 2160) &&
+ (type & VIDTYPE_VIU_422)) {
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ HFORMATTER_RRT_PIXEL0 |
+ HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ vini_phase | vphase);
+ } else {
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ HFORMATTER_REPEAT |
+ HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ vini_phase | vphase |
+ VFORMATTER_EN);
+ }
+ } else {
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ HFORMATTER_REPEAT |
+ HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ vini_phase | vphase |
+ VFORMATTER_EN);
+ }
+ } else if ((type & VIDTYPE_TYPEMASK) == VIDTYPE_INTERLACE_TOP) {
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ (0xe << VFORMATTER_INIPHASE_BIT) |
+ (((type & VIDTYPE_VIU_422) ? 0x10 : 0x08)
+ << VFORMATTER_PHASE_BIT) |
+ VFORMATTER_EN);
+ } else {
+ VSYNC_WR_MPEG_REG(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ HFORMATTER_REPEAT |
+ HFORMATTER_YC_RATIO_2_1 |
+ HFORMATTER_EN |
+ VFORMATTER_RPTLINE0_EN |
+ (0xc << VFORMATTER_INIPHASE_BIT) |
+ (((type & VIDTYPE_VIU_422) ? 0x10 : 0x08)
+ << VFORMATTER_PHASE_BIT) |
+ VFORMATTER_EN);
+ }
+
+ if (is_meson_txlx_cpu()
+ || is_meson_g12a_cpu()
+ || is_meson_g12b_cpu())
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_VD2_FMT_CTRL + cur_dev->viu_off,
+ 1, 29, 1);
+
+ /* LOOP/SKIP pattern */
+ pat = vpat[frame_par->vscale_skip_count];
+
+ if (type & VIDTYPE_VIU_FIELD) {
+ loop = 0;
+
+ if (type & VIDTYPE_INTERLACE)
+ pat = vpat[frame_par->vscale_skip_count >> 1];
+ } else if (type & VIDTYPE_MVC) {
+ loop = 0x11;
+ pat = 0x80;
+ } else if ((type & VIDTYPE_TYPEMASK) == VIDTYPE_INTERLACE_TOP) {
+ loop = 0x11;
+ pat <<= 4;
+ } else
+ loop = 0;
+
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_RPT_LOOP + cur_dev->viu_off,
+ (loop << VDIF_CHROMA_LOOP1_BIT) |
+ (loop << VDIF_LUMA_LOOP1_BIT) |
+ (loop << VDIF_CHROMA_LOOP0_BIT) |
+ (loop << VDIF_LUMA_LOOP0_BIT));
+
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA0_RPT_PAT + cur_dev->viu_off, pat);
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA0_RPT_PAT + cur_dev->viu_off, pat);
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA1_RPT_PAT + cur_dev->viu_off, pat);
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA1_RPT_PAT + cur_dev->viu_off, pat);
+
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA_PSEL + cur_dev->viu_off, 0);
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA_PSEL + cur_dev->viu_off, 0);
+}
+#endif
+
+/* for sdr/hdr/single dv switch with dual dv */
+static u32 last_el_status;
+/* for dual dv switch with different el size */
+static u32 last_el_w;
+bool has_enhanced_layer(struct vframe_s *vf)
+{
+ struct provider_aux_req_s req;
+
+ if (!vf)
+ return 0;
+ if (vf->source_type != VFRAME_SOURCE_TYPE_OTHERS)
+ return 0;
+ if (!is_dolby_vision_on())
+ return 0;
+
+ req.vf = vf;
+ req.bot_flag = 0;
+ req.aux_buf = NULL;
+ req.aux_size = 0;
+ req.dv_enhance_exist = 0;
+ vf_notify_provider_by_name("dvbldec",
+ VFRAME_EVENT_RECEIVER_GET_AUX_DATA,
+ (void *)&req);
return req.dv_enhance_exist;
}
u32 property_changed_true;
bool vf_with_el = false;
bool force_toggle = false;
long long *clk_array;
+ bool is_mvc = false;
if (vf == NULL)
return;
frame_count++;
toggle_count++;
+ if (vf->type & VIDTYPE_MVC)
+ is_mvc = true;
+
if (is_dolby_vision_enable())
vf_with_el = has_enhanced_layer(vf);
}
if (hold_video) {
- if ((cur_dispbuf != vf)
- && (vf->source_type != VFRAME_SOURCE_TYPE_OSD)) {
+ if (cur_dispbuf != vf) {
new_frame_count++;
if (vf->pts != 0) {
amlog_mask(LOG_MASK_TIMESTAMP,
if ((cur_dispbuf) && (cur_dispbuf != &vf_local) && (cur_dispbuf != vf)
&& (video_property_changed != 2)) {
- if (cur_dispbuf->source_type == VFRAME_SOURCE_TYPE_OSD) {
- if (osd_prov && osd_prov->ops && osd_prov->ops->put) {
- osd_prov->ops->put(cur_dispbuf,
- osd_prov->op_arg);
- if (debug_flag & DEBUG_FLAG_BLACKOUT) {
- pr_info(
- "[v4o]pre vf is osd,put it\n");
- }
- }
+ new_frame_count++;
+ if (new_frame_count == 1)
first_picture = 1;
- if (debug_flag & DEBUG_FLAG_BLACKOUT) {
- pr_info(
- "[v4o] pre vf is osd, clear it to NULL\n");
- }
- } else {
- new_frame_count++;
- if (new_frame_count == 1)
- first_picture = 1;
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
- if (is_vsync_rdma_enable()) {
+ if (is_vsync_rdma_enable()) {
#ifdef RDMA_RECYCLE_ORDERED_VFRAMES
- if (dispbuf_to_put_num < DISPBUF_TO_PUT_MAX) {
- dispbuf_to_put[dispbuf_to_put_num] =
- cur_dispbuf;
- dispbuf_to_put_num++;
- } else
- video_vf_put(cur_dispbuf);
+ if (dispbuf_to_put_num < DISPBUF_TO_PUT_MAX) {
+ dispbuf_to_put[dispbuf_to_put_num] =
+ cur_dispbuf;
+ dispbuf_to_put_num++;
+ } else
+ video_vf_put(cur_dispbuf);
#else
- if (cur_rdma_buf == cur_dispbuf) {
- dispbuf_to_put[0] = cur_dispbuf;
- dispbuf_to_put_num = 1;
- } else
- video_vf_put(cur_dispbuf);
+ if (cur_rdma_buf == cur_dispbuf) {
+ dispbuf_to_put[0] = cur_dispbuf;
+ dispbuf_to_put_num = 1;
+ } else
+ video_vf_put(cur_dispbuf);
#endif
- } else {
- int i;
+ } else {
+ int i;
- for (i = 0; i < dispbuf_to_put_num; i++) {
- if (dispbuf_to_put[i]) {
- video_vf_put(
- dispbuf_to_put[i]);
- dispbuf_to_put[i] = NULL;
- }
- dispbuf_to_put_num = 0;
+ for (i = 0; i < dispbuf_to_put_num; i++) {
+ if (dispbuf_to_put[i]) {
+ video_vf_put(
+ dispbuf_to_put[i]);
+ dispbuf_to_put[i] = NULL;
}
- video_vf_put(cur_dispbuf);
+ dispbuf_to_put_num = 0;
}
-#else
video_vf_put(cur_dispbuf);
+ }
+#else
+ video_vf_put(cur_dispbuf);
#endif
- if (debug_flag & DEBUG_FLAG_LATENCY) {
- vf->ready_clock[3] = sched_clock();
- pr_info("video toggle latency %lld ms,"
- "video get latency %lld ms,"
- "vdin put latency %lld ms,"
- "first %lld ms.\n",
- func_div(vf->ready_clock[3], 1000),
- func_div(vf->ready_clock[2], 1000),
- func_div(vf->ready_clock[1], 1000),
- func_div(vf->ready_clock[0], 1000));
- cur_dispbuf->ready_clock[4] = sched_clock();
- clk_array = cur_dispbuf->ready_clock;
- pr_info("video put latency %lld ms,"
- "video toggle latency %lld ms,"
- "video get latency %lld ms,"
- "vdin put latency %lld ms,"
- "first %lld ms.\n",
- func_div(*(clk_array + 4), 1000),
- func_div(*(clk_array + 3), 1000),
- func_div(*(clk_array + 2), 1000),
- func_div(*(clk_array + 1), 1000),
- func_div(*clk_array, 1000));
- }
+ if (debug_flag & DEBUG_FLAG_LATENCY) {
+ vf->ready_clock[3] = sched_clock();
+ pr_info(
+ "video toggle latency %lld ms, video get latency %lld ms, vdin put latency %lld ms, first %lld ms.\n",
+ func_div(vf->ready_clock[3], 1000),
+ func_div(vf->ready_clock[2], 1000),
+ func_div(vf->ready_clock[1], 1000),
+ func_div(vf->ready_clock[0], 1000));
+ cur_dispbuf->ready_clock[4] = sched_clock();
+ clk_array = cur_dispbuf->ready_clock;
+ pr_info("video put latency %lld ms, video toggle latency %lld ms, video get latency %lld ms, vdin put latency %lld ms, first %lld ms.\n",
+ func_div(*(clk_array + 4), 1000),
+ func_div(*(clk_array + 3), 1000),
+ func_div(*(clk_array + 2), 1000),
+ func_div(*(clk_array + 1), 1000),
+ func_div(*clk_array, 1000));
}
-
} else
first_picture = 1;
if (video_property_changed) {
property_changed_true = 2;
- video_property_changed = false;
+ video_property_changed = 0;
first_picture = 1;
}
if (property_changed_true > 0) {
first_picture = 1;
}
- if (debug_flag & DEBUG_FLAG_BLACKOUT) {
- if (first_picture) {
- pr_info
- ("[video4osd] first %s picture {%d,%d} pts:%x,\n",
- (vf->source_type ==
- VFRAME_SOURCE_TYPE_OSD) ? "OSD" : "", vf->width,
- vf->height, vf->pts);
- }
- }
+ if ((debug_flag & DEBUG_FLAG_BLACKOUT)
+ && first_picture)
+ pr_info("first picture {%d,%d} pts:%x,\n",
+ vf->width, vf->height, vf->pts);
+
/* switch buffer */
post_canvas = vf->canvas0Addr;
if ((get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) &&
vf->plane_num,
&disp_canvas_index[rdma_canvas_id][0]);
}
- if (!vf_with_el) {
+ if (is_mvc) {
if (vf->canvas1Addr != (u32)-1) {
canvas_copy(vf->canvas1Addr & 0xff,
disp_canvas_index[rdma_canvas_id][3]);
VSYNC_WR_MPEG_REG(
VD1_IF0_CANVAS0 + cur_dev->viu_off,
disp_canvas[rdma_canvas_id][0]);
- if (platform_type == 0) {
- VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 + cur_dev->viu_off,
- disp_canvas[rdma_canvas_id][0]);
- if (!vf_with_el) {
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CANVAS0 + cur_dev->viu_off,
- disp_canvas[rdma_canvas_id][1]);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CANVAS1 + cur_dev->viu_off,
- disp_canvas[rdma_canvas_id][1]);
- }
- } else {
- if (!vf_with_el)
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CANVAS0 + cur_dev->viu_off,
- disp_canvas[rdma_canvas_id][1]);
- if (cur_frame_par &&
+ if (is_mvc)
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CANVAS0 + cur_dev->viu_off,
+ disp_canvas[rdma_canvas_id][1]);
+ if (cur_frame_par &&
(cur_frame_par->vpp_2pic_mode == 1)) {
- VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[rdma_canvas_id][0]);
- if (!vf_with_el)
- VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
+ if (is_mvc)
+ VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[rdma_canvas_id][0]);
- } else {
- VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
+ } else {
+ VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[rdma_canvas_id][1]);
- if (!vf_with_el)
- VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
+ if (is_mvc)
+ VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[rdma_canvas_id][0]);
- }
}
if (cur_frame_par
&& (process_3d_type & MODE_3D_ENABLE)
&& (process_3d_type & MODE_3D_TO_2D_R)
&& (cur_frame_par->vpp_2pic_mode == VPP_SELECT_PIC1)
- && !vf_with_el) {
+ && is_mvc) {
VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS0 + cur_dev->viu_off,
disp_canvas[rdma_canvas_id][1]);
VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 + cur_dev->viu_off,
VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 + cur_dev->viu_off,
disp_canvas[rdma_canvas_id][1]);
}
- /* VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1,*/
- /*disp_canvas[rdma_canvas_id][1]); */
next_rdma_canvas_id = rdma_canvas_id ? 0 : 1;
#else
canvas_copy(vf->canvas0Addr & 0xff, disp_canvas_index[0]);
disp_canvas_index[1]);
canvas_copy((vf->canvas0Addr >> 16) & 0xff,
disp_canvas_index[2]);
- canvas_copy(vf->canvas1Addr & 0xff, disp_canvas_index[3]);
- canvas_copy((vf->canvas1Addr >> 8) & 0xff,
- disp_canvas_index[4]);
- canvas_copy((vf->canvas1Addr >> 16) & 0xff,
- disp_canvas_index[5]);
- if (platform_type == 0) {
- VSYNC_WR_MPEG_REG(
- VD1_IF0_CANVAS0 + cur_dev->viu_off,
- disp_canvas[0]);
- VSYNC_WR_MPEG_REG(
- VD1_IF0_CANVAS1 + cur_dev->viu_off,
- disp_canvas[0]);
- if (!vf_with_el) {
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CANVAS0 + cur_dev->viu_off,
- disp_canvas[1]);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CANVAS1 + cur_dev->viu_off,
- disp_canvas[1]);
- }
- } else {
- VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS0 + cur_dev->viu_off,
- disp_canvas[0]);
- if (!vf_with_el)
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CANVAS0 + cur_dev->viu_off,
- disp_canvas[0]);
- if (cur_frame_par &&
+ if (is_mvc) {
+ canvas_copy(vf->canvas1Addr & 0xff,
+ disp_canvas_index[3]);
+ canvas_copy((vf->canvas1Addr >> 8) & 0xff,
+ disp_canvas_index[4]);
+ canvas_copy((vf->canvas1Addr >> 16) & 0xff,
+ disp_canvas_index[5]);
+ }
+ VSYNC_WR_MPEG_REG(
+ VD1_IF0_CANVAS0 + cur_dev->viu_off,
+ disp_canvas[0]);
+ if (is_mvc)
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CANVAS0 + cur_dev->viu_off,
+ disp_canvas[0]);
+ if (cur_frame_par &&
(cur_frame_par->vpp_2pic_mode == 1)) {
- VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[0]);
- if (!vf_with_el)
- VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
+ if (is_mvc)
+ VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[0]);
- } else {
- VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
+ } else {
+ VSYNC_WR_MPEG_REG(VD1_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[1]);
- if (!vf_with_el)
- VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
+ if (is_mvc)
+ VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +
cur_dev->viu_off,
disp_canvas[1]);
- }
- /* VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS0 +*/
- /*cur_dev->viu_off, disp_canvas[0]); */
- /* VSYNC_WR_MPEG_REG(VD2_IF0_CANVAS1 +*/
- /*cur_dev->viu_off, disp_canvas[1]); */
}
#endif
}
/* set video PTS */
if (cur_dispbuf != vf) {
- if (vf->source_type != VFRAME_SOURCE_TYPE_OSD) {
- if (vf->pts != 0) {
- amlog_mask(LOG_MASK_TIMESTAMP,
- "vpts to: 0x%x, scr: 0x%x, abs_scr: 0x%x\n",
- vf->pts, timestamp_pcrscr_get(),
- READ_MPEG_REG(SCR_HIU));
-
- timestamp_vpts_set(vf->pts);
- } else if (cur_dispbuf) {
- amlog_mask(LOG_MASK_TIMESTAMP,
- "vpts inc: 0x%x, scr: 0x%x, abs_scr: 0x%x\n",
- timestamp_vpts_get() +
- DUR2PTS(cur_dispbuf->duration),
- timestamp_pcrscr_get(),
- READ_MPEG_REG(SCR_HIU));
-
- timestamp_vpts_inc(DUR2PTS
- (cur_dispbuf->duration));
-
- vpts_remainder +=
- DUR2PTS_RM(cur_dispbuf->duration);
- if (vpts_remainder >= 0xf) {
- vpts_remainder -= 0xf;
- timestamp_vpts_inc(-1);
- }
- }
- } else {
- first_picture = 1;
- if (debug_flag & DEBUG_FLAG_BLACKOUT) {
- pr_info(
- "[v4o] cur vframe is osd, do not set PTS\n");
+ if (vf->pts != 0) {
+ amlog_mask(LOG_MASK_TIMESTAMP,
+ "vpts to: 0x%x, scr: 0x%x, abs_scr: 0x%x\n",
+ vf->pts, timestamp_pcrscr_get(),
+ READ_MPEG_REG(SCR_HIU));
+ timestamp_vpts_set(vf->pts);
+ } else if (cur_dispbuf) {
+ amlog_mask(LOG_MASK_TIMESTAMP,
+ "vpts inc: 0x%x, scr: 0x%x, abs_scr: 0x%x\n",
+ timestamp_vpts_get() +
+ DUR2PTS(cur_dispbuf->duration),
+ timestamp_pcrscr_get(),
+ READ_MPEG_REG(SCR_HIU));
+
+ timestamp_vpts_inc(DUR2PTS
+ (cur_dispbuf->duration));
+
+ vpts_remainder +=
+ DUR2PTS_RM(cur_dispbuf->duration);
+ if (vpts_remainder >= 0xf) {
+ vpts_remainder -= 0xf;
+ timestamp_vpts_inc(-1);
}
}
vf->type_backup = vf->type;
((cur_dispbuf->type_backup & VIDTYPE_INTERLACE) !=
(vf->type_backup & VIDTYPE_INTERLACE)) ||
(cur_dispbuf->type != vf->type)))) {
+ int iret;
+
last_process_3d_type = process_3d_type;
atomic_inc(&video_sizechange);
wake_up_interruptible(&amvideo_sizechange_wait);
next_frame_par = (&frame_parms[0] == next_frame_par) ?
&frame_parms[1] : &frame_parms[0];
- vpp_set_filters(process_3d_type, wide_setting, vf,
+ update_layer_info(0);
+ iret = vpp_set_filters(
+ &glayer_info[0], vf,
next_frame_par, vinfo,
(is_dolby_vision_on() &&
is_dolby_vision_stb_mode()));
+ if (iret == VppFilter_Success_and_Changed)
+ video_property_changed = 1;
+
/* apply new vpp settings */
frame_par_ready_to_set = 1;
- /* #if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
- if ((get_cpu_type() >= MESON_CPU_MAJOR_ID_M8)
- && !is_meson_mtvd_cpu()) {
- if (((vf->width > 1920) && (vf->height > 1088)) ||
- ((vf->type & VIDTYPE_COMPRESS) &&
- (vf->compWidth > 1920) &&
- (vf->compHeight > 1080))) {
- if (vpu_clk_level == 0) {
- vpu_clk_level = 1;
-
- spin_lock_irqsave(&lock, flags);
- vpu_delay_work_flag |=
- VPU_DELAYWORK_VPU_CLK;
- spin_unlock_irqrestore(&lock, flags);
- }
- } else {
- if (vpu_clk_level == 1) {
- vpu_clk_level = 0;
-
- spin_lock_irqsave(&lock, flags);
- vpu_delay_work_flag |=
- VPU_DELAYWORK_VPU_CLK;
- spin_unlock_irqrestore(&lock, flags);
- }
+ if (((vf->width > 1920) && (vf->height > 1088)) ||
+ ((vf->type & VIDTYPE_COMPRESS) &&
+ (vf->compWidth > 1920) &&
+ (vf->compHeight > 1080))) {
+ if (vpu_clk_level == 0) {
+ vpu_clk_level = 1;
+ spin_lock_irqsave(&lock, flags);
+ vpu_delay_work_flag |=
+ VPU_DELAYWORK_VPU_CLK;
+ spin_unlock_irqrestore(&lock, flags);
+ }
+ } else {
+ if (vpu_clk_level == 1) {
+ vpu_clk_level = 0;
+ spin_lock_irqsave(&lock, flags);
+ vpu_delay_work_flag |=
+ VPU_DELAYWORK_VPU_CLK;
+ spin_unlock_irqrestore(&lock, flags);
}
}
- /* #endif */
-
}
last_el_status = vf_with_el;
}
if (first_picture && (disable_video != VIDEO_DISABLE_NORMAL)) {
EnableVideoLayer();
-
if ((vf->type & VIDTYPE_MVC) ||
(cur_dispbuf2 && (cur_dispbuf2->type & VIDTYPE_VD2)))
EnableVideoLayer2();
}
}
}
-static inline void vd1_path_select(bool afbc)
-{
- u32 misc_off = cur_dev->vpp_off;
-
- if (!legacy_vpp) {
- VSYNC_WR_MPEG_REG_BITS(
- VD1_AFBCD0_MISC_CTRL,
- /* go field sel */
- (0 << 20) |
- /* linebuffer en */
- (0 << 16) |
- /* vd1 -> dolby -> vpp top */
- (0 << 14) |
- /* axi sel: vd1 mif or afbc */
- ((afbc ? 1 : 0) << 12) |
- /* data sel: vd1 & afbc0 (not osd4) */
- (0 << 11) |
- /* data sel: afbc0 or vd1 */
- ((afbc ? 1 : 0) << 10) |
- /* afbc0 to vd1 (not di) */
- (0 << 9) |
- /* vd1 mif to vpp (not di) */
- (0 << 8) |
- /* afbc0 gclk ctrl */
- (0 << 0),
- 0, 22);
- if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1))
- VSYNC_WR_MPEG_REG_BITS(
- VD1_AFBCD0_MISC_CTRL,
- /* Vd1_afbc0_mem_sel */
- (afbc ? 1 : 0),
- 22, 1);
-
-#ifdef CONFIG_AMLOGIC_MEDIA_DEINTERLACE
- if (!cpu_after_eq(MESON_CPU_MAJOR_ID_G12A))
- return;
- if ((DI_POST_REG_RD(DI_POST_CTRL) & 0x100) != 0) {
- /* check di_vpp_out_en bit */
- VSYNC_WR_MPEG_REG_BITS(
- VD1_AFBCD0_MISC_CTRL,
- /* vd1 mif to di */
- 1,
- 8, 2);
- VSYNC_WR_MPEG_REG_BITS(
- VD1_AFBCD0_MISC_CTRL,
- /* go field select di post */
- 1,
- 20, 2);
- }
-#endif
- } else {
-#ifdef CONFIG_AMLOGIC_MEDIA_DEINTERLACE
- if ((DI_POST_REG_RD(DI_POST_CTRL) & 0x100) == 0)
- /* mif sel */
-#endif
- VSYNC_WR_MPEG_REG_BITS(
- VIU_MISC_CTRL0 + misc_off,
- 0, 16, 3);
- VSYNC_WR_MPEG_REG_BITS(
- VIU_MISC_CTRL0 + misc_off,
- (afbc ? 1 : 0), 20, 1);
- }
-}
-
-static inline void vd2_path_select(bool afbc)
-{
- u32 misc_off = cur_dev->vpp_off;
-
- if (!legacy_vpp) {
- VSYNC_WR_MPEG_REG_BITS(
- VD2_AFBCD1_MISC_CTRL,
- /* go field sel */
- (0 << 20) |
- /* linebuffer en */
- (0 << 16) |
- /* TODO: vd2 -> dolby -> vpp top ?? */
- (0 << 14) |
- /* axi sel: vd2 mif */
- ((afbc ? 1 : 0) << 12) |
- /* data sel: vd2 & afbc1 (not osd4) */
- (0 << 11) |
- /* data sel: afbc1 */
- ((afbc ? 1 : 0) << 10) |
- /* afbc1 to vd2 (not di) */
- (0 << 9) |
- /* vd2 mif to vpp (not di) */
- (0 << 8) |
- /* afbc1 gclk ctrl */
- (0 << 0),
- 0, 22);
- if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1))
- VSYNC_WR_MPEG_REG_BITS(
- VD2_AFBCD1_MISC_CTRL,
- /* Vd2_afbc0_mem_sel */
- (afbc ? 1 : 0),
- 22, 1);
- } else {
- VSYNC_WR_MPEG_REG_BITS(
- VIU_MISC_CTRL1 + misc_off,
- (afbc ? 2 : 0), 0, 2);
- }
-}
static void viu_set_dcu(struct vpp_frame_par_s *frame_par, struct vframe_s *vf)
{
0, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
u32 u, v;
u32 type, bit_mode = 0;
- bool vf_with_el = false;
+ bool is_mvc = false;
if (vf == NULL) {
pr_info("viu_set_dcu vf NULL, return\n");
return;
}
+
type = vf->type;
+ if (type & VIDTYPE_MVC)
+ is_mvc = true;
+
pr_debug("set dcu for vd1 %p, type:0x%x\n", vf, type);
if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) {
if (frame_par->nocomp)
VSYNC_WR_MPEG_REG_BITS(
G12_VD1_IF0_GEN_REG3,
(bit_mode & 0x3), 8, 2);
- if ((vf->type & VIDTYPE_MVC) && (!vf_with_el))
+ if (is_mvc)
VSYNC_WR_MPEG_REG_BITS(
G12_VD2_IF0_GEN_REG3,
(bit_mode & 0x3), 8, 2);
VD1_IF0_GEN_REG3 +
cur_dev->viu_off,
(bit_mode & 0x3), 8, 2);
- if ((vf->type & VIDTYPE_MVC) && (!vf_with_el))
+ if (is_mvc)
VSYNC_WR_MPEG_REG_BITS(
VD2_IF0_GEN_REG3 +
cur_dev->viu_off,
VDIF_DEMUX_MODE_RGB_444;
}
}
- if (is_dolby_vision_enable())
- vf_with_el = has_enhanced_layer(vf);
+
if (frame_par->hscale_skip_count)
r |= VDIF_CHROMA_HZ_AVG | VDIF_LUMA_HZ_AVG;
/*enable go field reset default according to vlsi*/
r |= VDIF_RESET_ON_GO_FIELD;
VSYNC_WR_MPEG_REG(VD1_IF0_GEN_REG + cur_dev->viu_off, r);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(
VD2_IF0_GEN_REG + cur_dev->viu_off, r);
VSYNC_WR_MPEG_REG_BITS(VD1_IF0_GEN_REG2 +
cur_dev->viu_off, 0, 0, 1);
}
-#if HAS_VPU_PROT
- if (has_vpu_prot()) {
- if (use_prot) {
- if (vf->video_angle == 2) {
- VSYNC_WR_MPEG_REG_BITS(VD1_IF0_GEN_REG2
- +
- cur_dev->viu_off,
- 0xf, 2, 4);
- } else {
- VSYNC_WR_MPEG_REG_BITS(VD1_IF0_GEN_REG2
- +
- cur_dev->viu_off,
- 0, 2, 4);
- }
- }
- }
-#else
#ifdef TV_REVERSE
if (reverse) {
VSYNC_WR_MPEG_REG_BITS((VD1_IF0_GEN_REG2 +
cur_dev->viu_off), 0xf, 2, 4);
- if ((vf->type & VIDTYPE_MVC) && (!vf_with_el))
+ if (is_mvc)
VSYNC_WR_MPEG_REG_BITS((VD2_IF0_GEN_REG2 +
cur_dev->viu_off), 0xf, 2, 4);
} else {
VSYNC_WR_MPEG_REG_BITS((VD1_IF0_GEN_REG2 +
cur_dev->viu_off), 0, 2, 4);
- if ((vf->type & VIDTYPE_MVC) && (!vf_with_el))
+ if (is_mvc)
VSYNC_WR_MPEG_REG_BITS((VD2_IF0_GEN_REG2 +
cur_dev->viu_off), 0, 2, 4);
}
#endif
-#endif
}
/* #endif */
if (type & VIDTYPE_VIU_444) {
VSYNC_WR_MPEG_REG(VIU_VD1_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_1_1);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_1_1);
} else if (type & VIDTYPE_VIU_FIELD) {
VIU_VD1_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_2_1 | HFORMATTER_EN |
VFORMATTER_RPTLINE0_EN | vini_phase | vphase);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(
VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_RRT_PIXEL0 |
HFORMATTER_YC_RATIO_2_1 | HFORMATTER_EN |
VFORMATTER_RPTLINE0_EN | vini_phase | vphase |
vformatter);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(
VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_2_1 |
VFORMATTER_RPTLINE0_EN |
vini_phase | vphase |
vformatter);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(
VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_2_1 |
(0xe << VFORMATTER_INIPHASE_BIT) |
(((type & VIDTYPE_VIU_422) ? 0x10 : 0x08)
<< VFORMATTER_PHASE_BIT) | VFORMATTER_EN);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_2_1 | HFORMATTER_EN |
VFORMATTER_RPTLINE0_EN | (0xa <<
VFORMATTER_INIPHASE_BIT) |
(((type & VIDTYPE_VIU_422) ? 0x10 : 0x08)
<< VFORMATTER_PHASE_BIT) | VFORMATTER_EN);
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_2_1 |
HFORMATTER_EN |
(((type & VIDTYPE_VIU_422) ? 0x10 : 0x08)
<< VFORMATTER_PHASE_BIT) | VFORMATTER_EN);
}
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(VIU_VD2_FMT_CTRL + cur_dev->viu_off,
HFORMATTER_YC_RATIO_2_1 |
HFORMATTER_EN |
(loop << VDIF_LUMA_LOOP1_BIT) |
(loop << VDIF_CHROMA_LOOP0_BIT) |
(loop << VDIF_LUMA_LOOP0_BIT));
- if (!vf_with_el)
+ if (is_mvc)
VSYNC_WR_MPEG_REG(
VD2_IF0_RPT_LOOP + cur_dev->viu_off,
(loop << VDIF_CHROMA_LOOP1_BIT) |
pat = 0;
else
pat = 0x88;
- }
- if (!vf_with_el) {
VSYNC_WR_MPEG_REG(
VD2_IF0_LUMA0_RPT_PAT + cur_dev->viu_off, pat);
VSYNC_WR_MPEG_REG(
VD2_IF0_CHROMA1_RPT_PAT + cur_dev->viu_off, pat);
}
- if (platform_type == 0) {
- /* picture 0/1 control */
- if (((type & VIDTYPE_INTERLACE) == 0) &&
- ((type & VIDTYPE_VIU_FIELD) == 0) &&
- ((type & VIDTYPE_MVC) == 0)) {
- /* progressive frame in two pictures */
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
- cur_dev->viu_off, (2 << 26) | /* two pic mode */
- (2 << 24) | /* use own last line */
- (2 << 8) | /* toggle pic 0 and 1, use pic0 first */
- (0x01)); /* loop pattern */
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
- cur_dev->viu_off,
- (2 << 26) | /* two pic mode */
- (2 << 24) | /* use own last line */
- (2 << 8) | /* toggle pic 0 and 1, use pic0 first */
- (0x01)); /* loop pattern */
- } else {
+ /* picture 0/1 control */
+ if ((((type & VIDTYPE_INTERLACE) == 0) &&
+ ((type & VIDTYPE_VIU_FIELD) == 0) &&
+ ((type & VIDTYPE_MVC) == 0)) ||
+ (frame_par->vpp_2pic_mode & 0x3)) {
+ /* progressive frame in two pictures */
+ if (frame_par->vpp_2pic_mode & VPP_PIC1_FIRST) {
VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
- cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
- cur_dev->viu_off, 0);
- if (!vf_with_el) {
- VSYNC_WR_MPEG_REG(
- VD2_IF0_LUMA_PSEL +
- cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CHROMA_PSEL +
- cur_dev->viu_off, 0);
- }
- }
- } else {
- /* picture 0/1 control */
- if ((((type & VIDTYPE_INTERLACE) == 0) &&
- ((type & VIDTYPE_VIU_FIELD) == 0) &&
- ((type & VIDTYPE_MVC) == 0)) ||
- (frame_par->vpp_2pic_mode & 0x3)) {
- /* progressive frame in two pictures */
- if (frame_par->vpp_2pic_mode & VPP_PIC1_FIRST) {
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, (2 << 26) |
/* two pic mode */
(2 << 24) |
/* toggle pic 0 and 1, use pic1 first*/
(0x01));
/* loop pattern */
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, (2 << 26) |
/* two pic mode */
(2 << 24) |
/* toggle pic 0 and 1,use pic1 first */
(0x01));
/* loop pattern */
- } else {
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ } else {
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, (2 << 26) |
/* two pic mode */
(2 << 24) |
/* toggle pic 0 and 1, use pic0 first */
(0x01));
/* loop pattern */
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, (2 << 26) |
/* two pic mode */
(2 << 24) |
/* toggle pic 0 and 1, use pic0 first */
(0x01));
/* loop pattern */
- }
- } else if (process_3d_type & MODE_3D_OUT_FA_MASK) {
- /*FA LR/TB output , do nothing*/
- } else {
- if (frame_par->vpp_2pic_mode & VPP_SELECT_PIC1) {
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ }
+ } else if (process_3d_type & MODE_3D_OUT_FA_MASK) {
+ /*FA LR/TB output , do nothing*/
+ } else {
+ if (frame_par->vpp_2pic_mode & VPP_SELECT_PIC1) {
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0);
- if (!vf_with_el) {
- VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
+ if (is_mvc) {
+ VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0);
- }
- } else {
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ }
+ } else {
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0);
- if (!vf_with_el) {
- VSYNC_WR_MPEG_REG(
- VD2_IF0_LUMA_PSEL +
- cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CHROMA_PSEL +
- cur_dev->viu_off, 0);
- }
+ if (is_mvc) {
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA_PSEL +
+ cur_dev->viu_off, 0);
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA_PSEL +
+ cur_dev->viu_off, 0);
}
}
}
}
}
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 */
-
static int detect_vout_type(void)
{
int vout_type = VOUT_TYPE_PROG;
return vout_type;
}
-#else
-static int detect_vout_type(void)
-{
-#if defined(CONFIG_AM_TCON_OUTPUT)
- return VOUT_TYPE_PROG;
-#else
- int vout_type;
- int encp_enable = READ_VCBUS_REG(ENCP_VIDEO_EN) & 1;
-
- if (encp_enable) {
- if (READ_VCBUS_REG(ENCP_VIDEO_MODE) & (1 << 12)) {
- /* 1080I */
- if (READ_VCBUS_REG(VENC_ENCP_LINE) < 562)
- vout_type = VOUT_TYPE_TOP_FIELD;
-
- else
- vout_type = VOUT_TYPE_BOT_FIELD;
-
- } else
- vout_type = VOUT_TYPE_PROG;
-
- } else {
- vout_type = (READ_VCBUS_REG(VENC_STATA) & 1) ?
- VOUT_TYPE_BOT_FIELD : VOUT_TYPE_TOP_FIELD;
- }
-
- return vout_type;
-#endif
-}
-#endif
-
#ifdef INTERLACE_FIELD_MATCH_PROCESS
static inline bool interlace_field_type_need_match(int vout_type,
struct vframe_s *vf)
VFRAME_EVENT_RECEIVER_DISP_MODE, (void *)&req);
} else
vf_notify_provider_by_name("vdin0",
- VFRAME_EVENT_RECEIVER_DISP_MODE, (void *)&req);
- return req.disp_mode;
-}
-static inline bool video_vf_dirty_put(struct vframe_s *vf)
-{
- if (!vf->frame_dirty)
- return false;
- if (cur_dispbuf != vf) {
- if (vf->source_type != VFRAME_SOURCE_TYPE_OSD) {
- if (vf->pts != 0) {
- amlog_mask(LOG_MASK_TIMESTAMP,
- "vpts to vf->pts:0x%x,scr:0x%x,abs_scr: 0x%x\n",
- vf->pts, timestamp_pcrscr_get(),
- READ_MPEG_REG(SCR_HIU));
- timestamp_vpts_set(vf->pts);
- } else if (cur_dispbuf) {
- amlog_mask(LOG_MASK_TIMESTAMP,
- "vpts inc:0x%x,scr: 0x%x, abs_scr: 0x%x\n",
- timestamp_vpts_get() +
- DUR2PTS(cur_dispbuf->duration),
- timestamp_pcrscr_get(),
- READ_MPEG_REG(SCR_HIU));
- timestamp_vpts_inc(
- DUR2PTS(cur_dispbuf->duration));
-
- vpts_remainder +=
- DUR2PTS_RM(cur_dispbuf->duration);
- if (vpts_remainder >= 0xf) {
- vpts_remainder -= 0xf;
- timestamp_vpts_inc(-1);
- }
+ VFRAME_EVENT_RECEIVER_DISP_MODE, (void *)&req);
+ return req.disp_mode;
+}
+static inline bool video_vf_dirty_put(struct vframe_s *vf)
+{
+ if (!vf->frame_dirty)
+ return false;
+ if (cur_dispbuf != vf) {
+ if (vf->pts != 0) {
+ amlog_mask(LOG_MASK_TIMESTAMP,
+ "vpts to vf->pts:0x%x,scr:0x%x,abs_scr: 0x%x\n",
+ vf->pts, timestamp_pcrscr_get(),
+ READ_MPEG_REG(SCR_HIU));
+ timestamp_vpts_set(vf->pts);
+ } else if (cur_dispbuf) {
+ amlog_mask(LOG_MASK_TIMESTAMP,
+ "vpts inc:0x%x,scr: 0x%x, abs_scr: 0x%x\n",
+ timestamp_vpts_get() +
+ DUR2PTS(cur_dispbuf->duration),
+ timestamp_pcrscr_get(),
+ READ_MPEG_REG(SCR_HIU));
+ timestamp_vpts_inc(
+ DUR2PTS(cur_dispbuf->duration));
+
+ vpts_remainder +=
+ DUR2PTS_RM(cur_dispbuf->duration);
+ if (vpts_remainder >= 0xf) {
+ vpts_remainder -= 0xf;
+ timestamp_vpts_inc(-1);
}
}
}
vinfo->sync_duration_num;
vsync_pts_inc_scale = vinfo->sync_duration_den;
vsync_pts_inc_scale_base = vinfo->sync_duration_num;
- video_property_changed = true;
+ video_property_changed = 1;
pr_info("Change to video 0\n");
}
} else {
vinfo->sync_duration_num;
vsync_pts_inc_scale = vinfo->sync_duration_den;
vsync_pts_inc_scale_base = vinfo->sync_duration_num;
- video_property_changed = true;
+ video_property_changed = 1;
pr_info("Change to video 1\n");
}
}
if ((vf) && ((vf->type & VIDTYPE_NO_VIDEO_ENABLE) == 0)) {
if ((old_vmode != new_vmode) || (debug_flag == 8)) {
debug_flag = 1;
- video_property_changed = true;
+ video_property_changed = 1;
pr_info("detect vout mode change!!!!!!!!!!!!\n");
old_vmode = new_vmode;
}
goto exit;
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
- if (is_vsync_rdma_enable())
+ if (is_vsync_rdma_enable()) {
rdma_canvas_id = next_rdma_canvas_id;
- else {
- if (rdma_enable_pre) {
- /*do not write register directly before RDMA is done */
- /*#if MESON_CPU_TYPE == MESON_CPU_TYPE_MESON6TV */
- if (is_meson_mtvd_cpu()) {
- if (debug_flag & DEBUG_FLAG_RDMA_WAIT_1) {
- while
- (
- ((READ_VCBUS_REG(ENCL_INFO_READ) >> 16)
- & 0x1fff) < 50);
- }
- }
- /* #endif */
+#ifdef VIDEO_PIP
+ pip_rdma_canvas_id = pip_next_rdma_canvas_id;
+#endif
+ } else {
+ if (rdma_enable_pre)
goto exit;
- }
+
rdma_canvas_id = 0;
next_rdma_canvas_id = 1;
+#ifdef VIDEO_PIP
+ pip_rdma_canvas_id = 0;
+ pip_next_rdma_canvas_id = 1;
+#endif
}
for (i = 0; i < dispbuf_to_put_num; i++) {
}
dispbuf_to_put_num = 0;
}
-#endif
-
- if (osd_prov && osd_prov->ops && osd_prov->ops->get) {
- vf = osd_prov->ops->get(osd_prov->op_arg);
- if (vf) {
- vf->source_type = VFRAME_SOURCE_TYPE_OSD;
- vsync_toggle_frame(vf);
- if (debug_flag & DEBUG_FLAG_BLACKOUT) {
- pr_info
- ("[video4osd] toggle osd_vframe {%d,%d}\n",
- vf->width, vf->height);
- }
- goto SET_FILTER;
- }
+#ifdef VIDEO_PIP
+ if (pipbuf_to_put) {
+ pip_vf_put(pipbuf_to_put);
+ pipbuf_to_put = NULL;
}
+#endif
+#endif
if ((!cur_dispbuf) || (cur_dispbuf == &vf_local)) {
}
vsync_toggle_frame(cur_dispbuf);
} else
- video_property_changed = false;
+ video_property_changed = 0;
} else {
goto SET_FILTER;
}
#endif
SET_FILTER:
+#ifdef VIDEO_PIP
+ vf = pip_vf_peek();
+ /* setting video display property in underflow mode */
+ if ((!vf) && cur_pipbuf && (pip_property_changed))
+ pip_toggle_frame(cur_pipbuf);
+ if (vf) {
+ vf = pip_vf_get();
+ if (vf) {
+ if (!vf->frame_dirty)
+ pip_toggle_frame(vf);
+ else
+ pip_vf_put(vf);
+ }
+ }
+#endif
#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
amvecm_on_vs(
(cur_dispbuf != &vf_local)
last_el_status = 0;
}
}
- {
-#if 0
- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) {
- if (cur_dispbuf->type & VIDTYPE_COMPRESS) {
- /*SET_VCBUS_REG_MASK(VIU_MISC_CTRL0,*/
- /*VIU_MISC_AFBC_VD1);*/
- VSYNC_WR_MPEG_REG_BITS(VIU_MISC_CTRL0 +
- cur_dev->viu_off, 1, 20, 1);
- } else {
- /*CLEAR_VCBUS_REG_MASK(VIU_MISC_CTRL0,*/
- /*VIU_MISC_AFBC_VD1);*/
- VSYNC_WR_MPEG_REG_BITS(VIU_MISC_CTRL0 +
- cur_dev->viu_off, 0, 20, 1);
- }
- }
-#endif
- if (platform_type == 1) {
- if (cur_frame_par && cur_frame_par->hscale_skip_count) {
- VSYNC_WR_MPEG_REG_BITS(VIU_VD1_FMT_CTRL +
- cur_dev->viu_off, 1, 20, 1);
- /* HFORMATTER_EN */
- VSYNC_WR_MPEG_REG_BITS(VIU_VD2_FMT_CTRL +
- cur_dev->viu_off, 1, 20, 1);
- /* HFORMATTER_EN */
- }
- if (process_3d_type & MODE_3D_OUT_FA_MASK) {
- if (toggle_3d_fa_frame == OUT_FA_A_FRAME) {
- VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- cur_dev->vpp_off, 1, 14, 1);
- /* VPP_VD1_PREBLEND disable */
- VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- cur_dev->vpp_off, 1, 10, 1);
- /* VPP_VD1_POSTBLEND disable */
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ if (cur_frame_par &&
+ cur_frame_par->hscale_skip_count) {
+ VSYNC_WR_MPEG_REG_BITS(VIU_VD1_FMT_CTRL +
+ cur_dev->viu_off, 1, 20, 1);
+ /* HFORMATTER_EN */
+#ifdef VIDEO_PIP
+ if (!cur_pipbuf)
+#endif
+ VSYNC_WR_MPEG_REG_BITS(VIU_VD2_FMT_CTRL +
+ cur_dev->viu_off, 1, 20, 1);
+ /* HFORMATTER_EN */
+ }
+ if (process_3d_type & MODE_3D_OUT_FA_MASK) {
+ if (toggle_3d_fa_frame == OUT_FA_A_FRAME) {
+ VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
+ cur_dev->vpp_off, 1, 14, 1);
+ /* VPP_VD1_PREBLEND disable */
+ VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
+ cur_dev->vpp_off, 1, 10, 1);
+ /* VPP_VD1_POSTBLEND disable */
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, 0x4000000);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0x4000000);
- VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
cur_dev->viu_off, 0x4000000);
- VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0x4000000);
- } else if (OUT_FA_B_FRAME ==
+ } else if (OUT_FA_B_FRAME ==
toggle_3d_fa_frame) {
- VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
+ VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
cur_dev->vpp_off, 1, 14, 1);
- /* VPP_VD1_PREBLEND disable */
- VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
+ /* VPP_VD1_PREBLEND disable */
+ VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
cur_dev->vpp_off, 1, 10, 1);
- /* VPP_VD1_POSTBLEND disable */
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ /* VPP_VD1_POSTBLEND disable */
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_LUMA_PSEL +
- cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(
- VD2_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- } else if (toggle_3d_fa_frame ==
+ VSYNC_WR_MPEG_REG(
+ VD2_IF0_CHROMA_PSEL +
+ cur_dev->viu_off, 0);
+ } else if (toggle_3d_fa_frame ==
OUT_FA_BANK_FRAME) {
- /* output a banking frame */
- VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- cur_dev->vpp_off, 0, 14, 1);
- /* VPP_VD1_PREBLEND disable */
- VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
+ /* output a banking frame */
+ VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
+ cur_dev->vpp_off, 0, 14, 1);
+ /* VPP_VD1_PREBLEND disable */
+ VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
cur_dev->vpp_off, 0, 10, 1);
- /* VPP_VD1_POSTBLEND disable */
- }
+ /* VPP_VD1_POSTBLEND disable */
}
- if ((process_3d_type & MODE_3D_OUT_TB)
- || (process_3d_type & MODE_3D_OUT_LR)) {
- if (cur_frame_par &&
- (cur_frame_par->vpp_2pic_mode &
+ }
+ if ((process_3d_type & MODE_3D_OUT_TB)
+ || (process_3d_type & MODE_3D_OUT_LR)) {
+ if (cur_frame_par &&
+ (cur_frame_par->vpp_2pic_mode &
VPP_PIC1_FIRST)) {
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, 0x4000000);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0x4000000);
- VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0);
- } else {
- VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
+ } else {
+ VSYNC_WR_MPEG_REG(VD1_IF0_LUMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD1_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0);
- VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_LUMA_PSEL +
cur_dev->viu_off, 0x4000000);
- VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
+ VSYNC_WR_MPEG_REG(VD2_IF0_CHROMA_PSEL +
cur_dev->viu_off, 0x4000000);
- }
-/*
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,1,15,1);//VPP_VD2_PREBLEND enable
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,1,11,1);//VPP_VD2_POSTBLEND enable
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,1,6,1);//PREBLEND enable must be set!
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,0x1ff,
- *VPP_VD2_ALPHA_BIT,9);//vd2 alpha must set
- */
}
-
-/*
- *else{
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,0,15,1);//VPP_VD2_PREBLEND enable
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,1,11,1);//VPP_VD2_POSTBLEND enable
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,0,6,1);//PREBLEND enable
- *VSYNC_WR_MPEG_REG_BITS(VPP_MISC +
- *cur_dev->vpp_off,0,VPP_VD2_ALPHA_BIT,9);//vd2 alpha must set
- *}
- */
}
- /* vertical phase */
- vphase =
- &cur_frame_par->VPP_vf_ini_phase_
+ /* vertical phase */
+ vphase = &cur_frame_par->VPP_vf_ini_phase_
[vpp_phase_table[vin_type]
[vout_type]];
- VSYNC_WR_MPEG_REG(VPP_VSC_INI_PHASE + cur_dev->vpp_off,
- ((u32) (vphase->phase) << 8));
+ VSYNC_WR_MPEG_REG(
+ VPP_VSC_INI_PHASE + cur_dev->vpp_off,
+ ((u32) (vphase->phase) << 8));
- if (vphase->repeat_skip >= 0) {
- /* skip lines */
- VSYNC_WR_MPEG_REG_BITS(VPP_VSC_PHASE_CTRL +
+ if (vphase->repeat_skip >= 0) {
+ /* skip lines */
+ VSYNC_WR_MPEG_REG_BITS(VPP_VSC_PHASE_CTRL +
cur_dev->vpp_off,
skip_tab[vphase->repeat_skip],
VPP_PHASECTL_INIRCVNUMT_BIT,
VPP_PHASECTL_INIRCVNUM_WID +
VPP_PHASECTL_INIRPTNUM_WID);
-
- } else {
- /* repeat first line */
- VSYNC_WR_MPEG_REG_BITS(VPP_VSC_PHASE_CTRL +
+ } else {
+ /* repeat first line */
+ VSYNC_WR_MPEG_REG_BITS(VPP_VSC_PHASE_CTRL +
cur_dev->vpp_off, 4,
VPP_PHASECTL_INIRCVNUMT_BIT,
VPP_PHASECTL_INIRCVNUM_WID);
- VSYNC_WR_MPEG_REG_BITS(VPP_VSC_PHASE_CTRL +
+ VSYNC_WR_MPEG_REG_BITS(VPP_VSC_PHASE_CTRL +
cur_dev->vpp_off,
1 - vphase->repeat_skip,
VPP_PHASECTL_INIRPTNUMT_BIT,
VPP_PHASECTL_INIRPTNUM_WID);
+ }
+ if (force_3d_scaler == 3 &&
+ cur_frame_par &&
+ cur_frame_par->vpp_3d_scale) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VPP_VSC_PHASE_CTRL, 3,
+ VPP_PHASECTL_DOUBLELINE_BIT, 2);
+ } else if (force_3d_scaler == 1 &&
+ cur_frame_par &&
+ cur_frame_par->vpp_3d_scale) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VPP_VSC_PHASE_CTRL, 1,
+ VPP_PHASECTL_DOUBLELINE_BIT,
+ VPP_PHASECTL_DOUBLELINE_WID);
+ } else if (force_3d_scaler == 2 &&
+ cur_frame_par &&
+ cur_frame_par->vpp_3d_scale) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VPP_VSC_PHASE_CTRL, 2,
+ VPP_PHASECTL_DOUBLELINE_BIT, 2);
+ } else {
+ VSYNC_WR_MPEG_REG_BITS(
+ VPP_VSC_PHASE_CTRL, 0,
+ VPP_PHASECTL_DOUBLELINE_BIT, 2);
+ }
+ }
+#ifdef VIDEO_PIP
+ if (pip_frame_ready_to_set)
+ curpip_frame_par = nextpip_frame_par;
+
+ if (cur_pipbuf) {
+ int need_afbc = (cur_pipbuf->type & VIDTYPE_COMPRESS);
+ int afbc_need_reset =
+ video2_enabled &&
+ need_afbc &&
+ (!(READ_VCBUS_REG(VD2_AFBC_ENABLE) & 0x100));
+ /*video on && afbc is off && is compress frame.*/
+ if (pip_frame_ready_to_set || afbc_need_reset)
+ pip_set_dcu(curpip_frame_par, cur_pipbuf);
+
+ if (cur_pipbuf && curpip_frame_par) {
+ if (curpip_frame_par->hscale_skip_count) {
+ VSYNC_WR_MPEG_REG_BITS(
+ VIU_VD2_FMT_CTRL +
+ cur_dev->viu_off, 1, 20, 1);
+ /* HFORMATTER_EN */
}
- if (platform_type == 1) {
- if (force_3d_scaler == 3 &&
- cur_frame_par &&
- cur_frame_par->vpp_3d_scale) {
- VSYNC_WR_MPEG_REG_BITS(
- VPP_VSC_PHASE_CTRL, 3,
- VPP_PHASECTL_DOUBLELINE_BIT, 2);
- } else if (force_3d_scaler == 1 &&
- cur_frame_par &&
- cur_frame_par->vpp_3d_scale) {
- VSYNC_WR_MPEG_REG_BITS(
- VPP_VSC_PHASE_CTRL, 1,
- VPP_PHASECTL_DOUBLELINE_BIT,
- VPP_PHASECTL_DOUBLELINE_WID);
- } else if (force_3d_scaler == 2 &&
- cur_frame_par &&
- cur_frame_par->vpp_3d_scale) {
- VSYNC_WR_MPEG_REG_BITS(
- VPP_VSC_PHASE_CTRL, 2,
- VPP_PHASECTL_DOUBLELINE_BIT, 2);
- } else {
- VSYNC_WR_MPEG_REG_BITS(
- VPP_VSC_PHASE_CTRL, 0,
- VPP_PHASECTL_DOUBLELINE_BIT, 2);
- }
+ proc_vd2_vsc_phase_per_vsync(
+ curpip_frame_par, cur_pipbuf, vout_type);
+ }
+ }
+
+ if (pip_frame_ready_to_set) {
+#if 0
+ u32 h_size, v_size;
+
+ if (pip_start_x_lines < pip_end_x_lines)
+ h_size = pip_end_x_lines - pip_start_x_lines + 1;
+ else
+ h_size = ori2_end_x_lines - ori2_start_x_lines + 1;
+
+ if (pip_start_y_lines < pip_end_y_lines)
+ v_size = pip_end_y_lines - pip_start_y_lines + 1;
+ else
+ v_size = ori2_end_y_lines - ori2_start_y_lines + 1;
+
+ zoom2_start_x_lines = ori2_start_x_lines;
+ zoom2_end_x_lines = ori2_end_x_lines;
+ zoom2_start_y_lines = ori2_start_y_lines;
+ zoom2_end_y_lines = ori2_end_y_lines;
+
+ if (h_size < (zoom2_end_x_lines - zoom2_start_x_lines + 1))
+ zoom2_end_x_lines = zoom2_start_x_lines + h_size - 1;
+ else if (h_size > (zoom2_end_x_lines - zoom2_start_x_lines + 1))
+ h_size = zoom2_end_x_lines - zoom2_start_x_lines + 1;
+
+ if (v_size < (zoom2_end_y_lines - zoom2_start_y_lines + 1))
+ zoom2_end_y_lines = zoom2_start_y_lines + v_size - 1;
+ else if (v_size > (zoom2_end_y_lines - zoom2_start_y_lines + 1))
+ v_size = (zoom2_end_y_lines - zoom2_start_y_lines + 1);
+
+ if (vinfo) {
+ if (pip_start_x_lines + h_size > vinfo->width) {
+ h_size = vinfo->width - pip_start_x_lines;
+ zoom2_end_x_lines =
+ zoom2_start_x_lines + h_size - 1;
+ }
+ if (pip_start_y_lines + v_size > vinfo->height) {
+ v_size = vinfo->height - pip_start_y_lines;
+ zoom2_end_y_lines =
+ zoom2_start_y_lines + v_size - 1;
+ }
+ }
+#endif
+ struct scaler_setting_s local_pps;
+ struct blend_setting_s local_blend;
+ struct vpp_frame_par_s *par = curpip_frame_par;
+
+ if (cur_pipbuf->type & VIDTYPE_INTERLACE) {
+ if (cur_pipbuf->type & VIDTYPE_VIU_FIELD) {
+ zoom2_start_y_lines =
+ par->VPP_vd_start_lines_ >> 1;
+ zoom2_end_y_lines =
+ ((par->VPP_vd_end_lines_ + 1)
+ >> 1) - 1;
+ } else {
+ zoom2_start_y_lines =
+ par->VPP_vd_start_lines_;
+ zoom2_end_y_lines =
+ par->VPP_vd_end_lines_;
+ }
+ } else {
+ if (cur_pipbuf->type & VIDTYPE_VIU_FIELD) {
+ zoom2_start_y_lines =
+ par->VPP_vd_start_lines_;
+ zoom2_end_y_lines =
+ par->VPP_vd_end_lines_;
+ } else {
+ zoom2_start_y_lines =
+ par->VPP_vd_start_lines_ >> 1;
+ zoom2_end_y_lines =
+ ((par->VPP_vd_end_lines_ + 1)
+ >> 1) - 1;
}
}
+ zoom2_start_x_lines =
+ par->VPP_hd_start_lines_;
+ zoom2_end_x_lines =
+ par->VPP_hd_end_lines_;
+ config_vd_pps(
+ 1, par, &local_pps, vinfo);
+ config_vd_blend(
+ 1, par, cur_pipbuf,
+ (legacy_vpp ? 0x1ff : 0x100), &local_blend);
+ vd2_scaler_setting(&local_pps);
+ vd2_zoom_display_horz(
+ cur_pipbuf,
+ par->hscale_skip_count);
+ vd2_zoom_display_vert(
+ cur_pipbuf,
+ par->vscale_skip_count);
+ vd2_vpp_blend_setting(&local_blend);
+ pip_frame_ready_to_set = 0;
}
+#endif
if (((frame_par_ready_to_set) || (frame_par_force_to_set)) &&
(cur_frame_par)) {
zoom2_end_y_lines = ori2_end_y_lines;
correct_vd2_mif_size_for_DV(
cur_frame_par, cur_dispbuf);
- vd2_zoom_display_horz(cur_dispbuf2, 0);
- vd2_zoom_display_vert(cur_dispbuf2);
+ vd2_zoom_display_horz(cur_dispbuf2,
+ cur_frame_par->hscale_skip_count);
+ vd2_zoom_display_vert(cur_dispbuf2,
+ cur_frame_par->vscale_skip_count);
}
}
/*vpp input size setting*/
(VPP_OSD1_POSTBLEND | VPP_OSD2_POSTBLEND))
vpp_misc_set |= VPP_POSTBLEND_EN;
}
+
+#ifdef VIDEO_PIP
+ if (cur_pipbuf && (video2_enabled == 1)
+ && ((vpp_misc_save & VPP_VD2_POSTBLEND) == 0)
+ && (video2_onoff_state == VIDEO_ENABLE_STATE_IDLE)) {
+ vpp_misc_set |=
+ VPP_VD2_POSTBLEND |
+ VPP_POSTBLEND_EN;
+ }
+#endif
+
if ((video_enabled == 1) && ((vpp_misc_save & VPP_VD1_POSTBLEND) == 0)
&& (video_onoff_state == VIDEO_ENABLE_STATE_IDLE)) {
vpp_misc_set |=
VPP_VSC_START_PHASE_STEP + cur_dev->vpp_off);
if ((vpp_filter->vpp_hf_start_phase_step != h_phase_step) ||
(vpp_filter->vpp_vsc_start_phase_step != v_phase_step)) {
- video_property_changed = true;
+ video_property_changed = 1;
/*pr_info("frame info register rdma write fail!\n");*/
}
}
else
vpp_misc_set |= VPP_VD2_PREBLEND |
VPP_PREBLEND_EN;
-
+#ifdef VIDEO_PIP
+ if (cur_pipbuf) {
+ vpp_misc_set &=
+ ~(VPP_PREBLEND_EN | VPP_VD2_PREBLEND);
+ vpp_misc_set |= VPP_VD2_POSTBLEND;
+ }
+#endif
/* g12a has no alpha overflow check in hardware */
if (!legacy_vpp)
vpp_misc_set |= (0x100 << VPP_VD2_ALPHA_BIT);
pr_info("VsyncEnableVideoLayer2\n");
} else if (video2_onoff_state == VIDEO_ENABLE_STATE_OFF_REQ) {
vpp_misc_set &= ~(VPP_VD2_PREBLEND |
- VPP_VD2_POSTBLEND | VPP_PREBLEND_EN);
+ VPP_VD2_POSTBLEND | VPP_PREBLEND_EN
+ | (0x1ff << VPP_VD2_ALPHA_BIT));
video2_onoff_state = VIDEO_ENABLE_STATE_IDLE;
video_onoff_time = jiffies_to_msecs(jiffies);
VPP_VD2_POSTBLEND |
VPP_VD1_POSTBLEND |
VPP_PREBLEND_EN);
+#ifdef VIDEO_PIP
+ /* should keep video2 display */
+ if (cur_pipbuf && video2_enabled)
+ vpp_misc_set |= VPP_VD2_POSTBLEND;
+#endif
} else {
video_enabled = video_status_saved;
}
if (!video_enabled &&
(vpp_misc_set & VPP_VD1_POSTBLEND))
vpp_misc_set &= ~(VPP_VD1_PREBLEND |
- VPP_VD2_PREBLEND |
- VPP_VD2_POSTBLEND |
VPP_VD1_POSTBLEND |
VPP_PREBLEND_EN);
+#ifdef VIDEO_PIP
+ if (pip_global_output == 0) {
+ video2_enabled = 0;
+ vpp_misc_set &= ~(VPP_VD2_PREBLEND |
+ VPP_VD2_POSTBLEND);
+ } else {
+ video2_enabled = video2_status_saved;
+ }
+
+ if (!video2_enabled &&
+ (vpp_misc_set & VPP_VD2_POSTBLEND))
+ vpp_misc_set &= ~(VPP_VD2_PREBLEND |
+ VPP_VD2_POSTBLEND);
+#endif
+
if (!legacy_vpp) {
u32 set_value = 0;
VPP_PREBLEND_EN |
VPP_POSTBLEND_EN |
0xf);
+
+ /* if vd2 is bottom layer, need remove alpha for vd2 */
+ if (((vpp_misc_set & VPP_VD1_POSTBLEND) == 0)
+ && (vpp_misc_set & VPP_VD2_POSTBLEND)) {
+ vpp_misc_set &= ~(0x1ff << VPP_VD2_ALPHA_BIT);
+ vpp_misc_set |= (0x100 << VPP_VD2_ALPHA_BIT);
+ }
+
vpp_misc_save &=
((1 << 29) | VPP_CM_ENABLE |
(0x1ff << VPP_VD2_ALPHA_BIT) |
if (vpp_misc_set & VPP_VD2_POSTBLEND)
set_value =
((1 << 20) |
- (1 << 16) | /* post bld premult*/
+ (0 << 16) | /* post bld premult*/
(2 << 8)); /* post src */
else if (vpp_misc_set & VPP_VD2_PREBLEND)
set_value =
VSYNC_WR_MPEG_REG(
VD2_BLEND_SRC_CTRL + cur_dev->vpp_off,
set_value);
+
set_value = vpp_misc_set;
set_value &=
((1 << 29) | VPP_CM_ENABLE |
/*vpp_misc_set maybe have same,but need off.*/
/* if vd1 off, disable vd2 also */
+#ifdef VIDEO_PIP
+ if (video2_off_req && cur_pipbuf) {
+ if ((debug_flag & DEBUG_FLAG_BLACKOUT)
+ && video2_off_req)
+ pr_info("VD2 AFBC off now.\n");
+ VSYNC_WR_MPEG_REG(VD2_AFBC_ENABLE, 0);
+ VSYNC_WR_MPEG_REG(VD2_IF0_GEN_REG, 0);
+ if (!legacy_vpp) {
+ VSYNC_WR_MPEG_REG(
+ VD2_BLEND_SRC_CTRL + cur_dev->vpp_off, 0);
+ }
+ if (cur_pipbuf && (cur_pipbuf == &local_pip))
+ cur_pipbuf = NULL;
+ } else if (!cur_pipbuf &&
+ (video2_off_req || video1_off_req)) {
+ if ((debug_flag & DEBUG_FLAG_BLACKOUT)
+ && video2_off_req)
+ pr_info("VD2 AFBC off now.\n");
+ VSYNC_WR_MPEG_REG(VD2_AFBC_ENABLE, 0);
+ VSYNC_WR_MPEG_REG(VD2_IF0_GEN_REG, 0);
+ if (!legacy_vpp) {
+ VSYNC_WR_MPEG_REG(
+ VD2_BLEND_SRC_CTRL + cur_dev->vpp_off, 0);
+ }
+ last_el_w = 0;
+ last_el_status = 0;
+ if (cur_dispbuf2 && (cur_dispbuf2 == &vf_local2))
+ cur_dispbuf2 = NULL;
+ need_disable_vd2 = false;
+ }
+#else
if (video2_off_req || video1_off_req) {
if ((debug_flag & DEBUG_FLAG_BLACKOUT)
&& video2_off_req)
cur_dispbuf2 = NULL;
need_disable_vd2 = false;
}
+#endif
+
if (video1_off_req) {
/*
* video layer off, swith off afbc,
}
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
cur_rdma_buf = cur_dispbuf;
+#ifdef VIDEO_PIP
+ pip_rdma_buf = cur_pipbuf;
+#endif
/* vsync_rdma_config(); */
vsync_rdma_process();
if (debug_flag & DEBUG_FLAG_PRINT_RDMA) {
int ret = 0;
static struct vpp_frame_par_s frame_par;
- vpp_set_filters(process_3d_type, wide_setting, vf, &frame_par, vinfo,
+ vpp_set_filters(
+ &glayer_info[0],
+ vf, &frame_par, vinfo,
(is_dolby_vision_on() &&
is_dolby_vision_stb_mode()));
ret = frame_par.vscale_skip_count;
vsync_freerun = 0;
vsync_pts_align = 0;
vsync_pts_aligned = false;
- video_prot.video_started = 0;
+
+#ifdef VIDEO_PIP
+ if (pip_loop) {
+#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
+ pipbuf_to_put = NULL;
+ pip_rdma_buf = NULL;
+#endif
+ if (cur_pipbuf) {
+ local_pip = *cur_pipbuf;
+ cur_pipbuf = &local_pip;
+ cur_pipbuf->video_angle = 0;
+ }
+ pip_frame_count = 0;
+ }
+#endif
spin_unlock_irqrestore(&lock, flags);
+#ifdef VIDEO_PIP
+ if (pip_loop) {
+ disable_videopip = VIDEO_DISABLE_FORNEXT;
+ DisableVideoLayer2();
+ }
+#endif
+
if (blackout | force_blackout) {
safe_disble_videolayer();
try_free_keep_video(1);
s32 w, h, x, y;
struct vdisplay_info_s *info_para = (struct vdisplay_info_s *)data;
const struct vinfo_s *info = get_current_vinfo();
+ struct disp_info_s *layer = &glayer_info[0];
if ((!cur_frame_par) || (!info))
return -1;
- vpp_get_video_layer_position(&x, &y, &w, &h);
+
+ x = layer->layer_left;
+ y = layer->layer_top;
+ w = layer->layer_width;
+ h = layer->layer_height;
+
if ((w == 0) || (w > info->width))
w = info->width;
if ((h == 0) || (h > info->height))
#endif
} else if (type == VFRAME_EVENT_PROVIDER_QUREY_DISPLAY_INFO) {
get_display_info(data);
- }
+ } else if (type == VFRAME_EVENT_PROVIDER_PROPERTY_CHANGED)
+ video_property_changed = 1;
return 0;
}
-static int video4osd_receiver_event_fun(int type, void *data,
- void *private_data)
+#ifdef VIDEO_PIP
+static void pip_vf_unreg_provider(void)
{
- if (type == VFRAME_EVENT_PROVIDER_UNREG) {
- osd_prov = NULL;
- if (debug_flag & DEBUG_FLAG_BLACKOUT)
- pr_info("[video4osd] clear osd_prov\n");
- } else if (type == VFRAME_EVENT_PROVIDER_REG) {
- osd_prov = vf_get_provider(RECEIVER4OSD_NAME);
+ ulong flags;
- if (debug_flag & DEBUG_FLAG_BLACKOUT)
- pr_info("[video4osd] set osd_prov\n");
+ /* atomic_set(&video_unreg_flag, 1); */
+ while (atomic_read(&video_inirq_flag) > 0)
+ schedule();
+ spin_lock_irqsave(&lock, flags);
+
+#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
+ pipbuf_to_put = NULL;
+ pip_rdma_buf = NULL;
+#endif
+ if (cur_pipbuf) {
+ local_pip = *cur_pipbuf;
+ cur_pipbuf = &local_pip;
+ cur_pipbuf->video_angle = 0;
+ }
+ pip_frame_count = 0;
+ spin_unlock_irqrestore(&lock, flags);
+
+ disable_videopip = VIDEO_DISABLE_FORNEXT;
+ DisableVideoLayer2();
+}
+
+static void pip_vf_light_unreg_provider(void)
+{
+ ulong flags;
+
+ spin_lock_irqsave(&lock, flags);
+#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
+ pipbuf_to_put = NULL;
+ pip_rdma_buf = NULL;
+#endif
+
+ if (cur_pipbuf) {
+ local_pip = *cur_pipbuf;
+ cur_pipbuf = &local_pip;
}
+ spin_unlock_irqrestore(&lock, flags);
+}
+
+static int pip_receiver_event_fun(
+ int type, void *data, void *private_data)
+{
+ if (type == VFRAME_EVENT_PROVIDER_UNREG)
+ pip_vf_unreg_provider();
+ else if (type == VFRAME_EVENT_PROVIDER_RESET)
+ pip_vf_light_unreg_provider();
+ else if (type == VFRAME_EVENT_PROVIDER_LIGHT_UNREG)
+ pip_vf_light_unreg_provider();
+ else if (type == VFRAME_EVENT_PROVIDER_REG)
+ pip_vf_light_unreg_provider();
return 0;
}
+#endif
unsigned int get_post_canvas(void)
{
if ((disable_video == VIDEO_DISABLE_FORNEXT) && cur_dispbuf
&& (cur_dispbuf != &vf_local))
- video_property_changed = true;
+ video_property_changed = 1;
try_free_keep_video(0);
} else {
if (cur_dispbuf && (cur_dispbuf != &vf_local)) {
EnableVideoLayer();
- video_property_changed = true;
+ video_property_changed = 1;
}
}
return 0;
}
-static void _set_video_crop(int *p)
+static void _set_video_crop(
+ struct disp_info_s *layer, int *p)
{
int last_l, last_r, last_t, last_b;
int new_l, new_r, new_t, new_b;
- vpp_get_video_source_crop(&last_t, &last_l, &last_b, &last_r);
- vpp_set_video_source_crop(p[0], p[1], p[2], p[3]);
- vpp_get_video_source_crop(&new_t, &new_l, &new_b, &new_r);
+ if (!layer)
+ return;
+
+ last_t = layer->crop_top;
+ last_l = layer->crop_left;
+ last_b = layer->crop_bottom;
+ last_r = layer->crop_right;
+
+ new_t = layer->crop_top = p[0];
+ new_l = layer->crop_left = p[1];
+ new_b = layer->crop_bottom = p[2];
+ new_r = layer->crop_right = p[3];
if ((new_t != last_t) || (new_l != last_l)
- || (new_b != last_b) || (new_r != last_r)) {
- video_property_changed = true;
+ || (new_b != last_b) || (new_r != last_r)) {
+ if (layer->layer_id == 0)
+ video_property_changed = 1;
+#ifdef VIDEO_PIP
+ else if (layer->layer_id == 1)
+ pip_property_changed = 1;
+#endif
}
}
-static void _set_video_window(int *p)
+static void _set_video_window(
+ struct disp_info_s *layer, int *p)
{
int w, h;
int *parsed = p;
#ifdef TV_REVERSE
int temp, temp1;
const struct vinfo_s *info = get_current_vinfo();
+#endif
- /* pr_info(KERN_DEBUG "%s: %u*/
- /*get vinfo(%d,%d).\n", __func__, __LINE__,*/
- /*info->width, info->height); */
+ if (!layer)
+ return;
+
+#ifdef TV_REVERSE
+ /* FIXME: use layer info */
if (reverse) {
temp = parsed[0];
temp1 = parsed[1];
parsed[3] = info->height - temp1 - 1;
}
#endif
- vpp_get_video_layer_position(&last_x, &last_y, &last_w, &last_h);
+
+ last_x = layer->layer_left;
+ last_y = layer->layer_top;
+ last_w = layer->layer_width;
+ last_h = layer->layer_height;
+
if (parsed[0] < 0 && parsed[2] < 2) {
parsed[2] = 2;
parsed[0] = 0;
} else
#endif
{
- if ((w == 1) && (h == 1)) {
- w = h = 0;
- vpp_set_video_layer_position(parsed[0], parsed[1], 0,
- 0);
- } else if ((w > 0) && (h > 0)) {
- vpp_set_video_layer_position(parsed[0], parsed[1], w,
- h);
+ if ((w > 0) && (h > 0)) {
+ if ((w == 1) && (h == 1)) {
+ w = 0;
+ h = 0;
+ }
+ layer->layer_left = parsed[0];
+ layer->layer_top = parsed[1];
+ layer->layer_width = w;
+ layer->layer_height = h;
}
}
- vpp_get_video_layer_position(&new_x, &new_y, &new_w, &new_h);
+
+ new_x = layer->layer_left;
+ new_y = layer->layer_top;
+ new_w = layer->layer_width;
+ new_h = layer->layer_height;
+
if ((last_x != new_x) || (last_y != new_y)
- || (last_w != new_w) || (last_h != new_h)) {
- video_property_changed = true;
+ || (last_w != new_w) || (last_h != new_h)) {
+ if (layer->layer_id == 0)
+ video_property_changed = 1;
+#ifdef VIDEO_PIP
+ else if (layer->layer_id == 1)
+ pip_property_changed = 1;
+#endif
}
}
#if ENABLE_UPDATE_HDR_FROM_USER
mutex_unlock(&omx_mutex);
}
+static int alloc_layer(u32 layer_id)
+{
+ int ret = -EINVAL;
+
+ if (layer_id == 0) {
+ if (layer_cap & LAYER0_BUSY) {
+ ret = -EBUSY;
+ } else if (layer_cap & LAYER0_AVAIL) {
+ ret = 0;
+ layer_cap |= LAYER0_BUSY;
+ }
+ } else if (layer_id == 1) {
+ if (layer_cap & LAYER1_BUSY) {
+ ret = -EBUSY;
+ } else if (layer_cap & LAYER1_AVAIL) {
+ ret = 0;
+ layer_cap |= LAYER1_BUSY;
+ }
+ }
+ return ret;
+}
+
+static int free_layer(u32 layer_id)
+{
+ int ret = -EINVAL;
+
+ if (layer_id == 0) {
+ if ((layer_cap & LAYER0_BUSY)
+ && (layer_cap & LAYER0_AVAIL)) {
+ ret = 0;
+ layer_cap &= ~LAYER0_BUSY;
+ }
+ } else if (layer_id == 1) {
+ if ((layer_cap & LAYER1_BUSY)
+ && (layer_cap & LAYER1_AVAIL)) {
+ ret = 0;
+ layer_cap &= ~LAYER1_BUSY;
+ }
+ }
+ return ret;
+}
/*********************************************************
* /dev/amvideo APIs
*/
static int amvideo_open(struct inode *inode, struct file *file)
{
+ file->private_data = NULL;
return 0;
}
static int amvideo_poll_open(struct inode *inode, struct file *file)
{
+ file->private_data = NULL;
return 0;
}
static int amvideo_release(struct inode *inode, struct file *file)
{
- if (blackout | force_blackout) {
- /* DisableVideoLayer();*/
- /*don't need it ,it have problem on pure music playing */
- }
+ file->private_data = NULL;
return 0;
}
static int amvideo_poll_release(struct inode *inode, struct file *file)
{
- if (blackout | force_blackout) {
- /* DisableVideoLayer();*/
- /*don't need it ,it have problem on pure music playing */
- }
+ file->private_data = NULL;
return 0;
}
{
long ret = 0;
void __user *argp = (void __user *)arg;
+ struct disp_info_s *layer = &glayer_info[0];
+ u32 layer_id;
+
+ switch (cmd) {
+ case AMSTREAM_IOC_GLOBAL_SET_VIDEOPIP_OUTPUT:
+ case AMSTREAM_IOC_GLOBAL_GET_VIDEOPIP_OUTPUT:
+ case AMSTREAM_IOC_GET_VIDEOPIP_DISABLE:
+ case AMSTREAM_IOC_SET_VIDEOPIP_DISABLE:
+ case AMSTREAM_IOC_GET_VIDEOPIP_AXIS:
+ case AMSTREAM_IOC_SET_VIDEOPIP_AXIS:
+ case AMSTREAM_IOC_GET_VIDEOPIP_CROP:
+ case AMSTREAM_IOC_SET_VIDEOPIP_CROP:
+ case AMSTREAM_IOC_GET_PIP_SCREEN_MODE:
+ case AMSTREAM_IOC_SET_PIP_SCREEN_MODE:
+ case AMSTREAM_IOC_GET_PIP_ZORDER:
+ case AMSTREAM_IOC_SET_PIP_ZORDER:
+ layer = &glayer_info[1];
+ break;
+ default:
+ break;
+ }
+
+ if (file->private_data)
+ layer = (struct disp_info_s *)file->private_data;
switch (cmd) {
case AMSTREAM_IOC_SET_HDR_INFO:{
}
break;
+ case AMSTREAM_IOC_GET_VIDEOPIP_DISABLE:
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_VIDEO_DISABLE:{
- u32 val;
+ case AMSTREAM_IOC_SET_VIDEOPIP_DISABLE:
+ case AMSTREAM_IOC_SET_VIDEO_DISABLE:
+ {
+ u32 val;
- if (copy_from_user(&val, argp, sizeof(u32)) == 0)
- ret = _video_set_disable(val);
- else
- ret = -EFAULT;
+ if (copy_from_user(&val, argp, sizeof(u32)) == 0) {
+ if (layer->layer_id == 0)
+ ret = _video_set_disable(val);
+#ifdef VIDEO_PIP
+ else if (layer->layer_id == 1)
+ ret = _videopip_set_disable(val);
+#endif
+ } else
+ ret = -EFAULT;
+ }
break;
- }
case AMSTREAM_IOC_GET_VIDEO_DISCONTINUE_REPORT:
put_user(enable_video_discontinue_report, (u32 __user *)argp);
enable_video_discontinue_report = (arg == 0) ? 0 : 1;
break;
- case AMSTREAM_IOC_GET_VIDEO_AXIS:{
+ case AMSTREAM_IOC_GET_VIDEOPIP_AXIS:
+ case AMSTREAM_IOC_GET_VIDEO_AXIS:
+ {
int axis[4];
#ifdef CONFIG_AMLOGIC_POST_PROCESS_MANAGER_PPSCALER
- if (video_scaler_mode) {
+ if (video_scaler_mode && (layer->layer_id == 0)) {
axis[0] = content_left;
axis[1] = content_top;
axis[2] = content_w;
} else
#endif
{
- vpp_get_video_layer_position(
- &axis[0], &axis[1],
- &axis[2],
- &axis[3]);
+ axis[0] = layer->layer_left;
+ axis[1] = layer->layer_top;
+ axis[2] = layer->layer_width;
+ axis[3] = layer->layer_height;
}
axis[2] = axis[0] + axis[2] - 1;
}
break;
- case AMSTREAM_IOC_SET_VIDEO_AXIS:{
+ case AMSTREAM_IOC_SET_VIDEOPIP_AXIS:
+ case AMSTREAM_IOC_SET_VIDEO_AXIS:
+ {
int axis[4];
if (copy_from_user(axis, argp, sizeof(axis)) == 0)
- _set_video_window(axis);
+ _set_video_window(layer, axis);
else
ret = -EFAULT;
}
break;
- case AMSTREAM_IOC_GET_VIDEO_CROP:{
+ case AMSTREAM_IOC_GET_VIDEOPIP_CROP:
+ case AMSTREAM_IOC_GET_VIDEO_CROP:
+ {
int crop[4];
{
- vpp_get_video_source_crop(&crop[0], &crop[1],
- &crop[2], &crop[3]);
+ crop[0] = layer->crop_top;
+ crop[1] = layer->crop_left;
+ crop[2] = layer->crop_bottom;
+ crop[3] = layer->crop_right;
}
if (copy_to_user(argp, &crop[0], sizeof(crop)) != 0)
}
break;
- case AMSTREAM_IOC_SET_VIDEO_CROP:{
+ case AMSTREAM_IOC_SET_VIDEOPIP_CROP:
+ case AMSTREAM_IOC_SET_VIDEO_CROP:
+ {
int crop[4];
if (copy_from_user(crop, argp, sizeof(crop)) == 0)
- _set_video_crop(crop);
+ _set_video_crop(layer, crop);
else
ret = -EFAULT;
}
break;
+ case AMSTREAM_IOC_GET_PIP_SCREEN_MODE:
case AMSTREAM_IOC_GET_SCREEN_MODE:
- if (copy_to_user(argp, &wide_setting, sizeof(u32)) != 0)
+ if (copy_to_user(argp, &layer->wide_mode, sizeof(u32)) != 0)
ret = -EFAULT;
break;
- case AMSTREAM_IOC_SET_SCREEN_MODE:{
+ case AMSTREAM_IOC_SET_PIP_SCREEN_MODE:
+ case AMSTREAM_IOC_SET_SCREEN_MODE:
+ {
u32 mode;
if (copy_from_user(&mode, argp, sizeof(u32)) == 0) {
if (mode >= VIDEO_WIDEOPTION_MAX)
ret = -EINVAL;
- else if (mode != wide_setting) {
- wide_setting = mode;
- video_property_changed = true;
+ else if (mode != layer->wide_mode) {
+ layer->wide_mode = mode;
+ if (layer->layer_id == 0)
+ video_property_changed = 1;
+#ifdef VIDEO_PIP
+ else if (layer->layer_id == 1)
+ pip_property_changed = 1;
+#endif
}
} else
ret = -EFAULT;
process_3d_type = type;
if (mvc_flag)
process_3d_type |= MODE_3D_MVC;
- video_property_changed = true;
+ video_property_changed = 1;
if ((process_3d_type & MODE_3D_FA)
&& cur_dispbuf
&& !cur_dispbuf->trans_fmt)
vsync_slow_factor = arg;
break;
+ case AMSTREAM_IOC_GLOBAL_SET_VIDEOPIP_OUTPUT:
case AMSTREAM_IOC_GLOBAL_SET_VIDEO_OUTPUT:
- if (arg != 0)
- video_global_output = 1;
- else
- video_global_output = 0;
+ if (layer->layer_id == 0) {
+ if (arg != 0)
+ video_global_output = 1;
+ else
+ video_global_output = 0;
+ }
+#ifdef VIDEO_PIP
+ else if (layer->layer_id == 1) {
+ if (arg != 0)
+ pip_global_output = 1;
+ else
+ pip_global_output = 0;
+ }
+#endif
break;
+ case AMSTREAM_IOC_GLOBAL_GET_VIDEOPIP_OUTPUT:
case AMSTREAM_IOC_GLOBAL_GET_VIDEO_OUTPUT:
- put_user(video_global_output, (u32 __user *)argp);
+ if (layer->layer_id == 0)
+ put_user(video_global_output, (u32 __user *)argp);
+#ifdef VIDEO_PIP
+ else if (layer->layer_id == 1)
+ put_user(pip_global_output, (u32 __user *)argp);
+#endif
break;
case AMSTREAM_IOC_GET_VIDEO_LAYER1_ON: {
videopeek = true;
nopostvideostart = true;
break;
+
+ case AMSTREAM_IOC_GET_PIP_ZORDER:
+ case AMSTREAM_IOC_GET_ZORDER:
+ break;
+
+ case AMSTREAM_IOC_SET_PIP_ZORDER:
+ case AMSTREAM_IOC_SET_ZORDER:
+ break;
+
+ case AMSTREAM_IOC_QUERY_LAYER:
+ mutex_lock(&video_layer_mutex);
+ put_user(layer_cap, (u32 __user *)argp);
+ mutex_unlock(&video_layer_mutex);
+ ret = 0;
+ break;
+
+ case AMSTREAM_IOC_ALLOC_LAYER:
+ if (copy_from_user(&layer_id, argp, sizeof(u32)) == 0) {
+ if (layer_id >= MAX_VD_LAYERS) {
+ ret = -EINVAL;
+ } else {
+ mutex_lock(&video_layer_mutex);
+ if (file->private_data) {
+ ret = -EBUSY;
+ } else {
+ ret = alloc_layer(layer_id);
+ if (!ret)
+ file->private_data =
+ (void *)&glayer_info[layer_id];
+ }
+ mutex_unlock(&video_layer_mutex);
+ }
+ } else
+ ret = -EFAULT;
+ break;
+
+ case AMSTREAM_IOC_FREE_LAYER:
+ mutex_lock(&video_layer_mutex);
+ if (!file->private_data) {
+ ret = -EINVAL;
+ } else {
+ ret = free_layer(layer->layer_id);
+ if (!ret)
+ file->private_data = NULL;
+ }
+ mutex_unlock(&video_layer_mutex);
+ break;
+
default:
return -EINVAL;
}
case AMSTREAM_IOC_GET_VSYNC_SLOW_FACTOR:
case AMSTREAM_IOC_GLOBAL_GET_VIDEO_OUTPUT:
case AMSTREAM_IOC_GET_VIDEO_LAYER1_ON:
+ case AMSTREAM_IOC_GLOBAL_SET_VIDEOPIP_OUTPUT:
+ case AMSTREAM_IOC_GLOBAL_GET_VIDEOPIP_OUTPUT:
+ case AMSTREAM_IOC_GET_VIDEOPIP_DISABLE:
+ case AMSTREAM_IOC_SET_VIDEOPIP_DISABLE:
+ case AMSTREAM_IOC_GET_VIDEOPIP_AXIS:
+ case AMSTREAM_IOC_SET_VIDEOPIP_AXIS:
+ case AMSTREAM_IOC_GET_VIDEOPIP_CROP:
+ case AMSTREAM_IOC_SET_VIDEOPIP_CROP:
+ case AMSTREAM_IOC_GET_PIP_SCREEN_MODE:
+ case AMSTREAM_IOC_SET_PIP_SCREEN_MODE:
+ case AMSTREAM_IOC_GET_PIP_ZORDER:
+ case AMSTREAM_IOC_SET_PIP_ZORDER:
+ case AMSTREAM_IOC_GET_ZORDER:
+ case AMSTREAM_IOC_SET_ZORDER:
+ case AMSTREAM_IOC_QUERY_LAYER:
+ case AMSTREAM_IOC_ALLOC_LAYER:
+ case AMSTREAM_IOC_FREE_LAYER:
arg = (unsigned long) compat_ptr(arg);
case AMSTREAM_IOC_TRICKMODE:
case AMSTREAM_IOC_VPAUSE:
return count;
}
-static void set_video_crop(const char *para)
+static void set_video_crop(
+ struct disp_info_s *layer, const char *para)
{
int parsed[4];
if (likely(parse_para(para, 4, parsed) == 4))
- _set_video_crop(parsed);
+ _set_video_crop(layer, parsed);
amlog_mask(LOG_MASK_SYSFS,
"video crop=>x0:%d,y0:%d,x1:%d,y1:%d\n ",
parsed[0], parsed[1], parsed[2], parsed[3]);
static void set_video_speed_check(const char *para)
{
int parsed[2];
+ struct disp_info_s *layer = &glayer_info[0];
- if (likely(parse_para(para, 2, parsed) == 2))
- vpp_set_video_speed_check(parsed[0], parsed[1]);
+ if (likely(parse_para(para, 2, parsed) == 2)) {
+ layer->speed_check_height = parsed[0];
+ layer->speed_check_width = parsed[1];
+ }
amlog_mask(LOG_MASK_SYSFS,
"video speed_check=>h:%d,w:%d\n ", parsed[0], parsed[1]);
}
-static void set_video_window(const char *para)
+static void set_video_window(
+ struct disp_info_s *layer, const char *para)
{
int parsed[4];
if (likely(parse_para(para, 4, parsed) == 4))
- _set_video_window(parsed);
+ _set_video_window(layer, parsed);
amlog_mask(LOG_MASK_SYSFS,
"video=>x0:%d,y0:%d,x1:%d,y1:%d\n ",
parsed[0], parsed[1], parsed[2], parsed[3]);
#ifdef TV_3D_FUNCTION_OPEN
u32 enable;
int r;
+ struct disp_info_s *layer = &glayer_info[0];
r = kstrtouint(buf, 0, &enable);
if (r < 0)
return -EINVAL;
- vpp_set_3d_scale(enable);
- video_property_changed = true;
+ layer->vpp_3d_scale = enable ? true : false;
+ video_property_changed = 1;
amlog_mask(LOG_MASK_SYSFS, "%s:%s 3d scale.\n", __func__,
enable ? "enable" : "disable");
#endif
if (likely(parse_para(buf, 1, parsed) == 1)) {
if (super_scaler != (parsed[0] & 0x1)) {
super_scaler = parsed[0] & 0x1;
- video_property_changed = true;
+ video_property_changed = 1;
}
}
mutex_unlock(&video_module_mutex);
char *buf)
{
u32 t, l, b, r;
+ struct disp_info_s *layer = &glayer_info[0];
- vpp_get_video_source_crop(&t, &l, &b, &r);
+ t = layer->crop_top;
+ l = layer->crop_left;
+ b = layer->crop_bottom;
+ r = layer->crop_right;
return snprintf(buf, 40, "%d %d %d %d\n", t, l, b, r);
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ struct disp_info_s *layer = &glayer_info[0];
+
mutex_lock(&video_module_mutex);
- set_video_crop(buf);
+ set_video_crop(layer, buf);
mutex_unlock(&video_module_mutex);
char *buf)
{
int x, y, w, h;
+ struct disp_info_s *layer = &glayer_info[0];
+
#ifdef CONFIG_AMLOGIC_POST_PROCESS_MANAGER_PPSCALER
if (video_scaler_mode) {
x = content_left;
} else
#endif
{
- vpp_get_video_layer_position(&x, &y, &w, &h);
+ x = layer->layer_left;
+ y = layer->layer_top;
+ w = layer->layer_width;
+ h = layer->layer_height;
}
return snprintf(buf, 40, "%d %d %d %d\n", x, y, x + w - 1, y + h - 1);
}
struct class_attribute *attr,
const char *buf, size_t count)
{
+ struct disp_info_s *layer = &glayer_info[0];
+
mutex_lock(&video_module_mutex);
- set_video_window(buf);
+ set_video_window(layer, buf);
mutex_unlock(&video_module_mutex);
struct class_attribute *attr, char *buf)
{
int x, y;
+ struct disp_info_s *layer = &glayer_info[0];
- vpp_get_global_offset(&x, &y);
+ x = layer->global_offset_x;
+ y = layer->global_offset_y;
return snprintf(buf, 40, "%d %d\n", x, y);
}
const char *buf, size_t count)
{
int parsed[2];
+ struct disp_info_s *layer = &glayer_info[0];
mutex_lock(&video_module_mutex);
if (likely(parse_para(buf, 2, parsed) == 2)) {
- vpp_set_global_offset(parsed[0], parsed[1]);
- video_property_changed = true;
+ layer->global_offset_x = parsed[0];
+ layer->global_offset_y = parsed[1];
+ video_property_changed = 1;
amlog_mask(LOG_MASK_SYSFS,
"video_offset=>x0:%d,y0:%d\n ",
struct class_attribute *attr,
char *buf)
{
- u32 r = vpp_get_zoom_ratio();
+ u32 r;
+ struct disp_info_s *layer = &glayer_info[0];
+
+ r = layer->zoom_ratio;
return snprintf(buf, 40, "%d\n", r);
}
{
unsigned long r;
int ret = 0;
+ struct disp_info_s *layer = &glayer_info[0];
ret = kstrtoul(buf, 0, (unsigned long *)&r);
if (ret < 0)
return -EINVAL;
- if ((r <= MAX_ZOOM_RATIO) && (r != vpp_get_zoom_ratio())) {
- vpp_set_zoom_ratio(r);
- video_property_changed = true;
+ if ((r <= MAX_ZOOM_RATIO) && (r != layer->zoom_ratio)) {
+ layer->zoom_ratio = r;
+ video_property_changed = 1;
}
return count;
static ssize_t video_screen_mode_show(struct class *cla,
struct class_attribute *attr, char *buf)
{
+ struct disp_info_s *layer = &glayer_info[0];
static const char * const wide_str[] = {
"normal", "full stretch", "4-3", "16-9", "non-linear",
"normal-noscaleup",
"16-9 combined", "Custom AR", "AFD"
};
- if (wide_setting < ARRAY_SIZE(wide_str)) {
- return sprintf(buf, "%d:%s\n", wide_setting,
- wide_str[wide_setting]);
+ if (layer->wide_mode < ARRAY_SIZE(wide_str)) {
+ return sprintf(buf, "%d:%s\n",
+ layer->wide_mode,
+ wide_str[layer->wide_mode]);
} else
return 0;
}
{
unsigned long mode;
int ret = 0;
+ struct disp_info_s *layer = &glayer_info[0];
ret = kstrtoul(buf, 0, (unsigned long *)&mode);
if (ret < 0)
return -EINVAL;
- if ((mode < VIDEO_WIDEOPTION_MAX) && (mode != wide_setting)) {
- wide_setting = mode;
- video_property_changed = true;
+ if ((mode < VIDEO_WIDEOPTION_MAX)
+ && (mode != layer->wide_mode)) {
+ layer->wide_mode = mode;
+ video_property_changed = 1;
}
return count;
struct class_attribute *attr,
char *buf)
{
- return sprintf(buf, "%d\n", vpp_get_nonlinear_factor());
+ u32 factor;
+ struct disp_info_s *layer = &glayer_info[0];
+
+ factor = vpp_get_nonlinear_factor(layer);
+
+ return sprintf(buf, "%d\n", factor);
}
static ssize_t video_nonlinear_factor_store(struct class *cla,
{
int r;
u32 factor;
+ struct disp_info_s *layer = &glayer_info[0];
r = kstrtoint(buf, 0, &factor);
if (r < 0)
return -EINVAL;
- if (vpp_set_nonlinear_factor(factor) == 0)
- video_property_changed = true;
+ if (vpp_set_nonlinear_factor(layer, factor) == 0)
+ video_property_changed = 1;
return count;
}
struct class_attribute *attr, char *buf)
{
u32 h, w;
+ struct disp_info_s *layer = &glayer_info[0];
- vpp_get_video_speed_check(&h, &w);
+ h = layer->speed_check_height;
+ w = layer->speed_check_width;
return snprintf(buf, 40, "%d %d\n", h, w);
}
struct class_attribute *attr,
const char *buf, size_t count)
{
-
set_video_speed_check(buf);
-
return strnlen(buf, count);
}
process_3d_type = type;
if (mvc_flag)
process_3d_type |= MODE_3D_MVC;
- video_property_changed = true;
+ video_property_changed = 1;
if ((process_3d_type & MODE_3D_FA)
&& cur_dispbuf && !cur_dispbuf->trans_fmt)
/*notify di 3d mode is frame alternative mode,1*/
void set_video_angle(u32 s_value)
{
- if ((s_value <= 3) && (video_angle != s_value)) {
- video_angle = s_value;
- video_prot.angle_changed = 1;
- video_prot.video_started = 1;
- pr_info("video_prot angle:%d\n", video_angle);
+ struct disp_info_s *layer = &glayer_info[0];
+
+ if ((s_value <= 3) && (layer->angle != s_value)) {
+ layer->angle = s_value;
+ pr_info("video angle:%d\n", layer->angle);
}
}
EXPORT_SYMBOL(set_video_angle);
static ssize_t video_angle_show(struct class *cla, struct class_attribute *attr,
char *buf)
{
- return snprintf(buf, 40, "%d\n", video_angle);
+ struct disp_info_s *layer = &glayer_info[0];
+
+ return snprintf(buf, 40, "%d\n", layer->angle);
}
static ssize_t video_angle_store(struct class *cla,
return count;
}
+#ifdef VIDEO_PIP
+static int _videopip_set_disable(u32 val)
+{
+ if (val > VIDEO_DISABLE_FORNEXT)
+ return -EINVAL;
+
+ disable_videopip = val;
+
+ if (disable_videopip != VIDEO_DISABLE_NONE) {
+ DisableVideoLayer2();
+
+ if ((disable_videopip == VIDEO_DISABLE_FORNEXT)
+ && cur_pipbuf && (cur_pipbuf != &local_pip))
+ pip_property_changed = 1;
+ } else {
+ if (cur_pipbuf && (cur_pipbuf != &local_pip))
+ EnableVideoLayer2();
+ }
+
+ return 0;
+}
+
+static ssize_t videopip_axis_show(
+ struct class *cla,
+ struct class_attribute *attr,
+ char *buf)
+{
+ int x0, y0, x1, y1;
+ struct disp_info_s *layer = &glayer_info[1];
+
+ x0 = layer->layer_left;
+ y0 = layer->layer_top;
+ x1 = layer->layer_width + x0 - 1;
+ y1 = layer->layer_height + y0 - 1;
+ return snprintf(buf, 40, "%d %d %d %d\n", x0, y0, x1, y1);
+}
+
+static ssize_t videopip_axis_store(
+ struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct disp_info_s *layer = &glayer_info[1];
+
+ mutex_lock(&video_module_mutex);
+
+ set_video_window(layer, buf);
+
+ mutex_unlock(&video_module_mutex);
+
+ return strnlen(buf, count);
+}
+
+static ssize_t videopip_crop_show(
+ struct class *cla,
+ struct class_attribute *attr,
+ char *buf)
+{
+ u32 t, l, b, r;
+ struct disp_info_s *layer = &glayer_info[1];
+
+ t = layer->crop_top;
+ l = layer->crop_left;
+ b = layer->crop_bottom;
+ r = layer->crop_right;
+ return snprintf(buf, 40, "%d %d %d %d\n", t, l, b, r);
+}
+
+static ssize_t videopip_crop_store(
+ struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct disp_info_s *layer = &glayer_info[1];
+
+ mutex_lock(&video_module_mutex);
+
+ set_video_crop(layer, buf);
+
+ mutex_unlock(&video_module_mutex);
+
+ return strnlen(buf, count);
+}
+
+static ssize_t videopip_disable_show(
+ struct class *cla, struct class_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%d\n", disable_videopip);
+}
+
+static ssize_t videopip_disable_store(
+ struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+
+ int r;
+ int val;
+
+ if (debug_flag & DEBUG_FLAG_BLACKOUT)
+ pr_info("%s(%s)\n", __func__, buf);
+
+ r = kstrtoint(buf, 0, &val);
+ if (r < 0)
+ return -EINVAL;
+
+ if (_videopip_set_disable(val) < 0)
+ return -EINVAL;
+
+ return count;
+}
+
+static ssize_t videopip_screen_mode_show(
+ struct class *cla,
+ struct class_attribute *attr,
+ char *buf)
+{
+ struct disp_info_s *layer = &glayer_info[1];
+ static const char * const wide_str[] = {
+ "normal", "full stretch", "4-3", "16-9", "non-linear",
+ "normal-noscaleup",
+ "4-3 ignore", "4-3 letter box", "4-3 pan scan", "4-3 combined",
+ "16-9 ignore", "16-9 letter box", "16-9 pan scan",
+ "16-9 combined", "Custom AR", "AFD"
+ };
+
+ if (layer->wide_mode < ARRAY_SIZE(wide_str)) {
+ return sprintf(buf, "%d:%s\n",
+ layer->wide_mode,
+ wide_str[layer->wide_mode]);
+ } else
+ return 0;
+}
+
+static ssize_t videopip_screen_mode_store(
+ struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+ unsigned long mode;
+ int ret = 0;
+ struct disp_info_s *layer = &glayer_info[1];
+
+ ret = kstrtoul(buf, 0, (unsigned long *)&mode);
+ if (ret < 0)
+ return -EINVAL;
+
+ if ((mode < VIDEO_WIDEOPTION_MAX)
+ && (mode != layer->wide_mode)) {
+ layer->wide_mode = mode;
+ pip_property_changed = 1;
+ }
+ return count;
+}
+
+static ssize_t videopip_loop_show(
+ struct class *cla, struct class_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%d\n", pip_loop);
+}
+
+static ssize_t videopip_loop_store(
+ struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+ int r;
+ int val;
+
+ r = kstrtoint(buf, 0, &val);
+ if (r < 0)
+ return -EINVAL;
+
+ pip_loop = val;
+ return count;
+}
+
+static ssize_t videopip_global_output_show(
+ struct class *cla,
+ struct class_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", pip_global_output);
+}
+
+static ssize_t videopip_global_output_store(
+ struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+ int r;
+
+ r = kstrtoint(buf, 0, &pip_global_output);
+ if (r < 0)
+ return -EINVAL;
+
+ pr_info("%s(%d)\n", __func__, pip_global_output);
+
+ return count;
+}
+
+static ssize_t videopip_state_show(
+ struct class *cla,
+ struct class_attribute *attr,
+ char *buf)
+{
+ ssize_t len = 0;
+ struct vppfilter_mode_s *vpp_filter = NULL;
+
+ if (!curpip_frame_par)
+ return len;
+ vpp_filter = &curpip_frame_par->vpp_filter;
+ len += sprintf(buf + len,
+ "zoom2_start_x_lines:%u.zoom2_end_x_lines:%u.\n",
+ zoom2_start_x_lines, zoom2_end_x_lines);
+ len += sprintf(buf + len,
+ "zoom2_start_y_lines:%u.zoom2_end_y_lines:%u.\n",
+ zoom2_start_y_lines, zoom2_end_y_lines);
+ len += sprintf(buf + len, "frame parameters: pic_in_height %u.\n",
+ curpip_frame_par->VPP_pic_in_height_);
+ len += sprintf(buf + len,
+ "frame parameters: VPP_line_in_length_ %u.\n",
+ curpip_frame_par->VPP_line_in_length_);
+ len += sprintf(buf + len, "vscale_skip_count %u.\n",
+ curpip_frame_par->vscale_skip_count);
+ len += sprintf(buf + len, "hscale_skip_count %u.\n",
+ curpip_frame_par->hscale_skip_count);
+ len += sprintf(buf + len, "supscl_path %u.\n",
+ curpip_frame_par->supscl_path);
+ len += sprintf(buf + len, "supsc0_enable %u.\n",
+ curpip_frame_par->supsc0_enable);
+ len += sprintf(buf + len, "supsc1_enable %u.\n",
+ curpip_frame_par->supsc1_enable);
+ len += sprintf(buf + len, "supsc0_hori_ratio %u.\n",
+ curpip_frame_par->supsc0_hori_ratio);
+ len += sprintf(buf + len, "supsc1_hori_ratio %u.\n",
+ curpip_frame_par->supsc1_hori_ratio);
+ len += sprintf(buf + len, "supsc0_vert_ratio %u.\n",
+ curpip_frame_par->supsc0_vert_ratio);
+ len += sprintf(buf + len, "supsc1_vert_ratio %u.\n",
+ curpip_frame_par->supsc1_vert_ratio);
+ len += sprintf(buf + len, "spsc0_h_in %u.\n",
+ curpip_frame_par->spsc0_h_in);
+ len += sprintf(buf + len, "spsc1_h_in %u.\n",
+ curpip_frame_par->spsc1_h_in);
+ len += sprintf(buf + len, "spsc0_w_in %u.\n",
+ curpip_frame_par->spsc0_w_in);
+ len += sprintf(buf + len, "spsc1_w_in %u.\n",
+ curpip_frame_par->spsc1_w_in);
+ len += sprintf(buf + len, "video_input_w %u.\n",
+ curpip_frame_par->video_input_w);
+ len += sprintf(buf + len, "video_input_h %u.\n",
+ curpip_frame_par->video_input_h);
+ len += sprintf(buf + len, "clk_in_pps %u.\n",
+ curpip_frame_par->clk_in_pps);
+ len +=
+ sprintf(buf + len, "hscale phase step 0x%x.\n",
+ vpp_filter->vpp_hsc_start_phase_step);
+ len +=
+ sprintf(buf + len, "vscale phase step 0x%x.\n",
+ vpp_filter->vpp_vsc_start_phase_step);
+ len +=
+ sprintf(buf + len, "pps pre hsc enable %d.\n",
+ vpp_filter->vpp_pre_hsc_en);
+ len +=
+ sprintf(buf + len, "pps pre vsc enable %d.\n",
+ vpp_filter->vpp_pre_vsc_en);
+ len +=
+ sprintf(buf + len, "hscale filter coef %d.\n",
+ vpp_filter->vpp_horz_filter);
+ len +=
+ sprintf(buf + len, "vscale filter coef %d.\n",
+ vpp_filter->vpp_vert_filter);
+ len +=
+ sprintf(buf + len, "vpp_vert_chroma_filter_en %d.\n",
+ vpp_filter->vpp_vert_chroma_filter_en);
+ len +=
+ sprintf(buf + len, "post_blend_vd_h_start 0x%x.\n",
+ curpip_frame_par->VPP_post_blend_vd_h_start_);
+ len +=
+ sprintf(buf + len, "post_blend_vd_h_end 0x%x.\n",
+ curpip_frame_par->VPP_post_blend_vd_h_end_);
+ len +=
+ sprintf(buf + len, "post_blend_vd_v_start 0x%x.\n",
+ curpip_frame_par->VPP_post_blend_vd_v_start_);
+ len +=
+ sprintf(buf + len, "post_blend_vd_v_end 0x%x.\n",
+ curpip_frame_par->VPP_post_blend_vd_v_end_);
+ len +=
+ sprintf(buf + len, "VPP_hd_start_lines_ 0x%x.\n",
+ curpip_frame_par->VPP_hd_start_lines_);
+ len +=
+ sprintf(buf + len, "VPP_hd_end_lines_ 0x%x.\n",
+ curpip_frame_par->VPP_hd_end_lines_);
+ len +=
+ sprintf(buf + len, "VPP_vd_start_lines_ 0x%x.\n",
+ curpip_frame_par->VPP_vd_start_lines_);
+ len +=
+ sprintf(buf + len, "VPP_vd_end_lines_ 0x%x.\n",
+ curpip_frame_par->VPP_vd_end_lines_);
+ len +=
+ sprintf(buf + len, "VPP_hsc_startp 0x%x.\n",
+ curpip_frame_par->VPP_hsc_startp);
+ len +=
+ sprintf(buf + len, "VPP_hsc_endp 0x%x.\n",
+ curpip_frame_par->VPP_hsc_endp);
+ len +=
+ sprintf(buf + len, "VPP_vsc_startp 0x%x.\n",
+ curpip_frame_par->VPP_vsc_startp);
+ len +=
+ sprintf(buf + len, "VPP_vsc_endp 0x%x.\n",
+ curpip_frame_par->VPP_vsc_endp);
+ return len;
+}
+
+#endif
+
static struct class_attribute amvideo_class_attrs[] = {
__ATTR(axis,
0664,
video_disable_show,
video_disable_store),
__ATTR(video_global_output,
- 0664,
- video_global_output_show,
- video_global_output_store),
+ 0664,
+ video_global_output_show,
+ video_global_output_store),
__ATTR(hold_video,
0664,
video_hold_show,
__ATTR_RO(fps_info),
__ATTR_RO(video_layer1_state),
__ATTR_RO(pic_mode_info),
+#ifdef VIDEO_PIP
+ __ATTR(axis_pip,
+ 0664,
+ videopip_axis_show,
+ videopip_axis_store),
+ __ATTR(crop_pip,
+ 0664,
+ videopip_crop_show,
+ videopip_crop_store),
+ __ATTR(disable_videopip,
+ 0664,
+ videopip_disable_show,
+ videopip_disable_store),
+ __ATTR(screen_mode_pip,
+ 0664,
+ videopip_screen_mode_show,
+ videopip_screen_mode_store),
+ __ATTR(videopip_loop,
+ 0664,
+ videopip_loop_show,
+ videopip_loop_store),
+ __ATTR(pip_global_output,
+ 0664,
+ videopip_global_output_show,
+ videopip_global_output_store),
+ __ATTR_RO(videopip_state),
+#endif
__ATTR_NULL
};
new_vmode = vinfo->mode;
break;
case VOUT_EVENT_OSD_PREBLEND_ENABLE:
- vpp_set_osd_layer_preblend(para);
break;
case VOUT_EVENT_OSD_DISP_AXIS:
- vpp_set_osd_layer_position(para);
break;
}
return 0;
spin_unlock_irqrestore(&lock, flags);
break;
case VOUT_EVENT_OSD_PREBLEND_ENABLE:
- vpp_set_osd_layer_preblend(para);
break;
case VOUT_EVENT_OSD_DISP_AXIS:
- vpp_set_osd_layer_position(para);
break;
}
return 0;
u32 cur_hold_line;
-#if 0 /* if (0 >= VMODE_MAX) //DEBUG_TMP */
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 */
- if (cpu_after_eq(MESON_CPU_MAJOR_ID_GXTVBB))
- WRITE_VCBUS_REG_BITS(VPP_OFIFO_SIZE, 0xfff,
- VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
- else
- WRITE_VCBUS_REG_BITS(VPP_OFIFO_SIZE, 0x77f,
- VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
-#if 0 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESONG9TV */
- WRITE_VCBUS_REG_BITS(VPP_OFIFO_SIZE, 0x800, VPP_OFIFO_SIZE_BIT,
- VPP_OFIFO_SIZE_WID);
-#endif
-#endif /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 */
-#else
if (!legacy_vpp) {
WRITE_VCBUS_REG_BITS(VPP_OFIFO_SIZE, 0x1000,
VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
} else if (cpu_after_eq(MESON_CPU_MAJOR_ID_GXTVBB))
WRITE_VCBUS_REG_BITS(VPP_OFIFO_SIZE, 0xfff,
VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
-#endif
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
WRITE_VCBUS_REG(VPP_PREBLEND_VD1_H_START_END, 4096);
WRITE_VCBUS_REG(VPP_BLEND_VD2_H_START_END, 4096);
-#endif
+
if (is_meson_txl_cpu() || is_meson_txlx_cpu()) {
/* fifo max size on txl :128*3=384[0x180] */
WRITE_VCBUS_REG(
VD2_IF0_LUMA_FIFO_SIZE + cur_dev->viu_off, 0x180);
}
-#if 0 /* if (0 >= VMODE_MAX) //DEBUG_TMP */
- CLEAR_VCBUS_REG_MASK(VPP_VSC_PHASE_CTRL,
- VPP_PHASECTL_TYPE_INTERLACE);
- SET_VCBUS_REG_MASK(VPP_MISC, VPP_OUT_SATURATE);
- WRITE_VCBUS_REG(VPP_HOLD_LINES + cur_dev->vpp_off, 0x08080808);
-#endif
-
#ifdef CONFIG_SUPPORT_VIDEO_ON_VPP2
-#if 0 /* if (0 >= VMODE_MAX) //DEBUG_TMP */
- CLEAR_VCBUS_REG_MASK(VPP2_VSC_PHASE_CTRL,
- VPP_PHASECTL_TYPE_INTERLACE);
- SET_VCBUS_REG_MASK(VPP2_MISC, VPP_OUT_SATURATE);
- WRITE_VCBUS_REG(VPP2_HOLD_LINES, 0x08080808);
-#endif
-#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
WRITE_VCBUS_REG_BITS(VPP2_OFIFO_SIZE, 0x800,
- VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
-#else
- WRITE_VCBUS_REG_BITS(VPP2_OFIFO_SIZE, 0x780,
- VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
-#endif
+ VPP_OFIFO_SIZE_BIT, VPP_OFIFO_SIZE_WID);
/*
*WRITE_VCBUS_REG_BITS(VPU_OSD3_MMC_CTRL, 1, 12, 2);
*select vdisp_mmc_arb for VIU2_OSD1 request
vpp_hold_line = cur_hold_line;
/* Temp force set dmc */
- if (!legacy_vpp)
+ if (!legacy_vpp) {
WRITE_DMCREG(
DMC_AM0_CHAN_CTRL,
0x8ff403cf);
-
+ /* for vd1 & vd2 dummy alpha*/
+ WRITE_VCBUS_REG(
+ VPP_POST_BLEND_DUMMY_ALPHA,
+ 0x7fffffff);
+ }
if (is_meson_tl1_cpu()) {
/* force bypass dolby for TL1, no dolby function */
WRITE_VCBUS_REG_BITS(
static int __init video_init(void)
{
- int r = 0;
+ int r = 0, i;
/*
*#ifdef CONFIG_ARCH_MESON1
*ulong clk = clk_get_rate(clk_get_sys("clk_other_pll", NULL));
goto err5;
}
+ for (i = 0; i < MAX_VD_LAYERS; i++) {
+ vpp_disp_info_init(&glayer_info[i], i);
+ glayer_info[i].wide_mode = 1;
+ }
+
+ if (legacy_vpp)
+ layer_cap =
+ LAYER1_AFBC |
+ LAYER1_AVAIL |
+ LAYER0_AFBC |
+ LAYER0_SCALER |
+ LAYER0_AVAIL;
+ else if (is_meson_tl1_cpu())
+ layer_cap =
+ LAYER1_AVAIL |
+ LAYER0_AFBC |
+ LAYER0_SCALER |
+ LAYER0_AVAIL;
+ else
+ layer_cap =
+ LAYER1_AFBC |
+ LAYER1_SCALER |
+ LAYER1_AVAIL |
+ LAYER0_AFBC |
+ LAYER0_SCALER |
+ LAYER0_AVAIL;
+
init_waitqueue_head(&amvideo_trick_wait);
init_waitqueue_head(&amvideo_sizechange_wait);
#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
NULL);
vf_reg_receiver(&video_vf_recv);
- vf_receiver_init(&video4osd_vf_recv, RECEIVER4OSD_NAME,
- &video4osd_vf_receiver, NULL);
- vf_reg_receiver(&video4osd_vf_recv);
+#ifdef VIDEO_PIP
+ vf_receiver_init(
+ &videopip_vf_recv, RECEIVERPIP_NAME,
+ &videopip_vf_receiver, NULL);
+ vf_reg_receiver(&videopip_vf_recv);
+#endif
+
#if DEBUG_TMP
switch_dev_register(&video1_state_sdev);
switch_set_state(&video1_state_sdev, 0);
video_debugfs_exit();
vf_unreg_receiver(&video_vf_recv);
- vf_unreg_receiver(&video4osd_vf_recv);
+#ifdef VIDEO_PIP
+ vf_unreg_receiver(&videopip_vf_recv);
+#endif
DisableVideoLayer();
DisableVideoLayer2();
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/amlogic/media/vout/vinfo.h>
-/* #include <mach/am_regs.h> */
#include <linux/amlogic/media/utils/amports_config.h>
-
#include <linux/amlogic/media/vpu/vpu.h>
-
#include <linux/amlogic/media/vfm/vframe.h>
#include <linux/amlogic/media/video_sink/video.h>
#include <linux/amlogic/media/video_sink/vpp.h>
-#include <linux/amlogic/media/vfm/vframe_provider.h>
-#include <linux/amlogic/media/video_sink/video_prot.h>
-/*#include <linux/amlogic/gpio-amlogic.h>*/
-
-#include <linux/amlogic/iomap.h>
-
#include "videolog.h"
/* #define CONFIG_VIDEO_LOG */
#ifdef CONFIG_VIDEO_LOG
#include <linux/amlogic/media/registers/register.h>
#include <linux/amlogic/media/utils/vdec_reg.h>
+#include "video_priv.h"
+
+#define MAX_NONLINEAR_FACTOR 0x40
+
/* vpp filter coefficients */
#define COEF_BICUBIC 0
#define COEF_3POINT_TRIANGLE 1
#define COEF_NULL 0xff
#define TOTAL_FILTERS 10
-#define MAX_NONLINEAR_FACTOR 0x40
-
#define VPP_SPEED_FACTOR 0x110ULL
#define SUPER_SCALER_V_FACTOR 100
#define PPS_FRAC_BITS 24
#define PPS_INT_BITS 4
+struct filter_info_s {
+ u32 cur_vert_filter;
+ u32 cur_horz_filter;
+ u32 last_vert_filter;
+ u32 last_horz_filter;
+ u32 scaler_filter_cnt;
+};
+
+static struct filter_info_s gfilter[MAX_VD_LAYERS];
+
const u32 vpp_filter_coefs_bicubic_sharp[] = {
3,
33 | 0x8000,
module_param(vpp_filter_fix, uint, 0664);
#define MAX_COEFF_LEVEL 5
-uint num_coeff_level = MAX_COEFF_LEVEL;
-uint vert_coeff_settings[MAX_COEFF_LEVEL] = {
+static uint num_coeff_level = MAX_COEFF_LEVEL;
+static uint vert_coeff_settings[MAX_COEFF_LEVEL] = {
/* in:out */
COEF_BICUBIC,
/* ratio < 1 */
/* this setting is most smooth */
};
-uint horz_coeff_settings[MAX_COEFF_LEVEL] = {
+static uint horz_coeff_settings[MAX_COEFF_LEVEL] = {
/* in:out */
COEF_BICUBIC,
/* ratio < 1 */
module_param_array(horz_coeff_settings, uint, &num_coeff_level, 0664);
MODULE_PARM_DESC(horz_coeff_settings, "\n horz_coeff_settings\n");
-bool vert_chroma_filter_en = true;
+static bool vert_chroma_filter_en = true;
module_param(vert_chroma_filter_en, bool, 0664);
MODULE_PARM_DESC(vert_chroma_filter_en, "enable vertical chromafilter\n");
-bool vert_chroma_filter_force_en;
+static bool vert_chroma_filter_force_en;
module_param(vert_chroma_filter_force_en, bool, 0664);
MODULE_PARM_DESC(vert_chroma_filter_force_en,
"force enable vertical chromafilter\n");
-uint vert_chroma_filter_limit = 480;
+static uint vert_chroma_filter_limit = 480;
module_param(vert_chroma_filter_limit, uint, 0664);
MODULE_PARM_DESC(vert_chroma_filter_limit, "vertical chromafilter limit\n");
-uint num_chroma_filter = TOTAL_FILTERS;
+static uint num_chroma_filter = TOTAL_FILTERS;
module_param_array(chroma_filter_table, uint, &num_chroma_filter, 0664);
MODULE_PARM_DESC(chroma_filter_table, "\n chroma_filter_table\n");
-uint cur_vert_chroma_filter;
+static uint cur_vert_chroma_filter;
MODULE_PARM_DESC(cur_vert_chroma_filter, "cur_vert_chroma_filter");
module_param(cur_vert_chroma_filter, int, 0444);
-uint cur_vert_filter;
+static uint cur_vert_filter;
MODULE_PARM_DESC(cur_vert_filter, "cur_vert_filter");
module_param(cur_vert_filter, int, 0444);
-uint cur_horz_filter;
+static uint cur_horz_filter;
MODULE_PARM_DESC(cur_horz_filter, "cur_horz_filter");
module_param(cur_horz_filter, int, 0444);
-uint cur_skip_line;
+static uint cur_skip_line;
MODULE_PARM_DESC(cur_skip_line, "cur_skip_line");
module_param(cur_skip_line, int, 0444);
-unsigned int super_scaler_v_ratio = 133;
+static unsigned int super_scaler_v_ratio = 133;
MODULE_PARM_DESC(super_scaler_v_ratio, "super_scaler_v_ratio");
module_param(super_scaler_v_ratio, uint, 0664);
module_param(skip_policy, uint, 0664);
MODULE_PARM_DESC(skip_policy, "\n skip_policy\n");
-unsigned int scaler_filter_cnt_limit = 10;
+static unsigned int scaler_filter_cnt_limit = 10;
MODULE_PARM_DESC(scaler_filter_cnt_limit, "scaler_filter_cnt_limit");
module_param(scaler_filter_cnt_limit, uint, 0664);
-static uint last_vert_filter;
-static uint last_horz_filter;
-static uint scaler_filter_cnt;
-
-static u32 vpp_wide_mode;
-static u32 vpp_zoom_ratio = 100;
-static s32 vpp_zoom_center_x, vpp_zoom_center_y;
-static u32 nonlinear_factor = MAX_NONLINEAR_FACTOR / 2;
-static u32 osd_layer_preblend;
-static s32 video_layer_top, video_layer_left, video_layer_width,
- video_layer_height;
-static u32 video_source_crop_top, video_source_crop_left,
- video_source_crop_bottom, video_source_crop_right;
-static u32 video_crop_top_resv, video_crop_left_resv,
- video_crop_bottom_resv, video_crop_right_resv;
-static s32 video_layer_global_offset_x, video_layer_global_offset_y;
-static s32 osd_layer_top, osd_layer_left, osd_layer_width, osd_layer_height;
-static u32 video_speed_check_width = 1800, video_speed_check_height = 1400;
-
#ifdef TV_3D_FUNCTION_OPEN
-static bool vpp_3d_scale;
static int force_filter_mode = 1;
MODULE_PARM_DESC(force_filter_mode, "force_filter_mode");
module_param(force_filter_mode, int, 0664);
module_param(sr0_sr1_refresh, uint, 0664);
MODULE_PARM_DESC(sr0_sr1_refresh, "sr0_sr1_refresh");
-bool pre_scaler_en = true;
+static bool pre_scaler_en = true;
module_param(pre_scaler_en, bool, 0664);
MODULE_PARM_DESC(pre_scaler_en, "pre_scaler_en");
-unsigned int force_vskip_cnt;
+static unsigned int force_vskip_cnt;
MODULE_PARM_DESC(force_vskip_cnt, "force_vskip_cnt");
module_param(force_vskip_cnt, uint, 0664);
-unsigned int disable_adapted;
+static unsigned int disable_adapted;
MODULE_PARM_DESC(disable_adapted, "disable_adapted");
module_param(disable_adapted, uint, 0664);
/*
* V-shape non-linear mode
*/
-static void
-calculate_non_linear_ratio(unsigned int middle_ratio,
- unsigned int width_out,
- struct vpp_frame_par_s *next_frame_par)
+static void calculate_non_linear_ratio(
+ unsigned int nonlinear_factor,
+ unsigned int middle_ratio,
+ unsigned int width_out,
+ struct vpp_frame_par_s *next_frame_par)
{
unsigned int diff_ratio;
- struct vppfilter_mode_s *vpp_filter = &next_frame_par->vpp_filter;
+ struct vppfilter_mode_s *vpp_filter =
+ &next_frame_par->vpp_filter;
diff_ratio = middle_ratio * nonlinear_factor;
vpp_filter->vpp_hf_start_phase_step = (middle_ratio << 6) - diff_ratio;
* (1.25 * 3840 / 1920) for 1080p mode.
*/
#define MIN_RATIO_1000 1250
-unsigned int min_skip_ratio = MIN_RATIO_1000;
+static unsigned int min_skip_ratio = MIN_RATIO_1000;
MODULE_PARM_DESC(min_skip_ratio, "min_skip_ratio");
module_param(min_skip_ratio, uint, 0664);
-unsigned int max_proc_height = 2160;
+static unsigned int max_proc_height = 2160;
MODULE_PARM_DESC(max_proc_height, "max_proc_height");
module_param(max_proc_height, uint, 0664);
-unsigned int cur_proc_height;
+static unsigned int cur_proc_height;
MODULE_PARM_DESC(cur_proc_height, "cur_proc_height");
module_param(cur_proc_height, uint, 0444);
-unsigned int cur_skip_ratio;
+static unsigned int cur_skip_ratio;
MODULE_PARM_DESC(cur_skip_ratio, "cur_skip_ratio");
module_param(cur_skip_ratio, uint, 0444);
-unsigned int cur_vf_type;
+static unsigned int cur_vf_type;
MODULE_PARM_DESC(cur_vf_type, "cur_vf_type");
module_param(cur_vf_type, uint, 0444);
-unsigned int custom_ar;
+static unsigned int custom_ar;
MODULE_PARM_DESC(custom_ar, "custom_ar");
module_param(custom_ar, uint, 0664);
*So need adjust bypass_ratio;
*/
-static int
-vpp_process_speed_check(s32 width_in,
- s32 height_in,
- s32 height_out,
- s32 height_screen,
- struct vpp_frame_par_s *next_frame_par,
- const struct vinfo_s *vinfo, struct vframe_s *vf)
+static int vpp_process_speed_check(
+ u32 layer_id,
+ s32 width_in,
+ s32 height_in,
+ s32 height_out,
+ s32 height_screen,
+ u32 video_speed_check_width,
+ u32 video_speed_check_height,
+ struct vpp_frame_par_s *next_frame_par,
+ const struct vinfo_s *vinfo, struct vframe_s *vf)
{
u32 cur_ratio, bpp = 1;
int min_ratio_1000 = 0;
u32 width_out = 0;
u32 vpu_clk = 0, max_height = 2160; /* 4k mode */
- if (vf)
+ if (!vf)
+ return SPEED_CHECK_DONE;
+
+ /* store the debug info for legacy */
+ if (layer_id == 0)
cur_vf_type = vf->type;
- else
- return 0;
+
if (force_vskip_cnt == 0xff)/*for debug*/
return SPEED_CHECK_DONE;
+
if (next_frame_par->vscale_skip_count < force_vskip_cnt)
return SPEED_CHECK_VSKIP;
if (get_cpu_type() >=
MESON_CPU_MAJOR_ID_GXBB) {
cur_ratio = div_u64((u64)height_in *
- (u64)vinfo->height *
- 1000,
- height_out * max_height);
+ (u64)vinfo->height *
+ 1000,
+ height_out * max_height);
/* di process first, need more a bit of ratio */
if (vf->type & VIDTYPE_PRE_INTERLACE)
cur_ratio = (cur_ratio * 105) / 100;
if ((next_frame_par->vscale_skip_count > 0)
&& (vf->type & VIDTYPE_VIU_444))
cur_ratio = cur_ratio * 2;
- cur_skip_ratio = cur_ratio;
+
+ /* store the debug info for legacy */
+ if (layer_id == 0)
+ cur_skip_ratio = cur_ratio;
+
if ((cur_ratio > min_ratio_1000) &&
- (vf->source_type != VFRAME_SOURCE_TYPE_TUNER) &&
- (vf->source_type != VFRAME_SOURCE_TYPE_CVBS))
+ (vf->source_type !=
+ VFRAME_SOURCE_TYPE_TUNER) &&
+ (vf->source_type !=
+ VFRAME_SOURCE_TYPE_CVBS))
return SPEED_CHECK_VSKIP;
}
if (vf->type & VIDTYPE_VIU_422) {
/*TODO vpu */
- if (height_out == 0
- || div_u64((u64)VPP_SPEED_FACTOR *
- (u64)width_in *
- (u64)height_in *
- (u64)vinfo->sync_duration_num *
- (u64)vtotal,
- height_out *
- vinfo->sync_duration_den *
- bypass_ratio) > clk_in_pps)
+ if (height_out == 0 ||
+ div_u64((u64)VPP_SPEED_FACTOR *
+ (u64)width_in *
+ (u64)height_in *
+ (u64)vinfo->sync_duration_num *
+ (u64)vtotal,
+ height_out *
+ vinfo->sync_duration_den *
+ bypass_ratio) > clk_in_pps)
return SPEED_CHECK_VSKIP;
else
return SPEED_CHECK_DONE;
} else {
/*TODO vpu */
- if (height_out == 0
- || div_u64((u64)VPP_SPEED_FACTOR *
+ if (height_out == 0 ||
+ div_u64((u64)VPP_SPEED_FACTOR *
(u64)width_in *
(u64)height_in *
(u64)vinfo->sync_duration_num *
/* 4K down scaling to non 4K > 30hz,*/
/*skip lines for memory bandwidth */
else if ((((vf->type & VIDTYPE_COMPRESS)
- == 0) || (next_frame_par->nocomp))
- &&
- (height_in > 2048) &&
- (height_out < 2048) &&
- (vinfo->sync_duration_num >
- (30 * vinfo->sync_duration_den)) &&
- (get_cpu_type() !=
- MESON_CPU_MAJOR_ID_GXTVBB) &&
- (get_cpu_type() !=
- MESON_CPU_MAJOR_ID_GXM))
+ == 0) || (next_frame_par->nocomp))
+ && (height_in > 2048)
+ && (height_out < 2048)
+ && (vinfo->sync_duration_num >
+ (30 * vinfo->sync_duration_den))
+ && (get_cpu_type() !=
+ MESON_CPU_MAJOR_ID_GXTVBB)
+ && (get_cpu_type() !=
+ MESON_CPU_MAJOR_ID_GXM))
return SPEED_CHECK_VSKIP;
else
return SPEED_CHECK_DONE;
} else if (next_frame_par->hscale_skip_count == 0) {
/*TODO vpu */
if (div_u64(VPP_SPEED_FACTOR * width_in *
- vinfo->sync_duration_num * height_screen,
- vinfo->sync_duration_den * 256)
+ vinfo->sync_duration_num * height_screen,
+ vinfo->sync_duration_den * 256)
> get_vpu_clk())
return SPEED_CHECK_HSKIP;
else
return SPEED_CHECK_VSKIP;
}
-static void
-vpp_set_filters2(u32 process_3d_type, u32 width_in,
+static int vpp_set_filters_internal(
+ struct disp_info_s *input,
+ u32 width_in,
u32 height_in,
u32 wid_out,
u32 hei_out,
u32 screen_aspect = 0;
bool skip_policy_check = true;
u32 vskip_step;
+ s32 video_layer_global_offset_x, video_layer_global_offset_y;
+ u32 video_source_crop_top, video_source_crop_left;
+ u32 video_source_crop_bottom, video_source_crop_right;
+ u32 vpp_zoom_ratio, nonlinear_factor;
+ u32 speed_check_width, speed_check_height;
+ s32 video_layer_top, video_layer_left;
+ s32 video_layer_width, video_layer_height;
+ u32 cur_custom_ar;
+#ifdef TV_REVERSE
+ bool reverse = false;
+#endif
+ int ret = VppFilter_Success;
+ u32 vert_chroma_filter;
+ struct filter_info_s *cur_filter;
+ s32 vpp_zoom_center_x, vpp_zoom_center_y;
+
+ if (!input)
+ return VppFilter_Fail;
+
+ cur_filter = &gfilter[input->layer_id];
+ cur_custom_ar = input->custom_ar;
+ vpp_zoom_ratio = input->zoom_ratio;
+ vpp_zoom_center_x = input->zoom_center_x;
+ vpp_zoom_center_y = input->zoom_center_y;
+ speed_check_width = input->speed_check_width;
+ speed_check_height = input->speed_check_height;
+ nonlinear_factor = input->nonlinear_factor;
+ video_layer_global_offset_x = input->global_offset_x;
+ video_layer_global_offset_y = input->global_offset_y;
+
+ video_layer_top = input->layer_top;
+ video_layer_left = input->layer_left;
+ video_layer_width = input->layer_width;
+ video_layer_height = input->layer_height;
+#ifdef TV_REVERSE
+ reverse = input->reverse;
+#endif
- if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXTVBB) {
- if (likely(w_in >
- (video_source_crop_left + video_source_crop_right))) {
- w_in -= video_source_crop_left;
- w_in -= video_source_crop_right;
- h_crop_enable = true;
- }
-
- if (likely(h_in >
- (video_source_crop_top + video_source_crop_bottom))) {
- h_in -= video_source_crop_top;
- h_in -= video_source_crop_bottom;
- v_crop_enable = true;
- }
+ if (vf->type & VIDTYPE_MVC) {
+ video_source_crop_left = 0;
+ video_source_crop_right = 0;
+ video_source_crop_top = 0;
+ video_source_crop_bottom = 0;
} else {
- if (likely(w_in >
- (video_source_crop_left + video_source_crop_right))) {
- w_in -= video_source_crop_left;
- w_in -= video_source_crop_right;
- h_crop_enable = true;
- }
+ video_source_crop_left = input->crop_left;
+ video_source_crop_right = input->crop_right;
+ video_source_crop_top = input->crop_top;
+ video_source_crop_bottom = input->crop_bottom;
+ }
- if (likely(h_in >
- (video_source_crop_top + video_source_crop_bottom))) {
- h_in -= video_source_crop_top;
- h_in -= video_source_crop_bottom;
- v_crop_enable = true;
- }
+ if (likely(w_in >
+ (video_source_crop_left + video_source_crop_right))) {
+ w_in -= video_source_crop_left;
+ w_in -= video_source_crop_right;
+ h_crop_enable = true;
+ }
+
+ if (likely(h_in >
+ (video_source_crop_top + video_source_crop_bottom))) {
+ h_in -= video_source_crop_top;
+ h_in -= video_source_crop_bottom;
+ v_crop_enable = true;
}
#ifndef TV_3D_FUNCTION_OPEN
#ifdef TV_3D_FUNCTION_OPEN
else if ((next_frame_par->vpp_3d_mode
== VPP_3D_MODE_LA)
- && (process_3d_type & MODE_3D_ENABLE))
+ && (input->proc_3d_type & MODE_3D_ENABLE))
vskip_step = 2;
#endif
else
RESTART:
aspect_factor = (vpp_flags & VPP_FLAG_AR_MASK) >> VPP_FLAG_AR_BITS;
+ /* don't use input->wide_mode */
wide_mode = vpp_flags & VPP_FLAG_WIDEMODE_MASK;
/* keep 8 bits resolution for aspect conversion */
aspect_factor = 0x90;
wide_mode = VIDEO_WIDEOPTION_NORMAL;
} else if ((wide_mode >= VIDEO_WIDEOPTION_4_3_IGNORE)
- && (wide_mode <= VIDEO_WIDEOPTION_4_3_COMBINED)) {
+ && (wide_mode <= VIDEO_WIDEOPTION_4_3_COMBINED)) {
if (aspect_factor != 0xc0)
fill_match = false;
orig_aspect = aspect_factor;
screen_aspect = 0xc0;
} else if ((wide_mode >= VIDEO_WIDEOPTION_16_9_IGNORE)
- && (wide_mode <= VIDEO_WIDEOPTION_16_9_COMBINED)) {
+ && (wide_mode <= VIDEO_WIDEOPTION_16_9_COMBINED)) {
if (aspect_factor != 0x90)
fill_match = false;
orig_aspect = aspect_factor;
screen_aspect = 0x90;
} else if (wide_mode == VIDEO_WIDEOPTION_CUSTOM) {
- if (custom_ar != 0)
- aspect_factor = custom_ar & 0x3ff;
+ if (cur_custom_ar != 0)
+ aspect_factor = cur_custom_ar & 0x3ff;
wide_mode = VIDEO_WIDEOPTION_NORMAL;
} else if (wide_mode == VIDEO_WIDEOPTION_AFD) {
if (aspect_factor == 0x90)
width_out * h_in * aspect_ratio_out);
}
- if (osd_layer_preblend)
- aspect_factor = 0x100;
-
height_after_ratio = (h_in * aspect_factor) >> 8;
/*
* it will override the input width_out/height_out for
* ratio calculations, a.k.a we have a window for video content
*/
- if (osd_layer_preblend) {
- if ((osd_layer_width == 0) || (osd_layer_height == 0)) {
- video_top = 0;
- video_left = 0;
- video_width = width_out;
- video_height = height_out;
-
- } else {
- video_top = osd_layer_top;
- video_left = osd_layer_left;
- video_width = osd_layer_width;
- video_height = osd_layer_height;
- }
+ video_top = video_layer_top;
+ video_left = video_layer_left;
+ video_width = video_layer_width;
+ video_height = video_layer_height;
+ if ((video_top == 0) && (video_left == 0) && (video_width <= 1)
+ && (video_height <= 1)) {
+ /* special case to do full screen display */
+ video_width = width_out;
+ video_height = height_out;
} else {
- video_top = video_layer_top;
- video_left = video_layer_left;
- video_width = video_layer_width;
- video_height = video_layer_height;
- if ((video_top == 0) && (video_left == 0) && (video_width <= 1)
- && (video_height <= 1)) {
- /* special case to do full screen display */
+ if ((video_layer_width < 16)
+ && (video_layer_height < 16)) {
+ /*
+ *sanity check to move
+ *video out when the target size is too small
+ */
video_width = width_out;
video_height = height_out;
- } else {
- if ((video_layer_width < 16)
- && (video_layer_height < 16)) {
- /*
- *sanity check to move
- *video out when the target size is too small
- */
- video_width = width_out;
- video_height = height_out;
- video_left = width_out * 2;
- }
- video_top += video_layer_global_offset_y;
- video_left += video_layer_global_offset_x;
+ video_left = width_out * 2;
}
+ video_top += video_layer_global_offset_y;
+ video_left += video_layer_global_offset_x;
}
/*aspect ratio match */
}
ratio_x = screen_ratio_x * w_in / video_width;
- ratio_y =
- screen_ratio_y * h_in / orig_aspect *
+ ratio_y = screen_ratio_y * h_in / orig_aspect *
screen_aspect / video_height;
} else {
screen_width = video_width * vpp_zoom_ratio / 100;
ratio_y = (height_after_ratio << 18) / screen_height;
if (super_debug)
- pr_info("height_after_ratio=%d,%d,%d,%d,%d\n",
- height_after_ratio, ratio_x, ratio_y,
- aspect_factor, wide_mode);
+ pr_info("layer%d: height_after_ratio=%d,%d,%d,%d,%d\n",
+ input->layer_id,
+ height_after_ratio, ratio_x, ratio_y,
+ aspect_factor, wide_mode);
if (wide_mode == VIDEO_WIDEOPTION_NORMAL) {
ratio_x = ratio_y = max(ratio_x, ratio_y);
ini_vphase = vpp_zoom_center_y & 0xff;
/* screen position for source */
-#ifdef TV_REVERSE
- start =
- video_top + (video_height + 1) / 2 - ((h_in << 17) +
- (vpp_zoom_center_y << 10) +
- (ratio_y >> 1)) / ratio_y;
+ start = video_top + (video_height + 1) / 2 -
+ ((h_in << 17) +
+ (vpp_zoom_center_y << 10) +
+ (ratio_y >> 1)) / ratio_y;
end = ((h_in << 18) + (ratio_y >> 1)) / ratio_y + start - 1;
if (super_debug)
- pr_info("top:start =%d,%d,%d,%d %d,%d,%d\n",
- start, end, video_top,
- video_height, h_in, ratio_y, vpp_zoom_center_y);
-#else
- start =
- video_top + video_height / 2 - ((h_in << 17) +
- (vpp_zoom_center_y << 10)) / ratio_y;
- end = (h_in << 18) / ratio_y + start - 1;
- if (super_debug)
- pr_info("top:start =%d,%d,%d,%d %d,%d,%d\n",
+ pr_info("layer%d: top:start =%d,%d,%d,%d %d,%d,%d\n",
+ input->layer_id,
start, end, video_top,
video_height, h_in, ratio_y, vpp_zoom_center_y);
-#endif
#ifdef TV_REVERSE
if (reverse) {
temp = (-start * ratio_y) >> 18;
next_frame_par->VPP_vd_end_lines_ =
h_in - 1 - temp;
-
} else
next_frame_par->VPP_vd_end_lines_ = h_in - 1;
-
} else {
if (start < video_top) {
temp = ((video_top - start) * ratio_y) >> 18;
} else
next_frame_par->VPP_vd_end_lines_ = h_in - 1;
}
- temp =
- next_frame_par->VPP_vd_end_lines_ -
+ temp = next_frame_par->VPP_vd_end_lines_ -
(video_height * ratio_y >> 18);
next_frame_par->VPP_vd_start_lines_ = (temp >= 0) ? temp : 0;
} else
if (start < 0) {
temp = (-start * ratio_y) >> 18;
next_frame_par->VPP_vd_start_lines_ = temp;
-
} else
next_frame_par->VPP_vd_start_lines_ = 0;
temp_height = min((video_top + video_height - 1),
if (start < video_top) {
temp = ((video_top - start) * ratio_y) >> 18;
next_frame_par->VPP_vd_start_lines_ = temp;
-
} else
next_frame_par->VPP_vd_start_lines_ = 0;
temp_height = min((video_top + video_height - 1),
(vinfo->height - 1)) - video_top + 1;
}
-
- temp =
- next_frame_par->VPP_vd_start_lines_ +
+ temp = next_frame_par->VPP_vd_start_lines_ +
(temp_height * ratio_y >> 18);
next_frame_par->VPP_vd_end_lines_ =
(temp <= (h_in - 1)) ? temp : (h_in - 1);
if (start >= end) {
/* nothing to display */
next_frame_par->VPP_vsc_startp = 0;
-
next_frame_par->VPP_vsc_endp = 0;
-
} else {
next_frame_par->VPP_vsc_startp =
- (vpp_flags & VPP_FLAG_INTERLACE_OUT) ? (start >> 1) : start;
-
+ (vpp_flags & VPP_FLAG_INTERLACE_OUT) ?
+ (start >> 1) : start;
next_frame_par->VPP_vsc_endp =
- (vpp_flags & VPP_FLAG_INTERLACE_OUT) ? (end >> 1) : end;
+ (vpp_flags & VPP_FLAG_INTERLACE_OUT) ?
+ (end >> 1) : end;
}
/* set filter co-efficients */
next_frame_par->VPP_hf_ini_phase_ = vpp_zoom_center_x & 0xff;
/* screen position for source */
-#ifdef TV_REVERSE
- start =
- video_left + (video_width + 1) / 2 - ((w_in << 17) +
- (vpp_zoom_center_x << 10) +
- (ratio_x >> 1)) / ratio_x;
+ start = video_left + (video_width + 1) / 2 - ((w_in << 17) +
+ (vpp_zoom_center_x << 10) +
+ (ratio_x >> 1)) / ratio_x;
end = ((w_in << 18) + (ratio_x >> 1)) / ratio_x + start - 1;
if (super_debug)
- pr_info("left:start =%d,%d,%d,%d %d,%d,%d\n",
+ pr_info("layer%d: left:start =%d,%d,%d,%d %d,%d,%d\n",
+ input->layer_id,
start, end, video_left,
video_width, w_in, ratio_x, vpp_zoom_center_x);
-#else
- start =
- video_left + video_width / 2 - ((w_in << 17) +
- (vpp_zoom_center_x << 10)) /
- ratio_x;
- end = (w_in << 18) / ratio_x + start - 1;
- if (super_debug)
- pr_info("left:start =%d,%d,%d,%d %d,%d,%d\n",
- start, end, video_left,
- video_width, w_in, ratio_x, vpp_zoom_center_x);
-#endif
+
/* calculate source horizontal clip */
#ifdef TV_REVERSE
if (reverse) {
temp_width = min((video_left + video_width - 1),
(vinfo->width - 1)) - video_left + 1;
}
- temp =
- next_frame_par->VPP_hd_start_lines_ +
+ temp = next_frame_par->VPP_hd_start_lines_ +
(temp_width * ratio_x >> 18);
next_frame_par->VPP_hd_end_lines_ =
(temp <= (w_in - 1)) ? temp : (w_in - 1);
}
if ((wide_mode == VIDEO_WIDEOPTION_NONLINEAR) && (end > start)) {
- calculate_non_linear_ratio(ratio_x, end - start,
- next_frame_par);
-
+ calculate_non_linear_ratio(
+ nonlinear_factor,
+ ratio_x, end - start,
+ next_frame_par);
next_frame_par->VPP_hsc_linear_startp =
next_frame_par->VPP_hsc_linear_endp = (start + end) / 2;
}
|| !next_frame_par->hscale_skip_count)
&& (!(vpp_flags & VPP_FLAG_VSCALE_DISABLE))) {
int skip = vpp_process_speed_check(
+ input->layer_id,
(next_frame_par->VPP_hd_end_lines_ -
next_frame_par->VPP_hd_start_lines_ + 1) /
(next_frame_par->hscale_skip_count + 1),
next_frame_par->VPP_vsc_startp + 1),
vinfo->height >>
((vpp_flags & VPP_FLAG_INTERLACE_OUT) ? 1 : 0),
+ speed_check_width,
+ speed_check_height,
next_frame_par,
vinfo,
vf);
(vf->canvas0Addr != 0) &&
(next_frame_par->vscale_skip_count > 1) &&
(!next_frame_par->nocomp)) {
- pr_info("Try DW buffer for compressed frame scaling.\n");
+ pr_info(
+ "layer%d: Try DW buffer for compressed frame scaling.\n",
+ input->layer_id);
/* for VIDTYPE_COMPRESS, check if we can use double write
* buffer when primary frame can not be scaled.
h_in = height_in = vf->height;
next_frame_par->hscale_skip_count = 0;
next_frame_par->vscale_skip_count = 0;
-
goto RESTART;
}
/* coeff selection before skip and apply pre_scaler */
filter->vpp_vert_filter =
coeff(vert_coeff_settings,
- filter->vpp_vsc_start_phase_step *
- (next_frame_par->vscale_skip_count + 1),
- 1,
- ((vf->type_original & VIDTYPE_TYPEMASK)
- != VIDTYPE_PROGRESSIVE),
- vf->combing_cur_lev);
+ filter->vpp_vsc_start_phase_step *
+ (next_frame_par->vscale_skip_count + 1),
+ 1,
+ ((vf->type_original & VIDTYPE_TYPEMASK)
+ != VIDTYPE_PROGRESSIVE),
+ vf->combing_cur_lev);
+
filter->vpp_vert_coeff =
filter_table[filter->vpp_vert_filter];
/* when local interlace or AV or ATV */
/* TODO: add 420 check for local */
if (vert_chroma_filter_force_en || (vert_chroma_filter_en
- && (((vf->source_type == VFRAME_SOURCE_TYPE_OTHERS)
- && (((vf->type_original & VIDTYPE_TYPEMASK) != VIDTYPE_PROGRESSIVE) ||
- (vf->height < vert_chroma_filter_limit)))
- || (vf->source_type == VFRAME_SOURCE_TYPE_CVBS)
- || (vf->source_type == VFRAME_SOURCE_TYPE_TUNER)))) {
- cur_vert_chroma_filter
- = chroma_filter_table[filter->vpp_vert_filter];
- filter->vpp_vert_chroma_coeff
- = filter_table[cur_vert_chroma_filter];
+ && (((vf->source_type == VFRAME_SOURCE_TYPE_OTHERS)
+ && (((vf->type_original & VIDTYPE_TYPEMASK)
+ != VIDTYPE_PROGRESSIVE)
+ || (vf->height < vert_chroma_filter_limit)))
+ || (vf->source_type == VFRAME_SOURCE_TYPE_CVBS)
+ || (vf->source_type == VFRAME_SOURCE_TYPE_TUNER)))) {
+ vert_chroma_filter =
+ chroma_filter_table[filter->vpp_vert_filter];
+ filter->vpp_vert_chroma_coeff =
+ filter_table[vert_chroma_filter];
filter->vpp_vert_chroma_filter_en = true;
} else {
- cur_vert_chroma_filter = COEF_NULL;
+ vert_chroma_filter = COEF_NULL;
filter->vpp_vert_chroma_filter_en = false;
}
+
/* avoid hscaler fitler adjustion affect on picture shift*/
filter->vpp_horz_filter =
coeff(horz_coeff_settings,
- filter->vpp_hf_start_phase_step,
- next_frame_par->VPP_hf_ini_phase_,
- ((vf->type_original & VIDTYPE_TYPEMASK)
- != VIDTYPE_PROGRESSIVE),
- vf->combing_cur_lev);
+ filter->vpp_hf_start_phase_step,
+ next_frame_par->VPP_hf_ini_phase_,
+ ((vf->type_original & VIDTYPE_TYPEMASK)
+ != VIDTYPE_PROGRESSIVE),
+ vf->combing_cur_lev);
/*for gxl cvbs out index*/
if ((vinfo->mode == VMODE_CVBS) && //DEBUG_TMP
(filter->vpp_hf_start_phase_step == (1 << 24)))
filter->vpp_vsc_start_phase_step >>= 1;
ratio_y >>= 1;
f2v_get_vertical_phase(ratio_y, ini_vphase,
- next_frame_par->VPP_vf_ini_phase_,
- vpp_flags & VPP_FLAG_INTERLACE_OUT);
-
+ next_frame_par->VPP_vf_ini_phase_,
+ vpp_flags & VPP_FLAG_INTERLACE_OUT);
} else
filter->vpp_pre_vsc_en = 0;
filter->vpp_vert_filter = vert_scaler_filter;
}
if (vert_chroma_filter_force_en &&
- vert_chroma_scaler_filter <= COEF_3D_FILTER) {
- cur_vert_chroma_filter = vert_chroma_scaler_filter;
- filter->vpp_vert_chroma_coeff
- = filter_table[cur_vert_chroma_filter];
- filter->vpp_vert_chroma_filter_en = true;
+ (vert_chroma_scaler_filter <= COEF_3D_FILTER)) {
+ vert_chroma_filter = vert_chroma_scaler_filter;
+ filter->vpp_vert_chroma_coeff =
+ filter_table[vert_chroma_filter];
+ filter->vpp_vert_chroma_filter_en = true;
} else {
- cur_vert_chroma_filter = COEF_NULL;
+ vert_chroma_filter = COEF_NULL;
filter->vpp_vert_chroma_filter_en = false;
}
filter->vpp_horz_filter = horz_scaler_filter;
}
-#ifdef TV_3D_FUNCTION_OPEN
+#ifdef TV_3D_FUNCTION_OPEN
/* final stage for 3D filter overwrite */
if ((next_frame_par->vpp_3d_scale) && force_filter_mode) {
filter->vpp_vert_coeff = filter_table[COEF_3D_FILTER];
filter->vpp_vert_filter = COEF_3D_FILTER;
}
#endif
- if ((last_vert_filter != filter->vpp_vert_filter) ||
- (last_horz_filter != filter->vpp_horz_filter)) {
- last_vert_filter = filter->vpp_vert_filter;
- last_horz_filter = filter->vpp_horz_filter;
- scaler_filter_cnt = 0;
- } else {
- scaler_filter_cnt++;
- }
- if ((scaler_filter_cnt >= scaler_filter_cnt_limit) &&
- ((cur_vert_filter != filter->vpp_vert_filter) ||
- (cur_horz_filter != filter->vpp_horz_filter))) {
- video_property_notify(1);
- cur_vert_filter = filter->vpp_vert_filter;
- cur_horz_filter = filter->vpp_horz_filter;
- scaler_filter_cnt = scaler_filter_cnt_limit;
- }
- cur_skip_line = next_frame_par->vscale_skip_count;
-
-#if HAS_VPU_PROT
- if (has_vpu_prot()) {
- if (get_prot_status()) {
- s32 tmp_height =
- (((s32) next_frame_par->VPP_vd_end_lines_ +
- 1) << 18) / tmp_ratio_y;
- s32 tmp_top = 0;
- s32 tmp_bottom = 0;
-
-/* pr_info("height_out %d video_height %d\n", height_out, video_height); */
-/* pr_info("vf1 %d %d %d %d vs %d %d\n", next_frame_par->VPP_hd_start_lines_,*/
-/* next_frame_par->VPP_hd_end_lines_, */
-/* next_frame_par->VPP_vd_start_lines_, next_frame_par->VPP_vd_end_lines_, */
-/* next_frame_par->hscale_skip_count, next_frame_par->vscale_skip_count); */
- if ((s32) video_height > tmp_height) {
- tmp_top = (s32) video_top +
- (((s32) video_height - tmp_height) >> 1);
- } else
- tmp_top = (s32) video_top;
- tmp_bottom = tmp_top +
- (((s32) next_frame_par->VPP_vd_end_lines_ + 1) << 18) /
- (s32) tmp_ratio_y;
- if (tmp_bottom > (s32) height_out
- && tmp_top < (s32) height_out) {
- s32 tmp_end =
- (s32) next_frame_par->VPP_vd_end_lines_ -
- ((tmp_bottom -
- (s32) height_out) *
- (s32) tmp_ratio_y >> 18);
- if (tmp_end <
- (s32) next_frame_par->VPP_vd_end_lines_) {
- next_frame_par->VPP_vd_end_lines_ =
- tmp_end;
- }
- } else if (tmp_bottom > (s32) height_out
- && tmp_top >= (s32) height_out)
- next_frame_par->VPP_vd_end_lines_ = 1;
- next_frame_par->VPP_vd_end_lines_ =
- next_frame_par->VPP_vd_end_lines_ -
- h_in / height_out;
- if ((s32) next_frame_par->VPP_vd_end_lines_ <
- (s32) next_frame_par->VPP_vd_start_lines_) {
- next_frame_par->VPP_vd_end_lines_ =
- next_frame_par->VPP_vd_start_lines_;
- }
- if ((s32) next_frame_par->VPP_hd_end_lines_ <
- (s32) next_frame_par->VPP_hd_start_lines_) {
- next_frame_par->VPP_hd_end_lines_ =
- next_frame_par->VPP_hd_start_lines_;
- }
-/* pr_info("tmp_top %d tmp_bottom %d tmp_height %d\n",*/
-/* tmp_top, tmp_bottom, tmp_height); */
-/* pr_info("vf2 %d %d %d %d\n", next_frame_par->VPP_hd_start_lines_,*/
-/* next_frame_par->VPP_hd_end_lines_, */
-/* next_frame_par->VPP_vd_start_lines_, next_frame_par->VPP_vd_end_lines_); */
- }
- }
-#endif
+ if ((cur_filter->last_vert_filter != filter->vpp_vert_filter) ||
+ (cur_filter->last_horz_filter != filter->vpp_horz_filter)) {
+ cur_filter->last_vert_filter = filter->vpp_vert_filter;
+ cur_filter->last_horz_filter = filter->vpp_horz_filter;
+ cur_filter->scaler_filter_cnt = 0;
+ } else {
+ cur_filter->scaler_filter_cnt++;
+ }
+ if ((cur_filter->scaler_filter_cnt >=
+ scaler_filter_cnt_limit) &&
+ ((cur_filter->cur_vert_filter !=
+ filter->vpp_vert_filter) ||
+ (cur_filter->cur_horz_filter !=
+ filter->vpp_horz_filter))) {
+ cur_filter->cur_vert_filter = filter->vpp_vert_filter;
+ cur_filter->cur_horz_filter = filter->vpp_horz_filter;
+ cur_filter->scaler_filter_cnt = scaler_filter_cnt_limit;
+ ret = VppFilter_Success_and_Changed;
+ }
+
+ /* store the debug info for legacy */
+ if (input->layer_id == 0) {
+ cur_vert_filter = cur_filter->cur_vert_filter;
+ cur_horz_filter = cur_filter->cur_horz_filter;
+ cur_vert_chroma_filter = vert_chroma_filter;
+ cur_skip_line =
+ next_frame_par->vscale_skip_count;
+ }
+
+ return ret;
}
/*
*VPP_SRSHARP0_CTRL:0x1d91
*[1]if sharpness is enable or vscaler is enable,must set to 1,
*sharpness1;reg can only to be w on gxtvbb;which is fix after txl
*/
-int vpp_set_super_scaler_regs(int scaler_path_sel,
- int reg_srscl0_enable,
- int reg_srscl0_hsize,
- int reg_srscl0_vsize,
- int reg_srscl0_hori_ratio,
- int reg_srscl0_vert_ratio,
- int reg_srscl1_enable,
- int reg_srscl1_hsize,
- int reg_srscl1_vsize,
- int reg_srscl1_hori_ratio,
- int reg_srscl1_vert_ratio,
- int vpp_postblend_out_width,
- int vpp_postblend_out_height)
+int vpp_set_super_scaler_regs(
+ int scaler_path_sel,
+ int reg_srscl0_enable,
+ int reg_srscl0_hsize,
+ int reg_srscl0_vsize,
+ int reg_srscl0_hori_ratio,
+ int reg_srscl0_vert_ratio,
+ int reg_srscl1_enable,
+ int reg_srscl1_hsize,
+ int reg_srscl1_vsize,
+ int reg_srscl1_hori_ratio,
+ int reg_srscl1_vert_ratio,
+ int vpp_postblend_out_width,
+ int vpp_postblend_out_height)
{
int tmp_data = 0;
tmp_data = VSYNC_RD_MPEG_REG(VPP_SRSHARP0_CTRL);
if (sr0_sr1_refresh) {
if (reg_srscl0_hsize > SUPER_CORE0_WIDTH_MAX) {
- if (((tmp_data >> 1)&0x1) != 0)
+ if (((tmp_data >> 1) & 0x1) != 0)
VSYNC_WR_MPEG_REG_BITS(VPP_SRSHARP0_CTRL,
0, 1, 1);
} else {
- if (((tmp_data >> 1)&0x1) != 1)
+ if (((tmp_data >> 1) & 0x1) != 1)
VSYNC_WR_MPEG_REG_BITS(VPP_SRSHARP0_CTRL,
1, 1, 1);
}
- if ((tmp_data&0x1) != 1)
+ if ((tmp_data & 0x1) != 1)
VSYNC_WR_MPEG_REG_BITS(VPP_SRSHARP0_CTRL, 1, 0, 1);
}
tmp_data = VSYNC_RD_MPEG_REG(VPP_SRSHARP1_CTRL);
if (sr0_sr1_refresh) {
- if (((tmp_data >> 1)&0x1) != 1)
+ if (((tmp_data >> 1) & 0x1) != 1)
VSYNC_WR_MPEG_REG_BITS(VPP_SRSHARP1_CTRL, 1, 1, 1);
- if ((tmp_data&0x1) != 1)
+ if ((tmp_data & 0x1) != 1)
VSYNC_WR_MPEG_REG_BITS(VPP_SRSHARP1_CTRL, 1, 0, 1);
}
/* core0 config */
tmp_data = VSYNC_RD_MPEG_REG(
SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt);
if (sr0_sr1_refresh) {
- if (((tmp_data >> 5)&0x1) != (reg_srscl0_vert_ratio&0x1))
+ if (((tmp_data >> 5) & 0x1) != (reg_srscl0_vert_ratio&0x1))
VSYNC_WR_MPEG_REG_BITS(
SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,
reg_srscl0_vert_ratio&0x1, 5, 1);
- if (((tmp_data >> 4)&0x1) != (reg_srscl0_hori_ratio&0x1))
+ if (((tmp_data >> 4) & 0x1) != (reg_srscl0_hori_ratio&0x1))
VSYNC_WR_MPEG_REG_BITS(
SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,
reg_srscl0_hori_ratio&0x1, 4, 1);
if (reg_srscl0_hsize > SUPER_CORE0_WIDTH_MAX) {
- if (((tmp_data >> 2)&0x1) != 0)
+ if (((tmp_data >> 2) & 0x1) != 0)
VSYNC_WR_MPEG_REG_BITS(
SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,
0, 2, 1);
} else {
- if (((tmp_data >> 2)&0x1) != 1)
+ if (((tmp_data >> 2) & 0x1) != 1)
VSYNC_WR_MPEG_REG_BITS(
SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,
1, 2, 1);
}
- if ((tmp_data & 0x1) == (reg_srscl0_hori_ratio&0x1))
+ if ((tmp_data & 0x1) == (reg_srscl0_hori_ratio & 0x1))
VSYNC_WR_MPEG_REG_BITS(
SRSHARP0_SHARP_SR2_CTRL + sr_reg_offt,
- ((~(reg_srscl0_hori_ratio&0x1))&0x1), 0, 1);
+ ((~(reg_srscl0_hori_ratio & 0x1)) & 0x1), 0, 1);
}
/* core1 config */
if (sr_support & SUPER_CORE1_SUPPORT) {
- if (is_meson_gxtvbb_cpu())
- tmp_data = sharpness1_sr2_ctrl_32d7;
- else
- tmp_data = VSYNC_RD_MPEG_REG(
- SRSHARP1_SHARP_SR2_CTRL + sr_reg_offt2);/*0xc80*/
- if (is_meson_gxtvbb_cpu() ||
- (((tmp_data >> 5)&0x1) != (reg_srscl1_vert_ratio&0x1)) ||
- (((tmp_data >> 4)&0x1) != (reg_srscl1_hori_ratio&0x1)) ||
- ((tmp_data & 0x1) == (reg_srscl1_hori_ratio&0x1)) ||
- (((tmp_data >> 2)&0x1) != 1)) {
- tmp_data = tmp_data & (~(1 << 5));
- tmp_data = tmp_data & (~(1 << 4));
- tmp_data = tmp_data & (~(1 << 2));
- tmp_data = tmp_data & (~(1 << 0));
- tmp_data |= ((reg_srscl1_vert_ratio&0x1) << 5);
- tmp_data |= ((reg_srscl1_hori_ratio&0x1) << 4);
- tmp_data |= (1 << 2);
- tmp_data |= (((~(reg_srscl1_hori_ratio&0x1))&0x1) << 0);
- if (sr0_sr1_refresh) {
- VSYNC_WR_MPEG_REG(
- SRSHARP1_SHARP_SR2_CTRL + sr_reg_offt2,/*0xc80*/
- tmp_data);
- sharpness1_sr2_ctrl_32d7 = tmp_data;
+ if (is_meson_gxtvbb_cpu())
+ tmp_data = sharpness1_sr2_ctrl_32d7;
+ else
+ tmp_data = VSYNC_RD_MPEG_REG(
+ SRSHARP1_SHARP_SR2_CTRL
+ + sr_reg_offt2); /*0xc80*/
+ if (is_meson_gxtvbb_cpu() ||
+ (((tmp_data >> 5) & 0x1) !=
+ (reg_srscl1_vert_ratio & 0x1)) ||
+ (((tmp_data >> 4) & 0x1) !=
+ (reg_srscl1_hori_ratio & 0x1)) ||
+ ((tmp_data & 0x1) ==
+ (reg_srscl1_hori_ratio & 0x1)) ||
+ (((tmp_data >> 2) & 0x1) != 1)) {
+ tmp_data = tmp_data & (~(1 << 5));
+ tmp_data = tmp_data & (~(1 << 4));
+ tmp_data = tmp_data & (~(1 << 2));
+ tmp_data = tmp_data & (~(1 << 0));
+ tmp_data |= ((reg_srscl1_vert_ratio & 0x1) << 5);
+ tmp_data |= ((reg_srscl1_hori_ratio & 0x1) << 4);
+ tmp_data |= (1 << 2);
+ tmp_data |=
+ (((~(reg_srscl1_hori_ratio & 0x1)) & 0x1) << 0);
+ if (sr0_sr1_refresh) {
+ VSYNC_WR_MPEG_REG(
+ SRSHARP1_SHARP_SR2_CTRL
+ + sr_reg_offt2, /*0xc80*/
+ tmp_data);
+ sharpness1_sr2_ctrl_32d7 = tmp_data;
+ }
}
}
- }
/* size config */
tmp_data = ((reg_srscl0_hsize & 0x1fff) << 16) |
- (reg_srscl0_vsize & 0x1fff);
+ (reg_srscl0_vsize & 0x1fff);
tmp_data2 = VSYNC_RD_MPEG_REG(
SRSHARP0_SHARP_HVSIZE + sr_reg_offt);
if (tmp_data != tmp_data2)
- VSYNC_WR_MPEG_REG(SRSHARP0_SHARP_HVSIZE + sr_reg_offt,
- tmp_data);
+ VSYNC_WR_MPEG_REG(
+ SRSHARP0_SHARP_HVSIZE + sr_reg_offt,
+ tmp_data);
tmp_data = ((reg_srscl1_hsize & 0x1fff) << 16) |
- (reg_srscl1_vsize & 0x1fff);
+ (reg_srscl1_vsize & 0x1fff);
if (sr_support & SUPER_CORE1_SUPPORT) {
if (get_cpu_type() != MESON_CPU_MAJOR_ID_GXTVBB)
return 0;
}
-static void vpp_set_super_scaler(const struct vinfo_s *vinfo,
- struct vpp_frame_par_s *next_frame_par,
- bool bypass_sr0, bool bypass_sr1)
+static void vpp_set_super_scaler(
+ u32 vpp_wide_mode,
+ const struct vinfo_s *vinfo,
+ struct vpp_frame_par_s *next_frame_par,
+ bool bypass_sr0, bool bypass_sr1)
{
unsigned int hor_sc_multiple_num, ver_sc_multiple_num, temp;
u32 width_out = next_frame_par->VPP_hsc_endp -
/* step1: judge core0&core1 vertical enable or disable*/
if (ver_sc_multiple_num >= 2*SUPER_SCALER_V_FACTOR) {
next_frame_par->supsc0_vert_ratio =
- ((src_width < SUPER_CORE0_WIDTH_MAX/2) &&
+ ((src_width < SUPER_CORE0_WIDTH_MAX / 2) &&
(sr_support & SUPER_CORE0_SUPPORT)) ? 1 : 0;
next_frame_par->supsc1_vert_ratio =
((width_out < SUPER_CORE1_WIDTH_MAX) &&
- (src_width < SUPER_CORE1_WIDTH_MAX/2) &&
+ (src_width < SUPER_CORE1_WIDTH_MAX / 2) &&
(sr_support & SUPER_CORE1_SUPPORT)) ? 1 : 0;
if (next_frame_par->supsc0_vert_ratio &&
- (ver_sc_multiple_num < 4*SUPER_SCALER_V_FACTOR))
+ (ver_sc_multiple_num < 4 * SUPER_SCALER_V_FACTOR))
next_frame_par->supsc1_vert_ratio = 0;
next_frame_par->supsc0_enable =
next_frame_par->supsc0_vert_ratio ? 1 : 0;
if ((hor_sc_multiple_num >= 2) &&
(vpp_wide_mode != VIDEO_WIDEOPTION_NONLINEAR)) {
if ((src_width > SUPER_CORE0_WIDTH_MAX) ||
- ((src_width > SUPER_CORE0_WIDTH_MAX/2) &&
+ ((src_width > SUPER_CORE0_WIDTH_MAX / 2) &&
next_frame_par->supsc0_vert_ratio) ||
- (((src_width << 1) > SUPER_CORE1_WIDTH_MAX/2) &&
+ (((src_width << 1) > SUPER_CORE1_WIDTH_MAX / 2) &&
next_frame_par->supsc1_vert_ratio))
next_frame_par->supsc0_hori_ratio = 0;
else if (sr_support & SUPER_CORE0_SUPPORT)
next_frame_par->supsc0_hori_ratio = 1;
if (((width_out >> 1) > SUPER_CORE1_WIDTH_MAX) ||
- (((width_out >> 1) > SUPER_CORE1_WIDTH_MAX/2) &&
+ (((width_out >> 1) > SUPER_CORE1_WIDTH_MAX / 2) &&
next_frame_par->supsc1_vert_ratio) ||
(next_frame_par->supsc0_hori_ratio &&
(hor_sc_multiple_num < 4)))
}
/* option add patch */
if ((ver_sc_multiple_num <= super_scaler_v_ratio) &&
- (src_height >= SUPER_CORE0_WIDTH_MAX/2) &&
+ (src_height >= SUPER_CORE0_WIDTH_MAX / 2) &&
(src_height <= 1088) &&
(ver_sc_multiple_num > SUPER_SCALER_V_FACTOR) &&
(vinfo->height >= 2000)) {
width_out >> next_frame_par->supsc0_hori_ratio;
} else if ((next_frame_par->supscl_path == PPS_CORE0_CORE1)
|| (next_frame_par->supscl_path ==
- PPS_CORE0_POSTBLEND_CORE1)){/*tl1*/
+ PPS_CORE0_POSTBLEND_CORE1)){ /*tl1*/
next_frame_par->spsc0_h_in =
(height_out >> next_frame_par->supsc0_vert_ratio) >>
next_frame_par->supsc1_vert_ratio;
next_frame_par->supsc1_vert_ratio;
}
if (super_debug) {
- pr_info("spsc0_w_in=%u, spsc0_h_in=%u, spsc1_w_in=%u, spsc1_h_in=%u.\n",
+ pr_info("layer0: spsc0_w_in=%u, spsc0_h_in=%u, spsc1_w_in=%u, spsc1_h_in=%u.\n",
next_frame_par->spsc0_w_in, next_frame_par->spsc0_h_in,
next_frame_par->spsc1_w_in, next_frame_par->spsc1_h_in);
- pr_info("supsc0_hori=%d,supsc1_hori=%d,supsc0_v=%d,supsc1_v=%d\n",
+ pr_info("layer0: supsc0_hori=%d,supsc1_hori=%d,supsc0_v=%d,supsc1_v=%d\n",
next_frame_par->supsc0_hori_ratio,
next_frame_par->supsc1_hori_ratio,
next_frame_par->supsc0_vert_ratio,
next_frame_par->supsc1_vert_ratio);
- pr_info("VPP_hd_start_lines= %d,%d,%d,%d, %d,%d,%d,%d, %d,%d\n",
+ pr_info("layer0: VPP_hd_start_lines= %d,%d,%d,%d, %d,%d,%d,%d, %d,%d\n",
next_frame_par->VPP_hd_start_lines_,
next_frame_par->VPP_hd_end_lines_,
next_frame_par->VPP_vd_start_lines_,
next_frame_par->VPP_vsc_endp);
}
}
+
#ifdef TV_3D_FUNCTION_OPEN
-void get_vpp_3d_mode(u32 process_3d_type, u32 trans_fmt, u32 *vpp_3d_mode)
+void get_vpp_3d_mode(
+ u32 process_3d_type, u32 trans_fmt, u32 *vpp_3d_mode)
{
switch (trans_fmt) {
case TVIN_TFMT_3D_LRH_OLOR:
break;
}
}
-static void
-vpp_get_video_source_size(u32 *src_width, u32 *src_height,
+
+static void vpp_get_video_source_size(
+ u32 *src_width, u32 *src_height,
u32 process_3d_type, struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par)
{
if ((process_3d_type & MODE_3D_AUTO) ||
- (((process_3d_type & MODE_3D_TO_2D_R) ||
- (process_3d_type & MODE_3D_TO_2D_L) ||
- (process_3d_type & MODE_3D_LR_SWITCH) ||
- (process_3d_type & MODE_FORCE_3D_TO_2D_TB) ||
- (process_3d_type & MODE_FORCE_3D_TO_2D_LR)) &&
- (process_3d_type & MODE_3D_ENABLE))) {
+ (((process_3d_type & MODE_3D_TO_2D_R) ||
+ (process_3d_type & MODE_3D_TO_2D_L) ||
+ (process_3d_type & MODE_3D_LR_SWITCH) ||
+ (process_3d_type & MODE_FORCE_3D_TO_2D_TB) ||
+ (process_3d_type & MODE_FORCE_3D_TO_2D_LR)) &&
+ (process_3d_type & MODE_3D_ENABLE))) {
if (vf->trans_fmt) {
if (process_3d_type & MODE_3D_TO_2D_MASK)
*src_height = vf->left_eye.height;
}
} else if ((process_3d_type & MODE_3D_LR) ||
- (process_3d_type & MODE_FORCE_3D_LR)) {
+ (process_3d_type & MODE_FORCE_3D_LR)) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_LR;
if (process_3d_type & MODE_3D_TO_2D_MASK) {
*src_width = vf->width >> 1;
}
} else if ((process_3d_type & MODE_3D_TB) ||
- (process_3d_type & MODE_FORCE_3D_TB)) {
+ (process_3d_type & MODE_FORCE_3D_TB)) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_TB;
if (process_3d_type & MODE_3D_TO_2D_MASK) {
*src_width = vf->width;
next_frame_par->vpp_3d_scale = 0;
}
} else if ((process_3d_type & MODE_3D_FA)
- || (process_3d_type & MODE_FORCE_3D_FA_LR)
- || (process_3d_type & MODE_FORCE_3D_FA_TB)) {
+ || (process_3d_type & MODE_FORCE_3D_FA_LR)
+ || (process_3d_type & MODE_FORCE_3D_FA_TB)) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_FA;
if (process_3d_type & MODE_3D_TO_2D_MASK) {
-
if (process_3d_type & MODE_FORCE_3D_FA_TB) {
next_frame_par->vpp_3d_mode = VPP_3D_MODE_TB;
*src_width = vf->width;
}
}
#endif
-void
-vpp_set_filters(u32 process_3d_type, u32 wide_mode,
- struct vframe_s *vf,
- struct vpp_frame_par_s *next_frame_par,
+
+static int vpp_set_filters_no_scaler_internal(
+ struct disp_info_s *input,
+ u32 width_in,
+ u32 height_in,
+ u32 wid_out,
+ u32 hei_out,
const struct vinfo_s *vinfo,
- bool bypass_sr)
+ u32 vpp_flags,
+ struct vpp_frame_par_s *next_frame_par, struct vframe_s *vf)
{
- u32 src_width = 0;
- u32 src_height = 0;
- u32 vpp_flags = 0;
- u32 aspect_ratio = 0;
-
- WARN_ON(vinfo == NULL);
-
- next_frame_par->VPP_post_blend_vd_v_start_ = 0;
- next_frame_par->VPP_post_blend_vd_h_start_ = 0;
-
- next_frame_par->VPP_postproc_misc_ = 0x200;
-#ifdef TV_3D_FUNCTION_OPEN
- next_frame_par->vscale_skip_count = 0;
- next_frame_par->hscale_skip_count = 0;
- /*
- *check 3d mode change in display buffer or 3d type
- *get the source size according to 3d mode
- */
- if (process_3d_type & MODE_3D_ENABLE) {
- vpp_get_video_source_size(&src_width, &src_height,
- process_3d_type, vf, next_frame_par);
- } else {
- if (vf->type & VIDTYPE_COMPRESS) {
- src_width = vf->compWidth;
- src_height = vf->compHeight;
- } else {
- src_width = vf->width;
- src_height = vf->height;
- }
- next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
- next_frame_par->vpp_2pic_mode = 0;
- next_frame_par->vpp_3d_scale = 0;
- }
- next_frame_par->trans_fmt = vf->trans_fmt;
- get_vpp_3d_mode(process_3d_type, next_frame_par->trans_fmt,
- &next_frame_par->vpp_3d_mode);
- if (vpp_3d_scale)
- next_frame_par->vpp_3d_scale = 1;
- amlog_mask(LOG_MASK_VPP, "%s: src_width %u,src_height %u.\n", __func__,
- src_width, src_height);
+ s32 start, end;
+ s32 video_top, video_left, temp;
+ u32 video_width, video_height;
+ u32 ratio_x = 0;
+ u32 ratio_y = 0;
+ u32 ratio_tmp = 0;
+ int temp_width;
+ int temp_height;
+ struct vppfilter_mode_s *filter = &next_frame_par->vpp_filter;
+ u32 wide_mode;
+ s32 height_shift = 0;
+ u32 w_in = width_in;
+ u32 h_in = height_in;
+ bool h_crop_enable = false, v_crop_enable = false;
+ bool skip_policy_check = true;
+ u32 vskip_step;
+ s32 video_layer_global_offset_x, video_layer_global_offset_y;
+ u32 video_source_crop_top, video_source_crop_left;
+ u32 video_source_crop_bottom, video_source_crop_right;
+ s32 video_layer_top, video_layer_left;
+ s32 video_layer_width, video_layer_height;
+#ifdef TV_REVERSE
+ bool reverse = false;
#endif
- /* check force ratio change flag in display buffer also
- * if it exist then it will override the settings in display side
- */
- if (vf->ratio_control & DISP_RATIO_FORCECONFIG) {
- if ((vf->ratio_control & DISP_RATIO_CTRL_MASK) ==
- DISP_RATIO_KEEPRATIO) {
- if (wide_mode == VIDEO_WIDEOPTION_FULL_STRETCH)
- wide_mode = VIDEO_WIDEOPTION_NORMAL;
- } else {
- if (wide_mode == VIDEO_WIDEOPTION_NORMAL)
- wide_mode = VIDEO_WIDEOPTION_FULL_STRETCH;
- }
- if (vf->ratio_control & DISP_RATIO_FORCE_NORMALWIDE)
- wide_mode = VIDEO_WIDEOPTION_NORMAL;
- else if (vf->ratio_control & DISP_RATIO_FORCE_FULL_STRETCH)
- wide_mode = VIDEO_WIDEOPTION_FULL_STRETCH;
- }
-
- aspect_ratio = (vf->ratio_control & DISP_RATIO_ASPECT_RATIO_MASK)
- >> DISP_RATIO_ASPECT_RATIO_BIT;
+ int ret = VppFilter_Success;
- if (vf->type & VIDTYPE_INTERLACE)
- vpp_flags = VPP_FLAG_INTERLACE_IN;
+ if (!input)
+ return VppFilter_Fail;
- if (vf->ratio_control & DISP_RATIO_PORTRAIT_MODE)
- vpp_flags |= VPP_FLAG_PORTRAIT_MODE;
+ video_layer_global_offset_x = input->global_offset_x;
+ video_layer_global_offset_y = input->global_offset_y;
- 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;
- }
+ video_layer_top = input->layer_top;
+ video_layer_left = input->layer_left;
+ video_layer_width = input->layer_width;
+ video_layer_height = input->layer_height;
+#ifdef TV_REVERSE
+ reverse = input->reverse;
#endif
+
if (vf->type & VIDTYPE_MVC) {
- video_source_crop_top = 0;
video_source_crop_left = 0;
- video_source_crop_bottom = 0;
video_source_crop_right = 0;
+ video_source_crop_top = 0;
+ video_source_crop_bottom = 0;
} else {
- video_source_crop_top = video_crop_top_resv;
- video_source_crop_left = video_crop_left_resv;
- video_source_crop_bottom = video_crop_bottom_resv;
- video_source_crop_right = video_crop_right_resv;
+ video_source_crop_left = input->crop_left;
+ video_source_crop_right = input->crop_right;
+ video_source_crop_top = input->crop_top;
+ video_source_crop_bottom = input->crop_bottom;
}
- 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->pic_mode.provider == PIC_MODE_PROVIDER_WSS) {
- /* from wss, need add global setting */
- video_source_crop_top += vf->pic_mode.vs;
- video_source_crop_left += vf->pic_mode.hs;
- video_source_crop_bottom += vf->pic_mode.ve;
- video_source_crop_right += vf->pic_mode.he;
- } else {
- /* from PQ database, final setting */
- video_source_crop_top = vf->pic_mode.vs;
- video_source_crop_left = vf->pic_mode.hs;
- video_source_crop_bottom = vf->pic_mode.ve;
- video_source_crop_right = vf->pic_mode.he;
- }
- if (vf->pic_mode.AFD_enable
- && (vf->ratio_control & DISP_RATIO_INFOFRAME_AVAIL))
- wide_mode = VIDEO_WIDEOPTION_AFD;
- if (wide_mode == VIDEO_WIDEOPTION_CUSTOM)
- custom_ar = vf->pic_mode.custom_ar;
+ if (likely(w_in >
+ (video_source_crop_left + video_source_crop_right))) {
+ w_in -= video_source_crop_left;
+ w_in -= video_source_crop_right;
+ h_crop_enable = true;
}
- vpp_wide_mode = wide_mode;
- vpp_flags |= wide_mode | (aspect_ratio << VPP_FLAG_AR_BITS);
-
- if (vinfo->field_height != vinfo->height)
- vpp_flags |= VPP_FLAG_INTERLACE_OUT;
- next_frame_par->VPP_post_blend_vd_v_end_ = vinfo->field_height - 1;
- next_frame_par->VPP_post_blend_vd_h_end_ = vinfo->width - 1;
- next_frame_par->VPP_post_blend_h_size_ = vinfo->width;
- vpp_set_filters2(process_3d_type, src_width, src_height,
- vinfo->width, vinfo->height,
- vinfo, vpp_flags, next_frame_par, vf);
- /*config super scaler after set next_frame_par is calc ok for pps*/
- vpp_set_super_scaler(vinfo, next_frame_par,
- (bypass_sr | bypass_spscl0),
- (bypass_sr | bypass_spscl1));
-}
+ if (likely(h_in >
+ (video_source_crop_top + video_source_crop_bottom))) {
+ h_in -= video_source_crop_top;
+ h_in -= video_source_crop_bottom;
+ v_crop_enable = true;
+ }
-void prot_get_parameter(u32 wide_mode,
- struct vframe_s *vf,
- struct vpp_frame_par_s *next_frame_par,
- const struct vinfo_s *vinfo)
-{
- u32 src_width = 0;
- u32 src_height = 0;
- u32 vpp_flags = 0;
- u32 aspect_ratio = 0;
- u32 process_3d_type = VPP_3D_MODE_NULL;
+ next_frame_par->vscale_skip_count = 0;
+ next_frame_par->hscale_skip_count = 0;
+ next_frame_par->nocomp = false;
+ if (vpp_flags & VPP_FLAG_INTERLACE_IN)
+ next_frame_par->vscale_skip_count++;
+ if (vpp_flags & VPP_FLAG_INTERLACE_OUT)
+ height_shift++;
- WARN_ON(vinfo == NULL);
+ if (vpp_flags & VPP_FLAG_INTERLACE_IN)
+ vskip_step = 2;
+ else
+ vskip_step = 1;
- next_frame_par->VPP_post_blend_vd_v_start_ = 0;
- next_frame_par->VPP_post_blend_vd_h_start_ = 0;
+RESTART:
+ /* don't use input->wide_mode */
+ wide_mode = vpp_flags & VPP_FLAG_WIDEMODE_MASK;
- next_frame_par->VPP_postproc_misc_ = 0x200;
+ /*
+ *if we have ever set a cropped display area for video layer
+ * (by checking video_layer_width/video_height), then
+ * it will override the input width_out/height_out for
+ * ratio calculations, a.k.a we have a window for video content
+ */
+ video_top = video_layer_top;
+ video_left = video_layer_left;
+ video_width = video_layer_width;
+ video_height = video_layer_height;
+ if ((video_top == 0) && (video_left == 0) && (video_width <= 1)
+ && (video_height <= 1)) {
+ /* special case to do full screen display */
+ video_width = video_layer_width;
+ video_height = video_layer_height;
+ } else {
+ video_top += video_layer_global_offset_y;
+ video_left += video_layer_global_offset_x;
+ }
+
+ ratio_x = (1 << 18);
+ ratio_y = (1 << 18);
+
+ /* screen position for source */
+ start = video_top + (video_height + 1) / 2 -
+ ((h_in << 17) +
+ (ratio_y >> 1)) / ratio_y;
+ end = ((h_in << 18) + (ratio_y >> 1)) / ratio_y + start - 1;
+ if (super_debug)
+ pr_info("layer%d: top:start =%d,%d,%d,%d %d,%d\n",
+ input->layer_id,
+ start, end, video_top,
+ video_height, h_in, ratio_y);
+
+#ifdef TV_REVERSE
+ if (reverse) {
+ /* calculate source vertical clip */
+ if (video_top < 0) {
+ if (start < 0) {
+ temp = (-start * ratio_y) >> 18;
+ next_frame_par->VPP_vd_end_lines_ =
+ h_in - 1 - temp;
+ } else
+ next_frame_par->VPP_vd_end_lines_ = h_in - 1;
+ } else {
+ if (start < video_top) {
+ temp = ((video_top - start) * ratio_y) >> 18;
+ next_frame_par->VPP_vd_end_lines_ =
+ h_in - 1 - temp;
+ } else
+ next_frame_par->VPP_vd_end_lines_ = h_in - 1;
+ }
+ temp = next_frame_par->VPP_vd_end_lines_ -
+ (video_height * ratio_y >> 18);
+ next_frame_par->VPP_vd_start_lines_ = (temp >= 0) ? temp : 0;
+ } else
+#endif
+ {
+ if (video_top < 0) {
+ if (start < 0) {
+ temp = (-start * ratio_y) >> 18;
+ next_frame_par->VPP_vd_start_lines_ = temp;
+ } else
+ next_frame_par->VPP_vd_start_lines_ = 0;
+ temp_height = min((video_top + video_height - 1),
+ (vinfo->height - 1));
+ } else {
+ if (start < video_top) {
+ temp = ((video_top - start) * ratio_y) >> 18;
+ next_frame_par->VPP_vd_start_lines_ = temp;
+ } else
+ next_frame_par->VPP_vd_start_lines_ = 0;
+ temp_height = min((video_top + video_height - 1),
+ (vinfo->height - 1)) - video_top + 1;
+ }
+ temp = next_frame_par->VPP_vd_start_lines_ +
+ (temp_height * ratio_y >> 18);
+ next_frame_par->VPP_vd_end_lines_ =
+ (temp <= (h_in - 1)) ? temp : (h_in - 1);
+ }
+
+ if (v_crop_enable) {
+ next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
+ next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
+ }
+
+ if (vpp_flags & VPP_FLAG_INTERLACE_IN)
+ next_frame_par->VPP_vd_start_lines_ &= ~1;
+
+ next_frame_par->VPP_pic_in_height_ =
+ next_frame_par->VPP_vd_end_lines_ -
+ next_frame_par->VPP_vd_start_lines_ + 1;
+ next_frame_par->VPP_pic_in_height_ =
+ next_frame_par->VPP_pic_in_height_ /
+ (next_frame_par->vscale_skip_count + 1);
+ /*
+ *find overlapped region between
+ *[start, end], [0, height_out-1],
+ *[video_top, video_top+video_height-1]
+ */
+ start = max(start, max(0, video_top));
+ end = min(end, min((s32)(vinfo->height - 1),
+ (s32)(video_top + video_height - 1)));
+
+ if (start >= end) {
+ /* nothing to display */
+ next_frame_par->VPP_vsc_startp = 0;
+ next_frame_par->VPP_vsc_endp = 0;
+ } else {
+ next_frame_par->VPP_vsc_startp =
+ (vpp_flags & VPP_FLAG_INTERLACE_OUT) ?
+ (start >> 1) : start;
+ next_frame_par->VPP_vsc_endp =
+ (vpp_flags & VPP_FLAG_INTERLACE_OUT) ?
+ (end >> 1) : end;
+ }
+
+ /* set filter co-efficients */
+ ratio_y <<= height_shift;
+ ratio_tmp = ratio_y / (next_frame_par->vscale_skip_count + 1);
+ ratio_y = ratio_tmp;
+
+ filter->vpp_vsc_start_phase_step = 0x1000000;
+
+ /* horizontal */
+ filter->vpp_hf_start_phase_slope = 0;
+ filter->vpp_hf_end_phase_slope = 0;
+ filter->vpp_hf_start_phase_step = 0x1000000;
+
+ next_frame_par->VPP_hsc_linear_startp = next_frame_par->VPP_hsc_startp;
+ next_frame_par->VPP_hsc_linear_endp = next_frame_par->VPP_hsc_endp;
+
+ filter->vpp_hsc_start_phase_step = 0x1000000;
+ next_frame_par->VPP_hf_ini_phase_ = 0;
+ /* screen position for source */
+ start = video_left + (video_width + 1) / 2 -
+ ((w_in << 17) + (ratio_x >> 1)) / ratio_x;
+ end = ((w_in << 18) + (ratio_x >> 1)) / ratio_x + start - 1;
+ if (super_debug)
+ pr_info("layer%d: left:start =%d,%d,%d,%d %d,%d\n",
+ input->layer_id,
+ start, end, video_left,
+ video_width, w_in, ratio_x);
+
+ /* calculate source horizontal clip */
+#ifdef TV_REVERSE
+ if (reverse) {
+ if (video_left < 0) {
+ if (start < 0) {
+ temp = (-start * ratio_x) >> 18;
+ next_frame_par->VPP_hd_end_lines_ =
+ w_in - 1 - temp;
+ } else
+ next_frame_par->VPP_hd_end_lines_ = w_in - 1;
+ } else {
+ if (start < video_left) {
+ temp = ((video_left - start) * ratio_x) >> 18;
+ next_frame_par->VPP_hd_end_lines_ =
+ w_in - 1 - temp;
+ } else
+ next_frame_par->VPP_hd_end_lines_ = w_in - 1;
+ }
+ temp = next_frame_par->VPP_hd_end_lines_ -
+ (video_width * ratio_x >> 18);
+ next_frame_par->VPP_hd_start_lines_ = (temp >= 0) ? temp : 0;
+ } else
+#endif
+ {
+ if (video_left < 0) {
+ if (start < 0) {
+ temp = (-start * ratio_x) >> 18;
+ next_frame_par->VPP_hd_start_lines_ = temp;
+
+ } else
+ next_frame_par->VPP_hd_start_lines_ = 0;
+ temp_width = min((video_left + video_width - 1),
+ (vinfo->width - 1));
+ } else {
+ if (start < video_left) {
+ temp = ((video_left - start) * ratio_x) >> 18;
+ next_frame_par->VPP_hd_start_lines_ = temp;
+
+ } else
+ next_frame_par->VPP_hd_start_lines_ = 0;
+ temp_width = min((video_left + video_width - 1),
+ (vinfo->width - 1)) - video_left + 1;
+ }
+ temp = next_frame_par->VPP_hd_start_lines_ +
+ (temp_width * ratio_x >> 18);
+ next_frame_par->VPP_hd_end_lines_ =
+ (temp <= (w_in - 1)) ? temp : (w_in - 1);
+ }
+
+ if (h_crop_enable) {
+ next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
+ next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
+ }
+
+ next_frame_par->VPP_line_in_length_ =
+ next_frame_par->VPP_hd_end_lines_ -
+ next_frame_par->VPP_hd_start_lines_ + 1;
+ /*
+ *find overlapped region between
+ * [start, end], [0, width_out-1],
+ * [video_left, video_left+video_width-1]
+ */
+ start = max(start, max(0, video_left));
+ end = min(end,
+ min((s32)(vinfo->width - 1),
+ (s32)(video_left + video_width - 1)));
+
+ if (start >= end) {
+ /* nothing to display */
+ next_frame_par->VPP_hsc_startp = 0;
+ next_frame_par->VPP_hsc_endp = 0;
+ /* avoid mif set wrong or di out size overflow */
+ next_frame_par->VPP_hd_start_lines_ = 0;
+ next_frame_par->VPP_hd_end_lines_ = 0;
+ next_frame_par->VPP_line_in_length_ = 0;
+ } else {
+ next_frame_par->VPP_hsc_startp = start;
+ next_frame_par->VPP_hsc_endp = end;
+ }
+
+ /*
+ *check the painful bandwidth limitation and see
+ * if we need skip half resolution on source side for progressive
+ * frames.
+ */
+ /* check vskip and hskip */
+ if (((next_frame_par->vscale_skip_count < MAX_VSKIP_COUNT)
+ || !next_frame_par->hscale_skip_count)
+ && (!(vpp_flags & VPP_FLAG_VSCALE_DISABLE))) {
+ int skip = SPEED_CHECK_DONE;
+
+ if (skip == SPEED_CHECK_VSKIP) {
+ u32 next_vskip =
+ next_frame_par->vscale_skip_count + vskip_step;
+
+ if (next_vskip <= MAX_VSKIP_COUNT) {
+ next_frame_par->vscale_skip_count = next_vskip;
+ goto RESTART;
+ } else
+ next_frame_par->hscale_skip_count = 1;
+ } else if (skip == SPEED_CHECK_HSKIP)
+ next_frame_par->hscale_skip_count = 1;
+ }
+
+ if ((vf->type & VIDTYPE_COMPRESS) &&
+ (vf->canvas0Addr != 0) &&
+ (next_frame_par->vscale_skip_count > 1) &&
+ (!next_frame_par->nocomp)) {
+ pr_info(
+ "layer%d: Try DW buffer for compressed frame scaling.\n",
+ input->layer_id);
+
+ /* for VIDTYPE_COMPRESS, check if we can use double write
+ * buffer when primary frame can not be scaled.
+ */
+ next_frame_par->nocomp = true;
+ w_in = width_in = vf->width;
+ h_in = height_in = vf->height;
+ next_frame_par->hscale_skip_count = 0;
+ next_frame_par->vscale_skip_count = 0;
+ goto RESTART;
+ }
+
+ if ((skip_policy & 0xf0) && (skip_policy_check == true)) {
+ skip_policy_check = false;
+ if (skip_policy & 0x40) {
+ next_frame_par->vscale_skip_count = skip_policy & 0xf;
+ goto RESTART;
+ } else if (skip_policy & 0x80) {
+ if ((((vf->width >= 4096) &&
+ (!(vf->type & VIDTYPE_COMPRESS))) ||
+ (vf->flag & VFRAME_FLAG_HIGH_BANDWIDTH))
+ && (next_frame_par->vscale_skip_count == 0)) {
+ next_frame_par->vscale_skip_count =
+ skip_policy & 0xf;
+ goto RESTART;
+ }
+ }
+ }
+
+ next_frame_par->video_input_h = next_frame_par->VPP_vd_end_lines_ -
+ next_frame_par->VPP_vd_start_lines_ + 1;
+ next_frame_par->video_input_h = next_frame_par->video_input_h /
+ (next_frame_par->vscale_skip_count + 1);
+ next_frame_par->video_input_w = next_frame_par->VPP_hd_end_lines_ -
+ next_frame_par->VPP_hd_start_lines_ + 1;
+ next_frame_par->video_input_w = next_frame_par->video_input_w /
+ (next_frame_par->hscale_skip_count + 1);
+
+ filter->vpp_hsc_start_phase_step = 0x1000000;
+
+ /* apply line skip */
+ if (next_frame_par->hscale_skip_count) {
+ filter->vpp_hf_start_phase_step >>= 1;
+ filter->vpp_hsc_start_phase_step >>= 1;
+ next_frame_par->VPP_line_in_length_ >>= 1;
+ }
+
+ return ret;
+}
+
+int vpp_set_filters(
+ struct disp_info_s *input,
+ struct vframe_s *vf,
+ struct vpp_frame_par_s *next_frame_par,
+ const struct vinfo_s *vinfo,
+ bool bypass_sr)
+{
+ u32 src_width = 0;
+ u32 src_height = 0;
+ u32 vpp_flags = 0;
+ u32 aspect_ratio = 0;
+ u32 process_3d_type;
+ u32 wide_mode;
+ int ret = VppFilter_Fail;
+ struct disp_info_s local_input;
+
+ if (!input)
+ return ret;
+
+ WARN_ON(vinfo == NULL);
+
+ /* use local var to avoid the input data be overwriten */
+ memcpy(&local_input, input, sizeof(struct disp_info_s));
+
+ process_3d_type = local_input.proc_3d_type;
+ wide_mode = local_input.wide_mode;
+
+ next_frame_par->VPP_post_blend_vd_v_start_ = 0;
+ next_frame_par->VPP_post_blend_vd_h_start_ = 0;
+
+ next_frame_par->VPP_postproc_misc_ = 0x200;
+#ifdef TV_3D_FUNCTION_OPEN
+ next_frame_par->vscale_skip_count = 0;
+ next_frame_par->hscale_skip_count = 0;
+ /*
+ *check 3d mode change in display buffer or 3d type
+ *get the source size according to 3d mode
+ */
+ if (process_3d_type & MODE_3D_ENABLE) {
+ vpp_get_video_source_size(&src_width, &src_height,
+ process_3d_type, vf, next_frame_par);
+ } else {
+ if (vf->type & VIDTYPE_COMPRESS) {
+ src_width = vf->compWidth;
+ src_height = vf->compHeight;
+ } else {
+ src_width = vf->width;
+ src_height = vf->height;
+ }
+ next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
+ next_frame_par->vpp_2pic_mode = 0;
+ next_frame_par->vpp_3d_scale = 0;
+ }
+ next_frame_par->trans_fmt = vf->trans_fmt;
+ get_vpp_3d_mode(process_3d_type,
+ next_frame_par->trans_fmt,
+ &next_frame_par->vpp_3d_mode);
+ if (local_input.vpp_3d_scale)
+ next_frame_par->vpp_3d_scale = 1;
+ amlog_mask(LOG_MASK_VPP, "%s: src_width %u,src_height %u.\n", __func__,
+ src_width, src_height);
+#endif
/* check force ratio change flag in display buffer also
* if it exist then it will override the settings in display side
*/
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;
- src_width = vf->width;
- src_height = vf->height;
+ if (vf->pic_mode.AFD_enable
+ && (vf->ratio_control & DISP_RATIO_INFOFRAME_AVAIL))
+ wide_mode = VIDEO_WIDEOPTION_AFD;
+ if (wide_mode == VIDEO_WIDEOPTION_CUSTOM) {
+ if (!custom_ar)
+ local_input.custom_ar = custom_ar;
+ else
+ local_input.custom_ar =
+ vf->pic_mode.custom_ar;
+ }
+ if (vf->pic_mode.provider == PIC_MODE_PROVIDER_WSS) {
+ /* from wss, need add global setting */
+ local_input.crop_top += vf->pic_mode.vs;
+ local_input.crop_left += vf->pic_mode.hs;
+ local_input.crop_bottom += vf->pic_mode.ve;
+ local_input.crop_right += vf->pic_mode.he;
+ } else {
+ /* from PQ database, final setting */
+ local_input.crop_top = vf->pic_mode.vs;
+ local_input.crop_left = vf->pic_mode.hs;
+ local_input.crop_bottom = vf->pic_mode.ve;
+ local_input.crop_right = vf->pic_mode.he;
+ }
+ }
- vpp_wide_mode = wide_mode;
+ /* don't restore the wide mode */
+ /* input->wide_mode = wide_mode; */
vpp_flags |= wide_mode | (aspect_ratio << VPP_FLAG_AR_BITS);
if (vinfo->field_height != vinfo->height)
vpp_flags |= VPP_FLAG_INTERLACE_OUT;
- next_frame_par->VPP_post_blend_vd_v_end_ =
- vinfo->field_height - 1;
- next_frame_par->VPP_post_blend_vd_h_end_ =
- vinfo->width - 1;
+ next_frame_par->VPP_post_blend_vd_v_end_ = vinfo->field_height - 1;
+ next_frame_par->VPP_post_blend_vd_h_end_ = vinfo->width - 1;
next_frame_par->VPP_post_blend_h_size_ = vinfo->width;
- vpp_set_filters2(process_3d_type, src_width, src_height,
- vinfo->width, vinfo->height,
- vinfo, vpp_flags, next_frame_par, vf);
-}
+ ret = vpp_set_filters_internal(
+ &local_input, src_width, src_height,
+ vinfo->width, vinfo->height,
+ vinfo, vpp_flags, next_frame_par, vf);
-void vpp_set_osd_layer_preblend(u32 *enable)
-{
- osd_layer_preblend = *enable;
+ /*config super scaler after set next_frame_par is calc ok for pps*/
+ if (local_input.layer_id == 0)
+ vpp_set_super_scaler(
+ wide_mode,
+ vinfo, next_frame_par,
+ (bypass_sr | bypass_spscl0),
+ (bypass_sr | bypass_spscl1));
+ return ret;
}
-void vpp_set_osd_layer_position(s32 *para)
+int vpp_set_filters_no_scaler(
+ struct disp_info_s *input,
+ struct vframe_s *vf,
+ struct vpp_frame_par_s *next_frame_par,
+ const struct vinfo_s *vinfo)
{
- if (IS_ERR_OR_NULL(¶[3])) {
- pr_info("para[3] is null\n");
- return;
- }
- if (para[2] < 2 || para[3] < 2)
- return;
+ u32 src_width = 0;
+ u32 src_height = 0;
+ u32 vpp_flags = 0;
+ u32 aspect_ratio = 0;
+ u32 wide_mode;
+ int ret = VppFilter_Fail;
+ struct disp_info_s local_input;
- osd_layer_left = para[0];
- osd_layer_top = para[1];
- osd_layer_width = para[2];
- osd_layer_height = para[3];
-}
+ if (!input)
+ return ret;
-void vpp_set_video_source_crop(u32 t, u32 l, u32 b, u32 r)
-{
- video_crop_top_resv = t;
- video_crop_left_resv = l;
- video_crop_bottom_resv = b;
- video_crop_right_resv = r;
-}
+ WARN_ON(vinfo == NULL);
-void vpp_get_video_source_crop(u32 *t, u32 *l, u32 *b, u32 *r)
-{
- *t = video_crop_top_resv;
- *l = video_crop_left_resv;
- *b = video_crop_bottom_resv;
- *r = video_crop_right_resv;
-}
+ /* use local var to avoid the input data be overwriten */
+ memcpy(&local_input, input, sizeof(struct disp_info_s));
+ /* wide_mode = local_input.wide_mode; */
+ wide_mode = VIDEO_WIDEOPTION_NORMAL;
+ next_frame_par->VPP_post_blend_vd_v_start_ = 0;
+ next_frame_par->VPP_post_blend_vd_h_start_ = 0;
-void vpp_set_video_layer_position(s32 x, s32 y, s32 w, s32 h)
-{
- if ((w < 0) || (h < 0))
- return;
+ next_frame_par->VPP_postproc_misc_ = 0x200;
+ next_frame_par->vscale_skip_count = 0;
+ next_frame_par->hscale_skip_count = 0;
+ if (vf->type & VIDTYPE_COMPRESS) {
+ src_width = vf->compWidth;
+ src_height = vf->compHeight;
+ } else {
+ src_width = vf->width;
+ src_height = vf->height;
+ }
+#ifdef TV_3D_FUNCTION_OPEN
+ next_frame_par->vpp_3d_mode = VPP_3D_MODE_NULL;
+ next_frame_par->vpp_2pic_mode = 0;
+ next_frame_par->vpp_3d_scale = 0;
+ next_frame_par->trans_fmt = vf->trans_fmt;
+#endif
- video_layer_left = x;
- video_layer_top = y;
- video_layer_width = w;
- video_layer_height = h;
-}
+ if (vf->type & VIDTYPE_INTERLACE)
+ vpp_flags = VPP_FLAG_INTERLACE_IN;
-void vpp_get_video_layer_position(s32 *x, s32 *y, s32 *w, s32 *h)
-{
- *x = video_layer_left;
- *y = video_layer_top;
- *w = video_layer_width;
- *h = video_layer_height;
-}
+ if ((vf->ratio_control & DISP_RATIO_ADAPTED_PICMODE)
+ && !disable_adapted) {
+ if (vf->pic_mode.provider == PIC_MODE_PROVIDER_WSS) {
+ /* from wss, need add global setting */
+ local_input.crop_top += vf->pic_mode.vs;
+ local_input.crop_left += vf->pic_mode.hs;
+ local_input.crop_bottom += vf->pic_mode.ve;
+ local_input.crop_right += vf->pic_mode.he;
+ } else {
+ /* from PQ database, final setting */
+ local_input.crop_top = vf->pic_mode.vs;
+ local_input.crop_left = vf->pic_mode.hs;
+ local_input.crop_bottom = vf->pic_mode.ve;
+ local_input.crop_right = vf->pic_mode.he;
+ }
+ }
-void vpp_set_global_offset(s32 x, s32 y)
-{
- video_layer_global_offset_x = x;
- video_layer_global_offset_y = y;
-}
+ aspect_ratio =
+ (vf->ratio_control & DISP_RATIO_ASPECT_RATIO_MASK)
+ >> DISP_RATIO_ASPECT_RATIO_BIT;
-void vpp_get_global_offset(s32 *x, s32 *y)
-{
- *x = video_layer_global_offset_x;
- *y = video_layer_global_offset_y;
-}
+ /* don't restore the wide mode */
+ /* input->wide_mode = wide_mode; */
+ vpp_flags |= wide_mode | (aspect_ratio << VPP_FLAG_AR_BITS);
+
+ if (vinfo->field_height != vinfo->height)
+ vpp_flags |= VPP_FLAG_INTERLACE_OUT;
-s32 vpp_set_nonlinear_factor(u32 f)
+ next_frame_par->VPP_post_blend_vd_v_end_ = vinfo->field_height - 1;
+ next_frame_par->VPP_post_blend_vd_h_end_ = vinfo->width - 1;
+ next_frame_par->VPP_post_blend_h_size_ = vinfo->width;
+
+ ret = vpp_set_filters_no_scaler_internal(
+ &local_input, src_width, src_height,
+ vinfo->width, vinfo->height,
+ vinfo, vpp_flags, next_frame_par, vf);
+ return ret;
+}
+s32 vpp_set_nonlinear_factor(
+ struct disp_info_s *info, u32 f)
{
if (f < MAX_NONLINEAR_FACTOR) {
- nonlinear_factor = f;
+ info->nonlinear_factor = f;
return 0;
}
return -1;
}
-u32 vpp_get_nonlinear_factor(void)
-{
- return nonlinear_factor;
-}
-
-void vpp_set_zoom_ratio(u32 r)
-{
- vpp_zoom_ratio = r;
-}
-
-u32 vpp_get_zoom_ratio(void)
-{
- return vpp_zoom_ratio;
-}
-
-void vpp_set_video_speed_check(u32 h, u32 w)
+u32 vpp_get_nonlinear_factor(
+ struct disp_info_s *info)
{
- video_speed_check_height = h;
- video_speed_check_width = w;
+ return info->nonlinear_factor;
}
-void vpp_get_video_speed_check(u32 *h, u32 *w)
+void vpp_disp_info_init(
+ struct disp_info_s *info, u8 id)
{
- *h = video_speed_check_height;
- *w = video_speed_check_width;
-}
-
-#ifdef TV_3D_FUNCTION_OPEN
-void vpp_set_3d_scale(bool enable)
-{
- vpp_3d_scale = enable;
+ if (info) {
+ memset(info, 0, sizeof(struct disp_info_s));
+ info->nonlinear_factor = MAX_NONLINEAR_FACTOR / 2;
+ info->zoom_ratio = 100;
+ info->speed_check_width = 1800;
+ info->speed_check_height = 1400;
+ info->layer_id = id;
+ memset(&gfilter[id], 0, sizeof(struct filter_info_s));
+ }
}
-#endif
void vpp_super_scaler_support(void)
{