/*
* Copyright © 2006 Keith Packard
* Copyright © 2007-2008 Dave Airlie
* Copyright © 2007-2008 Intel Corporation
* Jesse Barnes <jesse.barnes@intel.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __DRM_CRTC_H__
#define __DRM_CRTC_H__
#include <linux/spinlock.h>
#include <linux/types.h>
#include <drm/drm_modeset_lock.h>
#include <drm/drm_mode_object.h>
#include <drm/drm_modes.h>
#include <drm/drm_device.h>
#include <drm/drm_plane.h>
#include <drm/drm_debugfs_crc.h>
#include <drm/drm_mode_config.h>
struct drm_connector;
struct drm_device;
struct drm_framebuffer;
struct drm_mode_set;
struct drm_file;
struct drm_printer;
struct drm_self_refresh_data;
struct device_node;
struct edid;
static inline int64_t U642I64(uint64_t val)
{
return (int64_t)*((int64_t *)&val);
}
static inline uint64_t I642U64(int64_t val)
{
return (uint64_t)*((uint64_t *)&val);
}
struct drm_crtc;
struct drm_pending_vblank_event;
struct drm_plane;
struct drm_bridge;
struct drm_atomic_state;
struct drm_crtc_helper_funcs;
struct drm_plane_helper_funcs;
/**
* struct drm_crtc_state - mutable CRTC state
*
* Note that the distinction between @enable and @active is rather subtle:
* Flipping @active while @enable is set without changing anything else may
* never return in a failure from the &drm_mode_config_funcs.atomic_check
* callback. Userspace assumes that a DPMS On will always succeed. In other
* words: @enable controls resource assignment, @active controls the actual
* hardware state.
*
* The three booleans active_changed, connectors_changed and mode_changed are
* intended to indicate whether a full modeset is needed, rather than strictly
* describing what has changed in a commit. See also:
* drm_atomic_crtc_needs_modeset()
*/
struct drm_crtc_state {
/** @crtc: backpointer to the CRTC */
struct drm_crtc *crtc;
/**
* @enable: Whether the CRTC should be enabled, gates all other state.
* This controls reservations of shared resources. Actual hardware state
* is controlled by @active.
*/
bool enable;
/**
* @active: Whether the CRTC is actively displaying (used for DPMS).
* Implies that @enable is set. The driver must not release any shared
* resources if @active is set to false but @enable still true, because
* userspace expects that a DPMS ON always succeeds.
*
* Hence drivers must not consult @active in their various
* &drm_mode_config_funcs.atomic_check callback to reject an atomic
* commit. They can consult it to aid in the computation of derived
* hardware state, since even in the DPMS OFF state the display hardware
* should be as much powered down as when the CRTC is completely
* disabled through setting @enable to false.
*/
bool active;
/**
* @planes_changed: Planes on this crtc are updated. Used by the atomic
* helpers and drivers to steer the atomic commit control flow.
*/
bool planes_changed : 1;
/**
* @mode_changed: @mode or @enable has been changed. Used by the atomic
* helpers and drivers to steer the atomic commit control flow. See also
* drm_atomic_crtc_needs_modeset().
*
* Drivers are supposed to set this for any CRTC state changes that
* require a full modeset. They can also reset it to false if e.g. a
* @mode change can be done without a full modeset by only changing
* scaler settings.
*/
bool mode_changed : 1;
/**
* @active_changed: @active has been toggled. Used by the atomic
* helpers and drivers to steer the atomic commit control flow. See also
* drm_atomic_crtc_needs_modeset().
*/
bool active_changed : 1;
/**
* @connectors_changed: Connectors to this crtc have been updated,
* either in their state or routing. Used by the atomic
* helpers and drivers to steer the atomic commit control flow. See also
* drm_atomic_crtc_needs_modeset().
*
* Drivers are supposed to set this as-needed from their own atomic
* check code, e.g. from &drm_encoder_helper_funcs.atomic_check
*/
bool connectors_changed