1
/**************************************************************************
3
Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
6
Permission is hereby granted, free of charge, to any person obtaining a
7
copy of this software and associated documentation files (the
8
"Software"), to deal in the Software without restriction, including
9
without limitation the rights to use, copy, modify, merge, publish,
10
distribute, sub license, and/or sell copies of the Software, and to
11
permit persons to whom the Software is furnished to do so, subject to
12
the following conditions:
14
The above copyright notice and this permission notice (including the
15
next paragraph) shall be included in all copies or substantial portions
18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
22
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
**************************************************************************/
27
/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_debug.c,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
31
* Sung-Ching Lin <sclin@sis.com.tw>
36
* dump HW states, set environment variable SIS_DEBUG
37
* to enable these functions
46
/* for SiS 300/630/540 */
47
#define MMIOLength (0x8FFF-0x8800+1)
48
#define MMIO3DOffset (0x8800)
49
#define FILE_NAME "300.dump"
51
char *IOBase4Debug = 0;
53
char *prevLockFile = NULL;
56
DWORD _empty[0x10000];
59
dump_agp (void *addr, int dword_count)
61
if (!getenv ("SIS_DEBUG"))
66
FILE *file = fopen ("300agp.dump", "w");
70
for (i = 0; i < dword_count; i++)
72
fprintf (file, "%f\n", *(float *) addr);
73
((unsigned char *) addr) += 4;
81
d2f_once (GLcontext * ctx)
83
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
84
__GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private;
86
static int serialNumber = -1;
88
if (serialNumber == hwcx->serialNumber)
91
serialNumber = hwcx->serialNumber;
99
if (!getenv ("SIS_DEBUG"))
102
/* dump 0x8800 - 0x8AFF */
106
void *addr = IOBase4Debug + MMIO3DOffset;
108
assert (IOBase4Debug);
110
if ((fh = open (FILE_NAME, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE)) != -1)
112
rval = write (fh, addr, MMIOLength);
121
d2h (char *file_name)
125
void *addr[MMIOLength];
127
if (!getenv ("SIS_DEBUG"))
130
if ((fh = open (file_name, O_CREAT, S_IREAD | S_IWRITE)) != -1)
132
rval = read (fh, addr, MMIOLength);
136
memcpy (IOBase4Debug + MMIO3DOffset, addr, MMIOLength);
140
/* dump video memory to file */
142
dvidmem (unsigned char *addr, int size)
146
static char *file_name = "vidmem.dump";
148
if (!getenv ("SIS_DEBUG"))
151
if ((fh = open (file_name, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE)) != -1)
153
rval = write (fh, addr, size);