Commit 297160d4 authored by Yunfei Dong's avatar Yunfei Dong Committed by Mauro Carvalho Chehab
Browse files

media: mediatek: vcodec: move core context from device to each instance



There are so many lat buffer in core context list, some instances
maybe be scheduled for a very long time. Moving the core context to
each instance, it only be used to control lat buffer of each instance.
And the core work queue of each instance is scheduled by system.

Fixes: 2cfca6c1 ("media: mediatek: vcodec: move lat_buf to the top of core list")
Signed-off-by: default avatarYunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 2864e304
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -310,7 +310,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
	}

	if (IS_VDEC_LAT_ARCH(dev->vdec_pdata->hw_arch)) {
		vdec_msg_queue_init_ctx(&dev->msg_queue_core_ctx, MTK_VDEC_CORE);
		dev->core_workqueue =
			alloc_ordered_workqueue("core-decoder",
						WQ_MEM_RECLAIM | WQ_FREEZABLE);
+0 −2
Original line number Diff line number Diff line
@@ -462,7 +462,6 @@ struct mtk_vcodec_enc_pdata {
 * @enc_capability: used to identify encode capability
 *
 * @core_workqueue: queue used for core hardware decode
 * @msg_queue_core_ctx: msg queue context used for core workqueue
 *
 * @subdev_dev: subdev hardware device
 * @subdev_prob_done: check whether all used hw device is prob done
@@ -511,7 +510,6 @@ struct mtk_vcodec_dev {
	unsigned int enc_capability;

	struct workqueue_struct *core_workqueue;
	struct vdec_msg_queue_ctx msg_queue_core_ctx;

	void *subdev_dev[MTK_VDEC_HW_MAX];
	int (*subdev_prob_done)(struct mtk_vcodec_dev *vdec_dev);
+2 −2
Original line number Diff line number Diff line
@@ -672,7 +672,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
	if (IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability)) {
		memcpy(&share_info->h264_slice_params, &inst->vsi->h264_slice_params,
		       sizeof(share_info->h264_slice_params));
		vdec_msg_queue_qbuf(&inst->ctx->dev->msg_queue_core_ctx, lat_buf);
		vdec_msg_queue_qbuf(&inst->ctx->msg_queue.core_ctx, lat_buf);
	}

	/* wait decoder done interrupt */
@@ -698,7 +698,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
	if (!IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability)) {
		memcpy(&share_info->h264_slice_params, &inst->vsi->h264_slice_params,
		       sizeof(share_info->h264_slice_params));
		vdec_msg_queue_qbuf(&inst->ctx->dev->msg_queue_core_ctx, lat_buf);
		vdec_msg_queue_qbuf(&inst->ctx->msg_queue.core_ctx, lat_buf);
	}
	mtk_vcodec_debug(inst, "dec num: %d lat crc: 0x%x 0x%x 0x%x", inst->slice_dec_num,
			 inst->vsi->dec.crc[0], inst->vsi->dec.crc[1], inst->vsi->dec.crc[2]);
+2 −2
Original line number Diff line number Diff line
@@ -1017,7 +1017,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
	if (IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability)) {
		memcpy(&share_info->hevc_slice_params, &inst->vsi->hevc_slice_params,
		       sizeof(share_info->hevc_slice_params));
		vdec_msg_queue_qbuf(&inst->ctx->dev->msg_queue_core_ctx, lat_buf);
		vdec_msg_queue_qbuf(&inst->ctx->msg_queue.core_ctx, lat_buf);
	}

	/* wait decoder done interrupt */
@@ -1043,7 +1043,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
	if (!IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability)) {
		memcpy(&share_info->hevc_slice_params, &inst->vsi->hevc_slice_params,
		       sizeof(share_info->hevc_slice_params));
		vdec_msg_queue_qbuf(&inst->ctx->dev->msg_queue_core_ctx, lat_buf);
		vdec_msg_queue_qbuf(&inst->ctx->msg_queue.core_ctx, lat_buf);
	}
	mtk_vcodec_debug(inst, "dec num: %d lat crc: 0x%x 0x%x 0x%x", inst->slice_dec_num,
			 inst->vsi->dec.crc[0], inst->vsi->dec.crc[1], inst->vsi->dec.crc[2]);
+1 −1
Original line number Diff line number Diff line
@@ -2119,7 +2119,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
	vdec_msg_queue_update_ube_wptr(&ctx->msg_queue,
				       vsi->trans.dma_addr_end +
				       ctx->msg_queue.wdma_addr.dma_addr);
	vdec_msg_queue_qbuf(&ctx->dev->msg_queue_core_ctx, lat_buf);
	vdec_msg_queue_qbuf(&ctx->msg_queue.core_ctx, lat_buf);

	return 0;
err_free_fb_out:
Loading