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:
Simon Ser 2019-11-24 13:07:12 +01:00
parent b0e2b083f9
commit 44d65288d7
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
9 changed files with 68 additions and 68 deletions

View file

@ -22,22 +22,22 @@ Depends on libdrm. Requires universal planes and atomic.
See [`liftoff.h`][liftoff.h]. Here's the general idea: See [`liftoff.h`][liftoff.h]. Here's the general idea:
```c ```c
struct liftoff_display *display; struct liftoff_device *device;
struct liftoff_output *output; struct liftoff_output *output;
struct liftoff_layer *layer; struct liftoff_layer *layer;
drmModeAtomicReq *req; drmModeAtomicReq *req;
int ret; int ret;
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
output = liftoff_output_create(display, crtc_id); output = liftoff_output_create(device, crtc_id);
layer = liftoff_layer_create(output); layer = liftoff_layer_create(output);
liftoff_layer_set_property(layer, "FB_ID", fb_id); liftoff_layer_set_property(layer, "FB_ID", fb_id);
/* Probably setup more properties and more layers */ /* Probably setup more properties and more layers */
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
if (!liftoff_display_apply(display, req)) { if (!liftoff_device_apply(device, req)) {
perror("liftoff_display_apply"); perror("liftoff_device_apply");
exit(1); exit(1);
} }

View file

@ -102,7 +102,7 @@ int main(int argc, char *argv[])
int opt; int opt;
size_t layers_len; size_t layers_len;
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
drmModeRes *drm_res; drmModeRes *drm_res;
drmModeCrtc *crtc; drmModeCrtc *crtc;
drmModeConnector *connector; drmModeConnector *connector;
@ -150,9 +150,9 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
if (display == NULL) { if (device == NULL) {
perror("liftoff_display_create"); perror("liftoff_device_create");
return 1; return 1;
} }
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
connector = pick_connector(drm_fd, drm_res); connector = pick_connector(drm_fd, drm_res);
crtc = pick_crtc(drm_fd, drm_res, connector); crtc = pick_crtc(drm_fd, drm_res, connector);
disable_all_crtcs_except(drm_fd, drm_res, crtc->crtc_id); 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); drmModeFreeResources(drm_res);
if (connector == NULL) { if (connector == NULL) {
@ -193,8 +193,8 @@ int main(int argc, char *argv[])
liftoff_output_set_composition_layer(output, composition_layer); liftoff_output_set_composition_layer(output, composition_layer);
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
if (!liftoff_display_apply(display, req)) { if (!liftoff_device_apply(device, req)) {
perror("liftoff_display_commit"); perror("liftoff_device_commit");
return 1; return 1;
} }
@ -229,6 +229,6 @@ int main(int argc, char *argv[])
liftoff_output_destroy(output); liftoff_output_destroy(output);
drmModeFreeCrtc(crtc); drmModeFreeCrtc(crtc);
drmModeFreeConnector(connector); drmModeFreeConnector(connector);
liftoff_display_destroy(display); liftoff_device_destroy(device);
return 0; return 0;
} }

View file

@ -28,7 +28,7 @@ struct example_layer {
}; };
static int drm_fd = -1; 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 struct example_layer layers[LAYERS_LEN] = {0};
static size_t active_layer_idx = 2; static size_t active_layer_idx = 2;
@ -107,8 +107,8 @@ static bool draw(void)
draw_layer(drm_fd, active_layer); draw_layer(drm_fd, active_layer);
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
if (!liftoff_display_apply(display, req)) { if (!liftoff_device_apply(device, req)) {
perror("liftoff_display_commit"); perror("liftoff_device_commit");
return false; return false;
} }
@ -159,9 +159,9 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
if (display == NULL) { if (device == NULL) {
perror("liftoff_display_create"); perror("liftoff_device_create");
return 1; return 1;
} }
@ -169,7 +169,7 @@ int main(int argc, char *argv[])
connector = pick_connector(drm_fd, drm_res); connector = pick_connector(drm_fd, drm_res);
crtc = pick_crtc(drm_fd, drm_res, connector); crtc = pick_crtc(drm_fd, drm_res, connector);
disable_all_crtcs_except(drm_fd, drm_res, crtc->crtc_id); 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); drmModeFreeResources(drm_res);
if (connector == NULL) { if (connector == NULL) {
@ -225,6 +225,6 @@ int main(int argc, char *argv[])
liftoff_output_destroy(output); liftoff_output_destroy(output);
drmModeFreeCrtc(crtc); drmModeFreeCrtc(crtc);
drmModeFreeConnector(connector); drmModeFreeConnector(connector);
liftoff_display_destroy(display); liftoff_device_destroy(device);
return 0; return 0;
} }

View file

@ -68,7 +68,7 @@ static struct liftoff_layer *add_layer(int drm_fd, struct liftoff_output *output
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
drmModeRes *drm_res; drmModeRes *drm_res;
drmModeConnector *connector; drmModeConnector *connector;
drmModeCrtc *crtcs[MAX_OUTPUTS], *crtc; drmModeCrtc *crtcs[MAX_OUTPUTS], *crtc;
@ -94,9 +94,9 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
if (display == NULL) { if (device == NULL) {
perror("liftoff_display_create"); perror("liftoff_device_create");
return 1; return 1;
} }
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
continue; 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, printf("Using connector %d, CRTC %d\n", connector->connector_id,
crtc->crtc_id); crtc->crtc_id);
@ -154,8 +154,8 @@ int main(int argc, char *argv[])
} }
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
if (!liftoff_display_apply(display, req)) { if (!liftoff_device_apply(device, req)) {
perror("liftoff_display_commit"); perror("liftoff_device_commit");
return 1; return 1;
} }
@ -180,6 +180,6 @@ int main(int argc, char *argv[])
liftoff_output_destroy(outputs[i]); liftoff_output_destroy(outputs[i]);
drmModeFreeCrtc(crtcs[i]); drmModeFreeCrtc(crtcs[i]);
} }
liftoff_display_destroy(display); liftoff_device_destroy(device);
return 0; return 0;
} }

View file

@ -66,7 +66,7 @@ static struct liftoff_layer *add_layer(int drm_fd, struct liftoff_output *output
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
drmModeRes *drm_res; drmModeRes *drm_res;
drmModeCrtc *crtc; drmModeCrtc *crtc;
drmModeConnector *connector; drmModeConnector *connector;
@ -91,9 +91,9 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
if (display == NULL) { if (device == NULL) {
perror("liftoff_display_create"); perror("liftoff_device_create");
return 1; return 1;
} }
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
connector = pick_connector(drm_fd, drm_res); connector = pick_connector(drm_fd, drm_res);
crtc = pick_crtc(drm_fd, drm_res, connector); crtc = pick_crtc(drm_fd, drm_res, connector);
disable_all_crtcs_except(drm_fd, drm_res, crtc->crtc_id); 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); drmModeFreeResources(drm_res);
if (connector == NULL) { if (connector == NULL) {
@ -128,8 +128,8 @@ int main(int argc, char *argv[])
} }
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
if (!liftoff_display_apply(display, req)) { if (!liftoff_device_apply(device, req)) {
perror("liftoff_display_commit"); perror("liftoff_device_commit");
return 1; return 1;
} }
@ -153,6 +153,6 @@ int main(int argc, char *argv[])
liftoff_output_destroy(output); liftoff_output_destroy(output);
drmModeFreeCrtc(crtc); drmModeFreeCrtc(crtc);
drmModeFreeConnector(connector); drmModeFreeConnector(connector);
liftoff_display_destroy(display); liftoff_device_destroy(device);
return 0; return 0;
} }

View file

@ -41,7 +41,7 @@ int main(int argc, char *argv[])
size_t i, j; size_t i, j;
int plane_type; int plane_type;
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
struct liftoff_output *output; struct liftoff_output *output;
struct liftoff_layer *layers[MAX_LAYERS]; struct liftoff_layer *layers[MAX_LAYERS];
drmModeAtomicReq *req; drmModeAtomicReq *req;
@ -73,10 +73,10 @@ int main(int argc, char *argv[])
} }
drm_fd = liftoff_mock_drm_open(); drm_fd = liftoff_mock_drm_open();
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
assert(display != NULL); 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++) { for (i = 0; i < layers_len; i++) {
/* Planes don't intersect, so the library can arrange them in /* 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); clock_gettime(CLOCK_MONOTONIC, &start);
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
ok = liftoff_display_apply(display, req); ok = liftoff_device_apply(device, req);
assert(ok); assert(ok);
drmModeAtomicFree(req); drmModeAtomicFree(req);
@ -115,6 +115,6 @@ int main(int argc, char *argv[])
printf("With 20µs per atomic test commit, plane allocation would take " printf("With 20µs per atomic test commit, plane allocation would take "
"%fms\n", dur_ms + liftoff_mock_commit_count * 0.02); "%fms\n", dur_ms + liftoff_mock_commit_count * 0.02);
liftoff_display_destroy(display); liftoff_device_destroy(device);
close(drm_fd); close(drm_fd);
} }

View file

@ -560,7 +560,7 @@ static void run_test(struct test_layer *test_layers)
struct liftoff_mock_plane *mock_plane; struct liftoff_mock_plane *mock_plane;
struct test_layer *test_layer; struct test_layer *test_layer;
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
struct liftoff_output *output; struct liftoff_output *output;
struct liftoff_layer *layers[64]; struct liftoff_layer *layers[64];
drmModeAtomicReq *req; drmModeAtomicReq *req;
@ -572,10 +572,10 @@ static void run_test(struct test_layer *test_layers)
} }
drm_fd = liftoff_mock_drm_open(); drm_fd = liftoff_mock_drm_open();
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
assert(display != NULL); 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++) { for (i = 0; test_layers[i].width > 0; i++) {
test_layer = &test_layers[i]; test_layer = &test_layers[i];
layers[i] = add_layer(output, test_layer->x, test_layer->y, 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(); req = drmModeAtomicAlloc();
ok = liftoff_display_apply(display, req); ok = liftoff_device_apply(device, req);
assert(ok); assert(ok);
drmModeAtomicFree(req); drmModeAtomicFree(req);
@ -631,7 +631,7 @@ static void run_test(struct test_layer *test_layers)
} }
assert(ok); assert(ok);
liftoff_display_destroy(display); liftoff_device_destroy(device);
close(drm_fd); close(drm_fd);
} }
@ -639,7 +639,7 @@ static void test_basic(void)
{ {
struct liftoff_mock_plane *mock_plane; struct liftoff_mock_plane *mock_plane;
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
struct liftoff_output *output; struct liftoff_output *output;
struct liftoff_layer *layer; struct liftoff_layer *layer;
drmModeAtomicReq *req; drmModeAtomicReq *req;
@ -648,21 +648,21 @@ static void test_basic(void)
mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY); mock_plane = liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_PRIMARY);
drm_fd = liftoff_mock_drm_open(); drm_fd = liftoff_mock_drm_open();
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
assert(display != NULL); 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 = add_layer(output, 0, 0, 1920, 1080);
liftoff_mock_plane_add_compatible_layer(mock_plane, layer); liftoff_mock_plane_add_compatible_layer(mock_plane, layer);
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
ok = liftoff_display_apply(display, req); ok = liftoff_device_apply(device, req);
assert(ok); assert(ok);
assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer); assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer);
drmModeAtomicFree(req); drmModeAtomicFree(req);
liftoff_display_destroy(display); liftoff_device_destroy(device);
close(drm_fd); close(drm_fd);
} }

View file

@ -30,7 +30,7 @@ int main(int argc, char *argv[]) {
const char *test_name; const char *test_name;
struct liftoff_mock_plane *mock_plane; struct liftoff_mock_plane *mock_plane;
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
struct liftoff_output *output; struct liftoff_output *output;
struct liftoff_layer *layer; struct liftoff_layer *layer;
drmModeAtomicReq *req; drmModeAtomicReq *req;
@ -51,10 +51,10 @@ int main(int argc, char *argv[]) {
liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR); liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR);
drm_fd = liftoff_mock_drm_open(); drm_fd = liftoff_mock_drm_open();
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
assert(display != NULL); 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 = add_layer(output, 0, 0, 1920, 1080);
/* Layer incompatible with all planes */ /* Layer incompatible with all planes */
add_layer(output, 0, 0, 256, 256); 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); liftoff_mock_plane_add_compatible_layer(mock_plane, layer);
req = drmModeAtomicAlloc(); req = drmModeAtomicAlloc();
ok = liftoff_display_apply(display, req); ok = liftoff_device_apply(device, req);
assert(ok); assert(ok);
assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer); assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer);
drmModeAtomicFree(req); drmModeAtomicFree(req);
@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
ok = liftoff_display_apply(display, req); ok = liftoff_device_apply(device, req);
assert(ok); assert(ok);
assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer); assert(liftoff_mock_plane_get_layer(mock_plane, req) == layer);
if (want_reuse_prev_alloc) { if (want_reuse_prev_alloc) {
@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
drmModeAtomicFree(req); drmModeAtomicFree(req);
liftoff_display_destroy(display); liftoff_device_destroy(device);
close(drm_fd); close(drm_fd);
return 0; return 0;

View file

@ -32,7 +32,7 @@ static struct liftoff_layer *add_layer(struct liftoff_output *output,
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
struct liftoff_mock_plane *mock_plane; struct liftoff_mock_plane *mock_plane;
int drm_fd; int drm_fd;
struct liftoff_display *display; struct liftoff_device *device;
struct liftoff_output *output; struct liftoff_output *output;
struct liftoff_layer *layers[2], *layer; struct liftoff_layer *layers[2], *layer;
uint32_t fbs[2]; uint32_t fbs[2];
@ -46,10 +46,10 @@ int main(int argc, char *argv[]) {
liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR); liftoff_mock_drm_create_plane(DRM_PLANE_TYPE_CURSOR);
drm_fd = liftoff_mock_drm_open(); drm_fd = liftoff_mock_drm_open();
display = liftoff_display_create(drm_fd); device = liftoff_device_create(drm_fd);
assert(display != NULL); 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[0] = add_layer(output, 0, 0, 1920, 1080);
layers[1] = 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]); liftoff_layer_set_property(layer, "FB_ID", fbs[j % 2]);
ok = liftoff_display_apply(display, req); ok = liftoff_device_apply(device, req);
assert(ok); assert(ok);
} }
@ -81,7 +81,7 @@ int main(int argc, char *argv[]) {
drmModeAtomicFree(req); drmModeAtomicFree(req);
} }
liftoff_display_destroy(display); liftoff_device_destroy(device);
close(drm_fd); close(drm_fd);
return 0; return 0;