cirrus: handle server with no XAA

this fixes cirrus to work with a server with no XAA module.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie
2012-07-13 14:47:40 +10:00
parent 46a9e962c6
commit e443ede159
10 changed files with 65 additions and 12 deletions

View File

@@ -72,6 +72,24 @@ AC_CHECK_HEADER(xf1bpp.h,[AC_DEFINE(HAVE_XF1BPP, 1, [Have 1bpp support])],[])
AC_CHECK_HEADER(xf4bpp.h,[AC_DEFINE(HAVE_XF4BPP, 1, [Have 4bpp support])],[])
CPPFLAGS="$SAVE_CPPFLAGS"
AC_ARG_ENABLE(xaa,
AS_HELP_STRING([--enable-xaa],
[Enable legacy X Acceleration Architecture (XAA) [default=auto]]),
[XAA="$enableval"],
[XAA=auto])
if test "x$XAA" != xno; then
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
CFLAGS=$XORG_CFLAGS
CPPFLAGS="$XORG_CFLAGS"
AC_CHECK_HEADERS([xaa.h], XAA=yes, XAA=no)
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
fi
AC_MSG_CHECKING([whether to include XAA support])
AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
AC_MSG_RESULT([$XAA])
if test "x$XSERVER_LIBPCIACCESS" = xyes; then
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"

View File

@@ -40,8 +40,10 @@ typedef struct {
} AlpRegRec, *AlpRegPtr;
extern Bool AlpHWCursorInit(ScreenPtr pScreen, int size);
#ifdef HAVE_XAA_H
extern Bool AlpXAAInit(ScreenPtr pScreen);
extern Bool AlpXAAInitMMIO(ScreenPtr pScreen);
#endif
extern Bool AlpDGAInit(ScreenPtr pScreen);
extern Bool AlpI2CInit(ScrnInfoPtr pScrn);

View File

@@ -1088,7 +1088,12 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
/* Load XAA if needed */
if (!pCir->NoAccel) {
if (!xf86LoadSubModule(pScrn, "xaa")) {
#ifdef HAVE_XAA_H
if (!xf86LoadSubModule(pScrn, "xaa"))
#else
if (1)
#endif
{
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Falling back to shadowfb\n");
pCir->NoAccel = TRUE;
@@ -1096,6 +1101,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
}
/* Load ramdac if needed */
if (pCir->HWCursor) {
if (!xf86LoadSubModule(pScrn, "ramdac")) {
@@ -1650,10 +1656,12 @@ AlpScreenInit(SCREEN_INIT_ARGS_DECL)
if (!pCir->NoAccel) { /* Initialize XAA functions */
AlpOffscreenAccelInit(pScrn);
#ifdef HAVE_XAA_H
if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) :
AlpXAAInit(pScreen)))
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Could not initialize XAA\n");
#endif
}
#if 1
@@ -1860,9 +1868,11 @@ AlpCloseScreen(CLOSE_SCREEN_ARGS_DECL)
CirUnmapMem(pCir, pScrn->scrnIndex);
}
#ifdef HAVE_XAA_H
if (pCir->AccelInfoRec)
XAADestroyInfoRec(pCir->AccelInfoRec);
pCir->AccelInfoRec = NULL;
#endif
if (pCir->CursorInfoRec)
xf86DestroyCursorInfoRec(pCir->CursorInfoRec);
pCir->CursorInfoRec = NULL;

View File

@@ -16,6 +16,7 @@
#define _ALP_PRIVATE_
#include "alp.h"
#ifdef HAVE_XAA_H
#define WAIT outb(pCir->PIOReg, 0x31); \
while(inb(pCir->PIOReg + 1) & pCir->chip.alp->waitMsk){};
#define WAIT_1 outb(pCir->PIOReg, 0x31); \
@@ -683,4 +684,4 @@ AlpXAAInit(ScreenPtr pScreen)
return TRUE;
}
#endif

View File

@@ -17,6 +17,7 @@
#define _ALP_PRIVATE_
#include "alp.h"
#ifdef HAVE_XAA_H
#ifdef DEBUG
#define minb(p) \
(ErrorF("minb(%X)\n", p),\
@@ -266,7 +267,4 @@ AlpXAAInitMMIO(ScreenPtr pScreen)
return TRUE;
}
#endif

View File

@@ -4,7 +4,9 @@
#define CIR_H
#include "xf86Cursor.h"
#ifdef HAVE_XAA_H
#include "xaa.h"
#endif
#include "xf86i2c.h"
#include <string.h>
#include <stdlib.h>
@@ -44,7 +46,9 @@ typedef struct {
Bool NoAccel;
Bool HWCursor;
Bool UseMMIO;
#ifdef HAVE_XAA_H
XAAInfoRecPtr AccelInfoRec;
#endif
xf86CursorInfoPtr CursorInfoRec;
int DGAnumModes;
DGAModePtr DGAModes;

View File

@@ -30,8 +30,10 @@
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Pci.h"
#ifdef HAVE_XAA_H
#include "xaa.h"
#include "xaalocal.h"
#endif
#include "vgaHW.h"
#include "cir.h"
#include "dgaproc.h"
@@ -39,15 +41,17 @@
static Bool Cir_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
int *, int *, int *);
static Bool Cir_SetMode(ScrnInfoPtr, DGAModePtr);
static void Cir_Sync(ScrnInfoPtr);
static int Cir_GetViewport(ScrnInfoPtr);
static void Cir_SetViewport(ScrnInfoPtr, int, int, int);
#ifdef HAVE_XAA_H
static void Cir_Sync(ScrnInfoPtr);
static void Cir_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
static void Cir_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
/*
static void Cir_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
unsigned long);
*/
#endif
static
DGAFunctionRec CirDGAFuncs = {
@@ -56,9 +60,13 @@ DGAFunctionRec CirDGAFuncs = {
Cir_SetMode,
Cir_SetViewport,
Cir_GetViewport,
#ifdef HAVE_XAA_H
Cir_Sync,
Cir_FillRect,
Cir_BlitRect,
#else
NULL, NULL, NULL,
#endif
NULL /* Cir_BlitTransRect */
};
@@ -207,14 +215,12 @@ Cir_GetViewport(
return pCir->DGAViewportStatus;
}
#ifdef HAVE_XAA_H
static void
Cir_Sync(
ScrnInfoPtr pScrn
){
CirPtr pCir = CIRPTR(pScrn);
if(pCir->AccelInfoRec) {
(*pCir->AccelInfoRec->Sync)(pScrn);
}
@@ -255,3 +261,4 @@ Cir_BlitRect(
SET_SYNC_FLAG(pCir->AccelInfoRec);
}
}
#endif

View File

@@ -59,8 +59,10 @@ typedef struct {
/* lg_driver.c */
extern LgLineDataRec LgLineData[];
#ifdef HAVE_XAA_H
/* lg_xaa.c */
extern Bool LgXAAInit(ScreenPtr pScreen);
#endif
/* lg_hwcurs.c */
extern Bool LgHWCursorInit(ScreenPtr pScreen);

View File

@@ -797,7 +797,12 @@ LgPreInit(ScrnInfoPtr pScrn, int flags)
/* Load XAA if needed */
if (!pCir->NoAccel) {
if (!xf86LoadSubModule(pScrn, "xaa")) {
#ifdef HAVE_XAA_H
if (!xf86LoadSubModule(pScrn, "xaa"))
#else
if (1)
#endif
{
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Falling back to shadowfb\n");
pCir->NoAccel = TRUE;
@@ -1375,10 +1380,12 @@ LgScreenInit(SCREEN_INIT_ARGS_DECL)
*/
xf86SetBlackWhitePixels(pScreen);
#ifdef HAVE_XAA_H
if (!pCir->NoAccel) { /* Initialize XAA functions */
if (!LgXAAInit(pScreen))
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not initialize XAA\n");
}
#endif
#if 1
pCir->DGAModeInit = LgModeInit;
if (!CirDGAInit(pScreen))
@@ -1609,9 +1616,11 @@ LgCloseScreen(CLOSE_SCREEN_ARGS_DECL)
CirUnmapMem(pCir, pScrn->scrnIndex);
}
#ifdef HAVE_XAA_H
if (pCir->AccelInfoRec)
XAADestroyInfoRec(pCir->AccelInfoRec);
pCir->AccelInfoRec = NULL;
#endif
if (pCir->CursorInfoRec)
xf86DestroyCursorInfoRec(pCir->CursorInfoRec);

View File

@@ -26,6 +26,8 @@
#include "cir.h"
#define _LG_PRIVATE_
#include "lg.h"
#ifdef HAVE_XAA_H
#include "lg_xaa.h"
/* Laguna raster operations, source is OP1 and destination is OP0. */
@@ -296,4 +298,4 @@ LgSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
LgSETDSTXY(x2, y2);
LgSETEXTENTS(w, h);
}
#endif