diff options
author | Micah Fedke <micah.fedke@collabora.co.uk> | 2016-03-09 16:57:37 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-04-20 14:35:23 +0200 |
commit | be354f444e03edb7b73c8393762e90fc503d03b6 (patch) | |
tree | ea25799fa01b71023348fe7e52467d8d1ade5c57 /lib | |
parent | f8af3565bd9d79c16c48bc017d3698b4c19bed4f (diff) |
lib: update kmstest_get_pipe_from_crtc_id
This function uses an intel-specific ioctl to fetch a mapping between pipes and
crtc ids, but this technique is outdated as the crtc id is now always
equivalent to its index in the array of crtcs returned by the kernel.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_kms.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 8f30c940..ef24a496 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -378,20 +378,35 @@ void kmstest_dump_mode(drmModeModeInfo *mode) * @fd: DRM fd * @crtc_id: DRM CRTC id * - * Returns: The pipe number for the given DRM CRTC @crtc_id. This maps directly - * to an enum pipe value used in other helper functions. + * Returns: The crtc index for the given DRM CRTC ID @crtc_id. The crtc index + * is the equivalent of the pipe id. This value maps directly to an enum pipe + * value used in other helper functions. Returns 0 if the index could not be + * determined. */ + int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id) { - struct drm_i915_get_pipe_from_crtc_id pfci; - int ret; + drmModeRes *res; + drmModeCrtc *crtc; + int i, cur_id; + + res = drmModeGetResources(fd); + igt_assert(res); + + for (i = 0; i < res->count_crtcs; i++) { + crtc = drmModeGetCrtc(fd, res->crtcs[i]); + igt_assert(crtc); + cur_id = crtc->crtc_id; + drmModeFreeCrtc(crtc); + if (cur_id == crtc_id) + break; + } + + drmModeFreeResources(res); - memset(&pfci, 0, sizeof(pfci)); - pfci.crtc_id = crtc_id; - ret = drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &pfci); - igt_assert(ret == 0); + igt_assert(i < res->count_crtcs); - return pfci.pipe; + return i; } /** |