summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2003-10-09 06:35:11 +0000
committerKeith Packard <keithp@keithp.com>2003-10-09 06:35:11 +0000
commit346aff7ef6f47a191c7f134b7843a634189b9e83 (patch)
treee84fef5b4cc7feb7a0d5800dc3b3c92bfb0d5e9c
parentadc5b8068d5532a6f3f23e64d3c668a22d5b1504 (diff)
Use either vesa or fbdev, selectable at compile time
-rw-r--r--hw/kdrive/smi/Makefile.am4
-rw-r--r--hw/kdrive/smi/smi.c34
-rw-r--r--hw/kdrive/smi/smi.h46
-rw-r--r--hw/kdrive/smi/smistub.c2
4 files changed, 68 insertions, 18 deletions
diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am
index f97037a8e..b88503282 100644
--- a/hw/kdrive/smi/Makefile.am
+++ b/hw/kdrive/smi/Makefile.am
@@ -2,6 +2,7 @@ INCLUDES = \
-I$(top_srcdir)/fb \
-I$(top_srcdir)/hw/kdrive/src \
-I$(top_srcdir)/hw/kdrive/fbdev \
+ -I$(top_srcdir)/hw/kdrive/vesa \
-I$(top_srcdir)/mi \
-I$(top_srcdir)/miext/layer \
-I$(top_srcdir)/miext/shadow \
@@ -25,6 +26,7 @@ Xsmi_SOURCES = \
Xsmi_LDADD = \
$(top_builddir)/hw/kdrive/smi/libsmi.a \
$(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
$(top_builddir)/dix/libdix.a \
$(top_builddir)/os/libos.a \
$(top_builddir)/miext/layer/liblayer.a \
@@ -33,11 +35,13 @@ Xsmi_LDADD = \
$(top_builddir)/miext/shadow/libshadow.a \
$(top_builddir)/randr/librandr.a \
$(top_builddir)/render/librender.a \
+ $(top_builddir)/xfixes/libxfixes.a \
$(top_builddir)/fb/libfb.a \
$(top_builddir)/mi/libmi.a \
$(top_builddir)/Xext/libXext.a \
$(top_builddir)/randr/librandr.a \
$(top_builddir)/render/librender.a \
+ $(top_builddir)/xfixes/libxfixes.a \
$(top_builddir)/dix/libxpstubs.a \
$(XSERVER_LIBS) \
-lm -lz
diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c
index 83b512890..b8c8c93bd 100644
--- a/hw/kdrive/smi/smi.c
+++ b/hw/kdrive/smi/smi.c
@@ -40,7 +40,7 @@ smiCardInit (KdCardInfo *card)
(void) smiMapReg (card, smic);
- if (!fbdevInitialize (card, &smic->fbdev))
+ if (!subInitialize (card, &smic->sub))
{
xfree (smic);
return FALSE;
@@ -62,7 +62,7 @@ smiScreenInit (KdScreenInfo *screen)
if (!smis)
return FALSE;
memset (smis, '\0', sizeof (SmiScreenInfo));
- if (!fbdevScreenInitialize (screen, &smis->fbdev))
+ if (!subScreenInitialize (screen, &smis->sub))
{
xfree (smis);
return FALSE;
@@ -70,7 +70,11 @@ smiScreenInit (KdScreenInfo *screen)
if (!smic->reg_base)
screen->dumb = TRUE;
screen->softCursor = TRUE;
- smis->screen = smic->fbdev.fb;
+#ifdef SMI_VESA
+ smis->screen = smis->sub.fb;
+#else
+ smis->screen = smic->sub.fb;
+#endif
screen->driver = smis;
LEAVE();
return TRUE;
@@ -89,7 +93,7 @@ smiInitScreen (ScreenPtr pScreen)
smiInitVideo(pScreen);
#endif
#endif
- ret = fbdevInitScreen (pScreen);
+ ret = subInitScreen (pScreen);
LEAVE();
return ret;
}
@@ -106,7 +110,7 @@ smiRandRSetConfig (ScreenPtr pScreen,
ENTER ();
KdCheckSync (pScreen);
- ret = fbdevRandRSetConfig (pScreen, randr, rate, pSize);
+ ret = subRandRSetConfig (pScreen, randr, rate, pSize);
LEAVE();
return ret;
}
@@ -127,7 +131,7 @@ Bool
smiFinishInitScreen (ScreenPtr pScreen)
{
Bool ret;
- ret = fbdevFinishInitScreen (pScreen);
+ ret = subFinishInitScreen (pScreen);
#ifdef RANDR
smiRandRInit (pScreen);
#endif
@@ -140,7 +144,7 @@ smiPreserve (KdCardInfo *card)
SmiCardInfo *smic = card->driver;
ENTER ();
- fbdevPreserve(card);
+ subPreserve(card);
LEAVE();
}
@@ -232,7 +236,7 @@ smiEnable (ScreenPtr pScreen)
SmiCardInfo *smic = pScreenPriv->card->driver;
ENTER ();
- if (!fbdevEnable (pScreen))
+ if (!subEnable (pScreen))
return FALSE;
smiSetMMIO (pScreenPriv->card, smic);
@@ -257,7 +261,7 @@ smiDisable (ScreenPtr pScreen)
KdXVDisable (pScreen);
#endif
smiResetMMIO (pScreenPriv->card, smic);
- fbdevDisable (pScreen);
+ subDisable (pScreen);
LEAVE ();
}
@@ -266,7 +270,7 @@ smiDPMS (ScreenPtr pScreen, int mode)
{
Bool ret;
ENTER ();
- ret = fbdevDPMS (pScreen, mode);
+ ret = subDPMS (pScreen, mode);
LEAVE ();
return ret;
}
@@ -277,7 +281,7 @@ smiRestore (KdCardInfo *card)
SmiCardInfo *smic = card->driver;
ENTER ();
- fbdevRestore (card);
+ subRestore (card);
LEAVE();
}
@@ -287,7 +291,7 @@ smiScreenFini (KdScreenInfo *screen)
SmiScreenInfo *smis = (SmiScreenInfo *) screen->driver;
ENTER ();
- fbdevScreenFini (screen);
+ subScreenFini (screen);
xfree (smis);
screen->driver = 0;
LEAVE ();
@@ -300,7 +304,7 @@ smiCardFini (KdCardInfo *card)
ENTER ();
smiUnmapReg (card, smic);
- fbdevCardFini (card);
+ subCardFini (card);
LEAVE ();
}
@@ -334,8 +338,8 @@ KdCardFuncs smiFuncs = {
smiDrawDisable, /* disableAccel */
smiDrawFini, /* finiAccel */
- fbdevGetColors, /* getColors */
- fbdevPutColors, /* putColors */
+ subGetColors, /* getColors */
+ subPutColors, /* putColors */
smiFinishInitScreen, /* finishInitScreen */
};
diff --git a/hw/kdrive/smi/smi.h b/hw/kdrive/smi/smi.h
index 8a6aa09ff..7663592b5 100644
--- a/hw/kdrive/smi/smi.h
+++ b/hw/kdrive/smi/smi.h
@@ -25,7 +25,49 @@
#ifndef _SMI_H_
#define _SMI_H_
+
+#define SMI_VESA 1
+
+#ifdef SMI_VESA
+#include <vesa.h>
+#define subGetColors vesaGetColors
+#define subPutColors vesaPutColors
+#define subInitialize vesaInitialize
+#define subScreenInitialize vesaScreenInitialize
+#define subInitScreen vesaInitScreen
+#define subRandRSetConfig vesaRandRSetConfig
+#define subFinishInitScreen vesaFinishInitScreen
+#define subPreserve vesaPreserve
+#define subEnable vesaEnable
+#define subDPMS vesaDPMS
+#define subRestore vesaRestore
+#define subScreenFini vesaScreenFini
+#define subCardFini vesaCardFini
+#define subDisable vesaDisable
+#define SubCardPrivRec VesaCardPrivRec
+#define SubScreenPrivRec VesaScreenPrivRec
+#define subProcessArgument(c,v,i) vesaProcessArgument(c,v,i)
+#else
#include <fbdev.h>
+#define subGetColors fbdevGetColors
+#define subPutColors fbdevPutColors
+#define subInitialize fbdevInitialize
+#define subScreenInitialize fbdevScreenInitialize
+#define subInitScreen fbdevInitScreen
+#define subRandRSetConfig fbdevRandRSetConfig
+#define subFinishInitScreen fbdevFinishInitScreen
+#define subPreserve fbdevPreserve
+#define subEnable fbdevEnable
+#define subDPMS fbdevDPMS
+#define subRestore fbdevRestore
+#define subScreenFini fbdevScreenFini
+#define subCardFini fbdevCardFini
+#define subDisable fbdevDisable
+#define SubCardPrivRec FbdevPriv
+#define SubScreenPrivRec FbdevScrPriv
+#define subProcessArgument(c,v,i) 0
+#endif
+
#include "kxv.h"
#define DEBUG
@@ -124,7 +166,7 @@ typedef struct _DPR {
#define VGA_SEQ_DATA 0x3C5
typedef struct _smiCardInfo {
- FbdevPriv fbdev;
+ SubCardPrivRec sub;
CARD16 io_base;
CARD8 *reg_base;
DPR *dpr;
@@ -135,7 +177,7 @@ typedef struct _smiCardInfo {
#define smiCardInfo(kd) SmiCardInfo *smic = getSmiCardInfo(kd)
typedef struct _smiScreenInfo {
- FbdevScrPriv fbdev;
+ SubScreenPrivRec sub;
CARD8 *screen;
CARD32 stride;
CARD32 data_format;
diff --git a/hw/kdrive/smi/smistub.c b/hw/kdrive/smi/smistub.c
index cfbce20df..7b67c4b2e 100644
--- a/hw/kdrive/smi/smistub.c
+++ b/hw/kdrive/smi/smistub.c
@@ -55,7 +55,7 @@ ddxProcessArgument (int argc, char **argv, int i)
{
int ret;
-/* if (!(ret = vesaProcessArgument (argc, argv, i))) */
+ if (!(ret = subProcessArgument (argc, argv, i)))
ret = KdProcessArgument(argc, argv, i);
return ret;
}