summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2005-10-14 16:57:21 +0000
committerLuc Verhaegen <libv@skynet.be>2005-10-14 16:57:21 +0000
commitbab2b22ce2e11b9832b70ef8a958fd7a3c153109 (patch)
tree791442948bfb8b008cfb6710604bb118c1bc9eb1
parentb33b3757e38d28f05f72b56cea86ea8afc7cc410 (diff)
[devel-xfree86_4_5_dga] Fix build against XFree86 4.5.0. DGAOpenFrameBuffer
arguments changed.
-rw-r--r--src/Imakefile6
-rw-r--r--src/via_dga.c151
2 files changed, 81 insertions, 76 deletions
diff --git a/src/Imakefile b/src/Imakefile
index 02866da..ec22d8e 100644
--- a/src/Imakefile
+++ b/src/Imakefile
@@ -34,6 +34,10 @@ DEFXNEEDDRMLOCK = -DX_NEED_DRMLOCK
#undef DEFXNEEDDRMLOCK
#endif
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,4,20,0,0)
+DEFXFREE86DGA = -DXFREE86_45_DGA
+#endif
+
#else
XCOMM We are using X.org
@@ -129,7 +133,7 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
#endif
DEFINES = $(DRIDEFINES) $(DEFLINFB) $(DEFREGIONNULL) $(DEFXAAGETROP) \
- $(DEFI2CSTART) $(DEFXNEEDDRMLOCK)
+ $(DEFI2CSTART) $(DEFXNEEDDRMLOCK) $(DEFXFREE86DGA)
#if MakeHasPosixVariableSubstitutions
SubdirLibraryRule($(OBJS))
diff --git a/src/via_dga.c b/src/via_dga.c
index d77b896..e468cae 100644
--- a/src/via_dga.c
+++ b/src/via_dga.c
@@ -27,32 +27,8 @@
#include "via_driver.h"
#include "dgaproc.h"
-
-static Bool VIADGAOpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
- int *, int *, int *);
-static Bool VIADGASetMode(ScrnInfoPtr, DGAModePtr);
-static int VIADGAGetViewport(ScrnInfoPtr);
-static void VIADGASetViewport(ScrnInfoPtr, int, int, int);
-static void VIADGAFillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
-static void VIADGABlitRect(ScrnInfoPtr, int, int, int, int, int, int);
-
-
-static
-DGAFunctionRec VIADGAFuncs = {
- VIADGAOpenFramebuffer,
- NULL, /* CloseFrameBuffer */
- VIADGASetMode,
- VIADGASetViewport,
- VIADGAGetViewport,
- VIAAccelSync,
- VIADGAFillRect,
- VIADGABlitRect,
- NULL /* BlitTransRect */
-};
-
#define DGATRACE 4
-
static DGAModePtr
VIASetupDGAMode(
ScrnInfoPtr pScrn,
@@ -188,50 +164,6 @@ SECOND_PASS:
}
-Bool
-VIADGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
-{
- VIAPtr pVia = VIAPTR(pScrn);
- DGAModePtr modes = NULL;
- int num = 0;
-
- xf86ErrorFVerb(DGATRACE, " VIADGAInit\n");
-
- /* 8 */
- modes = VIASetupDGAMode(pScrn, modes, &num, 8, 8,
- (pScrn->bitsPerPixel == 8),
- (pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
- 0, 0, 0, PseudoColor);
-
- /* 16 */
- modes = VIASetupDGAMode(pScrn, modes, &num, 16, 16,
- (pScrn->bitsPerPixel == 16),
- (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
- 0xf800, 0x07e0, 0x001f, TrueColor);
-
- modes = VIASetupDGAMode(pScrn, modes, &num, 16, 16,
- (pScrn->bitsPerPixel == 16),
- (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
- 0xf800, 0x07e0, 0x001f, DirectColor);
-
- /* 24-in-32 */
- modes = VIASetupDGAMode(pScrn, modes, &num, 32, 24,
- (pScrn->bitsPerPixel == 32),
- (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
- 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
-
- modes = VIASetupDGAMode(pScrn, modes, &num, 32, 24,
- (pScrn->bitsPerPixel == 32),
- (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
- 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
-
- pVia->numDGAModes = num;
- pVia->DGAModes = modes;
-
- return DGAInit(pScreen, &VIADGAFuncs, modes, num);
-}
-
-
static Bool
VIADGASetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
{
@@ -330,15 +262,26 @@ VIADGABlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h,
}
}
+#ifdef XFREE86_45_DGA
+static Bool
+VIADGAOpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned int *mem,
+ unsigned int *size, unsigned int *offset,
+ unsigned int *flags)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ *name = NULL; /* no special device */
+ *mem = pVia->FrameBufferBase;
+ *size = pVia->videoRambytes;
+ *offset = 0;
+ *flags = 0;
+
+ return TRUE;
+}
+#else
static Bool
-VIADGAOpenFramebuffer(
- ScrnInfoPtr pScrn,
- char **name,
- unsigned char **mem,
- int *size,
- int *offset,
- int *flags)
+VIADGAOpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem,
+ int *size, int *offset, int *flags)
{
VIAPtr pVia = VIAPTR(pScrn);
@@ -350,3 +293,61 @@ VIADGAOpenFramebuffer(
return TRUE;
}
+#endif
+
+static
+DGAFunctionRec VIADGAFuncs = {
+ VIADGAOpenFramebuffer,
+ NULL, /* CloseFrameBuffer */
+ VIADGASetMode,
+ VIADGASetViewport,
+ VIADGAGetViewport,
+ VIAAccelSync,
+ VIADGAFillRect,
+ VIADGABlitRect,
+ NULL /* BlitTransRect */
+};
+
+
+Bool
+VIADGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+ DGAModePtr modes = NULL;
+ int num = 0;
+
+ xf86ErrorFVerb(DGATRACE, " VIADGAInit\n");
+
+ /* 8 */
+ modes = VIASetupDGAMode(pScrn, modes, &num, 8, 8,
+ (pScrn->bitsPerPixel == 8),
+ (pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
+ 0, 0, 0, PseudoColor);
+
+ /* 16 */
+ modes = VIASetupDGAMode(pScrn, modes, &num, 16, 16,
+ (pScrn->bitsPerPixel == 16),
+ (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
+ 0xf800, 0x07e0, 0x001f, TrueColor);
+
+ modes = VIASetupDGAMode(pScrn, modes, &num, 16, 16,
+ (pScrn->bitsPerPixel == 16),
+ (pScrn->depth != 16) ? 0 : pScrn->displayWidth,
+ 0xf800, 0x07e0, 0x001f, DirectColor);
+
+ /* 24-in-32 */
+ modes = VIASetupDGAMode(pScrn, modes, &num, 32, 24,
+ (pScrn->bitsPerPixel == 32),
+ (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
+ 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
+
+ modes = VIASetupDGAMode(pScrn, modes, &num, 32, 24,
+ (pScrn->bitsPerPixel == 32),
+ (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
+ 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
+
+ pVia->numDGAModes = num;
+ pVia->DGAModes = modes;
+
+ return DGAInit(pScreen, &VIADGAFuncs, modes, num);
+}