Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2104532iof; Tue, 7 Jun 2022 19:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuFDkPyz98NGl6z+hH7mHNZqxrUHur9FffudqdRmrPZ/BSHr/kOhrRha8xjtl6Wz0aUS1h X-Received: by 2002:a63:5b5d:0:b0:3fc:97d5:f8b2 with SMTP id l29-20020a635b5d000000b003fc97d5f8b2mr28567489pgm.322.1654656857092; Tue, 07 Jun 2022 19:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656857; cv=none; d=google.com; s=arc-20160816; b=nGU4y9PjaWWBu56Ec8yo4jusEA9Y0QoaZukCpS5pJanLfHk5mK05tz7cwVR71jwRGH hNXc8rkkrg9yufWy445Oolad8mt6Y+RgMgkE62BejwUxcivfJu9TKs8cFym0Z3e4Z8/3 oMIyR8BspHEvQvWKDZ0AiBq6DWMm3insqPeHCXYtqql4oN7Nt0TsggOZHJjPWiTkXO1R hUoktltsSnpguA7NwXaNG7FMSsmKh1BqAPPZZBFf6PXPHi9xjQ1u8oEScrqevL1ejETY lwEF/X86IOpQohKIEV0ARvygjlZiD/AnKnCEyiagH/U0KhHzBR88XIUbSrud1xxA6N0x hJ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GwiHiMZjayjXNEGAa2/o7KeN5r4Tf6hid1udjAcsd+k=; b=S9te75AAsNYuVUrCQdj+ZABZcDXuNT1g9ugJqgC3/ejchrBkAOfcc7IvSXa1FNJLGf DxWupirEd09MlsJxQ4tEj+iy9y/G+F+gfjSQvEFX9nBfQiUop/1yFc9RYr3AKBnWDqXW YpGFmlqLj5Jv6Am2bZZoRQKV1KDNk1Zc3qCIjaHby3+C2BUVgr9hp+AIcfpTj5g1eiKe NAVenqlhTAO4bL2JS+GGLzV3zeg6zNpa3mtLhsYhC4bZWM8u/I/mTEAbUenQg4KW6WtE NmE6HdyRr23Xr3VIOLOnvRkpqiJ25X/L5jkxLxBMkz4YiV/ki8voMVsTN+tsjD1C/+uU uLKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b+akAB8s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l7-20020a17090aaa8700b001dfd2940a5asi28957714pjq.112.2022.06.07.19.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:54:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b+akAB8s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B676260CF1; Tue, 7 Jun 2022 18:29:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380767AbiFGWh5 (ORCPT + 99 others); Tue, 7 Jun 2022 18:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378396AbiFGVY6 (ORCPT ); Tue, 7 Jun 2022 17:24:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 355DE14FC9E; Tue, 7 Jun 2022 12:01:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A58BBB82391; Tue, 7 Jun 2022 19:01:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0687C385A2; Tue, 7 Jun 2022 19:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628470; bh=d8rn+GMSsyVcqcclXF/X1Gus3C71I/FtkotnJluWPxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b+akAB8sdI3UtKyeT0TVwfVIwdROm666F3ULYcg3yqQVVfu+cMn5Du4cXO1ErOYrg P+BwIu89PRbjN3aBlzGlPPyCzlzu9O3I2vqm3MvaiZL2wzA2iLK76ypklAoKom2/AA 5DXbG0Zxs3XcHMYiSx1ZHnCDcKEfR6qpiMz01Fbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 342/879] media: hantro: Empty encoder capture buffers by default Date: Tue, 7 Jun 2022 18:57:40 +0200 Message-Id: <20220607165012.787189357@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai [ Upstream commit 309373a3571ef7175bd9da0c9b13476a718e8478 ] The payload size for encoder capture buffers is set by the driver upon finishing encoding each frame, based on the encoded length returned from hardware, and whatever header and padding length used. Setting a non-zero default serves no real purpose, and also causes issues if the capture buffer is returned to userspace unused, confusing the application. Instead, always set the payload size to 0 for encoder capture buffers when preparing them. Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver") Fixes: 082aaecff35f ("media: hantro: Fix .buf_prepare") Signed-off-by: Chen-Yu Tsai Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/hantro/hantro_v4l2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index 8b8276ff7b28..71a6279750bf 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -768,8 +768,12 @@ static int hantro_buf_prepare(struct vb2_buffer *vb) * (for OUTPUT buffers, if userspace passes 0 bytesused, v4l2-core sets * it to buffer length). */ - if (V4L2_TYPE_IS_CAPTURE(vq->type)) - vb2_set_plane_payload(vb, 0, pix_fmt->plane_fmt[0].sizeimage); + if (V4L2_TYPE_IS_CAPTURE(vq->type)) { + if (ctx->is_encoder) + vb2_set_plane_payload(vb, 0, 0); + else + vb2_set_plane_payload(vb, 0, pix_fmt->plane_fmt[0].sizeimage); + } return 0; } -- 2.35.1