1494N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 1494N/A * Copyright (c) 2006-2008, 2013, Intel Corporation 1494N/A * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> 1494N/A * DRM core CRTC related functions 1494N/A * Permission to use, copy, modify, distribute, and sell this software and its 1494N/A * documentation for any purpose is hereby granted without fee, provided that 1494N/A * the above copyright notice appear in all copies and that both that copyright 1494N/A * notice and this permission notice appear in supporting documentation, and 1494N/A * that the name of the copyright holders not be used in advertising or 1494N/A * publicity pertaining to distribution of the software without specific, 1494N/A * written prior permission. The copyright holders make no representations 1494N/A * about the suitability of this software for any purpose. It is provided "as 1494N/A * is" without express or implied warranty. 1494N/A * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1494N/A * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 1494N/A * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 1494N/A * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 1494N/A * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 1494N/A * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 1494N/A * Eric Anholt <eric@anholt.net> 1494N/A * Dave Airlie <airlied@linux.ie> 1494N/A * Jesse Barnes <jesse.barnes@intel.com> 1494N/A * drm_helper_move_panel_connectors_to_head() - move panels to the front in the 1494N/A * @dev: drm device to operate on 1494N/A * Some userspace presumes that the first connected connector is the main 1494N/A * display, where it's supposed to display e.g. the login screen. For 1494N/A * laptops, this should be the main panel. Use this function to sort all 1494N/A * (eDP/LVDS) panels to the front of the connector list, instead of 1494N/A * painstakingly trying to initialize them in the right order. 1494N/A * drm_helper_probe_connector_modes - get complete set of display modes 1494N/A * @maxX: max width for modes 1494N/A * @maxY: max height for modes 1494N/A * Caller must hold mode config lock. 1494N/A * Based on @dev's mode_config layout, scan all the connectors and try to detect 1494N/A * modes on them. Modes will first be added to the connector's probed_modes 1494N/A * list, then culled (based on validity and the @maxX, @maxY parameters) and 1494N/A * put into the normal modes list. 1494N/A * Intended to be used either at bootup time or when major configuration 1494N/A * FIXME: take into account monitor limits 1494N/A * Number of modes found on @connector. 1494N/A /* set all modes to the unverified state */ 1494N/A /* Re-enable polling in case the global poll config changed. */ 1494N/A * drm_helper_encoder_in_use - check if a given encoder is in use 1494N/A * @encoder: encoder to check 1494N/A * Caller must hold mode config lock. 1494N/A * Walk @encoders's DRM device's mode_config and see if it's in use. 1494N/A * True if @encoder is part of the mode_config, false otherwise. 1494N/A * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config 1494N/A * Caller must hold mode config lock. 1494N/A * Walk @crtc's DRM device's mode_config and see if it's in use. 1494N/A * True if @crtc is part of the mode_config, false otherwise. 1494N/A /* FIXME: Locking around list access? */ 1494N/A * drm_helper_disable_unused_functions - disable unused objects 1494N/A * Caller must hold mode config lock. 1494N/A * If an connector or CRTC isn't part of @dev's mode_config, it can be disabled 1494N/A * by calling its dpms function, which should power it off. 1494N/A /* disconnector encoder from any connector */ 1494N/A * drm_encoder_crtc_ok - can a given crtc drive a given encoder? 1494N/A * @encoder: encoder to test 1494N/A * Return false if @encoder can't be driven by @crtc, true otherwise. 1494N/A * Check the CRTC we're going to map each output to vs. its current 1494N/A * CRTC. If they don't match, we have to disable the output and the CRTC 1494N/A * since the driver will have to re-route things. 1494N/A /* Disable unused encoders */ 1494N/A /* Disable encoders whose CRTC is about to change */ 1494N/A * drm_crtc_set_mode - set a mode 1494N/A * @old_fb: old framebuffer, for cleanup 1494N/A * Caller must hold mode config lock. 1494N/A * Try to set @mode on @crtc. Give @crtc and its associated connectors a chance 1494N/A * to fixup or reject the mode prior to trying to set it. This is an internal 1494N/A * helper that drivers could e.g. use to update properties that require the 1494N/A * entire output pipe to be disabled and re-enabled in a new configuration. For 1494N/A * example for changing whether audio is enabled on a hdmi link or for changing 1494N/A * panel fitter or dither attributes. It is also called by the 1494N/A * drm_crtc_helper_set_config() helper function to drive the mode setting 1494N/A * True if the mode was set successfully, or false otherwise. 1494N/A /* Update crtc values up front so the driver can rely on them for mode 1494N/A /* Pass our mode to the connectors and the CRTC to give them a chance to 1494N/A * adjust it according to limitations or connector properties, and also 1494N/A * a chance to reject the mode entirely. 1494N/A /* Prepare the encoders and CRTCs before setting the mode. */ 1494N/A /* Disable the encoders as the first thing we do. */ 1494N/A /* Set up the DPLL and any encoders state that needs to adjust or depend 1494N/A /* Now enable the clocks, plane, pipe, and connectors that we set up. */ 1494N/A /* Store real post-adjustment hardware mode. */ 1494N/A /* Calculate and store various constants which 1494N/A * are later needed by vblank and swap-completion 1494N/A * timestamping. They are derived from true hwmode. 1494N/A /* FIXME: add subpixel order */ 1494N/A /* Decouple all encoders and their attached connectors from this crtc */ 1494N/A * drm_crtc_helper_set_config - set a new config from userspace 1494N/A * @set: mode set configuration 1494N/A * Caller must hold mode config lock. 1494N/A * Setup a new configuration, provided by the upper layers (either an ioctl call 1494N/A * from userspace or internally e.g. from the fbdev suppport code) in @set, and 1494N/A * enable it. This is the main helper functions for drivers that implement 1494N/A * kernel mode setting with the crtc helper functions and the assorted 1494N/A * ->prepare(), ->modeset() and ->commit() helper callbacks. 1494N/A /* Enforce sane interface api - has been abused by the fb helper. */ 1494N/A /* Allocate space for the backup of all (non-pointer) crtc, encoder and 1494N/A /* Copy data. Note that driver private data is not affected. 1494N/A * Should anything bad happen only the expected state is 1494N/A * restored, not the drivers personal bookkeeping. 1494N/A /* We should be able to check here if the fb has the same properties 1494N/A * and then just flip_or_move it */ 1494N/A /* If we have no fb then treat it as a full mode set */ 1494N/A /* a) traverse passed in connector list and get encoders for them */ 1494N/A /* if we can't get an encoder for a connector 1494N/A we are setting now - then fail */ 1494N/A /* don't break so fail path works correct */ 1494N/A if (connector->dpms != DRM_MODE_DPMS_ON) { 1494N/A DRM_DEBUG_KMS("connector dpms not on, full mode switch\n"); 1494N/A /* If the encoder is reused for another connector, then 1494N/A * the appropriate crtc will be set later. 1494N/A /* Make sure the new CRTC will work with the encoder */ 1494N/A /* mode_set_base is not a required function */ 1494N/A /* Restore all previous data. */ 1494N/A /* Try to restore the config */ 1494N/A * drm_helper_connector_dpms 1494N/A * @connector affected connector 1494N/A * This is the main helper function provided by the crtc helper framework for 1494N/A * implementing the DPMS connector attribute. It computes the new desired DPMS 1494N/A * state for all encoders and crtcs in the output mesh and calls the ->dpms() 1494N/A * callback provided by the driver appropriately. 1494N/A /* from off to on, do crtc then encoder */ 1494N/A /* from on to off, do encoder then crtc */ 1494N/A /* Turn off outputs that were already powered off */ 1494N/A /* disable the unused connectors while restoring the modesetting */ 1494N/A /* Ignore forced connectors. */ 1494N/A /* Ignore HPD capable connectors and connectors where we don't 1494N/A * want any hotplug detection at all for polling. */ 1494N/A /* if we are connected and don't want to poll for disconnect 1494N/A "status updated from %s to %s\n",
1494N/A /* kill timer and schedule immediate execution, this doesn't block */