mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-16 07:24:39 +08:00
076b6289b2
The last buffer from before the change must be marked
with the V4L2_BUF_FLAG_LAST flag,
similarly to the Drain sequence above.
initiate a drain of the capture queue in dynamic resolution change
Fixes: 6de8d628df
("media: amphion: add v4l2 m2m vpu decoder stateful driver")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright 2020-2021 NXP
|
|
*/
|
|
|
|
#ifndef _AMPHION_VPU_V4L2_H
|
|
#define _AMPHION_VPU_V4L2_H
|
|
|
|
#include <linux/videodev2.h>
|
|
|
|
void vpu_inst_lock(struct vpu_inst *inst);
|
|
void vpu_inst_unlock(struct vpu_inst *inst);
|
|
void vpu_set_buffer_state(struct vb2_v4l2_buffer *vbuf, unsigned int state);
|
|
unsigned int vpu_get_buffer_state(struct vb2_v4l2_buffer *vbuf);
|
|
|
|
int vpu_v4l2_open(struct file *file, struct vpu_inst *inst);
|
|
int vpu_v4l2_close(struct file *file);
|
|
|
|
u32 vpu_get_fmt_plane_size(struct vpu_format *fmt, u32 plane_no);
|
|
int vpu_try_fmt_common(struct vpu_inst *inst, struct v4l2_format *f, struct vpu_format *fmt);
|
|
int vpu_process_output_buffer(struct vpu_inst *inst);
|
|
int vpu_process_capture_buffer(struct vpu_inst *inst);
|
|
struct vb2_v4l2_buffer *vpu_next_src_buf(struct vpu_inst *inst);
|
|
void vpu_skip_frame(struct vpu_inst *inst, int count);
|
|
struct vb2_v4l2_buffer *vpu_find_buf_by_sequence(struct vpu_inst *inst, u32 type, u32 sequence);
|
|
struct vb2_v4l2_buffer *vpu_find_buf_by_idx(struct vpu_inst *inst, u32 type, u32 idx);
|
|
void vpu_v4l2_set_error(struct vpu_inst *inst);
|
|
int vpu_notify_eos(struct vpu_inst *inst);
|
|
int vpu_notify_source_change(struct vpu_inst *inst);
|
|
int vpu_set_last_buffer_dequeued(struct vpu_inst *inst, bool eos);
|
|
void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int type, enum vb2_buffer_state state);
|
|
int vpu_get_num_buffers(struct vpu_inst *inst, u32 type);
|
|
bool vpu_is_source_empty(struct vpu_inst *inst);
|
|
|
|
dma_addr_t vpu_get_vb_phy_addr(struct vb2_buffer *vb, u32 plane_no);
|
|
unsigned int vpu_get_vb_length(struct vb2_buffer *vb, u32 plane_no);
|
|
static inline struct vpu_format *vpu_get_format(struct vpu_inst *inst, u32 type)
|
|
{
|
|
if (V4L2_TYPE_IS_OUTPUT(type))
|
|
return &inst->out_format;
|
|
else
|
|
return &inst->cap_format;
|
|
}
|
|
|
|
static inline char *vpu_type_name(u32 type)
|
|
{
|
|
return V4L2_TYPE_IS_OUTPUT(type) ? "output" : "capture";
|
|
}
|
|
|
|
static inline int vpu_vb_is_codecconfig(struct vb2_v4l2_buffer *vbuf)
|
|
{
|
|
#ifdef V4L2_BUF_FLAG_CODECCONFIG
|
|
return (vbuf->flags & V4L2_BUF_FLAG_CODECCONFIG) ? 1 : 0;
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
#endif
|