Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3628734imm; Mon, 2 Jul 2018 02:38:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ832YftcBNwSG5AebJ6RCcJeeIKfgZWgWap3FRba8rCBXFas7sSIv+Tl6rzm9lK7RDNgsL X-Received: by 2002:a17:902:6802:: with SMTP id h2-v6mr24784530plk.113.1530524281732; Mon, 02 Jul 2018 02:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530524281; cv=none; d=google.com; s=arc-20160816; b=q9Y9iE5VRj80lRqD1K9gGBRPtZ2IHfYn+75iwNVkDuMcu+Jiqr6aAiYCpCuID4jStD GpKNUMm8dLnE9Hp/P3tbAJnMVeu3/DciGyosdF6lxfqcEvrJfHiL5j6p0NiKa+VQF+zO kGkg91LTVsITU9l6a2qRda7ko/APZ+Z04hVW3o6IFLjWxHpRy1hhE5VbHuSyQwPzHjJS vjHLz534mDXVOKtGev5MnQR7ECkk00NP1mCzgKfC2KtFTNtjPSGkqAmizYWrd9uZDsEF gI3pyWrRvNbEq8zWdowNxEUv4RozIig4KocExYpdbTKpMdUYQzhZHNkfRaPwpMSKQ9Os OtVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=1TjdyQXsyL3mjkJnB80bb9GrDAuptfPkHXcvzQkECS4=; b=H1Ge34WPoayQlYfBj9X6r/V0OfveNpZWMzM1a2X7eOzYb7p73jXtQ/S71OVBWrWj5L 60saHHUDN1T8nEIrHTxlen07xHoiNXEYpFCH3eiua4K7Ghy2EnrjDmuswbH8HRJ/Hgl8 SI/lqAHLPQjlvhItxGNin1NyJ+LcvfCbynNj4hM+OF6RYnBEp/E97TggTyN/oAokbCaO jVfV53wCe9kUqMo78EudYPziHk7Hqo/IPzC2rVN9euHTLukPDdBZaqUlbeXuKMaS9Iiq U3s94x9FSHB+4cqETFHVVPWCQf6GxGmXwJ628Fzj/i3LFiNxPEgIrn00jAJi1J19hnoU KekQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eURRN7ul; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si1002131pfb.131.2018.07.02.02.37.47; Mon, 02 Jul 2018 02:38:01 -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=@chromium.org header.s=google header.b=eURRN7ul; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933799AbeGBIv0 (ORCPT + 99 others); Mon, 2 Jul 2018 04:51:26 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:35444 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753621AbeGBIvQ (ORCPT ); Mon, 2 Jul 2018 04:51:16 -0400 Received: by mail-io0-f196.google.com with SMTP id q4-v6so14056384iob.2 for ; Mon, 02 Jul 2018 01:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1TjdyQXsyL3mjkJnB80bb9GrDAuptfPkHXcvzQkECS4=; b=eURRN7ultZ6G3S6dJ+b+VWR9j8IkA4BCUWQgah+CYUFBUi0g7fKfPayJFzi5mmMT9X z/wluxpEOCsH/su0YPMvO+pPdD5pO2SDsoQWw6Xthy1KmaYoIYZLwqCFFE2t1oc97T2O gIZ337TcdxoBXK+tUbsHhzziHBd1Rv4ocY0W8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1TjdyQXsyL3mjkJnB80bb9GrDAuptfPkHXcvzQkECS4=; b=HL31C0iXfnI7sG25pd6BnMqZfQlHxa2tfCPWGOnSZ9XIRtCDdjsTPhZYpjhykygnww ik4A8wJ0qggFO6lu3rdwKFDk2RsYhmatNjirPqT7J3LSV9vtYvZtV075Oq8gBe8DsYSL zH9zdxvGPWC8Dhu4b37On8+aLVVB4PX9L2sVUBOvfBC5unNZJU5RXivsJShcD6vV8p/b yw7/qJHkddAGss/IhAU1BWJcnTdFrXqcJ0K1xAEAWGkzTln85OugIj+k6wzI1EkWwRR3 nh3usHGyHNnaw7Kp+CfiFABXvviYRlsLC8ZC1ocSbmX4WZftpiYxDZoRBuDyk2NoqJBW ZpHQ== X-Gm-Message-State: APt69E3jip9V5+M9rcvEc9C31dLPt4KM87nU/hFtEczodUgVVmukPLpe k/gkIiKi25/3tsUs3sCSzXjTKGBP0eE= X-Received: by 2002:a6b:96c2:: with SMTP id y185-v6mr8921398iod.161.1530521476074; Mon, 02 Jul 2018 01:51:16 -0700 (PDT) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com. [209.85.223.171]) by smtp.gmail.com with ESMTPSA id v199-v6sm3800319itb.18.2018.07.02.01.51.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 01:51:15 -0700 (PDT) Received: by mail-io0-f171.google.com with SMTP id l25-v6so14030301ioh.12 for ; Mon, 02 Jul 2018 01:51:15 -0700 (PDT) X-Received: by 2002:a6b:33ce:: with SMTP id z197-v6mr3336225ioz.112.1530521474682; Mon, 02 Jul 2018 01:51:14 -0700 (PDT) MIME-Version: 1.0 References: <1530517447-29296-1-git-send-email-vgarodia@codeaurora.org> In-Reply-To: <1530517447-29296-1-git-send-email-vgarodia@codeaurora.org> From: Alexandre Courbot Date: Mon, 2 Jul 2018 17:51:03 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] venus: vdec: fix decoded data size To: vgarodia@codeaurora.org Cc: Stanimir Varbanov , Linux Media Mailing List , linux-arm-msm@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 2, 2018 at 4:44 PM Vikash Garodia wrote: > > Exisiting code returns the max of the decoded s/Exisiting/Existing Also the lines of your commit message look pretty short - I think the standard for kernel log messges is 72 chars? > 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); Reviewed-by: Alexandre Courbot Tested-by: Alexandre Courbot This indeed reports the correct size to the client. If bytesused were larger than the size of the buffer we would be having some trouble anyway. Actually in my tree I was using the following patch: --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -924,13 +924,12 @@ 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); vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++; if (vbuf->flags & V4L2_BUF_FLAG_LAST) { const struct v4l2_event ev = { .type = V4L2_EVENT_EOS }; - vb->planes[0].bytesused = bytesused; v4l2_event_queue_fh(&inst->fh, &ev); Given that we are now taking the minimum of these two values, it seems to me that we don't need to set bytesused again in case we are dealing with the last buffer? Stanimir, what do you think?