xf86Crtc.h revision 45e9809aff7304721fddb95654901b32195c9c7a
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore/*
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson * Copyright © 2006 Keith Packard
d15978eab6c23a98f0a5474466d5fe9b1be3ca9bGary Mills *
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov * Permission to use, copy, modify, distribute, and sell this software and its
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * documentation for any purpose is hereby granted without fee, provided that
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * the above copyright notice appear in all copies and that both that copyright
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * notice and this permission notice appear in supporting documentation, and
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * that the name of the copyright holders not be used in advertising or
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * publicity pertaining to distribution of the software without specific,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * written prior permission. The copyright holders make no representations
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * about the suitability of this software for any purpose. It is provided "as
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * is" without express or implied warranty.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * OF THIS SOFTWARE.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifndef _XF86CRTC_H_
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#define _XF86CRTC_H_
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include <edid.h>
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "randrstr.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#if XF86_MODES_RENAME
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "xf86Rename.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "xf86Modes.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "xf86Cursor.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "xf86i2c.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "damage.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#include "picturestr.h"
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore/* Compat definitions for older X Servers. */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifndef M_T_PREFERRED
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#define M_T_PREFERRED 0x08
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifndef M_T_DRIVER
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#define M_T_DRIVER 0x40
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifndef M_T_USERPREF
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#define M_T_USERPREF 0x80
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifndef HARDWARE_CURSOR_ARGB
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov#define HARDWARE_CURSOR_ARGB 0x00004000
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoretypedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoretypedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore/* define a standard for connector types */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoretypedef enum _xf86ConnectorType {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorNone,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorVGA,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorDVI_I,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorDVI_D,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorDVI_A,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorComposite,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorSvideo,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorComponent,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorLFP,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorProprietary,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorHDMI,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86ConnectorDisplayPort,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore} xf86ConnectorType;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoretypedef enum _xf86OutputStatus {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86OutputStatusConnected,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86OutputStatusDisconnected,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore XF86OutputStatusUnknown
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore} xf86OutputStatus;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoretypedef struct _xf86CrtcFuncs {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Turns the crtc on/off, or sets intermediate power levels if available.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Unsupported intermediate modes drop to the lower power setting. If the
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * be safe to call mode_set.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*dpms)(xf86CrtcPtr crtc,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int mode);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Saves the crtc's state for restoration on VT switch.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*save)(xf86CrtcPtr crtc);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Restore's the crtc's state at VT switch.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*restore)(xf86CrtcPtr crtc);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Lock CRTC prior to mode setting, mostly for DRI.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Returns whether unlock is needed
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*lock) (xf86CrtcPtr crtc);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Unlock CRTC after mode setting, mostly for DRI
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov (*unlock) (xf86CrtcPtr crtc);
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov /**
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov * Callback to adjust the mode to be set in the CRTC.
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This allows a CRTC to adjust the clock or even the entire set of
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * timings, which is used for panels with fixed timings or for
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * buses with clock limitations.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*mode_fixup)(xf86CrtcPtr crtc,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr mode,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr adjusted_mode);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Prepare CRTC for an upcoming mode set.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*prepare)(xf86CrtcPtr crtc);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Callback for setting up a video mode after fixups have been made.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*mode_set)(xf86CrtcPtr crtc,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr mode,
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov DisplayModePtr adjusted_mode,
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov int x, int y);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Commit mode changes to a CRTC
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*commit)(xf86CrtcPtr crtc);
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov /* Set the color ramps for the CRTC to the given values. */
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov void
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int size);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Allocate the shadow area, delay the pixmap creation until needed
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
d15978eab6c23a98f0a5474466d5fe9b1be3ca9bGary Mills
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Create shadow pixmap for rotation support
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore PixmapPtr
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Destroy shadow pixmap
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov */
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov void
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Set cursor colors
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Set cursor position
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Show cursor
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*show_cursor) (xf86CrtcPtr crtc);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Hide cursor
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*hide_cursor) (xf86CrtcPtr crtc);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Load monochrome image
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Load ARGB image
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Clean up driver-specific bits of the crtc
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov (*destroy) (xf86CrtcPtr crtc);
e50226eccc6dfcba3cc6f0df38438900e3df225cYuri Pankov
da17b20b93fdfe86e22d0e290ed2601a95e74977Damian Wojslaw /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Less fine-grained mode setting entry point for kernel modesetting
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Rotation rotation, int x, int y);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Callback for panning. Doesn't change the mode.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Added in ABI version 2
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*set_origin)(xf86CrtcPtr crtc, int x, int y);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#define XF86_CRTC_VERSION 3
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amorestruct _xf86Crtc {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * ABI versioning
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int version;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Associated ScrnInfo
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore ScrnInfoPtr scrn;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Desired state of this CRTC
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Set when this CRTC should be driving one or more outputs
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool enabled;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Active mode
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This reflects the mode as set in the CRTC currently
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * It will be cleared when the VT is not active or
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * during server startup
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModeRec mode;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Rotation rotation;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore PixmapPtr rotatedPixmap;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void *rotatedData;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Position on screen
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Locates this CRTC within the frame buffer
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int x, y;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Desired mode
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This is set to the requested mode, independent of
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * whether the VT is active. In particular, it receives
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * the startup configured mode and saves the active mode
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * on VT switch.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModeRec desiredMode;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Rotation desiredRotation;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int desiredX, desiredY;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /** crtc-specific functions */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore const xf86CrtcFuncsRec *funcs;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Driver private
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Holds driver-private information
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void *driver_private;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifdef RANDR_12_INTERFACE
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * RandR crtc
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * When RandR 1.2 is available, this
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * points at the associated crtc object
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore RRCrtcPtr randr_crtc;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#else
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void *randr_crtc;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Current cursor is ARGB
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool cursor_argb;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Track whether cursor is within CRTC range
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool cursor_in_range;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Track state of cursor associated with this CRTC
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool cursor_shown;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Current transformation matrix
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore PictTransform crtc_to_framebuffer;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /* framebuffer_to_crtc was removed in ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore PictFilterPtr filter; /* ABI 2 */
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore xFixed *params; /* ABI 2 */
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson int nparams; /* ABI 2 */
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson int filter_width; /* ABI 2 */
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson int filter_height; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool transform_in_use;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore RRTransformRec transform; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool transformPresent; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore RRTransformRec desiredTransform; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool desiredTransformPresent; /* ABI 2 */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Bounding box in screen space
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore BoxRec bounds;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Panning:
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * TotalArea: total panning area, larger than CRTC's size
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * TrackingArea: Area of the pointer for which the CRTC is panned
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Added in ABI version 2
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore BoxRec panningTotalArea;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore BoxRec panningTrackingArea;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore INT16 panningBorder[4];
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Current gamma, especially useful after initial config.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Added in ABI version 3
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore CARD16 *gamma_red;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore CARD16 *gamma_green;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore CARD16 *gamma_blue;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int gamma_size;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
429d0af29b3b9031688dd2fb16ecefb28f060e2eGarrett D'Amore * Actual state of this CRTC
429d0af29b3b9031688dd2fb16ecefb28f060e2eGarrett D'Amore *
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * Set to TRUE after modesetting, set to FALSE if no outputs are connected
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * Added in ABI version 3
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore */
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore Bool active;
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore /**
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * Clear the shadow
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore */
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore Bool shadowClear;
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore};
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amoretypedef struct _xf86OutputFuncs {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Called to allow the output a chance to create properties after the
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * RandR objects have been created.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*create_resources)(xf86OutputPtr output);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Turns the output on/off, or sets intermediate power levels if available.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Unsupported intermediate modes drop to the lower power setting. If the
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * disabled afterwards.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*dpms)(xf86OutputPtr output,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int mode);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Saves the output's state for restoration on VT switch.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*save)(xf86OutputPtr output);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Restore's the output's state at VT switch.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*restore)(xf86OutputPtr output);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Callback for testing a video mode for a given output.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This function should only check for cases where a mode can't be supported
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * on the output specifically, and not represent generic CRTC limitations.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*mode_valid)(xf86OutputPtr output,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr pMode);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Callback to adjust the mode to be set in the CRTC.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This allows an output to adjust the clock or even the entire set of
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * timings, which is used for panels with fixed timings or for
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * buses with clock limitations.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*mode_fixup)(xf86OutputPtr output,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr mode,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr adjusted_mode);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * Callback for preparing mode changes on an output
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore */
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore void
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore (*prepare)(xf86OutputPtr output);
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore /**
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * Callback for committing mode changes on an output
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore */
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore void
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore (*commit)(xf86OutputPtr output);
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore /**
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * Callback for setting up a video mode after fixups have been made.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * This is only called while the output is disabled. The dpms callback
c530934a778b6ba8ad55ddb0e3bbee8faa6260b0Garrett D'Amore * must be all that's necessary for the output, to turn the output on
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * after this function is called.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*mode_set)(xf86OutputPtr output,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr mode,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore DisplayModePtr adjusted_mode);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Probe for a connected output, and return detect_status.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore xf86OutputStatus
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*detect)(xf86OutputPtr output);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Query the device for the modes it provides.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * This function may also update MonInfo, mm_width, and mm_height.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * \return singly-linked list of modes or NULL if no modes found.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson DisplayModePtr
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson (*get_modes)(xf86OutputPtr output);
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifdef RANDR_12_INTERFACE
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson /**
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson * Callback when an output's property has changed.
9384cec630155c229c70dfb8a445c6ccf433045aJohann 'Myrkraverk' Oskarsson */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*set_property)(xf86OutputPtr output,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Atom property,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore RRPropertyValuePtr value);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifdef RANDR_13_INTERFACE
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Callback to get an updated property value
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Bool
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*get_property)(xf86OutputPtr output,
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore Atom property);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#ifdef RANDR_GET_CRTC_INTERFACE
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Callback to get current CRTC for a given output
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore xf86CrtcPtr
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*get_crtc)(xf86OutputPtr output);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#endif
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Clean up driver-specific bits of the output
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore void
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore (*destroy) (xf86OutputPtr output);
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore#define XF86_OUTPUT_VERSION 2
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amorestruct _xf86Output {
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * ABI versioning
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore int version;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Associated ScrnInfo
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore ScrnInfoPtr scrn;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Currently connected crtc (if any)
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore *
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * If this output is not in use, this field will be NULL.
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore xf86CrtcPtr crtc;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore * Possible CRTCs for this output as a mask of crtc indices
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore */
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore CARD32 possible_crtcs;
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore
84441f85b19f6b8080883f30109e58e43c893709Garrett D'Amore /**
* Possible outputs to share the same CRTC as a mask of output indices
*/
CARD32 possible_clones;
/**
* Whether this output can support interlaced modes
*/
Bool interlaceAllowed;
/**
* Whether this output can support double scan modes
*/
Bool doubleScanAllowed;
/**
* List of available modes on this output.
*
* This should be the list from get_modes(), plus perhaps additional
* compatible modes added later.
*/
DisplayModePtr probed_modes;
/**
* Options parsed from the related monitor section
*/
OptionInfoPtr options;
/**
* Configured monitor section
*/
XF86ConfMonitorPtr conf_monitor;
/**
* Desired initial position
*/
int initial_x, initial_y;
/**
* Desired initial rotation
*/
Rotation initial_rotation;
/**
* Current connection status
*
* This indicates whether a monitor is known to be connected
* to this output or not, or whether there is no way to tell
*/
xf86OutputStatus status;
/** EDID monitor information */
xf86MonPtr MonInfo;
/** subpixel order */
int subpixel_order;
/** Physical size of the currently attached output device. */
int mm_width, mm_height;
/** Output name */
char *name;
/** output-specific functions */
const xf86OutputFuncsRec *funcs;
/** driver private information */
void *driver_private;
/** Whether to use the old per-screen Monitor config section */
Bool use_screen_monitor;
#ifdef RANDR_12_INTERFACE
/**
* RandR 1.2 output structure.
*
* When RandR 1.2 is available, this points at the associated
* RandR output structure and is created when this output is created
*/
RROutputPtr randr_output;
#else
void *randr_output;
#endif
/**
* Desired initial panning
* Added in ABI version 2
*/
BoxRec initialTotalArea;
BoxRec initialTrackingArea;
INT16 initialBorder[4];
};
typedef struct _xf86CrtcConfigFuncs {
/**
* Requests that the driver resize the screen.
*
* The driver is responsible for updating scrn->virtualX and scrn->virtualY.
* If the requested size cannot be set, the driver should leave those values
* alone and return FALSE.
*
* A naive driver that cannot reallocate the screen may simply change
* virtual[XY]. A more advanced driver will want to also change the
* devPrivate.ptr and devKind of the screen pixmap, update any offscreen
* pixmaps it may have moved, and change pScrn->displayWidth.
*/
Bool
(*resize)(ScrnInfoPtr scrn,
int width,
int height);
} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
typedef struct _xf86CrtcConfig {
int num_output;
xf86OutputPtr *output;
/**
* compat_output is used whenever we deal
* with legacy code that only understands a single
* output. pScrn->modes will be loaded from this output,
* adjust frame will whack this output, etc.
*/
int compat_output;
int num_crtc;
xf86CrtcPtr *crtc;
int minWidth, minHeight;
int maxWidth, maxHeight;
/* For crtc-based rotation */
DamagePtr rotation_damage;
Bool rotation_damage_registered;
/* DGA */
unsigned int dga_flags;
unsigned long dga_address;
DGAModePtr dga_modes;
int dga_nmode;
int dga_width, dga_height, dga_stride;
DisplayModePtr dga_save_mode;
const xf86CrtcConfigFuncsRec *funcs;
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
/* Cursor information */
xf86CursorInfoPtr cursor_info;
CursorPtr cursor;
CARD8 *cursor_image;
Bool cursor_on;
CARD32 cursor_fg, cursor_bg;
/**
* Options parsed from the related device section
*/
OptionInfoPtr options;
Bool debug_modes;
/* wrap screen BlockHandler for rotation */
ScreenBlockHandlerProcPtr BlockHandler;
/* callback when crtc configuration changes */
xf86_crtc_notify_proc_ptr xf86_crtc_notify;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
static _X_INLINE xf86OutputPtr
xf86CompatOutput(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
return config->output[config->compat_output];
}
static _X_INLINE xf86CrtcPtr
xf86CompatCrtc(ScrnInfoPtr pScrn)
{
xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
if (!compat_output)
return NULL;
return compat_output->crtc;
}
static _X_INLINE RRCrtcPtr
xf86CompatRRCrtc(ScrnInfoPtr pScrn)
{
xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
if (!compat_crtc)
return NULL;
return compat_crtc->randr_crtc;
}
/*
* Initialize xf86CrtcConfig structure
*/
extern _X_EXPORT void
xf86CrtcConfigInit (ScrnInfoPtr scrn,
const xf86CrtcConfigFuncsRec *funcs);
extern _X_EXPORT void
xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
int minWidth, int minHeight,
int maxWidth, int maxHeight);
/*
* Crtc functions
*/
extern _X_EXPORT xf86CrtcPtr
xf86CrtcCreate (ScrnInfoPtr scrn,
const xf86CrtcFuncsRec *funcs);
extern _X_EXPORT void
xf86CrtcDestroy (xf86CrtcPtr crtc);
/**
* Sets the given video mode on the given crtc
*/
extern _X_EXPORT Bool
xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
RRTransformPtr transform, int x, int y);
extern _X_EXPORT Bool
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
int x, int y);
extern _X_EXPORT void
xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y);
/*
* Assign crtc rotation during mode set
*/
extern _X_EXPORT Bool
xf86CrtcRotate (xf86CrtcPtr crtc);
/*
* Clean up any rotation data, used when a crtc is turned off
* as well as when rotation is disabled.
*/
extern _X_EXPORT void
xf86RotateDestroy (xf86CrtcPtr crtc);
/*
* free shadow memory allocated for all crtcs
*/
extern _X_EXPORT void
xf86RotateFreeShadow(ScrnInfoPtr pScrn);
/*
* Clean up rotation during CloseScreen
*/
extern _X_EXPORT void
xf86RotateCloseScreen (ScreenPtr pScreen);
/**
* Return whether any output is assigned to the crtc
*/
extern _X_EXPORT Bool
xf86CrtcInUse (xf86CrtcPtr crtc);
/*
* Output functions
*/
extern _X_EXPORT xf86OutputPtr
xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec *funcs,
const char *name);
extern _X_EXPORT void
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
extern _X_EXPORT Bool
xf86OutputRename (xf86OutputPtr output, const char *name);
extern _X_EXPORT void
xf86OutputDestroy (xf86OutputPtr output);
extern _X_EXPORT void
xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
extern _X_EXPORT void
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
#ifdef RANDR_13_INTERFACE
# define ScreenInitRetType int
#else
# define ScreenInitRetType Bool
#endif
extern _X_EXPORT ScreenInitRetType
xf86CrtcScreenInit (ScreenPtr pScreen);
extern _X_EXPORT Bool
xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
extern _X_EXPORT void
xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
extern _X_EXPORT Bool
xf86SaveScreen(ScreenPtr pScreen, int mode);
extern _X_EXPORT void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
extern _X_EXPORT DisplayModePtr
xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
extern _X_EXPORT Bool
xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
/**
* Set the EDID information for the specified output
*/
extern _X_EXPORT void
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
/**
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
extern _X_EXPORT DisplayModePtr
xf86OutputGetEDIDModes (xf86OutputPtr output);
extern _X_EXPORT xf86MonPtr
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
/**
* Initialize dga for this screen
*/
#ifdef XFreeXDGA
extern _X_EXPORT Bool
xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
/* this is the real function, used only internally */
_X_INTERNAL Bool
_xf86_di_dga_init_internal (ScreenPtr pScreen);
/**
* Re-initialize dga for this screen (as when the set of modes changes)
*/
extern _X_EXPORT Bool
xf86DiDGAReInit (ScreenPtr pScreen);
#endif
/* This is the real function, used only internally */
_X_INTERNAL Bool
_xf86_di_dga_reinit_internal (ScreenPtr pScreen);
/*
* Set the subpixel order reported for the screen using
* the information from the outputs
*/
extern _X_EXPORT void
xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
/*
* Get a standard string name for a connector type
*/
extern _X_EXPORT char *
xf86ConnectorGetName(xf86ConnectorType connector);
/*
* Using the desired mode information in each crtc, set
* modes (used in EnterVT functions, or at server startup)
*/
extern _X_EXPORT Bool
xf86SetDesiredModes (ScrnInfoPtr pScrn);
/**
* Initialize the CRTC-based cursor code. CRTC function vectors must
* contain relevant cursor setting functions.
*
* Driver should call this from ScreenInit function
*/
extern _X_EXPORT Bool
xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
/**
* Called when anything on the screen is reconfigured.
*
* Reloads cursor images as needed, then adjusts cursor positions.
*
* Driver should call this from crtc commit function.
*/
extern _X_EXPORT void
xf86_reload_cursors (ScreenPtr screen);
/**
* Called from EnterVT to turn the cursors back on
*/
extern _X_EXPORT void
xf86_show_cursors (ScrnInfoPtr scrn);
/**
* Called by the driver to turn cursors off
*/
extern _X_EXPORT void
xf86_hide_cursors (ScrnInfoPtr scrn);
/**
* Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
*/
extern _X_EXPORT void
xf86_cursors_fini (ScreenPtr screen);
/*
* For overlay video, compute the relevant CRTC and
* clip video to that.
* wraps xf86XVClipVideoHelper()
*/
extern _X_EXPORT Bool
xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
xf86CrtcPtr *crtc_ret,
xf86CrtcPtr desired_crtc,
BoxPtr dst,
INT32 *xa,
INT32 *xb,
INT32 *ya,
INT32 *yb,
RegionPtr reg,
INT32 width,
INT32 height);
extern _X_EXPORT xf86_crtc_notify_proc_ptr
xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
extern _X_EXPORT void
xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
extern _X_EXPORT void
xf86_crtc_notify(ScreenPtr pScreen);
/**
* Gamma
*/
extern _X_EXPORT Bool
xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
#endif /* _XF86CRTC_H_ */