STRUCT DRM_MODE_CONFIG(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ‘‘ struct drm_mode_config โ€” Mode configuration control structure โœจ

okay bestie so this is from the Kernel API Manual, section 9, and it's genuinely the main character of KMS mode configuration. buckle up ๐Ÿ’–


๐ŸŒธ NAME

struct drm_mode_config โ€” the mode configuration control structure. that's it, that's the vibe. it's the big boss struct that holds all ur display mode setting state ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS

struct drm_mode_config {
    struct mutex mutex;
    struct drm_modeset_lock connection_mutex;
    struct drm_modeset_acquire_ctx *acquire_ctx;
    struct mutex idr_mutex;
    struct idr object_idr;
    struct idr tile_idr;
    struct mutex fb_lock;
    int num_fb;
    struct list_head fb_list;
    spinlock_t connector_list_lock;
    int num_connector;
    struct ida connector_ida;
    struct list_head connector_list;
    struct llist_head connector_free_list;
    struct work_struct connector_free_work;
    int num_encoder;
    struct list_head encoder_list;
    int num_total_plane;
    struct list_head plane_list;
    struct raw_spinlock panic_lock;
    int num_colorop;
    struct list_head colorop_list;
    int num_crtc;
    struct list_head crtc_list;
    struct list_head property_list;
    struct list_head privobj_list;
    unsigned int min_width, min_height;
    unsigned int max_width, max_height;
    const struct drm_mode_config_funcs *funcs;
    bool poll_enabled;
    bool poll_running;
    bool delayed_event;
    struct delayed_work output_poll_work;
    struct mutex blob_lock;
    struct list_head property_blob_list;
    struct drm_property *edid_property;
    struct drm_property *dpms_property;
    struct drm_property *path_property;
    struct drm_property *tile_property;
    struct drm_property *panel_type_property;
    struct drm_property *link_status_property;
    struct drm_property *plane_type_property;
    struct drm_property *prop_src_x;
    struct drm_property *prop_src_y;
    struct drm_property *prop_src_w;
    struct drm_property *prop_src_h;
    struct drm_property *prop_crtc_x;
    struct drm_property *prop_crtc_y;
    struct drm_property *prop_crtc_w;
    struct drm_property *prop_crtc_h;
    struct drm_property *prop_fb_id;
    struct drm_property *prop_in_fence_fd;
    struct drm_property *prop_out_fence_ptr;
    struct drm_property *prop_crtc_id;
    struct drm_property *prop_fb_damage_clips;
    struct drm_property *prop_active;
    struct drm_property *prop_mode_id;
    struct drm_property *prop_vrr_enabled;
    struct drm_property *dvi_i_subconnector_property;
    struct drm_property *dvi_i_select_subconnector_property;
    struct drm_property *dp_subconnector_property;
    struct drm_property *tv_subconnector_property;
    struct drm_property *tv_select_subconnector_property;
    struct drm_property *legacy_tv_mode_property;
    struct drm_property *tv_mode_property;
    struct drm_property *tv_left_margin_property;
    struct drm_property *tv_right_margin_property;
    struct drm_property *tv_top_margin_property;
    struct drm_property *tv_bottom_margin_property;
    struct drm_property *tv_brightness_property;
    struct drm_property *tv_contrast_property;
    struct drm_property *tv_flicker_reduction_property;
    struct drm_property *tv_overscan_property;
    struct drm_property *tv_saturation_property;
    struct drm_property *tv_hue_property;
    struct drm_property *scaling_mode_property;
    struct drm_property *aspect_ratio_property;
    struct drm_property *content_type_property;
    struct drm_property *degamma_lut_property;
    struct drm_property *degamma_lut_size_property;
    struct drm_property *ctm_property;
    struct drm_property *gamma_lut_property;
    struct drm_property *gamma_lut_size_property;
    struct drm_property *background_color_property;
    struct drm_property *suggested_x_property;
    struct drm_property *suggested_y_property;
    struct drm_property *non_desktop_property;
    struct drm_property *panel_orientation_property;
    struct drm_property *writeback_fb_id_property;
    struct drm_property *writeback_pixel_formats_property;
    struct drm_property *writeback_out_fence_ptr_property;
    struct drm_property *hdr_output_metadata_property;
    struct drm_property *content_protection_property;
    struct drm_property *hdcp_content_type_property;
    uint32_t preferred_depth, prefer_shadow;
    bool quirk_addfb_prefer_xbgr_30bpp;
    bool quirk_addfb_prefer_host_byte_order;
    bool async_page_flip;
    bool fb_modifiers_not_supported;
    bool normalize_zpos;
    struct drm_property *modifiers_property;
    struct drm_property *async_modifiers_property;
    struct drm_property *size_hints_property;
    uint32_t cursor_width, cursor_height;
    struct drm_atomic_commit *suspend_state;
    const struct drm_mode_config_helper_funcs *helper_private;
};

๐Ÿ’– Members

okay so every single one of these, no skipping, we're doing the whole roster ๐Ÿซถ

  • mutex โ€” this one is literally the big scary modeset BKL ๐Ÿ’€ it protects everything that isn't protected otherwise. its scope is unclear and fuzzy, so likeโ€ฆ try to remove stuff from under its protection and move it into more well-scoped locks, k? the one important thing it does protect is the use of acquire_ctx. no cap.
  • connection_mutex โ€” protects connector state and the whole connector โ†’ encoder โ†’ CRTC routing chain. for atomic drivers specifically, this protects drm_connector.state. โœจ
  • acquire_ctx โ€” the global implicit acquire context used by atomic drivers for legacy IOCTLs. it's deprecated bestie ๐Ÿ™ˆ because implicit locking contexts make it impossible to use driver-private struct drm_modeset_lock. anyone using this must hold mutex.
  • idr_mutex โ€” the mutex for KMS ID allocation and management. protects both object_idr and tile_idr. ๐Ÿ’…
  • object_idr โ€” the main KMS ID tracking object. use this idr for all the IDs โ€” fb, crtc, connector, modes โ€” it just makes life easier to only have one. iconic behavior honestly.
  • tile_idr โ€” use this idr for allocating new IDs for tiled sinks, like the ones u see in some high-res DP MST screens ๐Ÿ–ฅ๏ธ
  • fb_lock โ€” mutex that protects the global fb_list and num_fb.
  • num_fb โ€” the number of entries on fb_list.
  • fb_list โ€” the list of all struct drm_framebuffer. ๐ŸŽ€
  • connector_list_lock โ€” protects num_connector and connector_list and connector_free_list.
  • num_connector โ€” the number of connectors on this device. protected by connector_list_lock.
  • connector_ida โ€” the ID allocator for connector indices.
  • connector_list โ€” the list of connector objects linked with drm_connector.head. protected by connector_list_lock. โš ๏ธ only walk this list with drm_for_each_connector_iter and struct drm_connector_list_iter โ€” no freestyling, fr fr.
  • connector_free_list โ€” the list of connector objects linked with drm_connector.free_head. protected by connector_list_lock. it's used by drm_for_each_connector_iter and struct drm_connector_list_iter to safely free connectors using connector_free_work. ๐Ÿงš
  • connector_free_work โ€” the work that cleans up connector_free_list.
  • num_encoder โ€” the number of encoders on this device. this is invariant over the lifetime of a device, so it doesn't need any locks. lowkey chill.
  • encoder_list โ€” the list of encoder objects linked with drm_encoder.head. also invariant over the lifetime of a device, so no locks needed. ๐ŸŒธ
  • num_total_plane โ€” the number of universal (i.e. with primary/curso) planes on this device. invariant over the lifetime of a device, so no locks. โœจ
  • plane_list โ€” the list of plane objects linked with drm_plane.head. invariant over the lifetime of a device, so no locks needed.
  • panic_lock โ€” a raw spinlock used to protect critical sections of code that access the display hardware or the modeset software state, which the panic printing code must be protected against. see drm_panic_trylock, drm_panic_lock and drm_panic_unlock. ๐Ÿ”ฅ
  • num_colorop โ€” the number of colorop objects on this device. invariant over the lifetime of a device, so no locks. ๐Ÿ’œ
  • colorop_list โ€” the list of colorop objects linked with drm_colorop.head. invariant over the lifetime of a device, so no locks needed.
  • num_crtc โ€” the number of CRTCs on this device linked with drm_crtc.head. invariant over the lifetime of a device, so it doesn't need any locks. ๐Ÿ’…
  • crtc_list โ€” the list of CRTC objects linked with drm_crtc.head. invariant over the lifetime of a device, so no locks.
  • property_list โ€” the list of property type objects linked with drm_property.head. invariant over the lifetime of a device, so no locks. ๐ŸŽ€
  • privobj_list โ€” the list of private objects linked with drm_private_obj.head. invariant over the lifetime of a device, so no locks.
  • min_width โ€” minimum fb pixel width on this device.
  • min_height โ€” minimum fb pixel height on this device.
  • max_width โ€” maximum fb pixel width on this device.
  • max_height โ€” maximum fb pixel height on this device.
  • funcs โ€” the core driver provided mode setting functions. ๐Ÿ› ๏ธ
  • poll_enabled โ€” tracks polling support for this device.
  • poll_running โ€” tracks polling status for this device.
  • delayed_event โ€” tracks delayed poll uevent delivery for this device.
  • output_poll_work โ€” the delayed work for polling in process context.
  • blob_lock โ€” the mutex for blob property allocation and management. protects property_blob_list and drm_file.blobs. ๐Ÿ”’
  • property_blob_list โ€” the list of all the blob property objects linked with drm_property_blob.head. protected by blob_lock.
  • edid_property โ€” the default connector property that holds the EDID of the currently connected sink, if there is one. ๐Ÿ–ฅ๏ธโœจ
  • dpms_property โ€” the default connector property that controls the connector's DPMS state.
  • path_property โ€” the default connector property that holds the DP MST path for the port.
  • tile_property โ€” the default connector property that stores the tile position of a tiled screen, for sinks that need to be driven with multiple CRTCs.
  • panel_type_property โ€” the default connector property for panel type.
  • link_status_property โ€” the default connector property for the link status of a connector.
  • plane_type_property โ€” Default plane property that tells apart the legacy CURSOR, PRIMARY, and OVERLAY uses of planes. ๐ŸŽจ
  • prop_src_x โ€” Default atomic plane property for the plane source position in the connected drm_framebuffer. ๐Ÿ“
  • prop_src_y โ€” Default atomic plane property for the plane source position in the connected drm_framebuffer. ๐Ÿ“
  • prop_src_w โ€” Default atomic plane property for the plane source position in the connected drm_framebuffer. ๐Ÿ“
  • prop_src_h โ€” Default atomic plane property for the plane source position in the connected drm_framebuffer. ๐Ÿ“
  • prop_crtc_x โ€” Default atomic plane property for the plane destination position in the drm_crtc itโ€™s being shown on. ๐ŸŽฏ
  • prop_crtc_y โ€” Default atomic plane property for the plane destination position in the drm_crtc itโ€™s being shown on. ๐ŸŽฏ
  • prop_crtc_w โ€” Default atomic plane property for the plane destination position in the drm_crtc itโ€™s being shown on. ๐ŸŽฏ
  • prop_crtc_h โ€” Default atomic plane property for the plane destination position in the drm_crtc itโ€™s being shown on. ๐ŸŽฏ
  • prop_fb_id โ€” Default atomic plane property to specify the drm_framebuffer. ๐Ÿ–ผ๏ธ
  • prop_in_fence_fd โ€” Sync File fd representing the incoming fences for a Plane. ๐Ÿšง
  • prop_out_fence_ptr โ€” Sync File fd pointer representing the outgoing fences for a CRTC. Userspace should provide a pointer to a value of type s32, and then cast that pointer to u64. ๐Ÿ”—
  • prop_crtc_id โ€” Default atomic plane property to specify the drm_crtc. ๐ŸŽ›๏ธ
  • prop_fb_damage_clips โ€” Optional plane property to mark damaged regions on the plane in framebuffer coordinates of the framebuffer attached to the plane. ๐Ÿฉน
The layout of blob data is simply an array of drm_mode_rect. Unlike plane src coordinates, damage clips are not in 16.16 fixed point. ๐Ÿ“
  • prop_active โ€” Default atomic CRTC property to control the active state, which is the simplified implementation for DPMS in atomic drivers. โšก
  • prop_mode_id โ€” Default atomic CRTC property to set the mode for a CRTC. A 0 mode implies that the CRTC is entirely disabled โ€” all connectors must be off, and active must be set to disabled too. ๐Ÿšซ
  • prop_vrr_enabled โ€” Default atomic CRTC property to indicate whether variable refresh rate should be enabled on the CRTC. ๐ŸŒŠ
  • dvi_i_subconnector_property โ€” Optional DVI-I property to differentiate between analog or digital mode. ๐Ÿ”Œ
  • dvi_i_select_subconnector_property โ€” Optional DVI-I property to select between analog or digital mode. ๐Ÿ”€
  • dp_subconnector_property โ€” Optional DP property to differentiate between different DP downstream port types. ๐Ÿ–ฅ๏ธ
  • tv_subconnector_property โ€” Optional TV property to differentiate between different TV connector types. ๐Ÿ“บ
  • tv_select_subconnector_property โ€” Optional TV property to select between different TV connector types. ๐Ÿ“บ
  • legacy_tv_mode_property โ€” Optional TV property to select the output TV mode. Superseded by tv_mode_property. ๐Ÿ•ฐ๏ธ
  • tv_mode_property โ€” Optional TV property to select the TV standard output on the connector. ๐ŸŒ
  • tv_left_margin_property โ€” Optional TV property to set the left margin, expressed in pixels. ๐Ÿ“
  • tv_right_margin_property โ€” Optional TV property to set the right margin, expressed in pixels. ๐Ÿ“
  • tv_top_margin_property โ€” Optional TV property to set the right margin, expressed in pixels โ€” yes, the original says right margin here too, bestie ๐Ÿ™ˆ. ๐Ÿ“
  • tv_bottom_margin_property โ€” Optional TV property to set the right margin, expressed in pixels โ€” same energy, the page says right margin for this one too ๐Ÿ™ˆ. ๐Ÿ“
  • tv_brightness_property โ€” Optional TV property to set the brightness. โ˜€๏ธ
  • tv_contrast_property โ€” Optional TV property to set the contrast. ๐ŸŒ—
  • tv_flicker_reduction_property โ€” Optional TV property to control the flicker reduction mode. โœจ
  • tv_overscan_property โ€” Optional TV property to control the overscan setting. ๐Ÿ”
  • tv_saturation_property โ€” Optional TV property to set the saturation. ๐ŸŒˆ
  • tv_hue_property โ€” Optional TV property to set the hue. ๐ŸŽจ
  • scaling_mode_property โ€” Optional connector property to control the upscaling, mostly used for built-in panels. ๐Ÿงš
  • aspect_ratio_property โ€” Optional connector property to control the HDMI infoframe aspect ratio setting. ๐Ÿ“
  • content_type_property โ€” Optional connector property to control the HDMI infoframe content type setting. ๐ŸŽฌ
  • degamma_lut_property โ€” Optional CRTC property to set the LUT used to convert the framebufferโ€™s colors to linear gamma. ๐ŸŒˆ
  • degamma_lut_size_property โ€” Optional CRTC property for the size of the degamma LUT as supported by the driver (read-only). ๐Ÿ”’
  • ctm_property โ€” Optional CRTC property to set the matrix used to convert colors after the lookup in the degamma LUT. ๐Ÿงฎ
  • gamma_lut_property โ€” Optional CRTC property to set the LUT used to convert the colors, after the CTM matrix, to the gamma space of the connected screen. ๐Ÿ–ฅ๏ธ
  • gamma_lut_size_property โ€” Optional CRTC property for the size of the gamma LUT as supported by the driver (read-only). ๐Ÿ”’
  • background_color_property โ€” Optional CRTC property to set the background color. ๐ŸŽจ
  • suggested_x_property โ€” Optional connector property with a hint for the position of the output on the hostโ€™s screen. ๐Ÿงญ
  • suggested_y_property โ€” Optional connector property with a hint for the position of the output on the hostโ€™s screen. ๐Ÿงญ
  • non_desktop_property โ€” Optional connector property with a hint that the device isnโ€™t a standard display, and the console/desktop should not be displayed on it. ๐Ÿ™…โ€โ™€๏ธ
  • panel_orientation_property โ€” Optional connector property indicating how the lcd-panel is mounted inside the casing (e.g. normal or upside-down). ๐Ÿ”„
  • writeback_fb_id_property โ€” property for writeback connectors, storing the ID of the output framebuffer. See also: drm_writeback_connector_init. ๐Ÿ–ผ๏ธ
  • writeback_pixel_formats_property โ€” property for writeback connectors, storing an array of the supported pixel formats for the writeback engine (read-only). See also: drm_writeback_connector_init. ๐Ÿ”’
  • writeback_out_fence_ptr_property โ€” property for writeback connectors, fd pointer representing the outgoing fences for a writeback connector. Userspace should provide a pointer to a value of type s32, and then cast that pointer to u64. See also: drm_writeback_connector_init. ๐Ÿ”—
  • hdr_output_metadata_property โ€” connector property containing HDR metadata. This will be provided by userspace compositors based on HDR content. ๐ŸŒŸ
  • content_protection_property โ€” DRM ENUM property for content protection. See drm_connector_attach_content_protection_property. ๐Ÿ”
  • hdcp_content_type_property โ€” DRM ENUM property for type of Protected Content. ๐Ÿ›ก๏ธ
  • preferred_depth โ€” preferred RBG pixel depth, used by fb helpers. ๐ŸŽš๏ธ
  • prefer_shadow โ€” hint to userspace to prefer shadow-fb rendering. ๐ŸŒ“
  • quirk_addfb_prefer_xbgr_30bpp โ€” special hack for legacy ADDFB to keep nouveau userspace happy. Should only ever be set by the nouveau kernel driver. ๐Ÿ’€
  • quirk_addfb_prefer_host_byte_order โ€” when set to true, drm_mode_addfb will pick host byte order pixel_format when calling drm_mode_addfb2. This is how drm_mode_addfb should have worked from day one. It didnโ€™t though, so we ended up with quirks in both kernel and userspace drivers to deal with the broken behavior. Simply fixing drm_mode_addfb unconditionally would break these drivers, so add a quirk bit here to allow drivers opt-in. ๐Ÿงฉ
  • async_page_flip โ€” does this device support async flips on the primary plane? ๐Ÿ”„
  • fb_modifiers_not_supported โ€” when this flag is set, the DRM device will not expose modifier support to userspace. This is only used by legacy drivers that infer the buffer layout through heuristics without using modifiers. New drivers shall not set this flag. ๐Ÿšซ
  • normalize_zpos โ€” if true, the drm core will call drm_atomic_normalize_zpos as part of atomic mode checking from drm_atomic_helper_check. ๐Ÿ“š
  • modifiers_property โ€” plane property to list supported modifier/format combinations. ๐Ÿงฌ
  • async_modifiers_property โ€” plane property to list supported modifier/format combinations for asynchronous flips. โšก
  • size_hints_property โ€” plane SIZE_HINTS property. ๐Ÿ“
  • cursor_width โ€” hint to userspace for max cursor width. ๐Ÿ–ฑ๏ธ
  • cursor_height โ€” hint to userspace for max cursor height. ๐Ÿ–ฑ๏ธ
  • suspend_state โ€” atomic state when suspended. Set by drm_mode_config_helper_suspend and cleared by drm_mode_config_helper_resume. ๐Ÿ˜ด
  • helper_private โ€” mid-layer private data. ๐Ÿคซ

๐Ÿ’– Description ๐Ÿ’–

Core mode resource tracking structure. All CRTC, encoders, and connectors enumerated by the driver are added here, as are global properties. Some global restrictions are also here, e.g. dimension restrictions. ๐Ÿ—‚๏ธ

Framebuffer sizes refer to the virtual screen that can be displayed by the CRTC. This can be different from the physical resolution programmed. The minimum width and height, stored in min_width and min_height, describe the smallest size of the framebuffer. It correlates to the minimum programmable resolution. The maximum width, stored in max_width, is typically limited by the maximum pitch between two adjacent scanlines. The maximum height, stored in max_height, is usually only limited by the amount of addressable video memory. For hardware that has no real maximum, drivers should pick a reasonable default. ๐Ÿ–ฅ๏ธโœจ

See also DRM_SHADOW_PLANE_MAX_WIDTH and DRM_SHADOW_PLANE_MAX_HEIGHT. ๐Ÿ‘€

๐ŸŒˆ SEE ALSO ๐ŸŒˆ


okay thatโ€™s the whole struct page, bestie โ€” source/version/date vibes: ./include/drm, October 2026, struct drm_mode_config(9). ๐Ÿ’–โœจ๐Ÿซถ

๐Ÿ“ฆ where this page comes from