Received: by 10.192.165.148 with SMTP id m20csp4415900imm; Tue, 24 Apr 2018 02:18:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48EFUuPCy92aucu5yc+WHYH30sP6qLGBNNFo+3EYkcWcqU9qE2nFpOiK0o2ux47IelaWnZ0 X-Received: by 2002:a17:902:760f:: with SMTP id k15-v6mr23939423pll.294.1524561486784; Tue, 24 Apr 2018 02:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524561486; cv=none; d=google.com; s=arc-20160816; b=qb17f3jYS07pFkcmLs0bpTR7Z4z6vjyQPLbjwm3WwmsE4xU/BEE0NlZ+JzuBQu9lO1 EYa9W4701dge/SxCQ7t7Od5aDQkLpTh9g3OULrFL6z4jQorF5NouQF9J1GXJs4yofP+g 9mxhnuhPoPHK/SNyvaF9vvcVfSUrS+wYT50q1A0js0tk1HlNaPXsTcseC4OxSd4GRs8w lNPzapu+8NHd9+vqtemxoqoPHaMwflp8TyUZe99u8VU0NNMG8mDa6f5ZbTPCIU4KGOBU ifanQ6ejk2saiLDhNNod9a958Eqp3UtsuIDX7ImfTsAMIo+yzKydy/lQ5S6/eVMVHqOh qg4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/Uh72xbszD0rtRQmlKubtQiQre+5uHP9CSC+hMLWpo8=; b=01miRzVgNhYEDQXMH7xd3MZuJMJ5/LJ3ifVlF7cJtk8DpWX8ZbR/nXeIMzo1X459Mq bCuoGAwp+V90HZk73/8K+lLVjUPzFpE8DizUF29tSIAJGaNW9ljUn1o2sgv9FoAd4VFu aXTZacGDFMClIJcml/d1MLaQ+EH76p7eC8+srhVJbxprj2q5mvcT0Vmhej94ZBXD4bBK hQpnHVdHRGqncYkJCGJ8V6UiYgzUm7+P2vjUwjuJ5pEDUsnT5R05HwW9jp55BXUjE5/3 7p7MumlRTOqDvXiAjEzPdLgUwK98jCoxu3Ox0H7vB/D7baBI4OthNV+vBAY/+xIfU7CQ nhQQ== ARC-Authentication-Results: i=1; mx.google.com; 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 q3si11295160pgs.516.2018.04.24.02.17.51; Tue, 24 Apr 2018 02:18:06 -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; 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 S1756524AbeDXIhO (ORCPT + 99 others); Tue, 24 Apr 2018 04:37:14 -0400 Received: from mga05.intel.com ([192.55.52.43]:32132 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755724AbeDXIhM (ORCPT ); Tue, 24 Apr 2018 04:37:12 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2018 01:37:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,321,1520924400"; d="scan'208";a="48607366" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2018 01:37:07 -0700 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id 9FCDA2050A; Tue, 24 Apr 2018 11:37:06 +0300 (EEST) Date: Tue, 24 Apr 2018 11:37:06 +0300 From: Sakari Ailus To: Paul Kocialkowski Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Hans Verkuil , Philipp Zabel , Arnd Bergmann , Alexandre Courbot , Tomasz Figa Subject: Re: [PATCH v2 03/10] videobuf2-core: Add helper to get buffer private data from media request Message-ID: <20180424083706.cjwhq6nvkmitighq@paasikivi.fi.intel.com> References: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> <20180419154124.17512-4-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180419154124.17512-4-paul.kocialkowski@bootlin.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On Thu, Apr 19, 2018 at 05:41:17PM +0200, Paul Kocialkowski wrote: > When calling media operation driver callbacks related to media requests, > only a pointer to the request itself is provided, which is insufficient > to retrieve the driver's context. Since the driver context is usually > set as vb2 queue private data and given that the core can determine > which objects attached to the request are buffers, it is possible to > extract the associated private data for the first buffer found. > > This is required in order to access the current m2m context from m2m > drivers' private data in the context of media request operation > callbacks. More specifically, this allows scheduling m2m device runs > from the newly-introduced request complete operation. Rather than fetching a random buffer from the request objects, I'd suggest to allocate a struct that contains the media request and place the required information there. Such as was in my older patchset. The patch won't apply but the approach would be useful I think. > > Signed-off-by: Paul Kocialkowski > --- > drivers/media/common/videobuf2/videobuf2-core.c | 15 +++++++++++++++ > include/media/videobuf2-core.h | 1 + > 2 files changed, 16 insertions(+) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > index 13c9d9e243dd..6fa46bfc620f 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -1351,6 +1351,21 @@ bool vb2_core_request_has_buffers(struct media_request *req) > } > EXPORT_SYMBOL_GPL(vb2_core_request_has_buffers); > > +void *vb2_core_request_find_buffer_priv(struct media_request *req) > +{ > + struct media_request_object *obj; > + struct vb2_buffer *vb; > + > + obj = media_request_object_find(req, &vb2_core_req_ops, NULL); > + if (!obj) > + return NULL; > + > + vb = container_of(obj, struct vb2_buffer, req_obj); > + > + return vb2_get_drv_priv(vb->vb2_queue); > +} > +EXPORT_SYMBOL_GPL(vb2_core_request_find_buffer_priv); > + > int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb, > struct media_request *req) > { > diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h > index 032bd1bec555..65c0cf6afb55 100644 > --- a/include/media/videobuf2-core.h > +++ b/include/media/videobuf2-core.h > @@ -1153,4 +1153,5 @@ int vb2_verify_memory_type(struct vb2_queue *q, > enum vb2_memory memory, unsigned int type); > > bool vb2_core_request_has_buffers(struct media_request *req); > +void *vb2_core_request_find_buffer_priv(struct media_request *req); > #endif /* _MEDIA_VIDEOBUF2_CORE_H */ > -- > 2.16.3 > -- Sakari Ailus sakari.ailus@linux.intel.com