diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_bufmgr.h | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 16 | ||||
-rw-r--r-- | src/gallium/auxiliary/rtasm/rtasm_execmem.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_dump.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_sanity.c | 30 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_debug_memory.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_draw_quad.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_stream_stdc.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_time.c | 12 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_time.h | 6 |
11 files changed, 61 insertions, 40 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 556f26c0f0f..533c0a15f39 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -36,7 +36,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include <unistd.h> #include <sched.h> #endif @@ -559,7 +559,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) /* Wait on outstanding fences */ while (fenced_list->numDelayed) { pipe_mutex_unlock(fenced_list->mutex); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) sched_yield(); #endif _fenced_buffer_list_check_free(fenced_list, 1); diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h index fec8db91c71..74077f82774 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h @@ -200,10 +200,11 @@ pb_ondemand_manager_create(struct pb_manager *provider); /** * Debug buffer manager to detect buffer under- and overflows. * - * Band size should be a multiple of the largest alignment + * Under/overflow sizes should be a multiple of the largest alignment */ struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size); +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size); #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 070bf3f5173..21079b8bfd7 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -78,7 +78,8 @@ struct pb_debug_manager struct pb_manager *provider; - size_t band_size; + size_t underflow_size; + size_t overflow_size; }; @@ -301,7 +302,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, if(!buf) return NULL; - real_size = size + 2*mgr->band_size; + real_size = mgr->underflow_size + size + mgr->overflow_size; real_desc = *desc; real_desc.usage |= PIPE_BUFFER_USAGE_CPU_WRITE; real_desc.usage |= PIPE_BUFFER_USAGE_CPU_READ; @@ -327,7 +328,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, buf->base.vtbl = &pb_debug_buffer_vtbl; buf->mgr = mgr; - buf->underflow_size = mgr->band_size; + buf->underflow_size = mgr->underflow_size; buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size; pb_debug_buffer_fill(buf); @@ -356,7 +357,8 @@ pb_debug_manager_destroy(struct pb_manager *_mgr) struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size) +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size) { struct pb_debug_manager *mgr; @@ -371,7 +373,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size) mgr->base.create_buffer = pb_debug_manager_create_buffer; mgr->base.flush = pb_debug_manager_flush; mgr->provider = provider; - mgr->band_size = band_size; + mgr->underflow_size = underflow_size; + mgr->overflow_size = overflow_size; return &mgr->base; } @@ -381,7 +384,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size) struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size) +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size) { return provider; } diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 5acc5bcb7b0..1f0923b6831 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -37,8 +37,12 @@ #include "rtasm_execmem.h" +#if defined(PIPE_OS_BSD) +#define MAP_ANONYMOUS MAP_ANON +#endif -#if defined(PIPE_OS_LINUX) + +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) /* @@ -114,7 +118,7 @@ rtasm_exec_free(void *addr) } -#else /* PIPE_OS_LINUX */ +#else /* PIPE_OS_LINUX || PIPE_OS_BSD */ /* * Just use regular memory. @@ -134,4 +138,4 @@ rtasm_exec_free(void *addr) } -#endif /* PIPE_OS_LINUX */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index d57cb9139f7..a784b7cc3c1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -245,8 +245,12 @@ iter_declaration( } } - TXT( ", " ); - ENM( decl->Declaration.Interpolate, interpolate_names ); + if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT && + decl->Declaration.File == TGSI_FILE_INPUT) + { + TXT( ", " ); + ENM( decl->Declaration.Interpolate, interpolate_names ); + } if (decl->Declaration.Centroid) { TXT( ", CENTROID" ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 76e773da91c..6f1f5c2b4b0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -30,18 +30,19 @@ #include "tgsi_info.h" #include "tgsi_iterate.h" -#define MAX_REGISTERS 256 - typedef uint reg_flag; #define BITS_IN_REG_FLAG (sizeof( reg_flag ) * 8) +#define MAX_REGISTERS 256 +#define MAX_REG_FLAGS ((MAX_REGISTERS + BITS_IN_REG_FLAG - 1) / BITS_IN_REG_FLAG) + struct sanity_check_ctx { struct tgsi_iterate_context iter; - reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG]; - reg_flag regs_used[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG]; + reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REG_FLAGS]; + reg_flag regs_used[TGSI_FILE_COUNT][MAX_REG_FLAGS]; boolean regs_ind_used[TGSI_FILE_COUNT]; uint num_imms; uint num_instructions; @@ -89,7 +90,7 @@ check_file_name( uint file ) { if (file <= TGSI_FILE_NULL || file >= TGSI_FILE_COUNT) { - report_error( ctx, "Invalid register file name" ); + report_error( ctx, "(%u): Invalid register file name", file ); return FALSE; } return TRUE; @@ -113,7 +114,7 @@ is_any_register_declared( { uint i; - for (i = 0; i < MAX_REGISTERS / BITS_IN_REG_FLAG; i++) + for (i = 0; i < MAX_REG_FLAGS; i++) if (ctx->regs_decl[file][i]) return TRUE; return FALSE; @@ -162,9 +163,8 @@ check_register_usage( ctx->regs_ind_used[file] = TRUE; } else { - if (index < 0 || index > MAX_REGISTERS) { - report_error( ctx, "%s[%i]: Invalid index %s", - file_names[file], index, name ); + if (index < 0 || index >= MAX_REGISTERS) { + report_error( ctx, "%s[%d]: Invalid %s index", file_names[file], index, name ); return FALSE; } @@ -193,15 +193,15 @@ iter_instruction( info = tgsi_get_opcode_info( inst->Instruction.Opcode ); if (info == NULL) { - report_error( ctx, "Invalid instruction opcode" ); + report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode ); return TRUE; } if (info->num_dst != inst->Instruction.NumDstRegs) { - report_error( ctx, "Invalid number of destination operands" ); + report_error( ctx, "Invalid number of destination operands, should be %u", info->num_dst ); } if (info->num_src != inst->Instruction.NumSrcRegs) { - report_error( ctx, "Invalid number of source operands" ); + report_error( ctx, "Invalid number of source operands, should be %u", info->num_src ); } /* Check destination and source registers' validity. @@ -266,7 +266,7 @@ iter_declaration( return TRUE; for (i = decl->DeclarationRange.First; i <= decl->DeclarationRange.Last; i++) { if (is_register_declared( ctx, file, i )) - report_error( ctx, "The same register declared twice" ); + report_error( ctx, "%s[%u]: The same register declared more than once", file_names[file], i ); ctx->regs_decl[file][i / BITS_IN_REG_FLAG] |= (1 << (i % BITS_IN_REG_FLAG)); } @@ -295,7 +295,7 @@ iter_immediate( /* Check data type validity. */ if (imm->Immediate.DataType != TGSI_IMM_FLOAT32) { - report_error( ctx, "Invalid immediate data type" ); + report_error( ctx, "(%u): Invalid immediate data type", imm->Immediate.DataType ); return TRUE; } @@ -322,7 +322,7 @@ epilog( for (i = 0; i < MAX_REGISTERS; i++) { if (is_register_declared( ctx, file, i ) && !is_register_used( ctx, file, i ) && !ctx->regs_ind_used[file]) { - report_warning( ctx, "Register never used" ); + report_warning( ctx, "%s[%u]: Register never used", file_names[file], i ); } } } diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c index 758541c2829..7623cb93981 100644 --- a/src/gallium/auxiliary/util/u_debug_memory.c +++ b/src/gallium/auxiliary/util/u_debug_memory.c @@ -73,7 +73,9 @@ struct debug_memory_header const char *file; unsigned line; const char *function; +#if DEBUG_MEMORY_STACK struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK]; +#endif size_t size; unsigned magic; @@ -140,7 +142,9 @@ debug_malloc(const char *file, unsigned line, const char *function, hdr->size = size; hdr->magic = DEBUG_MEMORY_MAGIC; +#if DEBUG_MEMORY_STACK debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK); +#endif ftr = footer_from_header(hdr); ftr->magic = DEBUG_MEMORY_MAGIC; @@ -296,7 +300,9 @@ debug_memory_end(unsigned long start_no) debug_printf("%s:%u:%s: %u bytes at %p not freed\n", hdr->file, hdr->line, hdr->function, hdr->size, ptr); +#if DEBUG_MEMORY_STACK debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK); +#endif total_size += hdr->size; } diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c index f282f3d2891..f0bcd758999 100644 --- a/src/gallium/auxiliary/util/u_draw_quad.c +++ b/src/gallium/auxiliary/util/u_draw_quad.c @@ -51,9 +51,11 @@ util_draw_vertex_buffer(struct pipe_context *pipe, assert(num_attribs <= PIPE_MAX_ATTRIBS); /* tell pipe about the vertex buffer */ + memset(&vbuffer, 0, sizeof(vbuffer)); vbuffer.buffer = vbuf; vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */ vbuffer.buffer_offset = offset; + vbuffer.max_index = num_verts - 1; pipe->set_vertex_buffers(pipe, 1, &vbuffer); /* tell pipe about the vertex attributes */ diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c index ca80bef0f3d..0ead45a7491 100644 --- a/src/gallium/auxiliary/util/u_stream_stdc.c +++ b/src/gallium/auxiliary/util/u_stream_stdc.c @@ -32,7 +32,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) #include <stdio.h> diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c index dde2c74fa83..357d9360c90 100644 --- a/src/gallium/auxiliary/util/u_time.c +++ b/src/gallium/auxiliary/util/u_time.c @@ -35,7 +35,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include <sys/time.h> #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) #include <windows.h> @@ -77,7 +77,7 @@ util_time_get_frequency(void) void util_time_get(struct util_time *t) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) gettimeofday(&t->tv, NULL); #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) LONGLONG temp; @@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1, int64_t usecs, struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000; t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -124,7 +124,7 @@ int64_t util_time_diff(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return (t2->tv.tv_usec - t1->tv.tv_usec) + (t2->tv.tv_sec - t1->tv.tv_sec)*1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -144,7 +144,7 @@ util_time_micros( void ) util_time_get(&t1); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) util_time_get_frequency(); @@ -166,7 +166,7 @@ static INLINE int util_time_compare(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (t1->tv.tv_sec < t2->tv.tv_sec) return -1; else if(t1->tv.tv_sec > t2->tv.tv_sec) diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h index 35d97d16c73..4346ce1fa45 100644 --- a/src/gallium/auxiliary/util/u_time.h +++ b/src/gallium/auxiliary/util/u_time.h @@ -38,7 +38,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include <time.h> /* timeval */ #include <unistd.h> /* usleep */ #endif @@ -58,7 +58,7 @@ extern "C" { */ struct util_time { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) struct timeval tv; #else int64_t counter; @@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start, const struct util_time *end, const struct util_time *curr); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #define util_time_sleep usleep #else void |