summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-11-09 07:02:27 +0000
committerJosé Fonseca <[email protected]>2011-11-29 17:34:30 +0000
commit57f8e26ca87a2846f192682c84eccbf8b4500bfc (patch)
treebc0ff646a7a9dba4006d85610f86118bdf58bb3d /src/gallium/auxiliary/util
parent23a8a7fe8c799ed9040a03ef8e9e058686c00206 (diff)
gallium/auxiliary: Remove os_stream.
XP kernel mode was the only subsystem lacking stdio FILES. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_debug.c14
-rw-r--r--src/gallium/auxiliary/util/u_debug_refcnt.c22
-rw-r--r--src/gallium/auxiliary/util/u_dump.h48
-rw-r--r--src/gallium/auxiliary/util/u_dump_state.c103
4 files changed, 91 insertions, 96 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 2d6193039a7..b3a30adadb0 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -30,7 +30,6 @@
#include "pipe/p_config.h"
#include "pipe/p_compiler.h"
-#include "os/os_stream.h"
#include "util/u_debug.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
@@ -43,6 +42,7 @@
#include "util/u_prim.h"
#include "util/u_surface.h"
+#include <stdio.h>
#include <limits.h> /* CHAR_BIT */
#include <ctype.h> /* isalnum */
@@ -688,7 +688,7 @@ debug_dump_float_rgba_bmp(const char *filename,
float *rgba, unsigned stride)
{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
- struct os_stream *stream;
+ FILE *stream;
struct bmp_file_header bmfh;
struct bmp_info_header bmih;
unsigned x, y;
@@ -714,12 +714,12 @@ debug_dump_float_rgba_bmp(const char *filename,
bmih.biClrUsed = 0;
bmih.biClrImportant = 0;
- stream = os_file_stream_create(filename);
+ stream = fopen(filename, "wb");
if(!stream)
goto error1;
- os_stream_write(stream, &bmfh, 14);
- os_stream_write(stream, &bmih, 40);
+ fwrite(&bmfh, 14, 1, stream);
+ fwrite(&bmih, 40, 1, stream);
y = height;
while(y--) {
@@ -731,11 +731,11 @@ debug_dump_float_rgba_bmp(const char *filename,
pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]);
pixel.rgbBlue = float_to_ubyte(ptr[x*4 + 2]);
pixel.rgbAlpha = float_to_ubyte(ptr[x*4 + 3]);
- os_stream_write(stream, &pixel, 4);
+ fwrite(&pixel, 1, 4, stream);
}
}
- os_stream_close(stream);
+ fclose(stream);
error1:
;
#endif
diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c
index b3e38940850..2679932008d 100644
--- a/src/gallium/auxiliary/util/u_debug_refcnt.c
+++ b/src/gallium/auxiliary/util/u_debug_refcnt.c
@@ -29,6 +29,9 @@
/* see http://www.mozilla.org/performance/refcnt-balancer.html for what do with the output
* on Linux, use tools/addr2line.sh to postprocess it before anything else
**/
+
+#include <stdio.h>
+
#include "util/u_debug.h"
#include "util/u_debug_refcnt.h"
#include "util/u_debug_stack.h"
@@ -36,11 +39,10 @@
#include "util/u_string.h"
#include "util/u_hash_table.h"
#include "os/os_thread.h"
-#include "os/os_stream.h"
int debug_refcnt_state;
-struct os_stream* stream;
+FILE* stream;
/* TODO: maybe move this serial machinery to a stand-alone module and expose it? */
pipe_static_mutex(serials_mutex);
@@ -115,9 +117,9 @@ static void dump_stack(const char* symbols[STACK_LEN])
for(i = 0; i < STACK_LEN; ++i)
{
if(symbols[i])
- os_stream_printf(stream, "%s\n", symbols[i]);
+ fprintf(stream, "%s\n", symbols[i]);
}
- os_stream_write(stream, "\n", 1);
+ fprintf(stream, "\n");
}
void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change)
@@ -129,7 +131,7 @@ void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_de
{
const char* filename = debug_get_option("GALLIUM_REFCNT_LOG", NULL);
if(filename && filename[0])
- stream = os_file_stream_create(filename);
+ stream = fopen(filename, "wt");
if(stream)
debug_refcnt_state = 1;
@@ -161,31 +163,31 @@ void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_de
if(!existing)
{
- os_stream_printf(stream, "<%s> %p %u Create\n", buf, p, serial);
+ fprintf(stream, "<%s> %p %u Create\n", buf, p, serial);
dump_stack(symbols);
/* this is there to provide a gradual change even if we don't see the initialization */
for(i = 1; i <= refcnt - change; ++i)
{
- os_stream_printf(stream, "<%s> %p %u AddRef %u\n", buf, p, serial, i);
+ fprintf(stream, "<%s> %p %u AddRef %u\n", buf, p, serial, i);
dump_stack(symbols);
}
}
if(change)
{
- os_stream_printf(stream, "<%s> %p %u %s %u\n", buf, p, serial, change > 0 ? "AddRef" : "Release", refcnt);
+ fprintf(stream, "<%s> %p %u %s %u\n", buf, p, serial, change > 0 ? "AddRef" : "Release", refcnt);
dump_stack(symbols);
}
if(!refcnt)
{
debug_serial_delete((void*)p);
- os_stream_printf(stream, "<%s> %p %u Destroy\n", buf, p, serial);
+ fprintf(stream, "<%s> %p %u Destroy\n", buf, p, serial);
dump_stack(symbols);
}
- os_stream_flush(stream);
+ fflush(stream);
}
}
#endif
diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h
index 49536c0d593..3890b3bddca 100644
--- a/src/gallium/auxiliary/util/u_dump.h
+++ b/src/gallium/auxiliary/util/u_dump.h
@@ -39,6 +39,8 @@
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
+#include <stdio.h>
+
#ifdef __cplusplus
extern "C" {
@@ -48,14 +50,6 @@ extern "C" {
#define UTIL_DUMP_INVALID_NAME "<invalid>"
-struct os_stream;
-
-
-/* Duplicated here for convenience */
-extern struct os_stream *
-os_log_stream;
-
-
/*
* p_defines.h
*
@@ -93,79 +87,79 @@ util_dump_tex_filter(unsigned value, boolean shortened);
/*
- * p_state.h, through an os_stream
+ * p_state.h, through a FILE
*/
void
-util_dump_template(struct os_stream *stream,
+util_dump_template(FILE *stream,
const struct pipe_resource *templat);
void
-util_dump_rasterizer_state(struct os_stream *stream,
+util_dump_rasterizer_state(FILE *stream,
const struct pipe_rasterizer_state *state);
void
-util_dump_poly_stipple(struct os_stream *stream,
+util_dump_poly_stipple(FILE *stream,
const struct pipe_poly_stipple *state);
void
-util_dump_viewport_state(struct os_stream *stream,
+util_dump_viewport_state(FILE *stream,
const struct pipe_viewport_state *state);
void
-util_dump_scissor_state(struct os_stream *stream,
+util_dump_scissor_state(FILE *stream,
const struct pipe_scissor_state *state);
void
-util_dump_clip_state(struct os_stream *stream,
+util_dump_clip_state(FILE *stream,
const struct pipe_clip_state *state);
void
-util_dump_shader_state(struct os_stream *stream,
+util_dump_shader_state(FILE *stream,
const struct pipe_shader_state *state);
void
-util_dump_depth_stencil_alpha_state(struct os_stream *stream,
+util_dump_depth_stencil_alpha_state(FILE *stream,
const struct pipe_depth_stencil_alpha_state *state);
void
-util_dump_rt_blend_state(struct os_stream *stream,
+util_dump_rt_blend_state(FILE *stream,
const struct pipe_rt_blend_state *state);
void
-util_dump_blend_state(struct os_stream *stream,
+util_dump_blend_state(FILE *stream,
const struct pipe_blend_state *state);
void
-util_dump_blend_color(struct os_stream *stream,
+util_dump_blend_color(FILE *stream,
const struct pipe_blend_color *state);
void
-util_dump_stencil_ref(struct os_stream *stream,
+util_dump_stencil_ref(FILE *stream,
const struct pipe_stencil_ref *state);
void
-util_dump_framebuffer_state(struct os_stream *stream,
+util_dump_framebuffer_state(FILE *stream,
const struct pipe_framebuffer_state *state);
void
-util_dump_sampler_state(struct os_stream *stream,
+util_dump_sampler_state(FILE *stream,
const struct pipe_sampler_state *state);
void
-util_dump_surface(struct os_stream *stream,
+util_dump_surface(FILE *stream,
const struct pipe_surface *state);
void
-util_dump_transfer(struct os_stream *stream,
+util_dump_transfer(FILE *stream,
const struct pipe_transfer *state);
void
-util_dump_vertex_buffer(struct os_stream *stream,
+util_dump_vertex_buffer(FILE *stream,
const struct pipe_vertex_buffer *state);
void
-util_dump_vertex_element(struct os_stream *stream,
+util_dump_vertex_element(FILE *stream,
const struct pipe_vertex_element *state);
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 8a7ec584846..917d7cd359b 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -27,7 +27,6 @@
#include "pipe/p_compiler.h"
-#include "os/os_stream.h"
#include "util/u_memory.h"
#include "util/u_string.h"
#include "util/u_format.h"
@@ -41,7 +40,7 @@
*/
static INLINE void
-util_stream_writef(struct os_stream *stream, const char *format, ...)
+util_stream_writef(FILE *stream, const char *format, ...)
{
static char buf[1024];
unsigned len;
@@ -49,102 +48,102 @@ util_stream_writef(struct os_stream *stream, const char *format, ...)
va_start(ap, format);
len = util_vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
- os_stream_write(stream, buf, len);
+ fwrite(buf, len, 1, stream);
}
static void
-util_dump_bool(struct os_stream *stream, int value)
+util_dump_bool(FILE *stream, int value)
{
util_stream_writef(stream, "%c", value ? '1' : '0');
}
static void
-util_dump_int(struct os_stream *stream, long long int value)
+util_dump_int(FILE *stream, long long int value)
{
util_stream_writef(stream, "%lli", value);
}
static void
-util_dump_uint(struct os_stream *stream, long long unsigned value)
+util_dump_uint(FILE *stream, long long unsigned value)
{
util_stream_writef(stream, "%llu", value);
}
static void
-util_dump_float(struct os_stream *stream, double value)
+util_dump_float(FILE *stream, double value)
{
util_stream_writef(stream, "%g", value);
}
static void
-util_dump_string(struct os_stream *stream, const char *str)
+util_dump_string(FILE *stream, const char *str)
{
- os_stream_write_str(stream, "\"");
- os_stream_write_str(stream, str);
- os_stream_write_str(stream, "\"");
+ fputs("\"", stream);
+ fputs(str, stream);
+ fputs("\"", stream);
}
static void
-util_dump_enum(struct os_stream *stream, const char *value)
+util_dump_enum(FILE *stream, const char *value)
{
- os_stream_write_str(stream, value);
+ fputs(value, stream);
}
static void
-util_dump_array_begin(struct os_stream *stream)
+util_dump_array_begin(FILE *stream)
{
- os_stream_write_str(stream, "{");
+ fputs("{", stream);
}
static void
-util_dump_array_end(struct os_stream *stream)
+util_dump_array_end(FILE *stream)
{
- os_stream_write_str(stream, "}");
+ fputs("}", stream);
}
static void
-util_dump_elem_begin(struct os_stream *stream)
+util_dump_elem_begin(FILE *stream)
{
}
static void
-util_dump_elem_end(struct os_stream *stream)
+util_dump_elem_end(FILE *stream)
{
- os_stream_write_str(stream, ", ");
+ fputs(", ", stream);
}
static void
-util_dump_struct_begin(struct os_stream *stream, const char *name)
+util_dump_struct_begin(FILE *stream, const char *name)
{
- os_stream_write_str(stream, "{");
+ fputs("{", stream);
}
static void
-util_dump_struct_end(struct os_stream *stream)
+util_dump_struct_end(FILE *stream)
{
- os_stream_write_str(stream, "}");
+ fputs("}", stream);
}
static void
-util_dump_member_begin(struct os_stream *stream, const char *name)
+util_dump_member_begin(FILE *stream, const char *name)
{
util_stream_writef(stream, "%s = ", name);
}
static void
-util_dump_member_end(struct os_stream *stream)
+util_dump_member_end(FILE *stream)
{
- os_stream_write_str(stream, ", ");
+ fputs(", ", stream);
}
static void
-util_dump_null(struct os_stream *stream)
+util_dump_null(FILE *stream)
{
- os_stream_write_str(stream, "NULL");
+ fputs("NULL", stream);
}
static void
-util_dump_ptr(struct os_stream *stream, const void *value)
+util_dump_ptr(FILE *stream, const void *value)
{
if(value)
util_stream_writef(stream, "0x%08lx", (unsigned long)(uintptr_t)value);
@@ -224,26 +223,26 @@ util_dump_ptr(struct os_stream *stream, const void *value)
static void
-util_dump_format(struct os_stream *stream, enum pipe_format format)
+util_dump_format(FILE *stream, enum pipe_format format)
{
util_dump_enum(stream, util_format_name(format));
}
static void
-util_dump_enum_blend_factor(struct os_stream *stream, unsigned value)
+util_dump_enum_blend_factor(FILE *stream, unsigned value)
{
util_dump_enum(stream, util_dump_blend_factor(value, TRUE));
}
static void
-util_dump_enum_blend_func(struct os_stream *stream, unsigned value)
+util_dump_enum_blend_func(FILE *stream, unsigned value)
{
util_dump_enum(stream, util_dump_blend_func(value, TRUE));
}
static void
-util_dump_enum_func(struct os_stream *stream, unsigned value)
+util_dump_enum_func(FILE *stream, unsigned value)
{
util_dump_enum(stream, util_dump_func(value, TRUE));
}
@@ -255,7 +254,7 @@ util_dump_enum_func(struct os_stream *stream, unsigned value)
void
-util_dump_template(struct os_stream *stream, const struct pipe_resource *templat)
+util_dump_template(FILE *stream, const struct pipe_resource *templat)
{
if(!templat) {
util_dump_null(stream);
@@ -293,7 +292,7 @@ util_dump_template(struct os_stream *stream, const struct pipe_resource *templat
void
-util_dump_rasterizer_state(struct os_stream *stream, const struct pipe_rasterizer_state *state)
+util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *state)
{
if(!state) {
util_dump_null(stream);
@@ -339,7 +338,7 @@ util_dump_rasterizer_state(struct os_stream *stream, const struct pipe_rasterize
void
-util_dump_poly_stipple(struct os_stream *stream, const struct pipe_poly_stipple *state)
+util_dump_poly_stipple(FILE *stream, const struct pipe_poly_stipple *state)
{
if(!state) {
util_dump_null(stream);
@@ -357,7 +356,7 @@ util_dump_poly_stipple(struct os_stream *stream, const struct pipe_poly_stipple
void
-util_dump_viewport_state(struct os_stream *stream, const struct pipe_viewport_state *state)
+util_dump_viewport_state(FILE *stream, const struct pipe_viewport_state *state)
{
if(!state) {
util_dump_null(stream);
@@ -374,7 +373,7 @@ util_dump_viewport_state(struct os_stream *stream, const struct pipe_viewport_st
void
-util_dump_scissor_state(struct os_stream *stream, const struct pipe_scissor_state *state)
+util_dump_scissor_state(FILE *stream, const struct pipe_scissor_state *state)
{
if(!state) {
util_dump_null(stream);
@@ -393,7 +392,7 @@ util_dump_scissor_state(struct os_stream *stream, const struct pipe_scissor_stat
void
-util_dump_clip_state(struct os_stream *stream, const struct pipe_clip_state *state)
+util_dump_clip_state(FILE *stream, const struct pipe_clip_state *state)
{
unsigned i;
@@ -421,7 +420,7 @@ util_dump_clip_state(struct os_stream *stream, const struct pipe_clip_state *sta
void
-util_dump_shader_state(struct os_stream *stream, const struct pipe_shader_state *state)
+util_dump_shader_state(FILE *stream, const struct pipe_shader_state *state)
{
char str[8192];
@@ -443,7 +442,7 @@ util_dump_shader_state(struct os_stream *stream, const struct pipe_shader_state
void
-util_dump_depth_stencil_alpha_state(struct os_stream *stream, const struct pipe_depth_stencil_alpha_state *state)
+util_dump_depth_stencil_alpha_state(FILE *stream, const struct pipe_depth_stencil_alpha_state *state)
{
unsigned i;
@@ -498,7 +497,7 @@ util_dump_depth_stencil_alpha_state(struct os_stream *stream, const struct pipe_
}
void
-util_dump_rt_blend_state(struct os_stream *stream, const struct pipe_rt_blend_state *state)
+util_dump_rt_blend_state(FILE *stream, const struct pipe_rt_blend_state *state)
{
util_dump_struct_begin(stream, "pipe_rt_blend_state");
@@ -519,7 +518,7 @@ util_dump_rt_blend_state(struct os_stream *stream, const struct pipe_rt_blend_st
}
void
-util_dump_blend_state(struct os_stream *stream, const struct pipe_blend_state *state)
+util_dump_blend_state(FILE *stream, const struct pipe_blend_state *state)
{
unsigned valid_entries = 1;
@@ -551,7 +550,7 @@ util_dump_blend_state(struct os_stream *stream, const struct pipe_blend_state *s
void
-util_dump_blend_color(struct os_stream *stream, const struct pipe_blend_color *state)
+util_dump_blend_color(FILE *stream, const struct pipe_blend_color *state)
{
if(!state) {
util_dump_null(stream);
@@ -566,7 +565,7 @@ util_dump_blend_color(struct os_stream *stream, const struct pipe_blend_color *s
}
void
-util_dump_stencil_ref(struct os_stream *stream, const struct pipe_stencil_ref *state)
+util_dump_stencil_ref(FILE *stream, const struct pipe_stencil_ref *state)
{
if(!state) {
util_dump_null(stream);
@@ -581,7 +580,7 @@ util_dump_stencil_ref(struct os_stream *stream, const struct pipe_stencil_ref *s
}
void
-util_dump_framebuffer_state(struct os_stream *stream, const struct pipe_framebuffer_state *state)
+util_dump_framebuffer_state(FILE *stream, const struct pipe_framebuffer_state *state)
{
util_dump_struct_begin(stream, "pipe_framebuffer_state");
@@ -596,7 +595,7 @@ util_dump_framebuffer_state(struct os_stream *stream, const struct pipe_framebuf
void
-util_dump_sampler_state(struct os_stream *stream, const struct pipe_sampler_state *state)
+util_dump_sampler_state(FILE *stream, const struct pipe_sampler_state *state)
{
if(!state) {
util_dump_null(stream);
@@ -625,7 +624,7 @@ util_dump_sampler_state(struct os_stream *stream, const struct pipe_sampler_stat
void
-util_dump_surface(struct os_stream *stream, const struct pipe_surface *state)
+util_dump_surface(FILE *stream, const struct pipe_surface *state)
{
if(!state) {
util_dump_null(stream);
@@ -650,7 +649,7 @@ util_dump_surface(struct os_stream *stream, const struct pipe_surface *state)
void
-util_dump_transfer(struct os_stream *stream, const struct pipe_transfer *state)
+util_dump_transfer(FILE *stream, const struct pipe_transfer *state)
{
if(!state) {
util_dump_null(stream);
@@ -672,7 +671,7 @@ util_dump_transfer(struct os_stream *stream, const struct pipe_transfer *state)
void
-util_dump_vertex_buffer(struct os_stream *stream, const struct pipe_vertex_buffer *state)
+util_dump_vertex_buffer(FILE *stream, const struct pipe_vertex_buffer *state)
{
if(!state) {
util_dump_null(stream);
@@ -690,7 +689,7 @@ util_dump_vertex_buffer(struct os_stream *stream, const struct pipe_vertex_buffe
void
-util_dump_vertex_element(struct os_stream *stream, const struct pipe_vertex_element *state)
+util_dump_vertex_element(FILE *stream, const struct pipe_vertex_element *state)
{
if(!state) {
util_dump_null(stream);