aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2004-05-24 20:48:27 +0000
committerEric Anholt <[email protected]>2004-05-24 20:48:27 +0000
commitbbd557fc53669132fb1f93f7bb28b2939fa70f51 (patch)
tree7c17d319045d1175cc52ba3eb51d65c40501d751 /src/mesa
parent8c805fed0f8ec97ce8748918e382ceafab291c8d (diff)
Clean up some warnings by making sis_fatal_error a macro, and let it take an
argument of a message to print. Make some assert(0)s use sis_fatal_error.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/sis/sis_alloc.c10
-rw-r--r--src/mesa/drivers/dri/sis/sis_clear.c4
-rw-r--r--src/mesa/drivers/dri/sis/sis_context.c10
-rw-r--r--src/mesa/drivers/dri/sis/sis_context.h8
-rw-r--r--src/mesa/drivers/dri/sis/sis_dd.c2
-rw-r--r--src/mesa/drivers/dri/sis/sis_span.c2
-rw-r--r--src/mesa/drivers/dri/sis/sis_tex.c8
7 files changed, 16 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_alloc.c b/src/mesa/drivers/dri/sis/sis_alloc.c
index 0e85e6faff5..b808daae3d2 100644
--- a/src/mesa/drivers/dri/sis/sis_alloc.c
+++ b/src/mesa/drivers/dri/sis/sis_alloc.c
@@ -151,10 +151,7 @@ sisAllocZStencilBuffer( sisContextPtr smesa )
addr = sisAllocFB( smesa, totalBytes, &smesa->zbFree );
if (addr == NULL)
- {
- fprintf (stderr, "SIS driver : out of video memory\n");
- sis_fatal_error ();
- }
+ sis_fatal_error("Failure to allocate Z buffer.\n");
if (SIS_VERBOSE & VERBOSE_SIS_BUFFER) {
fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%p\n", addr);
@@ -210,10 +207,7 @@ sisAllocBackbuffer( sisContextPtr smesa )
/* Fixme: unique context alloc/free back-buffer? */
addr = sisAllocFB( smesa, size, &smesa->bbFree );
if (addr == NULL)
- {
- fprintf (stderr, "SIS driver : out of video memory\n");
- sis_fatal_error ();
- }
+ sis_fatal_error("Failure to allocate back buffer.\n");
addr = (char *)ALIGNMENT( (unsigned long)addr, DRAW_BUFFER_HW_ALIGNMENT );
diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c
index d34793d833a..1044f9bc793 100644
--- a/src/mesa/drivers/dri/sis/sis_clear.c
+++ b/src/mesa/drivers/dri/sis/sis_clear.c
@@ -66,7 +66,7 @@ set_color_pattern( sisContextPtr smesa, GLubyte red, GLubyte green,
smesa->clearColorPattern |= smesa->clearColorPattern << 16;
break;
default:
- assert(0);
+ sis_fatal_error("Bad dst color format\n");
}
}
@@ -89,7 +89,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil )
zPattern = FLOAT_TO_UINT(z);
break;
default:
- assert(0);
+ sis_fatal_error("Bad Z format\n");
}
smesa->clearZStencilPattern = zPattern;
}
diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c
index cdf9257b5e3..c49db5fe34b 100644
--- a/src/mesa/drivers/dri/sis/sis_context.c
+++ b/src/mesa/drivers/dri/sis/sis_context.c
@@ -182,7 +182,7 @@ sisCreateContext( const __GLcontextModes *glVisual,
smesa->colorFormat = DST_FORMAT_RGB_565;
break;
default:
- assert (0);
+ sis_fatal_error("Bad bytesPerPixel.\n");
}
/* Parse configuration files */
@@ -508,11 +508,3 @@ sis_update_texture_state (sisContextPtr smesa)
smesa->GlobalFlag &= ~GFLAG_TEXTURE_STATES;
}
-void
-sis_fatal_error (void)
-{
- /* free video memory, or the framebuffer device will do it automatically */
-
- fprintf(stderr, "Fatal errors in sis_dri.so\n");
- exit (-1);
-}
diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h
index 5df5890ecc4..395a7a3e6d6 100644
--- a/src/mesa/drivers/dri/sis/sis_context.h
+++ b/src/mesa/drivers/dri/sis/sis_context.h
@@ -395,6 +395,12 @@ struct sis_context
*(GLint *)(GET_IOBase(smesa) + 0x8b60) = (GLint)(-1); \
}
+#define sis_fatal_error(msg) \
+do { \
+ fprintf(stderr, "[%s:%d]: %s", __FILE__, __LINE__, msg); \
+ exit(-1); \
+} while (0)
+
/* Lock required */
#define mWait3DCmdQueue(wLen) \
/* Update the mirrored queue pointer if it doesn't indicate enough space */ \
@@ -431,6 +437,4 @@ void WaitingFor3dIdle(sisContextPtr smesa, int wLen);
extern void sis_update_texture_state( sisContextPtr smesa );
extern void sis_update_render_state( sisContextPtr smesa );
-void sis_fatal_error (void);
-
#endif
diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c
index 2c97d270fda..1cfca69af21 100644
--- a/src/mesa/drivers/dri/sis/sis_dd.c
+++ b/src/mesa/drivers/dri/sis/sis_dd.c
@@ -146,7 +146,7 @@ sisUpdateBufferSize( sisContextPtr smesa )
z_depth = 4;
break;
default:
- assert( 0 );
+ sis_fatal_error("Bad Z format\n");
}
current->hwZ &= ~MASK_ZBufferPitch;
diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c
index 1342d539223..fd2bc26d31c 100644
--- a/src/mesa/drivers/dri/sis/sis_span.c
+++ b/src/mesa/drivers/dri/sis/sis_span.c
@@ -294,7 +294,7 @@ sisDDInitSpanFuncs( GLcontext *ctx )
swdd->ReadRGBAPixels = sisReadRGBAPixels_8888;
break;
default:
- assert(0);
+ sis_fatal_error("Bad bytesPerPixel.\n");
break;
}
diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c
index e100e8e6a63..5fa8256f1ba 100644
--- a/src/mesa/drivers/dri/sis/sis_tex.c
+++ b/src/mesa/drivers/dri/sis/sis_tex.c
@@ -85,7 +85,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
t->hwformat = TEXEL_ARGB_0888_32;
break;
default:
- assert(0);
+ sis_fatal_error("Bad texture format.\n");
}
}
assert(t->format == image->Format);
@@ -96,10 +96,8 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
addr = sisAllocFB( smesa, size, &t->image[level].handle );
if (addr == NULL) {
addr = sisAllocAGP( smesa, size, &t->image[level].handle );
- if (addr == NULL) {
- fprintf (stderr, "SIS driver : out of video/agp memory\n");
- sis_fatal_error();
- }
+ if (addr == NULL)
+ sis_fatal_error("Failure to allocate texture memory.\n");
t->image[level].memType = AGP_TYPE;
}
else