summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-15 01:06:11 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-17 15:30:54 +0100
commit0af2b184ad0d876936091e58028cca56de30b850 (patch)
treea8c13096f1d46a4c7bf10bd3f344505949e8c63f
parent573d59dd148d9fedceb8aaeeb88b76cfc5564c40 (diff)
lib: extract kmstest_get_pipe_from_crtc_id
-rw-r--r--lib/drmtest.c13
-rw-r--r--lib/drmtest.h1
-rw-r--r--tests/kms_flip.c15
3 files changed, 15 insertions, 14 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index e55f63a..8518bde 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -916,3 +916,16 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
fflush(stdout);
}
+int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
+{
+ struct drm_i915_get_pipe_from_crtc_id pfci;
+ int ret;
+
+ memset(&pfci, 0, sizeof(pfci));
+ pfci.crtc_id = crtc_id;
+ ret = drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &pfci);
+ assert(ret == 0);
+
+ return pfci.pipe;
+}
+
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 796fa83..2000b70 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -110,6 +110,7 @@ unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
void *func_arg);
void kmstest_remove_fb(int fd, int fb_id);
void kmstest_dump_mode(drmModeModeInfo *mode);
+int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
inline static void _do_or_die(const char *function, int line, int ret)
{
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index e05efb1..e676f9b 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -938,19 +938,6 @@ static void run_test_on_crtc(struct test_output *o, int crtc, int duration)
drmModeFreeConnector(o->connector);
}
-static int get_pipe_from_crtc_id(int crtc_id)
-{
- struct drm_i915_get_pipe_from_crtc_id pfci;
- int ret;
-
- memset(&pfci, 0, sizeof(pfci));
- pfci.crtc_id = crtc_id;
- ret = drmIoctl(drm_fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &pfci);
- assert(ret == 0);
-
- return pfci.pipe;
-}
-
static int run_test(int duration, int flags, const char *test_name)
{
struct test_output o;
@@ -975,7 +962,7 @@ static int run_test(int duration, int flags, const char *test_name)
o.flip_state.name = "flip";
o.vblank_state.name = "vblank";
crtc = resources->crtcs[i];
- o.pipe = get_pipe_from_crtc_id(crtc);
+ o.pipe = kmstest_get_pipe_from_crtc_id(drm_fd, crtc);
run_test_on_crtc(&o, crtc, duration);
}