[Intel-gfx] [PATCH i-g-t 2/2] Adding kms_nv12 to test display NV12 feature

Daniel Vetter daniel at ffwll.ch
Wed Sep 2 01:04:05 PDT 2015


On Thu, Aug 27, 2015 at 01:51:52AM +0000, Konduru, Chandra wrote:
> > > +static void test_nv12_invalid_fb_params(data_t *d)
> > > +{
> > > +	igt_display_t *display = &d->display;
> > > +	igt_output_t *output;
> > > +	enum pipe pipe;
> > > +	int valid_tests = 0;
> > > +
> > > +	igt_require(d->display.has_universal_planes);
> > > +	igt_require(d->num_scalers);
> > > +
> > > +	for_each_connected_output(display, output) {
> > > +		struct local_drm_mode_fb_cmd2 f;
> > > +		int fd = d->drm_fd;
> > > +		drmModeModeInfo *mode;
> > > +
> > > +		mode = igt_output_get_mode(output);
> > > +		pipe = output->config.pipe;
> > > +
> > > +		igt_output_set_pipe(output, pipe);
> > > +
> > > +		/* Set up display with plane 1 */
> > > +		d->plane1 = igt_output_get_plane(output,
> > IGT_PLANE_PRIMARY);
> > > +		igt_plane_set_rotation(d->plane1, IGT_ROTATION_0);
> > > +		prepare_crtc(d, output, pipe, d->plane1, mode,
> > COMMIT_LEGACY);
> > > +
> > > +		/* use igt helper to create bo and addfb tile-Yf, this should pass
> > */
> > > +		d->fb_id1_nv12 = igt_create_fb(d->drm_fd,
> > > +				1920, 1080,
> > > +				DRM_FORMAT_NV12,
> > > +				LOCAL_I915_FORMAT_MOD_Yf_TILED,
> > > +				&d->fb1_nv12);
> > > +		igt_assert(d->fb_id1_nv12);
> > > +
> > > +		/* now remove fb but keep bo to redo addfb */
> > > +		drmModeRmFB(d->drm_fd, d->fb_id1_nv12);
> > > +
> > > +		/* redo AddFB */
> > > +		memset(&f, 0, sizeof(f));
> > > +
> > > +		f.width = d->fb1_nv12.width;
> > > +		f.height = d->fb1_nv12.height;
> > > +		f.pixel_format = d->fb1_nv12.drm_format;
> > > +		f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
> > > +		f.handles[0] = d->fb1_nv12.gem_handle;
> > > +		f.pitches[0] = d->fb1_nv12.stride;
> > > +		f.modifier[0] = LOCAL_I915_FORMAT_MOD_Yf_TILED;
> > > +		f.modifier[1] = LOCAL_I915_FORMAT_MOD_Yf_TILED;
> > > +
> > > +		/* test invalid uv start */
> > > +		f.handles[1] = d->fb1_nv12.gem_handle;
> > > +		f.pitches[1] = d->fb1_nv12.stride;
> > > +		f.offsets[1] = 0;  /* invalid uv start */
> > > +		igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2,
> > &f) != 0);
> > 
> > For such simple invalid input paramaters tests the usual approach is to
> > split them out. Also you don't have to do a modeset for addfb (which will
> > speed things up). Essentially each block with an igt_assert should be its
> > own subtest.
> > -Daniel
> > 
> 
> If each block is split into it's own subtest, if one runs just a subtest 
> and without a modeset, I don't know in which state the system is to start
> the test and doing a modeset will start with a known state.

ADDFB ioctl doesn't need any known modeset state at all, and that seems to
be the only ioctl you do. Which means you really don't need to do a
modeset (it's just overhead). See e.g. the other addfb testcases we have
in kms_addfb_basic.c.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list