summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c
blob: b8e38a7da782850665298c7dc5ea178ea78e80d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c,v 1.1 1999/12/26 18:24:15 robin Exp $ */

/* (c) Itai Nahshon */

#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
#include "compiler.h"

#include "xf86Pci.h"
#include "xf86PciInfo.h"

#include "vgaHW.h"

#include "cir.h"
#include "alp.h"

static Bool
AlpDGAGetParams(int scrnIndex, unsigned long *offset, int *banksize,
				int *memsize)
{
	ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
	CIRPtr pCir = &ALPPTR(pScrn)->CirRec;

	*offset = pCir->FbAddress;
	*banksize = pScrn->videoRam * 1024;
	*memsize = pScrn->videoRam * 1024;

#ifdef ALP_DEBUG
	ErrorF("AlpDGAGetParams %d = 0x%08x, %d, %d\n",
		scrnIndex, *banksize, *memsize);
#endif
	return TRUE;
}

static Bool
AlpDGASetDirect(int scrnIndex, Bool enable)
{
	return TRUE;
}

static Bool
AlpDGASetBank(int scrnIndex, int bank, int flags)
{
	return TRUE;
}

static Bool
AlpDGASetViewport(int scrnIndex, int x, int y, int flags)
{
	ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
	(*pScrn->AdjustFrame)(scrnIndex, x, y, 0);
	return TRUE;
}

static  Bool
AlpDGAViewportChanged(int scrnIndex, int n, int flags)
{
	return TRUE;
}

Bool
AlpDGAInit(ScreenPtr pScreen)
{
	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
	CIRPtr pCir = &ALPPTR(pScrn)->CirRec;
	DGAInfoPtr pDGAInfo;

	pDGAInfo = DGACreateInfoRec();
	if(pDGAInfo == NULL)
		return FALSE;

	pCir->DGAInfo = pDGAInfo;

	pDGAInfo->GetParams = AlpDGAGetParams;
	pDGAInfo->SetDirectMode = AlpDGASetDirect;
	pDGAInfo->SetBank = AlpDGASetBank;
	pDGAInfo->SetViewport = AlpDGASetViewport;
	pDGAInfo->ViewportChanged = AlpDGAViewportChanged;;

	return DGAInit(pScreen, pDGAInfo, 0);
}