From patchwork Thu Jan 9 13:35:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3lyaWUgV3UgKOWQtOaZlyk=?= X-Patchwork-Id: 13932610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 909FCE77199 for ; Thu, 9 Jan 2025 13:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hDcDVFoj8Dck1LqNJ4Zh+DbWOWQuRE0YqYBI3Mzm9w0=; b=vet4aljjAW8gYvEejyY7A/gujR OQQv2yCv2pdWsLyy74UlosYTZ0iDKy606n8ToupwQsgeDgTTvK8w+yPycKl5ifUlqyZ5ENhPmGahl ETNBDJaDBQVt8EWehJJBoUpwc/puY529RoOhrRFE1FsXX1GH6chqOVs3tr4LPogNKgEPjdMjmrCMp P768mTFVQ4wh2A2j6SoeMPPoZYXJ/2SHLNwrvRMfbe8ALZaXneBLRnjl2VM3JGSMQ8w1f2otvtwXj aGzxTQnkkhkyg3eSBhFbqFTZiZmVVkXjlgm8dLmNZtseYLYJ4Io9Plla/IlMq+NwWCGlRb+Cbf0FL Xh/7EUhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVsvU-0000000C7EP-1mXF; Thu, 09 Jan 2025 13:50:20 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVshI-0000000C30p-3vsx; Thu, 09 Jan 2025 13:35:42 +0000 X-UUID: 9ca6ad02ce8e11ef82ff63e91e7eb18c-20250109 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=hDcDVFoj8Dck1LqNJ4Zh+DbWOWQuRE0YqYBI3Mzm9w0=; b=d2yQgaMqZruh4u1/JygnTUnCF7yk9PUVdMTTgWqmmmKSoaeXtNyI+4a5kDdhIOduUyUCXP1+07tzpS1Dv0BkE+MXx5WBml1Mz9qRYXPTcks7RI9BD7gRm5HJR74Ov45eUydg2ZXYflsMhN/OTG6FGNokvF0Djcc2DydztLh7EWE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.46,REQID:a35915f7-c6ba-4cd5-a0e2-738851485268,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:60aa074,CLOUDID:9f96f5d1-15ca-4d8b-940c-bbea7162947b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 9ca6ad02ce8e11ef82ff63e91e7eb18c-20250109 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1520122824; Thu, 09 Jan 2025 06:35:38 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 9 Jan 2025 21:35:35 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 9 Jan 2025 21:35:34 +0800 From: kyrie.wu To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tzung-Bi Shih CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , AngeloGioacchino Del Regno , Bin Liu , kyrie wu , , , , , , kyrie.wu Subject: [V1,12/12] media: mediatek: jpeg: fix remove buffer operation for multi-core Date: Thu, 9 Jan 2025 21:35:12 +0800 Message-ID: <20250109133513.20151-13-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250109133513.20151-1-kyrie.wu@mediatek.com> References: <20250109133513.20151-1-kyrie.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250109_053540_999097_FAF717FB X-CRM114-Status: UNSURE ( 9.80 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org move remove buffer code to spinlock protect area for multi-core Signed-off-by: kyrie.wu --- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index 2919fdd92d45..065b35122acf 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1665,9 +1665,6 @@ static void mtk_jpegenc_worker(struct work_struct *work) goto enc_end; } - v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); - v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); - schedule_delayed_work(&comp_jpeg[hw_id]->job_timeout_work, msecs_to_jiffies(MTK_JPEG_HW_TIMEOUT_MSEC)); @@ -1688,6 +1685,8 @@ static void mtk_jpegenc_worker(struct work_struct *work) &src_buf->vb2_buf); mtk_jpeg_set_enc_params(ctx, comp_jpeg[hw_id]->reg_base); mtk_jpeg_enc_start(comp_jpeg[hw_id]->reg_base); + v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); jpeg_buf_queue_inc(ctx); v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); spin_unlock_irqrestore(&comp_jpeg[hw_id]->hw_lock, flags); @@ -1770,9 +1769,6 @@ static void mtk_jpegdec_worker(struct work_struct *work) goto dec_end; } - v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); - v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); - mtk_jpeg_set_dec_src(ctx, &src_buf->vb2_buf, &bs); if (mtk_jpeg_set_dec_dst(ctx, &jpeg_src_buf->dec_param, @@ -1800,6 +1796,8 @@ static void mtk_jpegdec_worker(struct work_struct *work) jpeg_src_buf->bs_size, &bs, &fb); + v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); mtk_jpeg_dec_start(comp_jpeg[hw_id]->reg_base); jpeg_buf_queue_inc(ctx); v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);