From 27ca1c17aab30670dd1d07e0809fd58cdecfc3b6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 30 Nov 2006 11:39:37 -0800 Subject: Rename I830 randr functions to xf86 as they are becoming generic. Change function names, create separate i830_randr.h header file to contain definitions. --- src/i830.h | 10 +---- src/i830_driver.c | 9 ++-- src/i830_modes.c | 2 +- src/i830_randr.c | 120 ++++++++++++++++++++++++++++++------------------------ src/i830_randr.h | 37 +++++++++++++++++ src/i830_rotate.c | 2 +- 6 files changed, 112 insertions(+), 68 deletions(-) create mode 100644 src/i830_randr.h diff --git a/src/i830.h b/src/i830.h index e88cd430..1b0b305a 100644 --- a/src/i830.h +++ b/src/i830.h @@ -60,6 +60,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vgaHW.h" #include "randrstr.h" #include "i830_xf86Crtc.h" +#include "i830_randr.h" #ifdef XF86DRI #include "xf86drm.h" @@ -606,15 +607,6 @@ void i830_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn); void i830_set_default_screen_size(ScrnInfoPtr pScrn); DisplayModePtr i830_ddc_get_modes(xf86OutputPtr output); -/* i830_randr.c */ -Bool I830RandRCreateScreenResources (ScreenPtr pScreen); -Bool I830RandRInit(ScreenPtr pScreen, int rotation); -Bool I830RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, - RRScreenSizePtr pSize); -Rotation I830GetRotation(ScreenPtr pScreen); -void I830GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); -Bool I830RandRPreInit (ScrnInfoPtr pScrn); - /* i830_tv.c */ void i830_tv_init(ScrnInfoPtr pScrn); diff --git a/src/i830_driver.c b/src/i830_driver.c index 50a5da05..6b7439aa 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1585,7 +1585,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Maximum frambuffer space: %d kByte\n", pScrn->videoRam); - if (!I830RandRPreInit (pScrn)) + if (!xf86RandRPreInit (pScrn)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); PreInitCleanup(pScrn); @@ -2614,7 +2614,7 @@ I830CreateScreenResources (ScreenPtr pScreen) if (!(*pScreen->CreateScreenResources)(pScreen)) return FALSE; - if (!I830RandRCreateScreenResources (pScreen)) + if (!xf86RandRCreateScreenResources (pScreen)) return FALSE; return TRUE; @@ -3157,10 +3157,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DisableRandR(); /* Disable built-in RandR extension */ shadowSetup(pScreen); /* support all rotations */ + xf86RandRInit (pScreen); if (IS_I965G(pI830)) { - I830RandRInit(pScreen, RR_Rotate_0); /* only 0 degrees for I965G */ + xf86RandRSetRotations (pScreen, RR_Rotate_0); /* only 0 degrees for I965G */ } else { - I830RandRInit(pScreen, RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270); + xf86RandRSetRotations (pScreen, RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270); } pI830->PointerMoved = pScrn->PointerMoved; pScrn->PointerMoved = I830PointerMoved; diff --git a/src/i830_modes.c b/src/i830_modes.c index 19ea05c7..7b487943 100644 --- a/src/i830_modes.c +++ b/src/i830_modes.c @@ -519,7 +519,7 @@ i830_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn) } } - I830GetOriginalVirtualSize(pScrn, &originalVirtualX, &originalVirtualY); + xf86GetOriginalVirtualSize(pScrn, &originalVirtualX, &originalVirtualY); /* Disable modes in the XFree86 DDX list that are larger than the current * virtual size. diff --git a/src/i830_randr.c b/src/i830_randr.c index ec0a2ec9..38ac320f 100644 --- a/src/i830_randr.c +++ b/src/i830_randr.c @@ -39,11 +39,12 @@ #include #include -#include "i830.h" -#include "i830_xf86Modes.h" +#include "i830_xf86Crtc.h" +#include "i830_randr.h" #include "i830_display.h" +#include "i830.h" -typedef struct _i830RandRInfo { +typedef struct _xf86RandRInfo { int virtualX; int virtualY; int mmWidth; @@ -55,18 +56,18 @@ typedef struct _i830RandRInfo { } XF86RandRInfoRec, *XF86RandRInfoPtr; #ifdef RANDR_12_INTERFACE -static Bool I830RandRInit12 (ScreenPtr pScreen); -static Bool I830RandRCreateScreenResources12 (ScreenPtr pScreen); +static Bool xf86RandRInit12 (ScreenPtr pScreen); +static Bool xf86RandRCreateScreenResources12 (ScreenPtr pScreen); #endif -static int i830RandRIndex; -static int i830RandRGeneration; +static int xf86RandRIndex; +static int xf86RandRGeneration; #define XF86RANDRINFO(p) \ - ((XF86RandRInfoPtr)(p)->devPrivates[i830RandRIndex].ptr) + ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandRIndex].ptr) static int -I830RandRModeRefresh (DisplayModePtr mode) +xf86RandRModeRefresh (DisplayModePtr mode) { if (mode->VRefresh) return (int) (mode->VRefresh + 0.5); @@ -75,7 +76,7 @@ I830RandRModeRefresh (DisplayModePtr mode) } static Bool -I830RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) { RRScreenSizePtr pSize; ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); @@ -97,7 +98,7 @@ I830RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) for (mode = scrp->modes; ; mode = mode->next) { - int refresh = I830RandRModeRefresh (mode); + int refresh = xf86RandRModeRefresh (mode); if (randrp->maxX == 0 || randrp->maxY == 0) { if (maxX < mode->HDisplay) @@ -151,7 +152,7 @@ I830RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) } static Bool -I830RandRSetMode (ScreenPtr pScreen, +xf86RandRSetMode (ScreenPtr pScreen, DisplayModePtr mode, Bool useVirtual, int mmWidth, @@ -240,7 +241,7 @@ I830RandRSetMode (ScreenPtr pScreen, } Bool -I830RandRSetConfig (ScreenPtr pScreen, +xf86RandRSetConfig (ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) @@ -273,7 +274,7 @@ I830RandRSetConfig (ScreenPtr pScreen, } if (mode->HDisplay == pSize->width && mode->VDisplay == pSize->height && - (rate == 0 || I830RandRModeRefresh (mode) == rate)) + (rate == 0 || xf86RandRModeRefresh (mode) == rate)) break; if (mode->next == scrp->modes) { @@ -299,7 +300,7 @@ I830RandRSetConfig (ScreenPtr pScreen, randrp->maxY = maxY; } - if (!I830RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, + if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) { randrp->rotation = oldRotation; return FALSE; @@ -322,7 +323,7 @@ I830RandRSetConfig (ScreenPtr pScreen, } Rotation -I830GetRotation(ScreenPtr pScreen) +xf86RandRGetRotation(ScreenPtr pScreen) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); @@ -330,19 +331,23 @@ I830GetRotation(ScreenPtr pScreen) } Bool -I830RandRCreateScreenResources (ScreenPtr pScreen) +xf86RandRCreateScreenResources (ScreenPtr pScreen) { +#if 0 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); +#endif #ifdef PANORAMIX /* XXX disable RandR when using Xinerama */ if (!noPanoramiXExtension) return TRUE; #endif #if RANDR_12_INTERFACE - if (I830RandRCreateScreenResources12 (pScreen)) + if (xf86RandRCreateScreenResources12 (pScreen)) return TRUE; #endif +#if 0 + /* XXX deal with initial rotation */ if (pI830->rotation != RR_Rotate_0) { RRScreenSize p; Rotation requestedRotation = pI830->rotation; @@ -356,15 +361,16 @@ I830RandRCreateScreenResources (ScreenPtr pScreen) p.mmHeight = pScreen->mmHeight; pI830->starting = TRUE; /* abuse this for dual head & rotation */ - I830RandRSetConfig (pScreen, requestedRotation, 0, &p); + xf86RandRSetConfig (pScreen, requestedRotation, 0, &p); pI830->starting = FALSE; } +#endif return TRUE; } Bool -I830RandRInit (ScreenPtr pScreen, int rotation) +xf86RandRInit (ScreenPtr pScreen) { rrScrPrivPtr rp; XF86RandRInfoPtr randrp; @@ -374,10 +380,10 @@ I830RandRInit (ScreenPtr pScreen, int rotation) if (!noPanoramiXExtension) return TRUE; #endif - if (i830RandRGeneration != serverGeneration) + if (xf86RandRGeneration != serverGeneration) { - i830RandRIndex = AllocateScreenPrivateIndex(); - i830RandRGeneration = serverGeneration; + xf86RandRIndex = AllocateScreenPrivateIndex(); + xf86RandRGeneration = serverGeneration; } randrp = xalloc (sizeof (XF86RandRInfoRec)); @@ -390,8 +396,8 @@ I830RandRInit (ScreenPtr pScreen, int rotation) return FALSE; } rp = rrGetScrPriv(pScreen); - rp->rrGetInfo = I830RandRGetInfo; - rp->rrSetConfig = I830RandRSetConfig; + rp->rrGetInfo = xf86RandRGetInfo; + rp->rrSetConfig = xf86RandRSetConfig; randrp->virtualX = -1; randrp->virtualY = -1; @@ -400,25 +406,33 @@ I830RandRInit (ScreenPtr pScreen, int rotation) randrp->rotation = RR_Rotate_0; /* initial rotated mode */ - randrp->supported_rotations = rotation; + randrp->supported_rotations = RR_Rotate_0; randrp->maxX = randrp->maxY = 0; - pScreen->devPrivates[i830RandRIndex].ptr = randrp; + pScreen->devPrivates[xf86RandRIndex].ptr = randrp; #if RANDR_12_INTERFACE - if (!I830RandRInit12 (pScreen)) + if (!xf86RandRInit12 (pScreen)) return FALSE; #endif return TRUE; } void -I830GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) +xf86RandRSetRotations (ScreenPtr pScreen, Rotation rotations) +{ + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + + randrp->supported_rotations = rotations; +} + +void +xf86GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) { ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; - if (i830RandRGeneration != serverGeneration || + if (xf86RandRGeneration != serverGeneration || XF86RANDRINFO(pScreen)->virtualX == -1) { *x = pScrn->virtualX; @@ -433,7 +447,7 @@ I830GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) #if RANDR_12_INTERFACE static Bool -I830RandRScreenSetSize (ScreenPtr pScreen, +xf86RandRScreenSetSize (ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, @@ -469,7 +483,7 @@ I830RandRScreenSetSize (ScreenPtr pScreen, } static Bool -I830RandRCrtcNotify (RRCrtcPtr randr_crtc) +xf86RandRCrtcNotify (RRCrtcPtr randr_crtc) { ScreenPtr pScreen = randr_crtc->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -518,7 +532,7 @@ I830RandRCrtcNotify (RRCrtcPtr randr_crtc) } static Bool -I830RandRCrtcSet (ScreenPtr pScreen, +xf86RandRCrtcSet (ScreenPtr pScreen, RRCrtcPtr randr_crtc, RRModePtr randr_mode, int x, @@ -589,11 +603,11 @@ I830RandRCrtcSet (ScreenPtr pScreen, } i830DisableUnusedFunctions (pScrn); } - return I830RandRCrtcNotify (randr_crtc); + return xf86RandRCrtcNotify (randr_crtc); } static Bool -I830RandRCrtcSetGamma (ScreenPtr pScreen, +xf86RandRCrtcSetGamma (ScreenPtr pScreen, RRCrtcPtr crtc) { return FALSE; @@ -663,7 +677,7 @@ I830xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes) * Mirror the current mode configuration to RandR */ static Bool -I830RandRSetInfo12 (ScrnInfoPtr pScrn) +xf86RandRSetInfo12 (ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); RROutputPtr clones[MAX_OUTPUTS]; @@ -773,16 +787,16 @@ I830RandRSetInfo12 (ScrnInfoPtr pScrn) * that to RandR */ static Bool -I830RandRGetInfo12 (ScreenPtr pScreen, Rotation *rotations) +xf86RandRGetInfo12 (ScreenPtr pScreen, Rotation *rotations) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; i830_reprobe_output_modes(pScrn); - return I830RandRSetInfo12 (pScrn); + return xf86RandRSetInfo12 (pScrn); } static Bool -I830RandRCreateObjects12 (ScrnInfoPtr pScrn) +xf86RandRCreateObjects12 (ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); int p; @@ -804,7 +818,7 @@ I830RandRCreateObjects12 (ScrnInfoPtr pScrn) } static Bool -I830RandRCreateScreenResources12 (ScreenPtr pScreen) +xf86RandRCreateScreenResources12 (ScreenPtr pScreen) { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -852,7 +866,7 @@ I830RandRCreateScreenResources12 (ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Setting screen physical size to %d x %d\n", mmWidth, mmHeight); - I830RandRScreenSetSize (pScreen, + xf86RandRScreenSetSize (pScreen, width, height, mmWidth, @@ -860,7 +874,7 @@ I830RandRCreateScreenResources12 (ScreenPtr pScreen) } for (p = 0; p < pI830->xf86_config.num_crtc; p++) - I830RandRCrtcNotify (pI830->xf86_config.crtc[p]->randr_crtc); + xf86RandRCrtcNotify (pI830->xf86_config.crtc[p]->randr_crtc); if (randrp->virtualX == -1 || randrp->virtualY == -1) { @@ -874,22 +888,22 @@ I830RandRCreateScreenResources12 (ScreenPtr pScreen) } static void -I830RandRPointerMoved (int scrnIndex, int x, int y) +xf86RandRPointerMoved (int scrnIndex, int x, int y) { } static Bool -I830RandRInit12 (ScreenPtr pScreen) +xf86RandRInit12 (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; rrScrPrivPtr rp = rrGetScrPriv(pScreen); - rp->rrGetInfo = I830RandRGetInfo12; - rp->rrScreenSetSize = I830RandRScreenSetSize; - rp->rrCrtcSet = I830RandRCrtcSet; - rp->rrCrtcSetGamma = I830RandRCrtcSetGamma; + rp->rrGetInfo = xf86RandRGetInfo12; + rp->rrScreenSetSize = xf86RandRScreenSetSize; + rp->rrCrtcSet = xf86RandRCrtcSet; + rp->rrCrtcSetGamma = xf86RandRCrtcSetGamma; rp->rrSetConfig = NULL; - pScrn->PointerMoved = I830RandRPointerMoved; + pScrn->PointerMoved = xf86RandRPointerMoved; return TRUE; } @@ -1155,7 +1169,7 @@ I830RRDefaultScreenLimits (RROutputPtr *outputs, int num_output, #endif Bool -I830RandRPreInit (ScrnInfoPtr pScrn) +xf86RandRPreInit (ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); #if RANDR_12_INTERFACE @@ -1174,13 +1188,13 @@ I830RandRPreInit (ScrnInfoPtr pScrn) i830_reprobe_output_modes(pScrn); #if RANDR_12_INTERFACE - if (!I830RandRCreateObjects12 (pScrn)) + if (!xf86RandRCreateObjects12 (pScrn)) return FALSE; /* * Configure output modes */ - if (!I830RandRSetInfo12 (pScrn)) + if (!xf86RandRSetInfo12 (pScrn)) return FALSE; /* * With RandR info set up, let RandR choose diff --git a/src/i830_randr.h b/src/i830_randr.h new file mode 100644 index 00000000..8c6af927 --- /dev/null +++ b/src/i830_randr.h @@ -0,0 +1,37 @@ +/* + * Copyright © 2006 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _XF86_RANDR_H_ +#define _XF86_RANDR_H_ +#include +#include + +Bool xf86RandRCreateScreenResources (ScreenPtr pScreen); +Bool xf86RandRInit(ScreenPtr pScreen); +void xf86RandRSetRotations (ScreenPtr pScreen, Rotation rotation); +Bool xf86RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, + RRScreenSizePtr pSize); +Rotation xf86RandRGetRotation(ScreenPtr pScreen); +void xf86GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); +Bool xf86RandRPreInit (ScrnInfoPtr pScrn); + +#endif /* _XF86_RANDR_H_ */ diff --git a/src/i830_rotate.c b/src/i830_rotate.c index 0471b55a..1427c244 100644 --- a/src/i830_rotate.c +++ b/src/i830_rotate.c @@ -757,7 +757,7 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn2 = pScrn; } - pI830->rotation = I830GetRotation(pScrn->pScreen); + pI830->rotation = xf86RandRGetRotation(pScrn->pScreen); /* Check if we've still got the same orientation, or same mode */ if (pI830->rotation == oldRotation && pI830->currentMode == mode) -- cgit v1.2.3