Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2470585imm; Wed, 3 Oct 2018 04:31:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV62RzOW4hRj/clNFppNH6g4TvfGh9z4JBgE1/UY0t1ClX39vjtC4i5/Kmc5wyU+b/aZg5lNa X-Received: by 2002:a62:ee06:: with SMTP id e6-v6mr1213240pfi.2.1538566270530; Wed, 03 Oct 2018 04:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538566270; cv=none; d=google.com; s=arc-20160816; b=FZBJv70wzPqu4QI250/myXSudPTgXDgWvMYr6CZ68xeZq40JK6O6tXshyk/soWq6kM LeU1UL8CrUrjJHjc6QEq43AumMz1kC7vKJlUeKt7bF2hvf8GKC+8YCy/iAQbVfphFSOm OQkH9B8PuOZskB/YIlZ5DbbPF0hrqqiU+am4BRPbGdAzSRa9ezbfdB20nE8TtVk2/WcN oBi+pEJeQbqPKUCD8RCkZsp+EuFjaLbdOZ8bPgTzbkfor9dCJCtOA0+elnX3z2mLbuq2 HkURnmQ9zehXbfPOqNUVhpGDgQ+zx53oAloHyEll1IBWfc5M2Hs6jzQR/LqQvaz11idP 86hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=tUTMhLmSqEpulypfatS5VozTFgXlfHLrfbD0jYg6kM0=; b=hLvwjzPMtRKTESXf5PDUqAJloLbyYg/gB+Za/54J/MRC/HcCiX7F0NF5unP4yuafMA FyxmMpqg4sRfq2+7FhUbSYwP1kdvA8rYqfVdAFWrbs4gHQPj+JoAer0kEUR/LThRW9Pd yGEB8HS+Uu0d99mu+Q3rxu4dS/XaRtr9HD6cwrBXVXwryU5BpcqdPp8+kjAggxr8+IhU 4MErzxl/ptEjCk8mmBIQV0kOqJecgvUH5N9cWDlq4iQq2q+YT5GdzxAMIbhAz4V59TE8 PxL5s6bPTSZJD+fvayliG/RT4uCgkkjdrgzhaq/x2wLWG5ySC5OTJ16BWifIYoynYcMt GX7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=o2k91CjD; dkim=pass header.i=@codeaurora.org header.s=default header.b=VuKB8p0C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1-v6si1301985plb.166.2018.10.03.04.30.55; Wed, 03 Oct 2018 04:31:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=o2k91CjD; dkim=pass header.i=@codeaurora.org header.s=default header.b=VuKB8p0C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbeJCSSh (ORCPT + 99 others); Wed, 3 Oct 2018 14:18:37 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53114 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726547AbeJCSSh (ORCPT ); Wed, 3 Oct 2018 14:18:37 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0670F607BD; Wed, 3 Oct 2018 11:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538566238; bh=kcINhkcUfuzC1LCmMOCUFvDVNU6dzcolKIXuKvfbxi8=; h=From:To:Cc:Subject:Date:From; b=o2k91CjD0ojgejpAsuacmNCmPDZV/Mp/OHzs3UeqlsX3S4Gp8yxnKcHTBL3CsXDRa kcFXcR5WXaGgqQNKlIUWK26RqH0drLpmEG6vSjstSFSN0QFGDX2Ie9fTKGq1nC/vjQ 4FlsalgRNQidtusuWX9FIshLkKgFQnknHCnQY0i8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 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 A627460B26; Wed, 3 Oct 2018 11:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538566237; bh=kcINhkcUfuzC1LCmMOCUFvDVNU6dzcolKIXuKvfbxi8=; h=From:To:Cc:Subject:Date:From; b=VuKB8p0CEu7WZjpdEYYkDV7k80Ych0pKouFycCyU3UFlaXDPcWKkhIlhzwpNdr35X +mQKTQBYPao8ZZNRZduLAY4jQACAqpjiLiU3Sq2kByHqxmd4APNHLC4jv6e/rqcKb+ HMaWMzxCtG6g5dUGUppX32CKARWgTTEiOu2vpc9A= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A627460B26 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] venus: vdec: fix decoded data size Date: Wed, 3 Oct 2018 17:00:21 +0530 Message-Id: <1538566221-21369-1-git-send-email-vgarodia@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Exisiting 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 --- 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++; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project