diff --git a/README.md b/README.md index 3543371..3ac8cf1 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ liftoff_layer_set_property(layer, "FB_ID", fb_id); /* Probably setup more properties and more layers */ req = drmModeAtomicAlloc(); -if (!liftoff_output_apply(output, req)) { +ret = liftoff_output_apply(output, req); +if (ret < 0) { perror("liftoff_output_apply"); exit(1); } diff --git a/alloc.c b/alloc.c index 0fae53a..be0d7a7 100644 --- a/alloc.c +++ b/alloc.c @@ -344,15 +344,14 @@ bool check_alloc_valid(struct alloc_result *result, struct alloc_step *step) return true; } -bool output_choose_layers(struct liftoff_output *output, - struct alloc_result *result, struct alloc_step *step) +int output_choose_layers(struct liftoff_output *output, + struct alloc_result *result, struct alloc_step *step) { struct liftoff_device *device; struct liftoff_plane *plane; struct liftoff_layer *layer; - int cursor; + int cursor, ret; size_t remaining_planes; - bool compatible; struct alloc_step next_step; device = output->device; @@ -368,7 +367,7 @@ bool output_choose_layers(struct liftoff_output *output, memcpy(result->best, step->alloc, result->planes_len * sizeof(struct liftoff_layer *)); } - return true; + return 0; } plane = liftoff_container_of(step->plane_link, plane, link); @@ -379,7 +378,7 @@ bool output_choose_layers(struct liftoff_output *output, * find a better allocation. Give up. */ /* TODO: change remaining_planes to only count those whose * possible CRTC match and which aren't allocated */ - return true; + return 0; } cursor = drmModeAtomicGetCursor(result->req); @@ -410,30 +409,30 @@ bool output_choose_layers(struct liftoff_output *output, liftoff_log(LIFTOFF_DEBUG, " Layer %p -> plane %"PRIu32": " "applying properties...", (void *)layer, plane->id); - if (!plane_apply(plane, layer, result->req, &compatible)) { - return false; - } - if (!compatible) { + ret = plane_apply(plane, layer, result->req); + if (ret == -EINVAL) { liftoff_log(LIFTOFF_DEBUG, " Layer %p -> plane %"PRIu32": " "incompatible properties", (void *)layer, plane->id); continue; + } else if (ret != 0) { + return ret; } - if (!device_test_commit(device, result->req, result->flags, - &compatible)) { - return false; - } - if (compatible) { + ret = device_test_commit(device, result->req, result->flags); + if (ret == 0) { liftoff_log(LIFTOFF_DEBUG, " Layer %p -> plane %"PRIu32": success", (void *)layer, plane->id); /* Continue with the next plane */ plane_step_init_next(&next_step, step, layer); - if (!output_choose_layers(output, result, &next_step)) { - return false; + ret = output_choose_layers(output, result, &next_step); + if (ret != 0) { + return ret; } + } else if (ret != -EINVAL && ret != -ERANGE) { + return ret; } drmModeAtomicSetCursor(result->req, cursor); @@ -442,32 +441,32 @@ bool output_choose_layers(struct liftoff_output *output, skip: /* Try not to use the current plane */ plane_step_init_next(&next_step, step, NULL); - if (!output_choose_layers(output, result, &next_step)) { - return false; + ret = output_choose_layers(output, result, &next_step); + if (ret != 0) { + return ret; } drmModeAtomicSetCursor(result->req, cursor); - return true; + return 0; } -static bool apply_current(struct liftoff_device *device, - drmModeAtomicReq *req) +static int apply_current(struct liftoff_device *device, drmModeAtomicReq *req) { struct liftoff_plane *plane; - int cursor; - bool compatible; + int cursor, ret; cursor = drmModeAtomicGetCursor(req); liftoff_list_for_each(plane, &device->planes, link) { - if (!plane_apply(plane, plane->layer, req, &compatible)) { + ret = plane_apply(plane, plane->layer, req); + assert(ret != -EINVAL); + if (ret != 0) { drmModeAtomicSetCursor(req, cursor); - return false; + return ret; } - assert(compatible); } - return true; + return 0; } static bool layer_needs_realloc(struct liftoff_layer *layer) @@ -525,37 +524,37 @@ static bool layer_needs_realloc(struct liftoff_layer *layer) return false; } -static bool reuse_previous_alloc(struct liftoff_output *output, - drmModeAtomicReq *req, uint32_t flags) +static int reuse_previous_alloc(struct liftoff_output *output, + drmModeAtomicReq *req, uint32_t flags) { struct liftoff_device *device; struct liftoff_layer *layer; - int cursor; - bool compatible; + int cursor, ret; device = output->device; if (output->layers_changed) { - return false; + return -EINVAL; } liftoff_list_for_each(layer, &output->layers, link) { if (layer_needs_realloc(layer)) { - return false; + return -EINVAL; } } cursor = drmModeAtomicGetCursor(req); - if (!apply_current(device, req)) { - return false; - } - if (!device_test_commit(device, req, flags, &compatible) || !compatible) { - drmModeAtomicSetCursor(req, cursor); - return false; + ret = apply_current(device, req); + if (ret != 0) { + return ret; } - return true; + ret = device_test_commit(device, req, flags); + if (ret != 0) { + drmModeAtomicSetCursor(req, cursor); + } + return ret; } static void mark_layers_clean(struct liftoff_output *output) @@ -628,8 +627,8 @@ static size_t non_composition_layers_length(struct liftoff_output *output) return n; } -bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, - uint32_t flags) +int liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, + uint32_t flags) { struct liftoff_device *device; struct liftoff_plane *plane; @@ -637,15 +636,16 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, struct alloc_result result; struct alloc_step step; size_t i; - bool compatible; + int ret; device = output->device; update_layers_priority(device); - if (reuse_previous_alloc(output, req, flags)) { + ret = reuse_previous_alloc(output, req, flags); + if (ret == 0) { log_reuse(output); - return true; + return 0; } log_no_reuse(output); @@ -665,10 +665,11 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, if (plane->layer == NULL) { liftoff_log(LIFTOFF_DEBUG, "Disabling plane %"PRIu32, plane->id); - if (!plane_apply(plane, NULL, req, &compatible)) { - return false; + ret = plane_apply(plane, NULL, req); + assert(ret != -EINVAL); + if (ret != 0) { + return ret; } - assert(compatible); } } @@ -680,7 +681,7 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, result.best = malloc(result.planes_len * sizeof(*result.best)); if (step.alloc == NULL || result.best == NULL) { liftoff_log_errno(LIFTOFF_ERROR, "malloc"); - return false; + return -ENOMEM; } /* For each plane, try to find a layer. Don't do it the other @@ -698,8 +699,9 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, step.score = 0; step.last_layer_zpos = INT_MAX; step.composited = false; - if (!output_choose_layers(output, &result, &step)) { - return false; + ret = output_choose_layers(output, &result, &step); + if (ret != 0) { + return ret; } liftoff_log(LIFTOFF_DEBUG, @@ -724,8 +726,9 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, layer->plane = plane; } - if (!apply_current(device, req)) { - return false; + ret = apply_current(device, req); + if (ret != 0) { + return ret; } free(step.alloc); @@ -733,5 +736,5 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, mark_layers_clean(output); - return true; + return 0; } diff --git a/device.c b/device.c index 8875a38..c0f812e 100644 --- a/device.c +++ b/device.c @@ -86,8 +86,8 @@ bool liftoff_device_register_all_planes(struct liftoff_device *device) return true; } -bool device_test_commit(struct liftoff_device *device, - drmModeAtomicReq *req, uint32_t flags, bool *compatible) +int device_test_commit(struct liftoff_device *device, + drmModeAtomicReq *req, uint32_t flags) { int ret; @@ -96,16 +96,12 @@ bool device_test_commit(struct liftoff_device *device, ret = drmModeAtomicCommit(device->drm_fd, req, DRM_MODE_ATOMIC_TEST_ONLY | flags, NULL); - } while (-ret == EINTR || -ret == EAGAIN); - if (ret == 0) { - *compatible = true; - } else if (-ret == EINVAL || -ret == ERANGE) { - *compatible = false; - } else { - liftoff_log_errno(LIFTOFF_ERROR, "drmModeAtomicCommit"); - *compatible = false; - return false; + } while (ret == -EINTR || ret == -EAGAIN); + + if (ret != 0 && ret != -EINVAL && ret != -ERANGE) { + liftoff_log(LIFTOFF_ERROR, "drmModeAtomicCommit: %s", + strerror(-ret)); } - return true; + return ret; } diff --git a/example/compositor.c b/example/compositor.c index 57b4b1b..d3fbb84 100644 --- a/example/compositor.c +++ b/example/compositor.c @@ -194,7 +194,8 @@ int main(int argc, char *argv[]) flags = DRM_MODE_ATOMIC_NONBLOCK; req = drmModeAtomicAlloc(); - if (!liftoff_output_apply(output, req, flags)) { + ret = liftoff_output_apply(output, req, flags); + if (ret != 0) { perror("liftoff_output_apply"); return 1; } diff --git a/example/dynamic.c b/example/dynamic.c index 619a6f4..6f3311a 100644 --- a/example/dynamic.c +++ b/example/dynamic.c @@ -111,7 +111,8 @@ static bool draw(void) flags = DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT; req = drmModeAtomicAlloc(); - if (!liftoff_output_apply(output, req, flags)) { + ret = liftoff_output_apply(output, req, flags); + if (ret != 0) { perror("liftoff_output_apply"); return false; } diff --git a/example/multi-output.c b/example/multi-output.c index ccf2034..183c17d 100644 --- a/example/multi-output.c +++ b/example/multi-output.c @@ -156,7 +156,8 @@ int main(int argc, char *argv[]) flags = DRM_MODE_ATOMIC_NONBLOCK; req = drmModeAtomicAlloc(); for (i = 0; i < outputs_len; i++) { - if (!liftoff_output_apply(outputs[i], req, flags)) { + ret = liftoff_output_apply(outputs[i], req, flags); + if (ret != 0) { perror("liftoff_output_apply"); return 1; } diff --git a/example/simple.c b/example/simple.c index fc75141..6f9c490 100644 --- a/example/simple.c +++ b/example/simple.c @@ -129,7 +129,8 @@ int main(int argc, char *argv[]) flags = DRM_MODE_ATOMIC_NONBLOCK; req = drmModeAtomicAlloc(); - if (!liftoff_output_apply(output, req, flags)) { + ret = liftoff_output_apply(output, req, flags); + if (ret != 0) { perror("liftoff_output_apply"); return 1; } diff --git a/include/libliftoff.h b/include/libliftoff.h index 6e2cd68..e58cf85 100644 --- a/include/libliftoff.h +++ b/include/libliftoff.h @@ -59,9 +59,11 @@ uint32_t liftoff_plane_get_id(struct liftoff_plane *plane); * plane mapping with `liftoff_layer_get_plane`. * * `flags` is the atomic commit flags the caller intends to use. + * + * Zero is returned on success, negative errno on error. */ -bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, - uint32_t flags); +int liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req, + uint32_t flags); /** * Make the device manage a CRTC's planes. diff --git a/include/log.h b/include/log.h index fbaa4e4..f4dd5fc 100644 --- a/include/log.h +++ b/include/log.h @@ -1,6 +1,8 @@ #ifndef LOG_H #define LOG_H +#include + #include #ifdef __GNUC__ diff --git a/include/private.h b/include/private.h index 796c3d4..636a463 100644 --- a/include/private.h +++ b/include/private.h @@ -81,8 +81,8 @@ struct liftoff_rect { int width, height; }; -bool device_test_commit(struct liftoff_device *device, - drmModeAtomicReq *req, uint32_t flags, bool *compatible); +int device_test_commit(struct liftoff_device *device, + drmModeAtomicReq *req, uint32_t flags); struct liftoff_layer_property *layer_get_property(struct liftoff_layer *layer, const char *name); @@ -95,8 +95,8 @@ bool layer_is_visible(struct liftoff_layer *layer); struct liftoff_plane_property *plane_get_property(struct liftoff_plane *plane, const char *name); -bool plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer, - drmModeAtomicReq *req, bool *compatible); +int plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer, + drmModeAtomicReq *req); void output_log_layers(struct liftoff_output *output); diff --git a/plane.c b/plane.c index 243d63c..e461a3d 100644 --- a/plane.c +++ b/plane.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -165,23 +166,24 @@ struct liftoff_plane_property *plane_get_property(struct liftoff_plane *plane, return NULL; } -static bool plane_set_prop(struct liftoff_plane *plane, drmModeAtomicReq *req, - struct liftoff_plane_property *prop, uint64_t value) +static int plane_set_prop(struct liftoff_plane *plane, drmModeAtomicReq *req, + struct liftoff_plane_property *prop, uint64_t value) { int ret; ret = drmModeAtomicAddProperty(req, plane->id, prop->id, value); if (ret < 0) { - liftoff_log_errno(LIFTOFF_ERROR, "drmModeAtomicAddProperty"); - return false; + liftoff_log(LIFTOFF_ERROR, "drmModeAtomicAddProperty: %s", + strerror(-ret)); + return ret; } - return true; + return 0; } -static bool set_plane_prop_str(struct liftoff_plane *plane, - drmModeAtomicReq *req, const char *name, - uint64_t value) +static int set_plane_prop_str(struct liftoff_plane *plane, + drmModeAtomicReq *req, const char *name, + uint64_t value) { struct liftoff_plane_property *prop; @@ -190,30 +192,33 @@ static bool set_plane_prop_str(struct liftoff_plane *plane, liftoff_log(LIFTOFF_DEBUG, "plane %"PRIu32" is missing the %s property", plane->id, name); - return false; + return -EINVAL; } return plane_set_prop(plane, req, prop, value); } -bool plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer, - drmModeAtomicReq *req, bool *compatible) +int plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer, + drmModeAtomicReq *req) { - int cursor; + int cursor, ret; size_t i; struct liftoff_layer_property *layer_prop; struct liftoff_plane_property *plane_prop; - *compatible = true; cursor = drmModeAtomicGetCursor(req); if (layer == NULL) { - return set_plane_prop_str(plane, req, "FB_ID", 0) && - set_plane_prop_str(plane, req, "CRTC_ID", 0); + ret = set_plane_prop_str(plane, req, "FB_ID", 0); + if (ret != 0) { + return ret; + } + return set_plane_prop_str(plane, req, "CRTC_ID", 0); } - if (!set_plane_prop_str(plane, req, "CRTC_ID", layer->output->crtc_id)) { - return false; + ret = set_plane_prop_str(plane, req, "CRTC_ID", layer->output->crtc_id); + if (ret != 0) { + return ret; } for (i = 0; i < layer->props_len; i++) { @@ -234,16 +239,16 @@ bool plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer, layer_prop->value == DRM_MODE_ROTATE_0) { continue; /* Layer isn't rotated */ } - *compatible = false; drmModeAtomicSetCursor(req, cursor); - return true; + return -EINVAL; } - if (!plane_set_prop(plane, req, plane_prop, layer_prop->value)) { + ret = plane_set_prop(plane, req, plane_prop, layer_prop->value); + if (ret != 0) { drmModeAtomicSetCursor(req, cursor); - return false; + return ret; } } - return true; + return 0; } diff --git a/test/bench.c b/test/bench.c index 6ef7f96..06b99c8 100644 --- a/test/bench.c +++ b/test/bench.c @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) struct liftoff_output *output; struct liftoff_layer *layers[MAX_LAYERS]; drmModeAtomicReq *req; - bool ok; + int ret; planes_len = 5; layers_len = 10; @@ -101,8 +101,8 @@ int main(int argc, char *argv[]) clock_gettime(CLOCK_MONOTONIC, &start); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); drmModeAtomicFree(req); clock_gettime(CLOCK_MONOTONIC, &end); diff --git a/test/test_alloc.c b/test/test_alloc.c index b521915..21ca23e 100644 --- a/test/test_alloc.c +++ b/test/test_alloc.c @@ -656,12 +656,13 @@ static void run_test(struct test_layer *test_layers) } req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); drmModeAtomicFree(req); + ok = true; for (i = 0; test_layers[i].width > 0; i++) { plane = liftoff_layer_get_plane(layers[i]); mock_plane = NULL; @@ -707,7 +708,6 @@ static void test_basic(void) struct liftoff_output *output; struct liftoff_layer *layer; drmModeAtomicReq *req; - bool ok; int ret; mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY); @@ -724,8 +724,8 @@ static void test_basic(void) liftoff_mock_plane_add_compatible_layer(mock_plane, layer); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_mock_plane_get_layer(mock_plane) == layer); @@ -745,7 +745,6 @@ static void test_no_fb_fail(bool zero_fb_id) struct liftoff_output *output; struct liftoff_layer *layer; drmModeAtomicReq *req; - bool ok; int ret; mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY); @@ -765,8 +764,8 @@ static void test_no_fb_fail(bool zero_fb_id) liftoff_mock_plane_add_compatible_layer(mock_plane, layer); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_mock_plane_get_layer(mock_plane) == NULL); @@ -787,7 +786,6 @@ static void test_composition_zero_fb(void) struct liftoff_layer *composition_layer, *layer_with_fb, *layer_without_fb; drmModeAtomicReq *req; - bool ok; int ret; mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY); @@ -811,8 +809,8 @@ static void test_composition_zero_fb(void) liftoff_mock_plane_add_compatible_layer(mock_plane, layer_with_fb); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_mock_plane_get_layer(mock_plane) == layer_with_fb); diff --git a/test/test_dynamic.c b/test/test_dynamic.c index 8d3793c..ff6b5ac 100644 --- a/test/test_dynamic.c +++ b/test/test_dynamic.c @@ -41,14 +41,13 @@ static struct liftoff_layer *add_layer(struct liftoff_output *output, static void first_commit(struct context *ctx) { drmModeAtomicReq *req; - bool ok; int ret; assert(ctx->commit_count == 0); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(ctx->output, req, 0); - assert(ok); + ret = liftoff_output_apply(ctx->output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(ctx->drm_fd, req, 0, NULL); assert(ret == 0); drmModeAtomicFree(req); @@ -64,12 +63,11 @@ static void first_commit(struct context *ctx) { static void second_commit(struct context *ctx, bool want_reuse_prev_alloc) { drmModeAtomicReq *req; - bool ok; int ret; req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(ctx->output, req, 0); - assert(ok); + ret = liftoff_output_apply(ctx->output, req, 0); + assert(ret == 0); if (want_reuse_prev_alloc) { /* The library should perform only one TEST_ONLY commit with the * previous plane allocation. */ diff --git a/test/test_priority.c b/test/test_priority.c index 6c93d46..cf0417f 100644 --- a/test/test_priority.c +++ b/test/test_priority.c @@ -37,7 +37,6 @@ int main(int argc, char *argv[]) { struct liftoff_layer *layers[2], *layer; uint32_t fbs[2]; drmModeAtomicReq *req; - bool ok; int ret; liftoff_log_set_priority(LIFTOFF_SILENT); @@ -75,8 +74,8 @@ int main(int argc, char *argv[]) { liftoff_layer_set_property(layer, "FB_ID", fbs[j % 2]); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); } diff --git a/test/test_prop.c b/test/test_prop.c index b5133b0..59320c0 100644 --- a/test/test_prop.c +++ b/test/test_prop.c @@ -35,7 +35,6 @@ static int test_prop_default(const char *prop_name) struct liftoff_output *output; struct liftoff_layer *layer; drmModeAtomicReq *req; - bool ok; int ret; mock_plane_without_prop = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_OVERLAY); @@ -80,8 +79,8 @@ static int test_prop_default(const char *prop_name) liftoff_layer_set_property(layer, prop.name, require_prop_value); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_layer_get_plane(layer) == NULL); @@ -94,8 +93,8 @@ static int test_prop_default(const char *prop_name) liftoff_layer_set_property(layer, prop.name, default_value); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_layer_get_plane(layer) != NULL); @@ -110,8 +109,8 @@ static int test_prop_default(const char *prop_name) liftoff_layer_set_property(layer, prop.name, require_prop_value); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_layer_get_plane(layer) != NULL); @@ -133,7 +132,6 @@ static int test_ignore_alpha(void) struct liftoff_output *output; struct liftoff_layer *layer; drmModeAtomicReq *req; - bool ok; int ret; mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY); @@ -154,8 +152,8 @@ static int test_ignore_alpha(void) liftoff_mock_plane_add_compatible_layer(mock_plane, layer); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_mock_plane_get_layer(mock_plane) == NULL); @@ -176,7 +174,6 @@ static int test_immutable_zpos(void) { struct liftoff_output *output; struct liftoff_layer *layer1, *layer2; drmModeAtomicReq *req; - bool ok; int ret; mock_plane1 = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_OVERLAY); @@ -214,8 +211,8 @@ static int test_immutable_zpos(void) { liftoff_layer_set_property(layer2, "zpos", 43); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_mock_plane_get_layer(mock_plane1) == layer1); @@ -227,8 +224,8 @@ static int test_immutable_zpos(void) { liftoff_layer_set_property(layer2, "zpos", 42); req = drmModeAtomicAlloc(); - ok = liftoff_output_apply(output, req, 0); - assert(ok); + ret = liftoff_output_apply(output, req, 0); + assert(ret == 0); ret = drmModeAtomicCommit(drm_fd, req, 0, NULL); assert(ret == 0); assert(liftoff_mock_plane_get_layer(mock_plane1) == layer2);