Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5135111imu; Tue, 13 Nov 2018 01:33:41 -0800 (PST) X-Google-Smtp-Source: AJdET5cma3rCBouE6jYKjnjF27oQu36GdHHVk1zna/z9kuvj2F6OftFUlkg4xWa5T5YTphoyVal3 X-Received: by 2002:a63:6704:: with SMTP id b4mr4104474pgc.100.1542101621593; Tue, 13 Nov 2018 01:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542101621; cv=none; d=google.com; s=arc-20160816; b=RSYeQV6Dm3XRqppk9UiCuefupB7l8eV8+M+aatxhWnJJAYAByLgHDHsfsCLbfpm1Mj khH8X9gGdm3z3qvsDrro2NOeMFrpufgt1Eo7+TvtszZmMbMP2YkctXUsN5896wCJdt2+ NtfGA53bB8i4Xv+1cw17u1neMk0IwDBDwlpNBiI0OiaubGc6qAlwiGPgu1Vjtt36iyhJ /jfx8JDXH1e4QanTdfmTtOLlFCvjJJlyE3Ner0G7UbSehm2bT1rC4p5e43yGoLCPvX2Y i00LR2nQnIR9Ki1Qglh2nj5cJYRVBVFbD4ib+9uTAYKueVhYORgdtjo6xJ5Vsn1lIdbQ n3lA== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sPwmqQYNP9eqvMbepbeCIftdcUUAvxdfCAU5vJtMY5o=; b=KxeZOlRVexDQGrDTL7Y0TTwaWV9uh+lw8Bm6tPViH4qR+RKBkw3NLNu3sv2BtEIhGk bDqWdPYAU/HsjLph9xvJV8EAYzs+bjmmZdSG8c/mibtshV2r6t6CvrbRjmoBA2pG9gEy B+f+9pAVt7ZwHuoOrN7ChcTrdr2DrAArmAzaq6wq/AxKg9b62w/UgVgU0yVNtGS3t9wj tpYxbJ4qgpkZaecItghEIj/pHB0l6u4v7rto595SLO2sO/Gmou5sO8PgskZYz3e7Tkzr ksC+6nyur5sI1tN7vhPpNJXznjbJBzSiLDJwDNhduBdNEbAJNt36Eu9g29+ldhn5bOC0 Cplw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DQADcyQ0; 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 r11-v6si7874682pli.248.2018.11.13.01.33.25; Tue, 13 Nov 2018 01:33:41 -0800 (PST) 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=DQADcyQ0; 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 S1731632AbeKMT2I (ORCPT + 99 others); Tue, 13 Nov 2018 14:28:08 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38556 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731372AbeKMT2I (ORCPT ); Tue, 13 Nov 2018 14:28:08 -0500 Received: by mail-pg1-f196.google.com with SMTP id f8-v6so5417179pgq.5 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=t22ZxIgwAIjVJbPNSycizoL8fG0blQV05Ou/WzRHDGcqo2AGMbiZAmHuLUlhc3CHWU Sn4SivZPg1Y367YPe93WPU/MbBB+MOxyNTCmT65yyEx8pxzz6tN5PkIQ6sG7AftbAupD xwOgFTLAbePffYHYzRI8YOtuCD1M0rDyWoSZRXYOYrzgKvDho0fiok8rCnii+whIULLA 9KbpnbBGy0PW/LTpLble+YKAKUqHMvCJR6Usi0LN0zKiz4mxMhEnVB7sQLAM2eS7Byb2 RVo+qx48yQrJx30G8AzAGiOmzwW7EVaLdRJDzQTT9urRJdHxDxoolxQjWvKiS5p4o2d+ FYOw== X-Gm-Message-State: AGRZ1gL3tG7vp5pgfEL2feaxEMDAP/Fg01gZhzyQv/nl02M1+crCMQLB jpC/qxlLcxIKcLyiwJbuLAhiOQ== 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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++; -- 2.19.1.930.g4563a0d9d0-goog