extern int dmabuf_fd_install_data(int fd, void* data, u32 size);
extern bool is_v4l2_buf_file(struct file *file);
+static void aml_recycle_dma_buffers(struct aml_vcodec_ctx *ctx);
static ulong aml_vcodec_ctx_lock(struct aml_vcodec_ctx *ctx)
{
void trans_vframe_to_user(struct aml_vcodec_ctx *ctx, struct vdec_v4l2_buffer *fb)
{
struct aml_video_dec_buf *dstbuf = NULL;
+ struct vb2_buffer *vb2_buf = NULL;
struct vframe_s *vf = (struct vframe_s *)fb->vf_handle;
v4l_dbg(ctx, V4L_DEBUG_CODEC_OUTPUT,
fb->m.mem[2].addr, fb->m.mem[2].size);
dstbuf = container_of(fb, struct aml_video_dec_buf, frame_buffer);
+ vb2_buf = &dstbuf->vb.vb2_buf;
+
+ if (ctx->is_drm_mode && vb2_buf->memory == VB2_MEMORY_DMABUF)
+ aml_recycle_dma_buffers(ctx);
+
if (dstbuf->frame_buffer.num_planes == 1) {
vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 0, fb->m.mem[0].bytes_used);
} else if (dstbuf->frame_buffer.num_planes == 2) {
struct aml_video_dec_buf *aml_buf = NULL;
struct file *file = NULL;
- if (ctx->is_drm_mode && ctx->output_dma_mode)
- aml_recycle_dma_buffers(ctx);
-
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, buf->type);
vb2_v4l2 = to_vb2_v4l2_buffer(vq->bufs[buf->index]);
aml_buf = container_of(vb2_v4l2, struct aml_video_dec_buf, vb);
/*v4l_dbg(ctx, V4L_DEBUG_CODEC_EXINFO, "idx: %d, state: %d\n",
q->bufs[i]->index, q->bufs[i]->state);*/
}
- }
- ctx->buf_used_count = 0;
- ctx->cap_pool.in = 0;
- ctx->cap_pool.out = 0;
- ctx->cap_pool.dec = 0;
- ctx->cap_pool.vpp = 0;
+ ctx->buf_used_count = 0;
+ ctx->cap_pool.in = 0;
+ ctx->cap_pool.out = 0;
+ ctx->cap_pool.dec = 0;
+ ctx->cap_pool.vpp = 0;
+ }
}
static void m2mops_vdec_device_run(void *priv)