diff options
Diffstat (limited to 'mesalib')
-rw-r--r-- | mesalib/configs/current.in | 1 | ||||
-rw-r--r-- | mesalib/configure.ac | 9 | ||||
-rw-r--r-- | mesalib/scons/gallium.py | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/Makefile | 6 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_cache.c | 8 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.c | 56 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug.h | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_draw.c | 11 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_surface.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/renderbuffer.c | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/syncobj.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/program/Android.mk | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_fbo.c | 8 |
15 files changed, 79 insertions, 65 deletions
diff --git a/mesalib/configs/current.in b/mesalib/configs/current.in index 62edfa5da..dc8e63f43 100644 --- a/mesalib/configs/current.in +++ b/mesalib/configs/current.in @@ -41,6 +41,7 @@ GLX_TLS = @GLX_TLS@ # dlopen DLOPEN_LIBS = @DLOPEN_LIBS@ +CLOCK_LIB = @CLOCK_LIB@ # Source selection MESA_ASM_FILES = @MESA_ASM_FILES@ diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 803c25649..a133902c6 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -535,6 +535,11 @@ AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"], [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])]) AC_SUBST([DLOPEN_LIBS]) +AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=], + [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt], + [AC_MSG_ERROR([Couldn't find clock_gettime])])]) +AC_SUBST([CLOCK_LIB]) + dnl See if posix_memalign is available AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) @@ -1121,7 +1126,7 @@ if test "x$enable_dri" = xyes; then # put all the necessary libs together DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS" - GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS" + GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS" fi AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS") AC_SUBST([DRI_DIRS]) @@ -1390,7 +1395,7 @@ if test "x$enable_openvg" = xyes; then CORE_DIRS="$CORE_DIRS mapi/vgapi" GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS" HAVE_ST_VEGA=yes - VG_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS" + VG_PC_LIB_PRIV="-lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS" AC_SUBST([VG_PC_LIB_PRIV]) fi diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py index e9496a8d5..66ccaea73 100644 --- a/mesalib/scons/gallium.py +++ b/mesalib/scons/gallium.py @@ -500,6 +500,8 @@ def generate(env): libs = [] if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'): libs += ['m', 'pthread', 'dl'] + if env['platform'] in 'linux': + libs += ['rt'] env.Append(LIBS = libs) # OpenMP diff --git a/mesalib/src/gallium/auxiliary/Makefile b/mesalib/src/gallium/auxiliary/Makefile index dc2800337..72208f1a7 100644 --- a/mesalib/src/gallium/auxiliary/Makefile +++ b/mesalib/src/gallium/auxiliary/Makefile @@ -13,7 +13,11 @@ C_SOURCES += \ $(GALLIVM_SOURCES) CPP_SOURCES += \ $(GALLIVM_CPP_SOURCES) -CXXFLAGS += $(LLVM_CXXFLAGS) + +# LLVM >= 3.2 requires -fno-rtti +ifeq ($(shell expr `echo $(LLVM_VERSION) | sed -e 's/\([0-9]\)\.\([0-9]\)/\10\2/g'` \>= 302),1) +CXXFLAGS += -fno-rtti +endif endif diff --git a/mesalib/src/gallium/auxiliary/util/u_cache.c b/mesalib/src/gallium/auxiliary/util/u_cache.c index df08ec302..26aab2bf1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cache.c +++ b/mesalib/src/gallium/auxiliary/util/u_cache.c @@ -183,12 +183,12 @@ util_cache_set(struct util_cache *cache, void *value) { struct util_cache_entry *entry; - uint32_t hash = cache->hash(key); + uint32_t hash; assert(cache); if (!cache) return; - + hash = cache->hash(key); entry = util_cache_entry_get(cache, hash, key); if (!entry) entry = cache->lru.prev; @@ -218,12 +218,12 @@ util_cache_get(struct util_cache *cache, const void *key) { struct util_cache_entry *entry; - uint32_t hash = cache->hash(key); + uint32_t hash; assert(cache); if (!cache) return NULL; - + hash = cache->hash(key); entry = util_cache_entry_get(cache, hash, key); if (!entry) return NULL; diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.c b/mesalib/src/gallium/auxiliary/util/u_debug.c index b26192a8b..ee97b7adb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug.c @@ -436,7 +436,7 @@ void debug_funclog_enter_exit(const char* f, const int line, const char* file) #ifdef DEBUG /** - * Dump an image to a .raw or .ppm file (depends on OS). + * Dump an image to .ppm file. * \param format PIPE_FORMAT_x * \param cpp bytes per pixel * \param width width in pixels @@ -444,56 +444,48 @@ void debug_funclog_enter_exit(const char* f, const int line, const char* file) * \param stride row stride in bytes */ void debug_dump_image(const char *prefix, - unsigned format, unsigned cpp, + enum pipe_format format, unsigned cpp, unsigned width, unsigned height, unsigned stride, const void *data) { /* write a ppm file */ char filename[256]; + unsigned char *rgb8; FILE *f; util_snprintf(filename, sizeof(filename), "%s.ppm", prefix); - f = fopen(filename, "w"); - if (f) { - int i, x, y; - int r, g, b; - const uint8_t *ptr = (uint8_t *) data; - - /* XXX this is a hack */ - switch (format) { - case PIPE_FORMAT_B8G8R8A8_UNORM: - r = 2; - g = 1; - b = 0; - break; - default: - r = 0; - g = 1; - b = 1; - } + rgb8 = MALLOC(height * width * 3); + if (!rgb8) { + return; + } + + util_format_translate( + PIPE_FORMAT_R8G8B8_UNORM, + rgb8, width * 3, + 0, 0, + format, + data, stride, + 0, 0, width, height); + /* Must be opened in binary mode or DOS line ending causes data + * to be read with one byte offset. + */ + f = fopen(filename, "wb"); + if (f) { fprintf(f, "P6\n"); - fprintf(f, "# ppm-file created by osdemo.c\n"); + fprintf(f, "# ppm-file created by gallium\n"); fprintf(f, "%i %i\n", width, height); fprintf(f, "255\n"); - fclose(f); - - f = fopen(filename, "ab"); /* reopen in binary append mode */ - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - i = y * stride + x * cpp; - fputc(ptr[i + r], f); /* write red */ - fputc(ptr[i + g], f); /* write green */ - fputc(ptr[i + b], f); /* write blue */ - } - } + fwrite(rgb8, 1, height * width * 3, f); fclose(f); } else { fprintf(stderr, "Can't open %s for writing\n", filename); } + + FREE(rgb8); } /* FIXME: dump resources, not surfaces... */ diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h index 3b42c2f07..0eb744333 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug.h @@ -41,6 +41,8 @@ #include "os/os_misc.h" +#include "pipe/p_format.h" + #ifdef __cplusplus extern "C" { @@ -418,7 +420,7 @@ struct pipe_transfer; struct pipe_resource; void debug_dump_image(const char *prefix, - unsigned format, unsigned cpp, + enum pipe_format format, unsigned cpp, unsigned width, unsigned height, unsigned stride, const void *data); diff --git a/mesalib/src/gallium/auxiliary/util/u_draw.c b/mesalib/src/gallium/auxiliary/util/u_draw.c index 5b3c41231..83d9284b8 100644 --- a/mesalib/src/gallium/auxiliary/util/u_draw.c +++ b/mesalib/src/gallium/auxiliary/util/u_draw.c @@ -108,8 +108,15 @@ util_draw_max_index( else { /* Per-instance data. Simply make sure the state tracker didn't * request more instances than those that fit in the buffer */ - assert((info->start_instance + info->instance_count)/element->instance_divisor - <= (buffer_max_index + 1)); + if ((info->start_instance + info->instance_count)/element->instance_divisor + > (buffer_max_index + 1)) { + /* FIXME: We really should stop thinking in terms of maximum + * indices/instances and simply start clamping against buffer + * size. */ + debug_printf("%s: too many instances for vertex buffer\n", + __FUNCTION__); + return 0; + } } } } diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c index e99431ef8..5b42afd0d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_surface.c +++ b/mesalib/src/gallium/auxiliary/util/u_surface.c @@ -266,13 +266,14 @@ util_clear_depth_stencil(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { + enum pipe_format format = dst->format; struct pipe_transfer *dst_trans; ubyte *dst_map; boolean need_rmw = FALSE; if ((clear_flags & PIPE_CLEAR_DEPTHSTENCIL) && ((clear_flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) && - util_format_is_depth_and_stencil(dst->format)) + util_format_is_depth_and_stencil(format)) need_rmw = TRUE; assert(dst->texture); @@ -289,14 +290,14 @@ util_clear_depth_stencil(struct pipe_context *pipe, if (dst_map) { unsigned dst_stride = dst_trans->stride; - uint64_t zstencil = util_pack64_z_stencil(dst->texture->format, + uint64_t zstencil = util_pack64_z_stencil(format, depth, stencil); unsigned i, j; assert(dst_trans->stride > 0); - switch (util_format_get_blocksize(dst->format)) { + switch (util_format_get_blocksize(format)) { case 1: - assert(dst->format == PIPE_FORMAT_S8_UINT); + assert(format == PIPE_FORMAT_S8_UINT); if(dst_stride == width) memset(dst_map, (uint8_t) zstencil, height * width); else { @@ -307,7 +308,7 @@ util_clear_depth_stencil(struct pipe_context *pipe, } break; case 2: - assert(dst->format == PIPE_FORMAT_Z16_UNORM); + assert(format == PIPE_FORMAT_Z16_UNORM); for (i = 0; i < height; i++) { uint16_t *row = (uint16_t *)dst_map; for (j = 0; j < width; j++) @@ -326,10 +327,10 @@ util_clear_depth_stencil(struct pipe_context *pipe, } else { uint32_t dst_mask; - if (dst->format == PIPE_FORMAT_Z24_UNORM_S8_UINT) + if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT) dst_mask = 0xffffff00; else { - assert(dst->format == PIPE_FORMAT_S8_UINT_Z24_UNORM); + assert(format == PIPE_FORMAT_S8_UINT_Z24_UNORM); dst_mask = 0xffffff; } if (clear_flags & PIPE_CLEAR_DEPTH) diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 9e23a66d7..150d41e04 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -129,7 +129,7 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_compression", o(dummy_true), GLL, 2000 }, { "GL_ARB_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 }, { "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), GLL, 1999 }, - { "GL_ARB_texture_cube_map_array", o(ARB_texture_cube_map_array), GLL, 2009 }, + { "GL_ARB_texture_cube_map_array", o(ARB_texture_cube_map_array), GL, 2009 }, { "GL_ARB_texture_env_add", o(dummy_true), GLL, 1999 }, { "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GLL, 2001 }, { "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GLL, 2001 }, @@ -308,7 +308,7 @@ static const struct extension extension_table[] = { { "GL_NV_light_max_exponent", o(dummy_true), GLL, 1999 }, { "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2000 }, { "GL_NV_point_sprite", o(NV_point_sprite), GL, 2001 }, - { "GL_NV_primitive_restart", o(NV_primitive_restart), GL, 2002 }, + { "GL_NV_primitive_restart", o(NV_primitive_restart), GLL, 2002 }, { "GL_NV_read_buffer", o(dummy_true), ES2, 2011 }, { "GL_NV_texgen_reflection", o(dummy_true), GLL, 1999 }, { "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 }, diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 9eec61de6..ce77b9f77 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -920,7 +920,9 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer) /* ID was reserved, but no real renderbuffer object made yet */ newRb = NULL; } - else if (!newRb && ctx->Extensions.ARB_framebuffer_object) { + else if (!newRb + && _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_framebuffer_object) { /* All RB IDs must be Gen'd */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindRenderbuffer(buffer)"); return; @@ -1761,7 +1763,9 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer) /* ID was reserved, but no real framebuffer object made yet */ newDrawFb = NULL; } - else if (!newDrawFb && ctx->Extensions.ARB_framebuffer_object) { + else if (!newDrawFb + && _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_framebuffer_object) { /* All FBO IDs must be Gen'd */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(buffer)"); return; diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c index 2f2844329..b42616226 100644 --- a/mesalib/src/mesa/main/renderbuffer.c +++ b/mesalib/src/mesa/main/renderbuffer.c @@ -160,10 +160,7 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr, if (deleteFlag) { GET_CURRENT_CONTEXT(ctx); - if (ctx) - oldRb->Delete(ctx, oldRb); - else - _mesa_problem(NULL, "Unable to delete renderbuffer, no context"); + oldRb->Delete(ctx, oldRb); } *ptr = NULL; diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 847612c3b..598414596 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -55,6 +55,7 @@ * \author Ian Romanick <ian.d.romanick@intel.com> */ +#include <inttypes.h> #include "glheader.h" #include "imports.h" #include "context.h" @@ -357,7 +358,8 @@ _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) } if (timeout != GL_TIMEOUT_IGNORED) { - _mesa_error(ctx, GL_INVALID_VALUE, "glWaitSync(timeout=0x%lx)", timeout); + _mesa_error(ctx, GL_INVALID_VALUE, "glWaitSync(timeout=0x%" PRIx64 ")", + (uint64_t) timeout); return; } diff --git a/mesalib/src/mesa/program/Android.mk b/mesalib/src/mesa/program/Android.mk index 5eb043955..712506129 100644 --- a/mesalib/src/mesa/program/Android.mk +++ b/mesalib/src/mesa/program/Android.mk @@ -65,9 +65,6 @@ LOCAL_GENERATED_SOURCES := \ $(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y $(mesa_local-y-to-c-and-h) -$(intermediates)/program/program_parse.tab.h: $(LOCAL_PATH)/program_parse.y - $(mesa_local-y-to-c-and-h) - $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l $(local-l-to-c) diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 04907c9f7..ae280bfa9 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -228,10 +228,10 @@ static void st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); - struct st_context *st = st_context(ctx); - struct pipe_context *pipe = st->pipe; - - pipe_surface_release(pipe, &strb->surface); + if (ctx) { + struct st_context *st = st_context(ctx); + pipe_surface_release(st->pipe, &strb->surface); + } pipe_resource_reference(&strb->texture, NULL); free(strb->data); _mesa_delete_renderbuffer(ctx, rb); |