kms_rotation_crc: Remove useless comments
[platform/upstream/intel-gpu-tools.git] / tests / kms_setmode.c
index 703e932..0b765a9 100644 (file)
@@ -32,7 +32,6 @@
 #include <getopt.h>
 #include <sys/time.h>
 
-#include "drm_fourcc.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
@@ -96,7 +95,7 @@ struct crtc_config {
        int pipe_id;
        int connector_count;
        struct connector_config *cconfs;
-       struct kmstest_fb fb_info;
+       struct igt_fb fb_info;
        drmModeModeInfo mode;
 };
 
@@ -142,22 +141,20 @@ static bool crtc_supports_mode(struct crtc_config *crtc, drmModeModeInfo *mode)
        return true;
 }
 
-static int paint_fb(struct kmstest_fb *fb, const char *test_name,
+static int paint_fb(struct igt_fb *fb, const char *test_name,
                    const char **crtc_str, int crtc_count, int current_crtc_idx)
 {
        double x, y;
        cairo_t *cr;
        int i;
 
-       cr = kmstest_get_cairo_ctx(drm_fd, fb);
+       cr = igt_get_cairo_ctx(drm_fd, fb);
 
-       kmstest_paint_test_pattern(cr, fb->width, fb->height);
+       igt_paint_test_pattern(cr, fb->width, fb->height);
 
-       cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
-                              CAIRO_FONT_WEIGHT_NORMAL);
        cairo_move_to(cr, fb->width / 2, fb->height / 2);
        cairo_set_font_size(cr, 24);
-       kmstest_cairo_printf_line(cr, align_hcenter, 40, "%s", test_name);
+       igt_cairo_printf_line(cr, align_hcenter, 40, "%s", test_name);
 
        cairo_get_current_point(cr, &x, &y);
        cairo_move_to(cr, 60, y);
@@ -166,10 +163,10 @@ static int paint_fb(struct kmstest_fb *fb, const char *test_name,
                if (i == current_crtc_idx) {
                        cairo_get_current_point(cr, &x, &y);
                        cairo_move_to(cr, x - 20, y);
-                       kmstest_cairo_printf_line(cr, align_right, 20, "X");
+                       igt_cairo_printf_line(cr, align_right, 20, "X");
                        cairo_move_to(cr, x, y);
                }
-               kmstest_cairo_printf_line(cr, align_left, 20, "%s",
+               igt_cairo_printf_line(cr, align_left, 20, "%s",
                                          crtc_str[i]);
        }
 
@@ -179,7 +176,7 @@ static int paint_fb(struct kmstest_fb *fb, const char *test_name,
 }
 
 static void create_fb_for_crtc(struct crtc_config *crtc,
-                              struct kmstest_fb *fb_info)
+                              struct igt_fb *fb_info)
 {
        int bpp;
        int depth;
@@ -189,8 +186,9 @@ static void create_fb_for_crtc(struct crtc_config *crtc,
        bpp = 32;
        depth = 24;
        enable_tiling = false;
-       fb_id = kmstest_create_fb(drm_fd, crtc->mode.hdisplay,
-                                 crtc->mode.vdisplay, bpp, depth,
+       fb_id = igt_create_fb(drm_fd, crtc->mode.hdisplay,
+                                 crtc->mode.vdisplay,
+                                 igt_bpp_depth_to_drm_format(bpp, depth),
                                  enable_tiling, fb_info);
        igt_assert(fb_id > 0);
 }
@@ -394,7 +392,7 @@ static void test_crtc_config(const struct test_config *tconf,
        if (filter_test_id && filter_test_id != test_id)
                return;
 
-       printf("  Test id#%d CRTC count %d\n", test_id, crtc_count);
+       igt_info("  Test id#%d CRTC count %d\n", test_id, crtc_count);
 
        for (i = 0; i < crtc_count; i++) {
                get_crtc_config_str(&crtcs[i], str_buf[i], sizeof(str_buf[i]));
@@ -403,7 +401,7 @@ static void test_crtc_config(const struct test_config *tconf,
 
        if (dry_run) {
                for (i = 0; i < crtc_count; i++)
-                       printf("    %s\n", crtc_strs[i]);
+                       igt_info("    %s\n", crtc_strs[i]);
                return;
        }
 
@@ -413,7 +411,7 @@ static void test_crtc_config(const struct test_config *tconf,
 
                crtc = &crtcs[i];
 
-               printf("    %s\n", crtc_strs[i]);
+               igt_info("    %s\n", crtc_strs[i]);
 
                create_fb_for_crtc(crtc, &crtc->fb_info);
                paint_fb(&crtc->fb_info, tconf->name, crtc_strs, crtc_count, i);
@@ -625,8 +623,8 @@ static void test_combinations(const struct test_config *tconf,
        get_combinations(tconf->resources->count_crtcs, connector_count,
                         true, &crtc_combs);
 
-       printf("Testing: %s %d connector combinations\n", tconf->name,
-               connector_count);
+       igt_info("Testing: %s %d connector combinations\n", tconf->name,
+                connector_count);
        for (i = 0; i < connector_combs.count; i++) {
                int *connector_idxs;
                int ret;
@@ -711,10 +709,8 @@ int main(int argc, char **argv)
 
        igt_skip_on_simulation();
 
-       if (dry_run && filter_test_id) {
-               fprintf(stderr, "only one of -d and -t is accepted\n");
-               exit(1);
-       }
+       igt_assert_f(!(dry_run && filter_test_id),
+                    "only one of -d and -t is accepted\n");
 
        igt_fixture {
                drm_fd = drm_open_any();