Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp343634ybv; Wed, 19 Feb 2020 00:34:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzR9GbCnyS19X5uvTUNZL2x5V7nQvTgX5vUillS6RZfxelqNXzXh3EyojuNMlPxMXv9d1gr X-Received: by 2002:aca:2114:: with SMTP id 20mr3647300oiz.9.1582101243491; Wed, 19 Feb 2020 00:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582101243; cv=none; d=google.com; s=arc-20160816; b=kzot7C+VR+szJ7Qu4/jlzBcq05d9m74wl75lPLL6T/E/ULkYfV9dygjMnvP8b/SPk8 0EoDwkIZDoQ5Za4AagYS6eSUQ5eVf2w/kA/Hg7y5rUOgc/dmHBmvfAklfbVYvQWH9X9v ibzNPXdSRbs9lyS0uG+u+qnydHezr7N30N053sdR5exrvj7UsyRe8TuvXhj9RnA/oRpz 36BZjNB16XlzqpTqxDxUEO5B6gRw48M/Ao2eZ1QSGm/tox+SEyJ4i8aOmPs7q5zriEO+ eWZhwWsDhSwilhQlfVzZtwR6lcziBBs7kIZgzvw3Kn7R1guQSOjErFkGH5Q2Iw7aDX+4 B7lw== 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; bh=U4aCjIQZIUNVY1swRODrnzqk0CR4OpJjzREh1VmipCg=; b=spGQ4P/R6Pv0SGENHup0uL70eZDHWEfdmbaAILYzCCxw2jgFdR0LLiOAig5Bj1Vjv5 bHN611Vxghadrh1ScL9PoziEeBiQIpgZxJ+X4IuLzFj3w+AXv8Fnsd/ubQmEFOPUbovw UzQ3i5BqtJbhc4JGijytS7VAInB/uPo1ilCwZ5Pp3H/Gs56IFNB/I70Egd9p/WH5pDDG /q4Rs9nldtsclXIgmvdE/x49vdKNTEwJz7pK+mlmxtPnh+z8S7Q1Ni7JzrpGDTFrKzev 9EQEVlNhSyct/6MNuUbKCz8C3mM4rzhLxtoCEvpmOiLQG8GUwPef7z0jG/XqyccrtfbC wW6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s1 header.b=BdQLS4bG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62si1111683oib.131.2020.02.19.00.33.51; Wed, 19 Feb 2020 00:34:03 -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=@xs4all.nl header.s=s1 header.b=BdQLS4bG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbgBSIdo (ORCPT + 99 others); Wed, 19 Feb 2020 03:33:44 -0500 Received: from lb2-smtp-cloud7.xs4all.net ([194.109.24.28]:60771 "EHLO lb2-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbgBSIdo (ORCPT ); Wed, 19 Feb 2020 03:33:44 -0500 Received: from [192.168.2.10] ([46.9.235.248]) by smtp-cloud7.xs4all.net with ESMTPA id 4KnajzLNyP9a94KndjnQZ8; Wed, 19 Feb 2020 09:33:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1582101222; bh=U4aCjIQZIUNVY1swRODrnzqk0CR4OpJjzREh1VmipCg=; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=BdQLS4bGfYyGaWBHwId8rEQWPOPy1irz/tI3r4ZVGHCzxDhVdC4TzQI9WZPfJd0iA Qh7/mRS444K94GNpK8v3lHNgOWSQwoYi8dI56/aWLyzwc5/AbiQ1tGf4qGjDlKHUUG da9eegx5dOqBS/FiU0VhR+13EFLxXZzpGPAlhLQmJ6/Kpp+9UBFUFU+JqDevLIVpic DoV0fRDGe4LW6rJC50M+A0Pnf4i2kwKqXHOnEC1IoDx9FDPdxGhKH4NAu9H54ndl8Z mk3EqwGGBdsQP96c8olsg311dkyaJUefmpmt1d/GRZPVwtreE2I3nf+0E626JJX2s8 zHlyQlAQsNAYg== Subject: Re: [RFC][PATCHv2 09/12] videobuf2: let user-space know if driver supports cache hints To: Sergey Senozhatsky , Hans Verkuil , Tomasz Figa , Mauro Carvalho Chehab , Kyungmin Park , Marek Szyprowski Cc: Sakari Ailus , Laurent Pinchart , Pawel Osciak , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200204025641.218376-1-senozhatsky@chromium.org> <20200204025641.218376-10-senozhatsky@chromium.org> From: Hans Verkuil Message-ID: <2a00bf5c-462e-8d35-844c-55ce2383b8e2@xs4all.nl> Date: Wed, 19 Feb 2020 09:33:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200204025641.218376-10-senozhatsky@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfKAipsOTGflQIVzAKHv/f8PHD8rgdCZg3/cZg+G8zuAR56O83+FOHU3nacfXDUOCJNaRWo69OPauisxgllNKypIewXOCJTMOFZqDXY4OtiD7Hrrkaf40 glFNRTCn7plDtPzidS0uNOCb8jfgMey2VdS3QfU4ONlCfI/robe7HDVkNNn6glpEJJBNJxoPdugY/sWCQ2TLUZxRgL6GADVoJlynGu7vtz1sAUgIpXLe5F1z Ooaw77mPpTRUpzeu39yKtuA3lnY6EPwF6vaiYFqzq9nVF/41dorGu+s20vFVYGsQEdVNiLoQ6A15b1TEYLVY/Ikjsi2+QER37dQzYmGWV4oboWWrixrb7mgU bBKUCNlonhbJoAV0BR3AR3zpWMa9dQAZau9HdaKxm4dxuDZuLC1g2YkBjSiwDE/LCvHNzZ/cDBE+RigQMa9rACLOtZlRR9XcJjVazxj5sUtD+pvgVsZXECH5 it31l/TluPqnXSqufUZ5yjlpL1F/hZ+jDaEvfFnf5GYw4ImehHIg6ZV5XeQBTKr+aMbJ+PKbF8R4yPnM Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/4/20 3:56 AM, Sergey Senozhatsky wrote: > Add V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS to fill_buf_caps(), which > is set when queue supports user-space cache management hints. Ah, you add the capability here :-) This should be moved forward in the series. Actually, I think this should be merged with the first patch of the series. Regards, Hans > > Change-Id: Ieac93f3726c61fd3b88e02c36980c1f3c7a82ecc > Signed-off-by: Sergey Senozhatsky > --- > Documentation/media/uapi/v4l/vidioc-reqbufs.rst | 7 +++++++ > drivers/media/common/videobuf2/videobuf2-v4l2.c | 2 ++ > include/uapi/linux/videodev2.h | 1 + > 3 files changed, 10 insertions(+) > > diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst > index 9741dac0d5b3..80603f57eb8a 100644 > --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst > +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst > @@ -165,6 +165,13 @@ aborting or finishing any DMA in progress, an implicit > - Only valid for stateless decoders. If set, then userspace can set the > ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag to hold off on returning the > capture buffer until the OUTPUT timestamp changes. > + * - ``V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS`` > + - 0x00000040 > + - Set when the queue/buffer support memory consistency and cache > + management hints. See :ref:`V4L2_FLAG_MEMORY_NON_CONSISTENT`, > + :ref:`V4L2_BUF_FLAG_NO_CACHE_INVALIDATE` and > + :ref:`V4L2_BUF_FLAG_NO_CACHE_CLEAN`. > + > > Return Value > ============ > diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c > index eb5d1306cb03..22ae0ff64684 100644 > --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c > +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c > @@ -698,6 +698,8 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps) > *caps |= V4L2_BUF_CAP_SUPPORTS_DMABUF; > if (q->subsystem_flags & VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF) > *caps |= V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF; > + if (q->allow_cache_hints) > + *caps |= V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS; > #ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API > if (q->supports_requests) > *caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index 169a8cf345ed..12b1bd220347 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -951,6 +951,7 @@ struct v4l2_requestbuffers { > #define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3) > #define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4) > #define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 5) > +#define V4L2_BUF_CAP_SUPPORTS_CACHE_HINTS (1 << 6) > > /** > * struct v4l2_plane - plane info for multi-planar buffers >