From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gustavo Padovan Subject: Re: [PATCH 1/2] dma-buf/fence: add fence_collection fences Date: Thu, 19 May 2016 10:20:07 -0300 Message-ID: <20160519132007.GA15155@joana> References: <1463605193-18040-1-git-send-email-gustavo@padovan.org> <20160518225710.GA32627@nuc-i3427.alporthouse.com> <573D6F67.7070109@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <573D6F67.7070109@amd.com> Sender: linux-kernel-owner@vger.kernel.org To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Chris Wilson , Gustavo Padovan , dri-devel@lists.freedesktop.org, marcheu@google.com, Daniel Stone , seanpaul@google.com, Daniel Vetter , linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Alex Deucher , John Harrison , m.chehab@samsung.com List-Id: dri-devel@lists.freedesktop.org Hi Christian, 2016-05-19 Christian K=F6nig : > Am 19.05.2016 um 00:57 schrieb Chris Wilson: > > On Wed, May 18, 2016 at 05:59:52PM -0300, Gustavo Padovan wrote: > > > +static void collection_check_cb_func(struct fence *fence, struct= fence_cb *cb) > > > +{ > > > + struct fence_collection_cb *f_cb; > > > + struct fence_collection *collection; > > > + > > > + f_cb =3D container_of(cb, struct fence_collection_cb, cb); > > > + collection =3D f_cb->collection; > > > + > > > + if (atomic_dec_and_test(&collection->num_pending_fences)) > > > + fence_signal(&collection->base); > > > +} > > > + > > > +static bool fence_collection_enable_signaling(struct fence *fenc= e) > > > +{ > > > + struct fence_collection *collection =3D to_fence_collection(fen= ce); > > > + int i; > > > + > > > + for (i =3D 0 ; i < collection->num_fences ; i++) { > > > + if (fence_add_callback(collection->fences[i].fence, > > > + &collection->fences[i].cb, > > > + collection_check_cb_func)) { > > > + atomic_dec(&collection->num_pending_fences); > > > + } > > > + } > > We don't always have a convenient means to preallocate an array of > > fences to use. Keeping a list of fences in addition to the array wo= uld > > be easier to user in many circumstances. >=20 > I agree that there is use for such an implementation as well, but as > mentioned in the last review cycle we intentionally chose an array in= stead > of a more complex implementation here. >=20 > This way the array can be passed to function like fence_wait_any_time= out() > as well. >=20 > I also suggested to rename it to fence_array to make that difference = clear > and allow for another implementation to live side by side with this. >=20 > My crux at the moment is that I need both for the amdgpu driver, an a= rray > based implementation and a collection like one. >=20 > Gustavo would you mind if I take your patches and work a bit on this? Please go ahead with this and let me know if you need anything from me. Gustavo