Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp414957imm; Wed, 18 Jul 2018 04:33:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe7CrfGPnNNnYjk9O7Eh4xf6wnssB6zt4cjYL2VsamIW+LFPVktORW4drbkwA7wLujJ48Wd X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr4898708pfm.254.1531913596255; Wed, 18 Jul 2018 04:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531913596; cv=none; d=google.com; s=arc-20160816; b=o3mDyyEKIWqq2voe74VJCwevwJ3Z1sdjKp7HP6m7s/P8/e25qCAAb6Oegbzpvgx3Qe xugQYi21hnFDCu07TmB89bNDIdg8r/DfD8p+DzRKOOsO2WckpTNLFFDlqfWBhFsKEr+N pcvonlXM1v1hFCZl72AN8IQE3H6J3U0YwKvKQ+kOM8cI410JQp3kYhgBYIFpKHAN9brw 8FOpdJwlvE/xjC1wIFy61O9qzjxAILqyOxROFVgu+Ki+YgTZia5HDBIbeSPKSMFaDXrw srTcR3r+Xh+h4e8OEf2C9ZGT4fB1GwVna/ouypPvIqhEO8uMcd6U2gOfH/ktRzq9npRd Qd+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=MX5g16XKofHSlXrsXIl3prxm5Y6ASxP2sUInxHB4+Eg=; b=ztJ/g6ozR79vMYVfGqnm+69pokA5DIlODJw02aqiYiAz7zGreLilNRTVhV/yU1klaL MhlDuRYY2dC6sS3ROSAPb3yBUEXUJOX0EvvCj5vdllDuDI1XJzgbp+EjC9SaDTPTK4Sg NCp7LUDso+J1+76Ci2+ODwCjpkeAbX9jo7LTX7gO/0hRiSjBGNRYRaqjv6BnnTgdN9Lm p/k33VPwn+L/zcq171G/rfmaNcN1tRGaP0wU3rB7NigVQNan1gWSNf41LS/XAhPJLW+L TenHEAvQIyxHUZhJvlF6s5/e59fSO/ssn/58Hp8Z3smLKQQ2L7whcEqdCLGRNt8TKLWv O1cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KgidKwAy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17-v6si2884509plq.221.2018.07.18.04.33.01; Wed, 18 Jul 2018 04:33:16 -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=@linaro.org header.s=google header.b=KgidKwAy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730329AbeGRMIl (ORCPT + 99 others); Wed, 18 Jul 2018 08:08:41 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37702 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728626AbeGRMIl (ORCPT ); Wed, 18 Jul 2018 08:08:41 -0400 Received: by mail-wm0-f65.google.com with SMTP id a19-v6so2498402wmb.2 for ; Wed, 18 Jul 2018 04:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=MX5g16XKofHSlXrsXIl3prxm5Y6ASxP2sUInxHB4+Eg=; b=KgidKwAyEnkcwRyVRdhwR8QDn3Xqysu3q6+wxtkoZWNAEpLyfN8iP6GqtSfciZUeQw HznG9e3VdROOaUY74UWJHP38g+lTg/Vzk3ARFLbmTfrxRfNsaugvHXZR70eKb/UiMUdq 7dBlhadvLBZsl8CXhvAcplENigcaxWg9xYbL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MX5g16XKofHSlXrsXIl3prxm5Y6ASxP2sUInxHB4+Eg=; b=a7cKsxulK38+dDi1AS+XdWrPd1BHzXWX0wZK2WVVvrvIXOcjUjDQHrG9bQTyzbKMuW Oo5sytlPeUHermiBGHu+tLKGX7x10RgJd76a6R2dWVxb6UAUqQaYi3DxyhPBX2GK6N0R UYVjE9t+xEYcxH1o2unP81Na/wiJ5Cw+ktGcJvQNCQSgs6OJ4jbsO8/sST22FjD9uVtB 0bGQl1qYRVcoDFUWJQERwJCpQzs24WwXUEX8Esh8SmT1ybyd2lP02G8RL2hlXZt1RUNR k10lTrsp9XEh5Ttt74+AjtnAmyiZKKfrlu2vEdA2YhiiZo1U7Wc1uNYgSEdBSYN9FLhW ntyg== X-Gm-Message-State: AOUpUlEd4mt+M/unFp0jUzmQ/jrDTcRs1He+VR5feE5qtaXm/AoAubBD T1CIeH2+b0cQUIR+py1pfvL9DQ== X-Received: by 2002:a1c:2352:: with SMTP id j79-v6mr1385009wmj.124.1531913472254; Wed, 18 Jul 2018 04:31:12 -0700 (PDT) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id w9-v6sm4703225wrr.77.2018.07.18.04.31.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 04:31:11 -0700 (PDT) Subject: Re: [PATCH] venus: vdec: fix decoded data size To: Vikash Garodia Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, acourbot@chromium.org References: <1530517447-29296-1-git-send-email-vgarodia@codeaurora.org> From: Stanimir Varbanov Message-ID: <01451f8e-aea3-b276-cb01-b0666a837d62@linaro.org> Date: Wed, 18 Jul 2018 14:31:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1530517447-29296-1-git-send-email-vgarodia@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vikash, On 07/02/2018 10:44 AM, Vikash Garodia wrote: > 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. > > Change-Id: Ie6f3429c0cb23f682544748d181fa4fa63ca2e28 > Signed-off-by: Vikash Garodia > --- > drivers/media/platform/qcom/venus/vdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c > index d079aeb..ada1d2f 100644 > --- a/drivers/media/platform/qcom/venus/vdec.c > +++ b/drivers/media/platform/qcom/venus/vdec.c > @@ -890,7 +890,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, > > vb = &vbuf->vb2_buf; > vb->planes[0].bytesused = > - max_t(unsigned int, opb_sz, bytesused); > + min_t(unsigned int, opb_sz, bytesused); Most probably my intension was to avoid bytesused == 0, but that is allowed from v4l2 driver -> userspace direction Could you drop min/max_t macros at all and use bytesused directly i.e. vb2_set_plane_payload(vb, 0, bytesused) -- regards, Stan