mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2025-01-18 10:27:00 +01:00
Move device_test_commit to device.c
This commit is contained in:
parent
b16078769e
commit
95d16704b9
3 changed files with 24 additions and 20 deletions
20
alloc.c
20
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)
|
||||
{
|
||||
|
|
21
device.c
21
device.c
|
@ -1,3 +1,4 @@
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue