From patchwork Mon Oct 8 11:09:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikash Garodia X-Patchwork-Id: 10630411 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 40222112B for ; Mon, 8 Oct 2018 11:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31D1C28AB3 for ; Mon, 8 Oct 2018 11:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25DCE28AE3; Mon, 8 Oct 2018 11:09:24 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 D371028AB3 for ; Mon, 8 Oct 2018 11:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbeJHSU3 (ORCPT ); Mon, 8 Oct 2018 14:20:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56012 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbeJHSU3 (ORCPT ); Mon, 8 Oct 2018 14:20:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3EBFE6081A; Mon, 8 Oct 2018 11:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538996957; bh=DadDPqVhqPzl0WJa42vAmu0diD1j8d+W5T528bpRdNw=; h=From:To:Cc:Subject:Date:From; b=nVhRK+7zN/5dFa2jAqOrL4K4T0LEFEUdxmL2jfcp4BW8XnTcjZhzXwQi819zeK/1f cKkF4U1NpRzdEmIQyU0pjZrivQy0giTXtroW83itYum7mkX5QqYgI/uEJu9Xyt2IMK EvQNEzeJfYzpVydz6AmTSjWdcRksvExrifX1NYWo= Received: from vgarodia-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vgarodia@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B70F56024C; Mon, 8 Oct 2018 11:09:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538996956; bh=DadDPqVhqPzl0WJa42vAmu0diD1j8d+W5T528bpRdNw=; h=From:To:Cc:Subject:Date:From; b=broqRSM65GFNKdeM8RCehzpcdFHSE6ifIadgONofeIbwIdyAZ8bNUUDlyacYS98ou 80GdAWcx36Aa0iwWlYFi/uBKf5VFrc3wS0ME5mvgI344gEhaCsJBVdeb9w24eZ9CdS uq4EMVsVqZpYs+KC6S436lQ2rwcDM2ROIv23hh60= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B70F56024C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vgarodia@codeaurora.org From: Vikash Garodia To: stanimir.varbanov@linaro.org, hverkuil@xs4all.nl, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, acourbot@chromium.org, vgarodia@codeaurora.org Subject: [PATCH v2] venus: vdec: fix decoded data size Date: Mon, 8 Oct 2018 16:39:04 +0530 Message-Id: <1538996944-15042-1-git-send-email-vgarodia@codeaurora.org> X-Mailer: git-send-email 1.9.1 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 Existing code returns the max of the decoded size and buffer size. It turns out that buffer size is always greater due to hardware alignment requirement. As a result, payload size given to client is incorrect. This change ensures that the bytesused is assigned to actual payload size, when available. Signed-off-by: Vikash Garodia Acked-by: Stanimir Varbanov Tested-by: Alexandre Courbot --- drivers/media/platform/qcom/venus/vdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 991e158..189ec97 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, unsigned int opb_sz = venus_helper_get_opb_size(inst); vb = &vbuf->vb2_buf; - vb->planes[0].bytesused = - max_t(unsigned int, opb_sz, bytesused); + vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz); vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++;