diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2016-02-26 08:54:57 -0300 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2016-03-03 16:56:01 -0300 |
commit | c6279ec4bbbc628bf8d759d17528d32d5469db61 (patch) | |
tree | a7b603e9c4cd4df57a88ac68bf7afa98132dc3a2 /tests | |
parent | b6b130c5ebb82145000eed0b16f951d844e8a126 (diff) |
lib/igt_kms: add kmstest_get_crtc_idx
Move it from pm_rpm.c to lib/igt_kms and remove the hardcoded version
from kms_frontbuffer_tracking. I'm also planning to add other callers.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/kms_frontbuffer_tracking.c | 10 | ||||
-rw-r--r-- | tests/pm_rpm.c | 14 |
2 files changed, 5 insertions, 19 deletions
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index c33668a0..55f508a2 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -2212,16 +2212,12 @@ static void wait_flip_event(void) static void set_prim_plane_for_params(struct modeset_params *params) { - int rc, i, crtc_index = -1; + int rc, i; + int crtc_idx = kmstest_get_crtc_idx(drm.res, params->crtc_id); uint32_t plane_id = 0; - for (i = 0; i < drm.res->count_crtcs; i++) - if (drm.res->crtcs[i] == params->crtc_id) - crtc_index = i; - igt_assert(crtc_index >= 0); - for (i = 0; i < drm.plane_res->count_planes; i++) - if ((drm.planes[i]->possible_crtcs & (1 << crtc_index)) && + if ((drm.planes[i]->possible_crtcs & (1 << crtc_idx)) && drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY) plane_id = drm.planes[i]->plane_id; igt_assert(plane_id); diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index c57bf11d..5f947e9e 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1681,17 +1681,6 @@ static void test_one_plane(bool dpms, uint32_t plane_id, igt_assert(wait_for_suspended()); } -static int get_crtc_idx(drmModeResPtr res, uint32_t crtc_id) -{ - int i; - - for (i = 0; i < res->count_crtcs; i++) - if (res->crtcs[i] == crtc_id) - return i; - - igt_assert(false); -} - /* This one also triggered WARNs on our driver at some point in time. */ static void planes_subtest(bool universal, bool dpms) { @@ -1699,7 +1688,8 @@ static void planes_subtest(bool universal, bool dpms) drmModePlaneResPtr planes; igt_require(default_mode_params); - crtc_idx = get_crtc_idx(ms_data.res, default_mode_params->crtc_id); + crtc_idx = kmstest_get_crtc_idx(ms_data.res, + default_mode_params->crtc_id); if (universal) { rc = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, |