mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 09:56:22 +00:00
tests/kms_force_connect: skip if a VGA connector is not available
v2: rename "connector" to "vga_connector" to improve the skip message (Chris Wilson) Suggested-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
5209ec142d
commit
e11b7100c9
@ -33,7 +33,7 @@ main (int argc, char **argv)
|
|||||||
/* force the VGA output and test that it worked */
|
/* force the VGA output and test that it worked */
|
||||||
int drm_fd;
|
int drm_fd;
|
||||||
drmModeRes *res;
|
drmModeRes *res;
|
||||||
drmModeConnector *connector, *temp;
|
drmModeConnector *vga_connector, *temp;
|
||||||
igt_display_t display;
|
igt_display_t display;
|
||||||
|
|
||||||
igt_simple_init(argc, argv);
|
igt_simple_init(argc, argv);
|
||||||
@ -44,21 +44,21 @@ main (int argc, char **argv)
|
|||||||
/* find the vga connector */
|
/* find the vga connector */
|
||||||
for (int i = 0; i < res->count_connectors; i++) {
|
for (int i = 0; i < res->count_connectors; i++) {
|
||||||
|
|
||||||
connector = drmModeGetConnector(drm_fd, res->connectors[i]);
|
vga_connector = drmModeGetConnector(drm_fd, res->connectors[i]);
|
||||||
|
|
||||||
if (connector->connector_type == DRM_MODE_CONNECTOR_VGA)
|
if (vga_connector->connector_type == DRM_MODE_CONNECTOR_VGA)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
drmModeFreeConnector(connector);
|
drmModeFreeConnector(vga_connector);
|
||||||
|
|
||||||
connector = NULL;
|
vga_connector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
igt_assert(connector);
|
igt_require(vga_connector);
|
||||||
|
|
||||||
/* force the connector on and check the reported values */
|
/* force the connector on and check the reported values */
|
||||||
kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON);
|
kmstest_force_connector(drm_fd, vga_connector, FORCE_CONNECTOR_ON);
|
||||||
temp = drmModeGetConnector(drm_fd, connector->connector_id);
|
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
|
||||||
igt_assert(temp->connection == DRM_MODE_CONNECTED);
|
igt_assert(temp->connection == DRM_MODE_CONNECTED);
|
||||||
igt_assert(temp->count_modes > 0);
|
igt_assert(temp->count_modes > 0);
|
||||||
drmModeFreeConnector(temp);
|
drmModeFreeConnector(temp);
|
||||||
@ -70,9 +70,9 @@ main (int argc, char **argv)
|
|||||||
igt_display_commit(&display);
|
igt_display_commit(&display);
|
||||||
|
|
||||||
/* test edid forcing */
|
/* test edid forcing */
|
||||||
kmstest_force_edid(drm_fd, connector, generic_edid[EDID_FHD],
|
kmstest_force_edid(drm_fd, vga_connector, generic_edid[EDID_FHD],
|
||||||
EDID_LENGTH);
|
EDID_LENGTH);
|
||||||
temp = drmModeGetConnector(drm_fd, connector->connector_id);
|
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
|
||||||
|
|
||||||
igt_assert(temp->count_modes == 1);
|
igt_assert(temp->count_modes == 1);
|
||||||
igt_assert(temp->modes[0].vrefresh == 60
|
igt_assert(temp->modes[0].vrefresh == 60
|
||||||
@ -82,9 +82,9 @@ main (int argc, char **argv)
|
|||||||
drmModeFreeConnector(temp);
|
drmModeFreeConnector(temp);
|
||||||
|
|
||||||
/* custom edid */
|
/* custom edid */
|
||||||
kmstest_force_edid(drm_fd, connector, generic_edid[EDID_WSXGA],
|
kmstest_force_edid(drm_fd, vga_connector, generic_edid[EDID_WSXGA],
|
||||||
EDID_LENGTH);
|
EDID_LENGTH);
|
||||||
temp = drmModeGetConnector(drm_fd, connector->connector_id);
|
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
|
||||||
|
|
||||||
igt_assert(temp->count_modes == 1);
|
igt_assert(temp->count_modes == 1);
|
||||||
igt_assert(temp->modes[0].vrefresh == 60
|
igt_assert(temp->modes[0].vrefresh == 60
|
||||||
@ -94,27 +94,28 @@ main (int argc, char **argv)
|
|||||||
drmModeFreeConnector(temp);
|
drmModeFreeConnector(temp);
|
||||||
|
|
||||||
/* remove edid */
|
/* remove edid */
|
||||||
kmstest_force_edid(drm_fd, connector, NULL, 0);
|
kmstest_force_edid(drm_fd, vga_connector, NULL, 0);
|
||||||
temp = drmModeGetConnector(drm_fd, connector->connector_id);
|
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
|
||||||
/* the connector should now have the 5 default modes */
|
/* the connector should now have the 5 default modes */
|
||||||
igt_assert(temp->count_modes == 5);
|
igt_assert(temp->count_modes == 5);
|
||||||
drmModeFreeConnector(temp);
|
drmModeFreeConnector(temp);
|
||||||
|
|
||||||
/* force the connector off */
|
/* force the connector off */
|
||||||
kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_OFF);
|
kmstest_force_connector(drm_fd, vga_connector, FORCE_CONNECTOR_OFF);
|
||||||
temp = drmModeGetConnector(drm_fd, connector->connector_id);
|
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
|
||||||
igt_assert(temp->connection == DRM_MODE_DISCONNECTED);
|
igt_assert(temp->connection == DRM_MODE_DISCONNECTED);
|
||||||
igt_assert(temp->count_modes == 0);
|
igt_assert(temp->count_modes == 0);
|
||||||
drmModeFreeConnector(temp);
|
drmModeFreeConnector(temp);
|
||||||
|
|
||||||
|
|
||||||
/* check that the previous state is restored */
|
/* check that the previous state is restored */
|
||||||
kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
|
kmstest_force_connector(drm_fd, vga_connector,
|
||||||
temp = drmModeGetConnector(drm_fd, connector->connector_id);
|
FORCE_CONNECTOR_UNSPECIFIED);
|
||||||
igt_assert(temp->connection == connector->connection);
|
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
|
||||||
|
igt_assert(temp->connection == vga_connector->connection);
|
||||||
drmModeFreeConnector(temp);
|
drmModeFreeConnector(temp);
|
||||||
|
|
||||||
drmModeFreeConnector(connector);
|
drmModeFreeConnector(vga_connector);
|
||||||
|
|
||||||
igt_exit();
|
igt_exit();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user