video: driver: buffer flow changes

When client queued a buffer, v4l2 framework
compares the client Dmabuf with the existing
dmabuf in the bufs array at the same index.
If the dmabuf is different then v4l2 framework
would call unmap_dmabuf, detach_dmabuf callbacks
for the old buffer and then calls attach_dmabuf,
map_dmabuf callbacks for the new buffer before
qbuf callback is made to driver. If the dmabuf
is same then qbuf callback will be made directly.

V4l2 framework expects that clients recycles the
same buffers in the same indices so that when
v4l2 framework compares dmabuf it won't unmap
or map buffers.

If client recycle the buffers in different indices
still usecase works but there will be unnecessary
unmap, map overhead will be incurred.

If client does not recycle the buffers at all,
meaning every time client queues new buffers
then special handling is required for decoder
output buffers which are used for reference by
video hardware.If any buffers are used by video
hardware as reference buffers then firmware returns
those buffers with READ_ONLY flag and they are kept
in read_only list and when read_only grows beyond
some limit then driver would ask firmware to release
those READ_ONLY buffers and when firmware responds
driver would delete these READ_ONLY buffers.

Change-Id: I8a0b11c986dd0b9464895498efd8c1831a754198
Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
Tento commit je obsažen v:
Darshana Patil
2022-08-25 19:37:50 -07:00
rodič 08b36416ce
revize 1ef323df29
11 změnil soubory, kde provedl 603 přidání a 400 odebrání

Zobrazit soubor

@@ -468,12 +468,14 @@ struct msm_vidc_allocations *msm_vidc_get_allocations(
const char *func);
struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
struct vb2_buffer *vb2);
int msm_vidc_allocate_buffers(struct msm_vidc_inst *inst,
enum msm_vidc_buffer_type buf_type, u32 num_buffers);
int msm_vidc_free_buffers(struct msm_vidc_inst *inst,
enum msm_vidc_buffer_type buf_type);
int msm_vidc_unmap_driver_buf(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf);
int msm_vidc_map_driver_buf(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf);
int msm_vidc_put_driver_buf(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf);
int msm_vidc_get_delayed_unmap(struct msm_vidc_inst *inst,
struct msm_vidc_map *map);
int msm_vidc_put_delayed_unmap(struct msm_vidc_inst *inst,
@@ -495,8 +497,8 @@ int msm_vidc_destroy_internal_buffer(struct msm_vidc_inst *inst,
void msm_vidc_destroy_buffers(struct msm_vidc_inst *inst);
int msm_vidc_flush_buffers(struct msm_vidc_inst* inst,
enum msm_vidc_buffer_type type);
int msm_vidc_flush_delayed_unmap_buffers(struct msm_vidc_inst *inst,
enum msm_vidc_buffer_type type);
int msm_vidc_flush_read_only_buffers(struct msm_vidc_inst *inst,
enum msm_vidc_buffer_type type);
struct msm_vidc_buffer *get_meta_buffer(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *vbuf);
struct msm_vidc_inst *get_inst_ref(struct msm_vidc_core *core,
@@ -598,5 +600,8 @@ int msm_vidc_get_input_rate(struct msm_vidc_inst *inst);
int msm_vidc_get_frame_rate(struct msm_vidc_inst *inst);
int msm_vidc_get_operating_rate(struct msm_vidc_inst *inst);
int msm_vidc_alloc_and_queue_input_internal_buffers(struct msm_vidc_inst *inst);
int vb2_buffer_to_driver(struct vb2_buffer *vb2, struct msm_vidc_buffer *buf);
struct msm_vidc_buffer *msm_vidc_fetch_buffer(struct msm_vidc_inst *inst,
struct vb2_buffer *vb2);
#endif // _MSM_VIDC_DRIVER_H_