diff -Nru drm-info-2.4.0/.gitlab-ci.yml drm-info-2.6.0/.gitlab-ci.yml --- drm-info-2.4.0/.gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ drm-info-2.6.0/.gitlab-ci.yml 2024-01-28 14:37:43.000000000 +0000 @@ -0,0 +1 @@ +include: https://git.sr.ht/~emersion/dalligi/blob/master/templates/single.yml diff -Nru drm-info-2.4.0/README.md drm-info-2.6.0/README.md --- drm-info-2.4.0/README.md 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/README.md 2024-01-28 14:37:43.000000000 +0000 @@ -4,30 +4,25 @@ Small utility to dump info about DRM devices. +## Building + Requires libdrm and json-c. -## Building +Build with: -Build with -``` -meson build -cd build -ninja -sudo ninja install -``` + meson setup build/ + ninja -C build/ If you don't have the minimum json-c version (0.13.0), meson will automatically download and compile it for you. If you don't want this, run the first meson -command with -``` -meson build --wrap-mode nofallback -``` +command with: + + meson setup build/ --wrap-mode=nofallback ## Usage -``` -drm_info [-j] [--] [path]... -``` + drm_info [-j] [--] [path]... + - `-j` - Output info in JSON. Otherwise the output is pretty-printed. - `path` - Zero or more paths to a DRM device to print info about, e.g. `/dev/dri/card0`. If no paths are given, all devices found in @@ -42,9 +37,7 @@ Please help us gather more data! You can do so by uploading DRM information from your GPU. -``` -drm_info -j | curl -d @- https://drmdb.emersion.fr/submit -``` + drm_info -j | curl -d @- https://drmdb.emersion.fr/submit This will upload information about your GPUs, your GPU drivers and your screens. diff -Nru drm-info-2.4.0/debian/changelog drm-info-2.6.0/debian/changelog --- drm-info-2.4.0/debian/changelog 2022-12-27 21:07:29.000000000 +0000 +++ drm-info-2.6.0/debian/changelog 2024-01-28 14:38:11.000000000 +0000 @@ -1,3 +1,11 @@ +drm-info (2.6.0-1) unstable; urgency=medium + + * New upstream version 2.6.0 + * d/copyright: bump years + * d/control: bump standards version to 4.6.2 (no changes needed) + + -- Birger Schacht Sun, 28 Jan 2024 15:38:11 +0100 + drm-info (2.4.0-1) unstable; urgency=medium * Update d/watch to new upstream repository at freedesktop.org diff -Nru drm-info-2.4.0/debian/control drm-info-2.6.0/debian/control --- drm-info-2.4.0/debian/control 2022-12-27 21:07:29.000000000 +0000 +++ drm-info-2.6.0/debian/control 2024-01-28 14:38:11.000000000 +0000 @@ -14,7 +14,7 @@ pkg-config, python3-distutils, scdoc, -Standards-Version: 4.6.1.0 +Standards-Version: 4.6.2 Homepage: https://gitlab.freedesktop.org/emersion/drm_info Vcs-Browser: https://salsa.debian.org/swaywm-team/drm-info Vcs-Git: https://salsa.debian.org/swaywm-team/drm-info.git diff -Nru drm-info-2.4.0/debian/copyright drm-info-2.6.0/debian/copyright --- drm-info-2.4.0/debian/copyright 2022-12-27 21:07:29.000000000 +0000 +++ drm-info-2.6.0/debian/copyright 2024-01-28 14:38:11.000000000 +0000 @@ -9,7 +9,7 @@ Files: debian/* Copyright: 2020 Evangelos Ribeiro Tzaras , - 2022 Birger Schacht + 2022-2024 Birger Schacht License: MIT License: MIT diff -Nru drm-info-2.4.0/drm_info.h drm-info-2.6.0/drm_info.h --- drm-info-2.4.0/drm_info.h 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/drm_info.h 2024-01-28 14:37:43.000000000 +0000 @@ -6,4 +6,16 @@ struct json_object *drm_info(char *paths[]); void print_drm(struct json_object *obj); +/* according to CTA 861.G */ +enum { + HDMI_STATIC_METADATA_TYPE1 = 0 +}; + +enum { + CTA_EOTF_TRADITIONAL_SDR = 0, + CTA_EOTF_TRADITIONAL_HDR, + CTA_EOTF_SMPTE_2084, + CTA_EOTF_HLG +}; + #endif diff -Nru drm-info-2.4.0/fourcc.py drm-info-2.6.0/fourcc.py --- drm-info-2.4.0/fourcc.py 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/fourcc.py 2024-01-28 14:37:43.000000000 +0000 @@ -37,7 +37,7 @@ f.write('''\ default: - return "Unknown"; + return "unknown"; } } @@ -51,7 +51,7 @@ f.write('''\ default: - return "Unknown"; + return "unknown"; } } ''') diff -Nru drm-info-2.4.0/json.c drm-info-2.6.0/json.c --- drm-info-2.4.0/json.c 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/json.c 2024-01-28 14:37:43.000000000 +0000 @@ -15,6 +15,7 @@ #include #include "drm_info.h" +#include "tables.h" static const struct { const char *name; @@ -47,6 +48,39 @@ { "SYNCOBJ_TIMELINE", DRM_CAP_SYNCOBJ_TIMELINE }, }; +static struct json_object *tainted_info(void) +{ +#ifndef __linux__ + return NULL; +#endif + + FILE *f = fopen("/proc/sys/kernel/tainted", "r"); + if (f == NULL) { + perror("fopen(/proc/sys/kernel/tainted)"); + return NULL; + } + + char str[64]; + size_t n = fread(str, 1, sizeof(str) - 1, f); + if (!feof(f)) { + fclose(f); + fprintf(stderr, "fread(/proc/sys/kernel/tainted) failed"); + return NULL; + } + str[n] = '\0'; + + fclose(f); + + errno = 0; + unsigned long tainted = strtoull(str, NULL, 10); + if (errno != 0) { + perror("strtoull"); + return NULL; + } + + return json_object_new_uint64(tainted); +} + static struct json_object *kernel_info(void) { struct utsname utsname; @@ -62,6 +96,7 @@ json_object_new_string(utsname.release)); json_object_object_add(obj, "version", json_object_new_string(utsname.version)); + json_object_object_add(obj, "tainted", tainted_info()); return obj; } @@ -129,39 +164,82 @@ json_object_object_add(obj, "bus_type", json_object_new_uint64(dev->bustype)); - struct json_object *device_data_obj = NULL; + struct json_object *device_data_obj = NULL, *bus_data_obj = NULL; + struct json_object *compatible_arr = NULL; switch (dev->bustype) { case DRM_BUS_PCI:; - drmPciDeviceInfo *pci = dev->deviceinfo.pci; + drmPciDeviceInfo *pci_dev = dev->deviceinfo.pci; + drmPciBusInfo *pci_bus = dev->businfo.pci; + device_data_obj = json_object_new_object(); json_object_object_add(device_data_obj, "vendor", - json_object_new_uint64(pci->vendor_id)); + json_object_new_uint64(pci_dev->vendor_id)); json_object_object_add(device_data_obj, "device", - json_object_new_uint64(pci->device_id)); + json_object_new_uint64(pci_dev->device_id)); json_object_object_add(device_data_obj, "subsystem_vendor", - json_object_new_uint64(pci->subvendor_id)); + json_object_new_uint64(pci_dev->subvendor_id)); json_object_object_add(device_data_obj, "subsystem_device", - json_object_new_uint64(pci->subdevice_id)); + json_object_new_uint64(pci_dev->subdevice_id)); + + bus_data_obj = json_object_new_object(); + json_object_object_add(bus_data_obj, "domain", + json_object_new_uint64(pci_bus->domain)); + json_object_object_add(bus_data_obj, "bus", + json_object_new_uint64(pci_bus->bus)); + json_object_object_add(bus_data_obj, "slot", + json_object_new_uint64(pci_bus->dev)); + json_object_object_add(bus_data_obj, "function", + json_object_new_uint64(pci_bus->func)); break; case DRM_BUS_USB:; - drmUsbDeviceInfo *usb = dev->deviceinfo.usb; + drmUsbDeviceInfo *usb_dev = dev->deviceinfo.usb; + drmUsbBusInfo *usb_bus = dev->businfo.usb; + device_data_obj = json_object_new_object(); json_object_object_add(device_data_obj, "vendor", - json_object_new_uint64(usb->vendor)); + json_object_new_uint64(usb_dev->vendor)); json_object_object_add(device_data_obj, "product", - json_object_new_uint64(usb->product)); + json_object_new_uint64(usb_dev->product)); + + bus_data_obj = json_object_new_object(); + json_object_object_add(bus_data_obj, "bus", + json_object_new_uint64(usb_bus->bus)); + json_object_object_add(bus_data_obj, "device", + json_object_new_uint64(usb_bus->dev)); break; case DRM_BUS_PLATFORM:; - drmPlatformDeviceInfo *platform = dev->deviceinfo.platform; + drmPlatformDeviceInfo *platform_dev = dev->deviceinfo.platform; + drmPlatformBusInfo *platform_bus = dev->businfo.platform; + + device_data_obj = json_object_new_object(); + compatible_arr = json_object_new_array(); + for (size_t i = 0; platform_dev->compatible[i]; ++i) + json_object_array_add(compatible_arr, + json_object_new_string(platform_dev->compatible[i])); + json_object_object_add(device_data_obj, "compatible", compatible_arr); + + bus_data_obj = json_object_new_object(); + json_object_object_add(bus_data_obj, "fullname", + json_object_new_string(platform_bus->fullname)); + break; + case DRM_BUS_HOST1X:; + drmHost1xDeviceInfo *host1x_dev = dev->deviceinfo.host1x; + drmHost1xBusInfo *host1x_bus = dev->businfo.host1x; + device_data_obj = json_object_new_object(); - struct json_object *compatible_arr = json_object_new_array(); - for (size_t i = 0; platform->compatible[i]; ++i) + compatible_arr = json_object_new_array(); + for (size_t i = 0; host1x_dev->compatible[i]; ++i) json_object_array_add(compatible_arr, - json_object_new_string(platform->compatible[i])); + json_object_new_string(host1x_dev->compatible[i])); json_object_object_add(device_data_obj, "compatible", compatible_arr); + + bus_data_obj = json_object_new_object(); + json_object_object_add(bus_data_obj, "fullname", + json_object_new_string(host1x_bus->fullname)); break; } json_object_object_add(obj, "device_data", device_data_obj); + json_object_object_add(obj, "bus_data", bus_data_obj); drmFreeDevice(&dev); @@ -288,6 +366,69 @@ return obj; } +static struct json_object *hdr_output_metadata_info(int fd, uint32_t blob_id) +{ + drmModePropertyBlobRes *blob = drmModeGetPropertyBlob(fd, blob_id); + if (!blob) { + perror("drmModeGetPropertyBlob"); + return NULL; + } + + struct json_object *obj = NULL; + + // The type field in the struct comes first and is an u32 + if (blob->length < sizeof(uint32_t)) { + fprintf(stderr, "HDR output metadata blob too short\n"); + goto exit; + } + + const struct hdr_output_metadata *meta = blob->data; + + obj = json_object_new_object(); + json_object_object_add(obj, "type", json_object_new_uint64(meta->metadata_type)); + + if (meta->metadata_type == HDMI_STATIC_METADATA_TYPE1) { + const size_t min_size = offsetof(struct hdr_output_metadata, hdmi_metadata_type1) + + sizeof(struct hdr_metadata_infoframe); + if (blob->length < min_size) { + fprintf(stderr, "HDR output metadata blob too short\n"); + goto exit; + } + + const struct hdr_metadata_infoframe *info = &meta->hdmi_metadata_type1; + json_object_object_add(obj, "eotf", json_object_new_int(info->eotf)); + // TODO: maybe add info->metadata_type, but seems to be the same as + // meta->metadata_type? + struct json_object *dp_obj = json_object_new_object(); + static const char *dp_keys[] = {"r", "g", "b"}; + for (size_t i = 0; i < 3; i++) { + struct json_object *coord_obj = json_object_new_object(); + json_object_object_add(coord_obj, "x", + json_object_new_double(info->display_primaries[i].x / 50000.0)); + json_object_object_add(coord_obj, "y", + json_object_new_double(info->display_primaries[i].y / 50000.0)); + json_object_object_add(dp_obj, dp_keys[i], coord_obj); + } + json_object_object_add(obj, "display_primaries", dp_obj); + struct json_object *coord_obj = json_object_new_object(); + json_object_object_add(coord_obj, "x", + json_object_new_double(info->white_point.x / 50000.0)); + json_object_object_add(coord_obj, "y", + json_object_new_double(info->white_point.y / 50000.0)); + json_object_object_add(obj, "white_point", coord_obj); + json_object_object_add(obj, "max_display_mastering_luminance", + json_object_new_int(info->max_display_mastering_luminance)); + json_object_object_add(obj, "min_display_mastering_luminance", + json_object_new_double(info->min_display_mastering_luminance / 10000.0)); + json_object_object_add(obj, "max_cll", json_object_new_int(info->max_cll)); + json_object_object_add(obj, "max_fall", json_object_new_int(info->max_fall)); + } + +exit: + drmModeFreePropertyBlob(blob); + return obj; +} + static struct json_object *fb_info(int fd, uint32_t id) { #ifdef HAVE_GETFB2 @@ -456,6 +597,8 @@ data_obj = writeback_pixel_formats_info(fd, value); } else if (strcmp(prop->name, "PATH") == 0) { data_obj = path_info(fd, value); + } else if (strcmp(prop->name, "HDR_OUTPUT_METADATA") == 0) { + data_obj = hdr_output_metadata_info(fd, value); } break; case DRM_MODE_PROP_RANGE: diff -Nru drm-info-2.4.0/meson.build drm-info-2.6.0/meson.build --- drm-info-2.4.0/meson.build 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/meson.build 2024-01-28 14:37:43.000000000 +0000 @@ -1,5 +1,5 @@ project('drm_info', 'c', - version: '2.4.0', + version: '2.6.0', license: 'MIT', meson_version: '>=0.49.0', default_options: [ @@ -34,34 +34,42 @@ ], ) -inc = [] # libdrm pretty consistently pulls in the linux userspace API headers. # We want a new libdrm to get all of the #defines in those headers, but # we don't actually need to link against a new version of libdrm itself. # # We need to make sure we don't use any new libdrm functions, but those # are added very infrequently, so this is unlikely to be an issue. -if libdrm.version().version_compare('<2.4.113') +if libdrm.version().version_compare('<2.4.115') if libdrm.type_name() == 'internal' error('libdrm subproject out of date. Run `meson subprojects update`.') endif - msg = [ - 'System libdrm version does not have latest Linux DRM headers.', - 'Attempting to use headers from meson subproject if present.', - 'If this fails, update your system libdrm or run `meson subprojects download`.', - ] - foreach s : msg - warning(s) - endforeach + # Sadly we need to circumvent Meson's sandbox here. There is no other way to + # link to the system libdrm *and* use drm_fourcc.h from the subproject. + fourcc_h_dir = meson.current_source_dir() / 'subprojects/libdrm/include/drm' + fourcc_h = fourcc_h_dir / 'drm_fourcc.h' + + if meson.version().version_compare('>= 0.53.0') + fs = import('fs') + if not fs.exists(fourcc_h) + error( + 'System libdrm version does not have latest Linux DRM headers. ' + + 'Update your system libdrm or run `meson subprojects download`.' + ) + endif + else + warning('System libdrm version does not have latest Linux DRM headers.') + warning('Attempting to use headers from meson subproject if present.') + warning('If this fails, update your system libdrm or run `meson subprojects download`.') + endif - fourcc_h = meson.current_source_dir() / 'subprojects/libdrm/include/drm/drm_fourcc.h' - inc += include_directories('subprojects/libdrm/include/drm') + add_project_arguments('-I' + fourcc_h_dir, language: 'c') libdrm = libdrm.partial_dependency(link_args: true) elif libdrm.type_name() == 'internal' fourcc_h = meson.current_source_dir() / 'subprojects/libdrm/include/drm/drm_fourcc.h' else - fourcc_h = libdrm.get_pkgconfig_variable('includedir') / 'libdrm/drm_fourcc.h' + fourcc_h = libdrm.get_pkgconfig_variable('pc_sysrootdir') + libdrm.get_pkgconfig_variable('includedir') / 'libdrm/drm_fourcc.h' endif if libpci.found() @@ -80,7 +88,6 @@ executable('drm_info', ['main.c', 'modifiers.c', 'json.c', 'pretty.c', tables_c], - include_directories: inc, dependencies: [libdrm, libpci, jsonc], install: true, ) diff -Nru drm-info-2.4.0/modifiers.c drm-info-2.6.0/modifiers.c --- drm-info-2.4.0/modifiers.c 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/modifiers.c 2024-01-28 14:37:43.000000000 +0000 @@ -30,12 +30,16 @@ return "GFX10"; case AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS: return "GFX10_RBPLUS"; + case AMD_FMT_MOD_TILE_VER_GFX11: + return "GFX11"; } - return "Unknown"; + return "unknown"; } static const char *amd_tile_str(uint64_t tile, uint64_t tile_version) { switch (tile_version) { + case AMD_FMT_MOD_TILE_VER_GFX11: + /* fallthrough */ case AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS: /* fallthrough */ case AMD_FMT_MOD_TILE_VER_GFX10: @@ -52,9 +56,11 @@ return "GFX9_64K_D_X"; case AMD_FMT_MOD_TILE_GFX9_64K_R_X: return "GFX9_64K_R_X"; + case AMD_FMT_MOD_TILE_GFX11_256K_R_X: + return "GFX11_256K_R_X"; } } - return "Unknown"; + return "unknown"; } static const char *amd_dcc_block_size_str(uint64_t size) { @@ -66,7 +72,7 @@ case AMD_FMT_MOD_DCC_BLOCK_256B: return "256B"; } - return "Unknown"; + return "unknown"; } static bool amd_gfx9_tile_is_x_t(uint64_t tile) { @@ -142,7 +148,7 @@ case AFBC_FORMAT_MOD_BLOCK_SIZE_32x8_64x4: return "32x8_64x4"; } - return "Unknown"; + return "unknown"; } static const char *arm_afrc_cu_size_str(uint64_t cu_size) { @@ -154,7 +160,7 @@ case AFRC_FORMAT_MOD_CU_SIZE_32: return "32"; } - return "Unknown"; + return "unknown"; } static void print_arm_modifier(uint64_t mod) { @@ -227,7 +233,7 @@ case AMLOGIC_FBC_LAYOUT_SCATTER: return "SCATTER"; } - return "Unknown"; + return "unknown"; } static void print_amlogic_modifier(uint64_t mod) { @@ -239,6 +245,59 @@ (options & AMLOGIC_FBC_OPTION_MEM_SAVING) ? "MEM_SAVING" : "0"); } +static const char *vivante_color_tiling_str(uint64_t tiling) { + switch (tiling) { + case 0: + return "LINEAR"; + case DRM_FORMAT_MOD_VIVANTE_TILED: + return "TILED"; + case DRM_FORMAT_MOD_VIVANTE_SUPER_TILED: + return "SUPER_TILED"; + case DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED: + return "SPLIT_TILED"; + case DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED: + return "SPLIT_SUPER_TILED"; + } + return "Unknown"; +} + +static const char *vivante_tile_status_str(uint64_t ts) { + switch (ts) { + case VIVANTE_MOD_TS_64_4: + return "64_4"; + case VIVANTE_MOD_TS_64_2: + return "64_2"; + case VIVANTE_MOD_TS_128_4: + return "128_4"; + case VIVANTE_MOD_TS_256_4: + return "256_4"; + } + return "Unknown"; +} + +static const char *vivante_compression_str(uint64_t comp) { + switch (comp) { + case VIVANTE_MOD_COMP_DEC400: + return "DEC400"; + } + return "Unknown"; +} + +static void print_vivante_modifier(uint64_t mod) { + uint64_t ts = mod & VIVANTE_MOD_TS_MASK; + uint64_t comp = mod & VIVANTE_MOD_COMP_MASK; + uint64_t tiling = mod & ~VIVANTE_MOD_EXT_MASK; + + printf("VIVANTE(tiling = %s", vivante_color_tiling_str(tiling)); + if (ts != 0) { + printf(", ts = %s", vivante_tile_status_str(ts)); + } + if (comp != 0) { + printf(", comp = %s", vivante_compression_str(comp)); + } + printf(")"); +} + static uint8_t mod_vendor(uint64_t mod) { return (uint8_t)(mod >> 56); } @@ -257,6 +316,9 @@ case DRM_FORMAT_MOD_VENDOR_AMLOGIC: print_amlogic_modifier(mod); break; + case DRM_FORMAT_MOD_VENDOR_VIVANTE: + print_vivante_modifier(mod); + break; default: printf("%s", basic_modifier_str(mod)); } diff -Nru drm-info-2.4.0/pretty.c drm-info-2.6.0/pretty.c --- drm-info-2.4.0/pretty.c 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/pretty.c 2024-01-28 14:37:43.000000000 +0000 @@ -40,6 +40,16 @@ return json_object_get_uint64(uint64_obj); } +static double get_object_object_double(struct json_object *obj, + const char *key) +{ + struct json_object *double_obj = json_object_object_get(obj, key); + if (!double_obj) { + return 0; + } + return json_object_get_double(double_obj); +} + static void print_driver(struct json_object *obj) { const char *name = get_object_object_string(obj, "name"); @@ -118,6 +128,7 @@ int available_nodes = get_object_object_uint64(obj, "available_nodes"); int bus_type = get_object_object_uint64(obj, "bus_type"); struct json_object *data_obj = json_object_object_get(obj, "device_data"); + struct json_object *compatible_arr = NULL; printf(L_VAL "Device: %s", bustype_str(bus_type)); switch (bus_type) { @@ -143,8 +154,14 @@ printf(" %04x:%04x", usb_vendor, usb_product); break; case DRM_BUS_PLATFORM:; - struct json_object *compatible_arr = - json_object_object_get(data_obj, "compatible"); + compatible_arr = json_object_object_get(data_obj, "compatible"); + for (size_t i = 0; i < json_object_array_length(compatible_arr); i++) { + printf(" %s", json_object_get_string( + json_object_array_get_idx(compatible_arr, i))); + } + break; + case DRM_BUS_HOST1X:; + compatible_arr = json_object_object_get(data_obj, "compatible"); for (size_t i = 0; i < json_object_array_length(compatible_arr); i++) { printf(" %s", json_object_get_string( json_object_array_get_idx(compatible_arr, i))); @@ -158,7 +175,7 @@ printf("\n"); } -// The refresh rate provided by the mode itself is innacurate, +// The refresh rate provided by the mode itself is inaccurate, // so we calculate it ourself. static int32_t refresh_rate(struct json_object *obj) { int clock = get_object_object_uint64(obj, "clock"); @@ -367,6 +384,66 @@ printf("%s" L_LAST "%s\n", prefix, json_object_get_string(obj)); } +static void print_hdr_output_metadata(struct json_object *obj, + const char *prefix) +{ + int type = get_object_object_uint64(obj, "type"); + + if (type != HDMI_STATIC_METADATA_TYPE1) { + printf("%s" L_LAST "Type: Reserved (%d)\n", prefix, type); + return; + } + printf("%s" L_VAL "Type: Static Metadata Type 1\n", prefix); + + int eotf = get_object_object_uint64(obj, "eotf"); + printf("%s" L_VAL "EOTF: ", prefix); + switch (eotf) { + case CTA_EOTF_TRADITIONAL_SDR: + printf("Traditional gamma - SDR"); + break; + case CTA_EOTF_TRADITIONAL_HDR: + printf("Traditional gamma - HDR"); + break; + case CTA_EOTF_SMPTE_2084: + printf("SMPTE ST 2084 (PQ)"); + break; + case CTA_EOTF_HLG: + printf("HLG"); + break; + default: + printf("Reserved (%d)", eotf); + break; + } + printf("\n"); + + struct json_object *dp_obj = json_object_object_get(obj, "display_primaries"); + static const char *dp_keys[] = {"r", "g", "b"}; + static const char *dp_names[] = {"Red", "Green", "Blue"}; + printf("%s" L_VAL "Display primaries:\n", prefix); + for (size_t i = 0; i < 3; i++) { + struct json_object *coord_obj = json_object_object_get(dp_obj, dp_keys[i]); + printf("%s" L_LINE "%s%s: ", prefix, i == 2 ? L_LAST : L_VAL, dp_names[i]); + printf("(%.4f, %.4f)\n", + get_object_object_double(coord_obj, "x"), + get_object_object_double(coord_obj, "y")); + } + + struct json_object *wp_obj = json_object_object_get(obj, "white_point"); + printf("%s" L_VAL "White point: ", prefix); + printf("(%.4f, %.4f)\n", + get_object_object_double(wp_obj, "x"), + get_object_object_double(wp_obj, "y")); + + printf("%s" L_VAL "Max display mastering luminance: %d cd/m²\n", prefix, + (int) get_object_object_uint64(obj, "max_display_mastering_luminance")); + printf("%s" L_VAL "Min display mastering luminance: %.4f cd/m²\n", prefix, + get_object_object_double(obj, "min_display_mastering_luminance")); + printf("%s" L_VAL "Max content light level: %d cd/m²\n", prefix, + (int) get_object_object_uint64(obj, "max_cll")); + printf("%s" L_LAST "Max frame average light level: %d cd/m²\n", prefix, + (int) get_object_object_uint64(obj, "max_fall")); +} + static void print_fb(struct json_object *obj, const char *prefix) { uint32_t id = get_object_object_uint64(obj, "id"); @@ -517,6 +594,8 @@ print_writeback_pixel_formats(data_obj, sub_prefix); else if (strcmp(prop_name, "PATH") == 0) print_path(data_obj, sub_prefix); + else if (strcmp(prop_name, "HDR_OUTPUT_METADATA") == 0) + print_hdr_output_metadata(data_obj, sub_prefix); break; case DRM_MODE_PROP_BITMASK: printf("bitmask {"); diff -Nru drm-info-2.4.0/subprojects/libdrm.wrap drm-info-2.6.0/subprojects/libdrm.wrap --- drm-info-2.4.0/subprojects/libdrm.wrap 2022-12-27 20:42:26.000000000 +0000 +++ drm-info-2.6.0/subprojects/libdrm.wrap 2024-01-28 14:37:43.000000000 +0000 @@ -1,4 +1,4 @@ [wrap-git] url = https://gitlab.freedesktop.org/mesa/drm.git -revision = libdrm-2.4.113 +revision = libdrm-2.4.115 depth = 1