mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-12-26 21:59:18 +01:00
feat: log device creation
For a new device log relevant data including all planes the output/CRTC supports.
This commit is contained in:
parent
8028aef654
commit
afef092218
3 changed files with 49 additions and 3 deletions
2
alloc.c
2
alloc.c
|
@ -614,7 +614,7 @@ bool liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req)
|
|||
|
||||
/* Disable all planes. Do it before building mappings to make sure not
|
||||
to hit bandwidth limits because too many planes are enabled. */
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "Disabling planes:");
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "Reset planes:");
|
||||
liftoff_list_for_each(plane, &device->planes, link) {
|
||||
if (plane->layer == NULL) {
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, " %"PRIu32, plane->id);
|
||||
|
|
11
device.c
11
device.c
|
@ -1,4 +1,5 @@
|
|||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -12,6 +13,8 @@ struct liftoff_device *liftoff_device_create(int drm_fd)
|
|||
drmModePlaneRes *drm_plane_res;
|
||||
uint32_t i;
|
||||
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "\nCreating device for fd %d. ", drm_fd);
|
||||
|
||||
device = calloc(1, sizeof(*device));
|
||||
if (device == NULL) {
|
||||
liftoff_log_errno(LIFTOFF_ERROR, "calloc");
|
||||
|
@ -56,7 +59,13 @@ struct liftoff_device *liftoff_device_create(int drm_fd)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
liftoff_log(LIFTOFF_DEBUG, "The device has %"PRIu32 " planes:", drm_plane_res->count_planes);
|
||||
|
||||
for (i = 0; i < drm_plane_res->count_planes; i++) {
|
||||
if (i < 9 && drm_plane_res->count_planes >= 9) {
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, " ");
|
||||
}
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "[%d] ", i + 1);
|
||||
if (plane_create(device, drm_plane_res->planes[i]) == NULL) {
|
||||
liftoff_device_destroy(device);
|
||||
return NULL;
|
||||
|
@ -64,6 +73,8 @@ struct liftoff_device *liftoff_device_create(int drm_fd)
|
|||
}
|
||||
drmModeFreePlaneResources(drm_plane_res);
|
||||
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "\n");
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
|
35
plane.c
35
plane.c
|
@ -30,6 +30,37 @@ static int guess_plane_zpos_from_type(struct liftoff_device *device,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void log_plane(struct liftoff_plane *plane)
|
||||
{
|
||||
size_t i;
|
||||
int per_line = 0;
|
||||
|
||||
if (!log_has(LIFTOFF_DEBUG)) {
|
||||
return;
|
||||
}
|
||||
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, " type: ");
|
||||
if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
|
||||
liftoff_log(LIFTOFF_DEBUG, "Primary");
|
||||
} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
|
||||
liftoff_log(LIFTOFF_DEBUG, "Cursor");
|
||||
} else {
|
||||
liftoff_log(LIFTOFF_DEBUG, "Overlay");
|
||||
}
|
||||
liftoff_log(LIFTOFF_DEBUG, " zpos: %"PRIu32, plane->zpos);
|
||||
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, " props:");
|
||||
for (i = 0; i < plane->props_len; i++) {
|
||||
if (per_line == 5) {
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "\n ");
|
||||
per_line = 0;
|
||||
}
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, " %s", plane->props[i].name);
|
||||
per_line++;
|
||||
}
|
||||
liftoff_log_cnt(LIFTOFF_DEBUG, "\n");
|
||||
}
|
||||
|
||||
struct liftoff_plane *plane_create(struct liftoff_device *device, uint32_t id)
|
||||
{
|
||||
struct liftoff_plane *plane, *cur;
|
||||
|
@ -41,6 +72,8 @@ struct liftoff_plane *plane_create(struct liftoff_device *device, uint32_t id)
|
|||
uint64_t value;
|
||||
bool has_type = false, has_zpos = false;
|
||||
|
||||
liftoff_log(LIFTOFF_DEBUG, "Plane %"PRIu32, id);
|
||||
|
||||
plane = calloc(1, sizeof(*plane));
|
||||
if (plane == NULL) {
|
||||
liftoff_log_errno(LIFTOFF_ERROR, "calloc");
|
||||
|
@ -125,6 +158,8 @@ struct liftoff_plane *plane_create(struct liftoff_device *device, uint32_t id)
|
|||
}
|
||||
}
|
||||
|
||||
log_plane(plane);
|
||||
|
||||
return plane;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue