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-Novakovic X-Patchwork-Id: 10062845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0D3D601D3 for ; Fri, 17 Nov 2017 14:30:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D19922ACEB for ; Fri, 17 Nov 2017 14:30:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C32A62ACF1; Fri, 17 Nov 2017 14:30:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D62B2ACEB for ; Fri, 17 Nov 2017 14:30:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935055AbdKQOaZ (ORCPT ); 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 X-Virus-Scanned: ClamAV using ClamSMTP 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 */