From 95d16704b98a7f7d547ce6eeafca2625d8ebe143 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 13 Jan 2020 12:22:47 +0100 Subject: [PATCH] Move device_test_commit to device.c --- alloc.c | 20 -------------------- device.c | 21 +++++++++++++++++++++ include/private.h | 3 +++ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/alloc.c b/alloc.c index c784434..2ee7908 100644 --- a/alloc.c +++ b/alloc.c @@ -343,26 +343,6 @@ bool check_alloc_valid(struct alloc_result *result, struct alloc_step *step) return true; } -static bool device_test_commit(struct liftoff_device *device, - drmModeAtomicReq *req, bool *compatible) -{ - int ret; - - ret = drmModeAtomicCommit(device->drm_fd, req, - DRM_MODE_ATOMIC_TEST_ONLY, NULL); - if (ret == 0) { - *compatible = true; - } else if (-ret == EINVAL || -ret == ERANGE) { - *compatible = false; - } else { - liftoff_log_errno(LIFTOFF_ERROR, "drmModeAtomicCommit"); - *compatible = false; - return false; - } - - return true; -} - bool output_choose_layers(struct liftoff_output *output, struct alloc_result *result, struct alloc_step *step) { diff --git a/device.c b/device.c index b98da1d..e4c0fde 100644 --- a/device.c +++ b/device.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -81,3 +82,23 @@ void liftoff_device_destroy(struct liftoff_device *device) free(device->crtcs); free(device); } + +bool device_test_commit(struct liftoff_device *device, + drmModeAtomicReq *req, bool *compatible) +{ + int ret; + + ret = drmModeAtomicCommit(device->drm_fd, req, + DRM_MODE_ATOMIC_TEST_ONLY, NULL); + if (ret == 0) { + *compatible = true; + } else if (-ret == EINVAL || -ret == ERANGE) { + *compatible = false; + } else { + liftoff_log_errno(LIFTOFF_ERROR, "drmModeAtomicCommit"); + *compatible = false; + return false; + } + + return true; +} diff --git a/include/private.h b/include/private.h index c0f7b84..a92acea 100644 --- a/include/private.h +++ b/include/private.h @@ -78,6 +78,9 @@ struct liftoff_rect { int width, height; }; +bool device_test_commit(struct liftoff_device *device, + drmModeAtomicReq *req, bool *compatible); + struct liftoff_layer_property *layer_get_property(struct liftoff_layer *layer, const char *name); void layer_get_rect(struct liftoff_layer *layer, struct liftoff_rect *rect);