tests: fix CRTC assignment for a few tests

All the tests I wrote always assumed that every connector supported
CRTC 0. This is not the case for BSW and possibly others, so fix the
tests before the CI reports more failures.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
Paulo Zanoni
2016-02-26 11:27:20 -03:00
parent 9751e602b7
commit d8bf28f0cb
8 changed files with 92 additions and 65 deletions
+32
View File
@@ -277,6 +277,38 @@ int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
return pfci.pipe;
}
/**
* kmstest_find_crtc_for_connector:
* @fd: DRM fd
* @res: libdrm resources pointer
* @connector: libdrm connector pointer
* @crtc_blacklist_idx_mask: a mask of CRTC indexes that we can't return
*
* Returns: the CRTC ID for a CRTC that fits the connector, otherwise it asserts
* false and never returns. The blacklist mask can be used in case you have
* CRTCs that are already in use by other connectors.
*/
uint32_t kmstest_find_crtc_for_connector(int fd, drmModeRes *res,
drmModeConnector *connector,
uint32_t crtc_blacklist_idx_mask)
{
drmModeEncoder *e;
uint32_t possible_crtcs;
int i, j;
for (i = 0; i < connector->count_encoders; i++) {
e = drmModeGetEncoder(fd, connector->encoders[i]);
possible_crtcs = e->possible_crtcs & ~crtc_blacklist_idx_mask;
drmModeFreeEncoder(e);
for (j = 0; possible_crtcs >> j; j++)
if (possible_crtcs & (1 << j))
return res->crtcs[j];
}
igt_assert(false);
}
/*
* Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was
* found and nothing was done.
+3
View File
@@ -151,6 +151,9 @@ bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
drmModePropertyPtr *prop);
void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources);
int kmstest_get_crtc_idx(drmModeRes *res, uint32_t crtc_id);
uint32_t kmstest_find_crtc_for_connector(int fd, drmModeRes *res,
drmModeConnector *connector,
uint32_t crtc_blacklist_idx_mask);
/*
* A small modeset API