[igt-dev] [PATCH i-g-t] igt/kms_addfb_basic: Exercise legacy interface to addfb2
Chris Wilson
chris at chris-wilson.co.uk
Wed Sep 5 14:37:26 UTC 2018
Quoting Daniel Vetter (2018-09-05 15:33:22)
> On Wed, Sep 05, 2018 at 11:05:22AM +0100, Chris Wilson wrote:
> > + igt_subtest("legacy-format") {
> > + struct {
> > + /* drm_mode_legacy_fb_format() */
> > + int bpp, depth;
> > + int expect;
> > + } known_formats[] = {
> > + { 8, 0 }, /* palette */
>
> Apparently 8/8
Indeed. The more we learn, the stranger things get.
> > + { 16, 15 }, /* x1r5g5b5 */
> > + { 16, 16 }, /* r5g6b5 */
> > + { 24, 24 }, /* r8g8b8 */
> > + { 32, 24 }, /* x8r8g8b8 */
> > + { 32, 30 }, /* x2r10g10b10 */
> > + { 32, 32 }, /* a2r10g10b10 */
> > + };
> > + struct drm_mode_fb_cmd arg = {
> > + .width = f.width,
> > + .height = f.height,
> > + .pitch = f.pitches[0],
> > + .handle = f.handles[0],
> > + };
> > + uint32_t prng = 0x12345678;
> > +
> > + /*
> > + * First confirm the kernel recognises our known_formats;
> > + * some may be invalid for different devices.
> > + */
> > + for (int i = 0; i < ARRAY_SIZE(known_formats); i++) {
> > + arg.bpp = known_formats[i].bpp;
> > + arg.depth = known_formats[i].depth;
> > + known_formats[i].expect = legacy_addfb(fd, &arg);
> > + igt_debug("(bpp:%d, depth:%d) -> expect:%d\n",
> > + arg.bpp, arg.depth, known_formats[i].expect);
> > + if (arg.fb_id) {
> > + igt_assert_eq(rmfb(fd, arg.fb_id), 0);
> > + arg.fb_id = 0;
> > + }
> > + }
> > +
> > + igt_until_timeout(1) {
> > + int expect = -EINVAL;
> > + int err;
> > +
> > + arg.bpp = hars_petruska_f54_1_random(&prng);
> > + arg.depth = hars_petruska_f54_1_random(&prng);
> > + for (int start = 0, end = ARRAY_SIZE(known_formats);
> > + start < end; ) {
>
> The b-search is maybe a bit overkill for an array with 7 entries :-) I'd
> simplify to a brute-force match.
You don't think Ville's going to add a thousand more distinct bpp/depth
later?
-Chris
More information about the igt-dev
mailing list