vpp: add two layers support for each chips [1/6]

PD#SWPL-85

Problem:
Need support two video layers feature

Solution:
1.Add vd2 mif config
2.Add vd2 pps calculation and config
3.Add vd2 axis/crop/screen mode interface by sysfs and ioctl
4.Add layer query/alloc/free interface

Verify:
Verify on U212

Change-Id: I71fc9ab2ae0230c3e84c4b790e77d2c790951642
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
This commit is contained in:
Brian Zhu
2019-01-16 05:12:00 +08:00
committed by Luan Yuan
parent 45056d66cc
commit f722263191
13 changed files with 4166 additions and 2224 deletions

View File

@@ -18,6 +18,7 @@
#ifndef DI_PPS_H
#define DI_PPS_H
#include <linux/amlogic/media/video_sink/video.h>
#include <linux/amlogic/media/video_sink/vpp.h>
#if 0
#define VPP_FLAG_WIDEMODE_MASK 0x0000000F
#define VPP_FLAG_INTERLACE_OUT 0x00000010

View File

@@ -54,6 +54,7 @@
#endif
#ifdef CONFIG_AMLOGIC_MEDIA_VIDEO
#include <linux/amlogic/media/vfm/vframe.h>
#include <linux/amlogic/media/video_sink/video.h>
#endif
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION

View File

@@ -31,11 +31,11 @@
#include <linux/of_fdt.h>
#include <linux/of_reserved_mem.h>
#include <linux/amlogic/media/utils/amports_config.h>
#include <linux/amlogic/media/video_sink/video.h>
#include "ppmgr_log.h"
#include "ppmgr_pri.h"
#include "ppmgr_dev.h"
#include <linux/amlogic/media/video_sink/video_prot.h>
#define PPMGRDRV_INFO(fmt, args...) pr_info("PPMGRDRV: info: "fmt"", ## args)
#define PPMGRDRV_DBG(fmt, args...) pr_debug("PPMGRDRV: dbg: "fmt"", ## args)

View File

@@ -46,7 +46,6 @@
#include <linux/mm.h>
#include <linux/amlogic/media/ppmgr/ppmgr.h>
#include <linux/amlogic/media/ppmgr/ppmgr_status.h>
#include <linux/amlogic/media/video_sink/video_prot.h>
/*#include "../amports/video.h"*/
#include <linux/amlogic/media/video_sink/video.h>
/*#include "../amports/vdec_reg.h"*/
@@ -2755,7 +2754,6 @@ static int process_vf_adjust(struct vframe_s *vf,
/* extern int get_tv_process_type(struct vframe_s *vf); */
/* #endif */
static struct task_struct *task;
/* extern int video_property_notify(int flag); */
/* extern struct vframe_s *get_cur_dispbuf(void); */
/* extern enum platform_type_t get_platform_type(void); */
@@ -2835,7 +2833,10 @@ static int ppmgr_task(void *data)
continue;
process_vf_change(vf, context, &ge2d_config);
video_property_notify(2);
vf_notify_receiver(
PROVIDER_NAME,
VFRAME_EVENT_PROVIDER_PROPERTY_CHANGED,
NULL);
vfq_lookup_start(&q_ready);
vf = vfq_peek(&q_ready);

File diff suppressed because it is too large Load Diff

View File

@@ -145,8 +145,9 @@ static int ge2d_store_frame_YUV444(u32 cur_index)
yaddr = keep_phy_addr(keep_y_addr);
canvas_config(ydupindex,
(ulong) yaddr,
cs.width, cs.height, CANVAS_ADDR_NOWRAP, cs.blkmode);
(ulong) yaddr,
cs.width, cs.height,
CANVAS_ADDR_NOWRAP, cs.blkmode);
canvas_read(ydupindex, &cd);
src_index = y_index;
@@ -194,8 +195,9 @@ static int ge2d_store_frame_YUV444(u32 cur_index)
return -1;
}
stretchblt_noalpha(ge2d_video_context, 0, 0, cs.width, cs.height,
0, 0, cs.width, cs.height);
stretchblt_noalpha(ge2d_video_context,
0, 0, cs.width, cs.height,
0, 0, cs.width, cs.height);
return 0;
}
@@ -226,11 +228,13 @@ static int ge2d_store_frame_NV21(u32 cur_index)
canvas_read(y_index, &cs0);
canvas_read(u_index, &cs1);
canvas_config(ydupindex,
(ulong) yaddr,
cs0.width, cs0.height, CANVAS_ADDR_NOWRAP, cs0.blkmode);
(ulong) yaddr,
cs0.width, cs0.height,
CANVAS_ADDR_NOWRAP, cs0.blkmode);
canvas_config(udupindex,
(ulong) uaddr,
cs1.width, cs1.height, CANVAS_ADDR_NOWRAP, cs1.blkmode);
(ulong) uaddr,
cs1.width, cs1.height,
CANVAS_ADDR_NOWRAP, cs1.blkmode);
canvas_read(ydupindex, &cd);
src_index = ((y_index & 0xff) | ((u_index << 8) & 0x0000ff00));
@@ -280,8 +284,9 @@ static int ge2d_store_frame_NV21(u32 cur_index)
return -1;
}
stretchblt_noalpha(ge2d_video_context, 0, 0, cs0.width, cs0.height,
0, 0, cs0.width, cs0.height);
stretchblt_noalpha(ge2d_video_context,
0, 0, cs0.width, cs0.height,
0, 0, cs0.width, cs0.height);
return 0;
}
@@ -322,8 +327,10 @@ static int ge2d_store_frame_YUV420(u32 cur_index)
yaddr = keep_phy_addr(keep_y_addr);
canvas_config(ydupindex,
(ulong) yaddr,
cs.width, cs.height, CANVAS_ADDR_NOWRAP, cs.blkmode);
(ulong) yaddr,
cs.width, cs.height,
CANVAS_ADDR_NOWRAP, cs.blkmode);
canvas_read(ydupindex, &cd);
ge2d_config.dst_planes[0].addr = cd.addr;
ge2d_config.dst_planes[0].w = cd.width;
@@ -371,8 +378,9 @@ static int ge2d_store_frame_YUV420(u32 cur_index)
pr_info("++ge2d configing error.\n");
return -1;
}
stretchblt_noalpha(ge2d_video_context, 0, 0, cs.width, cs.height, 0, 0,
cs.width, cs.height);
stretchblt_noalpha(ge2d_video_context,
0, 0, cs.width, cs.height,
0, 0, cs.width, cs.height);
/* U data */
ge2d_config.alu_const_color = 0;
@@ -393,8 +401,10 @@ static int ge2d_store_frame_YUV420(u32 cur_index)
uaddr = keep_phy_addr(keep_u_addr);
canvas_config(udupindex,
(ulong) uaddr,
cs.width, cs.height, CANVAS_ADDR_NOWRAP, cs.blkmode);
(ulong) uaddr,
cs.width, cs.height,
CANVAS_ADDR_NOWRAP, cs.blkmode);
canvas_read(udupindex, &cd);
ge2d_config.dst_planes[0].addr = cd.addr;
ge2d_config.dst_planes[0].w = cd.width;
@@ -442,8 +452,9 @@ static int ge2d_store_frame_YUV420(u32 cur_index)
pr_info("++ge2d configing error.\n");
return -1;
}
stretchblt_noalpha(ge2d_video_context, 0, 0, cs.width, cs.height, 0, 0,
cs.width, cs.height);
stretchblt_noalpha(ge2d_video_context,
0, 0, cs.width, cs.height,
0, 0, cs.width, cs.height);
/* operation top line */
/* V data */
@@ -465,8 +476,10 @@ static int ge2d_store_frame_YUV420(u32 cur_index)
vaddr = keep_phy_addr(keep_v_addr);
canvas_config(vdupindex,
(ulong) vaddr,
cs.width, cs.height, CANVAS_ADDR_NOWRAP, cs.blkmode);
(ulong) vaddr,
cs.width, cs.height,
CANVAS_ADDR_NOWRAP, cs.blkmode);
ge2d_config.dst_planes[0].addr = cd.addr;
ge2d_config.dst_planes[0].w = cd.width;
ge2d_config.dst_planes[0].h = cd.height;
@@ -513,14 +526,14 @@ static int ge2d_store_frame_YUV420(u32 cur_index)
pr_info("++ge2d configing error.\n");
return -1;
}
stretchblt_noalpha(ge2d_video_context, 0, 0, cs.width, cs.height, 0, 0,
cs.width, cs.height);
stretchblt_noalpha(ge2d_video_context,
0, 0, cs.width, cs.height,
0, 0, cs.width, cs.height);
return 0;
}
static void ge2d_keeplastframe_block(int cur_index, int format)
{
/* u32 cur_index; */
u32 y_index, u_index, v_index;
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
u32 y_index2, u_index2, v_index2;
@@ -579,10 +592,9 @@ static void ge2d_keeplastframe_block(int cur_index, int format)
video_module_unlock();
}
#endif
#define FETCHBUF_SIZE (64*1024) /*DEBUG_TMP*/
#define FETCHBUF_SIZE (64*1024) /*DEBUG_TMP*/
static int canvas_dup(ulong dst, ulong src_paddr, ulong size)
{
void *src_addr = codec_mm_phys_to_virt(src_paddr);
@@ -636,13 +648,14 @@ static int alloc_keep_buffer(void)
flags = CODEC_MM_FLAGS_DMA | CODEC_MM_FLAGS_FOR_VDECODER;
#endif
if ((flags & CODEC_MM_FLAGS_FOR_VDECODER) &&
codec_mm_video_tvp_enabled())/*TVP TODO for MULTI*/
codec_mm_video_tvp_enabled())
/*TVP TODO for MULTI*/
flags |= CODEC_MM_FLAGS_TVP;
if (!keep_y_addr) {
keep_y_addr = codec_mm_alloc_for_dma(
MEM_NAME,
PAGE_ALIGN(Y_BUFFER_SIZE)/PAGE_SIZE, 0, flags);
MEM_NAME,
PAGE_ALIGN(Y_BUFFER_SIZE)/PAGE_SIZE, 0, flags);
if (!keep_y_addr) {
pr_err("%s: failed to alloc y addr\n", __func__);
goto err1;
@@ -651,8 +664,8 @@ static int alloc_keep_buffer(void)
if (!keep_u_addr) {
keep_u_addr = codec_mm_alloc_for_dma(
MEM_NAME,
PAGE_ALIGN(U_BUFFER_SIZE)/PAGE_SIZE, 0, flags);
MEM_NAME,
PAGE_ALIGN(U_BUFFER_SIZE)/PAGE_SIZE, 0, flags);
if (!keep_u_addr) {
pr_err("%s: failed to alloc u addr\n", __func__);
goto err1;
@@ -661,8 +674,8 @@ static int alloc_keep_buffer(void)
if (!keep_v_addr) {
keep_v_addr = codec_mm_alloc_for_dma(
MEM_NAME,
PAGE_ALIGN(V_BUFFER_SIZE)/PAGE_SIZE, 0, flags);
MEM_NAME,
PAGE_ALIGN(V_BUFFER_SIZE)/PAGE_SIZE, 0, flags);
if (!keep_v_addr) {
pr_err("%s: failed to alloc v addr\n", __func__);
goto err1;
@@ -680,7 +693,6 @@ static int alloc_keep_buffer(void)
return -ENOMEM;
}
/*
*flags,used per bit:
*deflaut free alloced keeper buffer.
@@ -708,7 +720,6 @@ void try_free_keep_video(int flags)
mutex_unlock(&video_keeper_mutex);
}
EXPORT_SYMBOL(try_free_keep_video);
#endif
static void video_keeper_update_keeper_mem(
@@ -730,6 +741,7 @@ static void video_keeper_update_keeper_mem(
*id = ret;
}
}
static int video_keeper_frame_keep_locked(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf_el)
@@ -795,6 +807,7 @@ void video_keeper_new_frame_notify(void)
}
return;
}
static unsigned int vf_keep_current_locked(
struct vframe_s *cur_dispbuf,
struct vframe_s *cur_dispbuf_el)
@@ -809,28 +822,28 @@ static unsigned int vf_keep_current_locked(
return 0;
}
if (cur_dispbuf->source_type == VFRAME_SOURCE_TYPE_OSD) {
pr_info("keep exit is osd\n");
return 0;
}
if (get_video_debug_flags() & DEBUG_FLAG_TOGGLE_SKIP_KEEP_CURRENT) {
if (get_video_debug_flags() &
DEBUG_FLAG_TOGGLE_SKIP_KEEP_CURRENT) {
pr_info("keep exit is skip current\n");
return 0;
}
#ifdef CONFIG_AMLOGIC_MEDIA_VIDEOCAPTURE
ext_frame_capture_poll(1); /*pull if have capture end frame */
ext_frame_capture_poll(1); /*pull if have capture end frame */
#endif
if (get_blackout_policy()) {
pr_info("keep exit is skip current\n");
return 0;
}
if (VSYNC_RD_MPEG_REG(DI_IF1_GEN_REG) & 0x1) {
pr_info("keep exit is di\n");
return 0;
}
ret = video_keeper_frame_keep_locked(cur_dispbuf,
ret = video_keeper_frame_keep_locked(
cur_dispbuf,
cur_dispbuf_el);
if (ret) {
/*keeped ok with codec keeper!*/
@@ -844,34 +857,34 @@ static unsigned int vf_keep_current_locked(
}
#endif
if ((get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) &&
(cur_dispbuf->type & VIDTYPE_COMPRESS)) {
if (cur_dispbuf->type & VIDTYPE_COMPRESS) {
/* todo: duplicate compressed video frame */
pr_info("keep exit is skip VIDTYPE_COMPRESS\n");
return -1;
}
cur_index = READ_VCBUS_REG(VD1_IF0_CANVAS0 +
get_video_cur_dev()->viu_off);
get_video_cur_dev()->viu_off);
y_index = cur_index & 0xff;
u_index = (cur_index >> 8) & 0xff;
v_index = (cur_index >> 16) & 0xff;
canvas_read(y_index, &cd);
if ((cd.width * cd.height) <= 2048 * 1088 &&
!keep_y_addr) {
if ((cd.width * cd.height) <= 2048 * 1088
&& !keep_y_addr) {
alloc_keep_buffer();
}
if (!keep_y_addr
|| (cur_dispbuf->type & VIDTYPE_VIU_422) == VIDTYPE_VIU_422) {
|| (cur_dispbuf->type & VIDTYPE_VIU_422)
== VIDTYPE_VIU_422) {
/* no support VIDTYPE_VIU_422... */
pr_info("%s:no support VIDTYPE_VIU_422\n", __func__);
return -1;
}
if (get_video_debug_flags() & DEBUG_FLAG_BLACKOUT) {
pr_info("%s keep_y_addr=%p %x\n", __func__, (void *)keep_y_addr,
canvas_get_addr(y_index));
pr_info("%s keep_y_addr=%p %x\n",
__func__, (void *)keep_y_addr,
canvas_get_addr(y_index));
}
if ((cur_dispbuf->type & VIDTYPE_VIU_422) == VIDTYPE_VIU_422) {
@@ -886,21 +899,20 @@ static unsigned int vf_keep_current_locked(
return -1;
}
if (keep_phy_addr(keep_y_addr) != canvas_get_addr(y_index) &&
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cd.width) * (cd.height))) {
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cd.width) * (cd.height))) {
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
canvas_update_addr(disp_canvas_index[0][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
canvas_update_addr(disp_canvas_index[1][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
#else
canvas_update_addr(y_index,
keep_phy_addr(keep_y_addr));
#endif
if (get_video_debug_flags() & DEBUG_FLAG_BLACKOUT)
pr_info("%s: VIDTYPE_VIU_422\n", __func__);
}
*/
} else if ((cur_dispbuf->type & VIDTYPE_VIU_444) == VIDTYPE_VIU_444) {
@@ -916,17 +928,17 @@ static unsigned int vf_keep_current_locked(
ge2d_keeplastframe_block(cur_index, GE2D_FORMAT_M24_YUV444);
#else
if (keep_phy_addr(keep_y_addr) != canvas_get_addr(y_index) &&
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cd.width) * (cd.height))) {
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cd.width) * (cd.height))) {
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
canvas_update_addr(disp_canvas_index[0][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
canvas_update_addr(disp_canvas_index[1][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
#else
canvas_update_addr(y_index,
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
#endif
}
#endif
@@ -936,7 +948,7 @@ static unsigned int vf_keep_current_locked(
canvas_read(y_index, &cs0);
canvas_read(u_index, &cs1);
if ((Y_BUFFER_SIZE < (cs0.width * cs0.height))
|| (U_BUFFER_SIZE < (cs1.width * cs1.height))) {
|| (U_BUFFER_SIZE < (cs1.width * cs1.height))) {
pr_info("## [%s::%d] error: yuv data size larger",
__func__, __LINE__);
return -1;
@@ -945,21 +957,21 @@ static unsigned int vf_keep_current_locked(
ge2d_keeplastframe_block(cur_index, GE2D_FORMAT_M24_NV21);
#else
if (keep_phy_addr(keep_y_addr) != canvas_get_addr(y_index) &&
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cs0.width * cs0.height))
&& canvas_dup(keep_phy_addr(keep_u_addr),
canvas_get_addr(u_index),
(cs1.width * cs1.height))) {
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cs0.width * cs0.height))
&& canvas_dup(keep_phy_addr(keep_u_addr),
canvas_get_addr(u_index),
(cs1.width * cs1.height))) {
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
canvas_update_addr(disp_canvas_index[0][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
canvas_update_addr(disp_canvas_index[1][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
canvas_update_addr(disp_canvas_index[0][1],
keep_phy_addr(keep_u_addr));
keep_phy_addr(keep_u_addr));
canvas_update_addr(disp_canvas_index[1][1],
keep_phy_addr(keep_u_addr));
keep_phy_addr(keep_u_addr));
#else
canvas_update_addr(y_index,
keep_phy_addr(keep_y_addr));
@@ -976,13 +988,13 @@ static unsigned int vf_keep_current_locked(
canvas_read(v_index, &cs2);
if ((Y_BUFFER_SIZE < (cs0.width * cs0.height))
|| (U_BUFFER_SIZE < (cs1.width * cs1.height))
|| (V_BUFFER_SIZE < (cs2.width * cs2.height))) {
|| (U_BUFFER_SIZE < (cs1.width * cs1.height))
|| (V_BUFFER_SIZE < (cs2.width * cs2.height))) {
pr_info("## [%s::%d] error: yuv data size larger than buf size: %x,%x,%x, %x,%x, %x,%x, %x,%x,\n",
__func__, __LINE__, Y_BUFFER_SIZE,
U_BUFFER_SIZE, V_BUFFER_SIZE, cs0.width,
cs0.height, cs1.width, cs1.height, cs2.width,
cs2.height);
__func__, __LINE__, Y_BUFFER_SIZE,
U_BUFFER_SIZE, V_BUFFER_SIZE, cs0.width,
cs0.height, cs1.width, cs1.height, cs2.width,
cs2.height);
return -1;
}
#ifdef CONFIG_GE2D_KEEP_FRAME
@@ -990,28 +1002,28 @@ static unsigned int vf_keep_current_locked(
#else
if (keep_phy_addr(keep_y_addr) != canvas_get_addr(y_index) &&
/*must not the same address */
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cs0.width * cs0.height))
&& canvas_dup(keep_phy_addr(keep_u_addr),
canvas_get_addr(u_index),
(cs1.width * cs1.height))
canvas_dup(keep_phy_addr(keep_y_addr),
canvas_get_addr(y_index),
(cs0.width * cs0.height))
&& canvas_dup(keep_phy_addr(keep_u_addr),
canvas_get_addr(u_index),
(cs1.width * cs1.height))
&& canvas_dup(keep_phy_addr(keep_v_addr),
canvas_get_addr(v_index),
(cs2.width * cs2.height))) {
canvas_get_addr(v_index),
(cs2.width * cs2.height))) {
#ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
canvas_update_addr(disp_canvas_index[0][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
canvas_update_addr(disp_canvas_index[1][0],
keep_phy_addr(keep_y_addr));
keep_phy_addr(keep_y_addr));
canvas_update_addr(disp_canvas_index[0][1],
keep_phy_addr(keep_u_addr));
keep_phy_addr(keep_u_addr));
canvas_update_addr(disp_canvas_index[1][1],
keep_phy_addr(keep_u_addr));
keep_phy_addr(keep_u_addr));
canvas_update_addr(disp_canvas_index[0][2],
keep_phy_addr(keep_v_addr));
keep_phy_addr(keep_v_addr));
canvas_update_addr(disp_canvas_index[1][2],
keep_phy_addr(keep_v_addr));
keep_phy_addr(keep_v_addr));
#else
canvas_update_addr(y_index,
keep_phy_addr(keep_y_addr));
@@ -1038,8 +1050,8 @@ unsigned int vf_keep_current(
unsigned int ret;
mutex_lock(&video_keeper_mutex);
ret = vf_keep_current_locked(cur_dispbuf,
cur_dispbuf2);
ret = vf_keep_current_locked(
cur_dispbuf, cur_dispbuf2);
mutex_unlock(&video_keeper_mutex);
return ret;
}

View File

@@ -17,6 +17,9 @@
#ifndef VIDEO_PRIV_HEADER_HH
#define VIDEO_PRIV_HEADER_HH
#include <linux/amlogic/media/video_sink/vpp.h>
#define DEBUG_FLAG_BLACKOUT 0x1
#define DEBUG_FLAG_PRINT_TOGGLE_FRAME 0x2
#define DEBUG_FLAG_PRINT_RDMA 0x4
@@ -38,10 +41,97 @@
#define VIDEO_DISABLE_NORMAL 1
#define VIDEO_DISABLE_FORNEXT 2
#define VIDEO_NOTIFY_TRICK_WAIT 0x01
#define VIDEO_NOTIFY_PROVIDER_GET 0x02
#define VIDEO_NOTIFY_PROVIDER_PUT 0x04
#define VIDEO_NOTIFY_FRAME_WAIT 0x08
#define VIDEO_NOTIFY_POS_CHANGED 0x10
struct video_dev_s {
int vpp_off;
int viu_off;
};
struct mif_pos_s {
u32 id;
u32 vd_reg_offt;
u32 afbc_reg_offt;
/* frame original size */
u32 src_w;
u32 src_h;
/* mif start - end lines */
u32 start_x_lines;
u32 end_x_lines;
u32 start_y_lines;
u32 end_y_lines;
/* left and right eye position, skip flag. */
/* And if non 3d case, left eye = right eye */
u32 l_hs_luma;
u32 l_he_luma;
u32 l_hs_chrm;
u32 l_he_chrm;
u32 r_hs_luma;
u32 r_he_luma;
u32 r_hs_chrm;
u32 r_he_chrm;
u32 h_skip;
u32 l_vs_luma;
u32 l_ve_luma;
u32 l_vs_chrm;
u32 l_ve_chrm;
u32 r_vs_luma;
u32 r_ve_luma;
u32 r_vs_chrm;
u32 r_ve_chrm;
u32 v_skip;
bool reverse;
bool skip_afbc;
};
struct scaler_setting_s {
u32 id;
u32 misc_reg_offt;
bool sc_h_enable;
bool sc_v_enable;
bool sc_top_enable;
u32 vinfo_width;
u32 vinfo_height;
/* u32 VPP_pic_in_height_; */
/* u32 VPP_line_in_length_; */
struct vpp_frame_par_s *frame_par;
};
struct blend_setting_s {
u32 id;
u32 misc_reg_offt;
u32 layer_alpha;
u32 preblend_h_start;
u32 preblend_h_end;
u32 preblend_v_start;
u32 preblend_v_end;
u32 preblend_h_size;
u32 postblend_h_start;
u32 postblend_h_end;
u32 postblend_v_start;
u32 postblend_v_end;
u32 postblend_h_size;
struct vpp_frame_par_s *frame_par;
};
void safe_disble_videolayer(void);
void update_cur_dispbuf(void *buf);
@@ -54,6 +144,7 @@ struct vframe_s *get_cur_dispbuf(void);
int get_video_debug_flags(void);
int _video_set_disable(u32 val);
u32 get_video_enabled(void);
struct device *get_video_device(void);
#ifdef CONFIG_AMLOGIC_MEDIA_VIDEOCAPTURE
int ext_frame_capture_poll(int endflags);

File diff suppressed because it is too large Load Diff

View File

@@ -245,6 +245,9 @@
#define OSD1_BLEND_SRC_CTRL 0x1dfd
#define OSD2_BLEND_SRC_CTRL 0x1dfe
#define VPP_POST_BLEND_BLEND_DUMMY_DATA 0x3968
#define VPP_POST_BLEND_DUMMY_ALPHA 0x3969
/* after g12b */
#define SRSHARP0_SHARP_SYNC_CTRL 0x3eb0
#define SRSHARP1_SHARP_SYNC_CTRL 0x3fb0

View File

@@ -91,6 +91,31 @@
#define AMSTREAM_IOC_GLOBAL_SET_VIDEO_OUTPUT _IOW((_A_M), 0x22, int)
#define AMSTREAM_IOC_GET_VIDEO_LAYER1_ON _IOR((_A_M), 0x23, int)
#define AMSTREAM_IOC_GLOBAL_GET_VIDEOPIP_OUTPUT _IOR((_A_M), 0x2b, int)
#define AMSTREAM_IOC_GLOBAL_SET_VIDEOPIP_OUTPUT _IOW((_A_M), 0x2c, int)
#define AMSTREAM_IOC_GET_VIDEOPIP_DISABLE _IOR((_A_M), 0x2d, int)
#define AMSTREAM_IOC_SET_VIDEOPIP_DISABLE _IOW((_A_M), 0x2e, int)
#define AMSTREAM_IOC_GET_VIDEOPIP_AXIS _IOR((_A_M), 0x2f, int)
#define AMSTREAM_IOC_SET_VIDEOPIP_AXIS _IOW((_A_M), 0x30, int)
#define AMSTREAM_IOC_GET_VIDEOPIP_CROP _IOR((_A_M), 0x31, int)
#define AMSTREAM_IOC_SET_VIDEOPIP_CROP _IOW((_A_M), 0x32, int)
#define AMSTREAM_IOC_GET_PIP_SCREEN_MODE _IOR((_A_M), 0x33, int)
#define AMSTREAM_IOC_SET_PIP_SCREEN_MODE _IOW((_A_M), 0x34, int)
#define AMSTREAM_IOC_GET_PIP_ZORDER _IOW((_A_M), 0x35, unsigned int)
#define AMSTREAM_IOC_SET_PIP_ZORDER _IOW((_A_M), 0x36, unsigned int)
#define AMSTREAM_IOC_GET_ZORDER _IOW((_A_M), 0x37, unsigned int)
#define AMSTREAM_IOC_SET_ZORDER _IOW((_A_M), 0x38, unsigned int)
#define AMSTREAM_IOC_QUERY_LAYER _IOW((_A_M), 0x39, unsigned int)
#define AMSTREAM_IOC_ALLOC_LAYER _IOW((_A_M), 0x3a, unsigned int)
#define AMSTREAM_IOC_FREE_LAYER _IOW((_A_M), 0x3b, unsigned int)
/* VPP.3D IOCTL command list^M */
#define AMSTREAM_IOC_SET_3D_TYPE _IOW((_A_M), 0x3c, unsigned int)
#define AMSTREAM_IOC_GET_3D_TYPE _IOW((_A_M), 0x3d, unsigned int)
#define AMSTREAM_IOC_GET_SOURCE_VIDEO_3D_TYPE _IOW((_A_M), 0x3e, unsigned int)
#define AMSTREAM_IOC_APTS _IOR((_A_M), 0x40, int)
#define AMSTREAM_IOC_VPTS _IOR((_A_M), 0x41, int)
#define AMSTREAM_IOC_PCRSCR _IOR((_A_M), 0x42, int)
@@ -108,11 +133,6 @@
#define AMSTREAM_IOC_SET_VIDEO_CROP _IOW((_A_M), 0x4e, int)
#define AMSTREAM_IOC_PCRID _IOW((_A_M), 0x4f, int)
/* VPP.3D IOCTL command list^M */
#define AMSTREAM_IOC_SET_3D_TYPE _IOW((_A_M), 0x3c, unsigned int)
#define AMSTREAM_IOC_GET_3D_TYPE _IOW((_A_M), 0x3d, unsigned int)
#define AMSTREAM_IOC_GET_SOURCE_VIDEO_3D_TYPE _IOW((_A_M), 0x3e, unsigned int)
#define AMSTREAM_IOC_SUB_NUM _IOR((_A_M), 0x50, int)
#define AMSTREAM_IOC_SUB_INFO _IOR((_A_M), 0x51, int)
#define AMSTREAM_IOC_GET_BLACKOUT_POLICY _IOR((_A_M), 0x52, int)

View File

@@ -39,6 +39,7 @@
#define VFRAME_EVENT_PROVIDER_FR_HINT 13
#define VFRAME_EVENT_PROVIDER_FR_END_HINT 14
#define VFRAME_EVENT_PROVIDER_QUREY_DISPLAY_INFO 15
#define VFRAME_EVENT_PROVIDER_PROPERTY_CHANGED 16
enum receviver_start_e {
RECEIVER_STATE_NULL = -1,

View File

@@ -17,7 +17,19 @@
#ifndef VIDEO_H
#define VIDEO_H
#include "vpp.h"
#define MAX_VD_LAYERS 2
#define LAYER1_BUSY (1 << 11)
#define LAYER1_AFBC (1 << 10)
#define LAYER1_SCALER (1 << 9)
#define LAYER1_AVAIL (1 << 8)
#define LAYER0_BUSY (1 << 3)
#define LAYER0_AFBC (1 << 2)
#define LAYER0_SCALER (1 << 1)
#define LAYER0_AVAIL (1 << 0)
#define LAYER_BITS_SHFIT 8
enum {
VIDEO_WIDEOPTION_NORMAL = 0,
@@ -39,16 +51,6 @@ enum {
VIDEO_WIDEOPTION_MAX = 16
};
extern bool pre_scaler_en;
extern bool super_scaler;
#define VIDEO_NOTIFY_TRICK_WAIT 0x01
#define VIDEO_NOTIFY_PROVIDER_GET 0x02
#define VIDEO_NOTIFY_PROVIDER_PUT 0x04
#define VIDEO_NOTIFY_FRAME_WAIT 0x08
#define VIDEO_NOTIFY_POS_CHANGED 0x10
#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON6 */
/* TODO: move to register headers */
#define VPP_VADJ2_BLMINUS_EN (1 << 3)
#define VPP_VADJ2_EN (1 << 2)
@@ -160,7 +162,7 @@ extern bool super_scaler;
#define VPP_PHASECTL_TYPE_INTERLACE (1<<16)
#define VPP_PHASECTL_VSL0B (1<<15)
#define VPP_PHASECTL_DOUBLELINE_BIT 17
#define VPP_PHASECTL_DOUBLELINE_WID 1
#define VPP_PHASECTL_DOUBLELINE_WID 2
#define VPP_PHASECTL_INIRPTNUM_MASK 0x3
#define VPP_PHASECTL_INIRPTNUM_WID 2
#define VPP_PHASECTL_INIRPTNUMB_BIT 13
@@ -207,11 +209,7 @@ extern bool super_scaler;
#define VPP_FORCE_FIELD_BOTTOM (1 << 16)
#define VPP_FOURCE_GO_FIELD (1 << 15)
#define VPP_FOURCE_GO_LINE (1 << 14)
#if 1 /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
#define VPP_OFIFO_SIZE_WID 13
#else
#define VPP_OFIFO_SIZE_WID 12
#endif /* MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
#define VPP_OFIFO_SIZE_MASK 0xfff
#define VPP_OFIFO_SIZE_BIT 0
@@ -226,44 +224,6 @@ extern bool super_scaler;
#define VPP_COEF_INDEX_MASK 0x7f
#define VPP_COEF_INDEX_BIT 0
#define P_VFIFO2VD_LINE_TOP_START P_ENCP_VFIFO2VD_LINE_TOP_START
#endif
#if 0 /* MESON_CPU_TYPE < MESON_CPU_TYPE_MESON8 */
#define READ_VCBUS_REG(r) READ_CBUS_REG(r)
#define WRITE_VCBUS_REG(r, val) WRITE_CBUS_REG(r, val)
#define WRITE_VCBUS_REG_BITS(r, val, from, size) \
WRITE_CBUS_REG_BITS(r, val, from, size)
#define SET_VCBUS_REG_MASK(r, mask) SET_CBUS_REG_MASK(r, mask)
#define CLEAR_VCBUS_REG_MASK(r, mask) CLEAR_CBUS_REG_MASK(r, mask)
#endif
#ifdef CONFIG_CLK81_DFS
extern int check_and_set_clk81(void);
#endif
#ifdef CONFIG_GAMMA_PROC
extern int gamma_adjust(void);
#endif
#ifdef CONFIG_SCREEN_ON_EARLY
extern void osd_resume_early(void);
extern void vout_pll_resume_early(void);
extern void resume_vout_early(void);
extern int power_key_pressed;
#endif
#ifdef CONFIG_AM_VIDEO2
extern void set_clone_frame_rate(unsigned int frame_rate, unsigned int delay);
#endif
extern struct vframe_provider_s *vf_get_provider_by_name(
const char *provider_name);
extern 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 get_blackout_policy(void);
int get_video0_frame_info(struct vframe_s *vf);
#define AMVIDEO_UPDATE_OSD_MODE 0x00000001
#ifdef CONFIG_AMLOGIC_MEDIA_VIDEO
int amvideo_notifier_call_chain(unsigned long val, void *v);
@@ -275,8 +235,11 @@ static inline int amvideo_notifier_call_chain(unsigned long val, void *v)
#endif
int query_video_status(int type, int *value);
int get_video0_frame_info(struct vframe_s *vf);
struct device *get_video_device(void);
u32 set_blackout_policy(int policy);
u32 get_blackout_policy(void);
void set_video_angle(u32 s_value);
u32 get_video_angle(void);
extern unsigned int DI_POST_REG_RD(unsigned int addr);
extern int DI_POST_WR_REG_BITS(u32 adr, u32 val, u32 start, u32 len);
#endif /* VIDEO_H */

View File

@@ -17,8 +17,13 @@
#ifndef VPP_H
#define VPP_H
#include <linux/amlogic/media/vout/vinfo.h>
#include <linux/amlogic/media/video_sink/video_prot.h>
#define TV_3D_FUNCTION_OPEN
#define TV_REVERSE
extern bool super_scaler;
#define VPP_FLAG_WIDEMODE_MASK 0x0000000F
#define VPP_FLAG_INTERLACE_OUT 0x00000010
@@ -43,6 +48,12 @@
#define SPEED_CHECK_HSKIP 1
#define SPEED_CHECK_VSKIP 2
enum vppfilter_state_e {
VppFilter_Fail = -1,
VppFilter_Success = 0,
VppFilter_Success_and_Changed,
};
enum f2v_vphase_type_e {
F2V_IT2IT = 0,
F2V_IB2IB,
@@ -54,7 +65,7 @@ enum f2v_vphase_type_e {
F2V_IB2P,
F2V_P2P,
F2V_TYPE_MAX
}; /* frame to video conversion type */
}; /* frame to video conversion type */
struct f2v_vphase_s {
s8 repeat_skip;
@@ -142,21 +153,34 @@ struct vpp_frame_par_s {
};
#if 1
struct disp_info_s {
u8 layer_id;
/*
*(MESON_CPU_TYPE==MESON_CPU_TYPE_MESON6TV)||
*(MESON_CPU_TYPE==MESON_CPU_TYPE_MESONG9TV)
*/
#define TV_3D_FUNCTION_OPEN
#endif
u32 angle;
u32 custom_ar;
#define TV_REVERSE
bool reverse;
u32 proc_3d_type;
bool vpp_3d_scale;
u32 nonlinear_factor;
#ifdef TV_REVERSE
extern bool reverse;
#endif
extern bool platform_type;
u32 wide_mode;
u32 zoom_ratio;
s32 zoom_center_x;
s32 zoom_center_y;
s32 layer_top;
s32 layer_left;
s32 layer_width;
s32 layer_height;
u32 crop_top;
u32 crop_left;
u32 crop_bottom;
u32 crop_right;
s32 global_offset_x;
s32 global_offset_y;
u32 speed_check_width;
u32 speed_check_height;
};
enum select_scaler_path_e {
CORE0_PPS_CORE1 = 0, /*CORE0_PPS_CORE1_POSTBLEND*/
@@ -187,7 +211,6 @@ enum select_scaler_path_e {
#ifdef TV_3D_FUNCTION_OPEN
/*cmd use for 3d operation*/
#define MODE_3D_DISABLE 0x00000000
#define MODE_3D_ENABLE 0x00000001
@@ -222,11 +245,16 @@ enum select_scaler_path_e {
#define MODE_3D_OUT_FA_MASK \
(MODE_3D_OUT_FA_L_FIRST | \
MODE_3D_OUT_FA_R_FIRST|MODE_3D_OUT_FA_LB_FIRST|MODE_3D_OUT_FA_RB_FIRST)
MODE_3D_OUT_FA_R_FIRST | \
MODE_3D_OUT_FA_LB_FIRST | \
MODE_3D_OUT_FA_RB_FIRST)
#define MODE_3D_TO_2D_MASK \
(MODE_3D_TO_2D_L|MODE_3D_TO_2D_R|MODE_3D_OUT_FA_MASK | \
MODE_FORCE_3D_TO_2D_LR | MODE_FORCE_3D_TO_2D_TB)
(MODE_3D_TO_2D_L | \
MODE_3D_TO_2D_R | \
MODE_3D_OUT_FA_MASK | \
MODE_FORCE_3D_TO_2D_LR | \
MODE_FORCE_3D_TO_2D_TB)
#define VPP_3D_MODE_NULL 0x0
#define VPP_3D_MODE_LR 0x1
@@ -240,78 +268,49 @@ enum select_scaler_path_e {
#define VPP_PIC0_FIRST 0x0
#define VPP_PIC1_FIRST 0x8
extern
void vpp_set_3d_scale(bool enable);
extern
void get_vpp_3d_mode(u32 process_3d_type, u32 trans_fmt, u32 *vpp_3d_mode);
extern void get_vpp_3d_mode(u32 process_3d_type,
u32 trans_fmt, u32 *vpp_3d_mode);
#endif
extern void
vpp_set_filters(u32 process_3d_type, u32 wide_mode, struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par,
const struct vinfo_s *vinfo,
bool bypass_sr);
extern 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);
extern void vpp_set_video_source_crop(u32 t, u32 l, u32 b, u32 r);
extern 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);
extern void vpp_get_video_source_crop(u32 *t, u32 *l, u32 *b, u32 *r);
extern s32 vpp_set_nonlinear_factor(
struct disp_info_s *info, u32 f);
extern void vpp_set_video_layer_position(s32 x, s32 y, s32 w, s32 h);
extern u32 vpp_get_nonlinear_factor(
struct disp_info_s *info);
extern void vpp_get_video_layer_position(s32 *x, s32 *y, s32 *w, s32 *h);
extern void vpp_set_global_offset(s32 x, s32 y);
extern void vpp_get_global_offset(s32 *x, s32 *y);
extern void vpp_set_zoom_ratio(u32 r);
extern u32 vpp_get_zoom_ratio(void);
extern void vpp_set_osd_layer_preblend(u32 *enable);
extern void vpp_set_osd_layer_position(s32 *para);
extern s32 vpp_set_nonlinear_factor(u32 f);
extern u32 vpp_get_nonlinear_factor(void);
extern void vpp_set_video_speed_check(u32 h, u32 w);
extern void vpp_get_video_speed_check(u32 *h, u32 *w);
extern void vpp_disp_info_init(
struct disp_info_s *info, u8 id);
extern void vpp_super_scaler_support(void);
extern void vpp_bypass_ratio_config(void);
#ifdef CONFIG_AM_VIDEO2
extern void
vpp2_set_filters(u32 wide_mode, struct vframe_s *vf,
struct vpp_frame_par_s *next_frame_par,
const struct vinfo_s *vinfo);
extern void vpp2_set_video_layer_position(s32 x, s32 y, s32 w, s32 h);
extern void vpp2_get_video_layer_position(s32 *x, s32 *y, s32 *w, s32 *h);
extern void vpp2_set_zoom_ratio(u32 r);
extern u32 vpp2_get_zoom_ratio(void);
#endif
extern int video_property_notify(int flag);
extern 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);
extern 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);
#endif /* VPP_H */