From: Jeonghee Kim Date: Fri, 19 Jan 2018 07:44:18 +0000 (+0900) Subject: media: mfc: use the address in struct s5p_mfc_buf X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7d6ed3ed72cdc019c731be27e048d74ac29f6a27;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git media: mfc: use the address in struct s5p_mfc_buf We will use the variable(struct s5p_mfc_buf -> addr[])all the time, after we got the address from videobuf2 once. Change-Id: I00057a270bc0ede781ba203af56f453169368f0a Signed-off-by: Ayoung Sim Signed-off-by: Jeonghee Kim --- diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h index cf7c2c1b80a1..c6a6c0041cb9 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h @@ -222,10 +222,7 @@ struct s5p_mfc_debug { struct s5p_mfc_buf { struct vb2_v4l2_buffer vb; struct list_head list; - union { - dma_addr_t raw[3]; - dma_addr_t stream; - } planes; + dma_addr_t addr[MFC_MAX_PLANES]; int used; unsigned char *vir_addr; }; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c b/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c index 7932a978d636..f3e77bb27529 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_dec_vb2_ops.c @@ -181,26 +181,26 @@ static int s5p_mfc_dec_buf_init(struct vb2_buffer *vb) start_raw = s5p_mfc_mem_get_daddr_vb(vb, 0); if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV12N) { - buf->planes.raw[0] = start_raw; - buf->planes.raw[1] = NV12N_CBCR_BASE(start_raw, + buf->addr[0] = start_raw; + buf->addr[1] = NV12N_CBCR_BASE(start_raw, ctx->img_width, ctx->img_height); } else if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV12N_10B) { - buf->planes.raw[0] = start_raw; - buf->planes.raw[1] = NV12N_10B_CBCR_BASE(start_raw, + buf->addr[0] = start_raw; + buf->addr[1] = NV12N_10B_CBCR_BASE(start_raw, ctx->img_width, ctx->img_height); } else if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420N) { - buf->planes.raw[0] = start_raw; - buf->planes.raw[1] = YUV420N_CB_BASE(start_raw, + buf->addr[0] = start_raw; + buf->addr[1] = YUV420N_CB_BASE(start_raw, ctx->img_width, ctx->img_height); - buf->planes.raw[2] = YUV420N_CR_BASE(start_raw, + buf->addr[2] = YUV420N_CR_BASE(start_raw, ctx->img_width, ctx->img_height); } else { for (i = 0; i < ctx->dst_fmt->mem_planes; i++) - buf->planes.raw[i] = s5p_mfc_mem_get_daddr_vb(vb, i); + buf->addr[i] = s5p_mfc_mem_get_daddr_vb(vb, i); } if (call_cop(ctx, init_buf_ctrls, ctx, MFC_CTRL_TYPE_DST, @@ -211,7 +211,7 @@ static int s5p_mfc_dec_buf_init(struct vb2_buffer *vb) if (ret < 0) return ret; - buf->planes.stream = s5p_mfc_mem_get_daddr_vb(vb, 0); + buf->addr[0] = s5p_mfc_mem_get_daddr_vb(vb, 0); if (call_cop(ctx, init_buf_ctrls, ctx, MFC_CTRL_TYPE_SRC, vb->index) < 0) @@ -584,7 +584,7 @@ static void s5p_mfc_dec_buf_queue(struct vb2_buffer *vb) mfc_debug(2, "Src queue: %p\n", &ctx->src_buf_queue); mfc_debug(2, "Adding to src: %p (0x%08llx, 0x%08llx)\n", vb, s5p_mfc_mem_get_daddr_vb(vb, 0), - buf->planes.stream); + buf->addr[0]); if (dec->dst_memtype == V4L2_MEMORY_DMABUF && ctx->state < MFCINST_HEAD_PARSED && !ctx->is_drm) { stream_vir = vb2_plane_vaddr(vb, 0); @@ -595,7 +595,7 @@ static void s5p_mfc_dec_buf_queue(struct vb2_buffer *vb) s5p_mfc_add_tail_buf(&ctx->buf_queue_lock, &ctx->src_buf_queue, buf); MFC_TRACE_CTX("Q src[%d] fd: %d, %#llx\n", - vb->index, vb->planes[0].m.fd, buf->planes.stream); + vb->index, vb->planes[0].m.fd, buf->addr[0]); } else if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { index = vb->index; mfc_debug(2, "Dst queue: %p\n", &ctx->dst_buf_queue); @@ -603,7 +603,7 @@ static void s5p_mfc_dec_buf_queue(struct vb2_buffer *vb) s5p_mfc_mem_get_daddr_vb(vb, 0)); for (i = 0; i < ctx->dst_fmt->num_planes; i++) mfc_debug(2, "dec dst plane[%d]: %08llx\n", - i, buf->planes.raw[i]); + i, buf->addr[i]); s5p_mfc_store_dpb(ctx, vb); if ((dec->dst_memtype == V4L2_MEMORY_USERPTR || dec->dst_memtype == V4L2_MEMORY_DMABUF) && @@ -612,7 +612,7 @@ static void s5p_mfc_dec_buf_queue(struct vb2_buffer *vb) ctx->capture_state = QUEUE_BUFS_MMAPED; MFC_TRACE_CTX("Q dst[%d] fd: %d, %#llx / avail %#lx used %#x\n", - index, vb->planes[0].m.fd, buf->planes.raw[0], + index, vb->planes[0].m.fd, buf->addr[0], dec->available_dpb, dec->dynamic_used); } else { mfc_err_ctx("Unsupported buffer type (%d)\n", vq->type); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c index 35033700291f..cb4d4c9a1ec3 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_vb2_ops.c @@ -134,7 +134,7 @@ static int s5p_mfc_enc_buf_init(struct vb2_buffer *vb) if (ret < 0) return ret; - buf->planes.stream = s5p_mfc_mem_get_daddr_vb(vb, 0); + buf->addr[0] = s5p_mfc_mem_get_daddr_vb(vb, 0); if (call_cop(ctx, init_buf_ctrls, ctx, MFC_CTRL_TYPE_DST, vb->index) < 0) @@ -151,21 +151,21 @@ static int s5p_mfc_enc_buf_init(struct vb2_buffer *vb) return -ENOMEM; } if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_NV12N) { - buf->planes.raw[0] = start_raw; - buf->planes.raw[1] = NV12N_CBCR_BASE(start_raw, + buf->addr[0] = start_raw; + buf->addr[1] = NV12N_CBCR_BASE(start_raw, ctx->img_width, ctx->img_height); } else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420N) { - buf->planes.raw[0] = start_raw; - buf->planes.raw[1] = YUV420N_CB_BASE(start_raw, + buf->addr[0] = start_raw; + buf->addr[1] = YUV420N_CB_BASE(start_raw, ctx->img_width, ctx->img_height); - buf->planes.raw[2] = YUV420N_CR_BASE(start_raw, + buf->addr[2] = YUV420N_CR_BASE(start_raw, ctx->img_width, ctx->img_height); } else { for (i = 0; i < ctx->src_fmt->num_planes; i++) - buf->planes.raw[i] = s5p_mfc_mem_get_daddr_vb(vb, i); + buf->addr[i] = s5p_mfc_mem_get_daddr_vb(vb, i); } if (call_cop(ctx, init_buf_ctrls, ctx, MFC_CTRL_TYPE_SRC, @@ -377,9 +377,7 @@ static void s5p_mfc_enc_buf_queue(struct vb2_buffer *vb) if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { mfc_debug(2, "dst queue: %p\n", &ctx->dst_buf_queue); - mfc_debug(2, "Adding to dst: %p (%08llx, %08llx)\n", vb, - s5p_mfc_mem_get_daddr_vb(vb, 0), - buf->planes.stream); + mfc_debug(2, "Adding to dst vb: %p, addr: %08llx\n", vb, buf->addr[0]); /* Mark destination as available for use by MFC */ s5p_mfc_add_tail_buf(&ctx->buf_queue_lock, &ctx->dst_buf_queue, buf); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c index 8cb8001241e0..19325d0c4782 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_irq.c @@ -172,8 +172,7 @@ static void mfc_handle_frame_copy_timestamp(struct s5p_mfc_ctx *ctx) return; } - ref_mb = s5p_mfc_find_buf_vb(&ctx->buf_queue_lock, - &ctx->ref_buf_queue, dec_y_addr); + ref_mb = s5p_mfc_find_buf(&ctx->buf_queue_lock, &ctx->ref_buf_queue, dec_y_addr); if (ref_mb) ref_mb->vb.vb2_buf.timestamp = src_mb->vb.vb2_buf.timestamp; } @@ -186,13 +185,13 @@ static void mfc_handle_frame_output_move(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *ref_mb; int index; - ref_mb = s5p_mfc_find_move_buf_vb(&ctx->buf_queue_lock, + ref_mb = s5p_mfc_find_move_buf(&ctx->buf_queue_lock, &ctx->dst_buf_queue, &ctx->ref_buf_queue, dspl_y_addr, released_flag); if (ref_mb) { mfc_debug(2, "Listing: %d\n", ref_mb->vb.vb2_buf.index); /* Check if this is the buffer we're looking for */ mfc_debug(2, "Found 0x%08llx, looking for 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&ref_mb->vb.vb2_buf, 0), dspl_y_addr); + ref_mb->addr[0], dspl_y_addr); index = ref_mb->vb.vb2_buf.index; @@ -247,13 +246,13 @@ static void mfc_handle_frame_output_del(struct s5p_mfc_ctx *ctx, frame_type = s5p_mfc_get_disp_frame_type(); } - ref_mb = s5p_mfc_find_del_buf_vb(&ctx->buf_queue_lock, + ref_mb = s5p_mfc_find_del_buf(&ctx->buf_queue_lock, &ctx->ref_buf_queue, dspl_y_addr); if (ref_mb) { mfc_debug(2, "Listing: %d\n", ref_mb->vb.vb2_buf.index); /* Check if this is the buffer we're looking for */ mfc_debug(2, "Found 0x%08llx, looking for 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&ref_mb->vb.vb2_buf, 0), dspl_y_addr); + ref_mb->addr[0], dspl_y_addr); index = ref_mb->vb.vb2_buf.index; @@ -480,11 +479,11 @@ static void mfc_handle_ref_frame(struct s5p_mfc_ctx *ctx) dec_addr = (dma_addr_t)s5p_mfc_get_dec_y_addr(); /* Try to search decoded address in whole dst queue */ - dst_mb = s5p_mfc_find_move_buf_vb_used(&ctx->buf_queue_lock, + dst_mb = s5p_mfc_find_move_buf_used(&ctx->buf_queue_lock, &ctx->ref_buf_queue, &ctx->dst_buf_queue, dec_addr); if (dst_mb) { mfc_debug(2, "Found in dst queue = 0x%08llx, buf = 0x%08llx\n", - dec_addr, s5p_mfc_mem_get_daddr_vb(&dst_mb->vb.vb2_buf, 0)); + dec_addr, dst_mb->addr[0]); if (!(dec->dynamic_set & s5p_mfc_get_dec_used_flag())) dec->dynamic_used |= dec->dynamic_set; @@ -776,7 +775,7 @@ static void mfc_handle_stream_input(struct s5p_mfc_ctx *ctx, int slice_type) mfc_debug(2, "encoded[%d] addr: 0x%08llx\n", i, enc_addr[i]); - src_mb = s5p_mfc_find_del_buf_raw(&ctx->buf_queue_lock, + src_mb = s5p_mfc_find_del_buf(&ctx->buf_queue_lock, &ctx->src_buf_queue, enc_addr[0]); if (src_mb) { index = src_mb->vb.vb2_buf.index; @@ -791,7 +790,7 @@ static void mfc_handle_stream_input(struct s5p_mfc_ctx *ctx, int slice_type) s5p_mfc_raw_unprotect(ctx, src_mb, index); } - ref_mb = s5p_mfc_find_del_buf_raw(&ctx->buf_queue_lock, + ref_mb = s5p_mfc_find_del_buf(&ctx->buf_queue_lock, &ctx->ref_buf_queue, enc_addr[0]); if (ref_mb) { vb2_buffer_done(&ref_mb->vb.vb2_buf, VB2_BUF_STATE_DONE); 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 0b38b6d03ace..9cb790bca93b 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c @@ -596,7 +596,7 @@ static int mfc_nal_q_run_in_buf_enc(struct s5p_mfc_ctx *ctx, EncoderInputStr *pI } for (i = 0; i < raw->num_planes; i++) { - src_addr[i] = s5p_mfc_mem_get_daddr_vb(&src_mb->vb.vb2_buf, i); + src_addr[i] = src_mb->addr[i]; mfc_debug(2, "NAL Q: enc src[%d] addr: 0x%08llx\n", i, src_addr[i]); } @@ -628,7 +628,7 @@ static int mfc_nal_q_run_in_buf_enc(struct s5p_mfc_ctx *ctx, EncoderInputStr *pI return -EAGAIN; } - pInStr->StreamBufferAddr = s5p_mfc_mem_get_daddr_vb(&dst_mb->vb.vb2_buf, 0); + pInStr->StreamBufferAddr = dst_mb->addr[0]; pInStr->StreamBufferSize = (unsigned int)vb2_plane_size(&dst_mb->vb.vb2_buf, 0); pInStr->StreamBufferSize = ALIGN(pInStr->StreamBufferSize, 512); @@ -711,7 +711,7 @@ static int mfc_nal_q_run_in_buf_dec(struct s5p_mfc_ctx *ctx, DecoderInputStr *pI } /* src buffer setting */ - buf_addr = s5p_mfc_mem_get_daddr_vb(&src_mb->vb.vb2_buf, 0); + buf_addr = src_mb->addr[0]; strm_size = src_mb->vb.vb2_buf.planes[0].bytesused; cpb_buf_size = ALIGN(dec->src_buf_size, STREAM_BUF_ALIGN); mfc_debug(2, "NAL Q: Src addr: 0x%08llx, size: %d\n", buf_addr, strm_size); @@ -743,10 +743,10 @@ static int mfc_nal_q_run_in_buf_dec(struct s5p_mfc_ctx *ctx, DecoderInputStr *pI for (i = 0; i < raw->num_planes; i++) { pInStr->FrameSize[i] = raw->plane_size[i]; - pInStr->FrameAddr[i] = dst_mb->planes.raw[i]; + pInStr->FrameAddr[i] = dst_mb->addr[i]; } mfc_debug(2, "NAL Q: dst addr[0]: 0x%08llx\n", - dst_mb->planes.raw[0]); + dst_mb->addr[0]); pInStr->ScratchBufAddr = ctx->codec_buf.daddr; pInStr->ScratchBufSize = ctx->scratch_buf_size; @@ -763,7 +763,7 @@ static int mfc_nal_q_run_in_buf_dec(struct s5p_mfc_ctx *ctx, DecoderInputStr *pI pInStr->AvailableDpbFlagLower = dec->dynamic_set; MFC_TRACE_CTX("Set dst[%d] fd: %d, %#llx / avail %#lx used %#x\n", - dst_index, dst_mb->vb.vb2_buf.planes[0].m.fd, dst_mb->planes.raw[0], + dst_index, dst_mb->vb.vb2_buf.planes[0].m.fd, dst_mb->addr[0], dec->available_dpb, dec->dynamic_used); mfc_debug_leave(); @@ -879,7 +879,7 @@ static void mfc_nal_q_handle_stream(struct s5p_mfc_ctx *ctx, EncoderOutputStr *p mfc_debug(2, "NAL Q: encoded[%d] addr: 0x%08llx\n", i, enc_addr[i]); - src_mb = s5p_mfc_find_del_buf_vb(&ctx->buf_queue_lock, + src_mb = s5p_mfc_find_del_buf(&ctx->buf_queue_lock, &ctx->src_buf_nal_queue, enc_addr[0]); if (!src_mb) { mfc_err_dev("NAL Q: no src buffers\n"); @@ -888,7 +888,7 @@ static void mfc_nal_q_handle_stream(struct s5p_mfc_ctx *ctx, EncoderOutputStr *p vb2_buffer_done(&src_mb->vb.vb2_buf, VB2_BUF_STATE_DONE); - ref_mb = s5p_mfc_find_del_buf_vb(&ctx->buf_queue_lock, + ref_mb = s5p_mfc_find_del_buf(&ctx->buf_queue_lock, &ctx->ref_buf_queue, enc_addr[0]); if (ref_mb) vb2_buffer_done(&ref_mb->vb.vb2_buf, VB2_BUF_STATE_DONE); @@ -983,10 +983,10 @@ static void mfc_nal_q_handle_ref_frame(struct s5p_mfc_ctx *ctx, DecoderOutputStr mfc_debug(2, "NAL Q: dec addr: 0x%08llx, disp addr: 0x%08llx\n", dec_addr, disp_addr); - dst_mb = s5p_mfc_find_move_buf_vb_used(&ctx->buf_queue_lock, + dst_mb = s5p_mfc_find_move_buf_used(&ctx->buf_queue_lock, &ctx->ref_buf_queue, &ctx->dst_buf_nal_queue, dec_addr); if (dst_mb) { - buf_addr = s5p_mfc_mem_get_daddr_vb(&dst_mb->vb.vb2_buf, 0); + buf_addr = dst_mb->addr[0]; mfc_debug(2, "NAL Q: Found in dst queue, " "dec addr: 0x%08llx, buf addr: 0x%08llx, used: %d\n", dec_addr, buf_addr, dst_mb->used); @@ -1027,8 +1027,7 @@ static void mfc_nal_q_handle_frame_copy_timestamp(struct s5p_mfc_ctx *ctx, Decod return; } - ref_mb = s5p_mfc_find_buf_vb(&ctx->buf_queue_lock, - &ctx->ref_buf_queue, dec_y_addr); + ref_mb = s5p_mfc_find_buf(&ctx->buf_queue_lock, &ctx->ref_buf_queue, dec_y_addr); if (ref_mb) ref_mb->vb.vb2_buf.timestamp = src_mb->vb.vb2_buf.timestamp; @@ -1043,13 +1042,13 @@ static void mfc_nal_q_handle_frame_output_move(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *dst_mb; unsigned int index; - dst_mb = s5p_mfc_find_move_buf_vb(&ctx->buf_queue_lock, + dst_mb = s5p_mfc_find_move_buf(&ctx->buf_queue_lock, &ctx->dst_buf_queue, &ctx->ref_buf_queue, dspl_y_addr, released_flag); if (dst_mb) { mfc_debug(2, "NAL Q: find display buf, index: %d\n", dst_mb->vb.vb2_buf.index); /* Check if this is the buffer we're looking for */ mfc_debug(2, "NAL Q: buf addr: 0x%08llx, disp addr: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&dst_mb->vb.vb2_buf, 0), dspl_y_addr); + dst_mb->addr[0], dspl_y_addr); index = dst_mb->vb.vb2_buf.index; @@ -1106,13 +1105,13 @@ static void mfc_nal_q_handle_frame_output_del(struct s5p_mfc_ctx *ctx, frame_type = pOutStr->DisplayFrameType & S5P_FIMV_DISPLAY_FRAME_MASK; } - ref_mb = s5p_mfc_find_del_buf_vb(&ctx->buf_queue_lock, + ref_mb = s5p_mfc_find_del_buf(&ctx->buf_queue_lock, &ctx->ref_buf_queue, dspl_y_addr); if (ref_mb) { mfc_debug(2, "NAL Q: find display buf, index: %d\n", ref_mb->vb.vb2_buf.index); /* Check if this is the buffer we're looking for */ mfc_debug(2, "NAL Q: buf addr: 0x%08llx, disp addr: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&ref_mb->vb.vb2_buf, 0), dspl_y_addr); + ref_mb->addr[0], dspl_y_addr); index = ref_mb->vb.vb2_buf.index; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_opr.c b/drivers/media/platform/exynos/mfc/s5p_mfc_opr.c index 994b3c291ab8..07d1223275fe 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_opr.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_opr.c @@ -62,7 +62,7 @@ int s5p_mfc_run_dec_init(struct s5p_mfc_ctx *ctx) 0, src_mb->vb.vb2_buf.planes[0].bytesused); } - mfc_debug(2, "Header addr: 0x%08llx\n", s5p_mfc_mem_get_daddr_vb(&src_mb->vb.vb2_buf, 0)); + mfc_debug(2, "Header addr: 0x%08llx\n", src_mb->addr[0]); s5p_mfc_clean_ctx_int_flags(ctx); s5p_mfc_init_decode(ctx); @@ -235,7 +235,7 @@ int s5p_mfc_run_enc_init(struct s5p_mfc_ctx *ctx) s5p_mfc_set_enc_stride(ctx); - mfc_debug(2, "Header addr: 0x%08llx\n", s5p_mfc_mem_get_daddr_vb(&dst_mb->vb.vb2_buf, 0)); + mfc_debug(2, "Header addr: 0x%08llx\n", dst_mb->addr[0]); s5p_mfc_clean_ctx_int_flags(ctx); ret = s5p_mfc_init_encode(ctx); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c index a045496c3062..19193d3d4b40 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.c @@ -56,8 +56,7 @@ int s5p_mfc_peek_buf_csd(spinlock_t *plock, struct s5p_mfc_buf_queue *queue) csd = mfc_buf->vb.reserved2 & FLAG_CSD ? 1 : 0; mfc_debug(2, "mfc_buf: %p\n", mfc_buf); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); spin_unlock_irqrestore(plock, flags); return csd; @@ -83,8 +82,7 @@ struct s5p_mfc_buf *s5p_mfc_get_buf(spinlock_t *plock, struct s5p_mfc_buf_queue mfc_buf->used = used; mfc_debug(2, "mfc_buf: %p\n", mfc_buf); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); spin_unlock_irqrestore(plock, flags); return mfc_buf; @@ -110,8 +108,7 @@ struct s5p_mfc_buf *s5p_mfc_get_del_buf(spinlock_t *plock, struct s5p_mfc_buf_qu mfc_buf->used = used; mfc_debug(2, "mfc_buf: %p\n", mfc_buf); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); list_del(&mfc_buf->list); queue->count--; @@ -138,8 +135,7 @@ struct s5p_mfc_buf *s5p_mfc_get_del_if_consumed(spinlock_t *plock, struct s5p_mf mfc_buf = list_entry(queue->head.next, struct s5p_mfc_buf, list); mfc_debug(2, "mfc_buf: %p\n", mfc_buf); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); remained = (unsigned int)(mfc_buf->vb.vb2_buf.planes[0].bytesused - consumed); @@ -182,8 +178,7 @@ struct s5p_mfc_buf *s5p_mfc_get_move_buf(spinlock_t *plock, mfc_buf->used = used; mfc_debug(2, "mfc_buf: %p\n", mfc_buf); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); list_del(&mfc_buf->list); from_queue->count--; @@ -217,8 +212,7 @@ struct s5p_mfc_buf *s5p_mfc_get_move_buf_used(spinlock_t *plock, if (mfc_buf->used) { mfc_debug(2, "mfc_buf: %p\n", mfc_buf); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); list_del(&mfc_buf->list); from_queue->count--; @@ -251,9 +245,8 @@ struct s5p_mfc_buf *s5p_mfc_get_move_buf_addr(spinlock_t *plock, mfc_buf = list_entry(from_queue->head.next, struct s5p_mfc_buf, list); - if (s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0) == addr) { - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)); + if (mfc_buf->addr[0] == addr) { + mfc_debug(2, "First plane address: 0x%08llx\n", mfc_buf->addr[0]); list_del(&mfc_buf->list); from_queue->count--; @@ -269,7 +262,7 @@ struct s5p_mfc_buf *s5p_mfc_get_move_buf_addr(spinlock_t *plock, } } -struct s5p_mfc_buf *s5p_mfc_find_buf_vb(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, +struct s5p_mfc_buf *s5p_mfc_find_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, dma_addr_t addr) { unsigned long flags; @@ -280,7 +273,7 @@ struct s5p_mfc_buf *s5p_mfc_find_buf_vb(spinlock_t *plock, struct s5p_mfc_buf_qu mfc_debug(2, "Looking for this address: 0x%08llx\n", addr); list_for_each_entry(mfc_buf, &queue->head, list) { - mb_addr = s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0); + mb_addr = mfc_buf->addr[0]; mfc_debug(2, "plane[0] addr: 0x%08llx\n", mb_addr); if (addr == mb_addr) { @@ -293,7 +286,7 @@ struct s5p_mfc_buf *s5p_mfc_find_buf_vb(spinlock_t *plock, struct s5p_mfc_buf_qu return NULL; } -struct s5p_mfc_buf *s5p_mfc_find_del_buf_raw(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, +struct s5p_mfc_buf *s5p_mfc_find_del_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, dma_addr_t addr) { unsigned long flags; @@ -305,7 +298,7 @@ struct s5p_mfc_buf *s5p_mfc_find_del_buf_raw(spinlock_t *plock, struct s5p_mfc_b mfc_debug(2, "Looking for this address: 0x%08llx\n", addr); list_for_each_entry(mfc_buf, &queue->head, list) { - mb_addr = mfc_buf->planes.raw[0]; + mb_addr = mfc_buf->addr[0]; mfc_debug(2, "plane[0] addr: 0x%08llx\n", mb_addr); if (addr == mb_addr) { @@ -326,40 +319,7 @@ struct s5p_mfc_buf *s5p_mfc_find_del_buf_raw(spinlock_t *plock, struct s5p_mfc_b } } -struct s5p_mfc_buf *s5p_mfc_find_del_buf_vb(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, - dma_addr_t addr) -{ - unsigned long flags; - struct s5p_mfc_buf *mfc_buf = NULL; - dma_addr_t mb_addr; - int found = 0; - - spin_lock_irqsave(plock, flags); - - mfc_debug(2, "Looking for this address: 0x%08llx\n", addr); - list_for_each_entry(mfc_buf, &queue->head, list) { - mb_addr = s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0); - mfc_debug(2, "plane[0] addr: 0x%08llx\n", mb_addr); - - if (addr == mb_addr) { - found = 1; - break; - } - } - - if (found == 1) { - list_del(&mfc_buf->list); - queue->count--; - - spin_unlock_irqrestore(plock, flags); - return mfc_buf; - } else { - spin_unlock_irqrestore(plock, flags); - return NULL; - } -} - -struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb(spinlock_t *plock, +struct s5p_mfc_buf *s5p_mfc_find_move_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *to_queue, struct s5p_mfc_buf_queue *from_queue, dma_addr_t addr, unsigned int released_flag) { @@ -372,7 +332,7 @@ struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb(spinlock_t *plock, mfc_debug(2, "Looking for this address: 0x%08llx\n", addr); list_for_each_entry(mfc_buf, &from_queue->head, list) { - mb_addr = s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0); + mb_addr = mfc_buf->addr[0]; mfc_debug(2, "plane[0] addr: 0x%08llx\n", mb_addr); if (addr == mb_addr) { @@ -398,7 +358,7 @@ struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb(spinlock_t *plock, } } -struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb_used(spinlock_t *plock, +struct s5p_mfc_buf *s5p_mfc_find_move_buf_used(spinlock_t *plock, struct s5p_mfc_buf_queue *to_queue, struct s5p_mfc_buf_queue *from_queue, dma_addr_t addr) { @@ -411,7 +371,7 @@ struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb_used(spinlock_t *plock, mfc_debug(2, "Looking for this address: 0x%08llx\n", addr); list_for_each_entry(mfc_buf, &from_queue->head, list) { - mb_addr = s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0); + mb_addr = mfc_buf->addr[0]; mfc_debug(2, "plane[0] addr: 0x%08llx, used: %d\n", mb_addr, mfc_buf->used); @@ -940,8 +900,7 @@ int s5p_mfc_is_last_frame(struct s5p_mfc_ctx *ctx) src_mb = list_entry(ctx->src_buf_queue.head.next, struct s5p_mfc_buf, list); mfc_debug(2, "mfc_buf: %p\n", src_mb); - mfc_debug(2, "First plane address: 0x%08llx\n", - s5p_mfc_mem_get_daddr_vb(&src_mb->vb.vb2_buf, 0)); + mfc_debug(2, "First plane address: 0x%08llx\n", src_mb->addr[0]); if (src_mb->vb.reserved2 & FLAG_LAST_FRAME) { mfc_debug(2, "last frame!\n"); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h index 0c7fde4ed464..d6dadedc22dc 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_queue.h @@ -122,16 +122,14 @@ struct s5p_mfc_buf *s5p_mfc_get_move_buf_addr(spinlock_t *plock, struct s5p_mfc_buf_queue *to_queue, struct s5p_mfc_buf_queue *from_queue, dma_addr_t addr); -struct s5p_mfc_buf *s5p_mfc_find_buf_vb(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, +struct s5p_mfc_buf *s5p_mfc_find_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, dma_addr_t addr); -struct s5p_mfc_buf *s5p_mfc_find_del_buf_raw(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, +struct s5p_mfc_buf *s5p_mfc_find_del_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, dma_addr_t addr); -struct s5p_mfc_buf *s5p_mfc_find_del_buf_vb(spinlock_t *plock, struct s5p_mfc_buf_queue *queue, - dma_addr_t addr); -struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb(spinlock_t *plock, +struct s5p_mfc_buf *s5p_mfc_find_move_buf(spinlock_t *plock, struct s5p_mfc_buf_queue *to_queue, struct s5p_mfc_buf_queue *from_queue, dma_addr_t addr, unsigned int released_flag); -struct s5p_mfc_buf *s5p_mfc_find_move_buf_vb_used(spinlock_t *plock, +struct s5p_mfc_buf *s5p_mfc_find_move_buf_used(spinlock_t *plock, struct s5p_mfc_buf_queue *to_queue, struct s5p_mfc_buf_queue *from_queue, dma_addr_t addr); diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c b/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c index 113e9de06362..13aeac2b3ca4 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c @@ -310,7 +310,7 @@ int s5p_mfc_set_dec_stream_buffer(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *m cpb_buf_size = ALIGN(dec->src_buf_size, STREAM_BUF_ALIGN); if (mfc_buf) { - addr = s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0); + addr = mfc_buf->addr[0]; if (strm_size > set_strm_size_max(cpb_buf_size)) { mfc_info_ctx("Decrease strm_size because of %d align: %u -> %u\n", STREAM_BUF_ALIGN, strm_size, set_strm_size_max(cpb_buf_size)); @@ -353,14 +353,9 @@ void s5p_mfc_set_enc_frame_buffer(struct s5p_mfc_ctx *ctx, if (mfc_buf) { for (i = 0; i < num_planes; i++) { - addr[i] = mfc_buf->planes.raw[i]; + addr[i] = mfc_buf->addr[i]; mfc_debug(2, "enc src[%d] addr: 0x%08llx\n", i, addr[i]); } - - if (mfc_buf->planes.raw[0] != s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0)) - mfc_err_ctx("enc src yaddr: 0x%08llx != vb2 yaddr: 0x%08llx\n", - mfc_buf->planes.raw[i], - s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, i)); } for (i = 0; i < num_planes; i++) @@ -391,7 +386,7 @@ int s5p_mfc_set_enc_stream_buffer(struct s5p_mfc_ctx *ctx, dma_addr_t addr; unsigned int size, offset; - addr = s5p_mfc_mem_get_daddr_vb(&mfc_buf->vb.vb2_buf, 0); + addr = mfc_buf->addr[0]; offset = mfc_buf->vb.vb2_buf.planes[0].data_offset; size = (unsigned int)vb2_plane_size(&mfc_buf->vb.vb2_buf, 0); size = ALIGN(size, 512); @@ -450,13 +445,13 @@ int s5p_mfc_set_dynamic_dpb(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *dst_mb) set_bit(dst_index, &dec->available_dpb); dec->dynamic_set = 1 << dst_index; mfc_debug(2, "ADDING Flag after: 0x%lx\n", dec->available_dpb); - mfc_debug(2, "Dst addr [%d] = 0x%08llx\n", dst_index, dst_mb->planes.raw[0]); + mfc_debug(2, "Dst addr [%d] = 0x%08llx\n", dst_index, dst_mb->addr[0]); /* for debugging about black bar detection */ if (FW_HAS_BLACK_BAR_DETECT(dev) && dec->detect_black_bar) { for (i = 0; i < raw->num_planes; i++) { dec->frame_vaddr[i][dec->frame_cnt] = vb2_plane_vaddr(&dst_mb->vb.vb2_buf, i); - dec->frame_daddr[i][dec->frame_cnt] = dst_mb->planes.raw[i]; + dec->frame_daddr[i][dec->frame_cnt] = dst_mb->addr[i]; dec->frame_size[i][dec->frame_cnt] = raw->plane_size[i]; dec->index[i][dec->frame_cnt] = dst_index; dec->fd[i][dec->frame_cnt] = dst_mb->vb.vb2_buf.planes[0].m.fd; @@ -472,12 +467,12 @@ int s5p_mfc_set_dynamic_dpb(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *dst_mb) for (i = 0; i < raw->num_planes; i++) { MFC_WRITEL(raw->plane_size[i], S5P_FIMV_D_FIRST_PLANE_DPB_SIZE + i*4); - MFC_WRITEL(dst_mb->planes.raw[i], + MFC_WRITEL(dst_mb->addr[i], S5P_FIMV_D_FIRST_PLANE_DPB0 + (i*0x100 + dst_index*4)); } MFC_TRACE_CTX("Set dst[%d] fd: %d, %#llx / avail %#lx used %#x\n", - dst_index, dst_mb->vb.vb2_buf.planes[0].m.fd, dst_mb->planes.raw[0], + dst_index, dst_mb->vb.vb2_buf.planes[0].m.fd, dst_mb->addr[0], dec->available_dpb, dec->dynamic_used); return 0; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c b/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c index 304b689ea6a0..d71512633dd4 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_utils.c @@ -18,8 +18,6 @@ int s5p_mfc_check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb) { - int i; - if (!fmt) return -EINVAL; @@ -29,17 +27,6 @@ int s5p_mfc_check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb) return -EINVAL; } - for (i = 0; i < vb->num_planes; i++) { - if (!s5p_mfc_mem_get_daddr_vb(vb, i)) { - mfc_err_dev("failed to get plane cookie\n"); - return -ENOMEM; - } - - mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08llx\n", - vb->index, i, - s5p_mfc_mem_get_daddr_vb(vb, i)); - } - return 0; }