summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2000-08-26 00:24:38 +0000
committerKeith Packard <keithp@keithp.com>2000-08-26 00:24:38 +0000
commit83a388c96d665b6bfb0ae195c8c74e0e1520ab8f (patch)
tree87ab6a6b4f10adaf2104f7a41c7a55281aadc3c3
parent4223801110c8d5873dd668880dff411765dfc18d (diff)
Try to avoid hitting hardware during server reset when not active, add
KdPicture code
-rw-r--r--hw/kdrive/Imakefile6
-rw-r--r--hw/kdrive/linux/linux.c66
-rw-r--r--hw/kdrive/src/kasync.c2
-rw-r--r--hw/kdrive/src/kdrive.c32
-rw-r--r--hw/kdrive/src/kdrive.h4
-rw-r--r--hw/kdrive/src/kinput.c31
-rw-r--r--hw/kdrive/src/kpict.c66
-rw-r--r--hw/kdrive/trident/trident.c8
-rw-r--r--hw/kdrive/trident/tridentdraw.c2
9 files changed, 168 insertions, 49 deletions
diff --git a/hw/kdrive/Imakefile b/hw/kdrive/Imakefile
index 364897527..89334b101 100644
--- a/hw/kdrive/Imakefile
+++ b/hw/kdrive/Imakefile
@@ -3,13 +3,13 @@ XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.1 1999/11/19 13:53:4
#include <Server.tmpl>
SRCS = kcmap.c kcolor.c kdrive.c kinfo.c kinput.c kmap.c knoop.c ktest.c \
- vga.c kasync.c kmode.c kcurscol.c
+ vga.c kasync.c kmode.c kcurscol.c kpict.c
OBJS = kcmap.o kcolor.o kdrive.o kinfo.o kinput.o kmap.o knoop.o ktest.o \
- vga.o kasync.o kmode.o kcurscol.o
+ vga.o kasync.o kmode.o kcurscol.o kpict.o
INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
- -I../../fb -I../../mi -I../../include -I../../os \
+ -I../../fb -I../../mi -I../../render -I../../include -I../../os \
-I$(EXTINCSRC) -I$(XINCLUDESRC)
NormalLibraryObjectRule()
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index af50fd7ec..200bb896a 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -85,8 +85,6 @@ LinuxInit ()
}
close(fd);
-/* ErrorF("(using VT number %d)\n\n", vtno); */
-
sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */
if ((LinuxConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
@@ -184,11 +182,49 @@ LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr)
}
void
-LinuxEnable (void)
+LinuxSetSwitchMode (int mode)
{
struct sigaction act;
struct vt_mode VT;
+ if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0)
+ {
+ FatalError ("LinuxInit: VT_GETMODE failed\n");
+ }
+
+ if (mode == VT_PROCESS)
+ {
+ act.sa_handler = LinuxVTRequest;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_restorer = 0;
+ sigaction (SIGUSR1, &act, 0);
+
+ VT.mode = mode;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ }
+ else
+ {
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_restorer = 0;
+ sigaction (SIGUSR1, &act, 0);
+
+ VT.mode = mode;
+ VT.relsig = 0;
+ VT.acqsig = 0;
+ }
+ if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0)
+ {
+ FatalError("LinuxInit: VT_SETMODE failed\n");
+ }
+}
+
+void
+LinuxEnable (void)
+{
if (enabled)
return;
if (kdSwitchPending)
@@ -199,32 +235,16 @@ LinuxEnable (void)
/*
* now get the VT
*/
+ LinuxSetSwitchMode (VT_AUTO);
if (ioctl(LinuxConsoleFd, VT_ACTIVATE, vtno) != 0)
{
- ErrorF("LinuxInit: VT_ACTIVATE failed\n");
+ FatalError("LinuxInit: VT_ACTIVATE failed\n");
}
if (ioctl(LinuxConsoleFd, VT_WAITACTIVE, vtno) != 0)
{
- ErrorF("LinuxInit: VT_WAITACTIVE failed\n");
- }
- if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0)
- {
- FatalError ("LinuxInit: VT_GETMODE failed\n");
- }
-
- act.sa_handler = LinuxVTRequest;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- act.sa_restorer = 0;
- sigaction (SIGUSR1, &act, 0);
-
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0)
- {
- FatalError("LinuxInit: VT_SETMODE VT_PROCESS failed\n");
+ FatalError("LinuxInit: VT_WAITACTIVE failed\n");
}
+ LinuxSetSwitchMode (VT_PROCESS);
if (ioctl(LinuxConsoleFd, KDSETMODE, KD_GRAPHICS) < 0)
{
FatalError("LinuxInit: KDSETMODE KD_GRAPHICS failed\n");
diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c
index 44d8bdcb2..cb848ba4b 100644
--- a/hw/kdrive/src/kasync.c
+++ b/hw/kdrive/src/kasync.c
@@ -141,7 +141,6 @@ KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
fbPolyFillRect (pDrawable, pGC, nrect, prect);
}
-#if 0
void
KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
int narcs, xArc *pArcs)
@@ -149,7 +148,6 @@ KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
KdCheckSync(pDrawable->pScreen);
fbPolyFillArc (pDrawable, pGC, narcs, pArcs);
}
-#endif
void
KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 434f7fd9d..cf99c3863 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -300,6 +300,9 @@ ddxGiveUp ()
AbortDDX ();
}
+Bool kdDumbDriver;
+Bool kdSoftCursor;
+
void
KdParseScreen (KdScreenInfo *screen,
char *arg)
@@ -307,6 +310,10 @@ KdParseScreen (KdScreenInfo *screen,
char *bpp;
int fb;
+ screen->dumb = kdDumbDriver;
+ screen->softCursor = kdSoftCursor;
+ kdDumbDriver = FALSE;
+ kdSoftCursor = FALSE;
screen->width = 0;
screen->height = 0;
screen->rate = 0;
@@ -360,9 +367,6 @@ KdParseScreen (KdScreenInfo *screen,
arg++;
}
-Bool kdDumbDriver;
-Bool kdSoftCursor;
-
int
KdProcessArgument (int argc, char **argv, int i)
{
@@ -389,10 +393,6 @@ KdProcessArgument (int argc, char **argv, int i)
}
screen = KdScreenInfoAdd (card);
KdParseScreen (screen, argv[i+1]);
- screen->dumb = kdDumbDriver;
- screen->softCursor = kdSoftCursor;
- kdDumbDriver = FALSE;
- kdSoftCursor = FALSE;
}
else
UseMsg ();
@@ -493,11 +493,14 @@ KdCloseScreen (int index, ScreenPtr pScreen)
* Restore video hardware when last screen is closed
*/
if (screen == card->screenList)
- (*card->cfuncs->restore) (card);
-
+ {
+ if (kdEnabled)
+ (*card->cfuncs->restore) (card);
+ }
+
if (!pScreenPriv->screen->dumb)
(*card->cfuncs->finiAccel) (pScreen);
-
+
if (!pScreenPriv->screen->softCursor)
(*card->cfuncs->finiCursor) (pScreen);
@@ -686,12 +689,18 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
(void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
#endif
+#if 0
+ fbInitValidateTree (pScreen);
+#endif
+
+#if 0
pScreen->backingStoreSupport = Always;
#ifdef FB_OLD_SCREEN
miInitializeBackingStore (pScreen, &pScreenPriv->BackingStoreFuncs);
#else
miInitializeBackingStore (pScreen);
#endif
+#endif
/*
* Wrap CloseScreen, the order now is:
* KdCloseScreen
@@ -710,6 +719,9 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
miDCInitialize(pScreen, &kdPointerScreenFuncs);
}
+ if (!KdPictureInit (pScreen, 0, 0))
+ return FALSE;
+
if (!fbCreateDefColormap (pScreen))
{
return FALSE;
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 4b6c06ed4..eca68d819 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -297,7 +297,9 @@ void
KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
int nrect, xRectangle *prect);
-#define KdCheckPolyFillArc miPolyFillArc
+void
+KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *pArcs);
void
KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 5f1886519..278f3cff4 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -42,6 +42,7 @@ static Bool kdTimeoutPending;
static int kdBellPitch;
static int kdBellDuration;
static int kdLeds;
+static Bool kdInputEnabled;
int kdMinScanCode;
int kdMaxScanCode;
@@ -172,15 +173,22 @@ KdDisableInput (void)
KdRemoveFd (kdMouseFd);
if (kdKeyboardFd >= 0)
KdRemoveFd (kdKeyboardFd);
+ kdInputEnabled = FALSE;
}
void
KdEnableInput (void)
{
+ xEvent xE;
+
+ kdInputEnabled = TRUE;
if (kdMouseFd >= 0)
KdAddFd (kdMouseFd);
if (kdKeyboardFd >= 0)
KdAddFd (kdKeyboardFd);
+ /* reset screen saver */
+ xE.u.keyButtonPointer.time = GetTimeInMillis ();
+ NoticeEventTime (&xE);
}
static int
@@ -210,7 +218,7 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff)
if (kdMouseFuncs)
{
kdMouseFd = (*kdMouseFuncs->Init) ();
- if (kdMouseFd >= 0)
+ if (kdMouseFd >= 0 && kdInputEnabled)
KdAddFd (kdMouseFd);
}
break;
@@ -222,7 +230,8 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff)
pKdPointer = 0;
if (kdMouseFd >= 0)
{
- KdRemoveFd (kdMouseFd);
+ if (kdInputEnabled)
+ KdRemoveFd (kdMouseFd);
(*kdMouseFuncs->Fini) (kdMouseFd);
kdMouseFd = -1;
}
@@ -241,14 +250,16 @@ LegalModifier(unsigned int key, DevicePtr pDev)
static void
KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
{
- (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
+ if (kdInputEnabled)
+ (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
}
static void
KdSetLeds (void)
{
- (*kdKeyboardFuncs->Leds) (kdLeds);
+ if (kdInputEnabled)
+ (*kdKeyboardFuncs->Leds) (kdLeds);
}
void
@@ -297,7 +308,7 @@ KdKeybdProc(DeviceIntPtr pDevice, int onoff)
if (kdKeyboardFuncs)
{
kdKeyboardFd = (*kdKeyboardFuncs->Init) ();
- if (kdKeyboardFd >= 0)
+ if (kdKeyboardFd >= 0 && kdInputEnabled)
KdAddFd (kdKeyboardFd);
}
break;
@@ -309,7 +320,8 @@ KdKeybdProc(DeviceIntPtr pDevice, int onoff)
pDev->on = FALSE;
if (kdKeyboardFd >= 0)
{
- KdRemoveFd (kdKeyboardFd);
+ if (kdInputEnabled)
+ KdRemoveFd (kdKeyboardFd);
(*kdKeyboardFuncs->Fini) (kdKeyboardFd);
kdKeyboardFd = -1;
}
@@ -413,6 +425,7 @@ KdInitInput(KdMouseFuncs *pMouseFuncs,
kdLeds = 0;
kdBellPitch = 1000;
kdBellDuration = 200;
+ kdInputEnabled = TRUE;
KdInitModMap ();
KdInitAutoRepeats ();
KdResetInputMachine ();
@@ -710,7 +723,7 @@ xEvent kdHeldEvent;
int kdEmulationDx, kdEmulationDy;
#define EMULATION_WINDOW 10
-#define EMULATION_TIMEOUT 30
+#define EMULATION_TIMEOUT 100
#define EventX(e) ((e)->u.keyButtonPointer.rootX)
#define EventY(e) ((e)->u.keyButtonPointer.rootY)
@@ -1003,7 +1016,9 @@ KdReleaseAllKeys (void)
xE.u.keyButtonPointer.time = GetTimeInMillis();
xE.u.u.type = KeyRelease;
xE.u.u.detail = key;
+ KdBlockSigio ();
KdHandleKeyboardEvent (&xE);
+ KdUnblockSigio ();
}
}
@@ -1082,12 +1097,14 @@ KdEnqueueKeyboardEvent(unsigned char scan_code,
return;
}
}
+#if 0
if (xE.u.u.type == KeyRelease && !IsKeyDown (key_code))
{
xE.u.u.type = KeyPress;
KdHandleKeyboardEvent (&xE);
xE.u.u.type = KeyRelease;
}
+#endif
KdCheckSpecialKeys (&xE);
KdHandleKeyboardEvent (&xE);
}
diff --git a/hw/kdrive/src/kpict.c b/hw/kdrive/src/kpict.c
new file mode 100644
index 000000000..54dfda1f0
--- /dev/null
+++ b/hw/kdrive/src/kpict.c
@@ -0,0 +1,66 @@
+/*
+ * $Id$
+ *
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "kdrive.h"
+#include "picturestr.h"
+
+void
+KdCheckComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ KdCheckSync (pDst->pDrawable->pScreen);
+ fbComposite (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
+}
+
+KdPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
+ PictureScreenPtr ps;
+
+ if (!fbPictureInit (pScreen, formats, nformats))
+ return FALSE;
+ ps = GetPictureScreen(pScreen);
+ ps->Composite = KdCheckComposite;
+ return TRUE;
+}
diff --git a/hw/kdrive/trident/trident.c b/hw/kdrive/trident/trident.c
index 1a8509dbe..932e4ddb4 100644
--- a/hw/kdrive/trident/trident.c
+++ b/hw/kdrive/trident/trident.c
@@ -1,5 +1,5 @@
/*
- * Id: trident.c,v 1.2 1999/11/02 08:17:24 keithp Exp $
+ * $Id$
*
* Copyright © 1999 Keith Packard
*
@@ -115,7 +115,7 @@ tridentPause ()
struct timeval tv;
tv.tv_sec = 0;
- tv.tv_usec = 200 * 1000;
+ tv.tv_usec = 50 * 1000;
select (1, 0, 0, 0, &tv);
}
@@ -125,6 +125,7 @@ tridentPreserve (KdCardInfo *card)
TridentCardInfo *tridentc = card->driver;
fbdevPreserve (card);
+ tridentPause ();
tridentc->save.reg_3c4_0e = tridentReadIndex (tridentc, 0x3c4, 0x0e);
tridentc->save.reg_3d4_36 = tridentReadIndex (tridentc, 0x3d4, 0x36);
tridentc->save.reg_3d4_39 = tridentReadIndex (tridentc, 0x3d4, 0x39);
@@ -189,7 +190,9 @@ tridentResetMMIO (TridentCardInfo *tridentc)
#ifdef TRI_DEBUG
fprintf (stderr, "Reset MMIO\n");
#endif
+ tridentPause ();
tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentc->save.reg_3ce_21);
+ tridentPause ();
tridentWriteIndex (tridentc, 0x3d4, 0x62, tridentc->save.reg_3d4_62);
tridentWriteIndex (tridentc, 0x3d4, 0x39, tridentc->save.reg_3d4_39);
tridentWriteIndex (tridentc, 0x3d4, 0x36, tridentc->save.reg_3d4_36);
@@ -229,6 +232,7 @@ tridentDPMS (ScreenPtr pScreen, int mode)
TridentCardInfo *tridentc = pScreenPriv->card->driver;
tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentDPMSModes[mode]);
+ tridentPause ();
return TRUE;
}
diff --git a/hw/kdrive/trident/tridentdraw.c b/hw/kdrive/trident/tridentdraw.c
index 4ac0a627d..195927fa3 100644
--- a/hw/kdrive/trident/tridentdraw.c
+++ b/hw/kdrive/trident/tridentdraw.c
@@ -636,7 +636,7 @@ static const GCOps tridentOps = {
KdCheckPolyArc,
miFillPolygon,
tridentPolyFillRect,
- KdCheckPolyFillArc,
+ miPolyFillArc,
miPolyText8,
miPolyText16,
miImageText8,