Commit 9875c0be authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull media fixes from Mauro Carvalho Chehab:

 - some fixes for mediatec vcodec encoder/decoder oopses

* tag 'media/v6.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: mediatek: vcodec: support 36 bits physical address
  media: mediatek: vcodec: adding lock to protect encoder context list
  media: mediatek: vcodec: adding lock to protect decoder context list
  media: mediatek: vcodec: Fix oops when HEVC init fails
  media: mediatek: vcodec: Handle VP9 superframe bitstream with 8 sub-frames
parents fe5b5ef8 d353c3c3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -50,12 +50,12 @@ static void mtk_vcodec_vpu_reset_dec_handler(void *priv)

	dev_err(&dev->plat_dev->dev, "Watchdog timeout!!");

	mutex_lock(&dev->dev_mutex);
	mutex_lock(&dev->dev_ctx_lock);
	list_for_each_entry(ctx, &dev->ctx_list, list) {
		ctx->state = MTK_STATE_ABORT;
		mtk_v4l2_vdec_dbg(0, ctx, "[%d] Change to state MTK_STATE_ABORT", ctx->id);
	}
	mutex_unlock(&dev->dev_mutex);
	mutex_unlock(&dev->dev_ctx_lock);
}

static void mtk_vcodec_vpu_reset_enc_handler(void *priv)
@@ -65,12 +65,12 @@ static void mtk_vcodec_vpu_reset_enc_handler(void *priv)

	dev_err(&dev->plat_dev->dev, "Watchdog timeout!!");

	mutex_lock(&dev->dev_mutex);
	mutex_lock(&dev->dev_ctx_lock);
	list_for_each_entry(ctx, &dev->ctx_list, list) {
		ctx->state = MTK_STATE_ABORT;
		mtk_v4l2_vdec_dbg(0, ctx, "[%d] Change to state MTK_STATE_ABORT", ctx->id);
	}
	mutex_unlock(&dev->dev_mutex);
	mutex_unlock(&dev->dev_ctx_lock);
}

static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = {
+5 −0
Original line number Diff line number Diff line
@@ -268,7 +268,9 @@ static int fops_vcodec_open(struct file *file)

	ctx->dev->vdec_pdata->init_vdec_params(ctx);

	mutex_lock(&dev->dev_ctx_lock);
	list_add(&ctx->list, &dev->ctx_list);
	mutex_unlock(&dev->dev_ctx_lock);
	mtk_vcodec_dbgfs_create(ctx);

	mutex_unlock(&dev->dev_mutex);
@@ -311,7 +313,9 @@ static int fops_vcodec_release(struct file *file)
	v4l2_ctrl_handler_free(&ctx->ctrl_hdl);

	mtk_vcodec_dbgfs_remove(dev, ctx->id);
	mutex_lock(&dev->dev_ctx_lock);
	list_del_init(&ctx->list);
	mutex_unlock(&dev->dev_ctx_lock);
	kfree(ctx);
	mutex_unlock(&dev->dev_mutex);
	return 0;
@@ -404,6 +408,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
	for (i = 0; i < MTK_VDEC_HW_MAX; i++)
		mutex_init(&dev->dec_mutex[i]);
	mutex_init(&dev->dev_mutex);
	mutex_init(&dev->dev_ctx_lock);
	spin_lock_init(&dev->irqlock);

	snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), "%s",
+2 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ struct mtk_vcodec_dec_ctx {
 *
 * @dec_mutex: decoder hardware lock
 * @dev_mutex: video_device lock
 * @dev_ctx_lock: the lock of context list
 * @decode_workqueue: decode work queue
 *
 * @irqlock: protect data access by irq handler and work thread
@@ -282,6 +283,7 @@ struct mtk_vcodec_dec_dev {
	/* decoder hardware mutex lock */
	struct mutex dec_mutex[MTK_VDEC_HW_MAX];
	struct mutex dev_mutex;
	struct mutex dev_ctx_lock;
	struct workqueue_struct *decode_workqueue;

	spinlock_t irqlock;
+1 −1
Original line number Diff line number Diff line
@@ -869,7 +869,6 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx)
	inst->vpu.codec_type = ctx->current_codec;
	inst->vpu.capture_type = ctx->capture_fourcc;

	ctx->drv_handle = inst;
	err = vpu_dec_init(&inst->vpu);
	if (err) {
		mtk_vdec_err(ctx, "vdec_hevc init err=%d", err);
@@ -898,6 +897,7 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx)
	mtk_vdec_debug(ctx, "lat hevc instance >> %p, codec_type = 0x%x",
		       inst, inst->vpu.codec_type);

	ctx->drv_handle = inst;
	return 0;
error_free_inst:
	kfree(inst);
+1 −1
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
		       inst->frm_cnt, y_fb_dma, c_fb_dma, fb);

	inst->cur_fb = fb;
	dec->bs_dma = (unsigned long)bs->dma_addr;
	dec->bs_dma = (uint64_t)bs->dma_addr;
	dec->bs_sz = bs->size;
	dec->cur_y_fb_dma = y_fb_dma;
	dec->cur_c_fb_dma = c_fb_dma;
Loading