From patchwork Fri Nov 17 14:30:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 45501 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFhf3-0008Jz-KC; Fri, 17 Nov 2017 14:30:29 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935055AbdKQOaZ (ORCPT + 1 other); Fri, 17 Nov 2017 09:30:25 -0500 Received: from mout02.posteo.de ([185.67.36.66]:34269 "EHLO mout02.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933700AbdKQOaY (ORCPT ); Fri, 17 Nov 2017 09:30:24 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id D236720A06 for ; Fri, 17 Nov 2017 15:30:21 +0100 (CET) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3ydgWJ0CJvz108t; Fri, 17 Nov 2017 15:30:19 +0100 (CET) From: Martin Kepplinger To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH] media: coda: fix comparision of decoded frames' indexes Date: Fri, 17 Nov 2017 15:30:10 +0100 Message-Id: <20171117143010.501-1-martink@posteo.de> X-Mailer: git-send-email 2.11.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org At this point the driver looks the currently decoded frame's index and compares is to VPU-specific state values. Directly before this if and else statements the indexes are read (index for decoded and for displayed frame). Now what is saved in ctx->display_idx is an older value at this point! During these index checks, the current values apply, so fix this by taking display_idx instead of ctx->display_idx. ctx->display_idx is updated later in the same function. Signed-off-by: Martin Kepplinger --- Please review this thoroughly, but in case I am wrong here, this is at least very strange to read and *should* be accompanied with a comment about what's going on with that index value! I don't think it matter that much here because at least playing h264 worked before and works with this change, but I've tested it anyways. thanks martin drivers/media/platform/coda/coda-bit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index bfc4ecf6f068..fe38527a90e2 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -2089,7 +2089,7 @@ static void coda_finish_decode(struct coda_ctx *ctx) /* no frame was decoded, but we might have a display frame */ if (display_idx >= 0 && display_idx < ctx->num_internal_frames) ctx->sequence_offset++; - else if (ctx->display_idx < 0) + else if (display_idx < 0) ctx->hold = true; } else if (decoded_idx == -2) { /* no frame was decoded, we still return remaining buffers */