}
/* Get the source buffer */
- src_mb = s5p_mfc_get_del_if_consumed(&ctx->buf_queue_lock, &ctx->src_buf_queue,
- consumed, STUFF_BYTE, err, &deleted);
+ src_mb = s5p_mfc_get_del_if_consumed(ctx, &ctx->src_buf_queue,
+ s5p_mfc_get_consumed_stream(), STUFF_BYTE, err, &deleted);
if (!src_mb) {
mfc_err_dev("no src buffers.\n");
return;
if (!deleted) {
/* Run MFC again on the same buffer */
- mfc_debug(2, "Running again the same buffer.\n");
+ mfc_debug(2, "[MULTIFRAME] Running again the same buffer\n");
if (CODEC_MULTIFRAME(ctx))
dec->y_addr_for_pb = (dma_addr_t)s5p_mfc_get_dec_y_addr();
return 0;
}
if ((dec->has_multiframe && CODEC_MULTIFRAME(temp_ctx)) || dec->consumed) {
- mfc_debug(2, "There is a multi frame or consumed header.\n");
+ mfc_debug(2, "[MULTIFRAME] There is a multi frame or consumed header\n");
return 0;
}
if (dec->is_dpb_full) {
/* Check multi-frame */
consumed = pOutStr->DecodedNalSize;
- src_mb = s5p_mfc_get_del_if_consumed(&ctx->buf_queue_lock, &ctx->src_buf_nal_queue,
+ src_mb = s5p_mfc_get_del_if_consumed(ctx, &ctx->src_buf_nal_queue,
consumed, STUFF_BYTE, err, &deleted);
if (!src_mb) {
mfc_err_dev("no src buffers.\n");
if (!deleted) {
/* Run MFC again on the same buffer */
- mfc_debug(2, "NAL Q: Running again the same buffer.\n");
+ mfc_debug(2, "NAL Q:[MULTIFRAME] Running again the same buffer.\n");
if (CODEC_MULTIFRAME(ctx))
dec->y_addr_for_pb = (dma_addr_t)pOutStr->DecodedAddr[0];
goto leave_handle_frame;
}
if (need_empty_dpb) {
- mfc_debug(2, "NAL Q: There is multi-frame. consumed:%ld\n", dec->consumed);
+ mfc_debug(2, "NAL Q:[MULTIFRAME] There is multi-frame. consumed:%ld\n", dec->consumed);
dec->has_multiframe = 1;
dev->nal_q_handle->nal_q_exception = 1;
- mfc_info_ctx("NAL Q: nal_q_exception is set (multi-frame)\n");
+ mfc_info_ctx("NAL Q:[MULTIFRAME] nal_q_exception is set\n");
goto leave_handle_frame;
}
if (need_dpb_change || need_scratch_change) {
return mfc_buf;
}
-struct s5p_mfc_buf *s5p_mfc_get_del_if_consumed(spinlock_t *plock, struct s5p_mfc_buf_queue *queue,
+struct s5p_mfc_buf *s5p_mfc_get_del_if_consumed(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf_queue *queue,
unsigned long consumed, unsigned int min_bytes, int error, int *deleted)
{
unsigned long flags;
struct s5p_mfc_buf *mfc_buf = NULL;
- unsigned int remained;
+ struct s5p_mfc_dec *dec = ctx->dec_priv;
+ unsigned long remained;
- spin_lock_irqsave(plock, flags);
+ spin_lock_irqsave(&ctx->buf_queue_lock, flags);
if (list_empty(&queue->head)) {
mfc_debug(2, "queue is empty\n");
- spin_unlock_irqrestore(plock, flags);
+ spin_unlock_irqrestore(&ctx->buf_queue_lock, flags);
return NULL;
}
mfc_buf = list_entry(queue->head.next, struct s5p_mfc_buf, list);
- mfc_debug(2, "mfc_buf: 0x%p\n", mfc_buf);
- mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0][0]);
+ mfc_debug(4, "First plane address: 0x%08llx\n", mfc_buf->addr[0][0]);
- remained = (unsigned int)(mfc_buf->vb.vb2_buf.planes[0].bytesused - consumed);
+ if (dec->remained_size)
+ remained = dec->remained_size - consumed;
+ else
+ remained = mfc_buf->vb.vb2_buf.planes[0].bytesused - consumed;
- mfc_debug(2, "Packed PB test. Total Size: %d, consumed: %ld, remained: %d\n",
+ mfc_debug(2, "[MULTIFRAME] Total Size: %d, consumed: %ld, remained: %ld\n",
mfc_buf->vb.vb2_buf.planes[0].bytesused, consumed, remained);
if ((consumed > 0) && (remained > min_bytes) && (error == 0) &&
*deleted = 1;
}
- spin_unlock_irqrestore(plock, flags);
+ spin_unlock_irqrestore(&ctx->buf_queue_lock, flags);
return mfc_buf;
}
enum s5p_mfc_queue_used_type used);
struct s5p_mfc_buf *s5p_mfc_get_del_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *queue,
enum s5p_mfc_queue_used_type used);
-struct s5p_mfc_buf *s5p_mfc_get_del_if_consumed(spinlock_t *plock, struct s5p_mfc_buf_queue *queue,
+struct s5p_mfc_buf *s5p_mfc_get_del_if_consumed(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf_queue *queue,
unsigned long consumed, unsigned int min_bytes, int err, int *deleted);
struct s5p_mfc_buf *s5p_mfc_get_move_buf(spinlock_t *plock,
struct s5p_mfc_buf_queue *to_queue, struct s5p_mfc_buf_queue *from_queue,