示例#1
0
static void unset_mode(void)
{
	int rc;

	kmstest_unset_all_crtcs(drm.fd, drm.res);
	rc = drmModeSetCursor(drm.fd, modeset.crtc_id, 0, 0, 0);
	igt_assert(rc == 0);
}
示例#2
0
static void edp_subtest(int drm_fd, drmModeResPtr drm_res,
			drmModeConnectorPtr *drm_connectors, uint32_t devid,
			bool use_panel_fitter)
{
	int i, rc;
	uint32_t connector_id = 0, crtc_id = 0, buffer_id = 0;
	drmModeModeInfoPtr mode = NULL;
	drmModeModeInfo std_1024_mode = {
		.clock = 65000,
		.hdisplay = 1024,
		.hsync_start = 1048,
		.hsync_end = 1184,
		.htotal = 1344,
		.vtotal = 806,
		.hskew = 0,
		.vdisplay = 768,
		.vsync_start = 771,
		.vsync_end = 777,
		.vtotal = 806,
		.vscan = 0,
		.vrefresh = 60,
		.flags = 0xA,
		.type = 0x40,
		.name = "Custom 1024x768",
	};

	kmstest_unset_all_crtcs(drm_fd, drm_res);

	for (i = 0; i < drm_res->count_connectors; i++) {
		drmModeConnectorPtr c = drm_connectors[i];

		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
			continue;
		if (c->connection != DRM_MODE_CONNECTED)
			continue;

		if (!use_panel_fitter && c->count_modes) {
			connector_id = c->connector_id;
			mode = &c->modes[0];
			break;
		}
		if (use_panel_fitter) {
			connector_id = c->connector_id;

			/* This is one of the modes Xorg creates for panels, so
			 * it should work just fine. Notice that Gens that
			 * support LPSP are too new for panels with native
			 * 1024x768 resolution, so this should force the panel
			 * fitter. */
			igt_assert(c->count_modes &&
				   c->modes[0].hdisplay > 1024);
			igt_assert(c->count_modes &&
				   c->modes[0].vdisplay > 768);
			mode = &std_1024_mode;
			break;
		}
	}
	igt_require(connector_id);

	crtc_id = drm_res->crtcs[0];
	buffer_id = create_fb(drm_fd, mode->hdisplay, mode->vdisplay);

	igt_assert(crtc_id);
	igt_assert(buffer_id);
	igt_assert(connector_id);
	igt_assert(mode);

	rc = drmModeSetCrtc(drm_fd, crtc_id, buffer_id, 0, 0, &connector_id, 1,
			    mode);
	igt_assert_eq(rc, 0);

	if (use_panel_fitter) {
		if (IS_HASWELL(devid))
			igt_assert(!lpsp_is_enabled(drm_fd));
		else
			igt_assert(lpsp_is_enabled(drm_fd));
	} else {
		igt_assert(lpsp_is_enabled(drm_fd));
	}
}

static void non_edp_subtest(int drm_fd, drmModeResPtr drm_res,
			    drmModeConnectorPtr *drm_connectors)
{
	int i, rc;
	uint32_t connector_id = 0, crtc_id = 0, buffer_id = 0;
	drmModeModeInfoPtr mode = NULL;

	kmstest_unset_all_crtcs(drm_fd, drm_res);

	for (i = 0; i < drm_res->count_connectors; i++) {
		drmModeConnectorPtr c = drm_connectors[i];

		if (c->connector_type == DRM_MODE_CONNECTOR_eDP)
			continue;
		if (c->connection != DRM_MODE_CONNECTED)
			continue;

		if (c->count_modes) {
			connector_id = c->connector_id;
			mode = &c->modes[0];
			break;
		}
	}
	igt_require(connector_id);

	crtc_id = drm_res->crtcs[0];
	buffer_id = create_fb(drm_fd, mode->hdisplay, mode->vdisplay);

	igt_assert(crtc_id);
	igt_assert(buffer_id);
	igt_assert(connector_id);
	igt_assert(mode);

	rc = drmModeSetCrtc(drm_fd, crtc_id, buffer_id, 0, 0, &connector_id, 1,
			    mode);
	igt_assert_eq(rc, 0);

	igt_assert(!lpsp_is_enabled(drm_fd));
}
示例#3
0
/* The LPSP mode is all about an enabled pipe, but we expect to also be in the
 * low power mode when no pipes are enabled, so do this check anyway. */
static void screens_disabled_subtest(int drm_fd, drmModeResPtr drm_res)
{
	kmstest_unset_all_crtcs(drm_fd, drm_res);
	igt_assert(lpsp_is_enabled(drm_fd));
}