And add api doc while at it. Signed-off-by: Daniel Vetter <daniel.vet...@ffwll.ch> --- lib/igt_debugfs.c | 8 +++--- lib/igt_kms.c | 61 ++++++++++++++++++++++++++------------------- lib/igt_kms.h | 3 +-- tests/kms_cursor_crc.c | 10 +++++--- tests/kms_fbc_crc.c | 15 ++++++----- tests/kms_pipe_crc_basic.c | 4 +-- tests/kms_plane.c | 23 +++++++++-------- tests/kms_psr_sink_crc.c | 2 +- tests/kms_render.c | 2 +- tests/kms_setmode.c | 2 +- tests/kms_universal_plane.c | 12 ++++++--- 11 files changed, 80 insertions(+), 62 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index d4a6cf617ff5..f6f509dd1875 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -294,7 +294,7 @@ static bool igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc) { char buf[64]; - sprintf(buf, "pipe %c %s", pipe_name(pipe_crc->pipe), + sprintf(buf, "pipe %s %s", kmstest_pipe_name(pipe_crc->pipe), pipe_crc_source_name(pipe_crc->source)); errno = 0; write(pipe_crc->ctl_fd, buf, strlen(buf)); @@ -308,7 +308,7 @@ static void igt_pipe_crc_pipe_off(int fd, enum pipe pipe) { char buf[32]; - sprintf(buf, "pipe %c none", pipe_name(pipe)); + sprintf(buf, "pipe %s none", kmstest_pipe_name(pipe)); write(fd, buf, strlen(buf)); } @@ -379,7 +379,7 @@ igt_pipe_crc_new(enum pipe pipe, enum intel_pipe_crc_source source) pipe_crc->ctl_fd = igt_debugfs_open("i915_display_crc_ctl", O_WRONLY); igt_assert(pipe_crc->ctl_fd != -1); - sprintf(buf, "i915_pipe_%c_crc", pipe_name(pipe)); + sprintf(buf, "i915_pipe_%s_crc", kmstest_pipe_name(pipe)); pipe_crc->crc_fd = igt_debugfs_open(buf, O_RDONLY); igt_assert(pipe_crc->crc_fd != -1); @@ -445,7 +445,7 @@ void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc) { char buf[32]; - sprintf(buf, "pipe %c none", pipe_name(pipe_crc->pipe)); + sprintf(buf, "pipe %s none", kmstest_pipe_name(pipe_crc->pipe)); write(pipe_crc->ctl_fd, buf, strlen(buf)); } diff --git a/lib/igt_kms.c b/lib/igt_kms.c index cccb0377b16c..bae43eea174d 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -70,7 +70,14 @@ * Note that this library's header pulls in the [i-g-t framebuffer](intel-gpu-tools-i-g-t-framebuffer.html) * library as a dependency. */ -const char *kmstest_pipe_str(int pipe) + +/** + * kmstest_pipe_name: + * @pipe: display pipe + * + * Returns: String represnting @pipe, e.g. "A". + */ +const char *kmstest_pipe_name(enum pipe pipe) { const char *str[] = { "A", "B", "C" }; @@ -586,8 +593,8 @@ static void igt_output_refresh(igt_output_t *output) c->connector_type_id); } - LOG(display, "%s: Selecting pipe %c\n", output->name, - pipe_name(output->config.pipe)); + LOG(display, "%s: Selecting pipe %s\n", output->name, + kmstest_pipe_name(output->config.pipe)); display->pipes_in_use |= 1 << output->config.pipe; } @@ -902,9 +909,9 @@ static void igt_display_refresh(igt_display_t *display) igt_assert_f(a->pending_crtc_idx_mask != b->pending_crtc_idx_mask, - "%s and %s are both trying to use pipe %c\n", + "%s and %s are both trying to use pipe %s\n", igt_output_name(a), igt_output_name(b), - pipe_name(ffs(a->pending_crtc_idx_mask) - 1)); + kmstest_pipe_name(ffs(a->pending_crtc_idx_mask) - 1)); } } @@ -1018,9 +1025,9 @@ static int igt_drm_plane_commit(igt_plane_t *plane, if (plane->fb_changed && fb_id == 0) { LOG(display, - "%s: SetPlane pipe %c, plane %d, disabling\n", + "%s: SetPlane pipe %s, plane %d, disabling\n", igt_output_name(output), - pipe_name(output->config.pipe), + kmstest_pipe_name(output->config.pipe), plane->index); ret = drmModeSetPlane(display->drm_fd, @@ -1038,9 +1045,9 @@ static int igt_drm_plane_commit(igt_plane_t *plane, CHECK_RETURN(ret, fail_on_error); } else if (plane->fb_changed || plane->position_changed) { LOG(display, - "%s: SetPlane %c.%d, fb %u, position (%d, %d)\n", + "%s: SetPlane %s.%d, fb %u, position (%d, %d)\n", igt_output_name(output), - pipe_name(output->config.pipe), + kmstest_pipe_name(output->config.pipe), plane->index, fb_id, plane->crtc_x, plane->crtc_y); @@ -1092,9 +1099,9 @@ static int igt_cursor_commit_legacy(igt_plane_t *cursor, if (gem_handle) { LOG(display, - "%s: SetCursor pipe %c, fb %u %dx%d\n", + "%s: SetCursor pipe %s, fb %u %dx%d\n", igt_output_name(output), - pipe_name(output->config.pipe), + kmstest_pipe_name(output->config.pipe), gem_handle, cursor->fb->width, cursor->fb->height); @@ -1104,9 +1111,9 @@ static int igt_cursor_commit_legacy(igt_plane_t *cursor, cursor->fb->height); } else { LOG(display, - "%s: SetCursor pipe %c, disabling\n", + "%s: SetCursor pipe %s, disabling\n", igt_output_name(output), - pipe_name(output->config.pipe)); + kmstest_pipe_name(output->config.pipe)); ret = drmModeSetCursor(display->drm_fd, crtc_id, 0, 0, 0); @@ -1122,9 +1129,9 @@ static int igt_cursor_commit_legacy(igt_plane_t *cursor, int y = cursor->crtc_y; LOG(display, - "%s: MoveCursor pipe %c, (%d, %d)\n", + "%s: MoveCursor pipe %s, (%d, %d)\n", igt_output_name(output), - pipe_name(output->config.pipe), + kmstest_pipe_name(output->config.pipe), x, y); ret = drmModeMoveCursor(display->drm_fd, crtc_id, x, y); @@ -1168,10 +1175,10 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary, if (fb_id) { LOG(display, - "%s: SetCrtc pipe %c, fb %u, panning (%d, %d), " + "%s: SetCrtc pipe %s, fb %u, panning (%d, %d), " "mode %dx%d\n", igt_output_name(output), - pipe_name(output->config.pipe), + kmstest_pipe_name(output->config.pipe), fb_id, primary->pan_x, primary->pan_y, mode->hdisplay, mode->vdisplay); @@ -1185,9 +1192,9 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary, mode); } else { LOG(display, - "%s: SetCrtc pipe %c, disabling\n", + "%s: SetCrtc pipe %s, disabling\n", igt_output_name(output), - pipe_name(output->config.pipe)); + kmstest_pipe_name(output->config.pipe)); ret = drmModeSetCrtc(display->drm_fd, crtc_id, @@ -1391,8 +1398,8 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe) LOG(display, "%s: set_pipe(any)\n", igt_output_name(output)); output->pending_crtc_idx_mask = -1UL; } else { - LOG(display, "%s: set_pipe(%c)\n", igt_output_name(output), - pipe_name(pipe)); + LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output), + kmstest_pipe_name(pipe)); output->pending_crtc_idx_mask = 1 << pipe; } } @@ -1410,7 +1417,7 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb) igt_pipe_t *pipe = plane->pipe; igt_display_t *display = pipe->display; - LOG(display, "%c.%d: plane_set_fb(%d)\n", pipe_name(pipe->pipe), + LOG(display, "%s.%d: plane_set_fb(%d)\n", kmstest_pipe_name(pipe->pipe), plane->index, fb ? fb->fb_id : 0); plane->fb = fb; @@ -1423,8 +1430,8 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y) igt_pipe_t *pipe = plane->pipe; igt_display_t *display = pipe->display; - LOG(display, "%c.%d: plane_set_position(%d,%d)\n", - pipe_name(pipe->pipe), plane->index, x, y); + LOG(display, "%s.%d: plane_set_position(%d,%d)\n", + kmstest_pipe_name(pipe->pipe), plane->index, x, y); plane->crtc_x = x; plane->crtc_y = y; @@ -1437,7 +1444,8 @@ void igt_plane_set_panning(igt_plane_t *plane, int x, int y) igt_pipe_t *pipe = plane->pipe; igt_display_t *display = pipe->display; - LOG(display, "%c.%d: plane_set_panning(%d,%d)\n", pipe_name(pipe->pipe), + LOG(display, "%s.%d: plane_set_panning(%d,%d)\n", + kmstest_pipe_name(pipe->pipe), plane->index, x, y); plane->pan_x = x; @@ -1467,7 +1475,8 @@ void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation) igt_pipe_t *pipe = plane->pipe; igt_display_t *display = pipe->display; - LOG(display, "%c.%d: plane_set_rotation(%s)\n", pipe_name(pipe->pipe), + LOG(display, "%s.%d: plane_set_rotation(%s)\n", + kmstest_pipe_name(pipe->pipe), plane->index, rotation_name(rotation)); plane->rotation = rotation; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 285dc7b43abe..0e15b7dde26d 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -40,7 +40,7 @@ enum pipe { PIPE_C, I915_MAX_PIPES }; -#define pipe_name(p) ((p) + 'A') +const char *kmstest_pipe_name(enum pipe pipe); /* We namespace this enum to not conflict with the Android i915_drm.h */ enum igt_plane { @@ -138,7 +138,6 @@ void kmstest_free_connector_config(struct kmstest_connector_config *config); void kmstest_dump_mode(drmModeModeInfo *mode); int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id); -const char *kmstest_pipe_str(int pipe); const char *kmstest_encoder_type_str(int type); const char *kmstest_connector_status_str(int type); const char *kmstest_connector_type_str(int type); diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 723a6d556b54..e724073287ae 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -311,14 +311,16 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int valid_tests++; - igt_info("Beginning %s on pipe %c, connector %s\n", - igt_subtest_name(), pipe_name(data->pipe), + igt_info("Beginning %s on pipe %s, connector %s\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), igt_output_name(output)); testfunc(data); - igt_info("\n%s on pipe %c, connector %s: PASSED\n\n", - igt_subtest_name(), pipe_name(data->pipe), + igt_info("\n%s on pipe %s, connector %s: PASSED\n\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), igt_output_name(output)); /* cleanup what prepare_crtc() has done */ diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index b0108b1c4aa3..4302d1b4b54a 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -458,13 +458,15 @@ static void run_test(data_t *data, enum test_mode mode) if (!prepare_crtc(data)) continue; - igt_info("Beginning %s on pipe %c, connector %s\n", - igt_subtest_name(), pipe_name(data->pipe), + igt_info("Beginning %s on pipe %s, connector %s\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), igt_output_name(data->output)); if (!prepare_test(data, mode)) { - igt_info("%s on pipe %c, connector %s: SKIPPED\n", - igt_subtest_name(), pipe_name(data->pipe), + igt_info("%s on pipe %s, connector %s: SKIPPED\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), igt_output_name(data->output)); continue; } @@ -473,8 +475,9 @@ static void run_test(data_t *data, enum test_mode mode) test_crc(data, mode); - igt_info("%s on pipe %c, connector %s: PASSED\n", - igt_subtest_name(), pipe_name(data->pipe), + igt_info("%s on pipe %s, connector %s: PASSED\n", + igt_subtest_name(), + kmstest_pipe_name(data->pipe), igt_output_name(data->output)); finish_crtc(data, mode); diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c index 997c01cc39e4..a93c20fa0f27 100644 --- a/tests/kms_pipe_crc_basic.c +++ b/tests/kms_pipe_crc_basic.c @@ -212,9 +212,9 @@ static void test_read_crc(data_t *data, int pipe, unsigned flags) for_each_connected_output(display, output) { - igt_info("%s: Testing connector %s using pipe %c\n", + igt_info("%s: Testing connector %s using pipe %s\n", igt_subtest_name(), igt_output_name(output), - pipe_name(pipe)); + kmstest_pipe_name(pipe)); valid_connectors += test_read_crc_for_output(data, pipe, output, flags); } diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 93a05bb998b6..2e552fdc0ff9 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -159,8 +159,8 @@ test_plane_position_with_output(data_t *data, drmModeModeInfo *mode; igt_crc_t crc; - igt_info("Testing connector %s using pipe %c plane %d\n", - igt_output_name(output), pipe_name(pipe), plane); + igt_info("Testing connector %s using pipe %s plane %d\n", + igt_output_name(output), kmstest_pipe_name(pipe), plane); test_init(data, pipe); @@ -284,7 +284,8 @@ test_plane_panning_with_output(data_t *data, drmModeModeInfo *mode; igt_crc_t crc; - igt_info("Testing connector %s using pipe %c plane %d\n", igt_output_name(output), pipe_name(pipe), plane); + igt_info("Testing connector %s using pipe %s plane %d\n", + igt_output_name(output), kmstest_pipe_name(pipe), plane); test_init(data, pipe); @@ -341,21 +342,21 @@ test_plane_panning(data_t *data, enum pipe pipe, enum igt_plane plane, static void run_tests_for_pipe_plane(data_t *data, enum pipe pipe, enum igt_plane plane) { - igt_subtest_f("plane-position-covered-pipe-%c-plane-%d", - pipe_name(pipe), plane) + igt_subtest_f("plane-position-covered-pipe-%s-plane-%d", + kmstest_pipe_name(pipe), plane) test_plane_position(data, pipe, plane, TEST_POSITION_FULLY_COVERED); - igt_subtest_f("plane-position-hole-pipe-%c-plane-%d", - pipe_name(pipe), plane) + igt_subtest_f("plane-position-hole-pipe-%s-plane-%d", + kmstest_pipe_name(pipe), plane) test_plane_position(data, pipe, plane, 0); - igt_subtest_f("plane-panning-top-left-pipe-%c-plane-%d", - pipe_name(pipe), plane) + igt_subtest_f("plane-panning-top-left-pipe-%s-plane-%d", + kmstest_pipe_name(pipe), plane) test_plane_panning(data, pipe, plane, TEST_PANNING_TOP_LEFT); - igt_subtest_f("plane-panning-bottom-right-pipe-%c-plane-%d", - pipe_name(pipe), plane) + igt_subtest_f("plane-panning-bottom-right-pipe-%s-plane-%d", + kmstest_pipe_name(pipe), plane) test_plane_panning(data, pipe, plane, TEST_PANNING_BOTTOM_RIGHT); diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index c26c79676b24..9cae9a6a844e 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -140,7 +140,7 @@ connector_set_mode(data_t *data, drmModeModeInfo *mode, uint32_t fb_id) int ret; #if 0 - fprintf(stdout, "Using pipe %c, %dx%d\n", pipe_name(config->pipe), + fprintf(stdout, "Using pipe %s, %dx%d\n", kmstest_pipe_name(config->pipe), mode->hdisplay, mode->vdisplay); #endif diff --git a/tests/kms_render.c b/tests/kms_render.c index 6c742e238f7d..84cda80a040e 100644 --- a/tests/kms_render.c +++ b/tests/kms_render.c @@ -114,7 +114,7 @@ static int test_format(const char *test_name, mode->name, mode->vrefresh, igt_format_str(format)); igt_assert(ret > 0); ret = asprintf(&cconf_str, "pipe %s, encoder %s, connector %s", - kmstest_pipe_str(cconf->pipe), + kmstest_pipe_name(cconf->pipe), kmstest_encoder_type_str(cconf->encoder->encoder_type), kmstest_connector_type_str(cconf->connector->connector_type)); igt_assert(ret > 0); diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index 876225526186..46edf54b1d13 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -246,7 +246,7 @@ static void get_crtc_config_str(struct crtc_config *crtc, char *buf, pos = snprintf(buf, buf_size, "CRTC[%d] [Pipe %s] Mode: %s@%dHz Connectors: ", - crtc->crtc_id, kmstest_pipe_str(crtc->pipe_id), + crtc->crtc_id, kmstest_pipe_name(crtc->pipe_id), crtc->mode.name, crtc->mode.vrefresh); if (pos > buf_size) return; diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c index 94d89b87e6c5..805cc596c70b 100644 --- a/tests/kms_universal_plane.c +++ b/tests/kms_universal_plane.c @@ -135,7 +135,8 @@ functional_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output) igt_assert(data->display.has_universal_planes); igt_skip_on(pipe >= display->n_pipes); - igt_info("Testing connector %s using pipe %c\n", igt_output_name(output), pipe_name(pipe)); + igt_info("Testing connector %s using pipe %s\n", igt_output_name(output), + kmstest_pipe_name(pipe)); functional_test_init(&test, output, pipe); @@ -534,15 +535,18 @@ run_tests_for_pipe(data_t *data, enum pipe pipe) { igt_output_t *output; - igt_subtest_f("universal-plane-pipe-%c-functional", pipe_name(pipe)) + igt_subtest_f("universal-plane-pipe-%s-functional", + kmstest_pipe_name(pipe)) for_each_connected_output(&data->display, output) functional_test_pipe(data, pipe, output); - igt_subtest_f("universal-plane-pipe-%c-sanity", pipe_name(pipe)) + igt_subtest_f("universal-plane-pipe-%s-sanity", + kmstest_pipe_name(pipe)) for_each_connected_output(&data->display, output) sanity_test_pipe(data, pipe, output); - igt_subtest_f("disable-primary-vs-flip-pipe-%c", pipe_name(pipe)) + igt_subtest_f("disable-primary-vs-flip-pipe-%s", + kmstest_pipe_name(pipe)) for_each_connected_output(&data->display, output) pageflip_test_pipe(data, pipe, output); } -- 2.0.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx