summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2007-04-16 02:23:26 -0700
committerAaron Plattner <aplattner@nvidia.com>2007-04-24 16:38:04 -0700
commit339e30cb49a48344ec7b0dfd701b958b07ed32e5 (patch)
treeab7c482035d2baad7f5c700f48a2cfe590ee1076 /src
parentc6e4105ce40ef053e026cc0ffe4925ab568ea700 (diff)
G80: EXA infrastructure.
No acceleration yet.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/g80_driver.c54
-rw-r--r--src/g80_exa.c102
-rw-r--r--src/g80_exa.h1
-rw-r--r--src/g80_type.h10
-rw-r--r--src/g80_xaa.c4
-rw-r--r--src/g80_xaa.h2
7 files changed, 167 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 52b6b47..e2166fe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,6 +75,8 @@ g80_sources = \
g80_dma.c \
g80_dma.h \
g80_driver.c \
+ g80_exa.c \
+ g80_exa.h \
g80_output.c \
g80_output.h \
g80_sor.c \
diff --git a/src/g80_driver.c b/src/g80_driver.c
index a4e7bad..3e93237 100644
--- a/src/g80_driver.c
+++ b/src/g80_driver.c
@@ -45,6 +45,7 @@
#include "g80_display.h"
#include "g80_dma.h"
#include "g80_output.h"
+#include "g80_exa.h"
#include "g80_xaa.h"
#define G80_REG_SIZE (1024 * 1024 * 16)
@@ -66,6 +67,13 @@ static const char *xaaSymbols[] = {
NULL
};
+static const char *exaSymbols[] = {
+ "exaDriverAlloc",
+ "exaDriverInit",
+ "exaDriverFini",
+ NULL
+};
+
static const char *i2cSymbols[] = {
"xf86CreateI2CBusRec",
"xf86I2CBusInit",
@@ -96,11 +104,13 @@ static const char *int10Symbols[] = {
typedef enum {
OPTION_HW_CURSOR,
OPTION_NOACCEL,
+ OPTION_ACCEL_METHOD,
} G80Opts;
static const OptionInfoRec G80Options[] = {
{ OPTION_HW_CURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -164,6 +174,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
Bool primary;
const rgb zeros = {0, 0, 0};
const Gamma gzeros = {0.0, 0.0, 0.0};
+ char *s;
CARD32 tmp;
if(flags & PROBE_DETECT) {
@@ -272,6 +283,16 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
pNv->NoAccel = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
}
+ s = xf86GetOptValString(pNv->Options, OPTION_ACCEL_METHOD);
+ if(!s || !strcasecmp(s, "xaa"))
+ pNv->AccelMethod = XAA;
+ else if(!strcasecmp(s, "exa"))
+ pNv->AccelMethod = EXA;
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unrecognized AccelMethod "
+ "\"%s\".\n", s);
+ goto fail;
+ }
/* Set the bits per RGB for 8bpp mode */
if(pScrn->depth == 8)
@@ -366,8 +387,16 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(fbSymbols, NULL);
if(!pNv->NoAccel) {
- if(!xf86LoadSubModule(pScrn, "xaa")) goto fail;
- xf86LoaderReqSymLists(xaaSymbols, NULL);
+ switch(pNv->AccelMethod) {
+ case XAA:
+ if(!xf86LoadSubModule(pScrn, "xaa")) goto fail;
+ xf86LoaderReqSymLists(xaaSymbols, NULL);
+ break;
+ case EXA:
+ if(!xf86LoadSubModule(pScrn, "exa")) goto fail;
+ xf86LoaderReqSymLists(exaSymbols, NULL);
+ break;
+ }
}
/* Load ramdac if needed */
@@ -440,6 +469,8 @@ G80CloseScreen(int scrnIndex, ScreenPtr pScreen)
if(pNv->xaa)
XAADestroyInfoRec(pNv->xaa);
+ if(pNv->exa)
+ exaDriverFini(pScrn->pScreen);
xf86_cursors_fini(pScreen);
if(xf86ServerIsExiting()) {
@@ -759,10 +790,21 @@ G80ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if(!pNv->NoAccel) {
G80InitHW(pScrn);
- if(!G80XAAInit(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Hardware acceleration initialization failed\n");
- return FALSE;
+ switch(pNv->AccelMethod) {
+ case XAA:
+ if(!G80XAAInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "XAA hardware acceleration initialization failed\n");
+ return FALSE;
+ }
+ break;
+ case EXA:
+ if(!G80ExaInit(pScreen, pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "EXA hardware acceleration initialization failed\n");
+ return FALSE;
+ }
+ break;
}
}
diff --git a/src/g80_exa.c b/src/g80_exa.c
new file mode 100644
index 0000000..7f487ff
--- /dev/null
+++ b/src/g80_exa.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2007 NVIDIA, Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER 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 THE SOFTWARE.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "g80_type.h"
+#include "g80_dma.h"
+
+static void
+waitMarker(ScreenPtr pScreen, int marker)
+{
+ G80Sync(xf86Screens[pScreen->myNum]);
+}
+
+static Bool
+prepareSolid(PixmapPtr pPixmap,
+ int alu,
+ Pixel planemask,
+ Pixel fg)
+{
+ return FALSE;
+}
+
+static Bool
+checkComposite(int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ return FALSE;
+}
+
+static Bool
+prepareCopy(PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel planemask)
+{
+ return FALSE;
+}
+
+Bool G80ExaInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+{
+ G80Ptr pNv = G80PTR(pScrn);
+ ExaDriverPtr exa;
+ const int pitch = pScrn->displayWidth * (pScrn->bitsPerPixel / 8);
+
+ exa = pNv->exa = exaDriverAlloc();
+ if(!exa) return FALSE;
+
+ exa->exa_major = EXA_VERSION_MAJOR;
+ exa->exa_minor = EXA_VERSION_MINOR;
+ exa->memoryBase = pNv->mem;
+ exa->offScreenBase = pitch * pScrn->virtualY;
+ exa->memorySize = pitch * pNv->offscreenHeight;
+ exa->pixmapOffsetAlign = 256;
+ exa->pixmapPitchAlign = 256;
+ exa->flags = EXA_OFFSCREEN_PIXMAPS;
+ exa->maxX = 8192;
+ exa->maxY = 8192;
+
+ /**** Rendering ops ****/
+ exa->PrepareSolid = prepareSolid;
+ //exa->Solid = solid;
+ //exa->DoneSolid = doneSolid;
+ exa->PrepareCopy = prepareCopy;
+ //exa->Copy = copy;
+ //exa->DoneCopy = doneCopy;
+ exa->CheckComposite = checkComposite;
+ //exa->PrepareComposite = prepareComposite;
+ //exa->Composite = composite;
+ //exa->DoneComposite = doneComposite;
+
+ exa->WaitMarker = waitMarker;
+
+ return exaDriverInit(pScreen, exa);
+}
diff --git a/src/g80_exa.h b/src/g80_exa.h
new file mode 100644
index 0000000..2f01af6
--- /dev/null
+++ b/src/g80_exa.h
@@ -0,0 +1 @@
+Bool G80ExaInit(ScreenPtr pScreen, ScrnInfoPtr pScrn);
diff --git a/src/g80_type.h b/src/g80_type.h
index 95517e3..17acf93 100644
--- a/src/g80_type.h
+++ b/src/g80_type.h
@@ -1,4 +1,5 @@
#include <xaa.h>
+#include <exa.h>
#include <xf86.h>
#include <xf86int10.h>
#include <xf86Cursor.h>
@@ -24,6 +25,11 @@ typedef enum ORNum {
SOR1 = 1
} ORNum;
+typedef enum AccelMethod {
+ XAA,
+ EXA,
+} AccelMethod;
+
typedef struct G80Rec {
volatile CARD32 * reg;
unsigned char * mem;
@@ -46,11 +52,15 @@ typedef struct G80Rec {
OptionInfoPtr Options;
Bool HWCursor;
Bool NoAccel;
+ AccelMethod AccelMethod;
/* XAA */
XAAInfoRecPtr xaa;
CARD32 currentRop;
+ /* EXA */
+ ExaDriverPtr exa;
+
/* DMA command buffer */
CARD32 dmaPut;
CARD32 dmaCurrent;
diff --git a/src/g80_xaa.c b/src/g80_xaa.c
index 1f07444..d256d64 100644
--- a/src/g80_xaa.c
+++ b/src/g80_xaa.c
@@ -31,7 +31,7 @@
#include "g80_dma.h"
#include "g80_xaa.h"
-static void
+void
G80Sync(ScrnInfoPtr pScrn)
{
G80Ptr pNv = G80PTR(pScrn);
@@ -47,7 +47,7 @@ G80Sync(ScrnInfoPtr pScrn)
while(*pSync);
}
-static void
+void
G80DMAKickoffCallback(ScrnInfoPtr pScrn)
{
G80Ptr pNv = G80PTR(pScrn);
diff --git a/src/g80_xaa.h b/src/g80_xaa.h
index e2f1f63..7d2fee5 100644
--- a/src/g80_xaa.h
+++ b/src/g80_xaa.h
@@ -1 +1,3 @@
+void G80Sync(ScrnInfoPtr pScrn);
+void G80DMAKickoffCallback(ScrnInfoPtr pScrn);
Bool G80XAAInit(ScreenPtr);