From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E5923F6C48 for ; Mon, 13 Jul 2026 12:11:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783944684; cv=none; b=TmkoKE4mUaKtH1drgu6+wLUEj3XGqKuqikDpBGTDYn2uxaYgac1EAG1hppEgfa6yGEUhQEZFgUU7cB9zX2/Cc75OMz1yaqJYMDGVKJw9EymoGz+GYzniv/pRstVvZ4UKdKDJE9owrrXyWyW71DvrF38wUTHWzRejG62nlXxG86s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783944684; c=relaxed/simple; bh=G2NQafJclYTeJRa5vR4Nkq85FyLNUI0JvtBWv+71DF8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EeTi5PkHo/PgoOD2/v1SiDR5vqg3wyWdWSDrZfEnHXCjHfttD3xfQqBX8QgG92GMXY5mLTx7e9tQnHojy0Vhy+hFDMnpPwFRrytbdfF3qFTsRtipbZpEYspqRM9zG8BkkobI7xfkWp3E7lIL38juHU0UQlhPZaRn76RjyPGUU4I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fcozDjaz; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fcozDjaz" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-84864086bfeso3028982b3a.1 for ; Mon, 13 Jul 2026 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783944682; x=1784549482; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=fcozDjazFI/WUVc0BmHdQAQvM4spN0oJ9XlZLfElRLv4JT3GeeD7D5LQi7FGRoWlh+ Iqfl11+DFcJBk+LqcHVZGverbbXqiJJdjBdSSLD7pyULmurii+Do/R5CGKPCmXr70M+/ U9tMzOl+XMBityX623Sky1ZJ0wg7ozcnUohKb9GeEzkoJDWlQ+swCpWV8TB9JMkfAhKg JWSsS+b8El410LL/rkZvJTLt+cHHsl9bxarsiBYlJ1I7gSU/heipccqYdYtQs5Rl/+ZW uF/55/3JSWbS4WdOxoFZnyQlDbRgp6VrCXPq5DiXPlJq9PzbIXIGBOGHbQhEZN9PN5bW IFOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783944682; x=1784549482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=aSqO+ZD8pfGlAT76zcdTTbsAz/7Cms5f7Hy0JmGWHbyeHHFiJuGyBmxDrRVl7WpV7V fXdyqzP/RBfaoe0ivROUc2PIj96TfBgbqcxuVVPQ9Mo7t2iwCdejdtgssfvLHeKd1Ji8 DxVVXALZcGEEG3HFY/yne7xYk3ci5ojZhMQN2vtaOUnCbUlqfL910reNPfft+TRYwZYm eSrz3IKP4TQIdSAPGNNEwxstKbECcspg9sAw3BXHpir+4scPysyL5hKBppcExIOGTkN8 D40W+f0zkRiyyeu32QjQC76t2vqOxtSmZEJ3Vo3OPrintB6iYlGei2nnxGfVQxZZeTv/ 9zUg== X-Forwarded-Encrypted: i=1; AHgh+RovVsy9q9DvUyX84fum8uqAqYbKwHG+++UlEmFstFBe1FKHo9flpCKoX5o9uNUTLPeASgv0VrcdmG5Qte8=@vger.kernel.org X-Gm-Message-State: AOJu0YyAJjFg4Jx2FHnGTWKSYye//+dZevXDhI3I2lMPPFr2/2jjICU4 g3aFSmT0uElYa3sEw3q9CsMjLqtniDIqz0V1+vdK3SB/Km/oMlP47/hW X-Gm-Gg: AfdE7cmCDbA5igWYAO28dWnP6ZDMuv8d1LAG/zDVeB/MXGlHkV+J9bOVT9TJXWj1GTp EvTwfL6UzMMSSnYO4kk9iyjkJS0AcErijsmnVaDQRHhwIpUB7Fy2Nywb9+m2s5TeFJOZ349GVnA 99cStWOC/P6tyTcFba02Ks5/NXLtEaG+mC/LT8+lEPqLePjX55Ss/KBDYDNkaqTvPeMW/1/qO9v PEZFpXGryPXzxCDNLJ9na7EXljzRdqqw3xY6/q1jlSCEyz4R8qZMl3GKEitQfRv8RumDae6lDEt GQPM1bZ8wt2d+vxQs2HlhXlk4ddJtFQdiPZPuRtdjhrqxJPeRyIS3+BDUoawEe9RjmoRc2f90/h 20Ga3bs0GQh+OM2xpEIZMkpa8hpDfjSbt3IF6Q4rSUg4EU5HPMmP29tgN/wAqNFza7qoTcK/6tN fmDhkkjPhGkQ== X-Received: by 2002:a05:6300:220a:b0:3bf:aab1:cc8b with SMTP id adf61e73a8af0-3c110b436f6mr8836067637.46.1783944681879; Mon, 13 Jul 2026 05:11:21 -0700 (PDT) Received: from rockpi-5b ([45.112.0.180]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f7293sm67756935eec.3.2026.07.13.05.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 05:11:21 -0700 (PDT) From: Anand Moon To: Neil Armstrong , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Mauro Carvalho Chehab , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR AMLOGIC SOCS), linux-amlogic@lists.infradead.org (open list:DRM DRIVERS FOR AMLOGIC SOCS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Amlogic Meson SoC support), linux-kernel@vger.kernel.org (open list), linux-media@vger.kernel.org (open list:MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS), linux-staging@lists.linux.dev (open list:STAGING SUBSYSTEM) Cc: Anand Moon , Doruk Tan Ozturk , Nicolas Dufresne Subject: [PATCH v7 14/19] media: meson: vdec: Correct atomic counter placement in dst_buf_done Date: Mon, 13 Jul 2026 17:37:09 +0530 Message-ID: <20260713120840.17427-15-linux.amoon@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260713120840.17427-1-linux.amoon@gmail.com> References: <20260713120840.17427-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix an end-of-stream (EOS) boundary condition logic flaw in dst_buf_done() by relocating the atomic decrement helper to execute after state evaluation. Previously, decrementing sess->esparser_queued_bufs at the entry point of the function corrupted the conditional checks for the final video frame. This premature decrement tricked the driver into flagging the second-to-last buffer as the final frame (V4L2_BUF_FLAG_LAST) during teardown sequences, which cut off the true final frame and broke compliance validation. Resolve this by moving atomic_dec() to execute immediately after the EOS conditional tracking block finishes evaluating, right before invoking v4l2_m2m_buf_done(). This ensures accurate stream termination signaling. Cc: Nicolas Dufresne Signed-off-by: Anand Moon --- drivers/staging/media/meson/vdec/vdec_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c index f02c21d5a9c18..303236f0647c0 100644 --- a/drivers/staging/media/meson/vdec/vdec_helpers.c +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c @@ -314,6 +314,9 @@ static void dst_buf_done(struct amvdec_session *sess, dev_dbg(dev, "Buffer %u done, ts = %llu, flags = %08X\n", vbuf->vb2_buf.index, timestamp, flags); vbuf->field = field; + + atomic_dec(&sess->esparser_queued_bufs); + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); /* Buffer done probably means the vififo got freed */ -- 2.50.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 48CE5C43458 for ; Mon, 13 Jul 2026 12:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/6zHztFjZj/TlCXS2LirY4pzZBwkp5T0GXNyrFzQgIY=; b=vNTUiGpz6pVZck jW09676ugfLdWL3Xr2R/YtChs7doa6oy/gP78reHqrOrU46XXZdnc4VPxZvIRQQAcZ7XqhBZ6FdF5 gcF7g8xHGclG1U+yqHrmzMEOHY9ibkeW9w64O360DDgy46157ut8HpObHEkEyWl3cxHPFpvIVfeDR Skl5VqzjNA7w7uCnT8KHp4Kag7Ff2DktqUhk/tC7eciMbifurYhhOaSdAopZYP9ajH6zz0J4+YHNt 5ULWVWLBwalKuiet8+h5w3zEuTGMZGnvakcJOe8I1873c23cQMB1VoQEOXwLun4MvDcwCrQGaGlsi SOzIwuBdlaPr4vFHO6RA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjFVM-000000099PL-1aoU; Mon, 13 Jul 2026 12:11:24 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjFVK-000000099NJ-3PWA for linux-amlogic@lists.infradead.org; Mon, 13 Jul 2026 12:11:23 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-ca913a601fbso2089039a12.3 for ; Mon, 13 Jul 2026 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783944682; x=1784549482; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=iZZ2AaI7CV7XMb9/KgpYANe5E44mVn2ftoT5ag5Ctzaq65r7X+gmNi9ey/PENMQm41 OYua+Hywdz/Uoi6F88EgptRdc0ZSmmWasDgWtebWAxm5q/y8xNdGxfYYG7SRkf1WX2jp H1doOwsSDpNqEh821pNL3ie4Qfj9hRd2e1k0w59ItjURYWtsBTo2yXWKC4kQo2fxRFuj Z64unMzAnHwIGTzapU4W312/JygVQcTPi/AAY5aHVCTT8Rm6FpeS85gR+V6CdM+LoK9U XjxFulA4E5RvJvb2jODMe0I6AkfSsXymx3m0I8bgCWV65QVEdv61u4hI0s32Aos2vffx DMOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783944682; x=1784549482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=cKkYqqXSG7Bq00ezp4wW06IgQujaRaWfNICzBdiVCcFXebnTxcUj+H7eCHrNGNFv30 xsctneWbDb044x5TggJldBu3hScSHOjX+Du69PQ3fqC3Mx/DW3KU7gO6URs4wz9BX8tU T0V/Ndvsm3bpVfMaqqc2J4PAKfNLeQU3LyCv4kQhMFwghxT1NQUInUzpCZm3VwGCEC23 N8YdVqWJiIT+DycZCugSh9eQn0TE47njI5s0zoo9kHYOryIK5z6lHSu+i81tLWA0YhEV 698mOcY3D8FY4GrfjNR7T8UGGrg+1XCwlWXnVU9C+lwHg+b26wqlJm1jx3KQJRRav6DO fSHw== X-Forwarded-Encrypted: i=1; AHgh+Rpdd1NoXnLGePhwKPkd1qeqAWWhyyIZXZRzASj4m85AZP+OKmJryRoEGsB1pUhWW+Cz7pRu8XZQDb8flwYQ@lists.infradead.org X-Gm-Message-State: AOJu0YwHgQcfsr3Hoxbqbdqelh4vpw8UT+jQnZcc1Tkj0z8grXY2qpw1 KqkKmnchB2tZdDE78QkF0udGpFP2zuv0/2hHVOP2eTx9Tbvz726cbV1U X-Gm-Gg: AfdE7cnREZVQoVNk2Coxp9W+sywVyFK3s8DMEXB+OuVANDbdKCRpOP/f8RPE/ZHVlf4 7VfJGIpgpOzhKdtDuj9JlYm/a8KPTdhsVv3tID8CaK2hlKGwknPrwPGE6IZ30VFbNy3BCzYMUQ+ H7/LFePK/yJlQQkbgPjojXwesW+N4hxF5lYjkGjc1SdHf+3q8aMGkrrzTchsXhqOoNn1nkDayBQ ZyDwBbFDMyol06rfcWBo9nUOL46dV1a8bAHlCg3A1RMzQgmamTGVXf7y/0msHCPQrEitCBqtQje 0llXCAlsAKLlCjh1CJs8+mhcBSAszPegjNT7uApbBVXRU1WPpAbS5DptzhHBO3zX+9erSzsATaM vvXVFWXVwmS6/gmVOSlzhjuLvDSLHR6GliGmIEbWjo+2puVh8zvncIl6f896nibfL/UfHin4iLa UCNVLOXpawBA== X-Received: by 2002:a05:6300:220a:b0:3bf:aab1:cc8b with SMTP id adf61e73a8af0-3c110b436f6mr8836067637.46.1783944681879; Mon, 13 Jul 2026 05:11:21 -0700 (PDT) Received: from rockpi-5b ([45.112.0.180]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f7293sm67756935eec.3.2026.07.13.05.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 05:11:21 -0700 (PDT) From: Anand Moon To: Neil Armstrong , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Mauro Carvalho Chehab , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR AMLOGIC SOCS), linux-amlogic@lists.infradead.org (open list:DRM DRIVERS FOR AMLOGIC SOCS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Amlogic Meson SoC support), linux-kernel@vger.kernel.org (open list), linux-media@vger.kernel.org (open list:MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS), linux-staging@lists.linux.dev (open list:STAGING SUBSYSTEM) Subject: [PATCH v7 14/19] media: meson: vdec: Correct atomic counter placement in dst_buf_done Date: Mon, 13 Jul 2026 17:37:09 +0530 Message-ID: <20260713120840.17427-15-linux.amoon@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260713120840.17427-1-linux.amoon@gmail.com> References: <20260713120840.17427-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260713_051122_847150_6959F1B0 X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Doruk Tan Ozturk , Nicolas Dufresne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Fix an end-of-stream (EOS) boundary condition logic flaw in dst_buf_done() by relocating the atomic decrement helper to execute after state evaluation. Previously, decrementing sess->esparser_queued_bufs at the entry point of the function corrupted the conditional checks for the final video frame. This premature decrement tricked the driver into flagging the second-to-last buffer as the final frame (V4L2_BUF_FLAG_LAST) during teardown sequences, which cut off the true final frame and broke compliance validation. Resolve this by moving atomic_dec() to execute immediately after the EOS conditional tracking block finishes evaluating, right before invoking v4l2_m2m_buf_done(). This ensures accurate stream termination signaling. Cc: Nicolas Dufresne Signed-off-by: Anand Moon --- drivers/staging/media/meson/vdec/vdec_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c index f02c21d5a9c18..303236f0647c0 100644 --- a/drivers/staging/media/meson/vdec/vdec_helpers.c +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c @@ -314,6 +314,9 @@ static void dst_buf_done(struct amvdec_session *sess, dev_dbg(dev, "Buffer %u done, ts = %llu, flags = %08X\n", vbuf->vb2_buf.index, timestamp, flags); vbuf->field = field; + + atomic_dec(&sess->esparser_queued_bufs); + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); /* Buffer done probably means the vififo got freed */ -- 2.50.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic From mboxrd@z Thu Jan 1 00:00:00 1970 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 9C9DDC43458 for ; Mon, 13 Jul 2026 12:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:To:From:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=wrdhjgR606R91B 75AQ/b8NlB6PSHuKBM5b5rtzvfvQcUMkqL/lY8S7rdUnONBEIVz/bk4aPUM71Lj5FksO7uSFk/FIf YAUTMRJ1Z6jDMF8fZkHjeF/SkiWAVA2F9KvEaVIEmZdbR/4tABo2FfH4WXXYZe9Uuv/OY6JaRrfQD AOYlI7n7WWMtLF4h/FU/KxnSLUvvwPQBCHql6/5pStduBmyVXB8awXz4NvGPdtrB0EN5lIg6B19RY vvsfyOfL7Tsy4KxXJnBUinoT2IAjsHnDgtEx+k7yGdtSh6IMxLdb90V+tvJlT3+9j/5U+zMRVj3EK QdkotpT0jUSE3G13G0Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjFVM-000000099P4-0wr0; Mon, 13 Jul 2026 12:11:24 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjFVK-000000099NK-2a0E for linux-arm-kernel@lists.infradead.org; Mon, 13 Jul 2026 12:11:23 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2cce6a0c9c3so27122295ad.1 for ; Mon, 13 Jul 2026 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783944682; x=1784549482; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=iZZ2AaI7CV7XMb9/KgpYANe5E44mVn2ftoT5ag5Ctzaq65r7X+gmNi9ey/PENMQm41 OYua+Hywdz/Uoi6F88EgptRdc0ZSmmWasDgWtebWAxm5q/y8xNdGxfYYG7SRkf1WX2jp H1doOwsSDpNqEh821pNL3ie4Qfj9hRd2e1k0w59ItjURYWtsBTo2yXWKC4kQo2fxRFuj Z64unMzAnHwIGTzapU4W312/JygVQcTPi/AAY5aHVCTT8Rm6FpeS85gR+V6CdM+LoK9U XjxFulA4E5RvJvb2jODMe0I6AkfSsXymx3m0I8bgCWV65QVEdv61u4hI0s32Aos2vffx DMOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783944682; x=1784549482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=7nfm5E5YVw8Xk7Gt9ejcJe2nuIHpfZQPsIGFP/AIC7g=; b=XUmqEriaKdkGgQVZknyfUA8oiIoL1+HjEMdVX5iartOzVyDgrEtfK1kO6sSw/7r3im +c5TwlKkoBqDCL+oOYQEL0cgRzA7w5hfo4y58zyoZ6c/Wja1DgaQwFhkZgZPuyGgkmwG txmSuOdhzGCBsR5C+yD6ky/gdEP66/8yh8pd7Z2qoVYOJcV3bNvKC6DTP3Vm7f1v3Eiu zzaftpX8Lpzd4IU0uIrUQAl1PnzaKZPl0sHLhXjjNt9SSRa/rvoQwJDltbTmLn6fUd8V pyRNok5XT9beqiercIEYXzMNiHTnOAzZXyxHQJZRTMk3xCv3lB4vATHhxHdiPbH/gPf+ 8yqQ== X-Forwarded-Encrypted: i=1; AHgh+RqG82STCON+tuRSpaw4XNA1d0p4+jn4qtfon4zhnLQIFnyIyxXRlZxSvnA9OYmI6DZIekc+uo+YtxWpvyoSvncn@lists.infradead.org X-Gm-Message-State: AOJu0YxhlBJjFo6Nrc8tYMPh924evcwfecfwauvu6a7XznbotH63dNlM hDHkG3tqS+7EPrFh7N7XsMQj8IinBOrEKZKgr8yV6rZVMzyTqOPjwLfNfji/tA== X-Gm-Gg: AfdE7cnoB6+gQLUpDnwKCEk2nR1/bYtli18N7MPf3l+VDWu3d534Q64shkCbAodg/AF MvXzC0f1DHs50uW9Cl/jHybuhNK05FutuKVJ4k9uaePM+ldpnVxI8EIiHz6y/QsBNAdw8jQr+rE sYl57Rq/6TYEOVmPw1AORjunwG8gJpG4yZj/bi3IGakpqkBhSFVfB6GFkMUl4cDt7i0Aw0yQrP0 TP9I75+hvUSGl3RJMfLFbQPFmElO/RkijhcAMEag+piUltMYMEpO7XKz2AMiDWemFcs/mQLj0YR BrY8x9BLaTncALbZfq6h4/GJEqQtT2UC+njOA3zKZCsZQGbXi34+ZWh/vyCbSspX5bXgwYUPXMZ VEyCyqz39dWcwtQjuBRRRM/iAuofiubVG/QSlud75kNBwx4cjKGdzHwmTpr7x/l2oSXRQrH0kpN 2s1Hrfb7SqUA== X-Received: by 2002:a05:6300:220a:b0:3bf:aab1:cc8b with SMTP id adf61e73a8af0-3c110b436f6mr8836067637.46.1783944681879; Mon, 13 Jul 2026 05:11:21 -0700 (PDT) Received: from rockpi-5b ([45.112.0.180]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f7293sm67756935eec.3.2026.07.13.05.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 05:11:21 -0700 (PDT) From: Anand Moon To: Neil Armstrong , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Mauro Carvalho Chehab , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR AMLOGIC SOCS), linux-amlogic@lists.infradead.org (open list:DRM DRIVERS FOR AMLOGIC SOCS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Amlogic Meson SoC support), linux-kernel@vger.kernel.org (open list), linux-media@vger.kernel.org (open list:MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS), linux-staging@lists.linux.dev (open list:STAGING SUBSYSTEM) Subject: [PATCH v7 14/19] media: meson: vdec: Correct atomic counter placement in dst_buf_done Date: Mon, 13 Jul 2026 17:37:09 +0530 Message-ID: <20260713120840.17427-15-linux.amoon@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260713120840.17427-1-linux.amoon@gmail.com> References: <20260713120840.17427-1-linux.amoon@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260713_051122_670061_78DA0D2C X-CRM114-Status: GOOD ( 14.11 ) 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: , Cc: Doruk Tan Ozturk , Nicolas Dufresne Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix an end-of-stream (EOS) boundary condition logic flaw in dst_buf_done() by relocating the atomic decrement helper to execute after state evaluation. Previously, decrementing sess->esparser_queued_bufs at the entry point of the function corrupted the conditional checks for the final video frame. This premature decrement tricked the driver into flagging the second-to-last buffer as the final frame (V4L2_BUF_FLAG_LAST) during teardown sequences, which cut off the true final frame and broke compliance validation. Resolve this by moving atomic_dec() to execute immediately after the EOS conditional tracking block finishes evaluating, right before invoking v4l2_m2m_buf_done(). This ensures accurate stream termination signaling. Cc: Nicolas Dufresne Signed-off-by: Anand Moon --- drivers/staging/media/meson/vdec/vdec_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c index f02c21d5a9c18..303236f0647c0 100644 --- a/drivers/staging/media/meson/vdec/vdec_helpers.c +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c @@ -314,6 +314,9 @@ static void dst_buf_done(struct amvdec_session *sess, dev_dbg(dev, "Buffer %u done, ts = %llu, flags = %08X\n", vbuf->vb2_buf.index, timestamp, flags); vbuf->field = field; + + atomic_dec(&sess->esparser_queued_bufs); + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE); /* Buffer done probably means the vififo got freed */ -- 2.50.1