v4l2: v4l2 vf video support [1/3]

PD#SWPL-16226

Problem:
v4l2 can not display on vf video

Solution:
add v4l2 vf video support

Verify:
U212

Change-Id: If04fc991edaa57c202f1adcf6b1be6d453bb2af9
Signed-off-by: rongrong zhou <rongrong.zhou@amlogic.com>
This commit is contained in:
rongrong zhou
2019-11-23 18:49:24 +08:00
committed by Chris
parent 587114712c
commit 166414a886
8 changed files with 43 additions and 10 deletions

View File

@@ -9,7 +9,7 @@
ifndef CONFIG_KASAN
KBUILD_CFLAGS += -Wlarger-than=28792
KBUILD_CFLAGS += -Wstack-usage=1856 -Wno-bool-operation -Wno-maybe-uninitialized
KBUILD_CFLAGS += -Wstack-usage=1956 -Wno-bool-operation -Wno-maybe-uninitialized
else
ifeq ($(call cc-ifversion, -lt, 0500, y), y)
$(error -----GCC VERSION TOO SMALL FOR KASAN -----)

View File

@@ -49,7 +49,7 @@ static DEFINE_SPINLOCK(lock);
#define CLS_NAME "vfm"
#define VFM_NAME_LEN 100
#define VFM_MAP_SIZE 10
#define VFM_MAP_COUNT 20
#define VFM_MAP_COUNT 40
static struct device *vfm_dev;
struct vfm_map_s {
char id[VFM_NAME_LEN];

View File

@@ -30,7 +30,7 @@
#include "vfm.h"
#include "vftrace.h"
#define MAX_PROVIDER_NUM 32
#define MAX_PROVIDER_NUM 64
static struct vframe_provider_s *provider_table[MAX_PROVIDER_NUM];
static atomic_t provider_used = ATOMIC_INIT(0);

View File

@@ -28,8 +28,9 @@
/* Local headers */
#include "vfm.h"
#define MAX_RECEIVER_NUM 32
#define MAX_RECEIVER_NUM 64
struct vframe_receiver_s *receiver_table[MAX_RECEIVER_NUM];
static DEFINE_MUTEX(mutex);
int receiver_list(char *buf)
{
@@ -160,11 +161,15 @@ int vf_reg_receiver(struct vframe_receiver_s *recv)
if (!recv)
return -1;
mutex_lock(&mutex);
for (i = 0; i < MAX_RECEIVER_NUM; i++) {
r = receiver_table[i];
if (r) {
if (!strcmp(r->name, recv->name))
if (!strcmp(r->name, recv->name)) {
mutex_unlock(&mutex);
return -1;
}
}
}
for (i = 0; i < MAX_RECEIVER_NUM; i++) {
@@ -173,6 +178,8 @@ int vf_reg_receiver(struct vframe_receiver_s *recv)
break;
}
}
mutex_unlock(&mutex);
return 0;
}
EXPORT_SYMBOL(vf_reg_receiver);
@@ -184,6 +191,8 @@ void vf_unreg_receiver(struct vframe_receiver_s *recv)
if (!recv)
return;
mutex_lock(&mutex);
for (i = 0; i < MAX_RECEIVER_NUM; i++) {
r = receiver_table[i];
if (r) {
@@ -193,5 +202,6 @@ void vf_unreg_receiver(struct vframe_receiver_s *recv)
}
}
}
mutex_unlock(&mutex);
}
EXPORT_SYMBOL(vf_unreg_receiver);

View File

@@ -495,7 +495,11 @@ static int get_v4l2_buffer32(struct v4l2_buffer __user *kp,
get_user(memory, &up->memory) ||
put_user(memory, &kp->memory) ||
get_user(length, &up->length) ||
put_user(length, &kp->length))
put_user(length, &kp->length) ||
assign_in_user(&kp->sequence, &up->sequence) ||
assign_in_user(&kp->reserved2, &up->reserved2) ||
assign_in_user(&kp->reserved, &up->reserved))
return -EFAULT;
if (V4L2_TYPE_IS_OUTPUT(type))

View File

@@ -436,6 +436,7 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb,
} else {
/* Zero any output buffer flags as this is a capture buffer */
vbuf->flags &= ~V4L2_BUFFER_OUT_FLAGS;
vbuf->private = b->reserved2;
}
return 0;

View File

@@ -278,6 +278,7 @@ enum FRAME_BASE_VIDEO_PATH {
FRAME_BASE_PATH_V4L_VIDEO,
FRAME_BASE_PATH_TUNNEL_MODE,
FRAME_BASE_PATH_V4L_OSD,
FRAME_BASE_PATH_DI_V4LVIDEO,
FRAME_BASE_PATH_MAX
};

View File

@@ -78,13 +78,20 @@
#define TB_DETECT_BFF 2
#define TB_DETECT_TBF 3
#define VFRAME_FLAG_NO_DISCONTINUE 1
#define VFRAME_FLAG_SWITCHING_FENSE 2
#define VFRAME_FLAG_HIGH_BANDWIDTH 4
#define VFRAME_FLAG_NO_DISCONTINUE 1
#define VFRAME_FLAG_SWITCHING_FENSE 2
#define VFRAME_FLAG_HIGH_BANDWIDTH 4
#define VFRAME_FLAG_ERROR_RECOVERY 8
#define VFRAME_FLAG_SYNCFRAME 0x10
#define VFRAME_FLAG_GAME_MODE 0x20
#define VFRAME_FLAG_GAME_MODE 0x20
#define VFRAME_FLAG_VIDEO_COMPOSER 0x40
#define VFRAME_FLAG_VIDEO_COMPOSER_BYPASS 0x80
#define VFRAME_FLAG_COMPOSER_DONE 0x100
#define VFRAME_FLAG_VIDEO_COMPOSER_DMA 0x200
#define VFRAME_FLAG_VIDEO_LINEAR 0x400
#define VFRAME_FLAG_EMPTY_FRAME_V4L 0x800
#define VFRAME_FLAG_FAKE_FRAME 0x1000
enum pixel_aspect_ratio_e {
PIXEL_ASPECT_RATIO_1_1,
@@ -316,6 +323,14 @@ struct vframe_pic_mode_s {
#define BITDEPTH_MASK (BITDEPTH_YMASK | BITDEPTH_UMASK | BITDEPTH_VMASK)
#define BITDEPTH_SAVING_MODE 0x1
#define FULL_PACK_422_MODE 0x2
struct codec_mm_box_s {
void *mmu_box;
int mmu_idx;
void *bmmu_box;
int bmmu_idx;
};
struct vframe_s {
u32 index;
u32 index_disp;
@@ -439,6 +454,8 @@ struct vframe_s {
*****************/
u32 di_pulldown;
u32 di_gmv;
struct codec_mm_box_s mm_box;
} /*vframe_t */;
#if 0