Improve prop value pretty-printing in output_log_layers

Always print the sign when logging a signed value. Print the
full floating point value when logging an fp16 prop. SRC_X amd
SRC_Y are fp16 too.
This commit is contained in:
Simon Ser 2021-08-09 12:48:30 +02:00
parent 6321e7c5aa
commit 7f07d398d1

View file

@ -68,6 +68,10 @@ bool liftoff_output_needs_composition(struct liftoff_output *output)
return false; return false;
} }
double fp16_to_double(uint64_t val) {
return (double)(val >> 16) + (double)(val & 0xFFFF) / 0xFFFF;
}
void output_log_layers(struct liftoff_output *output) { void output_log_layers(struct liftoff_output *output) {
struct liftoff_layer *layer; struct liftoff_layer *layer;
size_t i; size_t i;
@ -98,12 +102,14 @@ void output_log_layers(struct liftoff_output *output) {
if (strcmp(name, "CRTC_X") == 0 || if (strcmp(name, "CRTC_X") == 0 ||
strcmp(name, "CRTC_Y") == 0) { strcmp(name, "CRTC_Y") == 0) {
liftoff_log(LIFTOFF_DEBUG, " %s = %"PRIi32, liftoff_log(LIFTOFF_DEBUG, " %s = %+"PRIi32,
name, (int32_t)value); name, (int32_t)value);
} else if (strcmp(name, "SRC_W") == 0 || } else if (strcmp(name, "SRC_X") == 0 ||
strcmp(name, "SRC_Y") == 0 ||
strcmp(name, "SRC_W") == 0 ||
strcmp(name, "SRC_H") == 0) { strcmp(name, "SRC_H") == 0) {
liftoff_log(LIFTOFF_DEBUG, " %s = %"PRIu64, liftoff_log(LIFTOFF_DEBUG, " %s = %f",
name, value >> 16); name, fp16_to_double(value));
} else { } else {
liftoff_log(LIFTOFF_DEBUG, " %s = %"PRIu64, liftoff_log(LIFTOFF_DEBUG, " %s = %"PRIu64,
name, value); name, value);