Update RandR to 1.0 (library version 2.0)

This commit is contained in:
Keith Packard 2002-09-29 23:39:47 +00:00
parent 5d87199643
commit 238a2ec201
6 changed files with 66 additions and 97 deletions

View File

@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.27 2001/07/20 19:35:29 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.28 2001/07/24 19:06:03 keithp Exp $ */
#include "fbdev.h" #include "fbdev.h"
@ -417,6 +417,7 @@ fbdevLayerCreate (ScreenPtr pScreen)
update = 0; update = 0;
window = 0; window = 0;
} }
return LayerCreate (pScreen, kind, screen->fb[0].depth, return LayerCreate (pScreen, kind, screen->fb[0].depth,
pPixmap, update, window, scrpriv->rotation, 0); pPixmap, update, window, scrpriv->rotation, 0);
} }
@ -430,8 +431,6 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
FbdevPriv *priv = pScreenPriv->card->driver; FbdevPriv *priv = pScreenPriv->card->driver;
KdScreenInfo *screen = pScreenPriv->screen; KdScreenInfo *screen = pScreenPriv->screen;
FbdevScrPriv *scrpriv = screen->driver; FbdevScrPriv *scrpriv = screen->driver;
RRVisualGroupPtr pVisualGroup;
RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
RRScreenSizePtr pSize; RRScreenSizePtr pSize;
Rotation rotateKind; Rotation rotateKind;
int rotation; int rotation;
@ -445,42 +444,11 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
if (n == pScreen->numDepths) if (n == pScreen->numDepths)
return FALSE; return FALSE;
pVisualGroup = RRCreateVisualGroup (pScreen);
if (!pVisualGroup)
return FALSE;
if (!RRAddDepthToVisualGroup (pScreen,
pVisualGroup,
&pScreen->allowedDepths[n]))
{
RRDestroyVisualGroup (pScreen, pVisualGroup);
return FALSE;
}
pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup);
if (!pVisualGroup)
return FALSE;
pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen);
if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen,
pGroupOfVisualGroup,
pVisualGroup))
{
RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
/* pVisualGroup left until screen closed */
return FALSE;
}
pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
if (!pGroupOfVisualGroup)
return FALSE;
pSize = RRRegisterSize (pScreen, pSize = RRRegisterSize (pScreen,
screen->width, screen->width,
screen->height, screen->height,
screen->width_mm, screen->width_mm,
screen->height_mm, screen->height_mm);
pGroupOfVisualGroup);
rotation = scrpriv->rotation - screen->rotation; rotation = scrpriv->rotation - screen->rotation;
if (rotation < 0) if (rotation < 0)
@ -502,7 +470,7 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
break; break;
} }
RRSetCurrentConfig (pScreen, rotateKind, pSize, pVisualGroup); RRSetCurrentConfig (pScreen, rotateKind, pSize);
return TRUE; return TRUE;
} }
@ -532,8 +500,7 @@ fbdevLayerRemove (WindowPtr pWin, pointer value)
fbdevRandRSetConfig (ScreenPtr pScreen, fbdevRandRSetConfig (ScreenPtr pScreen,
Rotation rotateKind, Rotation rotateKind,
RRScreenSizePtr pSize, RRScreenSizePtr pSize)
RRVisualGroupPtr pVisualGroup)
{ {
KdScreenPriv(pScreen); KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen; KdScreenInfo *screen = pScreenPriv->screen;
@ -598,6 +565,7 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
WalkTree (pScreen, fbdevLayerRemove, (pointer) scrpriv->pLayer); WalkTree (pScreen, fbdevLayerRemove, (pointer) scrpriv->pLayer);
LayerDestroy (pScreen, scrpriv->pLayer); LayerDestroy (pScreen, scrpriv->pLayer);
scrpriv->pLayer = pNewLayer; scrpriv->pLayer = pNewLayer;
KdSetSubpixelOrder (pScreen, scrpriv->rotation);
if (wasEnabled) if (wasEnabled)
KdEnableScreen (pScreen); KdEnableScreen (pScreen);
} }

View File

@ -19,7 +19,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.7 2001/07/24 19:06:03 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.8 2001/07/24 21:26:17 keithp Exp $ */
#include "mach64.h" #include "mach64.h"
#include <sys/io.h> #include <sys/io.h>
@ -123,14 +123,13 @@ mach64InitScreen (ScreenPtr pScreen)
#ifdef RANDR #ifdef RANDR
mach64RandRSetConfig (ScreenPtr pScreen, mach64RandRSetConfig (ScreenPtr pScreen,
Rotation rotation, Rotation rotation,
RRScreenSizePtr pSize, RRScreenSizePtr pSize)
RRVisualGroupPtr pVisualGroup)
{ {
KdScreenPriv(pScreen); KdScreenPriv(pScreen);
KdCheckSync (pScreen); KdCheckSync (pScreen);
if (!vesaRandRSetConfig (pScreen, rotation, pSize, pVisualGroup)) if (!vesaRandRSetConfig (pScreen, rotation, pSize))
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -1,5 +1,5 @@
/* /*
* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.21tsi Exp $ * $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.25 2002/09/26 02:56:48 keithp Exp $
* *
* Copyright © 1999 Keith Packard * Copyright © 1999 Keith Packard
* *
@ -384,6 +384,7 @@ KdParseScreen (KdScreenInfo *screen,
screen->height = 0; screen->height = 0;
screen->width_mm = 0; screen->width_mm = 0;
screen->height_mm = 0; screen->height_mm = 0;
screen->subpixel_order = kdSubpixelOrder;
screen->rate = 0; screen->rate = 0;
for (fb = 0; fb < KD_MAX_FB; fb++) for (fb = 0; fb < KD_MAX_FB; fb++)
screen->fb[fb].depth = 0; screen->fb[fb].depth = 0;
@ -427,7 +428,8 @@ KdParseScreen (KdScreenInfo *screen,
kdOrigin.y = 0; kdOrigin.y = 0;
kdDumbDriver = FALSE; kdDumbDriver = FALSE;
kdSoftCursor = FALSE; kdSoftCursor = FALSE;
kdSubpixelOrder = SubPixelUnknown;
if (delim == '@') if (delim == '@')
{ {
arg = KdParseFindNext (arg, "x", save, &delim); arg = KdParseFindNext (arg, "x", save, &delim);
@ -854,6 +856,45 @@ KdCreateWindow (WindowPtr pWin)
return fbCreateWindow (pWin); return fbCreateWindow (pWin);
} }
void
KdSetSubpixelOrder (ScreenPtr pScreen, int rotation)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
int subpixel_order = screen->subpixel_order;
int subpixel_dir;
int i;
struct {
int subpixel_order;
int direction;
} orders[] = {
{ SubPixelHorizontalRGB, 0 },
{ SubPixelHorizontalBGR, 180 },
{ SubPixelVerticalRGB, 270 },
{ SubPixelVerticalBGR, 90 },
};
/* map subpixel to direction */
for (i = 0; i < 4; i++)
if (orders[i].subpixel_order == subpixel_order)
break;
if (i < 4)
{
subpixel_dir = orders[i].direction;
/* add rotation */
subpixel_dir += rotation;
/* map back to subpixel order */
for (i = 0; i < 4; i++)
if (orders[i].direction == subpixel_dir)
{
subpixel_order = orders[i].subpixel_order;
break;
}
}
PictureSetSubpixelOrder (pScreen, subpixel_order);
}
/* Pass through AddScreen, which doesn't take any closure */ /* Pass through AddScreen, which doesn't take any closure */
static KdScreenInfo *kdCurrentScreen; static KdScreenInfo *kdCurrentScreen;
@ -1025,7 +1066,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
return FALSE; return FALSE;
} }
PictureSetSubpixelOrder (pScreen, kdSubpixelOrder); KdSetSubpixelOrder (pScreen, screen->rotation);
/* /*
* Enable the hardware * Enable the hardware

View File

@ -21,7 +21,7 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.21 2001/10/12 06:33:07 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.22 2002/08/02 16:15:02 keithp Exp $ */
#include <stdio.h> #include <stdio.h>
#include "X.h" #include "X.h"
@ -108,6 +108,7 @@ typedef struct _KdScreenInfo {
int rate; int rate;
int width_mm; int width_mm;
int height_mm; int height_mm;
int subpixel_order;
Bool dumb; Bool dumb;
Bool softCursor; Bool softCursor;
int mynum; int mynum;
@ -561,6 +562,9 @@ void
KdInitOutput (ScreenInfo *pScreenInfo, KdInitOutput (ScreenInfo *pScreenInfo,
int argc, char **argv); int argc, char **argv);
void
KdSetSubpixelOrder (ScreenPtr pScreen, int rotation);
/* kinfo.c */ /* kinfo.c */
KdCardInfo * KdCardInfo *
KdCardInfoAdd (KdCardFuncs *funcs, KdCardInfoAdd (KdCardFuncs *funcs,

View File

@ -19,7 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.17 2001/09/05 07:12:42 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.18 2001/09/14 19:25:17 keithp Exp $ */
#include "vesa.h" #include "vesa.h"
#ifdef RANDR #ifdef RANDR
@ -1010,8 +1010,6 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
int nmode; int nmode;
int n; int n;
RRVisualGroupPtr pVisualGroup;
RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
RRScreenSizePtr pSize; RRScreenSizePtr pSize;
*rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270; *rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270;
@ -1026,46 +1024,6 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
xfree (priv->modes); xfree (priv->modes);
priv->modes = modes; priv->modes = modes;
priv->nmode = nmode; priv->nmode = nmode;
/*
* XXX Create a single set of visual sets that has all of the visuals
* for the root depth
*/
for (n = 0; n < pScreen->numDepths; n++)
if (pScreen->allowedDepths[n].numVids)
break;
if (n == pScreen->numDepths)
return FALSE;
pVisualGroup = RRCreateVisualGroup (pScreen);
if (!pVisualGroup)
return FALSE;
if (!RRAddDepthToVisualGroup (pScreen,
pVisualGroup,
&pScreen->allowedDepths[n]))
{
RRDestroyVisualGroup (pScreen, pVisualGroup);
return FALSE;
}
pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup);
if (!pVisualGroup)
return FALSE;
pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen);
if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen,
pGroupOfVisualGroup,
pVisualGroup))
{
RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
/* pVisualGroup left until screen closed */
return FALSE;
}
pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
if (!pGroupOfVisualGroup)
return FALSE;
for (n = 0; n < nmode; n++) for (n = 0; n < nmode; n++)
{ {
mode = &priv->modes[n]; mode = &priv->modes[n];
@ -1102,8 +1060,7 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
} }
pSize = RRRegisterSize (pScreen, pSize = RRRegisterSize (pScreen,
width, height, width, height,
width_mm, height_mm, width_mm, height_mm);
pGroupOfVisualGroup);
if (mode->XResolution == screen->width && if (mode->XResolution == screen->width &&
mode->YResolution == screen->height) mode->YResolution == screen->height)
{ {
@ -1117,8 +1074,7 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
case 180: rot = RR_Rotate_180; break; case 180: rot = RR_Rotate_180; break;
case 270: rot = RR_Rotate_270; break; case 270: rot = RR_Rotate_270; break;
} }
RRSetCurrentConfig (pScreen, rot, pSize, RRSetCurrentConfig (pScreen, rot, pSize);
pVisualGroup);
} }
} }
} }
@ -1152,8 +1108,7 @@ vesaLayerRemove (WindowPtr pWin, pointer value)
Bool Bool
vesaRandRSetConfig (ScreenPtr pScreen, vesaRandRSetConfig (ScreenPtr pScreen,
Rotation rotation, Rotation rotation,
RRScreenSizePtr pSize, RRScreenSizePtr pSize)
RRVisualGroupPtr pVisualGroup)
{ {
KdScreenPriv(pScreen); KdScreenPriv(pScreen);
VesaModePtr mode; VesaModePtr mode;
@ -1300,6 +1255,8 @@ vesaRandRSetConfig (ScreenPtr pScreen,
pscr->pLayer = pNewLayer; pscr->pLayer = pNewLayer;
/* set the subpixel order */
KdSetSubpixelOrder (pScreen, pscr->rotate);
if (wasEnabled) if (wasEnabled)
KdEnableScreen (pScreen); KdEnableScreen (pScreen);

View File

@ -19,7 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.11 2001/07/20 19:35:30 keithp Exp $ */ /* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.12 2001/09/05 07:12:42 keithp Exp $ */
#ifndef _VESA_H_ #ifndef _VESA_H_
#define _VESA_H_ #define _VESA_H_
@ -165,4 +165,4 @@ vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
int int
vesaProcessArgument (int argc, char **argv, int i); vesaProcessArgument (int argc, char **argv, int i);
#endif _VESA_H_ #endif /* _VESA_H_ */