[igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking.
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Tue Feb 6 10:14:07 UTC 2018
This cleans up the tests slightly.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
tests/kms_flip.c | 3 +--
tests/kms_panel_fitting.c | 15 +++------------
tests/kms_plane_scaling.c | 7 +------
tests/kms_rotation_crc.c | 16 ++--------------
tests/kms_setmode.c | 12 +++---------
5 files changed, 10 insertions(+), 43 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index b43e77123e7f..3d6fe948d3bb 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1332,8 +1332,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
igt_info("\n%s: PASSED\n\n", test_name);
out:
- if (o->fb_ids[2])
- igt_remove_fb(drm_fd, &o->fb_info[2]);
+ igt_remove_fb(drm_fd, &o->fb_info[2]);
igt_remove_fb(drm_fd, &o->fb_info[1]);
igt_remove_fb(drm_fd, &o->fb_info[0]);
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index e0ca6cca8e6a..b3cee223a8e7 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -51,10 +51,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_output_set_pipe(output, pipe);
/* before allocating, free if any older fb */
- if (data->fb1.fb_id) {
- igt_remove_fb(data->drm_fd, &data->fb1);
- data->fb1.fb_id = 0;
- }
+ igt_remove_fb(data->drm_fd, &data->fb1);
/* allocate fb for plane 1 */
igt_create_pattern_fb(data->drm_fd,
@@ -83,14 +80,8 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
{
igt_display_t *display = &data->display;
- if (data->fb1.fb_id) {
- igt_remove_fb(data->drm_fd, &data->fb1);
- data->fb1.fb_id = 0;
- }
- if (data->fb2.fb_id) {
- igt_remove_fb(data->drm_fd, &data->fb2);
- data->fb2.fb_id = 0;
- }
+ igt_remove_fb(data->drm_fd, &data->fb1);
+ igt_remove_fb(data->drm_fd, &data->fb2);
if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
igt_plane_t *primary;
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 208f9262f84b..3171331c96b8 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -62,13 +62,8 @@ static void cleanup_fbs(data_t *data)
{
int i;
- for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
- if (!data->fb[i].fb_id)
- continue;
-
+ for (i = 0; i < ARRAY_SIZE(data->fb); i++)
igt_remove_fb(data->drm_fd, &data->fb[i]);
- data->fb[i].fb_id = 0;
- }
}
static void cleanup_crtc(data_t *data)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f65562bae9eb..4f56d3d65db4 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -174,17 +174,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
static void remove_fbs(data_t *data)
{
- if (!data->fb.fb_id)
- return;
-
igt_remove_fb(data->gfx_fd, &data->fb);
igt_remove_fb(data->gfx_fd, &data->fb_reference);
igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
-
- if (data->fb_flip.fb_id)
- igt_remove_fb(data->gfx_fd, &data->fb_flip);
-
- data->fb_flip.fb_id = data->fb.fb_id = 0;
+ igt_remove_fb(data->gfx_fd, &data->fb_flip);
}
enum rectangle_type {
@@ -205,12 +198,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
uint32_t pixel_format = data->override_fmt ?: DRM_FORMAT_XRGB8888;
const float flip_opacity = 0.75;
- if (data->fb.fb_id) {
- igt_plane_set_fb(plane, NULL);
- igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
-
- remove_fbs(data);
- }
+ remove_fbs(data);
igt_plane_set_rotation(plane, IGT_ROTATION_0);
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 06241b191a0f..47d04fb5f7b1 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -361,6 +361,9 @@ static void cleanup_crtcs(struct crtc_config *crtcs, int crtc_count)
int i;
for (i = 0; i < crtc_count; i++) {
+ igt_remove_fb(drm_fd, &crtcs[i].fb_info);
+ drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0, NULL, 0, NULL);
+
free(crtcs[i].cconfs);
}
}
@@ -577,15 +580,6 @@ static void test_crtc_config(const struct test_config *tconf,
if (ret == 0 && tconf->flags & TEST_TIMINGS)
check_timings(crtcs[0].crtc_idx, &crtcs[0].mode);
- for (i = 0; i < crtc_count; i++) {
- if (crtcs[i].fb_info.fb_id) {
- drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0, NULL,
- 0, NULL);
- drmModeRmFB(drm_fd, crtcs[i].fb_info.fb_id);
- crtcs[i].fb_info.fb_id = 0;
- }
- }
-
return;
}
--
2.16.1
More information about the igt-dev
mailing list