summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2006-02-16 00:14:11 +0000
committerEric Anholt <anholt@freebsd.org>2006-02-16 00:14:11 +0000
commitdc0354104cb4057dfcc7b2ccb8e2ae8474d70b15 (patch)
treee1badf347bf977fa1631f90a7997a0398c842639 /exa
parentc170aa830d0ce3dbff6b30081e04c3f91bf921be (diff)
Move EXA implementation up to the top level and remove its XFree86
dependencies. It was nearly abstract enough already to be used by multiple DDXes. This will be useful for EXA development through providing a fake acceleration implementation within Xephyr, so that testing can be done on new EXA code without worrying about buggy drivers.
Diffstat (limited to 'exa')
-rw-r--r--exa/Makefile.am8
-rw-r--r--exa/exa.c115
-rw-r--r--exa/exa.h3
-rw-r--r--exa/exa_accel.c29
-rw-r--r--exa/exa_migration.c6
-rw-r--r--exa/exa_offscreen.c7
-rw-r--r--exa/exa_priv.h14
-rw-r--r--exa/exa_render.c16
8 files changed, 52 insertions, 146 deletions
diff --git a/exa/Makefile.am b/exa/Makefile.am
index dcb944cd8..a4992052d 100644
--- a/exa/Makefile.am
+++ b/exa/Makefile.am
@@ -1,14 +1,12 @@
-module_LTLIBRARIES = libexa.la
+noinst_LTLIBRARIES = libexa.la
sdk_HEADERS = exa.h
-libexa_la_LDFLAGS = -avoid-version
-
INCLUDES = \
$(XORG_INCS) \
- -I$(srcdir)/../../../miext/cw
+ -I$(srcdir)/../miext/cw
-AM_CFLAGS = $(XORG_CFLAGS) @SERVER_DEFINES@ @MODULE_DEFINES@ @LOADER_DEFINES@
+AM_CFLAGS = $(XORG_CFLAGS) @SERVER_DEFINES@ @LOADER_DEFINES@ $(DIX_CFLAGS)
libexa_la_SOURCES = \
exa.c \
diff --git a/exa/exa.c b/exa/exa.c
index 7c5ef9f7b..d460f86d3 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -22,14 +22,15 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include <xorg-config.h>
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
#endif
+
+#include <stdlib.h>
+
#include "exa_priv.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xf86.h"
#include "exa.h"
#include "cw.h"
@@ -119,29 +120,12 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
PixmapPtr pPixmap;
ExaPixmapPrivPtr pExaPixmap;
int bpp;
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
ExaScreenPriv(pScreen);
if (w > 32767 || h > 32767)
return NullPixmap;
- if (!pScrn->vtSema || pExaScr->swappedOut) {
- pPixmap = pExaScr->SavedCreatePixmap(pScreen, w, h, depth);
- } else {
- bpp = BitsPerPixel (depth);
- if (bpp == 32 && depth == 24)
- {
- int format;
- for (format = 0; format < MAXFORMATS && pScrn->formats[format].depth; ++format)
- if (pScrn->formats[format].depth == 24)
- {
- bpp = pScrn->formats[format].bitsPerPixel;
- break;
- }
- }
-
- pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
- }
+ pPixmap = fbCreatePixmap (pScreen, w, h, depth);
if (!pPixmap)
return NULL;
pExaPixmap = ExaGetPixmapPriv(pPixmap);
@@ -288,7 +272,6 @@ exaCloseScreen(int i, ScreenPtr pScreen)
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
pScreen->CreateGC = pExaScr->SavedCreateGC;
pScreen->CloseScreen = pExaScr->SavedCloseScreen;
@@ -305,8 +288,6 @@ exaCloseScreen(int i, ScreenPtr pScreen)
ps->Glyphs = pExaScr->SavedGlyphs;
}
#endif
- if (pExaScr->wrappedEnableDisableFB)
- pScrn->EnableDisableFBAccess = pExaScr->SavedEnableDisableFBAccess;
xfree (pExaScr);
@@ -317,8 +298,6 @@ Bool
exaDriverInit (ScreenPtr pScreen,
ExaDriverPtr pScreenInfo)
{
- /* Do NOT use XF86SCRNINFO macro here!! */
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ExaScreenPrivPtr pExaScr;
#ifdef RENDER
@@ -334,8 +313,8 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
if (!pExaScr) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "EXA: Failed to allocate screen private\n");
+ LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
+ pScreen->myNum);
return FALSE;
}
@@ -343,6 +322,8 @@ exaDriverInit (ScreenPtr pScreen,
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
+ exaDDXDriverInit(pScreen);
+
/*
* Replace various fb screen functions
*/
@@ -389,8 +370,9 @@ exaDriverInit (ScreenPtr pScreen,
{
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
sizeof (ExaPixmapPrivRec))) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "EXA: Failed to allocate pixmap private\n");
+ LogMessage(X_WARNING,
+ "EXA(%d): Failed to allocate pixmap private\n",
+ pScreen->myNum);
return FALSE;
}
pExaScr->SavedCreatePixmap = pScreen->CreatePixmap;
@@ -401,7 +383,7 @@ exaDriverInit (ScreenPtr pScreen,
}
else
{
- xf86DrvMsg(pScreen->myNum, X_INFO, "EXA: No offscreen pixmaps\n");
+ LogMessage(X_INFO, "EXA(%d): No offscreen pixmaps\n", pScreen->myNum);
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, 0))
return FALSE;
}
@@ -410,14 +392,10 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->info->card.memorySize));
if (pExaScr->info->card.offScreenBase < pExaScr->info->card.memorySize) {
if (!exaOffscreenInit (pScreen)) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "EXA: Offscreen pixmap setup failed\n");
+ LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n",
+ pScreen->myNum);
return FALSE;
}
-
- pExaScr->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
- pScrn->EnableDisableFBAccess = exaEnableDisableFBAccess;
- pExaScr->wrappedEnableDisableFB = TRUE;
}
return TRUE;
@@ -444,9 +422,8 @@ void exaWaitSync(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
ExaCardInfoPtr card = &(pExaScr->info->card);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- if (card->needsSync && pScrn->vtSema) {
+ if (card->needsSync && !pExaScr->swappedOut) {
(*pExaScr->info->accel.WaitMarker)(pScreen, card->lastMarker);
card->needsSync = FALSE;
}
@@ -456,61 +433,3 @@ unsigned int exaGetVersion(void)
{
return EXA_VERSION;
}
-
-#ifdef XFree86LOADER
-static MODULESETUPPROTO(exaSetup);
-
-
-static const OptionInfoRec EXAOptions[] = {
- { -1, NULL,
- OPTV_NONE, {0}, FALSE }
-};
-
-/*ARGSUSED*/
-static const OptionInfoRec *
-EXAAvailableOptions(void *unused)
-{
- return (EXAOptions);
-}
-
-static XF86ModuleVersionInfo exaVersRec =
-{
- "exa",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 2, 0,
- ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-XF86ModuleData exaModuleData = { &exaVersRec, exaSetup, NULL };
-
-ModuleInfoRec EXA = {
- 1,
- "EXA",
- NULL,
- 0,
- EXAAvailableOptions,
-};
-
-/*ARGSUSED*/
-static pointer
-exaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
-{
- static Bool Initialised = FALSE;
-
- if (!Initialised) {
- Initialised = TRUE;
-#ifndef REMOVE_LOADER_CHECK_MODULE_INFO
- if (xf86LoaderCheckSymbol("xf86AddModuleInfo"))
-#endif
- xf86AddModuleInfo(&EXA, Module);
- }
-
- return (pointer)TRUE;
-}
-#endif
diff --git a/exa/exa.h b/exa/exa.h
index 43573aece..217d8ba32 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -249,6 +249,9 @@ exaGetPixmapPitch(PixmapPtr pPix);
unsigned long
exaGetPixmapSize(PixmapPtr pPix);
+void
+exaEnableDisableFBAccess (int index, Bool enable);
+
#define exaInitCard(exa, sync, memory_base, off_screen_base, memory_size, \
offscreen_byte_align, offscreen_pitch, flags, \
max_x, max_y) \
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index cbecddc38..b7b8bd1b1 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -22,14 +22,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include <xorg-config.h>
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
#endif
#include "exa_priv.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xf86.h"
#include "exa.h"
#include "cw.h"
@@ -49,8 +47,7 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
int off_x, off_y;
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- if (!pScrn->vtSema) {
+ if (pExaScr->swappedOut) {
ExaCheckFillSpans(pDrawable, pGC, n, ppt, pwidth, fSorted);
return;
}
@@ -213,8 +210,9 @@ RegionPtr
exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
int srcx, int srcy, int width, int height, int dstx, int dsty)
{
- ScrnInfoPtr pScrn = XF86SCRNINFO(pDstDrawable->pScreen);
- if (!pScrn->vtSema) {
+ ExaScreenPriv (pDstDrawable->pScreen);
+
+ if (pExaScr->swappedOut) {
return ExaCheckCopyArea(pSrcDrawable, pDstDrawable, pGC,
srcx, srcy, width, height, dstx, dsty);
}
@@ -232,7 +230,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
{
ExaScreenPriv (pDrawable->pScreen);
RegionPtr pClip = fbGetCompositeClip(pGC);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pDrawable->pScreen);
PixmapPtr pPixmap;
register BoxPtr pbox;
BoxPtr pextent;
@@ -243,7 +240,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
int xorg, yorg;
int n;
- if (!pScrn->vtSema ||
+ if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid ||
pDrawable->width > pExaScr->info->card.maxX ||
pDrawable->height > pExaScr->info->card.maxY ||
@@ -341,14 +338,13 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
int y2)
{
ExaScreenPriv (pDrawable->pScreen);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pDrawable->pScreen);
PixmapPtr pPixmap;
BoxPtr pbox;
int nbox;
int xoff, yoff;
int partX1, partX2, partY1, partY2;
- if (!pScrn->vtSema ||
+ if (pExaScr->swappedOut ||
pDrawable->width > pExaScr->info->card.maxX ||
pDrawable->height > pExaScr->info->card.maxY ||
!(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
@@ -560,12 +556,12 @@ const GCOps exaOps = {
void
exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
+ ExaScreenPriv (pWin->drawable.pScreen);
RegionRec rgnDst;
int dx, dy;
PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pWin->drawable.pScreen);
- if (!pScrn->vtSema) {
+ if (pExaScr->swappedOut) {
ExaScreenPriv(pWin->drawable.pScreen);
pExaScr->SavedCopyWindow (pWin, ptOldOrg, prgnSrc);
exaDrawableDirty (&pWin->drawable);
@@ -749,11 +745,10 @@ fallback:
void
exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
{
- ScrnInfoPtr pScrn = XF86SCRNINFO(pWin->drawable.pScreen);
-
+ ExaScreenPriv (pWin->drawable.pScreen);
if (!REGION_NUM_RECTS(pRegion))
return;
- if (pScrn->vtSema) {
+ if (!pExaScr->swappedOut) {
switch (what) {
case PW_BACKGROUND:
switch (pWin->backgroundState) {
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 270ad7541..50acad95f 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -22,8 +22,8 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include <xorg-config.h>
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
#endif
#include <string.h>
@@ -31,8 +31,6 @@
#include "exa_priv.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xf86.h"
#include "exa.h"
#include "cw.h"
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index b128504f2..a8ab37913 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -270,12 +270,7 @@ exaEnableDisableFBAccess (int index, Bool enable)
if (!enable) {
ExaOffscreenSwapOut (pScreen);
pExaScr->swappedOut = TRUE;
- }
-
- if (pExaScr->SavedEnableDisableFBAccess)
- (*pExaScr->SavedEnableDisableFBAccess)(index, enable);
-
- if (enable) {
+ } else {
ExaOffscreenSwapIn (pScreen);
pExaScr->swappedOut = FALSE;
}
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 460c4da81..25bbbde5e 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -26,8 +26,8 @@
#ifndef EXAPRIV_H
#define EXAPRIV_H
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
#endif
#include "exa.h"
@@ -93,8 +93,6 @@ typedef struct {
CompositeProcPtr SavedComposite;
GlyphsProcPtr SavedGlyphs;
#endif
- EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
- Bool wrappedEnableDisableFB;
Bool swappedOut;
} ExaScreenPrivRec, *ExaScreenPrivPtr;
@@ -143,6 +141,11 @@ typedef struct {
unsigned int size;
} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
+/**
+ * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
+ * to set EXA options or hook in screen functions to handle using EXA as the AA.
+ */
+void exaDDXDriverInit (ScreenPtr pScreen);
/* exaasync.c */
void
@@ -281,9 +284,6 @@ ExaOffscreenSwapIn (ScreenPtr pScreen);
void
ExaOffscreenFini (ScreenPtr pScreen);
-void
-exaEnableDisableFBAccess (int index, Bool enable);
-
/* exa.c */
void
exaDrawableUseScreen(DrawablePtr pDrawable);
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 4909a0fc4..206e19fa6 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright © 2001 Keith Packard
*
* Partly based on code that is Copyright © The XFree86 Project Inc.
@@ -22,18 +22,17 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include <xorg-config.h>
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
#endif
+
+#include <stdlib.h>
+
#include "exa_priv.h"
#ifdef RENDER
#include "mipict.h"
-#include "xf86str.h"
-#include "xf86.h"
-
-
#if DEBUG_TRACE_FALL
static void exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
{
@@ -449,11 +448,10 @@ exaComposite(CARD8 op,
{
ExaScreenPriv (pDst->pDrawable->pScreen);
int ret = -1;
- ScrnInfoPtr pScrn = XF86SCRNINFO(pDst->pDrawable->pScreen);
Bool saveSrcRepeat = pSrc->repeat;
Bool saveMaskRepeat = pMask ? pMask->repeat : 0;
- if (!pScrn->vtSema) {
+ if (pExaScr->swappedOut) {
exaDrawableDirty(pDst->pDrawable);
pExaScr->SavedComposite(op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height);