Update kdrive servers to support reflection
This commit is contained in:
parent
238a2ec201
commit
a80e1e5aed
|
@ -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.28 2001/07/24 19:06:03 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.29 2002/09/29 23:39:46 keithp Exp $ */
|
||||||
|
|
||||||
#include "fbdev.h"
|
#include "fbdev.h"
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
screen->rate = 72;
|
screen->rate = 72;
|
||||||
scrpriv->rotation = screen->rotation;
|
scrpriv->randr = screen->randr;
|
||||||
|
|
||||||
#ifdef FAKE24_ON_16
|
#ifdef FAKE24_ON_16
|
||||||
if (screen->fb[0].depth == 24 && screen->fb[0].bitsPerPixel == 24 &&
|
if (screen->fb[0].depth == 24 && screen->fb[0].bitsPerPixel == 24 &&
|
||||||
|
@ -348,43 +348,36 @@ fbdevLayerCreate (ScreenPtr pScreen)
|
||||||
int kind;
|
int kind;
|
||||||
KdMouseMatrix m;
|
KdMouseMatrix m;
|
||||||
|
|
||||||
switch (scrpriv->rotation) {
|
#ifdef FAKE24_ON_16
|
||||||
case 0:
|
if (fake24)
|
||||||
|
{
|
||||||
|
scrpriv->randr = RR_Rotate_0;
|
||||||
|
scrpriv->shadow = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* FAKE24_ON_16 */
|
||||||
|
{
|
||||||
|
if (scrpriv->randr != RR_Rotate_0)
|
||||||
|
scrpriv->shadow = TRUE;
|
||||||
|
else
|
||||||
|
scrpriv->shadow = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
||||||
|
|
||||||
|
if (m.matrix[0][0])
|
||||||
|
{
|
||||||
pScreen->width = screen->width;
|
pScreen->width = screen->width;
|
||||||
pScreen->height = screen->height;
|
pScreen->height = screen->height;
|
||||||
pScreen->mmWidth = screen->width_mm;
|
pScreen->mmWidth = screen->width_mm;
|
||||||
pScreen->mmHeight = screen->height_mm;
|
pScreen->mmHeight = screen->height_mm;
|
||||||
scrpriv->shadow = FALSE;
|
}
|
||||||
m.matrix[0][0] = 1; m.matrix[0][1] = 0; m.matrix[0][2] = 0;
|
else
|
||||||
m.matrix[1][0] = 0; m.matrix[1][1] = 1; m.matrix[1][2] = 0;
|
{
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
pScreen->width = screen->height;
|
pScreen->width = screen->height;
|
||||||
pScreen->height = screen->width;
|
pScreen->height = screen->width;
|
||||||
pScreen->mmWidth = screen->height_mm;
|
pScreen->mmWidth = screen->height_mm;
|
||||||
pScreen->mmHeight = screen->width_mm;
|
pScreen->mmHeight = screen->width_mm;
|
||||||
scrpriv->shadow = TRUE;
|
|
||||||
m.matrix[0][0] = 0; m.matrix[0][1] = -1; m.matrix[0][2] = screen->height - 1;
|
|
||||||
m.matrix[1][0] = 1; m.matrix[1][1] = 0; m.matrix[1][2] = 0;
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
pScreen->width = screen->width;
|
|
||||||
pScreen->height = screen->height;
|
|
||||||
pScreen->mmWidth = screen->width_mm;
|
|
||||||
pScreen->mmHeight = screen->height_mm;
|
|
||||||
scrpriv->shadow = TRUE;
|
|
||||||
m.matrix[0][0] = -1; m.matrix[0][1] = 0; m.matrix[0][2] = screen->width - 1;
|
|
||||||
m.matrix[1][0] = 0; m.matrix[1][1] = -1; m.matrix[1][2] = screen->height - 1;
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
pScreen->width = screen->height;
|
|
||||||
pScreen->height = screen->width;
|
|
||||||
pScreen->mmWidth = screen->height_mm;
|
|
||||||
pScreen->mmHeight = screen->width_mm;
|
|
||||||
scrpriv->shadow = TRUE;
|
|
||||||
m.matrix[0][0] = 0; m.matrix[0][1] = 1; m.matrix[0][2] = 0;
|
|
||||||
m.matrix[1][0] = -1; m.matrix[1][1] = 0; m.matrix[1][2] = screen->width - 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
KdSetMouseMatrix (&m);
|
KdSetMouseMatrix (&m);
|
||||||
|
|
||||||
|
@ -400,7 +393,7 @@ fbdevLayerCreate (ScreenPtr pScreen)
|
||||||
else
|
else
|
||||||
#endif /* FAKE24_ON_16 */
|
#endif /* FAKE24_ON_16 */
|
||||||
{
|
{
|
||||||
if (scrpriv->rotation)
|
if (scrpriv->randr)
|
||||||
update = shadowUpdateRotatePacked;
|
update = shadowUpdateRotatePacked;
|
||||||
else
|
else
|
||||||
update = shadowUpdatePacked;
|
update = shadowUpdatePacked;
|
||||||
|
@ -419,7 +412,7 @@ fbdevLayerCreate (ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
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->randr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -432,11 +425,10 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
FbdevScrPriv *scrpriv = screen->driver;
|
FbdevScrPriv *scrpriv = screen->driver;
|
||||||
RRScreenSizePtr pSize;
|
RRScreenSizePtr pSize;
|
||||||
Rotation rotateKind;
|
Rotation randr;
|
||||||
int rotation;
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
*rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270;
|
*rotations = RR_Rotate_All|RR_Reflect_All;
|
||||||
|
|
||||||
for (n = 0; n < pScreen->numDepths; n++)
|
for (n = 0; n < pScreen->numDepths; n++)
|
||||||
if (pScreen->allowedDepths[n].numVids)
|
if (pScreen->allowedDepths[n].numVids)
|
||||||
|
@ -450,27 +442,9 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
screen->width_mm,
|
screen->width_mm,
|
||||||
screen->height_mm);
|
screen->height_mm);
|
||||||
|
|
||||||
rotation = scrpriv->rotation - screen->rotation;
|
randr = KdSubRotation (scrpriv->randr, screen->randr);
|
||||||
if (rotation < 0)
|
|
||||||
rotation += 360;
|
RRSetCurrentConfig (pScreen, randr, pSize);
|
||||||
|
|
||||||
switch (rotation)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
rotateKind = RR_Rotate_0;
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
rotateKind = RR_Rotate_90;
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
rotateKind = RR_Rotate_180;
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
rotateKind = RR_Rotate_270;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
RRSetCurrentConfig (pScreen, rotateKind, pSize);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -499,42 +473,27 @@ fbdevLayerRemove (WindowPtr pWin, pointer value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fbdevRandRSetConfig (ScreenPtr pScreen,
|
fbdevRandRSetConfig (ScreenPtr pScreen,
|
||||||
Rotation rotateKind,
|
Rotation randr,
|
||||||
RRScreenSizePtr pSize)
|
RRScreenSizePtr pSize)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||||
FbdevScrPriv *scrpriv = screen->driver;
|
FbdevScrPriv *scrpriv = screen->driver;
|
||||||
int rotation;
|
int rotate;
|
||||||
|
int reflect;
|
||||||
Bool wasEnabled = pScreenPriv->enabled;
|
Bool wasEnabled = pScreenPriv->enabled;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The only thing that can change is rotation
|
* The only thing that can change is rotation
|
||||||
*/
|
*/
|
||||||
switch (rotateKind)
|
randr = KdAddRotation (randr, screen->randr);
|
||||||
{
|
|
||||||
case RR_Rotate_0:
|
|
||||||
rotation = screen->rotation;
|
|
||||||
break;
|
|
||||||
case RR_Rotate_90:
|
|
||||||
rotation = screen->rotation + 90;
|
|
||||||
break;
|
|
||||||
case RR_Rotate_180:
|
|
||||||
rotation = screen->rotation + 180;
|
|
||||||
break;
|
|
||||||
case RR_Rotate_270:
|
|
||||||
rotation = screen->rotation + 270;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (rotation >= 360)
|
|
||||||
rotation -= 360;
|
|
||||||
|
|
||||||
if (scrpriv->rotation != rotation)
|
if (scrpriv->randr != randr)
|
||||||
{
|
{
|
||||||
LayerPtr pNewLayer;
|
LayerPtr pNewLayer;
|
||||||
int kind;
|
int kind;
|
||||||
int oldrotation = scrpriv->rotation;
|
int oldrandr = scrpriv->randr;
|
||||||
int oldshadow = scrpriv->shadow;
|
int oldshadow = scrpriv->shadow;
|
||||||
int oldwidth = pScreen->width;
|
int oldwidth = pScreen->width;
|
||||||
int oldheight = pScreen->height;
|
int oldheight = pScreen->height;
|
||||||
|
@ -543,18 +502,18 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
|
||||||
if (wasEnabled)
|
if (wasEnabled)
|
||||||
KdDisableScreen (pScreen);
|
KdDisableScreen (pScreen);
|
||||||
|
|
||||||
scrpriv->rotation = rotation;
|
scrpriv->randr = randr;
|
||||||
pNewLayer = fbdevLayerCreate (pScreen);
|
pNewLayer = fbdevLayerCreate (pScreen);
|
||||||
if (!pNewLayer)
|
if (!pNewLayer)
|
||||||
{
|
{
|
||||||
scrpriv->shadow = oldshadow;
|
scrpriv->shadow = oldshadow;
|
||||||
scrpriv->rotation = oldrotation;
|
scrpriv->randr = oldrandr;
|
||||||
}
|
}
|
||||||
if (WalkTree (pScreen, fbdevLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING)
|
if (WalkTree (pScreen, fbdevLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING)
|
||||||
{
|
{
|
||||||
WalkTree (pScreen, fbdevLayerRemove, (pointer) pNewLayer);
|
WalkTree (pScreen, fbdevLayerRemove, (pointer) pNewLayer);
|
||||||
LayerDestroy (pScreen, pNewLayer);
|
LayerDestroy (pScreen, pNewLayer);
|
||||||
scrpriv->rotation = oldrotation;
|
scrpriv->randr = oldrandr;
|
||||||
scrpriv->shadow = oldshadow;
|
scrpriv->shadow = oldshadow;
|
||||||
pScreen->width = oldwidth;
|
pScreen->width = oldwidth;
|
||||||
pScreen->height = oldheight;
|
pScreen->height = oldheight;
|
||||||
|
@ -565,7 +524,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);
|
KdSetSubpixelOrder (pScreen, scrpriv->randr);
|
||||||
if (wasEnabled)
|
if (wasEnabled)
|
||||||
KdEnableScreen (pScreen);
|
KdEnableScreen (pScreen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.h,v 1.10 2001/05/29 17:47:55 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.h,v 1.11 2001/06/03 21:52:45 keithp Exp $ */
|
||||||
|
|
||||||
#ifndef _FBDEV_H_
|
#ifndef _FBDEV_H_
|
||||||
#define _FBDEV_H_
|
#define _FBDEV_H_
|
||||||
|
@ -48,7 +48,7 @@ typedef struct _fbdevPriv {
|
||||||
} FbdevPriv;
|
} FbdevPriv;
|
||||||
|
|
||||||
typedef struct _fbdevScrPriv {
|
typedef struct _fbdevScrPriv {
|
||||||
int rotation;
|
Rotation randr;
|
||||||
Bool shadow;
|
Bool shadow;
|
||||||
LayerPtr pLayer;
|
LayerPtr pLayer;
|
||||||
} FbdevScrPriv;
|
} FbdevScrPriv;
|
||||||
|
|
|
@ -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/mach64video.c,v 1.6 2001/07/24 19:06:03 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64video.c,v 1.7 2001/08/09 09:08:55 keithp Exp $ */
|
||||||
#include "mach64.h"
|
#include "mach64.h"
|
||||||
|
|
||||||
#include "Xv.h"
|
#include "Xv.h"
|
||||||
|
@ -148,7 +148,7 @@ mach64QueryBestSize(KdScreenInfo *screen,
|
||||||
static void
|
static void
|
||||||
mach64CopyPackedData(KdScreenInfo *screen,
|
mach64CopyPackedData(KdScreenInfo *screen,
|
||||||
unsigned char *buf,
|
unsigned char *buf,
|
||||||
int rotate,
|
int randr,
|
||||||
int srcPitch,
|
int srcPitch,
|
||||||
int dstPitch,
|
int dstPitch,
|
||||||
int srcW,
|
int srcW,
|
||||||
|
@ -168,24 +168,24 @@ mach64CopyPackedData(KdScreenInfo *screen,
|
||||||
int srcDown, srcRight, srcNext;
|
int srcDown, srcRight, srcNext;
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
switch (rotate) {
|
switch (randr & RR_Rotate_All) {
|
||||||
case 0:
|
case RR_Rotate_0:
|
||||||
src = buf;
|
src = buf;
|
||||||
srcDown = srcPitch;
|
srcDown = srcPitch;
|
||||||
srcRight = 2;
|
srcRight = 2;
|
||||||
break;
|
break;
|
||||||
case 90:
|
case RR_Rotate_90:
|
||||||
src = src + (srcH - 1) * 2;
|
src = buf + (srcH - 1) * 2;
|
||||||
srcDown = -2;
|
srcDown = -2;
|
||||||
srcRight = srcPitch;
|
srcRight = srcPitch;
|
||||||
break;
|
break;
|
||||||
case 180:
|
case RR_Rotate_180:
|
||||||
src = src + srcPitch * (srcH - 1) + (srcW - 1) * 2;
|
src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2;
|
||||||
srcDown = -srcPitch;
|
srcDown = -srcPitch;
|
||||||
srcRight = -2;
|
srcRight = -2;
|
||||||
break;
|
break;
|
||||||
case 270:
|
case RR_Rotate_270:
|
||||||
src = src + srcPitch * (srcW - 1);
|
src = buf + srcPitch * (srcW - 1);
|
||||||
srcDown = 2;
|
srcDown = 2;
|
||||||
srcRight = -srcPitch;
|
srcRight = -srcPitch;
|
||||||
break;
|
break;
|
||||||
|
@ -505,7 +505,7 @@ mach64DisplayVideo(KdScreenInfo *screen,
|
||||||
int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
|
int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
|
||||||
int xscaleIntUV = 0, xscaleFractUV = 0;
|
int xscaleIntUV = 0, xscaleFractUV = 0;
|
||||||
int yscaleIntUV = 0, yscaleFractUV = 0;
|
int yscaleIntUV = 0, yscaleFractUV = 0;
|
||||||
int rotate = mach64s->vesa.rotate;
|
int randr = mach64s->vesa.randr;
|
||||||
int HORZ_INC, VERT_INC;
|
int HORZ_INC, VERT_INC;
|
||||||
CARD32 SCALER_IN;
|
CARD32 SCALER_IN;
|
||||||
CARD32 OVERLAY_SCALE_CNTL;
|
CARD32 OVERLAY_SCALE_CNTL;
|
||||||
|
@ -622,7 +622,7 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
Reg *reg = mach64c->reg;
|
Reg *reg = mach64c->reg;
|
||||||
MediaReg *media = mach64c->media_reg;
|
MediaReg *media = mach64c->media_reg;
|
||||||
INT32 x1, x2, y1, y2;
|
INT32 x1, x2, y1, y2;
|
||||||
int rotate = mach64s->vesa.rotate;
|
int randr = mach64s->vesa.randr;
|
||||||
int srcPitch, srcPitch2, dstPitch;
|
int srcPitch, srcPitch2, dstPitch;
|
||||||
int top, left, npixels, nlines, size;
|
int top, left, npixels, nlines, size;
|
||||||
BoxRec dstBox;
|
BoxRec dstBox;
|
||||||
|
@ -651,29 +651,27 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
if (!media)
|
if (!media)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
switch (rotate) {
|
if (randr & (RR_Rotate_0|RR_Rotate_180))
|
||||||
case 0:
|
{
|
||||||
case 180:
|
|
||||||
dst_width = width;
|
dst_width = width;
|
||||||
dst_height = height;
|
dst_height = height;
|
||||||
rot_src_w = src_w;
|
rot_src_w = src_w;
|
||||||
rot_src_h = src_h;
|
rot_src_h = src_h;
|
||||||
rot_drw_w = drw_w;
|
rot_drw_w = drw_w;
|
||||||
rot_drw_h = drw_h;
|
rot_drw_h = drw_h;
|
||||||
break;
|
}
|
||||||
case 90:
|
else
|
||||||
case 270:
|
{
|
||||||
dst_width = height;
|
dst_width = height;
|
||||||
dst_height = width;
|
dst_height = width;
|
||||||
rot_src_w = src_h;
|
rot_src_w = src_h;
|
||||||
rot_src_h = src_w;
|
rot_src_h = src_w;
|
||||||
rot_drw_w = drw_h;
|
rot_drw_w = drw_h;
|
||||||
rot_drw_h = drw_w;
|
rot_drw_h = drw_w;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (rotate) {
|
switch (randr & RR_Rotate_All) {
|
||||||
case 0:
|
case RR_Rotate_0:
|
||||||
dst_x1 = dstBox.x1;
|
dst_x1 = dstBox.x1;
|
||||||
dst_y1 = dstBox.y1;
|
dst_y1 = dstBox.y1;
|
||||||
dst_x2 = dstBox.x2;
|
dst_x2 = dstBox.x2;
|
||||||
|
@ -683,7 +681,7 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
rot_x2 = x2;
|
rot_x2 = x2;
|
||||||
rot_y2 = y2;
|
rot_y2 = y2;
|
||||||
break;
|
break;
|
||||||
case 90:
|
case RR_Rotate_90:
|
||||||
dst_x1 = dstBox.y1;
|
dst_x1 = dstBox.y1;
|
||||||
dst_y1 = screen->height - dstBox.x2;
|
dst_y1 = screen->height - dstBox.x2;
|
||||||
dst_x2 = dstBox.y2;
|
dst_x2 = dstBox.y2;
|
||||||
|
@ -694,7 +692,7 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
rot_x2 = y2;
|
rot_x2 = y2;
|
||||||
rot_y2 = (src_w << 16) - x1;
|
rot_y2 = (src_w << 16) - x1;
|
||||||
break;
|
break;
|
||||||
case 180:
|
case RR_Rotate_180:
|
||||||
dst_x1 = screen->width - dstBox.x2;
|
dst_x1 = screen->width - dstBox.x2;
|
||||||
dst_y1 = screen->height - dstBox.y2;
|
dst_y1 = screen->height - dstBox.y2;
|
||||||
dst_x2 = screen->width - dstBox.x1;
|
dst_x2 = screen->width - dstBox.x1;
|
||||||
|
@ -704,7 +702,7 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
rot_x2 = (src_w << 16) - x1;
|
rot_x2 = (src_w << 16) - x1;
|
||||||
rot_y2 = (src_h << 16) - y1;
|
rot_y2 = (src_h << 16) - y1;
|
||||||
break;
|
break;
|
||||||
case 270:
|
case RR_Rotate_270:
|
||||||
dst_x1 = screen->width - dstBox.y2;
|
dst_x1 = screen->width - dstBox.y2;
|
||||||
dst_y1 = dstBox.x1;
|
dst_y1 = dstBox.x1;
|
||||||
dst_x2 = screen->width - dstBox.y1;
|
dst_x2 = screen->width - dstBox.y1;
|
||||||
|
@ -764,7 +762,7 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
case FOURCC_I420:
|
case FOURCC_I420:
|
||||||
top &= ~1;
|
top &= ~1;
|
||||||
nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
|
nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
|
||||||
mach64CopyPlanarData(screen, buf, rotate,
|
mach64CopyPlanarData(screen, buf, randr,
|
||||||
srcPitch, srcPitch2, dstPitch,
|
srcPitch, srcPitch2, dstPitch,
|
||||||
rot_src_w, rot_src_h, height,
|
rot_src_w, rot_src_h, height,
|
||||||
top, left, nlines, npixels, id);
|
top, left, nlines, npixels, id);
|
||||||
|
@ -773,7 +771,7 @@ mach64PutImage(KdScreenInfo *screen,
|
||||||
case FOURCC_YUY2:
|
case FOURCC_YUY2:
|
||||||
default:
|
default:
|
||||||
nlines = ((rot_y2 + 0xffff) >> 16) - top;
|
nlines = ((rot_y2 + 0xffff) >> 16) - top;
|
||||||
mach64CopyPackedData(screen, buf, rotate,
|
mach64CopyPackedData(screen, buf, randr,
|
||||||
srcPitch, dstPitch,
|
srcPitch, dstPitch,
|
||||||
rot_src_w, rot_src_h,
|
rot_src_w, rot_src_h,
|
||||||
top, left, nlines,
|
top, left, nlines,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.25 2002/09/26 02:56:48 keithp Exp $
|
* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.26 2002/09/29 23:39:46 keithp Exp $
|
||||||
*
|
*
|
||||||
* Copyright © 1999 Keith Packard
|
* Copyright © 1999 Keith Packard
|
||||||
*
|
*
|
||||||
|
@ -28,6 +28,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include <mivalidate.h>
|
#include <mivalidate.h>
|
||||||
#include <dixstruct.h>
|
#include <dixstruct.h>
|
||||||
|
#ifdef RANDR
|
||||||
|
#include <randrstr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XV
|
#ifdef XV
|
||||||
#include "kxv.h"
|
#include "kxv.h"
|
||||||
|
@ -365,6 +368,28 @@ KdParseFindNext (char *cur, char *delim, char *save, char *last)
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rotation
|
||||||
|
KdAddRotation (Rotation a, Rotation b)
|
||||||
|
{
|
||||||
|
Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
|
||||||
|
Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
|
||||||
|
|
||||||
|
if (rotate > RR_Rotate_270)
|
||||||
|
rotate /= (RR_Rotate_270 * RR_Rotate_90);
|
||||||
|
return reflect | rotate;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rotation
|
||||||
|
KdSubRotation (Rotation a, Rotation b)
|
||||||
|
{
|
||||||
|
Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
|
||||||
|
Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
|
||||||
|
|
||||||
|
if (rotate > RR_Rotate_270)
|
||||||
|
rotate /= (RR_Rotate_270 * RR_Rotate_90);
|
||||||
|
return reflect | rotate;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
KdParseScreen (KdScreenInfo *screen,
|
KdParseScreen (KdScreenInfo *screen,
|
||||||
char *arg)
|
char *arg)
|
||||||
|
@ -379,7 +404,7 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
screen->dumb = kdDumbDriver;
|
screen->dumb = kdDumbDriver;
|
||||||
screen->softCursor = kdSoftCursor;
|
screen->softCursor = kdSoftCursor;
|
||||||
screen->origin = kdOrigin;
|
screen->origin = kdOrigin;
|
||||||
screen->rotation = 0;
|
screen->randr = RR_Rotate_0;
|
||||||
screen->width = 0;
|
screen->width = 0;
|
||||||
screen->height = 0;
|
screen->height = 0;
|
||||||
screen->width_mm = 0;
|
screen->width_mm = 0;
|
||||||
|
@ -395,7 +420,7 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
arg = KdParseFindNext (arg, "x/@", save, &delim);
|
arg = KdParseFindNext (arg, "x/@XY", save, &delim);
|
||||||
if (!save[0])
|
if (!save[0])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -404,7 +429,7 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
|
|
||||||
if (delim == '/')
|
if (delim == '/')
|
||||||
{
|
{
|
||||||
arg = KdParseFindNext (arg, "x@", save, &delim);
|
arg = KdParseFindNext (arg, "x@XY", save, &delim);
|
||||||
if (!save[0])
|
if (!save[0])
|
||||||
return;
|
return;
|
||||||
mm = atoi(save);
|
mm = atoi(save);
|
||||||
|
@ -420,7 +445,7 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
screen->height = pixels;
|
screen->height = pixels;
|
||||||
screen->height_mm = mm;
|
screen->height_mm = mm;
|
||||||
}
|
}
|
||||||
if (delim != 'x' && delim != '@')
|
if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,22 +457,33 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
|
|
||||||
if (delim == '@')
|
if (delim == '@')
|
||||||
{
|
{
|
||||||
arg = KdParseFindNext (arg, "x", save, &delim);
|
arg = KdParseFindNext (arg, "xXY", save, &delim);
|
||||||
if (save[0])
|
if (save[0])
|
||||||
{
|
{
|
||||||
screen->rotation = atoi (save);
|
int rotate = atoi (save);
|
||||||
if (screen->rotation < 45)
|
if (rotate < 45)
|
||||||
screen->rotation = 0;
|
screen->randr = RR_Rotate_0;
|
||||||
else if (screen->rotation < 135)
|
else if (rotate < 135)
|
||||||
screen->rotation = 90;
|
screen->randr = RR_Rotate_90;
|
||||||
else if (screen->rotation < 225)
|
else if (rotate < 225)
|
||||||
screen->rotation = 180;
|
screen->randr = RR_Rotate_180;
|
||||||
else if (screen->rotation < 315)
|
else if (rotate < 315)
|
||||||
screen->rotation = 270;
|
screen->randr = RR_Rotate_270;
|
||||||
else
|
else
|
||||||
screen->rotation = 0;
|
screen->randr = RR_Rotate_0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (delim == 'X')
|
||||||
|
{
|
||||||
|
arg = KdParseFindNext (arg, "xY", save, &delim);
|
||||||
|
screen->randr |= RR_Reflect_X;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delim == 'Y')
|
||||||
|
{
|
||||||
|
arg = KdParseFindNext (arg, "xY", save, &delim);
|
||||||
|
screen->randr |= RR_Reflect_Y;
|
||||||
|
}
|
||||||
|
|
||||||
fb = 0;
|
fb = 0;
|
||||||
while (fb < KD_MAX_FB)
|
while (fb < KD_MAX_FB)
|
||||||
|
@ -857,22 +893,33 @@ KdCreateWindow (WindowPtr pWin)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
KdSetSubpixelOrder (ScreenPtr pScreen, int rotation)
|
KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
int subpixel_order = screen->subpixel_order;
|
int subpixel_order = screen->subpixel_order;
|
||||||
int subpixel_dir;
|
Rotation subpixel_dir;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
struct {
|
static struct {
|
||||||
int subpixel_order;
|
int subpixel_order;
|
||||||
int direction;
|
Rotation direction;
|
||||||
} orders[] = {
|
} orders[] = {
|
||||||
{ SubPixelHorizontalRGB, 0 },
|
{ SubPixelHorizontalRGB, RR_Rotate_0 },
|
||||||
{ SubPixelHorizontalBGR, 180 },
|
{ SubPixelHorizontalBGR, RR_Rotate_180 },
|
||||||
{ SubPixelVerticalRGB, 270 },
|
{ SubPixelVerticalRGB, RR_Rotate_270 },
|
||||||
{ SubPixelVerticalBGR, 90 },
|
{ SubPixelVerticalBGR, RR_Rotate_90 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
int bit;
|
||||||
|
int normal;
|
||||||
|
int reflect;
|
||||||
|
} reflects[] = {
|
||||||
|
{ RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR },
|
||||||
|
{ RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB },
|
||||||
|
{ RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR },
|
||||||
|
{ RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* map subpixel to direction */
|
/* map subpixel to direction */
|
||||||
|
@ -881,16 +928,23 @@ KdSetSubpixelOrder (ScreenPtr pScreen, int rotation)
|
||||||
break;
|
break;
|
||||||
if (i < 4)
|
if (i < 4)
|
||||||
{
|
{
|
||||||
subpixel_dir = orders[i].direction;
|
subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
|
||||||
/* add rotation */
|
|
||||||
subpixel_dir += rotation;
|
|
||||||
/* map back to subpixel order */
|
/* map back to subpixel order */
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (orders[i].direction == subpixel_dir)
|
if (orders[i].direction & subpixel_dir)
|
||||||
{
|
{
|
||||||
subpixel_order = orders[i].subpixel_order;
|
subpixel_order = orders[i].subpixel_order;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* reflect */
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
if ((randr & reflects[i].bit) &&
|
||||||
|
reflects[i].normal == subpixel_order)
|
||||||
|
{
|
||||||
|
subpixel_order = reflects[i].reflect;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PictureSetSubpixelOrder (pScreen, subpixel_order);
|
PictureSetSubpixelOrder (pScreen, subpixel_order);
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1120,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
KdSetSubpixelOrder (pScreen, screen->rotation);
|
KdSetSubpixelOrder (pScreen, screen->randr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable the hardware
|
* Enable the hardware
|
||||||
|
|
|
@ -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.22 2002/08/02 16:15:02 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.23 2002/09/29 23:39:46 keithp Exp $ */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "X.h"
|
#include "X.h"
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
#include "fb.h"
|
#include "fb.h"
|
||||||
#include "fboverlay.h"
|
#include "fboverlay.h"
|
||||||
#include "shadow.h"
|
#include "shadow.h"
|
||||||
|
#include "randrstr.h"
|
||||||
|
|
||||||
extern WindowPtr *WindowTable;
|
extern WindowPtr *WindowTable;
|
||||||
|
|
||||||
|
@ -97,12 +98,15 @@ typedef struct _KdFrameBuffer {
|
||||||
void *closure;
|
void *closure;
|
||||||
} KdFrameBuffer;
|
} KdFrameBuffer;
|
||||||
|
|
||||||
|
#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
|
||||||
|
#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
|
||||||
|
|
||||||
typedef struct _KdScreenInfo {
|
typedef struct _KdScreenInfo {
|
||||||
struct _KdScreenInfo *next;
|
struct _KdScreenInfo *next;
|
||||||
KdCardInfo *card;
|
KdCardInfo *card;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
void *driver;
|
void *driver;
|
||||||
int rotation;
|
Rotation randr; /* rotation and reflection */
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int rate;
|
int rate;
|
||||||
|
@ -514,6 +518,12 @@ KdResume (void);
|
||||||
void
|
void
|
||||||
KdProcessSwitch (void);
|
KdProcessSwitch (void);
|
||||||
|
|
||||||
|
Rotation
|
||||||
|
KdAddRotation (Rotation a, Rotation b);
|
||||||
|
|
||||||
|
Rotation
|
||||||
|
KdSubRotation (Rotation a, Rotation b);
|
||||||
|
|
||||||
void
|
void
|
||||||
KdParseScreen (KdScreenInfo *screen,
|
KdParseScreen (KdScreenInfo *screen,
|
||||||
char *arg);
|
char *arg);
|
||||||
|
@ -563,7 +573,7 @@ KdInitOutput (ScreenInfo *pScreenInfo,
|
||||||
int argc, char **argv);
|
int argc, char **argv);
|
||||||
|
|
||||||
void
|
void
|
||||||
KdSetSubpixelOrder (ScreenPtr pScreen, int rotation);
|
KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
|
||||||
|
|
||||||
/* kinfo.c */
|
/* kinfo.c */
|
||||||
KdCardInfo *
|
KdCardInfo *
|
||||||
|
@ -628,6 +638,9 @@ KdSetLed (int led, Bool on);
|
||||||
void
|
void
|
||||||
KdSetMouseMatrix (KdMouseMatrix *matrix);
|
KdSetMouseMatrix (KdMouseMatrix *matrix);
|
||||||
|
|
||||||
|
void
|
||||||
|
KdComputeMouseMatrix (KdMouseMatrix *matrix, Rotation randr, int width, int height);
|
||||||
|
|
||||||
void
|
void
|
||||||
KdBlockHandler (int screen,
|
KdBlockHandler (int screen,
|
||||||
pointer blockData,
|
pointer blockData,
|
||||||
|
|
|
@ -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/kinput.c,v 1.21 2001/09/29 04:16:38 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.24 2002/08/15 18:07:57 keithp Exp $ */
|
||||||
|
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
@ -369,6 +369,42 @@ KdSetMouseMatrix (KdMouseMatrix *matrix)
|
||||||
kdMouseMatrix = *matrix;
|
kdMouseMatrix = *matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
|
||||||
|
{
|
||||||
|
int x_dir = 1, y_dir = 1;
|
||||||
|
int i, j;
|
||||||
|
int size[2];
|
||||||
|
|
||||||
|
size[0] = width; size[1] = height;
|
||||||
|
if (randr & RR_Reflect_X)
|
||||||
|
x_dir = -1;
|
||||||
|
if (randr & RR_Reflect_Y)
|
||||||
|
y_dir = -1;
|
||||||
|
switch (randr & (RR_Rotate_All)) {
|
||||||
|
case RR_Rotate_0:
|
||||||
|
m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
|
||||||
|
m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
|
||||||
|
break;
|
||||||
|
case RR_Rotate_90:
|
||||||
|
m->matrix[0][0] = 0; m->matrix[0][1] = -y_dir;
|
||||||
|
m->matrix[1][0] = x_dir; m->matrix[1][1] = 0;
|
||||||
|
break;
|
||||||
|
case RR_Rotate_180:
|
||||||
|
m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
|
||||||
|
m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
|
||||||
|
break;
|
||||||
|
case RR_Rotate_270:
|
||||||
|
m->matrix[0][0] = 0; m->matrix[0][1] = y_dir;
|
||||||
|
m->matrix[1][0] = -x_dir; m->matrix[1][1] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (i = 0; i < 2; i++)
|
||||||
|
for (j = 0 ; j < 2; j++)
|
||||||
|
if (m->matrix[i][j] < 0)
|
||||||
|
m->matrix[i][3] = size[j] - 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
|
KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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.18 2001/09/14 19:25:17 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.19 2002/09/29 23:39:47 keithp Exp $ */
|
||||||
|
|
||||||
#include "vesa.h"
|
#include "vesa.h"
|
||||||
#ifdef RANDR
|
#ifdef RANDR
|
||||||
|
@ -401,7 +401,7 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr)
|
||||||
vesaReportMode (&pscr->mode);
|
vesaReportMode (&pscr->mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
pscr->rotate = screen->rotation;
|
pscr->randr = screen->randr;
|
||||||
pscr->shadow = vesa_shadow;
|
pscr->shadow = vesa_shadow;
|
||||||
pscr->origDepth = screen->fb[0].depth;
|
pscr->origDepth = screen->fb[0].depth;
|
||||||
pscr->layerKind = LAYER_FB;
|
pscr->layerKind = LAYER_FB;
|
||||||
|
@ -409,6 +409,7 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr)
|
||||||
/*
|
/*
|
||||||
* Compute visual support for the selected depth
|
* Compute visual support for the selected depth
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (pscr->mode.MemoryModel) {
|
switch (pscr->mode.MemoryModel) {
|
||||||
case MEMORY_DIRECT:
|
case MEMORY_DIRECT:
|
||||||
/* TrueColor or DirectColor */
|
/* TrueColor or DirectColor */
|
||||||
|
@ -748,50 +749,31 @@ vesaConfigureScreen (ScreenPtr pScreen)
|
||||||
if (pscr->mapping == VESA_PLANAR || pscr->mapping == VESA_MONO)
|
if (pscr->mapping == VESA_PLANAR || pscr->mapping == VESA_MONO)
|
||||||
{
|
{
|
||||||
pscr->shadow = TRUE;
|
pscr->shadow = TRUE;
|
||||||
pscr->rotate = 0;
|
pscr->randr = RR_Rotate_0;
|
||||||
m.matrix[0][0] = 1; m.matrix[0][1] = 0; m.matrix[0][2] = 0;
|
|
||||||
m.matrix[1][0] = 0; m.matrix[1][1] = 1; m.matrix[1][2] = 0;
|
|
||||||
}
|
}
|
||||||
else switch (pscr->rotate) {
|
else if (pscr->mapping == VESA_WINDOWED)
|
||||||
case 0:
|
pscr->shadow = TRUE;
|
||||||
|
else if (pscr->randr != RR_Rotate_0)
|
||||||
|
pscr->shadow = TRUE;
|
||||||
|
else
|
||||||
|
pscr->shadow = vesa_shadow;
|
||||||
|
|
||||||
|
KdComputeMouseMatrix (&m, pscr->randr,
|
||||||
|
pscr->mode.XResolution, pscr->mode.YResolution);
|
||||||
|
|
||||||
|
if (m.matrix[0][0])
|
||||||
|
{
|
||||||
pScreen->width = pscr->mode.XResolution;
|
pScreen->width = pscr->mode.XResolution;
|
||||||
pScreen->height = pscr->mode.YResolution;
|
pScreen->height = pscr->mode.YResolution;
|
||||||
pScreen->mmWidth = screen->width_mm;
|
pScreen->mmWidth = screen->width_mm;
|
||||||
pScreen->mmHeight = screen->height_mm;
|
pScreen->mmHeight = screen->height_mm;
|
||||||
if (pscr->mapping == VESA_WINDOWED)
|
}
|
||||||
pscr->shadow = TRUE;
|
else
|
||||||
else
|
{
|
||||||
pscr->shadow = vesa_shadow;
|
|
||||||
m.matrix[0][0] = 1; m.matrix[0][1] = 0; m.matrix[0][2] = 0;
|
|
||||||
m.matrix[1][0] = 0; m.matrix[1][1] = 1; m.matrix[1][2] = 0;
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
pScreen->width = pscr->mode.YResolution;
|
pScreen->width = pscr->mode.YResolution;
|
||||||
pScreen->height = pscr->mode.XResolution;
|
pScreen->height = pscr->mode.XResolution;
|
||||||
pScreen->mmWidth = screen->height_mm;
|
pScreen->mmWidth = screen->height_mm;
|
||||||
pScreen->mmHeight = screen->width_mm;
|
pScreen->mmHeight = screen->width_mm;
|
||||||
pscr->shadow = TRUE;
|
|
||||||
m.matrix[0][0] = 0; m.matrix[0][1] = -1; m.matrix[0][2] = pscr->mode.YResolution - 1;
|
|
||||||
m.matrix[1][0] = 1; m.matrix[1][1] = 0; m.matrix[1][2] = 0;
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
pScreen->width = pscr->mode.XResolution;
|
|
||||||
pScreen->height = pscr->mode.YResolution;
|
|
||||||
pScreen->mmWidth = screen->width_mm;
|
|
||||||
pScreen->mmHeight = screen->height_mm;
|
|
||||||
pscr->shadow = TRUE;
|
|
||||||
m.matrix[0][0] = -1; m.matrix[0][1] = 0; m.matrix[0][2] = pscr->mode.XResolution - 1;
|
|
||||||
m.matrix[1][0] = 0; m.matrix[1][1] = -1; m.matrix[1][2] = pscr->mode.YResolution - 1;
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
pScreen->width = pscr->mode.YResolution;
|
|
||||||
pScreen->height = pscr->mode.XResolution;
|
|
||||||
pScreen->mmWidth = screen->height_mm;
|
|
||||||
pScreen->mmHeight = screen->width_mm;
|
|
||||||
pscr->shadow = TRUE;
|
|
||||||
m.matrix[0][0] = 0; m.matrix[0][1] = 1; m.matrix[0][2] = 0;
|
|
||||||
m.matrix[1][0] = -1; m.matrix[1][1] = 0; m.matrix[1][2] = pscr->mode.XResolution - 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
KdSetMouseMatrix (&m);
|
KdSetMouseMatrix (&m);
|
||||||
}
|
}
|
||||||
|
@ -811,7 +793,7 @@ vesaLayerCreate (ScreenPtr pScreen)
|
||||||
|
|
||||||
if (pscr->shadow)
|
if (pscr->shadow)
|
||||||
{
|
{
|
||||||
if (pscr->rotate)
|
if (pscr->randr != RR_Rotate_0)
|
||||||
update = shadowUpdateRotatePacked;
|
update = shadowUpdateRotatePacked;
|
||||||
else
|
else
|
||||||
update = shadowUpdatePacked;
|
update = shadowUpdatePacked;
|
||||||
|
@ -855,7 +837,7 @@ vesaLayerCreate (ScreenPtr pScreen)
|
||||||
pScreen->width, pScreen->height, screen->fb[0].depth);
|
pScreen->width, pScreen->height, screen->fb[0].depth);
|
||||||
|
|
||||||
return LayerCreate (pScreen, kind, screen->fb[0].depth,
|
return LayerCreate (pScreen, kind, screen->fb[0].depth,
|
||||||
pPixmap, update, window, pscr->rotate, 0);
|
pPixmap, update, window, pscr->randr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -929,7 +911,7 @@ vesaMapFramebuffer (KdScreenInfo *screen)
|
||||||
ErrorF ("\tStatic color bpp %d depth %d\n",
|
ErrorF ("\tStatic color bpp %d depth %d\n",
|
||||||
bpp, depth);
|
bpp, depth);
|
||||||
}
|
}
|
||||||
pscr->rotate = 0;
|
pscr->randr = RR_Rotate_0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -941,7 +923,8 @@ vesaMapFramebuffer (KdScreenInfo *screen)
|
||||||
case 32:
|
case 32:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pscr->rotate = 0;
|
pscr->randr = RR_Rotate_0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->width = pscr->mode.XResolution;
|
screen->width = pscr->mode.XResolution;
|
||||||
|
@ -1012,7 +995,8 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
int n;
|
int n;
|
||||||
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|
|
||||||
|
RR_Reflect_X|RR_Reflect_Y);
|
||||||
/*
|
/*
|
||||||
* Get mode information from BIOS -- every time in case
|
* Get mode information from BIOS -- every time in case
|
||||||
* something changes, like an external monitor is plugged in
|
* something changes, like an external monitor is plugged in
|
||||||
|
@ -1044,7 +1028,7 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
|
mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
|
||||||
{
|
{
|
||||||
int width, height, width_mm, height_mm;
|
int width, height, width_mm, height_mm;
|
||||||
if (screen->rotation == 0 || screen->rotation == 180)
|
if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
|
||||||
{
|
{
|
||||||
width = mode->XResolution;
|
width = mode->XResolution;
|
||||||
height = mode->YResolution;
|
height = mode->YResolution;
|
||||||
|
@ -1064,17 +1048,8 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
if (mode->XResolution == screen->width &&
|
if (mode->XResolution == screen->width &&
|
||||||
mode->YResolution == screen->height)
|
mode->YResolution == screen->height)
|
||||||
{
|
{
|
||||||
int rotate = pscr->rotate - screen->rotation;
|
int randr = KdSubRotation (pscr->randr, screen->randr);
|
||||||
int rot;
|
RRSetCurrentConfig (pScreen, randr, pSize);
|
||||||
if (rotate < 0)
|
|
||||||
rotate += 360;
|
|
||||||
switch (rotate) {
|
|
||||||
case 0: rot = RR_Rotate_0; break;
|
|
||||||
case 90: rot = RR_Rotate_90; break;
|
|
||||||
case 180: rot = RR_Rotate_180; break;
|
|
||||||
case 270: rot = RR_Rotate_270; break;
|
|
||||||
}
|
|
||||||
RRSetCurrentConfig (pScreen, rot, pSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1082,7 @@ vesaLayerRemove (WindowPtr pWin, pointer value)
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
vesaRandRSetConfig (ScreenPtr pScreen,
|
vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
Rotation rotation,
|
Rotation randr,
|
||||||
RRScreenSizePtr pSize)
|
RRScreenSizePtr pSize)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
|
@ -1126,7 +1101,7 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
LayerPtr pNewLayer;
|
LayerPtr pNewLayer;
|
||||||
int newwidth, newheight;
|
int newwidth, newheight;
|
||||||
|
|
||||||
if (screen->rotation == 0 || screen->rotation == 180)
|
if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
|
||||||
{
|
{
|
||||||
newwidth = pSize->width;
|
newwidth = pSize->width;
|
||||||
newheight = pSize->height;
|
newheight = pSize->height;
|
||||||
|
@ -1182,17 +1157,8 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pscr->mode = *mode;
|
pscr->mode = *mode;
|
||||||
switch (rotation) {
|
pscr->randr = KdAddRotation (screen->randr, randr);
|
||||||
case RR_Rotate_0: pscr->rotate = 0; break;
|
|
||||||
case RR_Rotate_90: pscr->rotate = 90; break;
|
|
||||||
case RR_Rotate_180: pscr->rotate = 180; break;
|
|
||||||
case RR_Rotate_270: pscr->rotate = 270; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pscr->rotate += screen->rotation;
|
|
||||||
if (pscr->rotate >= 360)
|
|
||||||
pscr->rotate -= 360;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Can't rotate some formats
|
* Can't rotate some formats
|
||||||
*/
|
*/
|
||||||
|
@ -1202,7 +1168,7 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
case 32:
|
case 32:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (pscr->rotate)
|
if (pscr->randr)
|
||||||
goto bail2;
|
goto bail2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1222,7 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
pscr->pLayer = pNewLayer;
|
pscr->pLayer = pNewLayer;
|
||||||
|
|
||||||
/* set the subpixel order */
|
/* set the subpixel order */
|
||||||
KdSetSubpixelOrder (pScreen, pscr->rotate);
|
KdSetSubpixelOrder (pScreen, pscr->randr);
|
||||||
|
|
||||||
if (wasEnabled)
|
if (wasEnabled)
|
||||||
KdEnableScreen (pScreen);
|
KdEnableScreen (pScreen);
|
||||||
|
|
|
@ -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.12 2001/09/05 07:12:42 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.13 2002/09/29 23:39:47 keithp Exp $ */
|
||||||
|
|
||||||
#ifndef _VESA_H_
|
#ifndef _VESA_H_
|
||||||
#define _VESA_H_
|
#define _VESA_H_
|
||||||
|
@ -95,7 +95,7 @@ typedef struct _VesaCardPriv {
|
||||||
typedef struct _VesaScreenPriv {
|
typedef struct _VesaScreenPriv {
|
||||||
VesaModeRec mode;
|
VesaModeRec mode;
|
||||||
Bool shadow;
|
Bool shadow;
|
||||||
int rotate;
|
Rotation randr;
|
||||||
int mapping;
|
int mapping;
|
||||||
int origDepth;
|
int origDepth;
|
||||||
int layerKind;
|
int layerKind;
|
||||||
|
|
Loading…
Reference in New Issue