diff options
author | Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> | 2019-03-04 12:31:20 -0300 |
---|---|---|
committer | Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> | 2019-03-12 09:01:09 -0300 |
commit | 312fd6e178bc289c99675849bd1e78eee4afd539 (patch) | |
tree | cfb1b3368a28f8d079b450563ed8e423d7ae3383 /tests/kms_flip.c | |
parent | 07ed868473114a35981350ba50fd2ed6a65cf30c (diff) |
kms_flip: Remove magic constant in run_test_on_crtc_set()
The function run_test_on_crtc_set() expects a parameter named crtc_count
which slight changes the behavior of the test. If this crtc_count is
‘1’, the test will run in a single CRTC; otherwise, it will run in two
different CRTC. However, this function uses hardcoded literal 1 and 2
for each case. This patch creates two constant with the goal to improve
the readability.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'tests/kms_flip.c')
-rwxr-xr-x | tests/kms_flip.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/kms_flip.c b/tests/kms_flip.c index c625ac95..373f29a5 100755 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -76,6 +76,9 @@ #define EVENT_FLIP (1 << 0) #define EVENT_VBLANK (1 << 1) +#define RUN_TEST 1 +#define RUN_PAIR 2 + #ifndef DRM_CAP_TIMESTAMP_MONOTONIC #define DRM_CAP_TIMESTAMP_MONOTONIC 6 #endif @@ -1175,7 +1178,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, int i; switch (crtc_count) { - case 1: + case RUN_TEST: connector_find_preferred_mode(o->_connector[0], crtc_idxs[0], o); if (!o->mode_valid) return; @@ -1186,7 +1189,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, kmstest_connector_type_str(o->kconnector[0]->connector_type), o->kconnector[0]->connector_type_id); break; - case 2: + case RUN_PAIR: connector_find_compatible_mode(crtc_idxs[0], crtc_idxs[1], o); if (!o->mode_valid) return; @@ -1352,7 +1355,7 @@ static int run_test(int duration, int flags) o.depth = 24; crtc_idx = n; - run_test_on_crtc_set(&o, &crtc_idx, 1, duration); + run_test_on_crtc_set(&o, &crtc_idx, RUN_TEST, duration); } } @@ -1421,7 +1424,8 @@ static int run_pair(int duration, int flags) crtc_idxs[0] = n; crtc_idxs[1] = m; - run_test_on_crtc_set(&o, crtc_idxs, 2, + run_test_on_crtc_set(&o, crtc_idxs, + RUN_PAIR, duration); } } |