Too many changes, but all in kdrive:
Add support for global screen origins (-origin option), handles both Xinerama and mouse crossings. Fix XV enable/disable sequences -- can't use card wrappers as cards have more than one screen. Change vesa/fbdev to use new depth-independent rotation shadow update Fix vesa to allow starting rotation value (again) Make vesa driver write all colormap changes in one INT10 call
This commit is contained in:
parent
9826d5a133
commit
79486b3b5c
|
@ -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.25 2001/07/16 19:48:00 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.26 2001/07/19 08:46:30 keithp Exp $ */
|
||||||
|
|
||||||
#include "fbdev.h"
|
#include "fbdev.h"
|
||||||
|
|
||||||
|
@ -400,41 +400,10 @@ fbdevLayerCreate (ScreenPtr pScreen)
|
||||||
else
|
else
|
||||||
#endif /* FAKE24_ON_16 */
|
#endif /* FAKE24_ON_16 */
|
||||||
{
|
{
|
||||||
switch (scrpriv->rotation) {
|
if (scrpriv->rotation)
|
||||||
case 0:
|
update = shadowUpdateRotatePacked;
|
||||||
|
else
|
||||||
update = shadowUpdatePacked;
|
update = shadowUpdatePacked;
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
|
||||||
case 8:
|
|
||||||
update = shadowUpdateRotate8_90; break;
|
|
||||||
case 16:
|
|
||||||
update = shadowUpdateRotate16_90; break;
|
|
||||||
case 32:
|
|
||||||
update = shadowUpdateRotate32_90; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
|
||||||
case 8:
|
|
||||||
update = shadowUpdateRotate8_180; break;
|
|
||||||
case 16:
|
|
||||||
update = shadowUpdateRotate16_180; break;
|
|
||||||
case 32:
|
|
||||||
update = shadowUpdateRotate32_180; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
|
||||||
case 8:
|
|
||||||
update = shadowUpdateRotate8_270; break;
|
|
||||||
case 16:
|
|
||||||
update = shadowUpdateRotate16_270; break;
|
|
||||||
case 32:
|
|
||||||
update = shadowUpdateRotate32_270; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!update)
|
if (!update)
|
||||||
abort ();
|
abort ();
|
||||||
|
@ -449,7 +418,7 @@ fbdevLayerCreate (ScreenPtr pScreen)
|
||||||
window = 0;
|
window = 0;
|
||||||
}
|
}
|
||||||
return LayerCreate (pScreen, kind, screen->fb[0].depth,
|
return LayerCreate (pScreen, kind, screen->fb[0].depth,
|
||||||
pPixmap, update, window, 0);
|
pPixmap, update, window, scrpriv->rotation, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ of the copyright holder.
|
||||||
X Window System is a trademark of The Open Group */
|
X Window System is a trademark of The Open Group */
|
||||||
|
|
||||||
|
|
||||||
/* $XFree86$ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/i810/i810.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* i810.c - KDrive driver for the i810 chipset
|
* i810.c - KDrive driver for the i810 chipset
|
||||||
|
@ -1954,7 +1954,9 @@ i810Enable (ScreenPtr pScreen)
|
||||||
/* Set the DPMS mode */
|
/* Set the DPMS mode */
|
||||||
OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect);
|
OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect);
|
||||||
}
|
}
|
||||||
|
#ifdef XV
|
||||||
|
KdXVEnable (pScreen);
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1972,6 +1974,9 @@ i810Disable(ScreenPtr pScreen) {
|
||||||
if (I810_DEBUG)
|
if (I810_DEBUG)
|
||||||
fprintf(stderr,"i810Disable\n");
|
fprintf(stderr,"i810Disable\n");
|
||||||
|
|
||||||
|
#ifdef XV
|
||||||
|
KdXVDisable (pScreen);
|
||||||
|
#endif
|
||||||
i810Restore(screen->card);
|
i810Restore(screen->card);
|
||||||
|
|
||||||
if (!i810UnbindGARTMemory(screen))
|
if (!i810UnbindGARTMemory(screen))
|
||||||
|
|
|
@ -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.4 2001/06/19 09:31:47 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.5 2001/06/23 03:41:24 keithp Exp $ */
|
||||||
|
|
||||||
#include "mach64.h"
|
#include "mach64.h"
|
||||||
#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
|
@ -222,12 +222,18 @@ mach64Enable (ScreenPtr pScreen)
|
||||||
|
|
||||||
mach64SetMMIO (mach64c);
|
mach64SetMMIO (mach64c);
|
||||||
mach64DPMS (pScreen, KD_DPMS_NORMAL);
|
mach64DPMS (pScreen, KD_DPMS_NORMAL);
|
||||||
|
#ifdef XV
|
||||||
|
KdXVEnable (pScreen);
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mach64Disable (ScreenPtr pScreen)
|
mach64Disable (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
|
#ifdef XV
|
||||||
|
KdXVDisable (pScreen);
|
||||||
|
#endif
|
||||||
vesaDisable (pScreen);
|
vesaDisable (pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
*
|
*
|
||||||
* Tested running under a Compaq IPAQ Pocket PC running Linux
|
* Tested running under a Compaq IPAQ Pocket PC running Linux
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/hw/kdrive/pcmcia/pcmcia.c,v 1.3 2001/06/20 21:53:31 alanh Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/pcmcia/pcmcia.c,v 1.4 2001/06/21 00:58:51 keithp Exp $ */
|
||||||
|
|
||||||
#include "pcmcia.h"
|
#include "pcmcia.h"
|
||||||
#define extern
|
#define extern
|
||||||
|
@ -376,7 +376,7 @@ pcmciaLayerCreate (ScreenPtr pScreen)
|
||||||
pPixmap = 0;
|
pPixmap = 0;
|
||||||
|
|
||||||
return LayerCreate (pScreen, kind, screen->fb[0].depth,
|
return LayerCreate (pScreen, kind, screen->fb[0].depth,
|
||||||
pPixmap, update, window, 0);
|
pPixmap, update, window, pcmcias->rotation, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RANDR
|
#ifdef RANDR
|
||||||
|
|
|
@ -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.c,v 1.16 2001/06/04 09:45:41 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.17 2001/06/13 19:18:03 keithp Exp $ */
|
||||||
|
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
#ifdef PSEUDO8
|
#ifdef PSEUDO8
|
||||||
|
@ -47,6 +47,7 @@ Bool kdEmulateMiddleButton;
|
||||||
Bool kdDisableZaphod;
|
Bool kdDisableZaphod;
|
||||||
Bool kdEnabled;
|
Bool kdEnabled;
|
||||||
Bool kdSwitchPending;
|
Bool kdSwitchPending;
|
||||||
|
DDXPointRec kdOrigin;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Carry arguments from InitOutput through driver initialization
|
* Carry arguments from InitOutput through driver initialization
|
||||||
|
@ -340,8 +341,7 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
|
|
||||||
screen->dumb = kdDumbDriver;
|
screen->dumb = kdDumbDriver;
|
||||||
screen->softCursor = kdSoftCursor;
|
screen->softCursor = kdSoftCursor;
|
||||||
kdDumbDriver = FALSE;
|
screen->origin = kdOrigin;
|
||||||
kdSoftCursor = FALSE;
|
|
||||||
screen->rotation = 0;
|
screen->rotation = 0;
|
||||||
screen->width = 0;
|
screen->width = 0;
|
||||||
screen->height = 0;
|
screen->height = 0;
|
||||||
|
@ -386,22 +386,28 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kdOrigin.x += screen->width;
|
||||||
|
kdOrigin.y = 0;
|
||||||
|
kdDumbDriver = FALSE;
|
||||||
|
kdSoftCursor = FALSE;
|
||||||
|
|
||||||
if (delim == '@')
|
if (delim == '@')
|
||||||
{
|
{
|
||||||
arg = KdParseFindNext (arg, "x", save, &delim);
|
arg = KdParseFindNext (arg, "x", save, &delim);
|
||||||
if (!save[0])
|
if (save[0])
|
||||||
return;
|
{
|
||||||
screen->rotation = atoi (save);
|
screen->rotation = atoi (save);
|
||||||
if (screen->rotation < 45)
|
if (screen->rotation < 45)
|
||||||
screen->rotation = 0;
|
screen->rotation = 0;
|
||||||
else if (screen->rotation < 135)
|
else if (screen->rotation < 135)
|
||||||
screen->rotation = 90;
|
screen->rotation = 90;
|
||||||
else if (screen->rotation < 225)
|
else if (screen->rotation < 225)
|
||||||
screen->rotation = 180;
|
screen->rotation = 180;
|
||||||
else if (screen->rotation < 315)
|
else if (screen->rotation < 315)
|
||||||
screen->rotation = 270;
|
screen->rotation = 270;
|
||||||
else
|
else
|
||||||
screen->rotation = 0;
|
screen->rotation = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb = 0;
|
fb = 0;
|
||||||
|
@ -496,6 +502,25 @@ KdProcessArgument (int argc, char **argv, int i)
|
||||||
}
|
}
|
||||||
if (!strcmp (argv[i], "-standalone"))
|
if (!strcmp (argv[i], "-standalone"))
|
||||||
return 1;
|
return 1;
|
||||||
|
if (!strcmp (argv[i], "-origin"))
|
||||||
|
{
|
||||||
|
if ((i+1) < argc)
|
||||||
|
{
|
||||||
|
char *x = argv[i+1];
|
||||||
|
char *y = strchr (x, ',');
|
||||||
|
if (x)
|
||||||
|
kdOrigin.x = atoi (x);
|
||||||
|
else
|
||||||
|
kdOrigin.x = 0;
|
||||||
|
if (y)
|
||||||
|
kdOrigin.y = atoi(y+1);
|
||||||
|
else
|
||||||
|
kdOrigin.y = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
UseMsg ();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
#ifdef PSEUDO8
|
#ifdef PSEUDO8
|
||||||
return p8ProcessArgument (argc, argv, i);
|
return p8ProcessArgument (argc, argv, i);
|
||||||
#else
|
#else
|
||||||
|
@ -671,6 +696,9 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
||||||
pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
|
pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
|
||||||
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
|
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
|
||||||
|
#ifdef PANORAMIX
|
||||||
|
dixScreenOrigins[pScreen->myNum] = screen->origin;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!monitorResolution)
|
if (!monitorResolution)
|
||||||
monitorResolution = 75;
|
monitorResolution = 75;
|
||||||
|
|
|
@ -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.16 2001/06/29 14:00:40 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.17 2001/07/11 02:58:19 keithp Exp $ */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "X.h"
|
#include "X.h"
|
||||||
|
@ -111,6 +111,7 @@ typedef struct _KdScreenInfo {
|
||||||
Bool dumb;
|
Bool dumb;
|
||||||
Bool softCursor;
|
Bool softCursor;
|
||||||
int mynum;
|
int mynum;
|
||||||
|
DDXPointRec origin;
|
||||||
KdFrameBuffer fb[KD_MAX_FB];
|
KdFrameBuffer fb[KD_MAX_FB];
|
||||||
} KdScreenInfo;
|
} KdScreenInfo;
|
||||||
|
|
||||||
|
|
|
@ -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.17 2001/06/29 14:00:40 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.18 2001/07/11 02:58:19 keithp Exp $ */
|
||||||
|
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
@ -1394,54 +1394,92 @@ KdWakeupHandler (int screen,
|
||||||
KdProcessSwitch ();
|
KdProcessSwitch ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin))
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
|
KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = *ppScreen;
|
ScreenPtr pScreen = *ppScreen;
|
||||||
|
ScreenPtr pNewScreen;
|
||||||
int n;
|
int n;
|
||||||
|
int dx, dy;
|
||||||
|
int best_x, best_y;
|
||||||
|
int n_best_x, n_best_y;
|
||||||
CARD32 ms;
|
CARD32 ms;
|
||||||
|
|
||||||
if (kdDisableZaphod || screenInfo.numScreens <= 1)
|
if (kdDisableZaphod || screenInfo.numScreens <= 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (*x < 0 || *y < 0)
|
|
||||||
{
|
if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
|
||||||
ms = GetTimeInMillis ();
|
return FALSE;
|
||||||
if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
|
|
||||||
return FALSE;
|
|
||||||
kdOffScreen = TRUE;
|
|
||||||
kdOffScreenTime = ms;
|
|
||||||
|
|
||||||
n = pScreen->myNum - 1;
|
ms = GetTimeInMillis ();
|
||||||
if (n < 0)
|
if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
|
||||||
n = screenInfo.numScreens - 1;
|
return FALSE;
|
||||||
pScreen = screenInfo.screens[n];
|
kdOffScreen = TRUE;
|
||||||
|
kdOffScreenTime = ms;
|
||||||
|
n_best_x = -1;
|
||||||
|
best_x = 32767;
|
||||||
|
n_best_y = -1;
|
||||||
|
best_y = 32767;
|
||||||
|
for (n = 0; n < screenInfo.numScreens; n++)
|
||||||
|
{
|
||||||
|
pNewScreen = screenInfo.screens[n];
|
||||||
|
if (pNewScreen == pScreen)
|
||||||
|
continue;
|
||||||
|
dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
|
||||||
|
dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
|
||||||
if (*x < 0)
|
if (*x < 0)
|
||||||
*x += pScreen->width;
|
{
|
||||||
|
if (dx <= 0 && -dx < best_x)
|
||||||
|
{
|
||||||
|
best_x = -dx;
|
||||||
|
n_best_x = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (*x >= pScreen->width)
|
||||||
|
{
|
||||||
|
if (dx >= 0 && dx < best_x)
|
||||||
|
{
|
||||||
|
best_x = dx;
|
||||||
|
n_best_x = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (*y < 0)
|
if (*y < 0)
|
||||||
*y += pScreen->height;
|
{
|
||||||
*ppScreen = pScreen;
|
if (dy <= 0 && -dy < best_y)
|
||||||
return TRUE;
|
{
|
||||||
|
best_y = -dy;
|
||||||
|
n_best_y = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (*y >= pScreen->height)
|
||||||
|
{
|
||||||
|
if (dy >= 0 && dy < best_y)
|
||||||
|
{
|
||||||
|
best_y = dy;
|
||||||
|
n_best_y = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (*x >= pScreen->width || *y >= pScreen->height)
|
if (best_y < best_x)
|
||||||
{
|
n_best_x = n_best_y;
|
||||||
ms = GetTimeInMillis ();
|
if (n_best_x == -1)
|
||||||
if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
|
return FALSE;
|
||||||
return FALSE;
|
pNewScreen = screenInfo.screens[n_best_x];
|
||||||
kdOffScreen = TRUE;
|
|
||||||
kdOffScreenTime = ms;
|
if (*x < 0)
|
||||||
|
*x += pNewScreen->width;
|
||||||
n = pScreen->myNum + 1;
|
if (*y < 0)
|
||||||
if (n >= screenInfo.numScreens)
|
*y += pNewScreen->height;
|
||||||
n = 0;
|
|
||||||
if (*x >= pScreen->width)
|
if (*x >= pScreen->width)
|
||||||
*x -= pScreen->width;
|
*x -= pScreen->width;
|
||||||
if (*y >= pScreen->height)
|
if (*y >= pScreen->height)
|
||||||
*y -= pScreen->height;
|
*y -= pScreen->height;
|
||||||
pScreen = screenInfo.screens[n];
|
|
||||||
*ppScreen = pScreen;
|
*ppScreen = pNewScreen;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -35,7 +35,7 @@ of the copyright holder.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $XFree86$ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kxv.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
|
||||||
|
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
|
|
||||||
|
@ -98,12 +98,7 @@ static Bool KdXVDestroyWindow(WindowPtr pWin);
|
||||||
static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
|
static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
|
||||||
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
|
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
|
||||||
|
|
||||||
/* KdCardInfo functions */
|
|
||||||
static Bool KdXVEnable(ScreenPtr);
|
|
||||||
static void KdXVDisable(ScreenPtr);
|
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
|
|
||||||
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
|
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,7 +186,6 @@ KdXVScreenInit(
|
||||||
int num
|
int num
|
||||||
){
|
){
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
KdCardInfo *card = pScreenPriv->card;
|
|
||||||
KdXVScreenPtr ScreenPriv;
|
KdXVScreenPtr ScreenPriv;
|
||||||
XvScreenPtr pxvs;
|
XvScreenPtr pxvs;
|
||||||
|
|
||||||
|
@ -239,19 +233,13 @@ KdXVScreenInit(
|
||||||
ScreenPriv->WindowExposures = pScreen->WindowExposures;
|
ScreenPriv->WindowExposures = pScreen->WindowExposures;
|
||||||
ScreenPriv->ClipNotify = pScreen->ClipNotify;
|
ScreenPriv->ClipNotify = pScreen->ClipNotify;
|
||||||
|
|
||||||
/* fprintf(stderr,"XV: Wrapping screen & card funcs\n"); */
|
/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
|
||||||
|
|
||||||
ScreenPriv->enable = card->cfuncs->enable;
|
|
||||||
ScreenPriv->disable = card->cfuncs->disable;
|
|
||||||
|
|
||||||
pScreen->CreateWindow = KdXVCreateWindow;
|
pScreen->CreateWindow = KdXVCreateWindow;
|
||||||
pScreen->DestroyWindow = KdXVDestroyWindow;
|
pScreen->DestroyWindow = KdXVDestroyWindow;
|
||||||
pScreen->WindowExposures = KdXVWindowExposures;
|
pScreen->WindowExposures = KdXVWindowExposures;
|
||||||
pScreen->ClipNotify = KdXVClipNotify;
|
pScreen->ClipNotify = KdXVClipNotify;
|
||||||
|
|
||||||
card->cfuncs->disable = KdXVDisable;
|
|
||||||
card->cfuncs->enable = KdXVEnable;
|
|
||||||
|
|
||||||
if(!KdXVInitAdaptors(pScreen, adaptors, num))
|
if(!KdXVInitAdaptors(pScreen, adaptors, num))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1154,7 +1142,6 @@ static Bool
|
||||||
KdXVCloseScreen(int i, ScreenPtr pScreen)
|
KdXVCloseScreen(int i, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
KdCardInfo *card = pScreenPriv->card;
|
|
||||||
KdScreenInfo *screen=pScreenPriv->screen;
|
KdScreenInfo *screen=pScreenPriv->screen;
|
||||||
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
||||||
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
|
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
|
||||||
|
@ -1168,10 +1155,7 @@ KdXVCloseScreen(int i, ScreenPtr pScreen)
|
||||||
pScreen->WindowExposures = ScreenPriv->WindowExposures;
|
pScreen->WindowExposures = ScreenPriv->WindowExposures;
|
||||||
pScreen->ClipNotify = ScreenPriv->ClipNotify;
|
pScreen->ClipNotify = ScreenPriv->ClipNotify;
|
||||||
|
|
||||||
/* fprintf(stderr,"XV: Unwrapping screen & card funcs\n"); */
|
/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
|
||||||
|
|
||||||
card->cfuncs->enable = ScreenPriv->enable;
|
|
||||||
card->cfuncs->disable = ScreenPriv->disable;
|
|
||||||
|
|
||||||
for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
|
for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
|
||||||
KdXVFreeAdaptor(pa);
|
KdXVFreeAdaptor(pa);
|
||||||
|
@ -1202,29 +1186,41 @@ KdXVQueryAdaptors(
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
KdXVEnable(ScreenPtr pScreen)
|
KdXVRunning (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
static int count=0;
|
return (KdXVGeneration == serverGeneration &&
|
||||||
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
|
GET_XV_SCREEN(pScreen) != 0);
|
||||||
Bool ret;
|
|
||||||
|
|
||||||
ret = (*ScreenPriv->enable)(pScreen);
|
|
||||||
|
|
||||||
if(ret) WalkTree(pScreen, KdXVReputAllVideo, 0);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
Bool
|
||||||
|
KdXVEnable(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
KdXVScreenPtr ScreenPriv;
|
||||||
|
|
||||||
|
if (!KdXVRunning (pScreen))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
WalkTree(pScreen, KdXVReputAllVideo, 0);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
KdXVDisable(ScreenPtr pScreen)
|
KdXVDisable(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
XvScreenPtr pxvs;
|
||||||
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
|
KdXVScreenPtr ScreenPriv;
|
||||||
XvAdaptorPtr pAdaptor;
|
XvAdaptorPtr pAdaptor;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
XvPortRecPrivatePtr pPriv;
|
XvPortRecPrivatePtr pPriv;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
if (!KdXVRunning (pScreen))
|
||||||
|
return;
|
||||||
|
|
||||||
|
pxvs = GET_XV_SCREEN(pScreen);
|
||||||
|
ScreenPriv = GET_KDXV_SCREEN(pScreen);
|
||||||
|
|
||||||
for(i = 0; i < pxvs->nAdaptors; i++) {
|
for(i = 0; i < pxvs->nAdaptors; i++) {
|
||||||
pAdaptor = &pxvs->pAdaptors[i];
|
pAdaptor = &pxvs->pAdaptors[i];
|
||||||
for(j = 0; j < pAdaptor->nPorts; j++) {
|
for(j = 0; j < pAdaptor->nPorts; j++) {
|
||||||
|
@ -1247,8 +1243,6 @@ KdXVDisable(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*ScreenPriv->disable)(pScreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**** XvAdaptorRec fields ****/
|
/**** XvAdaptorRec fields ****/
|
||||||
|
|
|
@ -35,7 +35,7 @@ of the copyright holder.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $XFree86$ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/kxv.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
|
||||||
|
|
||||||
#ifndef _XVDIX_H_
|
#ifndef _XVDIX_H_
|
||||||
#define _XVDIX_H_
|
#define _XVDIX_H_
|
||||||
|
@ -249,6 +249,10 @@ KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
|
||||||
|
|
||||||
void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
|
void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
|
||||||
|
|
||||||
|
/* Must be called from KdCardInfo functions, can be called without Xv enabled */
|
||||||
|
Bool KdXVEnable(ScreenPtr);
|
||||||
|
void KdXVDisable(ScreenPtr);
|
||||||
|
|
||||||
/*** These are DDX layer privates ***/
|
/*** These are DDX layer privates ***/
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,8 +261,6 @@ typedef struct {
|
||||||
DestroyWindowProcPtr DestroyWindow;
|
DestroyWindowProcPtr DestroyWindow;
|
||||||
ClipNotifyProcPtr ClipNotify;
|
ClipNotifyProcPtr ClipNotify;
|
||||||
WindowExposuresProcPtr WindowExposures;
|
WindowExposuresProcPtr WindowExposures;
|
||||||
void (*disable) (ScreenPtr); /* turn off rendering */
|
|
||||||
Bool (*enable) (ScreenPtr); /* set up for rendering */
|
|
||||||
} KdXVScreenRec, *KdXVScreenPtr;
|
} KdXVScreenRec, *KdXVScreenPtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -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.13 2001/06/04 09:45:42 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.14 2001/06/11 01:38:54 keithp Exp $ */
|
||||||
|
|
||||||
#include "vesa.h"
|
#include "vesa.h"
|
||||||
#ifdef RANDR
|
#ifdef RANDR
|
||||||
|
@ -36,9 +36,8 @@ Bool vesa_verbose = FALSE;
|
||||||
|
|
||||||
#define VesaPriv(scr) ((VesaScreenPrivPtr) (scr)->driver)
|
#define VesaPriv(scr) ((VesaScreenPrivPtr) (scr)->driver)
|
||||||
|
|
||||||
#define ScreenRotated(scr) (VesaPriv(scr)->rotate == 90 || VesaPriv(scr)->rotate == 270)
|
#define vesaWidth(scr,vmib) ((vmib)->XResolution)
|
||||||
#define vesaWidth(scr,vmib) (ScreenRotated(scr) ? (vmib)->YResolution : (vmib)->XResolution)
|
#define vesaHeight(scr,vmib) ((vmib)->YResolution)
|
||||||
#define vesaHeight(scr,vmib) (ScreenRotated(scr) ? (vmib)->XResolution : (vmib)->YResolution)
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
vesaModeSupportable (VesaModePtr mode, Bool complain)
|
vesaModeSupportable (VesaModePtr mode, Bool complain)
|
||||||
|
@ -735,6 +734,65 @@ vesaCreateColormap16 (ColormapPtr pmap)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vesaConfigureScreen (ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
KdScreenPriv(pScreen);
|
||||||
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
|
VesaCardPrivPtr priv = pScreenPriv->card->driver;
|
||||||
|
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
|
||||||
|
|
||||||
|
KdMouseMatrix m;
|
||||||
|
|
||||||
|
if (pscr->mapping == VESA_PLANAR || pscr->mapping == VESA_MONO)
|
||||||
|
{
|
||||||
|
pscr->shadow = TRUE;
|
||||||
|
pscr->rotate = 0;
|
||||||
|
}
|
||||||
|
else switch (pscr->rotate) {
|
||||||
|
case 0:
|
||||||
|
pScreen->width = pscr->mode.XResolution;
|
||||||
|
pScreen->height = pscr->mode.YResolution;
|
||||||
|
pScreen->mmWidth = screen->width_mm;
|
||||||
|
pScreen->mmHeight = screen->height_mm;
|
||||||
|
if (pscr->mapping == VESA_WINDOWED)
|
||||||
|
pscr->shadow = TRUE;
|
||||||
|
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->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] = 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);
|
||||||
|
}
|
||||||
|
|
||||||
LayerPtr
|
LayerPtr
|
||||||
vesaLayerCreate (ScreenPtr pScreen)
|
vesaLayerCreate (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
|
@ -750,13 +808,15 @@ vesaLayerCreate (ScreenPtr pScreen)
|
||||||
|
|
||||||
if (pscr->shadow)
|
if (pscr->shadow)
|
||||||
{
|
{
|
||||||
|
if (pscr->rotate)
|
||||||
|
update = shadowUpdateRotatePacked;
|
||||||
|
else
|
||||||
|
update = shadowUpdatePacked;
|
||||||
switch (pscr->mapping) {
|
switch (pscr->mapping) {
|
||||||
case VESA_LINEAR:
|
case VESA_LINEAR:
|
||||||
update = shadowUpdatePacked;
|
|
||||||
window = vesaWindowLinear;
|
window = vesaWindowLinear;
|
||||||
break;
|
break;
|
||||||
case VESA_WINDOWED:
|
case VESA_WINDOWED:
|
||||||
update = shadowUpdatePacked;
|
|
||||||
window = vesaWindowWindowed;
|
window = vesaWindowWindowed;
|
||||||
break;
|
break;
|
||||||
case VESA_PLANAR:
|
case VESA_PLANAR:
|
||||||
|
@ -766,7 +826,6 @@ vesaLayerCreate (ScreenPtr pScreen)
|
||||||
else
|
else
|
||||||
update = shadowUpdatePlanar4;
|
update = shadowUpdatePlanar4;
|
||||||
window = vesaWindowPlanar;
|
window = vesaWindowPlanar;
|
||||||
pscr->rotate = 0;
|
|
||||||
break;
|
break;
|
||||||
case VESA_MONO:
|
case VESA_MONO:
|
||||||
update = vesaUpdateMono;
|
update = vesaUpdateMono;
|
||||||
|
@ -774,39 +833,6 @@ vesaLayerCreate (ScreenPtr pScreen)
|
||||||
window = vesaWindowCga;
|
window = vesaWindowCga;
|
||||||
else
|
else
|
||||||
window = vesaWindowLinear;
|
window = vesaWindowLinear;
|
||||||
pscr->rotate = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (pscr->rotate) {
|
|
||||||
case 90:
|
|
||||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
|
||||||
case 8:
|
|
||||||
update = shadowUpdateRotate8_90; break;
|
|
||||||
case 16:
|
|
||||||
update = shadowUpdateRotate16_90; break;
|
|
||||||
case 32:
|
|
||||||
update = shadowUpdateRotate32_90; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
|
||||||
case 8:
|
|
||||||
update = shadowUpdateRotate8_180; break;
|
|
||||||
case 16:
|
|
||||||
update = shadowUpdateRotate16_180; break;
|
|
||||||
case 32:
|
|
||||||
update = shadowUpdateRotate32_180; break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
|
|
||||||
case 8:
|
|
||||||
update = shadowUpdateRotate8_270; break;
|
|
||||||
case 16:
|
|
||||||
update = shadowUpdateRotate16_270; break;
|
|
||||||
case 32:
|
|
||||||
update = shadowUpdateRotate32_270; break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,10 +849,10 @@ vesaLayerCreate (ScreenPtr pScreen)
|
||||||
|
|
||||||
if (vesa_verbose)
|
if (vesa_verbose)
|
||||||
ErrorF ("Mode selected %dx%dx%d\n",
|
ErrorF ("Mode selected %dx%dx%d\n",
|
||||||
screen->width, screen->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, 0);
|
pPixmap, update, window, pscr->rotate, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -915,8 +941,8 @@ vesaMapFramebuffer (KdScreenInfo *screen)
|
||||||
pscr->rotate = 0;
|
pscr->rotate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->width = vesaWidth(screen, &pscr->mode);
|
screen->width = pscr->mode.XResolution;
|
||||||
screen->height = vesaHeight(screen, &pscr->mode);
|
screen->height = pscr->mode.YResolution;
|
||||||
screen->fb[0].depth = depth;
|
screen->fb[0].depth = depth;
|
||||||
screen->fb[0].bitsPerPixel = bpp;
|
screen->fb[0].bitsPerPixel = bpp;
|
||||||
screen->fb[0].byteStride = pscr->mode.BytesPerScanLine;
|
screen->fb[0].byteStride = pscr->mode.BytesPerScanLine;
|
||||||
|
@ -925,18 +951,10 @@ vesaMapFramebuffer (KdScreenInfo *screen)
|
||||||
if (pscr->mapping == VESA_LINEAR && !(pscr->mode.ModeAttributes & MODE_LINEAR))
|
if (pscr->mapping == VESA_LINEAR && !(pscr->mode.ModeAttributes & MODE_LINEAR))
|
||||||
pscr->mapping = VESA_WINDOWED;
|
pscr->mapping = VESA_WINDOWED;
|
||||||
|
|
||||||
pscr->shadow = vesa_shadow;
|
screen->softCursor = TRUE;
|
||||||
|
|
||||||
if (pscr->rotate)
|
|
||||||
pscr->shadow = TRUE;
|
|
||||||
|
|
||||||
if (pscr->rotate)
|
|
||||||
screen->softCursor = TRUE;
|
|
||||||
|
|
||||||
switch (pscr->mapping) {
|
switch (pscr->mapping) {
|
||||||
case VESA_MONO:
|
case VESA_MONO:
|
||||||
pscr->shadow = TRUE;
|
|
||||||
/* fall through */
|
|
||||||
case VESA_LINEAR:
|
case VESA_LINEAR:
|
||||||
if (pscr->mode.vbe)
|
if (pscr->mode.vbe)
|
||||||
pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo,
|
pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo,
|
||||||
|
@ -951,11 +969,9 @@ vesaMapFramebuffer (KdScreenInfo *screen)
|
||||||
break;
|
break;
|
||||||
case VESA_WINDOWED:
|
case VESA_WINDOWED:
|
||||||
pscr->fb = NULL;
|
pscr->fb = NULL;
|
||||||
pscr->shadow = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case VESA_PLANAR:
|
case VESA_PLANAR:
|
||||||
pscr->fb = NULL;
|
pscr->fb = NULL;
|
||||||
pscr->shadow = TRUE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb);
|
screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb);
|
||||||
|
@ -1063,16 +1079,39 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
mode->BlueMaskSize == pscr->mode.BlueMaskSize &&
|
mode->BlueMaskSize == pscr->mode.BlueMaskSize &&
|
||||||
mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
|
mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
|
||||||
{
|
{
|
||||||
pSize = RRRegisterSize (pScreen,
|
int width, height, width_mm, height_mm;
|
||||||
mode->XResolution,
|
if (screen->rotation == 0 || screen->rotation == 180)
|
||||||
mode->YResolution,
|
|
||||||
screen->width_mm,
|
|
||||||
screen->height_mm,
|
|
||||||
pGroupOfVisualGroup);
|
|
||||||
if (mode->XResolution == pScreen->width &&
|
|
||||||
mode->YResolution == pScreen->height)
|
|
||||||
{
|
{
|
||||||
RRSetCurrentConfig (pScreen, RR_Rotate_0, pSize,
|
width = mode->XResolution;
|
||||||
|
height = mode->YResolution;
|
||||||
|
width_mm = screen->width_mm;
|
||||||
|
height_mm = screen->height_mm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = mode->YResolution;
|
||||||
|
height = mode->XResolution;
|
||||||
|
width_mm = screen->height_mm;
|
||||||
|
height_mm = screen->width_mm;
|
||||||
|
}
|
||||||
|
pSize = RRRegisterSize (pScreen,
|
||||||
|
width, height,
|
||||||
|
width_mm, height_mm,
|
||||||
|
pGroupOfVisualGroup);
|
||||||
|
if (mode->XResolution == screen->width &&
|
||||||
|
mode->YResolution == screen->height)
|
||||||
|
{
|
||||||
|
int rotate = pscr->rotate - screen->rotation;
|
||||||
|
int rot;
|
||||||
|
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,
|
||||||
pVisualGroup);
|
pVisualGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1124,7 +1163,18 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
int oldmmwidth;
|
int oldmmwidth;
|
||||||
int oldmmheight;
|
int oldmmheight;
|
||||||
LayerPtr pNewLayer;
|
LayerPtr pNewLayer;
|
||||||
|
int newwidth, newheight;
|
||||||
|
|
||||||
|
if (screen->rotation == 0 || screen->rotation == 180)
|
||||||
|
{
|
||||||
|
newwidth = pSize->width;
|
||||||
|
newheight = pSize->height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newwidth = pSize->height;
|
||||||
|
newheight = pSize->width;
|
||||||
|
}
|
||||||
for (n = 0; n < priv->nmode; n++)
|
for (n = 0; n < priv->nmode; n++)
|
||||||
{
|
{
|
||||||
mode = &priv->modes[n];
|
mode = &priv->modes[n];
|
||||||
|
@ -1133,8 +1183,8 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
/*
|
/*
|
||||||
* XXX all we have to match is the size
|
* XXX all we have to match is the size
|
||||||
*/
|
*/
|
||||||
if (mode->XResolution == pSize->width &&
|
if (mode->XResolution == newwidth &&
|
||||||
mode->YResolution == pSize->height &&
|
mode->YResolution == newheight &&
|
||||||
mode->NumberOfPlanes == pscr->mode.NumberOfPlanes &&
|
mode->NumberOfPlanes == pscr->mode.NumberOfPlanes &&
|
||||||
mode->BitsPerPixel == pscr->mode.BitsPerPixel &&
|
mode->BitsPerPixel == pscr->mode.BitsPerPixel &&
|
||||||
mode->RedMaskSize == pscr->mode.RedMaskSize &&
|
mode->RedMaskSize == pscr->mode.RedMaskSize &&
|
||||||
|
@ -1152,11 +1202,13 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
if (wasEnabled)
|
if (wasEnabled)
|
||||||
KdDisableScreen (pScreen);
|
KdDisableScreen (pScreen);
|
||||||
|
|
||||||
ret = vesaSetMode (pScreen, mode);
|
if (mode->mode != pscr->mode.mode)
|
||||||
|
{
|
||||||
|
ret = vesaSetMode (pScreen, mode);
|
||||||
|
if (!ret)
|
||||||
|
goto bail1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ret)
|
|
||||||
goto bail1;
|
|
||||||
|
|
||||||
oldscr = *pscr;
|
oldscr = *pscr;
|
||||||
|
|
||||||
oldwidth = screen->width;
|
oldwidth = screen->width;
|
||||||
|
@ -1176,6 +1228,10 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
case RR_Rotate_270: pscr->rotate = 270; 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
|
||||||
*/
|
*/
|
||||||
|
@ -1190,20 +1246,6 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pScreen->width = screen->width = vesaWidth(screen, mode);
|
|
||||||
pScreen->height = screen->height = vesaHeight(screen, mode);
|
|
||||||
|
|
||||||
if (rotation & (RR_Rotate_90|RR_Rotate_270))
|
|
||||||
{
|
|
||||||
pScreen->mmWidth = pSize->mmHeight;
|
|
||||||
pScreen->mmHeight = pSize->mmWidth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pScreen->mmWidth = pSize->mmWidth;
|
|
||||||
pScreen->mmHeight = pSize->mmHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
vesaUnmapFramebuffer (screen);
|
vesaUnmapFramebuffer (screen);
|
||||||
if (!vesaMapFramebuffer (screen))
|
if (!vesaMapFramebuffer (screen))
|
||||||
goto bail3;
|
goto bail3;
|
||||||
|
@ -1217,6 +1259,15 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
#endif
|
#endif
|
||||||
screen->fb[0].byteStride = mode->BytesPerScanLine;
|
screen->fb[0].byteStride = mode->BytesPerScanLine;
|
||||||
screen->fb[0].pixelStride = ((mode->BytesPerScanLine * 8) / screen->fb[0].bitsPerPixel);
|
screen->fb[0].pixelStride = ((mode->BytesPerScanLine * 8) / screen->fb[0].bitsPerPixel);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute screen geometry
|
||||||
|
*/
|
||||||
|
vesaConfigureScreen (pScreen);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set frame buffer mapping
|
||||||
|
*/
|
||||||
if (!pscr->shadow)
|
if (!pscr->shadow)
|
||||||
{
|
{
|
||||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||||
|
@ -1227,7 +1278,10 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
screen->fb[0].byteStride,
|
screen->fb[0].byteStride,
|
||||||
screen->fb[0].frameBuffer);
|
screen->fb[0].frameBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the layer
|
||||||
|
*/
|
||||||
pNewLayer = vesaLayerCreate (pScreen);
|
pNewLayer = vesaLayerCreate (pScreen);
|
||||||
if (!pNewLayer)
|
if (!pNewLayer)
|
||||||
goto bail4;
|
goto bail4;
|
||||||
|
@ -1255,14 +1309,28 @@ bail4:
|
||||||
(void) vesaMapFramebuffer (screen);
|
(void) vesaMapFramebuffer (screen);
|
||||||
|
|
||||||
bail3:
|
bail3:
|
||||||
pScreen->width = screen->width = oldwidth;
|
pScreen->width = oldwidth;
|
||||||
pScreen->height = screen->height = oldheight;
|
pScreen->height = oldheight;
|
||||||
pScreen->mmWidth = oldmmwidth;
|
pScreen->mmWidth = oldmmwidth;
|
||||||
pScreen->mmHeight = oldmmheight;
|
pScreen->mmHeight = oldmmheight;
|
||||||
|
|
||||||
bail2:
|
bail2:
|
||||||
*pscr = oldscr;
|
*pscr = oldscr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set frame buffer mapping
|
||||||
|
*/
|
||||||
|
if (!pscr->shadow)
|
||||||
|
{
|
||||||
|
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||||
|
pScreen->width,
|
||||||
|
pScreen->height,
|
||||||
|
screen->fb[0].depth,
|
||||||
|
screen->fb[0].bitsPerPixel,
|
||||||
|
screen->fb[0].byteStride,
|
||||||
|
screen->fb[0].frameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
(void) vesaSetMode (pScreen, &pscr->mode);
|
(void) vesaSetMode (pScreen, &pscr->mode);
|
||||||
|
|
||||||
bail1:
|
bail1:
|
||||||
|
@ -1311,6 +1379,8 @@ vesaFinishInitScreen (ScreenPtr pScreen)
|
||||||
if (!LayerFinishInit (pScreen))
|
if (!LayerFinishInit (pScreen))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
vesaConfigureScreen (pScreen);
|
||||||
|
|
||||||
pscr->pLayer = vesaLayerCreate (pScreen);
|
pscr->pLayer = vesaLayerCreate (pScreen);
|
||||||
if (!pscr->pLayer)
|
if (!pscr->pLayer)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1363,7 +1433,6 @@ vesaEnable(ScreenPtr pScreen)
|
||||||
int i;
|
int i;
|
||||||
CARD32 size;
|
CARD32 size;
|
||||||
char *p;
|
char *p;
|
||||||
KdMouseMatrix m;
|
|
||||||
|
|
||||||
if (!vesaSetMode (pScreen, &pscr->mode))
|
if (!vesaSetMode (pScreen, &pscr->mode))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1397,25 +1466,6 @@ vesaEnable(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (pscr->rotate) {
|
|
||||||
case 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;
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
m.matrix[0][0] = 0; m.matrix[0][1] = -1; m.matrix[0][2] = pScreen->width - 1;
|
|
||||||
m.matrix[1][0] = 1; m.matrix[1][1] = 0; m.matrix[1][2] = 0;
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
m.matrix[0][0] = -1; m.matrix[0][1] = 0; m.matrix[0][2] = pScreen->width - 1;
|
|
||||||
m.matrix[1][0] = 0; m.matrix[1][1] = -1; m.matrix[1][2] = pScreen->height - 1;
|
|
||||||
break;
|
|
||||||
case 270:
|
|
||||||
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] = pScreen->height - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
KdSetMouseMatrix (&m);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1561,8 +1611,9 @@ vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
|
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
|
||||||
VesaCardPrivPtr priv = pScreenPriv->card->driver;
|
VesaCardPrivPtr priv = pScreenPriv->card->driver;
|
||||||
int p;
|
int p;
|
||||||
CARD8 scratch[4];
|
CARD8 *scratch;
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
|
int min, max;
|
||||||
|
|
||||||
if (vesa_swap_rgb)
|
if (vesa_swap_rgb)
|
||||||
{
|
{
|
||||||
|
@ -1577,13 +1628,20 @@ vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
blue = 2;
|
blue = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
min = 256;
|
||||||
|
max = 0;
|
||||||
while (n--)
|
while (n--)
|
||||||
{
|
{
|
||||||
|
p = pdefs->pixel;
|
||||||
|
if (p < min)
|
||||||
|
min = p;
|
||||||
|
if (p > max)
|
||||||
|
max = p;
|
||||||
|
scratch = priv->cmap + (p * 4);
|
||||||
scratch[red] = pdefs->red >> 8;
|
scratch[red] = pdefs->red >> 8;
|
||||||
scratch[green] = pdefs->green >> 8;
|
scratch[green] = pdefs->green >> 8;
|
||||||
scratch[blue] = pdefs->blue >> 8;
|
scratch[blue] = pdefs->blue >> 8;
|
||||||
scratch[3] = 0;
|
scratch[3] = 0;
|
||||||
p = pdefs->pixel;
|
|
||||||
pdefs++;
|
pdefs++;
|
||||||
if (pscr->mapping == VESA_PLANAR)
|
if (pscr->mapping == VESA_PLANAR)
|
||||||
{
|
{
|
||||||
|
@ -1601,19 +1659,22 @@ vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
vesaSetPalette (priv, 0x14, 1, scratch);
|
vesaSetPalette (priv, 0x14, 1, scratch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vesaSetPalette(priv, p, 1, scratch);
|
|
||||||
}
|
}
|
||||||
|
if (pscr->mapping != VESA_PLANAR)
|
||||||
|
vesaSetPalette (priv, min, max-min+1, priv->cmap + min * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
|
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
|
||||||
VesaCardPrivPtr priv = pScreenPriv->card->driver;
|
VesaCardPrivPtr priv = pScreenPriv->card->driver;
|
||||||
int first, i, j, k;
|
int first, i, j, k;
|
||||||
CARD8 scratch[4];
|
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
|
int min, max;
|
||||||
|
int p;
|
||||||
|
CARD8 *scratch;
|
||||||
|
|
||||||
if (vesa_swap_rgb)
|
if (vesa_swap_rgb)
|
||||||
{
|
{
|
||||||
|
@ -1628,8 +1689,24 @@ vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
blue = 2;
|
blue = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i<n; i++) {
|
min = 256;
|
||||||
vesaGetPalette(priv, pdefs[i].pixel, 1, scratch);
|
max = 0;
|
||||||
|
for(i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
p = pdefs[i].pixel;
|
||||||
|
if (p < min)
|
||||||
|
min = p;
|
||||||
|
if (p > max)
|
||||||
|
max = p;
|
||||||
|
if (pscr->mapping == VESA_PLANAR)
|
||||||
|
vesaGetPalette (priv, p, 1, priv->cmap + p * 4);
|
||||||
|
}
|
||||||
|
if (pscr->mapping != VESA_PLANAR)
|
||||||
|
vesaGetPalette (priv, min, max - min + 1, priv->cmap + min * 4);
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
p = pdefs[i].pixel;
|
||||||
|
scratch = priv->cmap + p * 4;
|
||||||
pdefs[i].red = scratch[red]<<8;
|
pdefs[i].red = scratch[red]<<8;
|
||||||
pdefs[i].green = scratch[green]<<8;
|
pdefs[i].green = scratch[green]<<8;
|
||||||
pdefs[i].blue = scratch[blue]<<8;
|
pdefs[i].blue = scratch[blue]<<8;
|
||||||
|
|
|
@ -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.9 2001/05/29 04:54:13 keithp Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.10 2001/06/04 09:45:42 keithp Exp $ */
|
||||||
|
|
||||||
#ifndef _VESA_H_
|
#ifndef _VESA_H_
|
||||||
#define _VESA_H_
|
#define _VESA_H_
|
||||||
|
@ -84,6 +84,7 @@ typedef struct _VesaCardPriv {
|
||||||
int old_vga_mode;
|
int old_vga_mode;
|
||||||
VbeInfoPtr vbeInfo;
|
VbeInfoPtr vbeInfo;
|
||||||
char text[VESA_TEXT_SAVE];
|
char text[VESA_TEXT_SAVE];
|
||||||
|
CARD8 cmap[256*4];
|
||||||
} VesaCardPrivRec, *VesaCardPrivPtr;
|
} VesaCardPrivRec, *VesaCardPrivPtr;
|
||||||
|
|
||||||
#define VESA_LINEAR 0
|
#define VESA_LINEAR 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user