[Intel-gfx] [PATCH i-g-t 2/2] Adding kms_nv12 to test display NV12 feature
Konduru, Chandra
chandra.konduru at intel.com
Wed Aug 26 18:51:52 PDT 2015
> > +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.
More information about the Intel-gfx
mailing list