From a04c8abb86362e39a5a74caddf923356dec8d61f Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Wed, 15 Apr 2020 10:37:24 +0100 Subject: [PATCH] modetest: reorder atomic path alike the non-atomic Makes the code a tiny bit more symmetrical. Signed-off-by: Emil Velikov Reviewed-by: Ezequiel Garcia Tested-by: Ezequiel Garcia --- tests/modetest/modetest.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 7ab73a07..95eab98c 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -2055,8 +2055,11 @@ int main(int argc, char **argv) return 1; } - set_mode(&dev, pipe_args, count); - atomic_set_planes(&dev, plane_args, plane_count, false); + if (count) + set_mode(&dev, pipe_args, count); + + if (plane_count) + atomic_set_planes(&dev, plane_args, plane_count, false); ret = drmModeAtomicCommit(dev.fd, dev.req, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); if (ret) { @@ -2075,13 +2078,18 @@ int main(int argc, char **argv) drmModeAtomicFree(dev.req); dev.req = drmModeAtomicAlloc(); - atomic_clear_mode(&dev, pipe_args, count); - atomic_clear_planes(&dev, plane_args, plane_count); + if (plane_count) + atomic_clear_planes(&dev, plane_args, plane_count); + + if (count) + atomic_clear_mode(&dev, pipe_args, count); + ret = drmModeAtomicCommit(dev.fd, dev.req, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); if (ret) fprintf(stderr, "Atomic Commit failed\n"); - atomic_clear_FB(&dev, plane_args, plane_count); + if (plane_count) + atomic_clear_FB(&dev, plane_args, plane_count); } drmModeAtomicFree(dev.req);