aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fontconfig/conf.d/11-lcdfilter-default.conf10
-rw-r--r--fontconfig/conf.d/11-lcdfilter-legacy.conf10
-rw-r--r--fontconfig/conf.d/11-lcdfilter-light.conf10
-rw-r--r--fontconfig/conf.d/Makefile.am3
-rw-r--r--fontconfig/fc-lang/Makefile.am4
-rw-r--r--fontconfig/fc-lang/brx.orth46
-rw-r--r--fontconfig/fc-lang/sat.orth44
-rw-r--r--fontconfig/src/fccfg.c10
-rw-r--r--fontconfig/src/ftglue.c3
-rw-r--r--libX11/nls/en_US.UTF-8/Compose.pre2
-rw-r--r--mesalib/include/GL/internal/dri_interface.h3
-rw-r--r--mesalib/scons/llvm.py14
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c21
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug_memory.c623
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h22
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_slab.c340
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml2
-rw-r--r--mesalib/src/mesa/main/enums.c7
-rw-r--r--mesalib/src/mesa/main/texstore.c26
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c18
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c21
-rw-r--r--mesalib/src/mesa/swrast/swrast.h4
-rw-r--r--pixman/pixman/pixman-mmx.c25
-rw-r--r--xorg-server/dix/events.c21
-rw-r--r--xorg-server/hw/xquartz/X11Application.m3
-rw-r--r--xorg-server/hw/xquartz/bundle/mk_bundke.sh62
27 files changed, 791 insertions, 572 deletions
diff --git a/fontconfig/conf.d/11-lcdfilter-default.conf b/fontconfig/conf.d/11-lcdfilter-default.conf
new file mode 100644
index 000000000..040a4ac83
--- /dev/null
+++ b/fontconfig/conf.d/11-lcdfilter-default.conf
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+<!-- Use lcddefault as default for LCD filter -->
+ <match target="font">
+ <edit mode="assign" name="lcdfilter">
+ <const>lcddefault</const>
+ </edit>
+ </match>
+</fontconfig>
diff --git a/fontconfig/conf.d/11-lcdfilter-legacy.conf b/fontconfig/conf.d/11-lcdfilter-legacy.conf
new file mode 100644
index 000000000..218585ce3
--- /dev/null
+++ b/fontconfig/conf.d/11-lcdfilter-legacy.conf
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+<!-- Use lcdlegacy as default for LCD filter -->
+ <match target="font">
+ <edit mode="assign" name="lcdfilter">
+ <const>lcdlegacy</const>
+ </edit>
+ </match>
+</fontconfig>
diff --git a/fontconfig/conf.d/11-lcdfilter-light.conf b/fontconfig/conf.d/11-lcdfilter-light.conf
new file mode 100644
index 000000000..d38a66ef0
--- /dev/null
+++ b/fontconfig/conf.d/11-lcdfilter-light.conf
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+<!-- Use lcdlight as default for LCD filter -->
+ <match target="font">
+ <edit mode="assign" name="lcdfilter">
+ <const>lcdlight</const>
+ </edit>
+ </match>
+</fontconfig>
diff --git a/fontconfig/conf.d/Makefile.am b/fontconfig/conf.d/Makefile.am
index 3f5255fad..d122a8ff0 100644
--- a/fontconfig/conf.d/Makefile.am
+++ b/fontconfig/conf.d/Makefile.am
@@ -32,6 +32,9 @@ CONF_FILES = \
10-sub-pixel-vbgr.conf \
10-sub-pixel-vrgb.conf \
10-unhinted.conf \
+ 11-lcdfilter-default.conf \
+ 11-lcdfilter-legacy.conf \
+ 11-lcdfilter-light.conf \
20-fix-globaladvance.conf \
20-unhint-small-vera.conf \
25-unhint-nonlatin.conf \
diff --git a/fontconfig/fc-lang/Makefile.am b/fontconfig/fc-lang/Makefile.am
index 628796054..8f53688a7 100644
--- a/fontconfig/fc-lang/Makefile.am
+++ b/fontconfig/fc-lang/Makefile.am
@@ -300,5 +300,7 @@ ORTH = \
wal.orth \
za.orth \
lah.orth \
- nqo.orth
+ nqo.orth \
+ brx.orth \
+ sat.orth
# ^-------------- Add new orth files here
diff --git a/fontconfig/fc-lang/brx.orth b/fontconfig/fc-lang/brx.orth
new file mode 100644
index 000000000..eab20462a
--- /dev/null
+++ b/fontconfig/fc-lang/brx.orth
@@ -0,0 +1,46 @@
+#
+# fontconfig/fc-lang/brx.orth
+#
+# Copyright © 2012 Parag Nemade
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of Keith Packard not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. Keith Packard makes no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# Bodo (Devanagari script) (brx)
+#
+# Source: Enhanced inscript: http://pune.cdac.in/html/gist/down/inscript_d.asp
+# Or
+# Source: http://malayalam.kerala.gov.in/images/8/80/Qwerty_enhancedinscriptkeyboardlayout.pdf Page No. 44
+#
+0901-0903 # Various Signs
+0905-090c # Independent vowels
+090f-0910 # Independent vowels
+0913-0914 # Independent vowels
+0915-0928 # Consonants
+092a-0930 # Consonants
+0932-0932 # Consonants
+0935-0939 # Consonants
+093c-0944 # Various and Dependent vowel signs
+0947-0948 # Dependent vowel signs
+094b-094d # Dependent vowel signs and virama
+0950-0952 # Sign and vedic tone marks
+0960-0963 # Additional vowels
+0964-0965 # Punctuations
+0966-096F # Digits
+0970 # Abbrevation sign
+
diff --git a/fontconfig/fc-lang/sat.orth b/fontconfig/fc-lang/sat.orth
new file mode 100644
index 000000000..d5d91d006
--- /dev/null
+++ b/fontconfig/fc-lang/sat.orth
@@ -0,0 +1,44 @@
+# fontconfig/fc-lang/sat.orth
+#
+# Copyright © 2012 Parag Nemade
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of Keith Packard not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. Keith Packard makes no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# Santali (Devanagari script) (sat)
+#
+# Source: Enhanced inscript: http://pune.cdac.in/html/gist/down/inscript_d.asp
+# Or
+# Source: http://malayalam.kerala.gov.in/images/8/80/Qwerty_enhancedinscriptkeyboardlayout.pdf Page No. 86
+#
+0901-0903 # Various Signs
+0905-090a # Independent vowels
+090f-0910 # Independent vowels
+0913-0914 # Independent vowels
+0915-0928 # Consonants
+092a-0930 # Consonants
+0932-0932 # Consonants
+0935 # Consonants
+0938-0939 # Consonants
+093c-0942 # Various and Dependent vowel signs
+0947-0948 # Dependent vowel signs
+094b-094d # Dependent vowel signs and virama
+0950 # Sign
+0964-0965 # Punctuations
+0966-096F # Digits
+0970 # Abbrevation sign
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index 09c59919d..9395f743d 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -2023,7 +2023,15 @@ FcConfigGlobMatch (const FcChar8 *glob,
return FcTrue;
/* short circuit another common case */
if (strchr ((char *) glob, '*') == 0)
- string += strlen ((char *) string) - strlen ((char *) glob);
+ {
+ size_t l1, l2;
+
+ l1 = strlen ((char *) string);
+ l2 = strlen ((char *) glob);
+ if (l1 < l2)
+ return FcFalse;
+ string += (l1 - l2);
+ }
while (*string)
{
if (FcConfigGlobMatch (glob, string))
diff --git a/fontconfig/src/ftglue.c b/fontconfig/src/ftglue.c
index d5af810b4..7c643d0ff 100644
--- a/fontconfig/src/ftglue.c
+++ b/fontconfig/src/ftglue.c
@@ -82,7 +82,6 @@ ftglue_stream_seek( FT_Stream stream,
{
FT_Error error = 0;
- stream->pos = pos;
if ( stream->read )
{
if ( stream->read( stream, pos, 0, 0 ) )
@@ -91,6 +90,8 @@ ftglue_stream_seek( FT_Stream stream,
else if ( pos > stream->size )
error = FT_Err_Invalid_Stream_Operation;
+ if ( !error )
+ stream->pos = pos;
LOG(( "ftglue:stream:seek(%ld) -> %d\n", pos, error ));
return error;
}
diff --git a/libX11/nls/en_US.UTF-8/Compose.pre b/libX11/nls/en_US.UTF-8/Compose.pre
index b8cb4f7cd..057f6217a 100644
--- a/libX11/nls/en_US.UTF-8/Compose.pre
+++ b/libX11/nls/en_US.UTF-8/Compose.pre
@@ -104,7 +104,7 @@ XCOMM Spaces
<Multi_key> <minus> <d> : "đ" dstroke # LATIN SMALL LETTER D WITH STROKE
<Multi_key> <minus> <D> : "Đ" Dstroke # LATIN CAPITAL LETTER D WITH STROKE
<Multi_key> <s> <s> : "ß" ssharp # LATIN SMALL LETTER SHARP S
-<Multi_key> <S> <S> : "ẞ" Ssharp # LATIN CAPITAL LETTER SHARP S
+<Multi_key> <S> <S> : "ẞ" U1e9e # LATIN CAPITAL LETTER SHARP S
<Multi_key> <o> <e> : "œ" oe # LATIN SMALL LIGATURE OE
<Multi_key> <O> <E> : "Œ" OE # LATIN CAPITAL LIGATURE OE
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index 701e83e78..da8366652 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -894,7 +894,7 @@ struct __DRIdri2ExtensionRec {
* extensions.
*/
#define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 2
+#define __DRI_IMAGE_VERSION 3
/**
* These formats correspond to the similarly named MESA_FORMAT_*
@@ -918,6 +918,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
#define __DRI_IMAGE_ATTRIB_NAME 0x2002
+#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
typedef struct __DRIimageRec __DRIimage;
typedef struct __DRIimageExtensionRec __DRIimageExtension;
diff --git a/mesalib/scons/llvm.py b/mesalib/scons/llvm.py
index 916b040b0..8222c5b45 100644
--- a/mesalib/scons/llvm.py
+++ b/mesalib/scons/llvm.py
@@ -92,7 +92,19 @@ def generate(env):
'HAVE_STDINT_H',
])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
- if llvm_version >= distutils.version.LooseVersion('2.9'):
+ if llvm_version >= distutils.version.LooseVersion('3.0'):
+ # 3.0
+ env.Prepend(LIBS = [
+ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+ 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG',
+ 'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter',
+ 'LLVMX86Utils', 'LLVMX86Info', 'LLVMJIT',
+ 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts',
+ 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+ 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
+ 'LLVMSupport'
+ ])
+ elif llvm_version >= distutils.version.LooseVersion('2.9'):
# 2.9
env.Prepend(LIBS = [
'LLVMObject', 'LLVMMCJIT', 'LLVMMCDisassembler',
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 6a32de619..48808ae08 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -241,7 +241,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
}
if (ctx->has_stream_out) {
- velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ velem[0].src_format = PIPE_FORMAT_R32_UINT;
ctx->velem_state_readbuf = pipe->create_vertex_elements_state(pipe, 1, &velem[0]);
}
@@ -263,8 +263,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
memset(&so, 0, sizeof(so));
so.num_outputs = 1;
- so.output[0].num_components = 4;
- so.stride[0] = 4;
+ so.output[0].num_components = 1;
+ so.stride[0] = 1;
ctx->vs_pos_only =
util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names,
@@ -1247,12 +1247,23 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
struct pipe_vertex_buffer vb;
struct pipe_stream_output_target *so_target;
+ if (srcx >= src->width0 ||
+ dstx >= dst->width0) {
+ return;
+ }
+ if (srcx + size > src->width0) {
+ size = src->width0 - srcx;
+ }
+ if (dstx + size > dst->width0) {
+ size = dst->width0 - dstx;
+ }
+
/* Drivers not capable of Stream Out should not call this function
* in the first place. */
assert(ctx->has_stream_out);
/* Some alignment is required. */
- if (srcx % 4 != 0 || dstx % 4 != 0 || size % 16 != 0 ||
+ if (srcx % 4 != 0 || dstx % 4 != 0 || size % 4 != 0 ||
!ctx->has_stream_out) {
struct pipe_box box;
u_box_1d(srcx, size, &box);
@@ -1277,7 +1288,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
so_target = pipe->create_stream_output_target(pipe, dst, dstx, size);
pipe->set_stream_output_targets(pipe, 1, &so_target, 0);
- util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 16);
+ util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4);
blitter_restore_vertex_states(ctx);
blitter_unset_running_flag(ctx);
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_memory.c b/mesalib/src/gallium/auxiliary/util/u_debug_memory.c
index 36497921e..e24a8bc0b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug_memory.c
+++ b/mesalib/src/gallium/auxiliary/util/u_debug_memory.c
@@ -1,307 +1,316 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * Memory debugging.
- *
- * @author José Fonseca <jrfonseca@tungstengraphics.com>
- */
-
-#include "pipe/p_config.h"
-
-#define DEBUG_MEMORY_IMPLEMENTATION
-
-#include "os/os_memory.h"
-#include "os/os_memory_debug.h"
-
-#include "util/u_debug.h"
-#include "util/u_debug_stack.h"
-#include "util/u_double_list.h"
-
-
-#define DEBUG_MEMORY_MAGIC 0x6e34090aU
-#define DEBUG_MEMORY_STACK 0 /* XXX: disabled until we have symbol lookup */
-
-
-struct debug_memory_header
-{
- struct list_head head;
-
- unsigned long no;
- 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;
-};
-
-struct debug_memory_footer
-{
- unsigned magic;
-};
-
-
-static struct list_head list = { &list, &list };
-
-static unsigned long last_no = 0;
-
-
-static INLINE struct debug_memory_header *
-header_from_data(void *data)
-{
- if(data)
- return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header));
- else
- return NULL;
-}
-
-static INLINE void *
-data_from_header(struct debug_memory_header *hdr)
-{
- if(hdr)
- return (void *)((char *)hdr + sizeof(struct debug_memory_header));
- else
- return NULL;
-}
-
-static INLINE struct debug_memory_footer *
-footer_from_header(struct debug_memory_header *hdr)
-{
- if(hdr)
- return (struct debug_memory_footer *)((char *)hdr + sizeof(struct debug_memory_header) + hdr->size);
- else
- return NULL;
-}
-
-
-void *
-debug_malloc(const char *file, unsigned line, const char *function,
- size_t size)
-{
- struct debug_memory_header *hdr;
- struct debug_memory_footer *ftr;
-
- hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr));
- if(!hdr) {
- debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
- file, line, function,
- (long unsigned)size);
- return NULL;
- }
-
- hdr->no = last_no++;
- hdr->file = file;
- hdr->line = line;
- hdr->function = 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;
-
- LIST_ADDTAIL(&hdr->head, &list);
-
- return data_from_header(hdr);
-}
-
-void
-debug_free(const char *file, unsigned line, const char *function,
- void *ptr)
-{
- struct debug_memory_header *hdr;
- struct debug_memory_footer *ftr;
-
- if(!ptr)
- return;
-
- hdr = header_from_data(ptr);
- if(hdr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: freeing bad or corrupted memory %p\n",
- file, line, function,
- ptr);
- debug_assert(0);
- return;
- }
-
- ftr = footer_from_header(hdr);
- if(ftr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: buffer overflow %p\n",
- hdr->file, hdr->line, hdr->function,
- ptr);
- debug_assert(0);
- }
-
- LIST_DEL(&hdr->head);
- hdr->magic = 0;
- ftr->magic = 0;
-
- os_free(hdr);
-}
-
-void *
-debug_calloc(const char *file, unsigned line, const char *function,
- size_t count, size_t size )
-{
- void *ptr = debug_malloc( file, line, function, count * size );
- if( ptr )
- memset( ptr, 0, count * size );
- return ptr;
-}
-
-void *
-debug_realloc(const char *file, unsigned line, const char *function,
- void *old_ptr, size_t old_size, size_t new_size )
-{
- struct debug_memory_header *old_hdr, *new_hdr;
- struct debug_memory_footer *old_ftr, *new_ftr;
- void *new_ptr;
-
- if(!old_ptr)
- return debug_malloc( file, line, function, new_size );
-
- if(!new_size) {
- debug_free( file, line, function, old_ptr );
- return NULL;
- }
-
- old_hdr = header_from_data(old_ptr);
- if(old_hdr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: reallocating bad or corrupted memory %p\n",
- file, line, function,
- old_ptr);
- debug_assert(0);
- return NULL;
- }
-
- old_ftr = footer_from_header(old_hdr);
- if(old_ftr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: buffer overflow %p\n",
- old_hdr->file, old_hdr->line, old_hdr->function,
- old_ptr);
- debug_assert(0);
- }
-
- /* alloc new */
- new_hdr = os_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
- if(!new_hdr) {
- debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
- file, line, function,
- (long unsigned)new_size);
- return NULL;
- }
- new_hdr->no = old_hdr->no;
- new_hdr->file = old_hdr->file;
- new_hdr->line = old_hdr->line;
- new_hdr->function = old_hdr->function;
- new_hdr->size = new_size;
- new_hdr->magic = DEBUG_MEMORY_MAGIC;
-
- new_ftr = footer_from_header(new_hdr);
- new_ftr->magic = DEBUG_MEMORY_MAGIC;
-
- LIST_REPLACE(&old_hdr->head, &new_hdr->head);
-
- /* copy data */
- new_ptr = data_from_header(new_hdr);
- memcpy( new_ptr, old_ptr, old_size < new_size ? old_size : new_size );
-
- /* free old */
- old_hdr->magic = 0;
- old_ftr->magic = 0;
- os_free(old_hdr);
-
- return new_ptr;
-}
-
-unsigned long
-debug_memory_begin(void)
-{
- return last_no;
-}
-
-void
-debug_memory_end(unsigned long start_no)
-{
- size_t total_size = 0;
- struct list_head *entry;
-
- if(start_no == last_no)
- return;
-
- entry = list.prev;
- for (; entry != &list; entry = entry->prev) {
- struct debug_memory_header *hdr;
- void *ptr;
- struct debug_memory_footer *ftr;
-
- hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
- ptr = data_from_header(hdr);
- ftr = footer_from_header(hdr);
-
- if(hdr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
- hdr->file, hdr->line, hdr->function,
- ptr);
- debug_assert(0);
- }
-
- if((start_no <= hdr->no && hdr->no < last_no) ||
- (last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
- debug_printf("%s:%u:%s: %lu bytes at %p not freed\n",
- hdr->file, hdr->line, hdr->function,
- (unsigned long) hdr->size, ptr);
-#if DEBUG_MEMORY_STACK
- debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
-#endif
- total_size += hdr->size;
- }
-
- if(ftr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: buffer overflow %p\n",
- hdr->file, hdr->line, hdr->function,
- ptr);
- debug_assert(0);
- }
- }
-
- if(total_size) {
- debug_printf("Total of %lu KB of system memory apparently leaked\n",
- (unsigned long) (total_size + 1023)/1024);
- }
- else {
- debug_printf("No memory leaks detected.\n");
- }
-}
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Memory debugging.
+ *
+ * @author José Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+#include "pipe/p_config.h"
+
+#define DEBUG_MEMORY_IMPLEMENTATION
+
+#include "os/os_memory.h"
+#include "os/os_memory_debug.h"
+#include "os/os_thread.h"
+
+#include "util/u_debug.h"
+#include "util/u_debug_stack.h"
+#include "util/u_double_list.h"
+
+
+#define DEBUG_MEMORY_MAGIC 0x6e34090aU
+#define DEBUG_MEMORY_STACK 0 /* XXX: disabled until we have symbol lookup */
+
+
+struct debug_memory_header
+{
+ struct list_head head;
+
+ unsigned long no;
+ 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;
+};
+
+struct debug_memory_footer
+{
+ unsigned magic;
+};
+
+
+static struct list_head list = { &list, &list };
+
+pipe_static_mutex(list_mutex);
+
+static unsigned long last_no = 0;
+
+
+static INLINE struct debug_memory_header *
+header_from_data(void *data)
+{
+ if(data)
+ return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header));
+ else
+ return NULL;
+}
+
+static INLINE void *
+data_from_header(struct debug_memory_header *hdr)
+{
+ if(hdr)
+ return (void *)((char *)hdr + sizeof(struct debug_memory_header));
+ else
+ return NULL;
+}
+
+static INLINE struct debug_memory_footer *
+footer_from_header(struct debug_memory_header *hdr)
+{
+ if(hdr)
+ return (struct debug_memory_footer *)((char *)hdr + sizeof(struct debug_memory_header) + hdr->size);
+ else
+ return NULL;
+}
+
+
+void *
+debug_malloc(const char *file, unsigned line, const char *function,
+ size_t size)
+{
+ struct debug_memory_header *hdr;
+ struct debug_memory_footer *ftr;
+
+ hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr));
+ if(!hdr) {
+ debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
+ file, line, function,
+ (long unsigned)size);
+ return NULL;
+ }
+
+ hdr->no = last_no++;
+ hdr->file = file;
+ hdr->line = line;
+ hdr->function = 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;
+
+ pipe_mutex_lock(list_mutex);
+ LIST_ADDTAIL(&hdr->head, &list);
+ pipe_mutex_unlock(list_mutex);
+
+ return data_from_header(hdr);
+}
+
+void
+debug_free(const char *file, unsigned line, const char *function,
+ void *ptr)
+{
+ struct debug_memory_header *hdr;
+ struct debug_memory_footer *ftr;
+
+ if(!ptr)
+ return;
+
+ hdr = header_from_data(ptr);
+ if(hdr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: freeing bad or corrupted memory %p\n",
+ file, line, function,
+ ptr);
+ debug_assert(0);
+ return;
+ }
+
+ ftr = footer_from_header(hdr);
+ if(ftr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: buffer overflow %p\n",
+ hdr->file, hdr->line, hdr->function,
+ ptr);
+ debug_assert(0);
+ }
+
+ pipe_mutex_lock(list_mutex);
+ LIST_DEL(&hdr->head);
+ pipe_mutex_unlock(list_mutex);
+ hdr->magic = 0;
+ ftr->magic = 0;
+
+ os_free(hdr);
+}
+
+void *
+debug_calloc(const char *file, unsigned line, const char *function,
+ size_t count, size_t size )
+{
+ void *ptr = debug_malloc( file, line, function, count * size );
+ if( ptr )
+ memset( ptr, 0, count * size );
+ return ptr;
+}
+
+void *
+debug_realloc(const char *file, unsigned line, const char *function,
+ void *old_ptr, size_t old_size, size_t new_size )
+{
+ struct debug_memory_header *old_hdr, *new_hdr;
+ struct debug_memory_footer *old_ftr, *new_ftr;
+ void *new_ptr;
+
+ if(!old_ptr)
+ return debug_malloc( file, line, function, new_size );
+
+ if(!new_size) {
+ debug_free( file, line, function, old_ptr );
+ return NULL;
+ }
+
+ old_hdr = header_from_data(old_ptr);
+ if(old_hdr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: reallocating bad or corrupted memory %p\n",
+ file, line, function,
+ old_ptr);
+ debug_assert(0);
+ return NULL;
+ }
+
+ old_ftr = footer_from_header(old_hdr);
+ if(old_ftr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: buffer overflow %p\n",
+ old_hdr->file, old_hdr->line, old_hdr->function,
+ old_ptr);
+ debug_assert(0);
+ }
+
+ /* alloc new */
+ new_hdr = os_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
+ if(!new_hdr) {
+ debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
+ file, line, function,
+ (long unsigned)new_size);
+ return NULL;
+ }
+ new_hdr->no = old_hdr->no;
+ new_hdr->file = old_hdr->file;
+ new_hdr->line = old_hdr->line;
+ new_hdr->function = old_hdr->function;
+ new_hdr->size = new_size;
+ new_hdr->magic = DEBUG_MEMORY_MAGIC;
+
+ new_ftr = footer_from_header(new_hdr);
+ new_ftr->magic = DEBUG_MEMORY_MAGIC;
+
+ pipe_mutex_lock(list_mutex);
+ LIST_REPLACE(&old_hdr->head, &new_hdr->head);
+ pipe_mutex_unlock(list_mutex);
+
+ /* copy data */
+ new_ptr = data_from_header(new_hdr);
+ memcpy( new_ptr, old_ptr, old_size < new_size ? old_size : new_size );
+
+ /* free old */
+ old_hdr->magic = 0;
+ old_ftr->magic = 0;
+ os_free(old_hdr);
+
+ return new_ptr;
+}
+
+unsigned long
+debug_memory_begin(void)
+{
+ return last_no;
+}
+
+void
+debug_memory_end(unsigned long start_no)
+{
+ size_t total_size = 0;
+ struct list_head *entry;
+
+ if(start_no == last_no)
+ return;
+
+ entry = list.prev;
+ for (; entry != &list; entry = entry->prev) {
+ struct debug_memory_header *hdr;
+ void *ptr;
+ struct debug_memory_footer *ftr;
+
+ hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
+ ptr = data_from_header(hdr);
+ ftr = footer_from_header(hdr);
+
+ if(hdr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
+ hdr->file, hdr->line, hdr->function,
+ ptr);
+ debug_assert(0);
+ }
+
+ if((start_no <= hdr->no && hdr->no < last_no) ||
+ (last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
+ debug_printf("%s:%u:%s: %lu bytes at %p not freed\n",
+ hdr->file, hdr->line, hdr->function,
+ (unsigned long) hdr->size, ptr);
+#if DEBUG_MEMORY_STACK
+ debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
+#endif
+ total_size += hdr->size;
+ }
+
+ if(ftr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: buffer overflow %p\n",
+ hdr->file, hdr->line, hdr->function,
+ ptr);
+ debug_assert(0);
+ }
+ }
+
+ if(total_size) {
+ debug_printf("Total of %lu KB of system memory apparently leaked\n",
+ (unsigned long) (total_size + 1023)/1024);
+ }
+ else {
+ debug_printf("No memory leaks detected.\n");
+ }
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index c90dc5707..2fe680ff4 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -135,6 +135,28 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_
*ptr = view;
}
+/**
+ * Similar to pipe_sampler_view_reference() but always set the pointer to
+ * NULL and pass in an explicit context. Passing an explicit context is a
+ * work-around for fixing a dangling context pointer problem when textures
+ * are shared by multiple contexts. XXX fix this someday.
+ */
+static INLINE void
+pipe_sampler_view_release(struct pipe_context *ctx,
+ struct pipe_sampler_view **ptr)
+{
+ struct pipe_sampler_view *old_view = *ptr;
+ if (*ptr && (*ptr)->context != ctx) {
+ debug_printf_once(("context mis-match in pipe_sampler_view_release()\n"));
+ }
+ if (pipe_reference_described(&(*ptr)->reference, NULL,
+ (debug_reference_descriptor)debug_describe_sampler_view)) {
+ ctx->sampler_view_destroy(ctx, old_view);
+ }
+ *ptr = NULL;
+}
+
+
static INLINE void
pipe_so_target_reference(struct pipe_stream_output_target **ptr,
struct pipe_stream_output_target *target)
diff --git a/mesalib/src/gallium/auxiliary/util/u_slab.c b/mesalib/src/gallium/auxiliary/util/u_slab.c
index 2c2175fea..f9f5ef68f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_slab.c
+++ b/mesalib/src/gallium/auxiliary/util/u_slab.c
@@ -1,169 +1,171 @@
-/*
- * Copyright 2010 Marek Olšák <maraeo@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "util/u_slab.h"
-
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "util/u_simple_list.h"
-
-#include <stdio.h>
-
-#define UTIL_SLAB_MAGIC 0xcafe4321
-
-/* The block is either allocated memory or free space. */
-struct util_slab_block {
- /* The header. */
- /* The first next free block. */
- struct util_slab_block *next_free;
-
- intptr_t magic;
-
- /* Memory after the last member is dedicated to the block itself.
- * The allocated size is always larger than this structure. */
-};
-
-static struct util_slab_block *
-util_slab_get_block(struct util_slab_mempool *pool,
- struct util_slab_page *page, unsigned index)
-{
- return (struct util_slab_block*)
- ((uint8_t*)page + sizeof(struct util_slab_page) +
- (pool->block_size * index));
-}
-
-static void util_slab_add_new_page(struct util_slab_mempool *pool)
-{
- struct util_slab_page *page;
- struct util_slab_block *block;
- int i;
-
- page = MALLOC(pool->page_size);
- insert_at_tail(&pool->list, page);
-
- /* Mark all blocks as free. */
- for (i = 0; i < pool->num_blocks-1; i++) {
- block = util_slab_get_block(pool, page, i);
- block->next_free = util_slab_get_block(pool, page, i+1);
- block->magic = UTIL_SLAB_MAGIC;
- }
-
- block = util_slab_get_block(pool, page, pool->num_blocks-1);
- block->next_free = pool->first_free;
- block->magic = UTIL_SLAB_MAGIC;
- pool->first_free = util_slab_get_block(pool, page, 0);
- pool->num_pages++;
-
-#if 0
- fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
-#endif
-}
-
-static void *util_slab_alloc_st(struct util_slab_mempool *pool)
-{
- struct util_slab_block *block;
-
- if (!pool->first_free)
- util_slab_add_new_page(pool);
-
- block = pool->first_free;
- assert(block->magic == UTIL_SLAB_MAGIC);
- pool->first_free = block->next_free;
-
- return (uint8_t*)block + sizeof(struct util_slab_block);
-}
-
-static void util_slab_free_st(struct util_slab_mempool *pool, void *ptr)
-{
- struct util_slab_block *block =
- (struct util_slab_block*)
- ((uint8_t*)ptr - sizeof(struct util_slab_block));
-
- assert(block->magic == UTIL_SLAB_MAGIC);
- block->next_free = pool->first_free;
- pool->first_free = block;
-}
-
-static void *util_slab_alloc_mt(struct util_slab_mempool *pool)
-{
- void *mem;
-
- pipe_mutex_lock(pool->mutex);
- mem = util_slab_alloc_st(pool);
- pipe_mutex_unlock(pool->mutex);
- return mem;
-}
-
-static void util_slab_free_mt(struct util_slab_mempool *pool, void *ptr)
-{
- pipe_mutex_lock(pool->mutex);
- util_slab_free_st(pool, ptr);
- pipe_mutex_unlock(pool->mutex);
-}
-
-void util_slab_set_thread_safety(struct util_slab_mempool *pool,
- enum util_slab_threading threading)
-{
- pool->threading = threading;
-
- if (threading) {
- pool->alloc = util_slab_alloc_mt;
- pool->free = util_slab_free_mt;
- } else {
- pool->alloc = util_slab_alloc_st;
- pool->free = util_slab_free_st;
- }
-}
-
-void util_slab_create(struct util_slab_mempool *pool,
- unsigned item_size,
- unsigned num_blocks,
- enum util_slab_threading threading)
-{
- item_size = align(item_size, sizeof(intptr_t));
-
- pool->num_pages = 0;
- pool->num_blocks = num_blocks;
- pool->block_size = sizeof(struct util_slab_block) + item_size;
- pool->block_size = align(pool->block_size, sizeof(intptr_t));
- pool->page_size = sizeof(struct util_slab_page) +
- num_blocks * pool->block_size;
- pool->first_free = NULL;
-
- make_empty_list(&pool->list);
-
- pipe_mutex_init(pool->mutex);
-
- util_slab_set_thread_safety(pool, threading);
-}
-
-void util_slab_destroy(struct util_slab_mempool *pool)
-{
- struct util_slab_page *page, *temp;
-
- foreach_s(page, temp, &pool->list) {
- remove_from_list(page);
- FREE(page);
- }
-
- pipe_mutex_destroy(pool->mutex);
-}
+/*
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "util/u_slab.h"
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+
+#include <stdio.h>
+
+#define UTIL_SLAB_MAGIC 0xcafe4321
+
+/* The block is either allocated memory or free space. */
+struct util_slab_block {
+ /* The header. */
+ /* The first next free block. */
+ struct util_slab_block *next_free;
+
+ intptr_t magic;
+
+ /* Memory after the last member is dedicated to the block itself.
+ * The allocated size is always larger than this structure. */
+};
+
+static struct util_slab_block *
+util_slab_get_block(struct util_slab_mempool *pool,
+ struct util_slab_page *page, unsigned index)
+{
+ return (struct util_slab_block*)
+ ((uint8_t*)page + sizeof(struct util_slab_page) +
+ (pool->block_size * index));
+}
+
+static void util_slab_add_new_page(struct util_slab_mempool *pool)
+{
+ struct util_slab_page *page;
+ struct util_slab_block *block;
+ int i;
+
+ page = MALLOC(pool->page_size);
+ insert_at_tail(&pool->list, page);
+
+ /* Mark all blocks as free. */
+ for (i = 0; i < pool->num_blocks-1; i++) {
+ block = util_slab_get_block(pool, page, i);
+ block->next_free = util_slab_get_block(pool, page, i+1);
+ block->magic = UTIL_SLAB_MAGIC;
+ }
+
+ block = util_slab_get_block(pool, page, pool->num_blocks-1);
+ block->next_free = pool->first_free;
+ block->magic = UTIL_SLAB_MAGIC;
+ pool->first_free = util_slab_get_block(pool, page, 0);
+ pool->num_pages++;
+
+#if 0
+ fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
+#endif
+}
+
+static void *util_slab_alloc_st(struct util_slab_mempool *pool)
+{
+ struct util_slab_block *block;
+
+ if (!pool->first_free)
+ util_slab_add_new_page(pool);
+
+ block = pool->first_free;
+ assert(block->magic == UTIL_SLAB_MAGIC);
+ pool->first_free = block->next_free;
+
+ return (uint8_t*)block + sizeof(struct util_slab_block);
+}
+
+static void util_slab_free_st(struct util_slab_mempool *pool, void *ptr)
+{
+ struct util_slab_block *block =
+ (struct util_slab_block*)
+ ((uint8_t*)ptr - sizeof(struct util_slab_block));
+
+ assert(block->magic == UTIL_SLAB_MAGIC);
+ block->next_free = pool->first_free;
+ pool->first_free = block;
+}
+
+static void *util_slab_alloc_mt(struct util_slab_mempool *pool)
+{
+ void *mem;
+
+ pipe_mutex_lock(pool->mutex);
+ mem = util_slab_alloc_st(pool);
+ pipe_mutex_unlock(pool->mutex);
+ return mem;
+}
+
+static void util_slab_free_mt(struct util_slab_mempool *pool, void *ptr)
+{
+ pipe_mutex_lock(pool->mutex);
+ util_slab_free_st(pool, ptr);
+ pipe_mutex_unlock(pool->mutex);
+}
+
+void util_slab_set_thread_safety(struct util_slab_mempool *pool,
+ enum util_slab_threading threading)
+{
+ pool->threading = threading;
+
+ if (threading) {
+ pool->alloc = util_slab_alloc_mt;
+ pool->free = util_slab_free_mt;
+ } else {
+ pool->alloc = util_slab_alloc_st;
+ pool->free = util_slab_free_st;
+ }
+}
+
+void util_slab_create(struct util_slab_mempool *pool,
+ unsigned item_size,
+ unsigned num_blocks,
+ enum util_slab_threading threading)
+{
+ item_size = align(item_size, sizeof(intptr_t));
+
+ pool->num_pages = 0;
+ pool->num_blocks = num_blocks;
+ pool->block_size = sizeof(struct util_slab_block) + item_size;
+ pool->block_size = align(pool->block_size, sizeof(intptr_t));
+ pool->page_size = sizeof(struct util_slab_page) +
+ num_blocks * pool->block_size;
+ pool->first_free = NULL;
+
+ make_empty_list(&pool->list);
+
+ pipe_mutex_init(pool->mutex);
+
+ util_slab_set_thread_safety(pool, threading);
+}
+
+void util_slab_destroy(struct util_slab_mempool *pool)
+{
+ struct util_slab_page *page, *temp;
+
+ if (pool->list.next) {
+ foreach_s(page, temp, &pool->list) {
+ remove_from_list(page);
+ FREE(page);
+ }
+ }
+
+ pipe_mutex_destroy(pool->mutex);
+}
diff --git a/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml b/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml
index 8dc827c5a..84e8aa8ae 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml
@@ -4,7 +4,7 @@
<OpenGLAPI>
<category name="GL_ARB_seamless_cube_map" number="65">
- <enum name="TEXTURE_CUBE_MAP_SEAMLESS" count="1" value="0x88F4">
+ <enum name="TEXTURE_CUBE_MAP_SEAMLESS" count="1" value="0x884F">
<size name="Get" mode="get"/>
</enum>
</category>
diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c
index b00a738bc..c92a9a166 100644
--- a/mesalib/src/mesa/main/enums.c
+++ b/mesalib/src/mesa/main/enums.c
@@ -4460,7 +4460,7 @@ static const enum_elt all_enums[2340] =
{ 45645, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
{ 45676, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
{ 45711, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */
- { 45746, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ { 45746, 0x0000884F }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
{ 45775, 0x00008071 }, /* GL_TEXTURE_DEPTH */
{ 45792, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
{ 45814, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
@@ -4723,7 +4723,7 @@ static const enum_elt all_enums[2340] =
{ 52477, 0x00000D17 }, /* GL_ZOOM_Y */
};
-static const unsigned reduced_enums[1571] =
+static const unsigned reduced_enums[1572] =
{
556, /* GL_FALSE */
853, /* GL_LINES */
@@ -5806,6 +5806,7 @@ static const unsigned reduced_enums[1571] =
2038, /* GL_TEXTURE_COMPARE_MODE */
2036, /* GL_TEXTURE_COMPARE_FUNC */
284, /* GL_COMPARE_REF_TO_TEXTURE */
+ 2079, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
1400, /* GL_POINT_SPRITE */
347, /* GL_COORD_REPLACE */
1405, /* GL_POINT_SPRITE_R_MODE_NV */
@@ -5917,7 +5918,7 @@ static const unsigned reduced_enums[1571] =
1368, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
400, /* GL_DEPTH24_STENCIL8 */
2134, /* GL_TEXTURE_STENCIL_SIZE */
- 2079, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ 1096, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
1094, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
1097, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
1101, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 8c51a948e..e8190c392 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -1350,6 +1350,32 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == MESA_FORMAT_ARGB8888 &&
+ srcFormat == GL_LUMINANCE_ALPHA &&
+ baseInternalFormat == GL_RGBA &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* special case of storing LA -> ARGB8888 */
+ int img, row, col;
+ const GLint srcRowStride =
+ _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *srcRow = (const GLubyte *)
+ _mesa_image_address(dims, srcPacking, srcAddr, srcWidth,
+ srcHeight, srcFormat, srcType, img, 0, 0);
+ GLubyte *dstRow = dstSlices[img];
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *d4 = (GLuint *) dstRow;
+ for (col = 0; col < srcWidth; col++) {
+ GLubyte l = srcRow[col * 2 + 0], a = srcRow[col * 2 + 1];
+ d4[col] = PACK_COLOR_8888(a, l, l, l);
+ }
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ }
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
dstFormat == MESA_FORMAT_ARGB8888 &&
srcFormat == GL_RGBA &&
baseInternalFormat == GL_RGBA &&
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 300c3f0eb..953295c0e 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -278,9 +278,16 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
case PIPE_FORMAT_R16G16_UNORM:
strb->Base.InternalFormat = GL_RG16;
break;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ strb->Base.InternalFormat = GL_RGBA32F;
+ break;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+ strb->Base.InternalFormat = GL_RGBA16F;
+ break;
default:
_mesa_problem(NULL,
- "Unexpected format in st_new_renderbuffer_fb");
+ "Unexpected format %s in st_new_renderbuffer_fb",
+ util_format_name(format));
free(strb);
return NULL;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 74ae2d11d..d887455e6 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -137,15 +137,7 @@ st_DeleteTextureObject(struct gl_context *ctx,
if (stObj->pt)
pipe_resource_reference(&stObj->pt, NULL);
if (stObj->sampler_view) {
- if (stObj->sampler_view->context != st->pipe) {
- /* Take "ownership" of this texture sampler view by setting
- * its context pointer to this context. This avoids potential
- * crashes when the texture object is shared among contexts
- * and the original/owner context has already been destroyed.
- */
- stObj->sampler_view->context = st->pipe;
- }
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
}
_mesa_delete_texture_object(ctx, texObj);
}
@@ -450,7 +442,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
/* The parent texture object does not have space for this image */
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory.
@@ -717,7 +709,7 @@ decompress_with_blit(struct gl_context * ctx,
/* destroy the temp / dest surface */
util_destroy_rgba_surface(dst_texture, dst_surface);
- pipe_sampler_view_reference(&src_view, NULL);
+ pipe_sampler_view_release(pipe, &src_view);
}
@@ -1260,7 +1252,7 @@ st_finalize_texture(struct gl_context *ctx,
firstImage->pt != stObj->pt &&
(!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) {
pipe_resource_reference(&stObj->pt, firstImage->pt);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
}
/* Find gallium format for the Mesa texture */
@@ -1300,7 +1292,7 @@ st_finalize_texture(struct gl_context *ctx,
* gallium texture now. We'll make a new one below.
*/
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 72d309300..9718367a8 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -96,6 +96,25 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
swImg->ImageOffsets[i] = i * width * height;
}
+ _swrast_init_texture_image(texImage, width, height, depth);
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Code that overrides ctx->Driver.AllocTextureImageBuffer may use this to
+ * initialize the fields of swrast_texture_image without allocating the image
+ * buffer or initializing ImageOffsets or RowStride.
+ *
+ * Returns GL_TRUE on success, GL_FALSE on memory allocation failure.
+ */
+void
+_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ struct swrast_texture_image *swImg = swrast_texture_image(texImage);
+
if ((width == 1 || _mesa_is_pow_two(texImage->Width2)) &&
(height == 1 || _mesa_is_pow_two(texImage->Height2)) &&
(depth == 1 || _mesa_is_pow_two(texImage->Depth2)))
@@ -115,8 +134,6 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
swImg->HeightScale = (GLfloat) texImage->Height;
swImg->DepthScale = (GLfloat) texImage->Depth;
}
-
- return GL_TRUE;
}
diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h
index 468d22f0b..ad19eeecc 100644
--- a/mesalib/src/mesa/swrast/swrast.h
+++ b/mesalib/src/mesa/swrast/swrast.h
@@ -192,6 +192,10 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
GLsizei height, GLsizei depth);
extern void
+_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
+ GLsizei height, GLsizei depth);
+
+extern void
_swrast_free_texture_image_buffer(struct gl_context *ctx,
struct gl_texture_image *texImage);
diff --git a/pixman/pixman/pixman-mmx.c b/pixman/pixman/pixman-mmx.c
index 09b20773c..a3500ce7d 100644
--- a/pixman/pixman/pixman-mmx.c
+++ b/pixman/pixman/pixman-mmx.c
@@ -63,7 +63,7 @@ _mm_empty (void)
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_mulhi_pu16 (__m64 __A, __m64 __B)
{
- asm("pmulhuw %1, %0\n\t"
+ asm ("pmulhuw %1, %0\n\t"
: "+y" (__A)
: "y" (__B)
);
@@ -75,7 +75,7 @@ _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
{
__m64 ret;
- asm("pshufw %2, %1, %0\n\t"
+ asm ("pshufw %2, %1, %0\n\t"
: "=y" (ret)
: "y" (__A), "K" (__N)
);
@@ -259,19 +259,19 @@ pix_add (__m64 a, __m64 b)
static force_inline __m64
expand_alpha (__m64 pixel)
{
- return _mm_shuffle_pi16(pixel, _MM_SHUFFLE (3, 3, 3, 3));
+ return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE (3, 3, 3, 3));
}
static force_inline __m64
expand_alpha_rev (__m64 pixel)
{
- return _mm_shuffle_pi16(pixel, _MM_SHUFFLE (0, 0, 0, 0));
+ return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE (0, 0, 0, 0));
}
static force_inline __m64
invert_colors (__m64 pixel)
{
- return _mm_shuffle_pi16(pixel, _MM_SHUFFLE (3, 0, 1, 2));
+ return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE (3, 0, 1, 2));
}
static force_inline __m64
@@ -297,14 +297,6 @@ in (__m64 src, __m64 mask)
return pix_multiply (src, mask);
}
-static force_inline __m64
-in_over_full_src_alpha (__m64 src, __m64 mask, __m64 dest)
-{
- src = _mm_or_si64 (src, MC (full_alpha));
-
- return over (in (src, mask), mask, dest);
-}
-
#ifndef _MSC_VER
static force_inline __m64
in_over (__m64 src, __m64 srca, __m64 mask, __m64 dest)
@@ -3029,7 +3021,6 @@ mmx_composite_copy_area (pixman_implementation_t *imp,
src_x, src_y, dest_x, dest_y, width, height);
}
-#ifdef USE_ARM_IWMMXT
static void
mmx_composite_over_x888_8_8888 (pixman_implementation_t *imp,
pixman_composite_info_t *info)
@@ -3086,7 +3077,6 @@ mmx_composite_over_x888_8_8888 (pixman_implementation_t *imp,
_mm_empty ();
}
-#endif
static const pixman_fast_path_t mmx_fast_paths[] =
{
@@ -3116,15 +3106,10 @@ static const pixman_fast_path_t mmx_fast_paths[] =
PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, x8r8g8b8, mmx_composite_over_8888_n_8888 ),
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, a8b8g8r8, mmx_composite_over_8888_n_8888 ),
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, x8b8g8r8, mmx_composite_over_8888_n_8888 ),
-#ifdef USE_ARM_IWMMXT
- /* FIXME: This code is commented out since it's apparently
- * not actually faster than the generic code on x86.
- */
PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, a8, x8r8g8b8, mmx_composite_over_x888_8_8888 ),
PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, a8, a8r8g8b8, mmx_composite_over_x888_8_8888 ),
PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, a8, x8b8g8r8, mmx_composite_over_x888_8_8888 ),
PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, a8, a8b8g8r8, mmx_composite_over_x888_8_8888 ),
-#endif
PIXMAN_STD_FAST_PATH (OVER, solid, null, a8r8g8b8, mmx_composite_over_n_8888 ),
PIXMAN_STD_FAST_PATH (OVER, solid, null, x8r8g8b8, mmx_composite_over_n_8888 ),
PIXMAN_STD_FAST_PATH (OVER, solid, null, r5g6b5, mmx_composite_over_n_0565 ),
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 9998845d0..924479582 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3449,21 +3449,16 @@ XineramaWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
int x, y, rc;
- DeviceIntPtr dev;
- SpritePtr pSprite;
+ SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
REQUEST(xWarpPointerReq);
+
if (stuff->dstWid != None) {
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
}
-
- /* Post through the XTest device */
- dev = PickPointer(client);
- dev = GetXTestDevice(dev);
- pSprite = dev->spriteInfo->sprite;
x = pSprite->hotPhys.x;
y = pSprite->hotPhys.y;
@@ -3513,9 +3508,9 @@ XineramaWarpPointer(ClientPtr client)
else if (y >= pSprite->physLimits.y2)
y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
- ConfineToShape(dev, pSprite->hotShape, &x, &y);
+ ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
- XineramaSetCursorPosition(dev, x, y, TRUE);
+ XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
return Success;
}
@@ -3533,7 +3528,7 @@ ProcWarpPointer(ClientPtr client)
WindowPtr dest = NULL;
int x, y, rc;
ScreenPtr newScreen;
- DeviceIntPtr dev, tmp, xtest_dev = NULL;
+ DeviceIntPtr dev, tmp;
SpritePtr pSprite;
REQUEST(xWarpPointerReq);
@@ -3546,13 +3541,11 @@ ProcWarpPointer(ClientPtr client)
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
if (rc != Success)
return rc;
- if (IsXTestDevice(tmp, dev))
- xtest_dev = tmp;
}
}
- /* Use the XTest device to actually move the pointer */
- dev = xtest_dev;
+ if (dev->lastSlave)
+ dev = dev->lastSlave;
pSprite = dev->spriteInfo->sprite;
#ifdef PANORAMIX
diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m
index 5b38eae32..048e7875b 100644
--- a/xorg-server/hw/xquartz/X11Application.m
+++ b/xorg-server/hw/xquartz/X11Application.m
@@ -191,6 +191,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
}
- (void) activateX:(OSX_BOOL)state {
+ if (_x_active == state)
+ return;
+
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active);
if (state) {
if(bgMouseLocationUpdated) {
diff --git a/xorg-server/hw/xquartz/bundle/mk_bundke.sh b/xorg-server/hw/xquartz/bundle/mk_bundke.sh
index 37e555f9e..288c6a9de 100644
--- a/xorg-server/hw/xquartz/bundle/mk_bundke.sh
+++ b/xorg-server/hw/xquartz/bundle/mk_bundke.sh
@@ -1,31 +1,31 @@
-#!/bin/sh
-#
-# 'Cause xcodebuild is hard to deal with
-
-SRCDIR=$1
-BUILDDIR=$2
-BUNDLE_ROOT=$3
-
-localities="Dutch English French German Italian Japanese Spanish da fi ko no pl pt pt_PT ru sv zh_CN zh_TW"
-for lang in ${localities} ; do
- [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj ] && rm -rf ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj
- mkdir -p ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib
- [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib ] || exit 1
-
- for f in InfoPlist.strings Localizable.strings main.nib/keyedobjects.nib ; do
- install -m 644 ${SRCDIR}/Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f}
- done
-done
-
-install -m 644 ${SRCDIR}/Resources/English.lproj/main.nib/designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib
-install -m 644 ${SRCDIR}/Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources
-
-install -m 644 ${BUILDDIR}/Info.plist ${BUNDLE_ROOT}/Contents
-install -m 644 ${SRCDIR}/PkgInfo ${BUNDLE_ROOT}/Contents
-
-mkdir -p ${BUNDLE_ROOT}/Contents/MacOS
-install -m 755 ${SRCDIR}/X11.sh ${BUNDLE_ROOT}/Contents/MacOS/X11
-
-if [[ $(id -u) == 0 ]] ; then
- chown -R root:admin ${BUNDLE_ROOT}
-fi
+#!/bin/sh
+#
+# 'Cause xcodebuild is hard to deal with
+
+SRCDIR=$1
+BUILDDIR=$2
+BUNDLE_ROOT=$3
+
+localities="Dutch English French German Italian Japanese Spanish ar ca cs da el fi he hr hu ko no pl pt pt_PT ro ru sk sv th tr uk zh_CN zh_TW"
+for lang in ${localities} ; do
+ [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj ] && rm -rf ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj
+ mkdir -p ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib
+ [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib ] || exit 1
+
+ for f in InfoPlist.strings Localizable.strings main.nib/keyedobjects.nib ; do
+ install -m 644 ${SRCDIR}/Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f}
+ done
+done
+
+install -m 644 ${SRCDIR}/Resources/English.lproj/main.nib/designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib
+install -m 644 ${SRCDIR}/Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources
+
+install -m 644 ${BUILDDIR}/Info.plist ${BUNDLE_ROOT}/Contents
+install -m 644 ${SRCDIR}/PkgInfo ${BUNDLE_ROOT}/Contents
+
+mkdir -p ${BUNDLE_ROOT}/Contents/MacOS
+install -m 755 ${SRCDIR}/X11.sh ${BUNDLE_ROOT}/Contents/MacOS/X11
+
+if [[ $(id -u) == 0 ]] ; then
+ chown -R root:admin ${BUNDLE_ROOT}
+fi