[igt-dev] [PATCH i-g-t v5 05/13] igt: fb: Refactor dumb buffer allocation path

Maxime Ripard maxime.ripard at bootlin.com
Wed Jan 30 14:18:08 UTC 2019


Hi!

On Fri, Jan 25, 2019 at 08:16:52AM -0800, Deepak Singh Rawat wrote:
> On Fri, 2019-01-25 at 15:58 +0100, Maxime Ripard wrote:
> > The else condition is not needed, since all the other conditions
> > return
> > when they are done.
> > 
> > Move the KMS dumb buffer allocation outside of the outer else
> > condition,
> > this will also allow to ease later changes.
> > 
> > Reviewed-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
> > Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
> > ---
> >  lib/igt_fb.c | 25 +++++++++++++++++--------
> >  1 file changed, 17 insertions(+), 8 deletions(-)
> > 
> > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > index d69c3fb2d38d..270db8d6dc90 100644
> > --- a/lib/igt_fb.c
> > +++ b/lib/igt_fb.c
> > @@ -557,15 +557,24 @@ static int create_bo_for_fb(struct igt_fb *fb)
> >  			igt_require(driver_has_gem_api);
> >  			return -EINVAL;
> >  		}
> > -	} else {
> > -		fb->is_dumb = true;
> > -
> > -		fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb-
> > >height,
> > -						     fb->plane_bpp[0],
> > -						     &fb->strides[0],
> > &fb->size);
> > -
> > -		return fb->gem_handle;
> >  	}
> > +
> > +	/*
> > +	 * The current dumb buffer allocation API doesn't really allow
> > to
> > +	 * specify a custom size or stride. Yet the caller is free to
> > specify
> > +	 * them, so we need to make sure to error out in this case.
> > +	 */
> > +	igt_assert(fb->size == 0);
> > +	igt_assert(fb->strides[0] == 0);
> 
> Hi Maxime, thanks for doing this. I am not an expert but do you think
> this should be igt_skip instead? Tests will simply fail where they
> should really be skipping if driver don't support the feature.

That's a good suggestion :)

I'm not sure what the proper behaviour here is though. Both approaches
make sense I guess, but skiping the test would hide that issue under
the carpet which might or might not be an issue, I don't know.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20190130/f2f8d5fc/attachment.sig>


More information about the igt-dev mailing list