h3, h5, minihwc: don't unconditionally define GDBG_INFO_ON in minihwc.c

several constifications.  exclude the debug stuff from release builds.
fixed that 'waxRegnames' typo in HWC_WAX_STORE and HWC_WAX_LOAD macros.
This commit is contained in:
sezero
2018-08-06 14:10:02 +03:00
parent b33d69b0a3
commit 2ee4b4f583
15 changed files with 67 additions and 95 deletions

View File

@@ -21,11 +21,10 @@
** Fixes Phantom Menace, OGL, and others.
**
** 1 3/04/98 4:13p Dow
**
*/
char * ioRegNames[] = {
#if GDBG_INFO_ON
const char * ioRegNames[] = {
"status",
"pciInit0",
"sipMonitor",
@@ -92,7 +91,7 @@ char * ioRegNames[] = {
"vidCurrOverlayStartAddr"
};
char *cmdAGPRegNames[] = {
const char *cmdAGPRegNames[] = {
// AGP
"agpReqSize",
"hostAddrLow",
@@ -168,7 +167,7 @@ char *cmdAGPRegNames[] = {
"yuvStride"
};
char *waxRegNames[] = {
const char *waxRegNames[] = {
"status",
"unused0",
"clip0min",
@@ -555,7 +554,7 @@ char *waxRegNames[] = {
"colorTransLut0FF"
};
char *sstRegNames[] = {
const char *sstRegNames[] = {
"status",
"intrCtrl",
"vAx",
@@ -773,7 +772,7 @@ char *sstRegNames[] = {
"texBaseAddr38",
"trexInit0",
"trexInit1",
"nccTable000",
"nccTable001",
"nccTable002",
@@ -803,3 +802,4 @@ char *sstRegNames[] = {
"tChromaKeyMin",
"tChromaKeyMax"
};
#endif

View File

@@ -29,10 +29,10 @@
#ifndef HWCIO_H
#define HWCIO_H
extern char *ioRegNames[];
extern char *cmdAGPRegNames[];
extern char *waxRegNames[];
extern char *sstRegNames[];
extern const char *ioRegNames[];
extern const char *cmdAGPRegNames[];
extern const char *waxRegNames[];
extern const char *sstRegNames[];
/*
** I/O Macros
@@ -59,13 +59,13 @@ GDBG_INFO(120, "Loaded 0x%x from CAGP Register %s\n", val,\
#define HWC_WAX_STORE(regInfo, reg, val)\
GDBG_INFO(120, "Storing 0x%x to WAX Register %s\n", val,\
waxRegnames[(offsetof(SstGRegs, reg)) >> 2]);\
waxRegNames[(offsetof(SstGRegs, reg)) >> 2]);\
((SstGRegs *) regInfo->waxRegs)->reg = val
#define HWC_WAX_LOAD(regInfo, reg, val)\
val = ((SstGRegs *) regInfo->waxRegs)->reg;\
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
waxRegnames[(offsetof(SstGRegs, reg)) >> 2]);
waxRegNames[(offsetof(SstGRegs, reg)) >> 2]);
#define HWC_SST_STORE(regInfo, reg, val)\
GDBG_INFO(120, "Storing 0x%x to 3D Register %s\n", val,\
@@ -77,4 +77,4 @@ val = ((SstRegs *) regInfo->sstRegs)->reg;\
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
sstRegNames[(offsetof(SstRegs, reg)) >> 2]);
#endif /* HWCIO_H not defined */
#endif /* HWCIO_H */

View File

@@ -21,7 +21,7 @@
/*
We need to provide the following functions:
char *
const char *
hwcGetErrorString(void);
hwcInfo *
@@ -169,7 +169,7 @@ static void deleteEnvData() {
envinit=0;
}
char *
const char *
hwcGetErrorString()
{
#define FN_NAME "hwcGetErrorString"

View File

@@ -388,14 +388,7 @@
** WinGlide
**
** 1 3/04/98 4:13p Dow
**
*/
#if !defined(GDBG_INFO_ON) || (GDBG_INFO_ON == 0)
#if defined(GDBG_INFO_ON)
#undef GDBG_INFO_ON
#endif /* defined(GDBG_INFO_ON) */
#define GDBG_INFO_ON
#endif /* !defined(GDBG_INFO_ON) || (GDBG_INFO_ON == 0) */
#include <stddef.h>
#include <stdlib.h>
@@ -3638,6 +3631,7 @@ FxBool
hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
{
#define FN_NAME "hwcResolutionSupported"
#if GDBG_INFO_ON
static char *resNames[] = {
"GR_RESOLUTION_320x200",
"GR_RESOLUTION_320x240",
@@ -3664,7 +3658,7 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
"GR_RESOLUTION_2048x1536",
"GR_RESOLUTION_2048x2048"
};
#endif
struct WidthHeight_s {
FxU32 width;
FxU32 height;
@@ -3694,7 +3688,6 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
{2048, 1536}, /* GR_RESOLUTION_2048x1536 */
{2048, 2048} /* GR_RESOLUTION_2048x2048 */
};
GDBG_INFO(80, FN_NAME ": res == %s (0x%x), supported == %s\n",
resNames[res], resolutionSupported[bInfo->boardNum][res],

View File

@@ -461,7 +461,7 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo
FxBool
hwcRestoreVideo(hwcBoardInfo *bInfo);
char *
const char *
hwcGetErrorString(void);
FxBool

View File

@@ -20,13 +20,11 @@
** 3 4/06/99 3:36p Dow
** Alt tab stuff
**
**
** 1 3/04/98 4:13p Dow
**
*/
char * ioRegNames[] = {
#if GDBG_INFO_ON
const char * ioRegNames[] = {
"status",
"pciInit0",
"sipMonitor",
@@ -93,7 +91,7 @@ char * ioRegNames[] = {
"vidCurrOverlayStartAddr"
};
char *cmdAGPRegNames[] = {
const char *cmdAGPRegNames[] = {
// AGP
"agpReqSize",
"hostAddrLow",
@@ -169,7 +167,7 @@ char *cmdAGPRegNames[] = {
"yuvStride"
};
char *waxRegNames[] = {
const char *waxRegNames[] = {
"status",
"unused0",
"clip0min",
@@ -556,7 +554,7 @@ char *waxRegNames[] = {
"colorTransLut0FF"
};
char *sstRegNames[] = {
const char *sstRegNames[] = {
"status",
"intrCtrl",
"vAx",
@@ -804,3 +802,4 @@ char *sstRegNames[] = {
"tChromaKeyMin",
"tChromaKeyMax"
};
#endif /* GDBG_INFO_ON */

View File

@@ -20,7 +20,6 @@
** 3 4/06/99 3:36p Dow
** Alt tab stuff
**
**
** 2 3/11/98 8:27p Dow
** WinGlide
**
@@ -30,10 +29,10 @@
#ifndef HWCIO_H
#define HWCIO_H
extern char *ioRegNames[];
extern char *cmdAGPRegNames[];
extern char *waxRegNames[];
extern char *sstRegNames[];
extern const char *ioRegNames[];
extern const char *cmdAGPRegNames[];
extern const char *waxRegNames[];
extern const char *sstRegNames[];
/*
** I/O Macros
@@ -60,13 +59,13 @@ GDBG_INFO(120, "Loaded 0x%x from CAGP Register %s\n", val,\
#define HWC_WAX_STORE(regInfo, reg, val)\
GDBG_INFO(120, "Storing 0x%x to WAX Register %s\n", val,\
waxRegnames[(offsetof(SstGRegs, reg)) >> 2]);\
waxRegNames[(offsetof(SstGRegs, reg)) >> 2]);\
((SstGRegs *) regInfo.waxBase)->reg = val
#define HWC_WAX_LOAD(regInfo, reg, val)\
val = ((SstGRegs *) regInfo.waxBase)->reg;\
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
waxRegnames[(offsetof(SstGRegs, reg)) >> 2]);
waxRegNames[(offsetof(SstGRegs, reg)) >> 2]);
#define HWC_SST_STORE(regInfo, reg, val)\
GDBG_INFO(120, "Storing 0x%x to 3D Register %s\n", val,\
@@ -78,4 +77,4 @@ val = ((SstRegs *) regInfo.sstBase)->reg;\
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
sstRegNames[(offsetof(SstRegs, reg)) >> 2]);
#endif /* HWCIO_H not defined */
#endif /* HWCIO_H */

View File

@@ -23,7 +23,7 @@
We need to provide the following functions:
char *
const char *
hwcGetErrorString(void);
hwcInfo *
@@ -208,7 +208,7 @@ static void deleteEnvData() {
}
#endif
char *
const char *
hwcGetErrorString()
{
#define FN_NAME "hwcGetErrorString"

View File

@@ -523,14 +523,7 @@
** WinGlide
**
** 1 3/04/98 4:13p Dow
**
*/
#if !defined(GDBG_INFO_ON) || (GDBG_INFO_ON == 0)
#if defined(GDBG_INFO_ON)
#undef GDBG_INFO_ON
#endif /* defined(GDBG_INFO_ON) */
#define GDBG_INFO_ON
#endif /* !defined(GDBG_INFO_ON) || (GDBG_INFO_ON == 0) */
#include <stddef.h>
#include <stdlib.h>
@@ -3562,7 +3555,7 @@ hwcRestoreVideo(hwcBoardInfo *bInfo)
#undef FN_NAME
} /* hwcRestoreVideo */
char *
const char *
hwcGetErrorString()
{
#define FN_NAME "hwcGetErrorString"
@@ -4050,6 +4043,7 @@ FxBool
hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
{
#define FN_NAME "hwcResolutionSupported"
#if GDBG_INFO_ON
static char *resNames[] = {
"GR_RESOLUTION_320x200",
"GR_RESOLUTION_320x240",
@@ -4076,7 +4070,7 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
"GR_RESOLUTION_2048x1536",
"GR_RESOLUTION_2048x2048"
};
#endif
#if 0
struct WidthHeight_s {
FxU32 width;
@@ -4107,7 +4101,7 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res)
{2048, 1536}, /* GR_RESOLUTION_2048x1536 */
{2048, 2048} /* GR_RESOLUTION_2048x2048 */
};
#endif
#endif
GDBG_INFO(80, FN_NAME ": res == %s (0x%x), supported == %s\n",
resNames[res], resolutionSupported[bInfo->boardNum][res],

View File

@@ -496,7 +496,7 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo
FxBool
hwcRestoreVideo(hwcBoardInfo *bInfo);
char *
const char *
hwcGetErrorString(void);
FxBool

View File

@@ -16,7 +16,7 @@
** THE UNITED STATES.
**
** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
**
**
** 3 3dfx 1.0.1.0.1.0 10/11/00 Brent Forced check in to enforce
** branching.
** 2 3dfx 1.0.1.0 06/20/00 Joseph Kain Changes to support the
@@ -26,11 +26,10 @@
** $
**
** 1 3/04/98 4:13p Dow
**
*/
char * ioRegNames[] = {
#if GDBG_INFO_ON
const char * ioRegNames[] = {
"status",
"pciInit0",
"sipMonitor",
@@ -97,7 +96,7 @@ char * ioRegNames[] = {
"vidCurrOverlayStartAddr"
};
char *cmdAGPRegNames[] = {
const char *cmdAGPRegNames[] = {
// AGP
"agpReqSize",
"hostAddrLow",
@@ -173,7 +172,7 @@ char *cmdAGPRegNames[] = {
"yuvStride"
};
char *waxRegNames[] = {
const char *waxRegNames[] = {
"status",
"unused0",
"clip0min",
@@ -560,7 +559,7 @@ char *waxRegNames[] = {
"colorTransLut0FF"
};
char *sstRegNames[] = {
const char *sstRegNames[] = {
"status",
"intrCtrl",
"vAx",
@@ -808,3 +807,4 @@ char *sstRegNames[] = {
"tChromaKeyMin",
"tChromaKeyMax"
};
#endif /* GDBG_INFO_ON */

View File

@@ -42,10 +42,10 @@
#ifndef HWCIO_H
#define HWCIO_H
extern char *ioRegNames[];
extern char *cmdAGPRegNames[];
extern char *waxRegNames[];
extern char *sstRegNames[];
extern const char *ioRegNames[];
extern const char *cmdAGPRegNames[];
extern const char *waxRegNames[];
extern const char *sstRegNames[];
#ifndef GET
# define GET(s) s
@@ -122,4 +122,4 @@ val = GET(((SstRegs *) regInfo.sstBase)->reg);\
GDBG_INFO(120, "Loaded 0x%x from WAX Register %s\n", val,\
sstRegNames[(offsetof(SstRegs, reg)) >> 2]);
#endif /* HWCIO_H not defined */
#endif /* HWCIO_H */

View File

@@ -23,7 +23,7 @@
We need to provide the following functions:
char *
const char *
hwcGetErrorString(void);
hwcInfo *
@@ -204,7 +204,7 @@ static void deleteEnvData() {
}
#endif
char *
const char *
hwcGetErrorString()
{
#define FN_NAME "hwcGetErrorString"

View File

@@ -732,16 +732,8 @@
** WinGlide
**
** 1 3/04/98 4:13p Dow
**
*/
#if !defined(GDBG_INFO_ON) || (GDBG_INFO_ON == 0)
#if defined(GDBG_INFO_ON)
#undef GDBG_INFO_ON
#endif /* defined(GDBG_INFO_ON) */
#define GDBG_INFO_ON
#endif /* !defined(GDBG_INFO_ON) || (GDBG_INFO_ON == 0) */
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -998,26 +990,20 @@ static _p_info *CPUInfo = NULL;
static char errorString[MAX_ERROR_SIZE];
static FxU32 __attribute_used fenceVar;
FxU32 hwc_errncpy(char *dst,const char *src);
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32)||(GLIDE_PLATFORM & GLIDE_OS_MACOS)
/* like strncpy, for the error string except it always null terminates */
FxU32 hwc_errncpy(char *dst,const char *src)
static void hwc_errncpy(char *dst,const char *src)
{
FxU32 i,size=MAX_ERROR_SIZE;
if (size==0)
return 0;
for(i=0;i<size;i++)
int i=0;
for(;i<MAX_ERROR_SIZE;i++)
{
*dst++=*src++;
if (src[-1]==0)
return i;
return;
}
dst[-1]=0;
return (i-1);
}
#endif
#if defined(__WATCOMC__)
/*
@@ -5819,7 +5805,7 @@ void hwcSLIReadDisable(hwcBoardInfo *bInfo)
}
#endif
char *
const char *
hwcGetErrorString()
{
#define FN_NAME "hwcGetErrorString"
@@ -8580,6 +8566,7 @@ FxBool
hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res, GrScreenRefresh_t ref)
{
#define FN_NAME "hwcResolutionSupported"
#if GDBG_INFO_ON
static char *resNames[] = {
"GR_RESOLUTION_320x200",
"GR_RESOLUTION_320x240",
@@ -8606,7 +8593,7 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res, GrScreenRe
"GR_RESOLUTION_2048x1536",
"GR_RESOLUTION_2048x2048"
};
#endif
#if 0
struct WidthHeight_s {
FxU32 width;
@@ -8637,8 +8624,8 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res, GrScreenRe
{2048, 1536}, /* GR_RESOLUTION_2048x1536 */
{2048, 2048} /* GR_RESOLUTION_2048x2048 */
};
#endif
#endif
#if GDBG_INFO_ON
static char *refresh[] = {
"GR_REFRESH_60Hz",
"GR_REFRESH_70Hz",
@@ -8648,9 +8635,9 @@ hwcResolutionSupported(hwcBoardInfo *bInfo, GrScreenResolution_t res, GrScreenRe
"GR_REFRESH_90Hz",
"GR_REFRESH_100Hz",
"GR_REFRESH_85Hz",
"GR_REFRESH_120Hz"
"GR_REFRESH_120Hz"
};
#endif
GDBG_INFO(80, FN_NAME ": res == %s (0x%x) ref == %s, supported == %s\n",
resNames[res], resolutionSupported[bInfo->boardNum][res][ref], refresh[ref],

View File

@@ -616,7 +616,7 @@ hwcRestoreVideo(hwcBoardInfo *bInfo);
void
hwcResetVideo(hwcBoardInfo *bInfo);
char *
const char *
hwcGetErrorString(void);
FxBool