summaryrefslogtreecommitdiff
path: root/tests/kms_force_connector_basic.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-03-19 17:44:13 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-08-10 11:24:15 +0200
commit8da67df27f8d859d083faf0760ac1e1dab81a774 (patch)
tree04349f7ff731c80484765f76d641c53776cbca7b /tests/kms_force_connector_basic.c
parent6cb3d7dbe5831a7b2b5b7a4638d8a8b7ac624f5f (diff)
tests/kms_force_connector_basic: Verify planes are restored after load detection, v2.
There's a bug in our load detection in which we don't correctly restore planes to their previous states. Strictly verify this is the case by setting a fb on all planes. Changes since v1: - Remove igt_assert(found) in verification, would always fail. Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_force_connector_basic.c')
-rw-r--r--tests/kms_force_connector_basic.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
index 6e96c6be..89431232 100644
--- a/tests/kms_force_connector_basic.c
+++ b/tests/kms_force_connector_basic.c
@@ -121,6 +121,14 @@ int main(int argc, char **argv)
}
igt_subtest("force-load-detect") {
+ int i, j, w = 64, h = 64;
+ drmModePlaneRes *plane_resources;
+ struct igt_fb xrgb_fb, argb_fb;
+
+ igt_create_fb(drm_fd, w, h, DRM_FORMAT_XRGB8888, 0, &xrgb_fb);
+ igt_create_fb(drm_fd, w, h, DRM_FORMAT_ARGB8888, 0, &argb_fb);
+ igt_assert(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) == 0);
+
/*
* disable all outputs to make sure we have a
* free crtc available for load detect
@@ -130,6 +138,42 @@ int main(int argc, char **argv)
igt_set_module_param_int("load_detect_test", 1);
+ plane_resources = drmModeGetPlaneResources(drm_fd);
+ igt_assert(plane_resources);
+
+ for (i = 0; i < plane_resources->count_planes; i++) {
+ drmModePlane *drm_plane;
+ bool found = false;
+ uint32_t plane_id = plane_resources->planes[i];
+
+ drm_plane = drmModeGetPlane(drm_fd, plane_id);
+ igt_assert(drm_plane);
+
+ for (j = 0; j < drm_plane->count_formats; j++) {
+ uint32_t format = drm_plane->formats[j];
+ uint32_t crtc = ffs(drm_plane->possible_crtcs) - 1;
+ uint32_t crtc_id = res->crtcs[crtc];
+
+ if (format == DRM_FORMAT_XRGB8888)
+ do_or_die(drmModeSetPlane(drm_fd, plane_id, crtc_id,
+ xrgb_fb.fb_id,
+ 0, 0, 0, w, h,
+ 0, 0, IGT_FIXED(w, 0), IGT_FIXED(h, 0)));
+ else if (format == DRM_FORMAT_ARGB8888)
+ do_or_die(drmModeSetPlane(drm_fd, plane_id, crtc_id,
+ argb_fb.fb_id,
+ 0, 0, 0, w, h,
+ 0, 0, IGT_FIXED(w, 0), IGT_FIXED(h, 0)));
+ else
+ continue;
+
+ found = true;
+ break;
+ }
+ drmModeFreePlane(drm_plane);
+ igt_assert(found);
+ }
+
/* This can't use drmModeGetConnectorCurrent
* because connector probing is the point of this test.
*/
@@ -140,6 +184,23 @@ int main(int argc, char **argv)
igt_assert(temp->connection != DRM_MODE_UNKNOWNCONNECTION);
drmModeFreeConnector(temp);
+
+ /* Look if planes are unmodified. */
+ for (i = 0; i < plane_resources->count_planes; i++) {
+ drmModePlane *drm_plane;
+
+ drm_plane = drmModeGetPlane(drm_fd,
+ plane_resources->planes[i]);
+ igt_assert(drm_plane);
+
+ igt_assert(drm_plane->crtc_id);
+ igt_assert(drm_plane->fb_id);
+
+ if (drm_plane->fb_id != xrgb_fb.fb_id)
+ igt_assert_eq(drm_plane->fb_id, argb_fb.fb_id);
+
+ drmModeFreePlane(drm_plane);
+ }
}
igt_subtest("force-connector-state") {