randrstr.h revision 4642e01f
105b261ecSmrg/* 205b261ecSmrg * Copyright © 2000 Compaq Computer Corporation 305b261ecSmrg * Copyright © 2002 Hewlett-Packard Company 405b261ecSmrg * Copyright © 2006 Intel Corporation 54642e01fSmrg * Copyright © 2008 Red Hat, Inc. 605b261ecSmrg * 705b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its 805b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that 905b261ecSmrg * the above copyright notice appear in all copies and that both that copyright 1005b261ecSmrg * notice and this permission notice appear in supporting documentation, and 1105b261ecSmrg * that the name of the copyright holders not be used in advertising or 1205b261ecSmrg * publicity pertaining to distribution of the software without specific, 1305b261ecSmrg * written prior permission. The copyright holders make no representations 1405b261ecSmrg * about the suitability of this software for any purpose. It is provided "as 1505b261ecSmrg * is" without express or implied warranty. 1605b261ecSmrg * 1705b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1805b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 1905b261ecSmrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 2005b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 2105b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 2205b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 2305b261ecSmrg * OF THIS SOFTWARE. 2405b261ecSmrg * 2505b261ecSmrg * Author: Jim Gettys, Hewlett-Packard Company, Inc. 2605b261ecSmrg * Keith Packard, Intel Corporation 2705b261ecSmrg */ 2805b261ecSmrg 2905b261ecSmrg#ifdef HAVE_DIX_CONFIG_H 3005b261ecSmrg#include <dix-config.h> 3105b261ecSmrg#endif 3205b261ecSmrg 3305b261ecSmrg#ifndef _RANDRSTR_H_ 3405b261ecSmrg#define _RANDRSTR_H_ 3505b261ecSmrg 3605b261ecSmrg#include <X11/X.h> 3705b261ecSmrg#include <X11/Xproto.h> 3805b261ecSmrg#include "misc.h" 3905b261ecSmrg#include "os.h" 4005b261ecSmrg#include "dixstruct.h" 4105b261ecSmrg#include "resource.h" 4205b261ecSmrg#include "scrnintstr.h" 4305b261ecSmrg#include "windowstr.h" 4405b261ecSmrg#include "pixmapstr.h" 4505b261ecSmrg#include "extnsionst.h" 4605b261ecSmrg#include "servermd.h" 474642e01fSmrg#include "rrtransform.h" 4805b261ecSmrg#include <X11/extensions/randr.h> 4905b261ecSmrg#include <X11/extensions/randrproto.h> 5005b261ecSmrg#ifdef RENDER 5105b261ecSmrg#include <X11/extensions/render.h> /* we share subpixel order information */ 5205b261ecSmrg#include "picturestr.h" 5305b261ecSmrg#endif 5405b261ecSmrg#include <X11/Xfuncproto.h> 5505b261ecSmrg 5605b261ecSmrg/* required for ABI compatibility for now */ 5705b261ecSmrg#define RANDR_10_INTERFACE 1 5805b261ecSmrg#define RANDR_12_INTERFACE 1 594642e01fSmrg#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */ 604642e01fSmrg#define RANDR_GET_CRTC_INTERFACE 1 614642e01fSmrg 624642e01fSmrg#define RANDR_INTERFACE_VERSION 0x0103 6305b261ecSmrg 6405b261ecSmrgtypedef XID RRMode; 6505b261ecSmrgtypedef XID RROutput; 6605b261ecSmrgtypedef XID RRCrtc; 6705b261ecSmrg 6805b261ecSmrgextern int RREventBase, RRErrorBase; 6905b261ecSmrg 7005b261ecSmrgextern int (*ProcRandrVector[RRNumberRequests])(ClientPtr); 7105b261ecSmrgextern int (*SProcRandrVector[RRNumberRequests])(ClientPtr); 7205b261ecSmrg 7305b261ecSmrg/* 7405b261ecSmrg * Modeline for a monitor. Name follows directly after this struct 7505b261ecSmrg */ 7605b261ecSmrg 7705b261ecSmrg#define RRModeName(pMode) ((char *) (pMode + 1)) 7805b261ecSmrgtypedef struct _rrMode RRModeRec, *RRModePtr; 7905b261ecSmrgtypedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr; 8005b261ecSmrgtypedef struct _rrProperty RRPropertyRec, *RRPropertyPtr; 8105b261ecSmrgtypedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr; 8205b261ecSmrgtypedef struct _rrOutput RROutputRec, *RROutputPtr; 8305b261ecSmrg 8405b261ecSmrgstruct _rrMode { 8505b261ecSmrg int refcnt; 8605b261ecSmrg xRRModeInfo mode; 8705b261ecSmrg char *name; 8805b261ecSmrg ScreenPtr userScreen; 8905b261ecSmrg}; 9005b261ecSmrg 9105b261ecSmrgstruct _rrPropertyValue { 9205b261ecSmrg Atom type; /* ignored by server */ 9305b261ecSmrg short format; /* format of data for swapping - 8,16,32 */ 9405b261ecSmrg long size; /* size of data in (format/8) bytes */ 9505b261ecSmrg pointer data; /* private to client */ 9605b261ecSmrg}; 9705b261ecSmrg 9805b261ecSmrgstruct _rrProperty { 9905b261ecSmrg RRPropertyPtr next; 10005b261ecSmrg ATOM propertyName; 10105b261ecSmrg Bool is_pending; 10205b261ecSmrg Bool range; 10305b261ecSmrg Bool immutable; 10405b261ecSmrg int num_valid; 10505b261ecSmrg INT32 *valid_values; 10605b261ecSmrg RRPropertyValueRec current, pending; 10705b261ecSmrg}; 10805b261ecSmrg 10905b261ecSmrgstruct _rrCrtc { 11005b261ecSmrg RRCrtc id; 11105b261ecSmrg ScreenPtr pScreen; 11205b261ecSmrg RRModePtr mode; 11305b261ecSmrg int x, y; 11405b261ecSmrg Rotation rotation; 11505b261ecSmrg Rotation rotations; 11605b261ecSmrg Bool changed; 11705b261ecSmrg int numOutputs; 11805b261ecSmrg RROutputPtr *outputs; 11905b261ecSmrg int gammaSize; 12005b261ecSmrg CARD16 *gammaRed; 12105b261ecSmrg CARD16 *gammaBlue; 12205b261ecSmrg CARD16 *gammaGreen; 12305b261ecSmrg void *devPrivate; 1244642e01fSmrg Bool transforms; 1254642e01fSmrg RRTransformRec client_pending_transform; 1264642e01fSmrg RRTransformRec client_current_transform; 1274642e01fSmrg PictTransform transform; 1284642e01fSmrg struct pict_f_transform f_transform; 1294642e01fSmrg struct pict_f_transform f_inverse; 13005b261ecSmrg}; 13105b261ecSmrg 13205b261ecSmrgstruct _rrOutput { 13305b261ecSmrg RROutput id; 13405b261ecSmrg ScreenPtr pScreen; 13505b261ecSmrg char *name; 13605b261ecSmrg int nameLength; 13705b261ecSmrg CARD8 connection; 13805b261ecSmrg CARD8 subpixelOrder; 13905b261ecSmrg int mmWidth; 14005b261ecSmrg int mmHeight; 14105b261ecSmrg RRCrtcPtr crtc; 14205b261ecSmrg int numCrtcs; 14305b261ecSmrg RRCrtcPtr *crtcs; 14405b261ecSmrg int numClones; 14505b261ecSmrg RROutputPtr *clones; 14605b261ecSmrg int numModes; 14705b261ecSmrg int numPreferred; 14805b261ecSmrg RRModePtr *modes; 14905b261ecSmrg int numUserModes; 15005b261ecSmrg RRModePtr *userModes; 15105b261ecSmrg Bool changed; 15205b261ecSmrg RRPropertyPtr properties; 15305b261ecSmrg Bool pendingProperties; 15405b261ecSmrg void *devPrivate; 15505b261ecSmrg}; 15605b261ecSmrg 15705b261ecSmrg#if RANDR_12_INTERFACE 15805b261ecSmrgtypedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen, 15905b261ecSmrg CARD16 width, 16005b261ecSmrg CARD16 height, 16105b261ecSmrg CARD32 mmWidth, 16205b261ecSmrg CARD32 mmHeight); 16305b261ecSmrg 16405b261ecSmrgtypedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen, 16505b261ecSmrg RRCrtcPtr crtc, 16605b261ecSmrg RRModePtr mode, 16705b261ecSmrg int x, 16805b261ecSmrg int y, 16905b261ecSmrg Rotation rotation, 17005b261ecSmrg int numOutputs, 17105b261ecSmrg RROutputPtr *outputs); 17205b261ecSmrg 17305b261ecSmrgtypedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, 17405b261ecSmrg RRCrtcPtr crtc); 17505b261ecSmrg 17605b261ecSmrgtypedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen, 17705b261ecSmrg RROutputPtr output, 17805b261ecSmrg Atom property, 17905b261ecSmrg RRPropertyValuePtr value); 18005b261ecSmrg 18105b261ecSmrgtypedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen, 18205b261ecSmrg RROutputPtr output, 18305b261ecSmrg RRModePtr mode); 18405b261ecSmrg 18505b261ecSmrgtypedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, 18605b261ecSmrg RRModePtr mode); 18705b261ecSmrg 18805b261ecSmrg#endif 18905b261ecSmrg 1904642e01fSmrg#if RANDR_13_INTERFACE 1914642e01fSmrgtypedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen, 1924642e01fSmrg RROutputPtr output, 1934642e01fSmrg Atom property); 1944642e01fSmrgtypedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn, 1954642e01fSmrg RRCrtcPtr crtc, 1964642e01fSmrg BoxPtr totalArea, 1974642e01fSmrg BoxPtr trackingArea, 1984642e01fSmrg INT16 *border); 1994642e01fSmrgtypedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn, 2004642e01fSmrg RRCrtcPtr crtc, 2014642e01fSmrg BoxPtr totalArea, 2024642e01fSmrg BoxPtr trackingArea, 2034642e01fSmrg INT16 *border); 2044642e01fSmrg 2054642e01fSmrg#endif /* RANDR_13_INTERFACE */ 2064642e01fSmrg 20705b261ecSmrgtypedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); 20805b261ecSmrgtypedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen); 20905b261ecSmrg 21005b261ecSmrg/* These are for 1.0 compatibility */ 21105b261ecSmrg 21205b261ecSmrgtypedef struct _rrRefresh { 21305b261ecSmrg CARD16 rate; 21405b261ecSmrg RRModePtr mode; 21505b261ecSmrg} RRScreenRate, *RRScreenRatePtr; 21605b261ecSmrg 21705b261ecSmrgtypedef struct _rrScreenSize { 21805b261ecSmrg int id; 21905b261ecSmrg short width, height; 22005b261ecSmrg short mmWidth, mmHeight; 22105b261ecSmrg int nRates; 22205b261ecSmrg RRScreenRatePtr pRates; 22305b261ecSmrg} RRScreenSize, *RRScreenSizePtr; 22405b261ecSmrg 22505b261ecSmrg#ifdef RANDR_10_INTERFACE 22605b261ecSmrg 22705b261ecSmrgtypedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen, 22805b261ecSmrg Rotation rotation, 22905b261ecSmrg int rate, 23005b261ecSmrg RRScreenSizePtr pSize); 23105b261ecSmrg 23205b261ecSmrg#endif 23305b261ecSmrg 23405b261ecSmrg 23505b261ecSmrgtypedef struct _rrScrPriv { 23605b261ecSmrg /* 23705b261ecSmrg * 'public' part of the structure; DDXen fill this in 23805b261ecSmrg * as they initialize 23905b261ecSmrg */ 24005b261ecSmrg#if RANDR_10_INTERFACE 24105b261ecSmrg RRSetConfigProcPtr rrSetConfig; 24205b261ecSmrg#endif 24305b261ecSmrg RRGetInfoProcPtr rrGetInfo; 24405b261ecSmrg#if RANDR_12_INTERFACE 24505b261ecSmrg RRScreenSetSizeProcPtr rrScreenSetSize; 24605b261ecSmrg RRCrtcSetProcPtr rrCrtcSet; 24705b261ecSmrg RRCrtcSetGammaProcPtr rrCrtcSetGamma; 24805b261ecSmrg RROutputSetPropertyProcPtr rrOutputSetProperty; 24905b261ecSmrg RROutputValidateModeProcPtr rrOutputValidateMode; 25005b261ecSmrg RRModeDestroyProcPtr rrModeDestroy; 25105b261ecSmrg#endif 2524642e01fSmrg#if RANDR_13_INTERFACE 2534642e01fSmrg RROutputGetPropertyProcPtr rrOutputGetProperty; 2544642e01fSmrg RRGetPanningProcPtr rrGetPanning; 2554642e01fSmrg RRSetPanningProcPtr rrSetPanning; 2564642e01fSmrg#endif 25705b261ecSmrg 25805b261ecSmrg /* 25905b261ecSmrg * Private part of the structure; not considered part of the ABI 26005b261ecSmrg */ 26105b261ecSmrg TimeStamp lastSetTime; /* last changed by client */ 26205b261ecSmrg TimeStamp lastConfigTime; /* possible configs changed */ 26305b261ecSmrg RRCloseScreenProcPtr CloseScreen; 26405b261ecSmrg 26505b261ecSmrg Bool changed; /* some config changed */ 26605b261ecSmrg Bool configChanged; /* configuration changed */ 26705b261ecSmrg Bool layoutChanged; /* screen layout changed */ 26805b261ecSmrg 26905b261ecSmrg CARD16 minWidth, minHeight; 27005b261ecSmrg CARD16 maxWidth, maxHeight; 27105b261ecSmrg CARD16 width, height; /* last known screen size */ 27205b261ecSmrg CARD16 mmWidth, mmHeight; /* last known screen size */ 27305b261ecSmrg 27405b261ecSmrg int numOutputs; 27505b261ecSmrg RROutputPtr *outputs; 2764642e01fSmrg RROutputPtr primaryOutput; 27705b261ecSmrg 27805b261ecSmrg int numCrtcs; 27905b261ecSmrg RRCrtcPtr *crtcs; 28005b261ecSmrg 28105b261ecSmrg /* Last known pointer position */ 28205b261ecSmrg RRCrtcPtr pointerCrtc; 28305b261ecSmrg 28405b261ecSmrg#ifdef RANDR_10_INTERFACE 28505b261ecSmrg /* 28605b261ecSmrg * Configuration information 28705b261ecSmrg */ 28805b261ecSmrg Rotation rotations; 28905b261ecSmrg CARD16 reqWidth, reqHeight; 29005b261ecSmrg 29105b261ecSmrg int nSizes; 29205b261ecSmrg RRScreenSizePtr pSizes; 29305b261ecSmrg 29405b261ecSmrg Rotation rotation; 29505b261ecSmrg int rate; 29605b261ecSmrg int size; 29705b261ecSmrg#endif 29805b261ecSmrg} rrScrPrivRec, *rrScrPrivPtr; 29905b261ecSmrg 3004642e01fSmrgextern DevPrivateKey rrPrivKey; 30105b261ecSmrg 3024642e01fSmrg#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey)) 30305b261ecSmrg#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) 3044642e01fSmrg#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p) 30505b261ecSmrg 30605b261ecSmrg/* 30705b261ecSmrg * each window has a list of clients requesting 30805b261ecSmrg * RRNotify events. Each client has a resource 30905b261ecSmrg * for each window it selects RRNotify input for, 31005b261ecSmrg * this resource is used to delete the RRNotifyRec 31105b261ecSmrg * entry from the per-window queue. 31205b261ecSmrg */ 31305b261ecSmrg 31405b261ecSmrgtypedef struct _RREvent *RREventPtr; 31505b261ecSmrg 31605b261ecSmrgtypedef struct _RREvent { 31705b261ecSmrg RREventPtr next; 31805b261ecSmrg ClientPtr client; 31905b261ecSmrg WindowPtr window; 32005b261ecSmrg XID clientResource; 32105b261ecSmrg int mask; 32205b261ecSmrg} RREventRec; 32305b261ecSmrg 32405b261ecSmrgtypedef struct _RRTimes { 32505b261ecSmrg TimeStamp setTime; 32605b261ecSmrg TimeStamp configTime; 32705b261ecSmrg} RRTimesRec, *RRTimesPtr; 32805b261ecSmrg 32905b261ecSmrgtypedef struct _RRClient { 33005b261ecSmrg int major_version; 33105b261ecSmrg int minor_version; 33205b261ecSmrg/* RRTimesRec times[0]; */ 33305b261ecSmrg} RRClientRec, *RRClientPtr; 33405b261ecSmrg 33505b261ecSmrgextern RESTYPE RRClientType, RREventType; /* resource types for event masks */ 3364642e01fSmrgextern DevPrivateKey RRClientPrivateKey; 33705b261ecSmrgextern RESTYPE RRCrtcType, RRModeType, RROutputType; 33805b261ecSmrg 33905b261ecSmrg#define LookupOutput(client,id,a) ((RROutputPtr) \ 34005b261ecSmrg (SecurityLookupIDByType (client, id, \ 34105b261ecSmrg RROutputType, a))) 34205b261ecSmrg#define LookupCrtc(client,id,a) ((RRCrtcPtr) \ 34305b261ecSmrg (SecurityLookupIDByType (client, id, \ 34405b261ecSmrg RRCrtcType, a))) 34505b261ecSmrg#define LookupMode(client,id,a) ((RRModePtr) \ 34605b261ecSmrg (SecurityLookupIDByType (client, id, \ 34705b261ecSmrg RRModeType, a))) 34805b261ecSmrg 3494642e01fSmrg#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey)) 35005b261ecSmrg#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient) 35105b261ecSmrg 35205b261ecSmrg/* Initialize the extension */ 35305b261ecSmrgvoid 35405b261ecSmrgRRExtensionInit (void); 35505b261ecSmrg 35605b261ecSmrg#ifdef RANDR_12_INTERFACE 35705b261ecSmrg/* 35805b261ecSmrg * Set the range of sizes for the screen 35905b261ecSmrg */ 36005b261ecSmrgvoid 36105b261ecSmrgRRScreenSetSizeRange (ScreenPtr pScreen, 36205b261ecSmrg CARD16 minWidth, 36305b261ecSmrg CARD16 minHeight, 36405b261ecSmrg CARD16 maxWidth, 36505b261ecSmrg CARD16 maxHeight); 36605b261ecSmrg#endif 36705b261ecSmrg 36805b261ecSmrg/* rrscreen.c */ 36905b261ecSmrg/* 37005b261ecSmrg * Notify the extension that the screen size has been changed. 37105b261ecSmrg * The driver is responsible for calling this whenever it has changed 37205b261ecSmrg * the size of the screen 37305b261ecSmrg */ 37405b261ecSmrgvoid 37505b261ecSmrgRRScreenSizeNotify (ScreenPtr pScreen); 37605b261ecSmrg 37705b261ecSmrg/* 37805b261ecSmrg * Request that the screen be resized 37905b261ecSmrg */ 38005b261ecSmrgBool 38105b261ecSmrgRRScreenSizeSet (ScreenPtr pScreen, 38205b261ecSmrg CARD16 width, 38305b261ecSmrg CARD16 height, 38405b261ecSmrg CARD32 mmWidth, 38505b261ecSmrg CARD32 mmHeight); 38605b261ecSmrg 38705b261ecSmrg/* 38805b261ecSmrg * Send ConfigureNotify event to root window when 'something' happens 38905b261ecSmrg */ 39005b261ecSmrgvoid 39105b261ecSmrgRRSendConfigNotify (ScreenPtr pScreen); 39205b261ecSmrg 39305b261ecSmrg/* 39405b261ecSmrg * screen dispatch 39505b261ecSmrg */ 39605b261ecSmrgint 39705b261ecSmrgProcRRGetScreenSizeRange (ClientPtr client); 39805b261ecSmrg 39905b261ecSmrgint 40005b261ecSmrgProcRRSetScreenSize (ClientPtr client); 40105b261ecSmrg 40205b261ecSmrgint 40305b261ecSmrgProcRRGetScreenResources (ClientPtr client); 40405b261ecSmrg 4054642e01fSmrgint 4064642e01fSmrgProcRRGetScreenResourcesCurrent (ClientPtr client); 4074642e01fSmrg 40805b261ecSmrgint 40905b261ecSmrgProcRRSetScreenConfig (ClientPtr client); 41005b261ecSmrg 41105b261ecSmrgint 41205b261ecSmrgProcRRGetScreenInfo (ClientPtr client); 41305b261ecSmrg 41405b261ecSmrg/* 41505b261ecSmrg * Deliver a ScreenNotify event 41605b261ecSmrg */ 41705b261ecSmrgvoid 41805b261ecSmrgRRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen); 41905b261ecSmrg 42005b261ecSmrg/* mirandr.c */ 42105b261ecSmrgBool 42205b261ecSmrgmiRandRInit (ScreenPtr pScreen); 42305b261ecSmrg 42405b261ecSmrgBool 42505b261ecSmrgmiRRGetInfo (ScreenPtr pScreen, Rotation *rotations); 42605b261ecSmrg 42705b261ecSmrgBool 42805b261ecSmrgmiRRGetScreenInfo (ScreenPtr pScreen); 42905b261ecSmrg 43005b261ecSmrgBool 43105b261ecSmrgmiRRCrtcSet (ScreenPtr pScreen, 43205b261ecSmrg RRCrtcPtr crtc, 43305b261ecSmrg RRModePtr mode, 43405b261ecSmrg int x, 43505b261ecSmrg int y, 43605b261ecSmrg Rotation rotation, 43705b261ecSmrg int numOutput, 43805b261ecSmrg RROutputPtr *outputs); 43905b261ecSmrg 44005b261ecSmrgBool 44105b261ecSmrgmiRROutputSetProperty (ScreenPtr pScreen, 44205b261ecSmrg RROutputPtr output, 44305b261ecSmrg Atom property, 44405b261ecSmrg RRPropertyValuePtr value); 44505b261ecSmrg 4464642e01fSmrgBool 4474642e01fSmrgmiRROutputGetProperty (ScreenPtr pScreen, 4484642e01fSmrg RROutputPtr output, 4494642e01fSmrg Atom property); 4504642e01fSmrg 45105b261ecSmrgBool 45205b261ecSmrgmiRROutputValidateMode (ScreenPtr pScreen, 45305b261ecSmrg RROutputPtr output, 45405b261ecSmrg RRModePtr mode); 45505b261ecSmrg 45605b261ecSmrgvoid 45705b261ecSmrgmiRRModeDestroy (ScreenPtr pScreen, 45805b261ecSmrg RRModePtr mode); 45905b261ecSmrg 46005b261ecSmrg/* randr.c */ 46105b261ecSmrg/* 46205b261ecSmrg * Send all pending events 46305b261ecSmrg */ 46405b261ecSmrgvoid 46505b261ecSmrgRRTellChanged (ScreenPtr pScreen); 46605b261ecSmrg 46705b261ecSmrg/* 46805b261ecSmrg * Poll the driver for changed information 46905b261ecSmrg */ 47005b261ecSmrgBool 4714642e01fSmrgRRGetInfo (ScreenPtr pScreen, Bool force_query); 47205b261ecSmrg 47305b261ecSmrgBool RRInit (void); 47405b261ecSmrg 47505b261ecSmrgBool RRScreenInit(ScreenPtr pScreen); 47605b261ecSmrg 47705b261ecSmrgRROutputPtr 47805b261ecSmrgRRFirstOutput (ScreenPtr pScreen); 47905b261ecSmrg 48005b261ecSmrgRotation 48105b261ecSmrgRRGetRotation (ScreenPtr pScreen); 48205b261ecSmrg 48305b261ecSmrgCARD16 48405b261ecSmrgRRVerticalRefresh (xRRModeInfo *mode); 48505b261ecSmrg 48605b261ecSmrg#ifdef RANDR_10_INTERFACE 48705b261ecSmrg/* 48805b261ecSmrg * This is the old interface, deprecated but left 48905b261ecSmrg * around for compatibility 49005b261ecSmrg */ 49105b261ecSmrg 49205b261ecSmrg/* 49305b261ecSmrg * Then, register the specific size with the screen 49405b261ecSmrg */ 49505b261ecSmrg 49605b261ecSmrgRRScreenSizePtr 49705b261ecSmrgRRRegisterSize (ScreenPtr pScreen, 49805b261ecSmrg short width, 49905b261ecSmrg short height, 50005b261ecSmrg short mmWidth, 50105b261ecSmrg short mmHeight); 50205b261ecSmrg 50305b261ecSmrgBool RRRegisterRate (ScreenPtr pScreen, 50405b261ecSmrg RRScreenSizePtr pSize, 50505b261ecSmrg int rate); 50605b261ecSmrg 50705b261ecSmrg/* 50805b261ecSmrg * Finally, set the current configuration of the screen 50905b261ecSmrg */ 51005b261ecSmrg 51105b261ecSmrgvoid 51205b261ecSmrgRRSetCurrentConfig (ScreenPtr pScreen, 51305b261ecSmrg Rotation rotation, 51405b261ecSmrg int rate, 51505b261ecSmrg RRScreenSizePtr pSize); 51605b261ecSmrg 51705b261ecSmrgBool RRScreenInit (ScreenPtr pScreen); 51805b261ecSmrg 51905b261ecSmrgRotation 52005b261ecSmrgRRGetRotation (ScreenPtr pScreen); 52105b261ecSmrg 52205b261ecSmrgint 52305b261ecSmrgRRSetScreenConfig (ScreenPtr pScreen, 52405b261ecSmrg Rotation rotation, 52505b261ecSmrg int rate, 52605b261ecSmrg RRScreenSizePtr pSize); 52705b261ecSmrg 52805b261ecSmrg#endif 52905b261ecSmrg 53005b261ecSmrg/* rrcrtc.c */ 53105b261ecSmrg 53205b261ecSmrg/* 53305b261ecSmrg * Notify the CRTC of some change; layoutChanged indicates that 53405b261ecSmrg * some position or size element changed 53505b261ecSmrg */ 53605b261ecSmrgvoid 53705b261ecSmrgRRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged); 53805b261ecSmrg 53905b261ecSmrg/* 54005b261ecSmrg * Create a CRTC 54105b261ecSmrg */ 54205b261ecSmrgRRCrtcPtr 54305b261ecSmrgRRCrtcCreate (ScreenPtr pScreen, void *devPrivate); 54405b261ecSmrg 54505b261ecSmrg/* 54605b261ecSmrg * Set the allowed rotations on a CRTC 54705b261ecSmrg */ 54805b261ecSmrgvoid 54905b261ecSmrgRRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations); 55005b261ecSmrg 5514642e01fSmrg/* 5524642e01fSmrg * Set whether transforms are allowed on a CRTC 5534642e01fSmrg */ 5544642e01fSmrgvoid 5554642e01fSmrgRRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms); 5564642e01fSmrg 55705b261ecSmrg/* 55805b261ecSmrg * Notify the extension that the Crtc has been reconfigured, 55905b261ecSmrg * the driver calls this whenever it has updated the mode 56005b261ecSmrg */ 56105b261ecSmrgBool 56205b261ecSmrgRRCrtcNotify (RRCrtcPtr crtc, 56305b261ecSmrg RRModePtr mode, 56405b261ecSmrg int x, 56505b261ecSmrg int y, 56605b261ecSmrg Rotation rotation, 5674642e01fSmrg RRTransformPtr transform, 56805b261ecSmrg int numOutputs, 56905b261ecSmrg RROutputPtr *outputs); 57005b261ecSmrg 57105b261ecSmrgvoid 57205b261ecSmrgRRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc); 57305b261ecSmrg 57405b261ecSmrg/* 57505b261ecSmrg * Request that the Crtc be reconfigured 57605b261ecSmrg */ 57705b261ecSmrgBool 57805b261ecSmrgRRCrtcSet (RRCrtcPtr crtc, 57905b261ecSmrg RRModePtr mode, 58005b261ecSmrg int x, 58105b261ecSmrg int y, 58205b261ecSmrg Rotation rotation, 58305b261ecSmrg int numOutput, 58405b261ecSmrg RROutputPtr *outputs); 58505b261ecSmrg 58605b261ecSmrg/* 58705b261ecSmrg * Request that the Crtc gamma be changed 58805b261ecSmrg */ 58905b261ecSmrg 59005b261ecSmrgBool 59105b261ecSmrgRRCrtcGammaSet (RRCrtcPtr crtc, 59205b261ecSmrg CARD16 *red, 59305b261ecSmrg CARD16 *green, 59405b261ecSmrg CARD16 *blue); 59505b261ecSmrg 59605b261ecSmrg/* 59705b261ecSmrg * Notify the extension that the Crtc gamma has been changed 59805b261ecSmrg * The driver calls this whenever it has changed the gamma values 59905b261ecSmrg * in the RRCrtcRec 60005b261ecSmrg */ 60105b261ecSmrg 60205b261ecSmrgBool 60305b261ecSmrgRRCrtcGammaNotify (RRCrtcPtr crtc); 60405b261ecSmrg 60505b261ecSmrg/* 60605b261ecSmrg * Set the size of the gamma table at server startup time 60705b261ecSmrg */ 60805b261ecSmrg 60905b261ecSmrgBool 61005b261ecSmrgRRCrtcGammaSetSize (RRCrtcPtr crtc, 61105b261ecSmrg int size); 61205b261ecSmrg 61305b261ecSmrg/* 61405b261ecSmrg * Return the area of the frame buffer scanned out by the crtc, 61505b261ecSmrg * taking into account the current mode and rotation 61605b261ecSmrg */ 61705b261ecSmrg 61805b261ecSmrgvoid 61905b261ecSmrgRRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height); 62005b261ecSmrg 6214642e01fSmrg/* 6224642e01fSmrg * Compute the complete transformation matrix including 6234642e01fSmrg * client-specified transform, rotation/reflection values and the crtc 6244642e01fSmrg * offset. 6254642e01fSmrg * 6264642e01fSmrg * Return TRUE if the resulting transform is not a simple translation. 6274642e01fSmrg */ 6284642e01fSmrgBool 6294642e01fSmrgRRTransformCompute (int x, 6304642e01fSmrg int y, 6314642e01fSmrg int width, 6324642e01fSmrg int height, 6334642e01fSmrg Rotation rotation, 6344642e01fSmrg RRTransformPtr rr_transform, 6354642e01fSmrg 6364642e01fSmrg PictTransformPtr transform, 6374642e01fSmrg struct pict_f_transform *f_transform, 6384642e01fSmrg struct pict_f_transform *f_inverse); 6394642e01fSmrg 6404642e01fSmrg/* 6414642e01fSmrg * Return crtc transform 6424642e01fSmrg */ 6434642e01fSmrgRRTransformPtr 6444642e01fSmrgRRCrtcGetTransform (RRCrtcPtr crtc); 6454642e01fSmrg 6464642e01fSmrg/* 6474642e01fSmrg * Check whether the pending and current transforms are the same 6484642e01fSmrg */ 6494642e01fSmrgBool 6504642e01fSmrgRRCrtcPendingTransform (RRCrtcPtr crtc); 6514642e01fSmrg 65205b261ecSmrg/* 65305b261ecSmrg * Destroy a Crtc at shutdown 65405b261ecSmrg */ 65505b261ecSmrgvoid 65605b261ecSmrgRRCrtcDestroy (RRCrtcPtr crtc); 65705b261ecSmrg 6584642e01fSmrg 6594642e01fSmrg/* 6604642e01fSmrg * Set the pending CRTC transformation 6614642e01fSmrg */ 6624642e01fSmrg 6634642e01fSmrgint 6644642e01fSmrgRRCrtcTransformSet (RRCrtcPtr crtc, 6654642e01fSmrg PictTransformPtr transform, 6664642e01fSmrg struct pict_f_transform *f_transform, 6674642e01fSmrg struct pict_f_transform *f_inverse, 6684642e01fSmrg char *filter, 6694642e01fSmrg int filter_len, 6704642e01fSmrg xFixed *params, 6714642e01fSmrg int nparams); 6724642e01fSmrg 67305b261ecSmrg/* 67405b261ecSmrg * Initialize crtc type 67505b261ecSmrg */ 67605b261ecSmrgBool 67705b261ecSmrgRRCrtcInit (void); 67805b261ecSmrg 67905b261ecSmrg/* 68005b261ecSmrg * Crtc dispatch 68105b261ecSmrg */ 68205b261ecSmrg 68305b261ecSmrgint 68405b261ecSmrgProcRRGetCrtcInfo (ClientPtr client); 68505b261ecSmrg 68605b261ecSmrgint 68705b261ecSmrgProcRRSetCrtcConfig (ClientPtr client); 68805b261ecSmrg 68905b261ecSmrgint 69005b261ecSmrgProcRRGetCrtcGammaSize (ClientPtr client); 69105b261ecSmrg 69205b261ecSmrgint 69305b261ecSmrgProcRRGetCrtcGamma (ClientPtr client); 69405b261ecSmrg 69505b261ecSmrgint 69605b261ecSmrgProcRRSetCrtcGamma (ClientPtr client); 69705b261ecSmrg 6984642e01fSmrgint 6994642e01fSmrgProcRRSetCrtcTransform (ClientPtr client); 7004642e01fSmrg 7014642e01fSmrgint 7024642e01fSmrgProcRRGetCrtcTransform (ClientPtr client); 7034642e01fSmrg 7044642e01fSmrgint 7054642e01fSmrgProcRRGetPanning (ClientPtr client); 7064642e01fSmrg 7074642e01fSmrgint 7084642e01fSmrgProcRRSetPanning (ClientPtr client); 7094642e01fSmrg 71005b261ecSmrg/* rrdispatch.c */ 71105b261ecSmrgBool 71205b261ecSmrgRRClientKnowsRates (ClientPtr pClient); 71305b261ecSmrg 71405b261ecSmrg/* rrmode.c */ 71505b261ecSmrg/* 71605b261ecSmrg * Find, and if necessary, create a mode 71705b261ecSmrg */ 71805b261ecSmrg 71905b261ecSmrgRRModePtr 72005b261ecSmrgRRModeGet (xRRModeInfo *modeInfo, 72105b261ecSmrg const char *name); 72205b261ecSmrg 72305b261ecSmrgvoid 72405b261ecSmrgRRModePruneUnused (ScreenPtr pScreen); 72505b261ecSmrg 72605b261ecSmrg/* 72705b261ecSmrg * Destroy a mode. 72805b261ecSmrg */ 72905b261ecSmrg 73005b261ecSmrgvoid 73105b261ecSmrgRRModeDestroy (RRModePtr mode); 73205b261ecSmrg 73305b261ecSmrg/* 73405b261ecSmrg * Return a list of modes that are valid for some output in pScreen 73505b261ecSmrg */ 73605b261ecSmrgRRModePtr * 73705b261ecSmrgRRModesForScreen (ScreenPtr pScreen, int *num_ret); 73805b261ecSmrg 73905b261ecSmrg/* 74005b261ecSmrg * Initialize mode type 74105b261ecSmrg */ 74205b261ecSmrgBool 74305b261ecSmrgRRModeInit (void); 74405b261ecSmrg 74505b261ecSmrgint 74605b261ecSmrgProcRRCreateMode (ClientPtr client); 74705b261ecSmrg 74805b261ecSmrgint 74905b261ecSmrgProcRRDestroyMode (ClientPtr client); 75005b261ecSmrg 75105b261ecSmrgint 75205b261ecSmrgProcRRAddOutputMode (ClientPtr client); 75305b261ecSmrg 75405b261ecSmrgint 75505b261ecSmrgProcRRDeleteOutputMode (ClientPtr client); 75605b261ecSmrg 75705b261ecSmrg/* rroutput.c */ 75805b261ecSmrg 75905b261ecSmrg/* 76005b261ecSmrg * Notify the output of some change. configChanged indicates whether 76105b261ecSmrg * any external configuration (mode list, clones, connected status) 76205b261ecSmrg * has changed, or whether the change was strictly internal 76305b261ecSmrg * (which crtc is in use) 76405b261ecSmrg */ 76505b261ecSmrgvoid 76605b261ecSmrgRROutputChanged (RROutputPtr output, Bool configChanged); 76705b261ecSmrg 76805b261ecSmrg/* 76905b261ecSmrg * Create an output 77005b261ecSmrg */ 77105b261ecSmrg 77205b261ecSmrgRROutputPtr 77305b261ecSmrgRROutputCreate (ScreenPtr pScreen, 77405b261ecSmrg const char *name, 77505b261ecSmrg int nameLength, 77605b261ecSmrg void *devPrivate); 77705b261ecSmrg 77805b261ecSmrg/* 77905b261ecSmrg * Notify extension that output parameters have been changed 78005b261ecSmrg */ 78105b261ecSmrgBool 78205b261ecSmrgRROutputSetClones (RROutputPtr output, 78305b261ecSmrg RROutputPtr *clones, 78405b261ecSmrg int numClones); 78505b261ecSmrg 78605b261ecSmrgBool 78705b261ecSmrgRROutputSetModes (RROutputPtr output, 78805b261ecSmrg RRModePtr *modes, 78905b261ecSmrg int numModes, 79005b261ecSmrg int numPreferred); 79105b261ecSmrg 79205b261ecSmrgint 79305b261ecSmrgRROutputAddUserMode (RROutputPtr output, 79405b261ecSmrg RRModePtr mode); 79505b261ecSmrg 79605b261ecSmrgint 79705b261ecSmrgRROutputDeleteUserMode (RROutputPtr output, 79805b261ecSmrg RRModePtr mode); 79905b261ecSmrg 80005b261ecSmrgBool 80105b261ecSmrgRROutputSetCrtcs (RROutputPtr output, 80205b261ecSmrg RRCrtcPtr *crtcs, 80305b261ecSmrg int numCrtcs); 80405b261ecSmrg 80505b261ecSmrgBool 80605b261ecSmrgRROutputSetConnection (RROutputPtr output, 80705b261ecSmrg CARD8 connection); 80805b261ecSmrg 80905b261ecSmrgBool 81005b261ecSmrgRROutputSetSubpixelOrder (RROutputPtr output, 81105b261ecSmrg int subpixelOrder); 81205b261ecSmrg 81305b261ecSmrgBool 81405b261ecSmrgRROutputSetPhysicalSize (RROutputPtr output, 81505b261ecSmrg int mmWidth, 81605b261ecSmrg int mmHeight); 81705b261ecSmrg 81805b261ecSmrgvoid 81905b261ecSmrgRRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output); 82005b261ecSmrg 82105b261ecSmrgvoid 82205b261ecSmrgRROutputDestroy (RROutputPtr output); 82305b261ecSmrg 82405b261ecSmrgint 82505b261ecSmrgProcRRGetOutputInfo (ClientPtr client); 82605b261ecSmrg 8274642e01fSmrgextern int 8284642e01fSmrgProcRRSetOutputPrimary (ClientPtr client); 8294642e01fSmrg 8304642e01fSmrgextern int 8314642e01fSmrgProcRRGetOutputPrimary (ClientPtr client); 8324642e01fSmrg 83305b261ecSmrg/* 83405b261ecSmrg * Initialize output type 83505b261ecSmrg */ 83605b261ecSmrgBool 83705b261ecSmrgRROutputInit (void); 83805b261ecSmrg 83905b261ecSmrg/* rrpointer.c */ 84005b261ecSmrgvoid 84105b261ecSmrgRRPointerMoved (ScreenPtr pScreen, int x, int y); 84205b261ecSmrg 84305b261ecSmrgvoid 84405b261ecSmrgRRPointerScreenConfigured (ScreenPtr pScreen); 84505b261ecSmrg 84605b261ecSmrg/* rrproperty.c */ 84705b261ecSmrg 84805b261ecSmrgvoid 84905b261ecSmrgRRDeleteAllOutputProperties (RROutputPtr output); 85005b261ecSmrg 85105b261ecSmrgRRPropertyValuePtr 85205b261ecSmrgRRGetOutputProperty (RROutputPtr output, Atom property, Bool pending); 85305b261ecSmrg 85405b261ecSmrgRRPropertyPtr 85505b261ecSmrgRRQueryOutputProperty (RROutputPtr output, Atom property); 85605b261ecSmrg 85705b261ecSmrgvoid 85805b261ecSmrgRRDeleteOutputProperty (RROutputPtr output, Atom property); 85905b261ecSmrg 86005b261ecSmrgBool 86105b261ecSmrgRRPostPendingProperties (RROutputPtr output); 86205b261ecSmrg 86305b261ecSmrgint 86405b261ecSmrgRRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, 86505b261ecSmrg int format, int mode, unsigned long len, 86605b261ecSmrg pointer value, Bool sendevent, Bool pending); 86705b261ecSmrg 86805b261ecSmrgint 86905b261ecSmrgRRConfigureOutputProperty (RROutputPtr output, Atom property, 87005b261ecSmrg Bool pending, Bool range, Bool immutable, 87105b261ecSmrg int num_values, INT32 *values); 87205b261ecSmrgint 87305b261ecSmrgProcRRChangeOutputProperty (ClientPtr client); 87405b261ecSmrg 87505b261ecSmrgint 87605b261ecSmrgProcRRGetOutputProperty (ClientPtr client); 87705b261ecSmrg 87805b261ecSmrgint 87905b261ecSmrgProcRRListOutputProperties (ClientPtr client); 88005b261ecSmrg 88105b261ecSmrgint 88205b261ecSmrgProcRRQueryOutputProperty (ClientPtr client); 88305b261ecSmrg 88405b261ecSmrgint 88505b261ecSmrgProcRRConfigureOutputProperty (ClientPtr client); 88605b261ecSmrg 88705b261ecSmrgint 88805b261ecSmrgProcRRDeleteOutputProperty (ClientPtr client); 88905b261ecSmrg 89005b261ecSmrg/* rrxinerama.c */ 89105b261ecSmrgvoid 89205b261ecSmrgRRXineramaExtensionInit(void); 89305b261ecSmrg 89405b261ecSmrg#endif /* _RANDRSTR_H_ */ 89505b261ecSmrg 89605b261ecSmrg/* 89705b261ecSmrg 89805b261ecSmrgrandr extension implementation structure 89905b261ecSmrg 90005b261ecSmrgQuery state: 90105b261ecSmrg ProcRRGetScreenInfo/ProcRRGetScreenResources 90205b261ecSmrg RRGetInfo 90305b261ecSmrg 90405b261ecSmrg • Request configuration from driver, either 1.0 or 1.2 style 90505b261ecSmrg • These functions only record state changes, all 90605b261ecSmrg other actions are pended until RRTellChanged is called 90705b261ecSmrg 90805b261ecSmrg ->rrGetInfo 90905b261ecSmrg 1.0: 91005b261ecSmrg RRRegisterSize 91105b261ecSmrg RRRegisterRate 91205b261ecSmrg RRSetCurrentConfig 91305b261ecSmrg 1.2: 91405b261ecSmrg RRScreenSetSizeRange 91505b261ecSmrg RROutputSetCrtcs 91605b261ecSmrg RRModeGet 91705b261ecSmrg RROutputSetModes 91805b261ecSmrg RROutputSetConnection 91905b261ecSmrg RROutputSetSubpixelOrder 92005b261ecSmrg RROutputSetClones 92105b261ecSmrg RRCrtcNotify 92205b261ecSmrg 92305b261ecSmrg • Must delay scanning configuration until after ->rrGetInfo returns 92405b261ecSmrg because some drivers will call SetCurrentConfig in the middle 92505b261ecSmrg of the ->rrGetInfo operation. 92605b261ecSmrg 92705b261ecSmrg 1.0: 92805b261ecSmrg 92905b261ecSmrg • Scan old configuration, mirror to new structures 93005b261ecSmrg 93105b261ecSmrg RRScanOldConfig 93205b261ecSmrg RRCrtcCreate 93305b261ecSmrg RROutputCreate 93405b261ecSmrg RROutputSetCrtcs 93505b261ecSmrg RROutputSetConnection 93605b261ecSmrg RROutputSetSubpixelOrder 93705b261ecSmrg RROldModeAdd • This adds modes one-at-a-time 93805b261ecSmrg RRModeGet 93905b261ecSmrg RRCrtcNotify 94005b261ecSmrg 94105b261ecSmrg • send events, reset pointer if necessary 94205b261ecSmrg 94305b261ecSmrg RRTellChanged 94405b261ecSmrg WalkTree (sending events) 94505b261ecSmrg 94605b261ecSmrg • when layout has changed: 94705b261ecSmrg RRPointerScreenConfigured 94805b261ecSmrg RRSendConfigNotify 94905b261ecSmrg 95005b261ecSmrgAsynchronous state setting (1.2 only) 95105b261ecSmrg When setting state asynchronously, the driver invokes the 95205b261ecSmrg ->rrGetInfo function and then calls RRTellChanged to flush 95305b261ecSmrg the changes to the clients and reset pointer if necessary 95405b261ecSmrg 95505b261ecSmrgSet state 95605b261ecSmrg 95705b261ecSmrg ProcRRSetScreenConfig 95805b261ecSmrg RRCrtcSet 95905b261ecSmrg 1.2: 96005b261ecSmrg ->rrCrtcSet 96105b261ecSmrg RRCrtcNotify 96205b261ecSmrg 1.0: 96305b261ecSmrg ->rrSetConfig 96405b261ecSmrg RRCrtcNotify 96505b261ecSmrg RRTellChanged 96605b261ecSmrg */ 967