Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1323619pxu; Fri, 27 Nov 2020 05:02:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrZCH+Zkys/x77cBvDo2MgvQ101IkVPls4R1G54ln6luNP99nJMi2TbelACWO3Bzz/UkMq X-Received: by 2002:aa7:c3c1:: with SMTP id l1mr7329357edr.153.1606482131160; Fri, 27 Nov 2020 05:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606482131; cv=none; d=google.com; s=arc-20160816; b=Wo6WCqF8SReipvvRvTrM/HGVy0xEhvLZoZLpqkVznDrSI4S0juJyD0Ggopxl1ls6C/ umaZ1iEF9zPmWTP2soL+rmBXap+Ve1AeEjw8idmQMu72GMOQZjqVuzhHTaaZ7EZ4fCCV vNVvDnqx4FjIG9WT4fLnDMcazLKdlgnECqBTG6KoW1kJosW6mYFZr4xk2JDSB77XC0tI KVzZltVZgBymSGtbQel/SYH5VQ/jga8KNZMYnGkODqBMRr5G8RuCcJI9FtwLZ7FxT95T SKyKiWNlKOMmbqaHtbyVG80x5l1xkHxca1d+JbWgx1gvENxtxf66Oe4adD7nWNzWCckx 2ACA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=HOMppZobt6qFRcDaM53vHK/IM1PaO9vvUi20G1XPmOw=; b=rKM1EjrLLgtW3OhQON5HNA1FlEADWc2gIyTLHLit3ZKAEcqfMYrijEu7y+ub5FZbQA 6qF60VEykJj1y2A1dXR2gCymCFs4FQcklHlDUcdgGXHUsimNgI51l/KMVn3OQpjeIWOG E4fqhHA1RI0052xb8A5N8MbIRo5zlJll8VReNcaGQ9QJBTdDEKmB3csgK64EKpnIUiUi zfIGgmm27CVr9HfRA9i9285J/Z5vDdYGdANGMIZA3i7qIJA+XGZN4Cnm6f0qf8xcCnPg 1nTewoEJTUxSwXYEK5Mt1xCxerq17Fx8k4qy46mdX6rOsRo0g8boXdxnWG7Hh2T++/3b aGMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s2 header.b=YSJ5gwPm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf22si5179014edb.560.2020.11.27.05.01.44; Fri, 27 Nov 2020 05:02:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s2 header.b=YSJ5gwPm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729527AbgK0NAF (ORCPT + 99 others); Fri, 27 Nov 2020 08:00:05 -0500 Received: from lb3-smtp-cloud8.xs4all.net ([194.109.24.29]:54515 "EHLO lb3-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728404AbgK0NAE (ORCPT ); Fri, 27 Nov 2020 08:00:04 -0500 Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud8.xs4all.net with ESMTPA id idLykQ9HIDuFjidM2kqtAp; Fri, 27 Nov 2020 14:00:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s2; t=1606482002; bh=HOMppZobt6qFRcDaM53vHK/IM1PaO9vvUi20G1XPmOw=; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=YSJ5gwPmwaue9ecT8oxVpdRs0Byukek1K9Uuf3NMFbdaD/5KackXMAPdE2HqW5x5R 1mkLdiL34MJZD8CKuF3ZmVNwUhtIByWleBV6Y/iHPtPdQQ1dusgBOjC5X5Ponab6VX rJfhIVBRQdOaFhIJnI23F38G74g11IK1GW6tsG4Pd671HC9NI81ZcXVYHJ5xSZKPDc 3BpYzYohujEc65TQfzpQwywuRWDUH7uvjzeYhkfDXIpsq1RkKtWvyTFl+jCA8LstYi cm/sUeaufzsFF7zSqOBZZYiTU+WlnA7C3v1dShz4zdyyCAjQfNA8BC/Q7sDSLIyX+Y QwasEP9UEeJOw== Subject: Re: [PATCH] media: vb2: always set buffer cache sync hints To: Sergey Senozhatsky , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky References: <20201127094136.1051071-1-sergey.senozhatsky@gmail.com> From: Hans Verkuil Message-ID: <0dbfa509-8c82-7470-c18b-24ab5c92dc4b@xs4all.nl> Date: Fri, 27 Nov 2020 13:59:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201127094136.1051071-1-sergey.senozhatsky@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfF9WdxLsIljKXQ86VtwCHlJGUVW9BlpEOCet6vkdk1HOeJYbwsqj+ni99c22/uEahuaYHePbGdnzvrlzHNCTN8+qrE6EgCMWIRLUSnuLeXQoRN5/wgI6 QZC8ul1RjHRyzULD35ZdJLoegGBz0wAh97ZD/5M8mCa6GPepgeWV5x3lemSTblbts+Zkg+gp9YkvK7WG5qAZvTrqVZ0sYs1NbaDjoND17AgW9E9X+mVJsR6H MXpz4uHWunGEG/TwtgUFiyJbek4EfcSMx51G8pZxajm+RqYjDoymHy6va2s7+j2Xt7ZoQaH5vOSECOq1iX7Jo8OPsNEjAet39cWGyAVDBP4JB734shO1mLA4 U8543Sejhz4cSs4RqyHhKxdF7CFugV3gnwfMRZto1q4C1JOeea/s6rhQYTzARghj2GrvAUxh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/11/2020 10:41, Sergey Senozhatsky wrote: > We need to always set ->need_cache_sync_on_prepare and > ->need_cache_sync_on_finish when we initialize vb2 buffer. > > Currently these flags are set/adjusted only in V4L2's > vb2_queue_or_prepare_buf(), which means that for the code > paths that don't use V4L2 vb2 will always tell videobuf2 > core to skip ->prepare() and ->finish() cache syncs/flushes. > > This is a quick solution that should do the trick. The > proper fix, however, is much more complicated and requires > a rather big videobuf2 refactoring - we need to move cache > sync/flush decision making out of core videobuf2 to the > allocators. > > Reported-by: Tomasz Figa > Signed-off-by: Sergey Senozhatsky > --- > drivers/media/common/videobuf2/videobuf2-core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > index 5499013cf82e..14a26888a892 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -414,6 +414,8 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory, > vb->index = q->num_buffers + buffer; > vb->type = q->type; > vb->memory = memory; > + vb->need_cache_sync_on_prepare = 1; > + vb->need_cache_sync_on_finish = 1; I think this needs a comment, basically explaining what you said in the commit log. It's not obvious from the code that this is a workaround. Regards, Hans > for (plane = 0; plane < num_planes; ++plane) { > vb->planes[plane].length = plane_sizes[plane]; > vb->planes[plane].min_length = plane_sizes[plane]; >