STRUCT DRM_MODE_CONFIG(9)
๐ 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 ofacquire_ctx. no cap.connection_mutexโ protects connector state and the whole connector โ encoder โ CRTC routing chain. for atomic drivers specifically, this protectsdrm_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-privatestruct drm_modeset_lock. anyone using this must holdmutex.idr_mutexโ the mutex for KMS ID allocation and management. protects bothobject_idrandtile_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 globalfb_listandnum_fb.num_fbโ the number of entries onfb_list.fb_listโ the list of allstruct drm_framebuffer. ๐connector_list_lockโ protectsnum_connectorandconnector_listandconnector_free_list.num_connectorโ the number of connectors on this device. protected byconnector_list_lock.connector_idaโ the ID allocator for connector indices.connector_listโ the list of connector objects linked withdrm_connector.head. protected byconnector_list_lock. โ ๏ธ only walk this list withdrm_for_each_connector_iterandstruct drm_connector_list_iterโ no freestyling, fr fr.connector_free_listโ the list of connector objects linked withdrm_connector.free_head. protected byconnector_list_lock. it's used bydrm_for_each_connector_iterandstruct drm_connector_list_iterto safely free connectors usingconnector_free_work. ๐งconnector_free_workโ the work that cleans upconnector_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 withdrm_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 withdrm_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. seedrm_panic_trylock,drm_panic_lockanddrm_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 withdrm_colorop.head. invariant over the lifetime of a device, so no locks needed.num_crtcโ the number of CRTCs on this device linked withdrm_crtc.head. invariant over the lifetime of a device, so it doesn't need any locks. ๐crtc_listโ the list of CRTC objects linked withdrm_crtc.head. invariant over the lifetime of a device, so no locks.property_listโ the list of property type objects linked withdrm_property.head. invariant over the lifetime of a device, so no locks. ๐privobj_listโ the list of private objects linked withdrm_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. protectsproperty_blob_listanddrm_file.blobs. ๐property_blob_listโ the list of all the blob property objects linked withdrm_property_blob.head. protected byblob_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 legacyCURSOR,PRIMARY, andOVERLAYuses of planes. ๐จprop_src_xโ Default atomic plane property for the plane source position in the connecteddrm_framebuffer. ๐prop_src_yโ Default atomic plane property for the plane source position in the connecteddrm_framebuffer. ๐prop_src_wโ Default atomic plane property for the plane source position in the connecteddrm_framebuffer. ๐prop_src_hโ Default atomic plane property for the plane source position in the connecteddrm_framebuffer. ๐prop_crtc_xโ Default atomic plane property for the plane destination position in thedrm_crtcitโs being shown on. ๐ฏprop_crtc_yโ Default atomic plane property for the plane destination position in thedrm_crtcitโs being shown on. ๐ฏprop_crtc_wโ Default atomic plane property for the plane destination position in thedrm_crtcitโs being shown on. ๐ฏprop_crtc_hโ Default atomic plane property for the plane destination position in thedrm_crtcitโs being shown on. ๐ฏprop_fb_idโ Default atomic plane property to specify thedrm_framebuffer. ๐ผ๏ธprop_in_fence_fdโSync File fdrepresenting the incoming fences for a Plane. ๐งprop_out_fence_ptrโSync File fdpointer representing the outgoing fences for a CRTC. Userspace should provide a pointer to a value of types32, and then cast that pointer tou64. ๐prop_crtc_idโ Default atomic plane property to specify thedrm_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. A0mode implies that the CRTC is entirely disabled โ all connectors must be off, andactivemust 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 bytv_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 types32, and then cast that pointer tou64. 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. Seedrm_connector_attach_content_protection_property. ๐hdcp_content_type_propertyโ DRM ENUM property for type of Protected Content. ๐ก๏ธpreferred_depthโ preferredRBGpixel 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_addfbwill pick host byte orderpixel_formatwhen callingdrm_mode_addfb2. This is howdrm_mode_addfbshould 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 fixingdrm_mode_addfbunconditionally 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 calldrm_atomic_normalize_zposas part of atomic mode checking fromdrm_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โ planeSIZE_HINTSproperty. ๐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 bydrm_mode_config_helper_suspendand cleared bydrm_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 ๐
- Kernel file
./include/drm/drm_mode_config.hstruct drm_mode_config_funcs(9),drm_mode_config_init(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms