1494N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 1494N/A * Copyright © 2006 Keith Packard 1494N/A * Copyright © 2007-2008 Dave Airlie 1494N/A * Copyright (c) 2007-2008, 2013, Intel Corporation 1494N/A * Jesse Barnes <jesse.barnes@intel.com> 1494N/A * Permission is hereby granted, free of charge, to any person obtaining a 1494N/A * copy of this software and associated documentation files (the "Software"), 1494N/A * to deal in the Software without restriction, including without limitation 1494N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1494N/A * and/or sell copies of the Software, and to permit persons to whom the 1494N/A * Software is furnished to do so, subject to the following conditions: 1494N/A * The above copyright notice and this permission notice shall be included in 1494N/A * all copies or substantial portions of the Software. 1494N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1494N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1494N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1494N/A * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1494N/A * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1494N/A * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 1494N/A * OTHER DEALINGS IN THE SOFTWARE. 1494N/A * Note on terminology: here, for brevity and convenience, we refer to connector 1494N/A * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, 1494N/A * DVI, etc. And 'screen' refers to the whole of the visible display, which 1494N/A * may span multiple monitors (and therefore multiple CRTC and connector 1494N/A#
define DRM_MODE(
nm, t, c,
hd,
hss,
hse,
ht,
hsk,
vd,
vss,
vse,
vt,
vs, f) \
1494N/A /* Addressable image size (may be 0 for projectors, etc.) */ 1494N/A /* Actual mode we give to hw */ 1494N/A /* Driver private mode info */ 1494N/A * Describes a given display (e.g. CRT or flat panel) and its limitations. 1494N/A /* Clock limits FIXME: storage format */ 1494N/A /* note: use drm_framebuffer_remove() */ 1494N/A * Optinal callback for the dirty fb ioctl. 1494N/A * Userspace can notify the driver via this callback 1494N/A * that a area of the framebuffer has changed and should 1494N/A * be flushed to the display hardware. 1494N/A * drm_mode_fb_dirty_cmd for more information as all 1494N/A * the semantics and arguments have a one to one mapping 1494N/A * Note that the fb is refcounted for the benefit of driver internals, 1494N/A * scanout does not actually complete until the next vblank. So some 1494N/A * cleanup (like releasing the reference(s) on the backing GEM bo(s)) 1494N/A * should be deferred. In cases like this, the driver would like to 1494N/A * hold a ref to the fb even though it has already been removed from 1494N/A * Place on the dev->mode_config.fb_list, access protected by 1494N/A * dev->mode_config.fb_lock. 1494N/A /* depth can be 15 or 16 */ 1494N/A /* if you are using the helper */ 1494N/A * drm_crtc_funcs - control CRTCs for a given device 1494N/A * @restore: restore CRTC state 1494N/A * @reset: reset CRTC after state has been invalidate (e.g. resume) 1494N/A * @cursor_set: setup the cursor 1494N/A * @cursor_move: move the cursor 1494N/A * @gamma_set: specify color ramp for CRTC 1494N/A * @destroy: deinit and free object 1494N/A * @set_property: called when a property is changed 1494N/A * @set_config: apply a new CRTC configuration 1494N/A * @page_flip: initiate a page flip 1494N/A * The drm_crtc_funcs structure is the central CRTC management structure 1494N/A * in the DRM. Each CRTC controls one or more connectors (note that the name 1494N/A * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc. 1494N/A * connectors, not just CRTs). 1494N/A * Each driver is responsible for filling out this structure at startup time, 1494N/A * in addition to providing other modesetting features, like i2c and DDC 1494N/A /* Set gamma on the CRTC */ 1494N/A /* Object destroy routine */ 1494N/A * Flip to the given framebuffer. This implements the page 1494N/A * implementation must return immediately and block all 1494N/A * rendering to the current fb until the flip has completed. 1494N/A * If userspace set the event flag in the ioctl, the event 1494N/A * argument will point to an event to send back when the flip 1494N/A * completes, otherwise it will be NULL. 1494N/A * drm_crtc - central CRTC control structure 1494N/A * @base: base KMS object for ID tracking etc. 1494N/A * @enabled: is this CRTC enabled? 1494N/A * @mode: current mode timings 1494N/A * @hwmode: mode timings as programmed to hw regs 1494N/A * @invert_dimensions: for purposes of error checking crtc vs fb sizes, 1494N/A * is performing 90 or 270 degree rotated scanout 1494N/A * @funcs: CRTC control functions 1494N/A * @gamma_size: size of gamma ramp 1494N/A * @gamma_store: gamma ramp values 1494N/A * @framedur_ns: precise frame timing 1494N/A * @framedur_ns: precise line timing 1494N/A * @pixeldur_ns: precise pixel timing 1494N/A * @helper_private: mid-layer private data 1494N/A * @properties: property tracking for this CRTC 1494N/A * Each CRTC may have one or more connectors associated with it. This structure 1494N/A * allows the CRTC to be controlled. 1494N/A * This provides a read lock for the overall crtc state (mode, dpms 1494N/A * state, ...) and a write lock for everything which can be update 1494N/A * without a full modeset (fb, cursor data, ...) 1494N/A /* framebuffer the connector is currently bound to */ 1494N/A /* Temporary tracking of the old fb while a modeset is ongoing. Used 1494N/A * by drm_mode_set_config_internal to implement correct refcounting. */ 1494N/A /* Requested mode from modesetting. */ 1494N/A /* Programmed mode in hw, after adjustments for encoders, 1494N/A * crtc, panel scaling etc. Needed for timestamping etc. 1494N/A /* CRTC gamma size for reporting to userspace */ 1494N/A /* Constants needed for precise vblank and swap timestamping. */ 1494N/A /* if you are using the helper */ 1494N/A * drm_connector_funcs - control connectors on a given device 1494N/A * @dpms: set power state (see drm_crtc_funcs above) 1494N/A * @save: save connector state 1494N/A * @restore: restore connector state 1494N/A * @reset: reset connector after state has been invalidate (e.g. resume) 1494N/A * @detect: is this connector active? 1494N/A * @get_modes: get mode list for this connector 1494N/A * @set_property: property for this connector may need update 1494N/A * @destroy: make object go away 1494N/A * @force: notify the driver the connector is forced on 1494N/A * Each CRTC may have one or more connectors attached to it. The functions 1494N/A * below allow the core DRM code to control connectors, enumerate available modes, 1494N/A /* Check to see if anything is attached to the connector. 1494N/A * @force is set to false whilst polling, true when checking the 1494N/A * connector due to user request. @force can be used by the driver 1494N/A * to avoid expensive, destructive operations during automated 1494N/A * drm_encoder_funcs - encoder controls 1494N/A * @reset: reset state (e.g. at init or resume time) 1494N/A * @destroy: cleanup and free associated data 1494N/A * Encoders sit between CRTCs and connectors. 1494N/A * drm_encoder - central DRM encoder structure 1494N/A * @possible_crtcs: bitmask of potential CRTC bindings 1494N/A * @possible_clones: bitmask of potential sibling encoders for cloning 1494N/A * @crtc: currently bound CRTC 1494N/A * @funcs: control functions 1494N/A * @helper_private: mid-layer private data 1494N/A * CRTCs drive pixels to encoders, which convert them into signals 1494N/A * appropriate for a given connector or set of connectors. 1494N/A/* should we poll this connector for connects and disconnects */ 1494N/A/* can cleanly poll for disconnections without flickering the screen */ 1494N/A/* DACs should rarely do this without a lot of testing */ 1494N/A * drm_connector - central DRM connector control structure 1494N/A * @kdev: kernel device for sysfs attributes 1494N/A * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h 1494N/A * @connector_type_id: index into connector type enum 1494N/A * @interlace_allowed: can this connector handle interlaced modes? 1494N/A * @doublescan_allowed: can this connector handle doublescan? 1494N/A * @modes: modes available on this connector (from fill_modes() + user) 1494N/A * @status: one of the drm_connector_status enums (connected, not, or unknown) 1494N/A * @probed_modes: list of modes derived directly from the display 1494N/A * @display_info: information about attached display (e.g. from EDID) 1494N/A * @funcs: connector control functions 1494N/A * @edid_blob_ptr: DRM property containing EDID if present 1494N/A * @property_ids: property tracking for this connector 1494N/A * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling 1494N/A * @dpms: current dpms state 1494N/A * @helper_private: mid-layer private data 1494N/A * @force: a %DRM_FORCE_<foo> state for forced mode sets 1494N/A * @encoder_ids: valid encoders for this connector 1494N/A * @encoder: encoder driving this connector, if any 1494N/A * @eld: EDID-like data, if present 1494N/A * @dvi_dual: dual link DVI, if found 1494N/A * @max_tmds_clock: max clock rate, if found 1494N/A * @latency_present: AV delay info from ELD, if found 1494N/A * @video_latency: video latency info from ELD, if found 1494N/A * @audio_latency: audio latency info from ELD, if found 1494N/A * @null_edid_counter: track sinks that give us all zeros for the EDID 1494N/A * Each connector may be connected to one or more CRTCs, or may be clonable by 1494N/A * another connector if they can share a CRTC. Each connector also has a specific 1494N/A * position in the broader display (referred to as a 'screen' though it could 1494N/A /* these are modes added by probing with DDC or the BIOS */ 1494N/A * drm_plane_funcs - driver plane control functions 1494N/A * @update_plane: update the plane configuration 1494N/A * @disable_plane: shut down the plane 1494N/A * @destroy: clean up plane resources 1494N/A * @set_property: called when a property is changed 1494N/A * drm_plane - central DRM plane control structure 1494N/A * @dev: DRM device this plane belongs to 1494N/A * @head: for list management 1494N/A * @possible_crtcs: pipes this plane can be bound to 1494N/A * @format_types: array of formats supported by this plane 1494N/A * @format_count: number of formats supported 1494N/A * @crtc: currently bound CRTC 1494N/A * @properties: property tracking for this plane 1494N/A * drm_mode_set - new values for a CRTC config change 1494N/A * @fb: framebuffer to use for new config 1494N/A * @crtc: CRTC whose configuration we're about to change 1494N/A * @mode: mode timings to use 1494N/A * @x: position of this CRTC relative to @fb 1494N/A * @y: position of this CRTC relative to @fb 1494N/A * @connectors: array of connectors to drive with this CRTC if possible 1494N/A * @num_connectors: size of @connectors array 1494N/A * Represents a single crtc the connectors that it drives with what mode 1494N/A * and from which framebuffer it scans out from. 1494N/A * This is used to set modes. 1494N/A * struct drm_mode_config_funcs - basic driver provided mode setting functions 1494N/A * @fb_create: create a new framebuffer object 1494N/A * @output_poll_changed: function to handle output configuration changes 1494N/A * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that 1494N/A * drm_mode_group - group of mode setting resources for potential sub-grouping 1494N/A * @num_encoders: encoder count 1494N/A * @num_connectors: connector count 1494N/A * @id_list: list of KMS object IDs in this group 1494N/A * Currently this simply tracks the global mode setting state. But in the 1494N/A * future it could allow groups of objects to be set aside into independent 1494N/A * control groups for use by different user level processes (e.g. two X servers 1494N/A * running simultaneously on different heads, each with their own mode 1494N/A * configuration and freedom of mode setting). 1494N/A /* list of object IDs for this group */ 1494N/A * drm_mode_config - Mode configuration control structure 1494N/A * @mutex: mutex protecting KMS related lists and structures 1494N/A * @idr_mutex: mutex for KMS ID allocation and management 1494N/A * @crtc_idr: main KMS ID tracking object 1494N/A * @num_fb: number of fbs available 1494N/A * @fb_list: list of framebuffers available 1494N/A * @num_connector: number of connectors on this device 1494N/A * @connector_list: list of connector objects 1494N/A * @num_encoder: number of encoders on this device 1494N/A * @encoder_list: list of encoder objects 1494N/A * @num_crtc: number of CRTCs on this device 1494N/A * @crtc_list: list of CRTC objects 1494N/A * @min_width: minimum pixel width on this device 1494N/A * @min_height: minimum pixel height on this device 1494N/A * @max_width: maximum pixel width on this device 1494N/A * @max_height: maximum pixel height on this device 1494N/A * @funcs: core driver provided mode setting functions 1494N/A * @fb_base: base address of the framebuffer 1494N/A * @poll_enabled: track polling status for this device 1494N/A * @output_poll_work: delayed work for polling in process context 1494N/A * @*_property: core property tracking 1494N/A * Core mode resource tracking structure. All CRTC, encoders, and connectors 1494N/A * enumerated by the driver are added here, as are global properties. Some 1494N/A * global restrictions are also here, e.g. dimension restrictions. 1494N/A struct idr crtc_idr;
/* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 1494N/A * fb_lock - mutex to protect fb state 1494N/A * Besides the global fb list his also protects the fbs list in the 1494N/A /* this is limited to one for now */ 1494N/A /* pointers to standard properties */ 1494N/A /* dumb ioctl parameters */ 1494N/A/* helper to unplug all connectors from sysfs for device */