[COMMON] media: mfc: DRV4.0: update prefix [MULTIFRAME]
authorAyoung Sim <a.sim@samsung.com>
Wed, 20 Jun 2018 07:47:18 +0000 (16:47 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 06:18:40 +0000 (15:18 +0900)
Change-Id: I667454a40f65755b628f4c0e2c8a08d987e9e753
Signed-off-by: Ayoung Sim <a.sim@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc_irq.c
drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c
drivers/media/platform/exynos/mfc/s5p_mfc_queue.c
drivers/media/platform/exynos/mfc/s5p_mfc_queue.h

index 9d7ec9aab1c1f3e3addf68927bc5091a94f893fd..08a9802573d2cd5584631b72f31a1c17fd0881b9 100644 (file)
@@ -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();
index e4176dad4e9c4cf8def604a1ea4f550ee0a7e428..66f7cab945a66f01b641b1340af3145eee49afca 100644 (file)
@@ -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) {
index 379d7d43a228efda899cf71e0a698a8bfaaa2135..f4b41303e957f8848785dcf29ae7aa9d885cc9dd 100644 (file)
@@ -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;
 }
 
index ac7782e8bef187d62f79c4c4e04b09c5f7b5b2b3..8f50a27387a8af798cd20550371603c65df84c7d 100644 (file)
@@ -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,