summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2006-03-09 06:06:25 +0000
committerEric Anholt <anholt@FreeBSD.org>2006-03-09 06:06:25 +0000
commitd0a258cc49922898233ccb23d14b77158a80ad7d (patch)
tree05cf29565d0df4709db1de88acbbe29e9a44de74
parent334130651599a0edbfed21305f3ef20e3509c751 (diff)
Update drivers that support EXA for the new EXA ABI. This consists of
moving all the accel and card members into the driver ptr, filling in the exa_major/ exa_minor fields, and always using LoadSubModule so we can check the module version up front. Only tested on ATI.
-rw-r--r--src/radeon.h2
-rw-r--r--src/radeon_driver.c5
-rw-r--r--src/radeon_exa.c44
-rw-r--r--src/radeon_exa_funcs.c59
4 files changed, 63 insertions, 47 deletions
diff --git a/src/radeon.h b/src/radeon.h
index cd3eed9..355c64c 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -408,7 +408,7 @@ typedef struct {
Bool PaletteSavedOnVT; /* Palette saved on last VT switch */
#ifdef USE_EXA
- ExaDriverRec exa;
+ ExaDriverPtr exa;
int engineMode;
#define EXA_ENGINEMODE_UNKNOWN 0
#define EXA_ENGINEMODE_2D 1
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 937545f..848b33b 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -1,5 +1,5 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.117 2004/02/19 22:38:12 tsi Exp $ */
-/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.91 2006-03-02 02:05:17 benh Exp $ */
+/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.92 2006/03/03 16:41:41 daenzer Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -328,6 +328,7 @@ static const char *fbSymbols[] = {
#ifdef USE_EXA
static const char *exaSymbols[] = {
+ "exaDriverAlloc",
"exaDriverInit",
"exaDriverFini",
"exaOffscreenAlloc",
@@ -4354,7 +4355,7 @@ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn)
#ifdef USE_EXA
if (info->useEXA) {
- info->exaReq.majorversion = 1;
+ info->exaReq.majorversion = 2;
info->exaReq.minorversion = 0;
if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL,
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 56927c1..ab6810e 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -157,10 +157,10 @@ static Bool RADEONGetOffsetPitch(PixmapPtr pPix, int bpp, CARD32 *pitch_offset,
{
RINFO_FROM_SCREEN(pPix->drawable.pScreen);
- if (pitch % info->exa.card.pixmapPitchAlign != 0)
+ if (pitch % info->exa->pixmapPitchAlign != 0)
RADEON_FALLBACK(("Bad pitch 0x%08x\n", pitch));
- if (offset % info->exa.card.pixmapOffsetAlign != 0)
+ if (offset % info->exa->pixmapOffsetAlign != 0)
RADEON_FALLBACK(("Bad offset 0x%08x\n", offset));
pitch = pitch >> 6;
@@ -371,6 +371,14 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
int next, screen_size;
int byteStride = pScrn->displayWidth * cpp;
+ if (info->exa != NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map already initialized\n");
+ return FALSE;
+ }
+ info->exa = exaDriverAlloc();
+ if (info->exa == NULL)
+ return FALSE;
+
/* Need to adjust screen size for 16 line tiles, and then make it align to.
* the buffer alignment requirement.
*/
@@ -379,12 +387,12 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
else
screen_size = pScrn->virtualY * byteStride;
- info->exa.card.memoryBase = info->FB + pScrn->fbOffset;
- info->exa.card.memorySize = info->FbMapSize - info->FbSecureSize;
- info->exa.card.offScreenBase = screen_size;
+ info->exa->memoryBase = info->FB + pScrn->fbOffset;
+ info->exa->memorySize = info->FbMapSize - info->FbSecureSize;
+ info->exa->offScreenBase = screen_size;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Allocating from a screen of %ld kb\n",
- info->exa.card.memorySize / 1024);
+ info->exa->memorySize / 1024);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Will use %d kb for front buffer at offset 0x%08x\n",
@@ -412,12 +420,12 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
* offscreen locations does.
*/
info->backPitch = pScrn->displayWidth;
- next = RADEON_ALIGN(info->exa.card.offScreenBase, RADEON_BUFFER_ALIGN);
+ next = RADEON_ALIGN(info->exa->offScreenBase, RADEON_BUFFER_ALIGN);
if (!info->noBackBuffer &&
- next + screen_size <= info->exa.card.memorySize)
+ next + screen_size <= info->exa->memorySize)
{
info->backOffset = next;
- info->exa.card.offScreenBase = next + screen_size;
+ info->exa->offScreenBase = next + screen_size;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Will use %d kb for back buffer at offset 0x%08x\n",
screen_size / 1024, info->backOffset);
@@ -428,26 +436,26 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
*/
info->depthPitch = RADEON_ALIGN(pScrn->displayWidth, 32);
depth_size = RADEON_ALIGN(pScrn->virtualY, 16) * info->depthPitch * cpp;
- next = RADEON_ALIGN(info->exa.card.offScreenBase, RADEON_BUFFER_ALIGN);
- if (next + depth_size <= info->exa.card.memorySize)
+ next = RADEON_ALIGN(info->exa->offScreenBase, RADEON_BUFFER_ALIGN);
+ if (next + depth_size <= info->exa->memorySize)
{
info->depthOffset = next;
- info->exa.card.offScreenBase = next + depth_size;
+ info->exa->offScreenBase = next + depth_size;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Will use %d kb for depth buffer at offset 0x%08x\n",
depth_size / 1024, info->depthOffset);
}
- info->textureSize *= (info->exa.card.memorySize -
- info->exa.card.offScreenBase) / 100;
+ info->textureSize *= (info->exa->memorySize -
+ info->exa->offScreenBase) / 100;
l = RADEONLog2(info->textureSize / RADEON_NR_TEX_REGIONS);
if (l < RADEON_LOG_TEX_GRANULARITY)
l = RADEON_LOG_TEX_GRANULARITY;
info->textureSize = (info->textureSize >> l) << l;
if (info->textureSize >= 512 * 1024) {
- info->textureOffset = info->exa.card.offScreenBase;
- info->exa.card.offScreenBase += info->textureSize;
+ info->textureOffset = info->exa->offScreenBase;
+ info->exa->offScreenBase += info->textureSize;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Will use %d kb for textures at offset 0x%08x\n",
info->textureSize / 1024, info->textureOffset);
@@ -460,8 +468,8 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Will use %ld kb for X Server offscreen at offset 0x%08lx\n",
- (info->exa.card.memorySize - info->exa.card.offScreenBase) /
- 1024, info->exa.card.offScreenBase);
+ (info->exa->memorySize - info->exa->offScreenBase) /
+ 1024, info->exa->offScreenBase);
return TRUE;
}
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 65ba4ce..4f08d9b 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -347,31 +347,37 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
{
RINFO_FROM_SCREEN(pScreen);
- memset(&info->exa.accel, 0, sizeof(ExaAccelInfoRec));
+ if (info->exa == NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
+ return FALSE;
+ }
+
+ info->exa->exa_major = 2;
+ info->exa->exa_minor = 0;
- info->exa.accel.PrepareSolid = FUNC_NAME(RADEONPrepareSolid);
- info->exa.accel.Solid = FUNC_NAME(RADEONSolid);
- info->exa.accel.DoneSolid = FUNC_NAME(RADEONDoneSolid);
+ info->exa->PrepareSolid = FUNC_NAME(RADEONPrepareSolid);
+ info->exa->Solid = FUNC_NAME(RADEONSolid);
+ info->exa->DoneSolid = FUNC_NAME(RADEONDoneSolid);
- info->exa.accel.PrepareCopy = FUNC_NAME(RADEONPrepareCopy);
- info->exa.accel.Copy = FUNC_NAME(RADEONCopy);
- info->exa.accel.DoneCopy = FUNC_NAME(RADEONDoneCopy);
+ info->exa->PrepareCopy = FUNC_NAME(RADEONPrepareCopy);
+ info->exa->Copy = FUNC_NAME(RADEONCopy);
+ info->exa->DoneCopy = FUNC_NAME(RADEONDoneCopy);
- info->exa.accel.WaitMarker = FUNC_NAME(RADEONSync);
- info->exa.accel.UploadToScreen = FUNC_NAME(RADEONUploadToScreen);
- info->exa.accel.DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen);
+ info->exa->WaitMarker = FUNC_NAME(RADEONSync);
+ info->exa->UploadToScreen = FUNC_NAME(RADEONUploadToScreen);
+ info->exa->DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen);
#if X_BYTE_ORDER == X_BIG_ENDIAN
- info->exa.accel.PrepareAccess = RADEONPrepareAccess;
- info->exa.accel.FinishAccess = RADEONFinishAccess;
+ info->exa->PrepareAccess = RADEONPrepareAccess;
+ info->exa->FinishAccess = RADEONFinishAccess;
#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */
- info->exa.card.flags = EXA_OFFSCREEN_PIXMAPS;
- info->exa.card.pixmapOffsetAlign = RADEON_BUFFER_ALIGN + 1;
- info->exa.card.pixmapPitchAlign = 64;
+ info->exa->flags = EXA_OFFSCREEN_PIXMAPS;
+ info->exa->pixmapOffsetAlign = RADEON_BUFFER_ALIGN + 1;
+ info->exa->pixmapPitchAlign = 64;
- info->exa.card.maxX = 2047;
- info->exa.card.maxY = 2047;
+ info->exa->maxX = 2047;
+ info->exa->maxY = 2047;
#ifdef RENDER
if (info->RenderAccel) {
@@ -384,26 +390,27 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
(info->ChipFamily == CHIP_FAMILY_R200)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration "
"enabled for R200 type cards.\n");
- info->exa.accel.CheckComposite = R200CheckComposite;
- info->exa.accel.PrepareComposite =
+ info->exa->CheckComposite = R200CheckComposite;
+ info->exa->PrepareComposite =
FUNC_NAME(R200PrepareComposite);
- info->exa.accel.Composite = FUNC_NAME(RadeonComposite);
- info->exa.accel.DoneComposite = RadeonDoneComposite;
+ info->exa->Composite = FUNC_NAME(RadeonComposite);
+ info->exa->DoneComposite = RadeonDoneComposite;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration "
"enabled for R100 type cards.\n");
- info->exa.accel.CheckComposite = R100CheckComposite;
- info->exa.accel.PrepareComposite =
+ info->exa->CheckComposite = R100CheckComposite;
+ info->exa->PrepareComposite =
FUNC_NAME(R100PrepareComposite);
- info->exa.accel.Composite = FUNC_NAME(RadeonComposite);
- info->exa.accel.DoneComposite = RadeonDoneComposite;
+ info->exa->Composite = FUNC_NAME(RadeonComposite);
+ info->exa->DoneComposite = RadeonDoneComposite;
}
}
#endif
RADEONEngineInit(pScrn);
- if (!exaDriverInit(pScreen, &info->exa)) {
+ if (!exaDriverInit(pScreen, info->exa)) {
+ xfree(info->exa);
return FALSE;
}
exaMarkSync(pScreen);