From patchwork Tue Nov 13 09:30:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 10680107 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B948109C for ; Tue, 13 Nov 2018 09:30:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ADC82A101 for ; Tue, 13 Nov 2018 09:30:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E53C2A0C6; Tue, 13 Nov 2018 09:30:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 D3CB42A074 for ; Tue, 13 Nov 2018 09:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731612AbeKMT2I (ORCPT ); Tue, 13 Nov 2018 14:28:08 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43255 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731370AbeKMT2I (ORCPT ); Tue, 13 Nov 2018 14:28:08 -0500 Received: by mail-pg1-f193.google.com with SMTP id n10-v6so5410768pgv.10 for ; Tue, 13 Nov 2018 01:30:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sPwmqQYNP9eqvMbepbeCIftdcUUAvxdfCAU5vJtMY5o=; b=DQADcyQ05kkYk3zKhC3GDamjEQ0RgANb13f0NLbfkyTvNUqjY7zqcloMCeS99N2+D5 gHIQUn1cJZPNIe00G4o3cuTrB4yPHuEcMGD6e0ZdUWzX1r5Hd2s9w3Rd9kWYHuHlxLKS tPwFT6wN1rsd6I8b3G9+oydcRADN8ZQNuqOIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sPwmqQYNP9eqvMbepbeCIftdcUUAvxdfCAU5vJtMY5o=; b=L+Byn8dxqTjbQaPQdFcxBStH2UeiAGjSoq6SJ0GJ5mz56hr+/I8UHwj7h8/xt/QyeO K95AjuH4ycL8gWLUVKkn6lfT7dFtBcvTWCK2DUBNWQfsWeKx2ZcPD+0G1O2LzdcxVAlB +Bez/wgRCRBZitUQRNsPwUsexoENwqkFdVfK29YGcQd8jpmy7qNdk5a31vZZvUZB7/mB ox5Zojc7UyjY3nA97WPERfT4E9xMaL+XOAC4QF8EfxLUXqKK5OrDW/H7JNNr1r6+LlHw +wYNC2ge77KehNqZofnF/mhfu+lruTqpTDyMNeqOPL9AZA1Ki78qtLpMCR9dIL7R+DWp GfZg== X-Gm-Message-State: AGRZ1gKyRj/7e3ofDYg4kfM40fUyD2isbBV6Qg8UO1bhGWCJlcO8lgNC PPFjgnuUGPAw7jKDDEs8FqeAEV7nv90= X-Google-Smtp-Source: AJdET5d6jKYZ4+U6+0cr5wnHFmdGdqPz7mowjQUhS4NMd1trt+pQvmF/QGwdEiEAxFgfnwtDjPqQuw== X-Received: by 2002:a63:8043:: with SMTP id j64mr4109676pgd.405.1542101454407; Tue, 13 Nov 2018 01:30:54 -0800 (PST) Received: from acourbot.tok.corp.google.com ([2401:fa00:4:4:9712:8cf1:d0f:7d33]) by smtp.gmail.com with ESMTPSA id k14sm20613216pgs.52.2018.11.13.01.30.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 01:30:53 -0800 (PST) From: Alexandre Courbot To: Stanimir Varbanov , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [PATCH] media: venus: fix reported size of 0-length buffers Date: Tue, 13 Nov 2018 18:30:48 +0900 Message-Id: <20181113093048.236201-1-acourbot@chromium.org> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The last buffer is often signaled by an empty buffer with the V4L2_BUF_FLAG_LAST flag set. Such buffers were returned with the bytesused field set to the full size of the OPB, which leads user-space to believe that the buffer actually contains useful data. Fix this by passing the number of bytes reported used by the firmware. Signed-off-by: Alexandre Courbot Acked-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 189ec975c6bb..282de21cf2e1 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -885,10 +885,8 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, vbuf->field = V4L2_FIELD_NONE; if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - unsigned int opb_sz = venus_helper_get_opb_size(inst); - vb = &vbuf->vb2_buf; - vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz); + vb2_set_plane_payload(vb, 0, bytesused); vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++;