Lines Matching +full:cairo +full:- +full:tests
26 #include <cairo.h>
97 #define COMP(x) do { if (m1->x != m2->x) return false; } while (0) in drm_mode_equal()
118 for (i = 0; i < connector->count_modes; i++) in connector_supports_mode()
119 if (drm_mode_equal(&connector->modes[i], mode)) in connector_supports_mode()
129 for (i = 0; i < crtc->connector_count; i++) { in crtc_supports_mode()
130 if (!connector_supports_mode(crtc->cconfs[i].connector, mode)) in crtc_supports_mode()
146 cairo_move_to(cr, fb->width / 2, fb->height / 2); in paint_fb()
156 cairo_move_to(cr, x - 20, y); in paint_fb()
178 fb_id = igt_create_pattern_fb(drm_fd, crtc->mode.hdisplay, in create_fb_for_crtc()
179 crtc->mode.vdisplay, in create_fb_for_crtc()
196 for (i = 0; i < crtc->connector_count; i++) { in get_mode_for_crtc()
197 mode = &crtc->cconfs[i].default_mode; in get_mode_for_crtc()
206 for (i = 0; i < crtc->cconfs[0].connector->count_modes; i++) { in get_mode_for_crtc()
207 mode = &crtc->cconfs[0].connector->modes[i]; in get_mode_for_crtc()
217 mode = &crtc->cconfs[0].default_mode; in get_mode_for_crtc()
218 for (i = 1; i < crtc->connector_count; i++) in get_mode_for_crtc()
219 if (crtc->cconfs[i].default_mode.clock < mode->clock) in get_mode_for_crtc()
220 mode = &crtc->cconfs[i].default_mode; in get_mode_for_crtc()
229 for (i = 0; i < resources->count_encoders; i++) in get_encoder_idx()
230 if (resources->encoders[i] == encoder->encoder_id) in get_encoder_idx()
243 crtc->crtc_id, kmstest_pipe_name(crtc->pipe_id), in get_crtc_config_str()
244 crtc->mode.name, crtc->mode.vrefresh); in get_crtc_config_str()
247 for (i = 0; i < crtc->connector_count; i++) { in get_crtc_config_str()
248 drmModeConnector *connector = crtc->cconfs[i].connector; in get_crtc_config_str()
250 pos += snprintf(&buf[pos], buf_size - pos, in get_crtc_config_str()
251 "%s%s-%d[%d]", i ? ", " : "", in get_crtc_config_str()
252 kmstest_connector_type_str(connector->connector_type), in get_crtc_config_str()
253 connector->connector_type_id, connector->connector_id); in get_crtc_config_str()
267 int encoder_usage_count[resources->count_encoders]; in setup_crtcs()
283 crtc->crtc_idx = cconf[i].crtc_idx; in setup_crtcs()
285 resources->crtcs[crtc->crtc_idx]); in setup_crtcs()
286 crtc->crtc_id = drm_crtc->crtc_id; in setup_crtcs()
288 crtc->pipe_id = kmstest_get_pipe_from_crtc_id(drm_fd, in setup_crtcs()
289 crtc->crtc_id); in setup_crtcs()
291 crtc->connector_count = 1; in setup_crtcs()
293 if (cconf[j].crtc_idx == crtc->crtc_idx) in setup_crtcs()
294 crtc->connector_count++; in setup_crtcs()
296 crtc->cconfs = malloc(sizeof(*crtc->cconfs) * in setup_crtcs()
297 crtc->connector_count); in setup_crtcs()
298 igt_assert(crtc->cconfs); in setup_crtcs()
301 for (j = 0; j < crtc->connector_count; j++) { in setup_crtcs()
305 crtc->cconfs[j] = cconf[i + j]; in setup_crtcs()
309 if (connector->count_encoders == 1) { in setup_crtcs()
311 connector->encoders[0]); in setup_crtcs()
313 igt_assert_eq(connector->connector_type, in setup_crtcs()
316 igt_assert(connector->count_encoders >= crtc->crtc_idx); in setup_crtcs()
318 connector->encoders[crtc_count]); in setup_crtcs()
322 config_valid &= !!(encoder->possible_crtcs & in setup_crtcs()
323 (1 << crtc->crtc_idx)); in setup_crtcs()
328 ~encoder->possible_clones); in setup_crtcs()
332 get_mode_for_crtc(crtc, &crtc->mode); in setup_crtcs()
333 create_fb_for_crtc(crtc, &crtc->fb_info); in setup_crtcs()
335 i += crtc->connector_count; in setup_crtcs()
347 if (connector->count_encoders > 1) in setup_crtcs()
350 encoder = drmModeGetEncoder(drm_fd, connector->encoders[idx]); in setup_crtcs()
354 for (i = 0; i < resources->count_encoders; i++) in setup_crtcs()
379 ids = malloc(sizeof(*ids) * crtc->connector_count); in get_connector_ids()
381 for (i = 0; i < crtc->connector_count; i++) in get_connector_ids()
382 ids[i] = crtc->cconfs[i].connector->connector_id; in get_connector_ids()
391 if (!crtc->connector_count) in test_stealing()
392 return drmModeSetCrtc(fd, crtc->crtc_id, in test_stealing()
393 crtc->fb_info.fb_id, 0, 0, in test_stealing()
394 ids, crtc->connector_count, &crtc->mode); in test_stealing()
396 for (i = 0; i < crtc->connector_count; ++i) { in test_stealing()
397 ret = drmModeSetCrtc(fd, crtc->crtc_id, in test_stealing()
398 crtc->fb_info.fb_id, 0, 0, in test_stealing()
399 &ids[i], 1, &crtc->mode); in test_stealing()
403 ret = drmModeSetCrtc(fd, crtc->crtc_id, in test_stealing()
404 crtc->fb_info.fb_id, 0, 0, in test_stealing()
405 ids, crtc->connector_count, &crtc->mode); in test_stealing()
407 /* This should fail with -EINVAL */ in test_stealing()
417 return 1000.0 * kmode->htotal * kmode->vtotal / kmode->clock; in frame_time()
422 return 1000.0 * kmode->htotal / kmode->clock; in line_time()
478 igt_stats_push(&stats, now - last_timestamp); in check_timings()
499 …igt_info("Expected frametime: %.0fus; measured %.1fus +- %.3fus accuracy %.2f%% [%.2f scanlines]\n… in check_timings()
512 * (expected - accuracy, expected + accuracy). in check_timings()
516 * (mean - accuracy + n * sigma, mean + accuracy + n * sigma) in check_timings()
519 * (erf(abs(-(accuracy/sigma) + n) / sqrt(2)) in check_timings()
529 igt_assert_f(fabs(mean - expected) < 1.718 * stddev, in check_timings()
530 …"vblank interval differs from modeline! expected %.1fus, measured %1.fus +- %.3fus, difference %.1… in check_timings()
532 fabs(mean - expected), fabs(mean - expected) / stddev); in check_timings()
571 create_fb_for_crtc(crtc, &crtc->fb_info); in test_crtc_config()
572 paint_fb(&crtc->fb_info, tconf->name, crtc_strs, crtc_count, i); in test_crtc_config()
575 if (tconf->flags & TEST_STEALING) in test_crtc_config()
578 ret = drmModeSetCrtc(drm_fd, crtc->crtc_id, in test_crtc_config()
579 crtc->fb_info.fb_id, 0, 0, ids, in test_crtc_config()
580 crtc->connector_count, &crtc->mode); in test_crtc_config()
590 igt_assert(config_failed == !!(tconf->flags & TEST_INVALID)); in test_crtc_config()
592 if (ret == 0 && tconf->flags & TEST_TIMINGS) in test_crtc_config()
606 setup_crtcs(tconf->resources, cconfs, connector_count, crtcs, in test_one_combination()
609 if (config_valid == !(tconf->flags & TEST_INVALID)) in test_one_combination()
626 if ((tconf->flags & TEST_SINGLE_CRTC_CLONE) && in assign_crtc_to_connectors()
628 return -1; in assign_crtc_to_connectors()
630 if ((tconf->flags & TEST_EXCLUSIVE_CRTC_CLONE) && in assign_crtc_to_connectors()
632 return -1; in assign_crtc_to_connectors()
649 cconf->connector = connector; in get_one_connector()
651 if (connector->connection != DRM_MODE_CONNECTED) { in get_one_connector()
653 return -1; in get_one_connector()
657 &cconf->default_mode)) { in get_one_connector()
659 return -1; in get_one_connector()
675 igt_assert_lt(connector_idx, resources->count_connectors); in get_connectors()
676 connector_id = resources->connectors[connector_idx]; in get_connectors()
686 while (i--) in get_connectors()
689 return -1; in get_connectors()
722 igt_assert(set->count < set->capacity); in iterate_combinations()
723 set->items[set->count++] = *comb; in iterate_combinations()
728 comb->elems[depth] = v; in iterate_combinations()
729 iterate_combinations(n, k - 1, allow_repetitions, in iterate_combinations()
741 igt_assert(k <= ARRAY_SIZE(set->items[0].elems)); in get_combinations()
742 set->count = 0; in get_combinations()
754 if (connector_count > 2 && (tconf->flags & TEST_STEALING)) in test_combinations()
757 igt_assert(tconf->resources); in test_combinations()
759 connector_combs.capacity = pow(tconf->resources->count_connectors, in test_combinations()
760 tconf->resources->count_crtcs + 1); in test_combinations()
761 crtc_combs.capacity = pow(tconf->resources->count_crtcs, in test_combinations()
762 tconf->resources->count_crtcs + 1); in test_combinations()
767 get_combinations(tconf->resources->count_connectors, connector_count, in test_combinations()
769 get_combinations(tconf->resources->count_crtcs, connector_count, in test_combinations()
772 igt_info("Testing: %s %d connector combinations\n", tconf->name, in test_combinations()
783 ret = get_connectors(tconf->resources, connector_idxs, in test_combinations()
812 connector_num = tconf->flags & TEST_CLONE ? 2 : 1; in run_test()
813 for (; connector_num <= tconf->resources->count_crtcs; connector_num++) in run_test()
834 " -d\t\tDon't run any test, only print what would be done. (still needs DRM access)\n"
835 " -t <test id>\tRun only the test with this id.";
842 } tests[] = { variable
845 "basic-clone-single-crtc" },
847 "invalid-clone-single-crtc" },
849 "invalid-clone-exclusive-crtc" },
851 "clone-exclusive-crtc" },
853 "invalid-clone-single-crtc-stealing" }
860 "only one of -d and -t is accepted\n");
871 for (i = 0; i < ARRAY_SIZE(tests); i++) {
872 igt_subtest(tests[i].name) {
874 .flags = tests[i].flags,
875 .name = tests[i].name,