mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-12-25 21:59:11 +01:00
Fixup display → device bulk rename
I managed to do a bit of a mess here.
Fixes: b0e2b083f9
("Rename display to device")
This commit is contained in:
parent
b0e2b083f9
commit
44d65288d7
9 changed files with 68 additions and 68 deletions
10
README.md
10
README.md
|
@ -22,22 +22,22 @@ Depends on libdrm. Requires universal planes and atomic.
|
|||
See [`liftoff.h`][liftoff.h]. Here's the general idea:
|
||||
|
||||
```c
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
struct liftoff_output *output;
|
||||
struct liftoff_layer *layer;
|
||||
drmModeAtomicReq *req;
|
||||
int ret;
|
||||
|
||||
display = liftoff_display_create(drm_fd);
|
||||
output = liftoff_output_create(display, crtc_id);
|
||||
device = liftoff_device_create(drm_fd);
|
||||
output = liftoff_output_create(device, crtc_id);
|
||||
|
||||
layer = liftoff_layer_create(output);
|
||||
liftoff_layer_set_property(layer, "FB_ID", fb_id);
|
||||
/* Probably setup more properties and more layers */
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
if (!liftoff_display_apply(display, req)) {
|
||||
perror("liftoff_display_apply");
|
||||
if (!liftoff_device_apply(device, req)) {
|
||||
perror("liftoff_device_apply");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
|||
int opt;
|
||||
size_t layers_len;
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
drmModeRes *drm_res;
|
||||
drmModeCrtc *crtc;
|
||||
drmModeConnector *connector;
|
||||
|
@ -150,9 +150,9 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
display = liftoff_display_create(drm_fd);
|
||||
if (display == NULL) {
|
||||
perror("liftoff_display_create");
|
||||
device = liftoff_device_create(drm_fd);
|
||||
if (device == NULL) {
|
||||
perror("liftoff_device_create");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
|
|||
connector = pick_connector(drm_fd, drm_res);
|
||||
crtc = pick_crtc(drm_fd, drm_res, connector);
|
||||
disable_all_crtcs_except(drm_fd, drm_res, crtc->crtc_id);
|
||||
output = liftoff_output_create(display, crtc->crtc_id);
|
||||
output = liftoff_output_create(device, crtc->crtc_id);
|
||||
drmModeFreeResources(drm_res);
|
||||
|
||||
if (connector == NULL) {
|
||||
|
@ -193,8 +193,8 @@ int main(int argc, char *argv[])
|
|||
liftoff_output_set_composition_layer(output, composition_layer);
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
if (!liftoff_display_apply(display, req)) {
|
||||
perror("liftoff_display_commit");
|
||||
if (!liftoff_device_apply(device, req)) {
|
||||
perror("liftoff_device_commit");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -229,6 +229,6 @@ int main(int argc, char *argv[])
|
|||
liftoff_output_destroy(output);
|
||||
drmModeFreeCrtc(crtc);
|
||||
drmModeFreeConnector(connector);
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ struct example_layer {
|
|||
};
|
||||
|
||||
static int drm_fd = -1;
|
||||
static struct liftoff_display *display = NULL;
|
||||
static struct liftoff_device *device = NULL;
|
||||
static struct example_layer layers[LAYERS_LEN] = {0};
|
||||
static size_t active_layer_idx = 2;
|
||||
|
||||
|
@ -107,8 +107,8 @@ static bool draw(void)
|
|||
draw_layer(drm_fd, active_layer);
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
if (!liftoff_display_apply(display, req)) {
|
||||
perror("liftoff_display_commit");
|
||||
if (!liftoff_device_apply(device, req)) {
|
||||
perror("liftoff_device_commit");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -159,9 +159,9 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
display = liftoff_display_create(drm_fd);
|
||||
if (display == NULL) {
|
||||
perror("liftoff_display_create");
|
||||
device = liftoff_device_create(drm_fd);
|
||||
if (device == NULL) {
|
||||
perror("liftoff_device_create");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ int main(int argc, char *argv[])
|
|||
connector = pick_connector(drm_fd, drm_res);
|
||||
crtc = pick_crtc(drm_fd, drm_res, connector);
|
||||
disable_all_crtcs_except(drm_fd, drm_res, crtc->crtc_id);
|
||||
output = liftoff_output_create(display, crtc->crtc_id);
|
||||
output = liftoff_output_create(device, crtc->crtc_id);
|
||||
drmModeFreeResources(drm_res);
|
||||
|
||||
if (connector == NULL) {
|
||||
|
@ -225,6 +225,6 @@ int main(int argc, char *argv[])
|
|||
liftoff_output_destroy(output);
|
||||
drmModeFreeCrtc(crtc);
|
||||
drmModeFreeConnector(connector);
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ static struct liftoff_layer *add_layer(int drm_fd, struct liftoff_output *output
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
drmModeRes *drm_res;
|
||||
drmModeConnector *connector;
|
||||
drmModeCrtc *crtcs[MAX_OUTPUTS], *crtc;
|
||||
|
@ -94,9 +94,9 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
display = liftoff_display_create(drm_fd);
|
||||
if (display == NULL) {
|
||||
perror("liftoff_display_create");
|
||||
device = liftoff_device_create(drm_fd);
|
||||
if (device == NULL) {
|
||||
perror("liftoff_device_create");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
|||
continue;
|
||||
}
|
||||
|
||||
output = liftoff_output_create(display, crtc->crtc_id);
|
||||
output = liftoff_output_create(device, crtc->crtc_id);
|
||||
|
||||
printf("Using connector %d, CRTC %d\n", connector->connector_id,
|
||||
crtc->crtc_id);
|
||||
|
@ -154,8 +154,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
if (!liftoff_display_apply(display, req)) {
|
||||
perror("liftoff_display_commit");
|
||||
if (!liftoff_device_apply(device, req)) {
|
||||
perror("liftoff_device_commit");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -180,6 +180,6 @@ int main(int argc, char *argv[])
|
|||
liftoff_output_destroy(outputs[i]);
|
||||
drmModeFreeCrtc(crtcs[i]);
|
||||
}
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ static struct liftoff_layer *add_layer(int drm_fd, struct liftoff_output *output
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
drmModeRes *drm_res;
|
||||
drmModeCrtc *crtc;
|
||||
drmModeConnector *connector;
|
||||
|
@ -91,9 +91,9 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
display = liftoff_display_create(drm_fd);
|
||||
if (display == NULL) {
|
||||
perror("liftoff_display_create");
|
||||
device = liftoff_device_create(drm_fd);
|
||||
if (device == NULL) {
|
||||
perror("liftoff_device_create");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
|||
connector = pick_connector(drm_fd, drm_res);
|
||||
crtc = pick_crtc(drm_fd, drm_res, connector);
|
||||
disable_all_crtcs_except(drm_fd, drm_res, crtc->crtc_id);
|
||||
output = liftoff_output_create(display, crtc->crtc_id);
|
||||
output = liftoff_output_create(device, crtc->crtc_id);
|
||||
drmModeFreeResources(drm_res);
|
||||
|
||||
if (connector == NULL) {
|
||||
|
@ -128,8 +128,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
if (!liftoff_display_apply(display, req)) {
|
||||
perror("liftoff_display_commit");
|
||||
if (!liftoff_device_apply(device, req)) {
|
||||
perror("liftoff_device_commit");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,6 @@ int main(int argc, char *argv[])
|
|||
liftoff_output_destroy(output);
|
||||
drmModeFreeCrtc(crtc);
|
||||
drmModeFreeConnector(connector);
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
return 0;
|
||||
}
|
||||
|
|
12
test/bench.c
12
test/bench.c
|
@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
|||
size_t i, j;
|
||||
int plane_type;
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
struct liftoff_output *output;
|
||||
struct liftoff_layer *layers[MAX_LAYERS];
|
||||
drmModeAtomicReq *req;
|
||||
|
@ -73,10 +73,10 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
drm_fd = liftoff_mock_drm_open();
|
||||
display = liftoff_display_create(drm_fd);
|
||||
assert(display != NULL);
|
||||
device = liftoff_device_create(drm_fd);
|
||||
assert(device != NULL);
|
||||
|
||||
output = liftoff_output_create(display, liftoff_mock_drm_crtc_id);
|
||||
output = liftoff_output_create(device, liftoff_mock_drm_crtc_id);
|
||||
|
||||
for (i = 0; i < layers_len; i++) {
|
||||
/* Planes don't intersect, so the library can arrange them in
|
||||
|
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
|||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
ok = liftoff_display_apply(display, req);
|
||||
ok = liftoff_device_apply(device, req);
|
||||
assert(ok);
|
||||
drmModeAtomicFree(req);
|
||||
|
||||
|
@ -115,6 +115,6 @@ int main(int argc, char *argv[])
|
|||
printf("With 20µs per atomic test commit, plane allocation would take "
|
||||
"%fms\n", dur_ms + liftoff_mock_commit_count * 0.02);
|
||||
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
close(drm_fd);
|
||||
}
|
||||
|
|
|
@ -560,7 +560,7 @@ static void run_test(struct test_layer *test_layers)
|
|||
struct liftoff_mock_plane *mock_plane;
|
||||
struct test_layer *test_layer;
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
struct liftoff_output *output;
|
||||
struct liftoff_layer *layers[64];
|
||||
drmModeAtomicReq *req;
|
||||
|
@ -572,10 +572,10 @@ static void run_test(struct test_layer *test_layers)
|
|||
}
|
||||
|
||||
drm_fd = liftoff_mock_drm_open();
|
||||
display = liftoff_display_create(drm_fd);
|
||||
assert(display != NULL);
|
||||
device = liftoff_device_create(drm_fd);
|
||||
assert(device != NULL);
|
||||
|
||||
output = liftoff_output_create(display, liftoff_mock_drm_crtc_id);
|
||||
output = liftoff_output_create(device, liftoff_mock_drm_crtc_id);
|
||||
for (i = 0; test_layers[i].width > 0; i++) {
|
||||
test_layer = &test_layers[i];
|
||||
layers[i] = add_layer(output, test_layer->x, test_layer->y,
|
||||
|
@ -596,7 +596,7 @@ static void run_test(struct test_layer *test_layers)
|
|||
}
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
ok = liftoff_display_apply(display, req);
|
||||
ok = liftoff_device_apply(device, req);
|
||||
assert(ok);
|
||||
drmModeAtomicFree(req);
|
||||
|
||||
|
@ -631,7 +631,7 @@ static void run_test(struct test_layer *test_layers)
|
|||
}
|
||||
assert(ok);
|
||||
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
close(drm_fd);
|
||||
}
|
||||
|
||||
|
@ -639,7 +639,7 @@ static void test_basic(void)
|
|||
{
|
||||
struct liftoff_mock_plane *mock_plane;
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
struct liftoff_output *output;
|
||||
struct liftoff_layer *layer;
|
||||
drmModeAtomicReq *req;
|
||||
|
@ -648,21 +648,21 @@ static void test_basic(void)
|
|||
mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY);
|
||||
|
||||
drm_fd = liftoff_mock_drm_open();
|
||||
display = liftoff_display_create(drm_fd);
|
||||
assert(display != NULL);
|
||||
device = liftoff_device_create(drm_fd);
|
||||
assert(device != NULL);
|
||||
|
||||
output = liftoff_output_create(display, liftoff_mock_drm_crtc_id);
|
||||
output = liftoff_output_create(device, liftoff_mock_drm_crtc_id);
|
||||
layer = add_layer(output, 0, 0, 1920, 1080);
|
||||
|
||||
liftoff_mock_plane_add_compatible_layer(mock_plane, layer);
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
ok = liftoff_display_apply(display, req);
|
||||
ok = liftoff_device_apply(device, req);
|
||||
assert(ok);
|
||||
assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer);
|
||||
drmModeAtomicFree(req);
|
||||
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
close(drm_fd);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ int main(int argc, char *argv[]) {
|
|||
const char *test_name;
|
||||
struct liftoff_mock_plane *mock_plane;
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
struct liftoff_output *output;
|
||||
struct liftoff_layer *layer;
|
||||
drmModeAtomicReq *req;
|
||||
|
@ -51,10 +51,10 @@ int main(int argc, char *argv[]) {
|
|||
liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR);
|
||||
|
||||
drm_fd = liftoff_mock_drm_open();
|
||||
display = liftoff_display_create(drm_fd);
|
||||
assert(display != NULL);
|
||||
device = liftoff_device_create(drm_fd);
|
||||
assert(device != NULL);
|
||||
|
||||
output = liftoff_output_create(display, liftoff_mock_drm_crtc_id);
|
||||
output = liftoff_output_create(device, liftoff_mock_drm_crtc_id);
|
||||
layer = add_layer(output, 0, 0, 1920, 1080);
|
||||
/* Layer incompatible with all planes */
|
||||
add_layer(output, 0, 0, 256, 256);
|
||||
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[]) {
|
|||
liftoff_mock_plane_add_compatible_layer(mock_plane, layer);
|
||||
|
||||
req = drmModeAtomicAlloc();
|
||||
ok = liftoff_display_apply(display, req);
|
||||
ok = liftoff_device_apply(device, req);
|
||||
assert(ok);
|
||||
assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer);
|
||||
drmModeAtomicFree(req);
|
||||
|
@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
ok = liftoff_display_apply(display, req);
|
||||
ok = liftoff_device_apply(device, req);
|
||||
assert(ok);
|
||||
assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer);
|
||||
if (want_reuse_prev_alloc) {
|
||||
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
drmModeAtomicFree(req);
|
||||
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
close(drm_fd);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -32,7 +32,7 @@ static struct liftoff_layer *add_layer(struct liftoff_output *output,
|
|||
int main(int argc, char *argv[]) {
|
||||
struct liftoff_mock_plane *mock_plane;
|
||||
int drm_fd;
|
||||
struct liftoff_display *display;
|
||||
struct liftoff_device *device;
|
||||
struct liftoff_output *output;
|
||||
struct liftoff_layer *layers[2], *layer;
|
||||
uint32_t fbs[2];
|
||||
|
@ -46,10 +46,10 @@ int main(int argc, char *argv[]) {
|
|||
liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR);
|
||||
|
||||
drm_fd = liftoff_mock_drm_open();
|
||||
display = liftoff_display_create(drm_fd);
|
||||
assert(display != NULL);
|
||||
device = liftoff_device_create(drm_fd);
|
||||
assert(device != NULL);
|
||||
|
||||
output = liftoff_output_create(display, liftoff_mock_drm_crtc_id);
|
||||
output = liftoff_output_create(device, liftoff_mock_drm_crtc_id);
|
||||
layers[0] = add_layer(output, 0, 0, 1920, 1080);
|
||||
layers[1] = add_layer(output, 0, 0, 1920, 1080);
|
||||
|
||||
|
@ -72,7 +72,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
liftoff_layer_set_property(layer, "FB_ID", fbs[j % 2]);
|
||||
|
||||
ok = liftoff_display_apply(display, req);
|
||||
ok = liftoff_device_apply(device, req);
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ int main(int argc, char *argv[]) {
|
|||
drmModeAtomicFree(req);
|
||||
}
|
||||
|
||||
liftoff_display_destroy(display);
|
||||
liftoff_device_destroy(device);
|
||||
close(drm_fd);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue