From cfef82949309ece00c5dc5389fd45ff45a2ef324 Mon Sep 17 00:00:00 2001 From: Ayoung Sim Date: Wed, 20 Jun 2018 16:47:18 +0900 Subject: [PATCH] [COMMON] media: mfc: DRV4.0: update prefix [MULTIFRAME] Change-Id: I667454a40f65755b628f4c0e2c8a08d987e9e753 Signed-off-by: Ayoung Sim --- .../media/platform/exynos/mfc/s5p_mfc_irq.c | 6 +++--- .../media/platform/exynos/mfc/s5p_mfc_nal_q.c | 10 ++++----- .../media/platform/exynos/mfc/s5p_mfc_queue.c | 21 +++++++++++-------- .../media/platform/exynos/mfc/s5p_mfc_queue.h | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index 9d7ec9aab1c1..08a9802573d2 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -543,8 +543,8 @@ static void mfc_handle_frame_input(struct s5p_mfc_ctx *ctx, unsigned int err) } /* 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; @@ -556,7 +556,7 @@ static void mfc_handle_frame_input(struct s5p_mfc_ctx *ctx, unsigned int err) 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(); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c index e4176dad4e9c..66f7cab945a6 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c @@ -80,7 +80,7 @@ int s5p_mfc_nal_q_check_enable(struct s5p_mfc_dev *dev) 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) { @@ -1439,7 +1439,7 @@ static void mfc_nal_q_handle_frame_input(struct s5p_mfc_ctx *ctx, unsigned int e /* 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"); @@ -1452,7 +1452,7 @@ static void mfc_nal_q_handle_frame_input(struct s5p_mfc_ctx *ctx, unsigned int e 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]; @@ -1539,10 +1539,10 @@ void mfc_nal_q_handle_frame(struct s5p_mfc_ctx *ctx, DecoderOutputStr *pOutStr) 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) { diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c index 379d7d43a228..f4b41303e957 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c @@ -114,29 +114,32 @@ struct s5p_mfc_buf *s5p_mfc_get_del_buf(spinlock_t *plock, struct s5p_mfc_buf_qu 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) && @@ -150,7 +153,7 @@ struct s5p_mfc_buf *s5p_mfc_get_del_if_consumed(spinlock_t *plock, struct s5p_mf *deleted = 1; } - spin_unlock_irqrestore(plock, flags); + spin_unlock_irqrestore(&ctx->buf_queue_lock, flags); return mfc_buf; } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h index ac7782e8bef1..8f50a27387a8 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h @@ -111,7 +111,7 @@ struct s5p_mfc_buf *s5p_mfc_get_buf(spinlock_t *plock, struct s5p_mfc_buf_queue 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, -- 2.20.1