summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2007-02-14 14:17:14 -0800
committerKeith Packard <keithp@guitar.keithp.com>2007-02-14 14:17:14 -0800
commit22a271555a46267c40448fa926d45692498ef7c6 (patch)
tree90c325ad44409e52639679c61cfaa73f55faf337
parenta7c64d5e28f608d54c94fa7a5c92bd5b471179c7 (diff)
Create driver-independent DGA hooks, remove i830 DGA code.
As RandR needs to poke at DGA code, and we want the RandR code to be driver-independent, it seemed easier to just make the DGA code driver-independent as well.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/i830_dga.c271
-rw-r--r--src/i830_driver.c4
-rw-r--r--src/i830_randr.c4
-rw-r--r--src/i830_xf86Crtc.h11
-rw-r--r--src/i830_xf86DiDGA.c280
-rw-r--r--src/i830_xf86Rename.h2
7 files changed, 295 insertions, 279 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c63cc41..a94e14c8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,7 +59,6 @@ intel_drv_la_SOURCES = \
i830_cursor.c \
i830_debug.c \
i830_debug.h \
- i830_dga.c \
i830_display.c \
i830_display.h \
i830_driver.c \
@@ -85,6 +84,7 @@ intel_drv_la_SOURCES = \
i830_xf86Crtc.h \
i830_xf86Crtc.c \
i830_xf86Rotate.c \
+ i830_xf86DiDGA.c \
i915_3d.c \
i915_3d.h \
i915_reg.h \
diff --git a/src/i830_dga.c b/src/i830_dga.c
deleted file mode 100644
index 817d96d9..00000000
--- a/src/i830_dga.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- */
-/*
- * Reformatted with GNU indent (2.2.8), using the following options:
- *
- * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
- * -lp -npcs -psl -sob -ss -br -ce -sc -hnl
- *
- * This provides a good match with the original i810 code and preferred
- * XFree86 formatting conventions.
- *
- * When editing this driver, please follow the existing formatting, and edit
- * with <TAB> characters expanded at 8-column intervals.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dga.c,v 1.2 2002/11/05 02:01:18 dawes Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "xf86.h"
-#include "xf86DDC.h"
-#include "xf86_OSproc.h"
-#include "dgaproc.h"
-#include "i830_xf86Crtc.h"
-#include "i830_xf86Modes.h"
-#include "gcstruct.h"
-
-static DGAModePtr
-xf86_dga_get_modes (ScreenPtr pScreen, int *nump)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- DGAModePtr modes, mode;
- DisplayModePtr display_mode;
- int bpp = pScrn->bitsPerPixel >> 3;
- int num;
- PixmapPtr pPixmap = pScreen->GetScreenPixmap (pScreen);
-
- if (!pPixmap)
- return NULL;
-
- num = 0;
- display_mode = pScrn->modes;
- while (display_mode)
- {
- num++;
- display_mode = display_mode->next;
- if (display_mode == pScrn->modes)
- break;
- }
-
- if (!num)
- return NULL;
-
- modes = xalloc(num * sizeof(DGAModeRec));
- if (!modes)
- return NULL;
-
- num = 0;
- display_mode = pScrn->modes;
- while (display_mode)
- {
- mode = modes + num++;
-
- mode->mode = display_mode;
- mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
- mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
- if (display_mode->Flags & V_DBLSCAN)
- mode->flags |= DGA_DOUBLESCAN;
- if (display_mode->Flags & V_INTERLACE)
- mode->flags |= DGA_INTERLACED;
- mode->byteOrder = pScrn->imageByteOrder;
- mode->depth = pScrn->depth;
- mode->bitsPerPixel = pScrn->bitsPerPixel;
- mode->red_mask = pScrn->mask.red;
- mode->green_mask = pScrn->mask.green;
- mode->blue_mask = pScrn->mask.blue;
- mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
- mode->viewportWidth = display_mode->HDisplay;
- mode->viewportHeight = display_mode->VDisplay;
- mode->xViewportStep = (bpp == 3) ? 2 : 1;
- mode->yViewportStep = 1;
- mode->viewportFlags = DGA_FLIP_RETRACE;
- mode->offset = 0;
- mode->address = pPixmap->devPrivate.ptr;
- mode->bytesPerScanline = pPixmap->devKind;
- mode->imageWidth = pPixmap->drawable.width;
- mode->imageHeight = pPixmap->drawable.height;
- mode->pixmapWidth = mode->imageWidth;
- mode->pixmapHeight = mode->imageHeight;
- mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
- mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
-
- display_mode = display_mode->next;
- if (display_mode == pScrn->modes)
- break;
- }
- *nump = num;
- return modes;
-}
-
-static Bool
-xf86_dga_set_mode(ScrnInfoPtr pScrn, DGAModePtr display_mode)
-{
- ScreenPtr pScreen = pScrn->pScreen;
-
- if (!display_mode)
- xf86SwitchMode(pScreen, pScrn->currentMode);
- else
- xf86SwitchMode(pScreen, display_mode->mode);
-
- return TRUE;
-}
-
-static int
-xf86_dga_get_viewport(ScrnInfoPtr pScrn)
-{
- return 0;
-}
-
-static void
-xf86_dga_set_viewport(ScrnInfoPtr pScrn, int x, int y, int flags)
-{
- pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags);
-}
-
-static void
-xf86_dga_fill_rect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color)
-{
- ScreenPtr pScreen = pScrn->pScreen;
- WindowPtr pRoot = WindowTable [pScreen->myNum];
- GCPtr pGC = GetScratchGC (pRoot->drawable.depth, pScreen);
- XID vals[2];
- xRectangle r;
-
- if (!pGC)
- return;
- vals[0] = color;
- vals[1] = IncludeInferiors;
- ChangeGC (pGC, GCForeground|GCSubwindowMode, vals);
- ValidateGC (&pRoot->drawable, pGC);
- r.x = x;
- r.y = y;
- r.width = w;
- r.height = h;
- pGC->ops->PolyFillRect (&pRoot->drawable, pGC, 1, &r);
- FreeScratchGC (pGC);
-}
-
-static void
-xf86_dga_sync(ScrnInfoPtr pScrn)
-{
- ScreenPtr pScreen = pScrn->pScreen;
- WindowPtr pRoot = WindowTable [pScreen->myNum];
- char buffer[4];
-
- pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
-}
-
-static void
-xf86_dga_blit_rect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
-{
- ScreenPtr pScreen = pScrn->pScreen;
- WindowPtr pRoot = WindowTable [pScreen->myNum];
- GCPtr pGC = GetScratchGC (pRoot->drawable.depth, pScreen);
- XID vals[1];
-
- if (!pGC)
- return;
- vals[0] = IncludeInferiors;
- ChangeGC (pGC, GCSubwindowMode, vals);
- ValidateGC (&pRoot->drawable, pGC);
- pGC->ops->CopyArea (&pRoot->drawable, &pRoot->drawable, pGC,
- srcx, srcy, w, h, dstx, dsty);
- FreeScratchGC (pGC);
-}
-
-static Bool
-xf86_dga_open_framebuffer(ScrnInfoPtr pScrn,
- char **name,
- unsigned char **mem, int *size, int *offset, int *flags)
-{
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pPixmap = pScreen->GetScreenPixmap (pScreen);
-
- if (!pPixmap)
- return FALSE;
-
- *size = pPixmap->drawable.height * pPixmap->devKind;
- *mem = (unsigned char *) (pScrn->memPhysBase + pScrn->fbOffset);
- *offset = 0;
- *flags = DGA_NEED_ROOT;
-
- return TRUE;
-}
-
-static void
-xf86_dga_close_framebuffer(ScrnInfoPtr pScrn)
-{
-}
-
-static DGAFunctionRec xf86_dga_funcs = {
- xf86_dga_open_framebuffer,
- xf86_dga_close_framebuffer,
- xf86_dga_set_mode,
- xf86_dga_set_viewport,
- xf86_dga_get_viewport,
- xf86_dga_sync,
- xf86_dga_fill_rect,
- xf86_dga_blit_rect,
- NULL
-};
-
-static DGAModePtr xf86_dga_modes[MAXSCREENS];
-
-Bool
-xf86_dga_reinit (ScreenPtr pScreen)
-{
- int num;
- DGAModePtr modes;
-
- modes = xf86_dga_get_modes (pScreen, &num);
- if (!modes)
- return FALSE;
-
- if (xf86_dga_modes[pScreen->myNum])
- xfree (xf86_dga_modes[pScreen->myNum]);
-
- xf86_dga_modes[pScreen->myNum] = modes;
- return DGAReInitModes (pScreen, modes, num);
-}
-
-Bool
-xf86_dga_init (ScreenPtr pScreen)
-{
- int num;
- DGAModePtr modes;
-
- modes = xf86_dga_get_modes (pScreen, &num);
- if (!modes)
- return FALSE;
-
- if (xf86_dga_modes[pScreen->myNum])
- xfree (xf86_dga_modes[pScreen->myNum]);
-
- xf86_dga_modes[pScreen->myNum] = modes;
- return DGAInit(pScreen, &xf86_dga_funcs, modes, num);
-}
-
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 4b87ec5e..56903e15 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2727,7 +2727,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
- xf86_dga_init (pScreen);
+ xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset);
DPRINTF(PFX,
"assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n");
@@ -3393,7 +3393,7 @@ I830CheckDevicesTimer(OsTimerPtr timer, CARD32 now, pointer arg)
xf86ProbeOutputModes (pScrn, 0, 0);
xf86SetScrnInfoModes (pScrn);
- xf86_dga_reinit (pScrn->pScreen);
+ xf86DiDGAReInit (pScrn->pScreen);
xf86SwitchMode(pScrn->pScreen, pScrn->currentMode);
/* Clear the BIOS's hotkey press flags */
diff --git a/src/i830_randr.c b/src/i830_randr.c
index 03ca5042..b9cc9aa8 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -94,7 +94,7 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
/* Re-probe the outputs for new monitors or modes */
xf86ProbeOutputModes (scrp, 0, 0);
xf86SetScrnInfoModes (scrp);
- xf86_dga_reinit (pScreen);
+ xf86DiDGAReInit (pScreen);
for (mode = scrp->modes; ; mode = mode->next)
{
@@ -851,7 +851,7 @@ xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
xf86ProbeOutputModes (pScrn, 0, 0);
xf86SetScrnInfoModes (pScrn);
- xf86_dga_reinit (pScreen);
+ xf86DiDGAReInit (pScreen);
return xf86RandR12SetInfo12 (pScreen);
}
diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h
index 2d773284..53d2cdb7 100644
--- a/src/i830_xf86Crtc.h
+++ b/src/i830_xf86Crtc.h
@@ -414,7 +414,12 @@ typedef struct _xf86CrtcConfig {
DamagePtr rotationDamage;
/* DGA */
- unsigned int dga_flags;
+ unsigned int dga_flags;
+ unsigned long dga_address;
+ DGAModePtr dga_modes;
+ int dga_nmode;
+ int dga_width, dga_height, dga_stride;
+ DisplayModePtr dga_save_mode;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
@@ -536,13 +541,13 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
*/
Bool
-xf86_dga_init (ScreenPtr pScreen);
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
/**
* Re-initialize dga for this screen (as when the set of modes changes)
*/
Bool
-xf86_dga_reinit (ScreenPtr pScreen);
+xf86DiDGAReInit (ScreenPtr pScreen);
#endif /* _XF86CRTC_H_ */
diff --git a/src/i830_xf86DiDGA.c b/src/i830_xf86DiDGA.c
new file mode 100644
index 00000000..24a52973
--- /dev/null
+++ b/src/i830_xf86DiDGA.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86_OSproc.h"
+#include "dgaproc.h"
+#include "i830_xf86Crtc.h"
+#include "i830_xf86Modes.h"
+#include "gcstruct.h"
+
+static Bool
+xf86_dga_get_modes (ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ DGAModePtr modes, mode;
+ DisplayModePtr display_mode;
+ int bpp = scrn->bitsPerPixel >> 3;
+ int num;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode)
+ {
+ num++;
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+
+ if (!num)
+ return FALSE;
+
+ modes = xalloc(num * sizeof(DGAModeRec));
+ if (!modes)
+ return FALSE;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode)
+ {
+ mode = modes + num++;
+
+ mode->mode = display_mode;
+ mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
+ mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+ if (display_mode->Flags & V_DBLSCAN)
+ mode->flags |= DGA_DOUBLESCAN;
+ if (display_mode->Flags & V_INTERLACE)
+ mode->flags |= DGA_INTERLACED;
+ mode->byteOrder = scrn->imageByteOrder;
+ mode->depth = scrn->depth;
+ mode->bitsPerPixel = scrn->bitsPerPixel;
+ mode->red_mask = scrn->mask.red;
+ mode->green_mask = scrn->mask.green;
+ mode->blue_mask = scrn->mask.blue;
+ mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
+ mode->viewportWidth = display_mode->HDisplay;
+ mode->viewportHeight = display_mode->VDisplay;
+ mode->xViewportStep = (bpp == 3) ? 2 : 1;
+ mode->yViewportStep = 1;
+ mode->viewportFlags = DGA_FLIP_RETRACE;
+ mode->offset = 0;
+ mode->address = (unsigned char *) xf86_config->dga_address;
+ mode->bytesPerScanline = xf86_config->dga_stride;
+ mode->imageWidth = xf86_config->dga_width;
+ mode->imageHeight = xf86_config->dga_height;
+ mode->pixmapWidth = mode->imageWidth;
+ mode->pixmapHeight = mode->imageHeight;
+ mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
+ mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
+
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+ if (xf86_config->dga_modes)
+ xfree (xf86_config->dga_modes);
+ xf86_config->dga_nmode = num;
+ xf86_config->dga_modes = modes;
+ return TRUE;
+}
+
+static Bool
+xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!display_mode)
+ {
+ if (xf86_config->dga_save_mode)
+ {
+ xf86SwitchMode(pScreen, xf86_config->dga_save_mode);
+ xf86_config->dga_save_mode = NULL;
+ }
+ }
+ else
+ {
+ if (!xf86_config->dga_save_mode)
+ {
+ xf86_config->dga_save_mode = scrn->currentMode;
+ xf86SwitchMode(pScreen, display_mode->mode);
+ }
+ }
+ return TRUE;
+}
+
+static int
+xf86_dga_get_viewport(ScrnInfoPtr scrn)
+{
+ return 0;
+}
+
+static void
+xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
+{
+ scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
+}
+
+static Bool
+xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+
+ pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height,
+ scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride,
+ (char *) scrn->memPhysBase + scrn->fbOffset);
+ if (!pPixmap)
+ return FALSE;
+ pGC = GetScratchGC (scrn->depth, pScreen);
+ if (!pGC)
+ {
+ FreeScratchPixmapHeader (pPixmap);
+ return FALSE;
+ }
+ *ppDrawable = &pPixmap->drawable;
+ *ppGC = pGC;
+ return TRUE;
+}
+
+static void
+xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC)
+{
+ FreeScratchGC (pGC);
+ FreeScratchPixmapHeader ((PixmapPtr) pDrawable);
+}
+
+static void
+xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color)
+{
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+ XID vals[1];
+ xRectangle r;
+
+ if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
+ return;
+ vals[0] = color;
+ ChangeGC (pGC, GCForeground, vals);
+ ValidateGC (pDrawable, pGC);
+ r.x = x;
+ r.y = y;
+ r.width = w;
+ r.height = h;
+ pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r);
+ xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
+}
+
+static void
+xf86_dga_sync(ScrnInfoPtr scrn)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ WindowPtr pRoot = WindowTable [pScreen->myNum];
+ char buffer[4];
+
+ pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
+}
+
+static void
+xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+
+ if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
+ return;
+ ValidateGC (pDrawable, pGC);
+ pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty);
+ xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
+}
+
+static Bool
+xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
+ char **name,
+ unsigned char **mem, int *size, int *offset, int *flags)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ *size = xf86_config->dga_stride * xf86_config->dga_height;
+ *mem = (unsigned char *) (xf86_config->dga_address);
+ *offset = 0;
+ *flags = DGA_NEED_ROOT;
+
+ return TRUE;
+}
+
+static void
+xf86_dga_close_framebuffer(ScrnInfoPtr scrn)
+{
+}
+
+static DGAFunctionRec xf86_dga_funcs = {
+ xf86_dga_open_framebuffer,
+ xf86_dga_close_framebuffer,
+ xf86_dga_set_mode,
+ xf86_dga_set_viewport,
+ xf86_dga_get_viewport,
+ xf86_dga_sync,
+ xf86_dga_fill_rect,
+ xf86_dga_blit_rect,
+ NULL
+};
+
+Bool
+xf86DiDGAReInit (ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!xf86_dga_get_modes (pScreen))
+ return FALSE;
+
+ return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode);
+}
+
+Bool
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ xf86_config->dga_flags = 0;
+ xf86_config->dga_address = dga_address;
+ xf86_config->dga_width = scrn->virtualX;
+ xf86_config->dga_height = scrn->virtualY;
+ xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3;
+
+ if (!xf86_dga_get_modes (pScreen))
+ return FALSE;
+
+ return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode);
+}
diff --git a/src/i830_xf86Rename.h b/src/i830_xf86Rename.h
index cf8de622..de2eb9a5 100644
--- a/src/i830_xf86Rename.h
+++ b/src/i830_xf86Rename.h
@@ -62,5 +62,7 @@
#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
+#define xf86DiDGAInit XF86NAME(xf86DiDGAInit)
+#define xf86DiDGAReInit XF86NAME(xf86DiDGAReInit)
#endif /* _XF86RENAME_H_ */