2017-11-17 21:46:00

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [RFC v5 07/11] [media] vb2: add in-fence support to QBUF

2017-11-17 Mauro Carvalho Chehab <[email protected]>:

> Em Fri, 17 Nov 2017 15:49:23 +0900
> Alexandre Courbot <[email protected]> escreveu:
>
> > > @@ -178,6 +179,12 @@ static int vb2_queue_or_prepare_buf(struct
> > > vb2_queue *q, struct v4l2_buffer *b,
> > > return -EINVAL;
> > > }
> > >
> > > + if ((b->fence_fd != 0 && b->fence_fd != -1) &&
> >
> > Why do we need to consider both values invalid? Can 0 ever be a valid fence
> > fd?
>
> Programs that don't use fences will initialize reserved2/fence_fd field
> at the uAPI call to zero.
>
> So, I guess using fd=0 here could be a problem. Anyway, I would, instead,
> do:
>
> if ((b->fence_fd < 1) &&
> ...
>
> as other negative values are likely invalid as well.

We are checking when the fence_fd is set but the flag wasn't. Checking
for < 1 is exactly the opposite. so we keep as is or do it fence_fd > 0.

Gustavo

From 1584351257539076619@xxx Fri Nov 17 21:45:02 +0000 2017
X-GM-THRID: 1584155088810136583
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-17 18:55:56

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [RFC v5 07/11] [media] vb2: add in-fence support to QBUF

Em Fri, 17 Nov 2017 11:08:01 -0200
Gustavo Padovan <[email protected]> escreveu:

> 2017-11-17 Mauro Carvalho Chehab <[email protected]>:
>
> > Em Fri, 17 Nov 2017 15:49:23 +0900
> > Alexandre Courbot <[email protected]> escreveu:
> >
> > > > @@ -178,6 +179,12 @@ static int vb2_queue_or_prepare_buf(struct
> > > > vb2_queue *q, struct v4l2_buffer *b,
> > > > return -EINVAL;
> > > > }
> > > >
> > > > + if ((b->fence_fd != 0 && b->fence_fd != -1) &&
> > >
> > > Why do we need to consider both values invalid? Can 0 ever be a valid fence
> > > fd?
> >
> > Programs that don't use fences will initialize reserved2/fence_fd field
> > at the uAPI call to zero.
> >
> > So, I guess using fd=0 here could be a problem. Anyway, I would, instead,
> > do:
> >
> > if ((b->fence_fd < 1) &&
> > ...
> >
> > as other negative values are likely invalid as well.
>
> We are checking when the fence_fd is set but the flag wasn't. Checking
> for < 1 is exactly the opposite. so we keep as is or do it fence_fd > 0.

Ah, yes. Anyway, I would stick with:
if ((b->fence_fd > 0) &&
...

>
> Gustavo


--
Thanks,
Mauro

From 1584339782368678260@xxx Fri Nov 17 18:42:38 +0000 2017
X-GM-THRID: 1584155088810136583
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread