Use PRIu32 for printing plane IDs

This commit is contained in:
Simon Ser 2019-09-13 19:43:01 +03:00
parent 5afeeb531a
commit a1e3798f6f
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -96,7 +96,8 @@ static struct liftoff_plane *plane_create(struct liftoff_display *display,
drmModeFreeObjectProperties(drm_props); drmModeFreeObjectProperties(drm_props);
if (!has_type) { if (!has_type) {
fprintf(stderr, "plane %d is missing the 'type' property\n", fprintf(stderr,
"plane %"PRIu32" is missing the 'type' property\n",
plane->id); plane->id);
free(plane); free(plane);
return NULL; return NULL;
@ -246,7 +247,8 @@ static bool plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer
if (layer == NULL) { if (layer == NULL) {
plane_prop = plane_get_property(plane, "FB_ID"); plane_prop = plane_get_property(plane, "FB_ID");
if (plane_prop == NULL) { if (plane_prop == NULL) {
fprintf(stderr, "plane is missing the FB_ID property\n"); fprintf(stderr, "plane %"PRIu32" is missing the FB_ID "
"property\n", plane->id);
return false; return false;
} }
return plane_set_prop(plane, req, plane_prop, 0); return plane_set_prop(plane, req, plane_prop, 0);
@ -254,7 +256,8 @@ static bool plane_apply(struct liftoff_plane *plane, struct liftoff_layer *layer
plane_prop = plane_get_property(plane, "CRTC_ID"); plane_prop = plane_get_property(plane, "CRTC_ID");
if (plane_prop == NULL) { if (plane_prop == NULL) {
fprintf(stderr, "plane is missing the CRTC_ID property\n"); fprintf(stderr, "plane %"PRIu32" is missing the CRTC_ID "
"property\n", plane->id);
return false; return false;
} }
if (!plane_set_prop(plane, req, plane_prop, layer->output->crtc_id)) { if (!plane_set_prop(plane, req, plane_prop, layer->output->crtc_id)) {
@ -304,8 +307,8 @@ struct plane_data {
int last_plane_zpos, last_layer_zpos; int last_plane_zpos, last_layer_zpos;
}; };
bool output_choose_layers(struct liftoff_output *output, struct plane_alloc *alloc, bool output_choose_layers(struct liftoff_output *output,
struct plane_data *data) struct plane_alloc *alloc, struct plane_data *data)
{ {
struct liftoff_display *display; struct liftoff_display *display;
struct liftoff_plane *plane; struct liftoff_plane *plane;
@ -350,7 +353,7 @@ bool output_choose_layers(struct liftoff_output *output, struct plane_alloc *all
goto skip; goto skip;
} }
fprintf(stderr, "Performing allocation for plane %d (%zu/%zu)\n", fprintf(stderr, "Performing allocation for plane %"PRIu32" (%zu/%zu)\n",
plane->id, data->plane_idx + 1, alloc->planes_len); plane->id, data->plane_idx + 1, alloc->planes_len);
liftoff_list_for_each(layer, &output->layers, link) { liftoff_list_for_each(layer, &output->layers, link) {
@ -376,7 +379,7 @@ bool output_choose_layers(struct liftoff_output *output, struct plane_alloc *all
/* This layer needs to be on top of the last /* This layer needs to be on top of the last
* allocated one */ * allocated one */
/* TODO: don't skip if they don't intersect? */ /* TODO: don't skip if they don't intersect? */
fprintf(stderr, "Layer %p -> plane %d: " fprintf(stderr, "Layer %p -> plane %"PRIu32": "
"layer zpos invalid\n", "layer zpos invalid\n",
(void *)layer, plane->id); (void *)layer, plane->id);
continue; continue;
@ -387,7 +390,7 @@ bool output_choose_layers(struct liftoff_output *output, struct plane_alloc *all
* allocated one, but this plane isn't under the * allocated one, but this plane isn't under the
* last one. This */ * last one. This */
/* TODO: don't skip if they don't intersect? */ /* TODO: don't skip if they don't intersect? */
fprintf(stderr, "Layer %p -> plane %d: " fprintf(stderr, "Layer %p -> plane %"PRIu32": "
"plane zpos invalid\n", "plane zpos invalid\n",
(void *)layer, plane->id); (void *)layer, plane->id);
continue; continue;
@ -395,22 +398,23 @@ bool output_choose_layers(struct liftoff_output *output, struct plane_alloc *all
} }
/* Try to use this layer for the current plane */ /* Try to use this layer for the current plane */
fprintf(stderr, "Layer %p -> plane %d: applying properties...\n", fprintf(stderr, "Layer %p -> plane %"PRIu32": "
(void *)layer, plane->id); "applying properties...\n", (void *)layer, plane->id);
data->alloc[data->plane_idx] = layer; data->alloc[data->plane_idx] = layer;
if (!plane_apply(plane, layer, alloc->req, &compatible)) { if (!plane_apply(plane, layer, alloc->req, &compatible)) {
return false; return false;
} }
if (!compatible) { if (!compatible) {
fprintf(stderr, "Layer %p -> plane %d: incompatible " fprintf(stderr, "Layer %p -> plane %"PRIu32": "
"properties\n", (void *)layer, plane->id); "incompatible properties\n",
(void *)layer, plane->id);
continue; continue;
} }
ret = drmModeAtomicCommit(display->drm_fd, alloc->req, ret = drmModeAtomicCommit(display->drm_fd, alloc->req,
DRM_MODE_ATOMIC_TEST_ONLY, NULL); DRM_MODE_ATOMIC_TEST_ONLY, NULL);
if (ret == 0) { if (ret == 0) {
fprintf(stderr, "Layer %p -> plane %d: success\n", fprintf(stderr, "Layer %p -> plane %"PRIu32": success\n",
(void *)layer, plane->id); (void *)layer, plane->id);
/* Continue with the next plane */ /* Continue with the next plane */
next_data.score = data->score + 1; next_data.score = data->score + 1;