-
Notifications
You must be signed in to change notification settings - Fork 13
Decode HDR_OUTPUT_METADATA #53
base: master
Are you sure you want to change the base?
Conversation
This was essential in debugging some HDR enablement code I'm working on. In the pretty-print output, all fields are decoded to integers. If someone deems it useful, I could put in the extra work to show enum names and convert the fixed-point values to floats in the 0.0-1.0 range. Im the json output, I deliberately flattened the primaries to separate fields for the B, G and B components because I felt that the array notation is less redable.
NOTE: Squash this commit before merging.
struct json_object_iter iter; | ||
json_object_object_foreachC(arr, iter) { | ||
if (iter.val) { | ||
printf("%s%s\"%s\" = %"PRIu64"\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to manually print each field here. This would allow us to get human-readable output. Enums could be pretty-printed with the stringified enum name and its value (like we do for modifiers, but no need for code generation). Fields with X/Y values could be printed on a single line.
|
||
struct json_object *obj = json_object_new_object(); | ||
json_object_object_add(obj, "type", new_json_object_uint64(meta->metadata_type)); | ||
if (meta->metadata_type == 1 /*HDMI_STATIC_METADATA_TYPE1*/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we #define
this?
I'll just point out that I don't merge anything until any Linux and/or libdrm version it depends on is in at least Archlinux stable. |
Does this mean you want the copy of the struct to be deleted here and just use libdrm 2.4.104 instead? Do you have libdrm 2.4.104 where you want it yet? There are no other deps. |
drm_info pulls the latest libdrm with Meson subprojects automatically if it's not new enough. (drm_info always uses the system dynamic library for libdrm, but may pull recent kernel uapi headers from the subproject.) |
This was essential in debugging some HDR enablement code I'm working on.
In the pretty-print output, all fields are decoded to integers.
If someone deems it useful, I could put in the extra work to show enum
names and convert the fixed-point values to floats in the 0.0-1.0 range.
In the JSON output, I deliberately flattened the primaries to separate
fields for the B, G and B components because I felt that the array
notation is less readable.