Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package drm_info for openSUSE:Factory checked in at 2023-03-22 22:31:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/drm_info (Old) and /work/SRC/openSUSE:Factory/.drm_info.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "drm_info" Wed Mar 22 22:31:03 2023 rev:3 rq:1073687 version:2.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/drm_info/drm_info.changes 2023-01-23 18:32:20.804219273 +0100 +++ /work/SRC/openSUSE:Factory/.drm_info.new.31432/drm_info.changes 2023-03-22 22:31:49.574550745 +0100 @@ -1,0 +2,18 @@ +Tue Mar 21 15:48:26 UTC 2023 - Michael Vetter <[email protected]> + +- Update to 2.5.0: + * Find drm_fourcc.h in sysroot + * build: bump libdrm to 2.4.114 + * ci: add .gitlab-ci.yml + * build: fix "Unknown statement" error + * build: fix "Unknown statement" for real + * Consistently use lower-case "unknown" as fallback value + * Add device bus info + * Add support for Vivante modifiers + * Add support for printing AMD GFX11 modifiers + * Fix AMD tile for GFX11 modifiers + * build: add workaround for include_directories() sandbox + * build: bump version to 2.5.0 + * Decode HDR_OUTPUT_METADATA + +------------------------------------------------------------------- Old: ---- drm_info-2.4.0.tar.gz New: ---- drm_info-2.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ drm_info.spec ++++++ --- /var/tmp/diff_new_pack.hRLytB/_old 2023-03-22 22:31:49.946552616 +0100 +++ /var/tmp/diff_new_pack.hRLytB/_new 2023-03-22 22:31:49.950552637 +0100 @@ -17,7 +17,7 @@ Name: drm_info -Version: 2.4.0 +Version: 2.5.0 Release: 0 Summary: Small utility to dump info about DRM devices License: MIT ++++++ drm_info-2.4.0.tar.gz -> drm_info-2.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/.gitlab-ci.yml new/drm_info-v2.5.0/.gitlab-ci.yml --- old/drm_info-v2.4.0/.gitlab-ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/drm_info-v2.5.0/.gitlab-ci.yml 2023-02-09 14:11:50.000000000 +0100 @@ -0,0 +1 @@ +include: https://git.sr.ht/~emersion/dalligi/blob/master/templates/single.yml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/drm_info.h new/drm_info-v2.5.0/drm_info.h --- old/drm_info-v2.4.0/drm_info.h 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/drm_info.h 2023-02-09 14:11:50.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/fourcc.py new/drm_info-v2.5.0/fourcc.py --- old/drm_info-v2.4.0/fourcc.py 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/fourcc.py 2023-02-09 14:11:50.000000000 +0100 @@ -37,7 +37,7 @@ f.write('''\ default: - return "Unknown"; + return "unknown"; } } @@ -51,7 +51,7 @@ f.write('''\ default: - return "Unknown"; + return "unknown"; } } ''') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/json.c new/drm_info-v2.5.0/json.c --- old/drm_info-v2.4.0/json.c 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/json.c 2023-02-09 14:11:50.000000000 +0100 @@ -15,6 +15,7 @@ #include <xf86drmMode.h> #include "drm_info.h" +#include "tables.h" static const struct { const char *name; @@ -129,39 +130,66 @@ 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; 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(); struct json_object *compatible_arr = json_object_new_array(); - for (size_t i = 0; platform->compatible[i]; ++i) + for (size_t i = 0; platform_dev->compatible[i]; ++i) json_object_array_add(compatible_arr, - json_object_new_string(platform->compatible[i])); + 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; } json_object_object_add(obj, "device_data", device_data_obj); + json_object_object_add(obj, "bus_data", bus_data_obj); drmFreeDevice(&dev); @@ -288,6 +316,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 +547,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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/meson.build new/drm_info-v2.5.0/meson.build --- old/drm_info-v2.4.0/meson.build 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/meson.build 2023-02-09 14:11:50.000000000 +0100 @@ -1,5 +1,5 @@ project('drm_info', 'c', - version: '2.4.0', + version: '2.5.0', license: 'MIT', meson_version: '>=0.49.0', default_options: [ @@ -34,14 +34,13 @@ ], ) -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 @@ -55,13 +54,15 @@ 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 = meson.current_source_dir() / 'subprojects/libdrm/include/drm/drm_fourcc.h' - inc += include_directories('subprojects/libdrm/include/drm') + add_project_arguments('-I' + meson.current_source_dir() / 'subprojects/libdrm/include/drm', 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 +81,6 @@ executable('drm_info', ['main.c', 'modifiers.c', 'json.c', 'pretty.c', tables_c], - include_directories: inc, dependencies: [libdrm, libpci, jsonc], install: true, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/modifiers.c new/drm_info-v2.5.0/modifiers.c --- old/drm_info-v2.4.0/modifiers.c 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/modifiers.c 2023-02-09 14:11:50.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/pretty.c new/drm_info-v2.5.0/pretty.c --- old/drm_info-v2.4.0/pretty.c 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/pretty.c 2023-02-09 14:11:50.000000000 +0100 @@ -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"); @@ -367,6 +377,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 +587,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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/drm_info-v2.4.0/subprojects/libdrm.wrap new/drm_info-v2.5.0/subprojects/libdrm.wrap --- old/drm_info-v2.4.0/subprojects/libdrm.wrap 2022-10-07 10:25:44.000000000 +0200 +++ new/drm_info-v2.5.0/subprojects/libdrm.wrap 2023-02-09 14:11:50.000000000 +0100 @@ -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
